llvm-mos-sdk
c64
c64.h
Go to the documentation of this file.
1
// Copyright 2022 LLVM-MOS Project
2
// Licensed under the Apache License, Version 2.0 with LLVM Exceptions.
3
// See https://github.com/llvm-mos/llvm-mos-sdk/blob/main/LICENSE for license
4
// information.
5
6
// Originally from cc65. Modified from original version.
7
8
// clang-format off
9
10
/*****************************************************************************/
11
/* */
12
/* c64.h */
13
/* */
14
/* C64 system-specific definitions */
15
/* */
16
/* */
17
/* */
18
/* (C) 1998-2013 Ullrich von Bassewitz */
19
/* Roemerstrasse 52 */
20
/* D-70794 Filderstadt */
21
/* EMail: uz@cc65.org */
22
/* */
23
/* */
24
/* This software is provided 'as-is', without any expressed or implied */
25
/* warranty. In no event will the authors be held liable for any damages */
26
/* arising from the use of this software. */
27
/* */
28
/* Permission is granted to anyone to use this software for any purpose, */
29
/* including commercial applications, and to alter it and redistribute it */
30
/* freely, subject to the following restrictions: */
31
/* */
32
/* 1. The origin of this software must not be misrepresented; you must not */
33
/* claim that you wrote the original software. If you use this software */
34
/* in a product, an acknowledgment in the product documentation would be */
35
/* appreciated but is not required. */
36
/* 2. Altered source versions must be plainly marked as such, and must not */
37
/* be misrepresented as being the original software. */
38
/* 3. This notice may not be removed or altered from any source */
39
/* distribution. */
40
/* */
41
/*****************************************************************************/
42
43
44
45
#ifndef _C64_H
46
#define _C64_H
47
48
49
50
/* Check for errors */
51
#if !defined(__C64__)
52
# error This module may only be used when compiling for the C64!
53
#endif
54
55
56
57
/*****************************************************************************/
58
/* Data */
59
/*****************************************************************************/
60
61
62
63
/* Additional key defines */
64
#define CH_F1 133
65
#define CH_F2 137
66
#define CH_F3 134
67
#define CH_F4 138
68
#define CH_F5 135
69
#define CH_F6 139
70
#define CH_F7 136
71
#define CH_F8 140
72
73
/* Color defines */
74
#define COLOR_BLACK 0x00
75
#define COLOR_WHITE 0x01
76
#define COLOR_RED 0x02
77
#define COLOR_CYAN 0x03
78
#define COLOR_PURPLE 0x04
79
#define COLOR_GREEN 0x05
80
#define COLOR_BLUE 0x06
81
#define COLOR_YELLOW 0x07
82
#define COLOR_ORANGE 0x08
83
#define COLOR_BROWN 0x09
84
#define COLOR_LIGHTRED 0x0A
85
#define COLOR_GRAY1 0x0B
86
#define COLOR_GRAY2 0x0C
87
#define COLOR_LIGHTGREEN 0x0D
88
#define COLOR_LIGHTBLUE 0x0E
89
#define COLOR_GRAY3 0x0F
90
91
/* Masks for joy_read */
92
#define JOY_UP_MASK 0x01
93
#define JOY_DOWN_MASK 0x02
94
#define JOY_LEFT_MASK 0x04
95
#define JOY_RIGHT_MASK 0x08
96
#define JOY_BTN_1_MASK 0x10
97
98
/* Define hardware */
99
#include <
_vic2.h
>
100
#define VIC (*(volatile struct __vic2*)0xD000)
101
102
#include <
_sid.h
>
103
#define SID (*(volatile struct __sid*)0xD400)
104
105
#include <
_6526.h
>
106
#define CIA1 (*(volatile struct __6526*)0xDC00)
107
#define CIA2 (*(volatile struct __6526*)0xDD00)
108
109
/* Define special memory areas */
110
#define COLOR_RAM ((volatile unsigned char*)0xD800)
111
112
// TODO
113
#if 0
114
/* Return codes for get_ostype */
115
#define C64_OS_US 0xAA
/* US version */
116
#define C64_OS_PET64 0x64
/* PET 64 */
117
#define C64_OS_SX64 0x43
/* SX-64 */
118
#define C64_EU_NEW 0x03
119
#define C64_EU_OLD 0x00
120
#define C64_DTV 0xFF
/* C64 DTV */
121
122
123
124
/*****************************************************************************/
125
/* Code */
126
/*****************************************************************************/
127
128
129
130
unsigned
char
get_ostype
(
void
);
131
/* Get the ROM version. Returns one of the C64_OS_xxx codes. */
132
#endif
133
134
135
136
/* End of c64.h */
137
#endif
get_ostype
signed char get_ostype(void) __attribute__((leaf))
_sid.h
_6526.h
_vic2.h
Generated by
1.8.17