Debian Codegraph @

ACME_Lib/cbm/264/ted.a

raw
1 ;ACME 0.96.4
2
3 !ifdef lib_cbm_264_ted_a !eof
4 lib_cbm_264_ted_a = 1
5
6 ; Text Display (TED) 7360/8360
7
8 ; Definitions:
9 ; HiRes: High resolution (320x200 pixels, two colors per 8x8 block)
10 ; MCM: Multi-color mode (160x200 pixels, four colors per 4x8 block)
11 ; Text mode: Pixel data is taken from charset, index/color/luminance is
12 ; taken from video ram.
13 ; Bitmap mode: Pixel data is taken from 8 KiB bitmap, color/luminance is taken
14 ; from video ram.
15 ; ECM: Extended color mode. Like HiRes text mode, but instead of 256
16 ; different characters on a shared background color, 64 different
17 ; characters on four different background colors are displayed.
18 ; MC text mode is actually a mixed mode: each character position has its own
19 ; bit to decide whether it is displayed in HiRes or MC.
20
21 ; info taken from
22 ; http://mclauchlan.site.net.au/scott/C=Hacking/C-Hacking12/gfx.html (Document Revision B)
23 ; http://www.zimmers.net/anonftp/pub/cbm/maps/C16.MemoryMap
24
25 ; Video RAM is $0800 bytes
26 ; in text mode:
27 ; first $0400 bytes is color/luminance info:
28 ; %7....... flash (ignored in MCM and ECM)
29 ; %.654.... luminance
30 ; %....3... MCM: multicolor flag
31 ; %.....210 MCM: color
32 ; %....3210 HiRes and ECM: color
33 ; second $0400 bytes hold screen codes:
34 ; %76543210 HiRes and MCM: screen code (in HiRes, bit 7 can
35 ; be configured to be "hardware reverse",
36 ; see register $ff07)
37 ; %76...... ECM: background color index (see registers
38 ; $ff15..$ff18)
39 ; %..543210 ECM: screen code
40 ; in bitmap mode:
41 ; CAUTION!
42 ; LOW nibble of luma corresponds to HIGH nibble of color and vice versa!
43 ; first $0400 bytes is luminance info:
44 ; %7....... unused
45 ; %.654.... luminance of %0 HiRes pixels or %01 MC pixels
46 ; %....3... unused
47 ; %.....210 luminance of %1 HiRes pixels or %10 MC pixels
48 ; second $0400 bytes is color info:
49 ; %7654.... color of %1 pixels or %10 MC pixels
50 ; %....3210 color of %0 pixels or %01 MC pixels
51
52 ; colors:
53 tedcolor_BLACK = $0 ; ignores luminance, black is always black!
54 tedcolor_WHITE = $1 ; actually gray, only max luminance gives white
55 tedcolor_RED = $2
56 tedcolor_CYAN = $3
57 tedcolor_PURPLE = $4
58 tedcolor_GREEN = $5
59 tedcolor_BLUE = $6
60 tedcolor_YELLOW = $7 ; needs high luminance to look yellow...
61 ; these cannot be used as main color in MCM:
62 tedcolor_ORANGE = $8
63 tedcolor_BROWN = $9
64 tedcolor_YELLOWGREEN = $a
65 tedcolor_PINK = $b
66 tedcolor_BLUEGREEN = $c
67 tedcolor_LIGHTBLUE = $d
68 tedcolor_DARKBLUE = $e
69 tedcolor_LIGHTGREEN = $f
70 ; the color names are somewhat useless, because they refer not to the sixteen
71 ; base colors, but to the sixteen pre-defined luminance/color combinations
72 ; available by pressing the ctrl or cbm key with a digit key (see the ROM table
73 ; at $e143 for these combined values).
74 ; for a "nice" color display, use this order: 2,8,9,7,a,f,5,c,3,d,6,e,4,b,
75 ; that will give a red/yellow/green/blue/purple spectrum.
76 ; to display the whole palette, try this program:
77 ; 10 for i = 0 to 15:color 1, 1
78 ; 20 read c$:print " " c$ " ";
79 ; 30 poke 194, 128:for lu = 0 to 7
80 ; 40 color 1, dec(c$) + 1, lu
81 ; 50 print " ";
82 ; 60 next:print:next:color 1, 1
83 ; 70 data 0,1,2,8,9,7,a,f
84 ; 80 data 5,c,3,d,6,e,4,b
85
86 ; TED registers
87 !addr ted_base = $ff00
88
89 ; timers
90 ted_timer1_lo = ted_base + $00 ; decrements from the last value written into it
91 ted_timer1_hi = ted_base + $01
92 ted_timer2_lo = ted_base + $02 ; runs freely from $ffff
93 ted_timer2_hi = ted_base + $03
94 ted_timer3_lo = ted_base + $04 ; runs freely from $ffff
95 ted_timer3_hi = ted_base + $05
96
97 ; mode bits
98 ted_vertctrl = ted_base + $06 ; mostly the same as VIC's $d011
99 tedvert_TEST = %#....... ; internal test, it should be 0
100 tedvert_EBCM = %.#...... ; extended background color mode
101 tedvert_BITMAP = %..#..... ; bitmap mode
102 tedvert_ENABLE = %...#.... ; display enable (0: blank screen)
103 tedvert_25ROWS = %....#... ; 0: 24 rows, 1: 25 rows
104 tedvert_SMOOTH = %.....### ; vertical smooth scroll (std: %011, higher values move text down)
105
106 ted_horzctrl = ted_base + $07 ; most similar VIC-reg is $d016
107 tedhorz_256CHRS = %#....... ; 0: 128 characters and hardware reverse, 1: 256 characters
108 tedhorz_NTSC = %.#...... ; 0: PAL, 1: NTSC
109 tedhorz_FREEZE = %..#..... ; if set, TED stops its counters and screen-generating, only single clock and refresh cycles remain.
110 tedhorz_MULTI = %...#.... ; multicolor mode
111 tedhorz_40COLS = %....#... ; 0: 38 columns, 1: 40 columns
112 tedhorz_SMOOTH = %.....### ; horizontal smooth scroll (std: %000, higher values move text right)
113
114 ; i/o
115 ted_keyboard = ted_base + $08 ; keyboard input latch (write to trigger sampling, then read input byte)
116 ; to scan keyboard, write output byte to $fd30, then write $ff here (to disable joysticks) and read input byte.
117 ; to scan joysticks, write $ff to $fd30 (to disable keyboard), then write SELECT value here and read input byte.
118 tedjoy1_SELECT = %#####.## ; d2 low selects joy #1
119 tedjoy2_SELECT = %######.# ; d1 low selects joy #2
120 ; CAUTION, the joystick bits are low-active, so invert input byte before using these:
121 tedjoy2_FIRE = %#.......
122 tedjoy1_FIRE = %.#......
123 tedjoy_RIGHT = %....#...
124 tedjoy_LEFT = %.....#..
125 tedjoy_DOWN = %......#.
126 tedjoy_UP = %.......#
127
128 ; interrupts
129 ted_irq = ted_base + $09 ; interrupt request register
130 ; if bit is set, interrupt has occurred.
131 ; to acknowledge interrupts, write back the value read from this register
132 ; (setting bits clears them, i.e. writing $82 clears ACTIVE and RASTER
133 ; but does not change the COUNTER bits)
134 tedirq_ACTIVE = %#....... ; 1: TED is signalling interrupt to cpu
135 tedirq_COUNTER3 = %.#...... ; 1: counter #3 underflow
136 ; %..#..... ; always 1 (unused)
137 tedirq_COUNTER2 = %...#.... ; 1: counter #2 underflow
138 tedirq_COUNTER1 = %....#... ; 1: counter #1 underflow
139 ; %.....#.. ; always 1 (light pen, not implemented)
140 tedirq_RASTER = %......#. ; 1: raster line reached
141 ; %.......# ; always 1 (unused)
142
143 ted_mask = ted_base + $0a ; interrupt mask register (enable/disable)
144 ; if bit is set, interrupt is enabled.
145 ; use the tedirq_* constants from above.
146 ; %#....... ; always 1 (unused)
147 ;COUNTER3 = %.#...... ; 1: enable counter #3 underflow interrupt
148 ; = %..#..... ; always 1 (unused)
149 ;COUNTER2 = %...#.... ; 1: enable counter #2 underflow interrupt
150 ;COUNTER1 = %....#... ; 1: enable counter #1 underflow interrupt
151 ; = %.....#.. ; always 1 (light pen, not implemented)
152 ;RASTER = %......#. ; 1: enable raster line interrupt
153 tedmask_LINEBIT8= %.......# ; bit 8 of raster line register $ff0b (see below)
154
155 ted_line = ted_base + $0b ; raster line to trigger interrupt. bit 8 is in bit 0 of $ff0a (see above)
156
157 ; hardware cursor, given as screen offset (0...999). use 1000 or greater to hide.
158 ted_hwcursor_hi = ted_base + $0c ; %765432.. are unused, %......10 are MSBs of hw cursor offset
159 ted_hwcursor_lo = ted_base + $0d ; hardware cursor offset (low byte)
160
161 ; sound
162 ; to calculate the register values:
163 ; NTSC: reg = 1024 - (111860.781 / frequency_in_Hz)
164 ; PAL: reg = 1024 - (111840.45 / frequency_in_Hz)
165 ted_sound1_low = ted_base + $0e ; low 8 bits of voice #1 frequency
166 ted_sound2_low = ted_base + $0f ; low 8 bits of voice #2 frequency
167 ted_sound2_hi = ted_base + $10 ; bits 7..2 are unused, bits 1..0 are the highmost 2 bits of voice #2 frequency
168 ted_sound_ctrl = ted_base + $11 ; sound control register
169 tedsound_DA = %#....... ; D/A mode (sound reload)
170 tedsound_NOISE2 = %.#...... ; voice #2 noise on/off
171 tedsound_SQUARE2= %..#..... ; voice #2 square wave on/off (if you set both, the square will sound)
172 tedsound_ONOFF1 = %...#.... ; voice #1 on/off
173 tedsound_VOLUME = %....#### ; volume, maximum value is 8
174
175 ted_misc = ted_base + $12 ; some memory and some sound bits:
176 ; = %##...... ; unused
177 tedmisc_BITMAP = %..###... ; a15/a14/a13 of bitmap in memory
178 tedmisc_ROMCHAR = %.....#.. ; 0: charset is in RAM, 1: charset is in ROM
179 tedmisc_SOUNDMSB= %......## ; highmost bits of voice #1 frequency
180
181 ted_mem = ted_base + $13 ;
182 tedmem_CHARGEN = %######.. ; high address bits of character generator
183 tedmem_SCLOCK = %......#. ; 1: force single clock mode
184 tedmem_ROM = %.......# ; read-only: ROM is active over $8000
185
186 ted_videoram = ted_base + $14 ; bits 7..3 are the high address bits of video ram
187
188 ; color registers
189 ; %7....... unused
190 ; %.654.... luminance
191 ; %....3210 color
192 ted_background = ted_base + $15 ; color for %00 pixels (or %0 in HiRes)
193 ted_color1 = ted_base + $16 ; color for %01 pixels (MCM and ECM)
194 ted_color2 = ted_base + $17 ; color for %10 pixels (MCM and ECM)
195 ted_color3 = ted_base + $18 ; color for %11 pixels (MCM graphics and ECM)
196 ted_border = ted_base + $19
197
198 ; current character position
199 ted_charpos_hi = ted_base + $1a ; bits 1..0 are highmost bits
200 ted_charpos_lo = ted_base + $1b ; low bits of actual character position
201
202 ; current raster position (writable!)
203 ted_vertical_hi = ted_base + $1c ; bit 0 is msb of raster line
204 ted_vertical_lo = ted_base + $1d ; low 8 bits of raster line
205 ted_horizontal = ted_base + $1e ; horizontal position (given in double pixels)
206
207 ted_count = ted_base + $1f
208 ; = %#....... ; always 1 (unused)
209 tedcount_FLASH = %.####... ; flashing counter
210 tedcount_CHAR = %.....### ; raster line in character row (r/w!)
211
212 ; pseudo registers
213 ; these are not really registers inside TED, but here they are, anyway:
214 !addr ted_enable_roms = $ff3e ; any write here enables ROMs above $8000
215 !addr ted_enable_rams = $ff3f ; any write here enables RAM above $8000