1;* ======================================================================== *;
2;*  The routines and data in this file (gimini.asm) are dedicated to the    *;
3;*  public domain via the Creative Commons CC0 v1.0 license by its author,  *;
4;*  Joseph Zbiciak.                                                         *;
5;*                                                                          *;
6;*          https://creativecommons.org/publicdomain/zero/1.0/              *;
7;* ======================================================================== *;
8
9;;==========================================================================;;
10;; GIMINI structure definitions.  Defines the memory map and peripherals.   ;;
11;;==========================================================================;;
12
13;; ======================================================================== ;;
14;;  Overall Memory Map                                                      ;;
15;;  MEMMAP -- Structure containing overall system memory map.               ;;
16;; ======================================================================== ;;
17MEMMAP          STRUCT  0
18@@stic          QEQU    $0000 ;..$003F  ; Standard Television Interface Circuit
19@@voice         QEQU    $0080 ;..$0081  ; Voice Synthesizer
20@@psg1          QEQU    $00F0 ;..$00FF  ; Secondary Programmable Sound Gen.
21@@dataram       QEQU    $0100 ;..$01EF  ; 8-bit Data RAM
22@@psg0          QEQU    $01F0 ;..$01FF  ; Primary Programmable Sound Generator
23@@backtab       QEQU    $0200 ;..$02EF  ; 16-bit Display RAM
24@@sysram        QEQU    $02F0 ;..$035F  ; 16-bit System RAM (incl. Stack)
25@@exec2         QEQU    $0400 ;..$04FF  ; Executive ROM expansion
26@@exec          QEQU    $1000 ;..$1FFF  ; Executive ROM
27@@grom          QEQU    $3000 ;..$37FF  ; Graphics ROM
28@@gram          QEQU    $3800 ;..$39FF  ; Graphics RAM
29@@gram_alias1   QEQU    $3A00 ;..$3BFF  ; Graphics RAM alias
30@@gram_alias2   QEQU    $3C00 ;..$3DFF  ; Graphics RAM alias
31@@gram_alias3   QEQU    $3E00 ;..$3FFF  ; Graphics RAM alias
32@@stic_alias1   QEQU    $4000 ;..$403F  ; STIC alias (incomplete decode)
33@@stic_alias2   QEQU    $8000 ;..$803F  ; STIC alias (incomplete decode)
34                ENDS
35
36
37
38;;==========================================================================;;
39;; AY8914 Programmable Sound Generator Register Definitions.                ;;
40;;                                                                          ;;
41;; PSG0 -- Primary PSG in the Gimini Console.                               ;;
42;; PSG1 -- Secondary PSG, available when expansion is attached.             ;;
43;; PSG  -- Constants and bitfields common to both PSG's.                    ;;
44;;                                                                          ;;
45;; Each PSG contains the following set of registers:                        ;;
46;;                                                                          ;;
47;;     Register pairs:                                                      ;;
48;;                                                                          ;;
49;;       7   6   5   4   3   2   1   0 | 7   6   5   4   3   2   1   0      ;;
50;;     +---------------+---------------|-------------------------------+    ;;
51;;  R4 |    unused     |                Channel A Period               | R0 ;;
52;;     +---------------+---------------|-------------------------------+    ;;
53;;  R5 |    unused     |                Channel B Period               | R1 ;;
54;;     +---------------+---------------|-------------------------------+    ;;
55;;  R6 |    unused     |                Channel C Period               | R2 ;;
56;;     +---------------+---------------|-------------------------------+    ;;
57;;  R7 |                        Envelope Period                        | R3 ;;
58;;     +-------------------------------|-------+-----------------------+    ;;
59;;                                                                          ;;
60;;     Single registers:                                                    ;;
61;;                                                                          ;;
62;;         7       6       5       4       3       2       1       0        ;;
63;;     +---------------+-----------------------+-----------------------+    ;;
64;;     | I/O Port Dir  |    Noise Enables      |     Tone Enables      |    ;;
65;;  R8 |   0   |   0   |   C   |   B   |   A   |   C   |   B   |   A   |    ;;
66;;     +-------+-------+-------+-------+-------+-------+-------+-------+    ;;
67;;  R9 |            unused     |              Noise Period             |    ;;
68;;     +-----------------------+-------+-------+-------+-------+-------+    ;;
69;;     |                               |   Envelope Characteristics    |    ;;
70;; R10 |            unused             | CONT  |ATTACK | ALTER | HOLD  |    ;;
71;;     +---------------+---------------+-------+-------+-------+-------+    ;;
72;; R11 |    unused     | A Envl Select |    Channel A Volume Level     |    ;;
73;;     +---------------+---------------+-------------------------------+    ;;
74;; R12 |    unused     | B Envl Select |    Channel B Volume Level     |    ;;
75;;     +---------------+---------------+-------------------------------+    ;;
76;; R13 |    unused     | C Envl Select |    Channel C Volume Level     |    ;;
77;;     +---------------+---------------+-------------------------------+    ;;
78;;                                                                          ;;
79;;==========================================================================;;
80
81                ;;==========================================================;;
82                ;; Primary PSG in the main console.                         ;;
83                ;;==========================================================;;
84PSG0            STRUCT  $01F0
85
86                ;;----------------------------------------------------------;;
87                ;; Register address definitions                             ;;
88                ;;----------------------------------------------------------;;
89@@chn_a_lo      QEQU    $ + 0   ; Channel A period, lower 8 bits of 12
90@@chn_b_lo      QEQU    $ + 1   ; Channel B period, lower 8 bits of 12
91@@chn_c_lo      QEQU    $ + 2   ; Channel C period, lower 8 bits of 12
92@@envlp_lo      QEQU    $ + 3   ; Envelope period,  lower 8 bits of 16
93
94@@chn_a_hi      QEQU    $ + 4   ; Channel A period, upper 4 bits of 12
95@@chn_b_hi      QEQU    $ + 5   ; Channel B period, upper 4 bits of 12
96@@chn_c_hi      QEQU    $ + 6   ; Channel C period, upper 4 bits of 12
97@@envlp_hi      QEQU    $ + 7   ; Envelope period,  upper 8 bits of 16
98
99@@chan_enable   QEQU    $ + 8   ; Channel enables (bits 3-5 noise, 0-2 tone)
100@@noise         QEQU    $ + 9   ; Noise period (5 bits)
101@@envelope      QEQU    $ + 10  ; Envelope type/trigger (4 bits)
102
103@@chn_a_vol     QEQU    $ + 11  ; Channel A volume / Envelope select (6 bits)
104@@chn_b_vol     QEQU    $ + 12  ; Channel B volume / Envelope select (6 bits)
105@@chn_c_vol     QEQU    $ + 13  ; Channel C volume / Envelope select (6 bits)
106
107@@io_port0      QEQU    $ + 14  ; I/O port 0 (8 bits)
108@@io_port1      QEQU    $ + 15  ; I/O port 1 (8 bits)
109
110                ENDS
111
112                ;;==========================================================;;
113                ;; Secondary PSG in the expansion unit.                     ;;
114                ;;==========================================================;;
115PSG1            STRUCT  $00F0
116
117                ;;----------------------------------------------------------;;
118                ;; Register address definitions                             ;;
119                ;;----------------------------------------------------------;;
120@@chn_a_lo      QEQU    $ + 0   ; Channel A period, lower 8 bits of 12
121@@chn_b_lo      QEQU    $ + 1   ; Channel B period, lower 8 bits of 12
122@@chn_c_lo      QEQU    $ + 2   ; Channel C period, lower 8 bits of 12
123@@envlp_lo      QEQU    $ + 3   ; Envelope period,  lower 8 bits of 16
124
125@@chn_a_hi      QEQU    $ + 4   ; Channel A period, upper 4 bits of 12
126@@chn_b_hi      QEQU    $ + 5   ; Channel B period, upper 4 bits of 12
127@@chn_c_hi      QEQU    $ + 6   ; Channel C period, upper 4 bits of 12
128@@envlp_hi      QEQU    $ + 7   ; Envelope period,  upper 8 bits of 16
129
130@@chan_enable   QEQU    $ + 8   ; Channel enables (bits 3-5 noise, 0-2 tone)
131@@noise         QEQU    $ + 9   ; Noise period (5 bits)
132@@envelope      QEQU    $ + 10  ; Envelope type/trigger (4 bits)
133
134@@chn_a_vol     QEQU    $ + 11  ; Channel A volume / Envelope select (6 bits)
135@@chn_b_vol     QEQU    $ + 12  ; Channel B volume / Envelope select (6 bits)
136@@chn_c_vol     QEQU    $ + 13  ; Channel C volume / Envelope select (6 bits)
137
138@@io_port0      QEQU    $ + 14  ; I/O port 0 (8 bits)
139@@io_port1      QEQU    $ + 15  ; I/O port 1 (8 bits)
140
141                ENDS
142
143                ;;==========================================================;;
144                ;; Useful Constants / Bit-field definitions.                ;;
145                ;;==========================================================;;
146PSG             STRUCT  $0000   ; Constants, etc. common to both PSGs.
147
148                ;;----------------------------------------------------------;;
149                ;; Bits to OR together for Channel Enable word              ;;
150                ;;----------------------------------------------------------;;
151@@tone_a_on     QEQU    00000000b
152@@tone_b_on     QEQU    00000000b
153@@tone_c_on     QEQU    00000000b
154@@noise_a_on    QEQU    00000000b
155@@noise_b_on    QEQU    00000000b
156@@noise_c_on    QEQU    00000000b
157
158@@tone_a_off    QEQU    00000001b
159@@tone_b_off    QEQU    00000010b
160@@tone_c_off    QEQU    00000100b
161@@noise_a_off   QEQU    00001000b
162@@noise_b_off   QEQU    00010000b
163@@noise_c_off   QEQU    00100000b
164
165                ;;----------------------------------------------------------;;
166                ;; Bits to OR together for Envelope Type                    ;;
167                ;;----------------------------------------------------------;;
168@@envl_cont     QEQU    00001000b   ; Continue
169@@envl_attack   QEQU    00000100b   ; Attack (vs. Decay)
170@@envl_alter    QEQU    00000010b   ; Alternate
171@@envl_hold     QEQU    00000001b   ; Hold
172
173                ;;----------------------------------------------------------;;
174                ;; Volume levels                                            ;;
175                ;;----------------------------------------------------------;;
176@@vol_0         QEQU    0
177@@vol_1         QEQU    1
178@@vol_2         QEQU    2
179@@vol_3         QEQU    3
180@@vol_4         QEQU    4
181@@vol_5         QEQU    5
182@@vol_6         QEQU    6
183@@vol_7         QEQU    7
184@@vol_8         QEQU    8
185@@vol_9         QEQU    9
186@@vol_10        QEQU    10
187@@vol_11        QEQU    11
188@@vol_12        QEQU    12
189@@vol_13        QEQU    13
190@@vol_14        QEQU    14
191@@vol_15        QEQU    15
192@@vol_envl      QEQU    63
193
194                ENDS
195
196;;==========================================================================;;
197;; AY8900 Standard Television Interface Circuit                             ;;
198;;                                                                          ;;
199;; STIC -- Register definitions, constants and bitfields                    ;;
200;;                                                                          ;;
201;; The Standard Television Interface Circuit provides a method for placing  ;;
202;; characters and graphics on the screen.  It provides a 20x12 matrix of    ;;
203;; background 'cards'.  Each card contains an 8x8 tile of pixels.  It also  ;;
204;; provides 8 movable objects (refered to here as MOBs).                    ;;
205;;                                                                          ;;
206;; MOB controls: (Note: 'mob' is MOB number (0 - 7))                        ;;
207;;  mob + $00   -- X position, and some attribute bits.                     ;;
208;;  mob + $08   -- Y position, and some attribute bits.                     ;;
209;;  mob + $10   -- Character definition, more attribute bits.               ;;
210;;  mob + $18   -- Collision information.                                   ;;
211;;                                                                          ;;
212;; Display Mode controls:                                                   ;;
213;;  $20         -- Display enable (must be written during vert blank.)      ;;
214;;  $21         -- Graphics mode (write sets FGBG, read sets Color Stack)   ;;
215;;                                                                          ;;
216;; Color Stack and Border Color controls:                                   ;;
217;;  $28..$2B    -- Color stack entries 0..3                                 ;;
218;;  $2C         -- Screen border color                                      ;;
219;;                                                                          ;;
220;; Display framing controls:                                                ;;
221;;  $30         -- Pixel column delay (0..7)                                ;;
222;;  $31         -- Pixel row delay (0..7)                                   ;;
223;;  $32         -- Edge masking (bit 0 masks left, bit 1 masks top)         ;;
224;;                                                                          ;;
225;; Color Set                                                                ;;
226;;       Primary Color Set                Pastel Color Set                  ;;
227;;    ------------------------       -----------------------------          ;;
228;;     0 Black   4 Dark Green          8 Grey     12 Pink                   ;;
229;;     1 Blue    5 Green               9 Cyan     13 Light Blue             ;;
230;;     2 Red     6 Yellow             10 Orange   14 Yellow-Green           ;;
231;;     3 Tan     7 White              11 Brown    15 Purple                 ;;
232;;                                                                          ;;
233;;==========================================================================;;
234STIC            STRUCT  $0000
235
236;;--------------------------------------------------------------------------;;
237;; MOB Controls                                                             ;;
238;;                                                                          ;;
239;; X Register layout:                                                       ;;
240;;                                                                          ;;
241;;    13   12   11   10    9    8    7    6    5    4    3    2    1    0   ;;
242;;  +----+----+----+----+----+----+----+----+----+----+----+----+----+----+ ;;
243;;  | ?? | ?? | ?? | X  |VISB|INTR|            X Coordinate               | ;;
244;;  |    |    |    |SIZE|    |    |             (0 to 255)                | ;;
245;;  +----+----+----+----+----+----+----+----+----+----+----+----+----+----+ ;;
246;;                                                                          ;;
247;; Y Register layout:                                                       ;;
248;;                                                                          ;;
249;;    13   12   11   10    9    8    7    6    5    4    3    2    1    0   ;;
250;;  +----+----+----+----+----+----+----+----+----+----+----+----+----+----+ ;;
251;;  | ?? | ?? | Y  | X  | Y  | Y  |YRES|          Y Coordinate            | ;;
252;;  |    |    |FLIP|FLIP|SIZ4|SIZ2|    |           (0 to 127)             | ;;
253;;  +----+----+----+----+----+----+----+----+----+----+----+----+----+----+ ;;
254;;                                                                          ;;
255;; A Register layout:                                                       ;;
256;;                                                                          ;;
257;;    13   12   11   10    9    8    7    6    5    4    3    2    1    0   ;;
258;;  +----+----+----+----+----+----+----+----+----+----+----+----+----+----+ ;;
259;;  |PRIO| FG |GRAM|      GRAM/GROM Card # (0 to 255)      |   FG Color   | ;;
260;;  |    |bit3|GROM|     (bits 9, 10 ignored for GRAM)     |   Bits 0-2   | ;;
261;;  +----+----+----+----+----+----+----+----+----+----+----+----+----+----+ ;;
262;;                                                                          ;;
263;; C Register layout:                                                       ;;
264;;                                                                          ;;
265;;    13   12   11   10    9    8    7    6    5    4    3    2    1    0   ;;
266;;  +----+----+----+----+----+----+----+----+----+----+----+----+----+----+ ;;
267;;  | ?? | ?? | ?? | ?? |COLL|COLL|COLL|COLL|COLL|COLL|COLL|COLL|COLL|COLL| ;;
268;;  |    |    |    |    |BORD| BG |MOB7|MOB6|MOB5|MOB4|MOB3|MOB2|MOB1|MOB0| ;;
269;;  +----+----+----+----+----+----+----+----+----+----+----+----+----+----+ ;;
270;;--------------------------------------------------------------------------;;
271
272@@mob0_x        QEQU    $00 + 0     ; MOB 0 X position, XSIZE/VIS attributes
273@@mob1_x        QEQU    $00 + 1     ; MOB 1 X position, XSIZE/VIS attributes
274@@mob2_x        QEQU    $00 + 2     ; MOB 2 X position, XSIZE/VIS attributes
275@@mob3_x        QEQU    $00 + 3     ; MOB 3 X position, XSIZE/VIS attributes
276@@mob4_x        QEQU    $00 + 4     ; MOB 4 X position, XSIZE/VIS attributes
277@@mob5_x        QEQU    $00 + 5     ; MOB 5 X position, XSIZE/VIS attributes
278@@mob6_x        QEQU    $00 + 6     ; MOB 6 X position, XSIZE/VIS attributes
279@@mob7_x        QEQU    $00 + 7     ; MOB 7 X position, XSIZE/VIS attributes
280
281@@mob0_y        QEQU    $08 + 0     ; MOB 0 Y pos'n, YRES/YSIZE/XFLIP/YFLIP
282@@mob1_y        QEQU    $08 + 1     ; MOB 1 Y pos'n, YRES/YSIZE/XFLIP/YFLIP
283@@mob2_y        QEQU    $08 + 2     ; MOB 2 Y pos'n, YRES/YSIZE/XFLIP/YFLIP
284@@mob3_y        QEQU    $08 + 3     ; MOB 3 Y pos'n, YRES/YSIZE/XFLIP/YFLIP
285@@mob4_y        QEQU    $08 + 4     ; MOB 4 Y pos'n, YRES/YSIZE/XFLIP/YFLIP
286@@mob5_y        QEQU    $08 + 5     ; MOB 5 Y pos'n, YRES/YSIZE/XFLIP/YFLIP
287@@mob6_y        QEQU    $08 + 6     ; MOB 6 Y pos'n, YRES/YSIZE/XFLIP/YFLIP
288@@mob7_y        QEQU    $08 + 7     ; MOB 7 Y pos'n, YRES/YSIZE/XFLIP/YFLIP
289
290@@mob0_a        QEQU    $10 + 0     ; MOB 0 Color, Card #, Priority
291@@mob1_a        QEQU    $10 + 1     ; MOB 1 Color, Card #, Priority
292@@mob2_a        QEQU    $10 + 2     ; MOB 2 Color, Card #, Priority
293@@mob3_a        QEQU    $10 + 3     ; MOB 3 Color, Card #, Priority
294@@mob4_a        QEQU    $10 + 4     ; MOB 4 Color, Card #, Priority
295@@mob5_a        QEQU    $10 + 5     ; MOB 5 Color, Card #, Priority
296@@mob6_a        QEQU    $10 + 6     ; MOB 6 Color, Card #, Priority
297@@mob7_a        QEQU    $10 + 7     ; MOB 7 Color, Card #, Priority
298
299@@mob0_c        QEQU    $18 + 0     ; MOB 0 Collision detect
300@@mob1_c        QEQU    $18 + 1     ; MOB 1 Collision detect
301@@mob2_c        QEQU    $18 + 2     ; MOB 2 Collision detect
302@@mob3_c        QEQU    $18 + 3     ; MOB 3 Collision detect
303@@mob4_c        QEQU    $18 + 4     ; MOB 4 Collision detect
304@@mob5_c        QEQU    $18 + 5     ; MOB 5 Collision detect
305@@mob6_c        QEQU    $18 + 6     ; MOB 6 Collision detect
306@@mob7_c        QEQU    $18 + 7     ; MOB 7 Collision detect
307
308                ;;----------------------------------------------------------;;
309                ;; Display Mode Controls                                    ;;
310                ;;----------------------------------------------------------;;
311@@viden         QEQU    $20         ; Display Enable (write during vblank)
312@@mode          QEQU    $21         ; Mode select
313
314                ;;----------------------------------------------------------;;
315                ;; Color Stack and Display Border Color Controls            ;;
316                ;;----------------------------------------------------------;;
317@@colstack      QEQU    $28         ; Base of the color stack
318@@cs0           QEQU    $28 + 0     ; Color Stack 0
319@@cs1           QEQU    $28 + 1     ; Color Stack 1
320@@cs2           QEQU    $28 + 2     ; Color Stack 2
321@@cs3           QEQU    $28 + 3     ; Color Stack 3
322@@bord          QEQU    $2C         ; Border color
323
324                ;;----------------------------------------------------------;;
325                ;; Display Framing Controls                                 ;;
326                ;;----------------------------------------------------------;;
327@@h_delay       QEQU    $30         ; Horizontal delay (0 - 7 pixels)
328@@v_delay       QEQU    $31         ; Vertical delay (0 - 7 pixels)
329@@edgemask      QEQU    $32         ; Edge masking
330
331                ;;----------------------------------------------------------;;
332                ;; Useful bitfields/constants/masks for MOBS                ;;
333                ;;----------------------------------------------------------;;
334@@mobx_xpos     QEQU    00000011111111b     ; MOB XREG: X position
335@@mobx_intr     QEQU    00000100000000b     ; MOB XREG: Interaction
336@@mobx_visb     QEQU    00001000000000b     ; MOB XREG: Visibility
337@@mobx_xsize    QEQU    00010000000000b     ; MOB XREG: Horiz 2x magnification
338
339@@moby_ypos     QEQU    00000001111111b     ; MOB YREG: Y position
340@@moby_yres     QEQU    00000010000000b     ; MOB YREG: Y res. (8 or 16 rows)
341@@moby_ysize2   QEQU    00000100000000b     ; MOB YREG: Vert 2x magnification
342@@moby_ysize4   QEQU    00001000000000b     ; MOB YREG: Vert 4x magnification
343@@moby_ysize8   QEQU    00001100000000b     ; MOB YREG: 8x mag (sets 4x & 2x)
344@@moby_xflip    QEQU    00010000000000b     ; MOB YREG: Flip horizontally
345@@moby_yflip    QEQU    00100000000000b     ; MOB YREG: Flip vertically
346
347@@moba_fg0      QEQU    00000000000000b     ; MOB AREG: Foreground color =  0
348@@moba_fg1      QEQU    00000000000001b     ; MOB AREG: Foreground color =  1
349@@moba_fg2      QEQU    00000000000010b     ; MOB AREG: Foreground color =  2
350@@moba_fg3      QEQU    00000000000011b     ; MOB AREG: Foreground color =  3
351@@moba_fg4      QEQU    00000000000100b     ; MOB AREG: Foreground color =  4
352@@moba_fg5      QEQU    00000000000101b     ; MOB AREG: Foreground color =  5
353@@moba_fg6      QEQU    00000000000110b     ; MOB AREG: Foreground color =  6
354@@moba_fg7      QEQU    00000000000111b     ; MOB AREG: Foreground color =  7
355@@moba_fg8      QEQU    01000000000000b     ; MOB AREG: Foreground color =  8
356@@moba_fg9      QEQU    01000000000001b     ; MOB AREG: Foreground color =  9
357@@moba_fgA      QEQU    01000000000010b     ; MOB AREG: Foreground color = 10
358@@moba_fgB      QEQU    01000000000011b     ; MOB AREG: Foreground color = 11
359@@moba_fgC      QEQU    01000000000100b     ; MOB AREG: Foreground color = 12
360@@moba_fgD      QEQU    01000000000101b     ; MOB AREG: Foreground color = 13
361@@moba_fgE      QEQU    01000000000110b     ; MOB AREG: Foreground color = 14
362@@moba_fgF      QEQU    01000000000111b     ; MOB AREG: Foreground color = 15
363@@moba_card     QEQU    00000111111000b     ; MOB AREG: Card # mask
364@@moba_gram     QEQU    00100000000000b     ; MOB AREG: GRAM card select
365@@moba_prio     QEQU    10000000000000b     ; MOB AREG: Priority
366                                            ;           (above/below bkgnd)
367
368@@mobc_coll0    QEQU    00000000000001b     ; MOB CREG: Collision w/ MOB #0
369@@mobc_coll1    QEQU    00000000000010b     ; MOB CREG: Collision w/ MOB #1
370@@mobc_coll2    QEQU    00000000000100b     ; MOB CREG: Collision w/ MOB #2
371@@mobc_coll3    QEQU    00000000001000b     ; MOB CREG: Collision w/ MOB #3
372@@mobc_coll4    QEQU    00000000010000b     ; MOB CREG: Collision w/ MOB #4
373@@mobc_coll5    QEQU    00000000100000b     ; MOB CREG: Collision w/ MOB #5
374@@mobc_coll6    QEQU    00000001000000b     ; MOB CREG: Collision w/ MOB #6
375@@mobc_coll7    QEQU    00000010000000b     ; MOB CREG: Collision w/ MOB #7
376@@mobc_collmob  QEQU    00000011111111b     ; MOB CREG: Coll w/ any MOB (mask)
377@@mobc_collbg   QEQU    00000100000000b     ; MOB CREG; Coll w/ background
378@@mobc_collbord QEQU    00001000000000b     ; MOB CREG; Coll w/ background
379
380                ;;----------------------------------------------------------;;
381                ;; Useful bits for Edge Masking.                            ;;
382                ;;----------------------------------------------------------;;
383@@mask_left     QEQU    00000000000001b     ; Edge mask: Mask leftmost 8 pixels
384@@mask_top      QEQU    00000000000010b     ; Edge mask: Mask topmost 8 pixels
385
386;;--------------------------------------------------------------------------;;
387;; Useful bits for Color Stack Mode                                         ;;
388;;                                                                          ;;
389;; Display format word layout in Color Stack Mode:                          ;;
390;;   13   12    11   10    9    8    7    6    5    4    3    2    1    0   ;;
391;; +----+-----+----+----+----+----+----+----+----+----+----+----+----+----+ ;;
392;; |Adv.|FG   |GRAM|           GRAM/GROM Card #            |   FG Color   | ;;
393;; |col |Bit3/|GROM|    (0-255 for GROM, 0-63 for GRAM)    |   Bits 0-2   | ;;
394;; |stck|----------|                                       |              | ;;
395;; |    |col. sqr. |                                       |              | ;;
396;; |    |mode slct.|                                       |              | ;;
397;; +----+-----+----+----+----+----+----+----+----+----+----+----+----+----+ ;;
398;;                                                                          ;;
399;; Color Stack Notes:                                                       ;;
400;;  -- If GRAM card, two MSBs of Card # are ignored, and may be used by     ;;
401;;     the program to store other information.                              ;;
402;;                                                                          ;;
403;;  -- Bit 12 is set and Bit 11 is cleared, this word is treated as a       ;;
404;;     colored-square-mode display word, in the format below.               ;;
405;;                                                                          ;;
406;;  -- The color stack is reset to offset 0 at the start of the display.    ;;
407;;     Setting the 'advance' bit advances the color stack by one for that   ;;
408;;     card and all cards after it in normal left-to-right scanning order.  ;;
409;;                                                                          ;;
410;;  -- Bits 14 and 15 of the display format word are ignored and may be     ;;
411;;     used by the program to store status bits, etc.                       ;;
412;;                                                                          ;;
413;; Display format word layout in Colored Squares Mode:                      ;;
414;;                                                                          ;;
415;;   13   12   11   10    9    8    7    6    5    4    3    2    1    0    ;;
416;; +----+----+----+----+----+----+----+----+----+----+----+----+----+----+  ;;
417;; |Pix3|  1 |  0 | Pix. 3  | Pix. 2 color | Pix. 1 color | Pix. 0 color |  ;;
418;; |Bit2|    |    | bit 0-1 |    (0-7)     |    (0-7)     |    (0-7)     |  ;;
419;; +----+----+----+----+----+----+----+----+----+----+----+----+----+----+  ;;
420;;                                                                          ;;
421;; Pixels are display like so:  +-----+-----+                               ;;
422;;                              |Pixel|Pixel|                               ;;
423;;                              |  0  |  1  |                               ;;
424;;                              +-----+-----+                               ;;
425;;                              |Pixel|Pixel|                               ;;
426;;                              |  2  |  3  |                               ;;
427;;                              +-----+-----+                               ;;
428;;                                                                          ;;
429;; Colored Square Mode Notes:                                               ;;
430;;                                                                          ;;
431;;  -- It is not possible to advance the color stack with a card that is    ;;
432;;     displayed in color-stack mode.                                       ;;
433;;                                                                          ;;
434;;  -- Color 7 in colored squares mode instead shows the current color on   ;;
435;;     the color stack.                                                     ;;
436;;                                                                          ;;
437;;  -- Colors 0 through 6 in a colored-square card will interact with       ;;
438;;     MOBs, but color 7 will not.                                          ;;
439;;                                                                          ;;
440;;  -- Bits 14 and 15 of the display format word are ignored and may be     ;;
441;;     used by the program to store status bits, etc.                       ;;
442;;--------------------------------------------------------------------------;;
443@@cs_fg0        QEQU    00000000000000b     ; foreground ==  0
444@@cs_fg1        QEQU    00000000000001b     ; foreground ==  1
445@@cs_fg2        QEQU    00000000000010b     ; foreground ==  2
446@@cs_fg3        QEQU    00000000000011b     ; foreground ==  3
447@@cs_fg4        QEQU    00000000000100b     ; foreground ==  4
448@@cs_fg5        QEQU    00000000000101b     ; foreground ==  5
449@@cs_fg6        QEQU    00000000000110b     ; foreground ==  6
450@@cs_fg7        QEQU    00000000000111b     ; foreground ==  7
451@@cs_fg8        QEQU    01000000000000b     ; foreground ==  8
452@@cs_fg9        QEQU    01000000000001b     ; foreground ==  9
453@@cs_fgA        QEQU    01000000000010b     ; foreground == 10
454@@cs_fgB        QEQU    01000000000011b     ; foreground == 11
455@@cs_fgC        QEQU    01000000000100b     ; foreground == 12
456@@cs_fgD        QEQU    01000000000101b     ; foreground == 13
457@@cs_fgE        QEQU    01000000000110b     ; foreground == 14
458@@cs_fgF        QEQU    01000000000111b     ; foreground == 15
459@@cs_card       QEQU    00011111111000b     ; Card # mask (GRAM/GROM index #)
460@@cs_gram       QEQU    00100000000000b     ; Selects cards from GRAM if set
461@@cs_advance    QEQU    10000000000000b     ; Advances color stack.
462@@cs_colsqr     QEQU    01000000000000b     ; Selects 'colored square mode'
463
464@@cs_pix0       QEQU    00000000000111b     ; ColSqr Pixel 0 mask
465@@cs_pix1       QEQU    00000000111000b     ; ColSqr Pixel 1 mask
466@@cs_pix2       QEQU    00000111000000b     ; ColSqr Pixel 2 mask
467@@cs_pix3       QEQU    10011000000000b     ; ColSqr Pixel 3 mask
468
469@@cs_pix0_0     QEQU    00000000000000b     ; ColSqr Pixel 0, color == 0
470@@cs_pix0_1     QEQU    00000000000001b     ; ColSqr Pixel 0, color == 1
471@@cs_pix0_2     QEQU    00000000000010b     ; ColSqr Pixel 0, color == 2
472@@cs_pix0_3     QEQU    00000000000011b     ; ColSqr Pixel 0, color == 3
473@@cs_pix0_4     QEQU    00000000000100b     ; ColSqr Pixel 0, color == 4
474@@cs_pix0_5     QEQU    00000000000101b     ; ColSqr Pixel 0, color == 5
475@@cs_pix0_6     QEQU    00000000000110b     ; ColSqr Pixel 0, color == 6
476@@cs_pix0_7     QEQU    00000000000111b     ; ColSqr Pixel 0, color == 7
477
478@@cs_pix1_0     QEQU    00000000000000b     ; ColSqr Pixel 1, color == 0
479@@cs_pix1_1     QEQU    00000000001000b     ; ColSqr Pixel 1, color == 1
480@@cs_pix1_2     QEQU    00000000010000b     ; ColSqr Pixel 1, color == 2
481@@cs_pix1_3     QEQU    00000000011000b     ; ColSqr Pixel 1, color == 3
482@@cs_pix1_4     QEQU    00000000100000b     ; ColSqr Pixel 1, color == 4
483@@cs_pix1_5     QEQU    00000000101000b     ; ColSqr Pixel 1, color == 5
484@@cs_pix1_6     QEQU    00000000110000b     ; ColSqr Pixel 1, color == 6
485@@cs_pix1_7     QEQU    00000000111000b     ; ColSqr Pixel 1, color == 7
486
487@@cs_pix2_0     QEQU    00000000000000b     ; ColSqr Pixel 2, color == 0
488@@cs_pix2_1     QEQU    00000001000000b     ; ColSqr Pixel 2, color == 1
489@@cs_pix2_2     QEQU    00000010000000b     ; ColSqr Pixel 2, color == 2
490@@cs_pix2_3     QEQU    00000011000000b     ; ColSqr Pixel 2, color == 3
491@@cs_pix2_4     QEQU    00000100000000b     ; ColSqr Pixel 2, color == 4
492@@cs_pix2_5     QEQU    00000101000000b     ; ColSqr Pixel 2, color == 5
493@@cs_pix2_6     QEQU    00000110000000b     ; ColSqr Pixel 2, color == 6
494@@cs_pix2_7     QEQU    00000111000000b     ; ColSqr Pixel 2, color == 7
495
496@@cs_pix3_0     QEQU    00000000000000b     ; ColSqr Pixel 3, color == 0
497@@cs_pix3_1     QEQU    00001000000000b     ; ColSqr Pixel 3, color == 1
498@@cs_pix3_2     QEQU    00010000000000b     ; ColSqr Pixel 3, color == 2
499@@cs_pix3_3     QEQU    00011000000000b     ; ColSqr Pixel 3, color == 3
500@@cs_pix3_4     QEQU    10000000000000b     ; ColSqr Pixel 3, color == 4
501@@cs_pix3_5     QEQU    10001000000000b     ; ColSqr Pixel 3, color == 5
502@@cs_pix3_6     QEQU    10010000000000b     ; ColSqr Pixel 3, color == 6
503@@cs_pix3_7     QEQU    10011000000000b     ; ColSqr Pixel 3, color == 7
504
505;;--------------------------------------------------------------------------;;
506;; Useful bits for Foreground/Background Mode                               ;;
507;;                                                                          ;;
508;; Display format word layout in Color Stack Mode:                          ;;
509;;   13   12   11   10    9    8    7    6    5    4    3    2    1    0    ;;
510;; +----+----+----+----+----+----+----+----+----+----+----+----+----+----+  ;;
511;; |BG  |BG  |GRAM|BG  |BG  |      GRAM/GROM Card #       |   FG Color   |  ;;
512;; |Bit2|Bit3|GROM|Bit1|Bit0|          (0 - 63)           |   Bits 0-2   |  ;;
513;; +----+----+----+----+----+----+----+----+----+----+----+----+----+----+  ;;
514;;--------------------------------------------------------------------------;;
515
516@@fb_fg0        QEQU    00000000000000b     ; foreground ==  0
517@@fb_fg1        QEQU    00000000000001b     ; foreground ==  1
518@@fb_fg2        QEQU    00000000000010b     ; foreground ==  2
519@@fb_fg3        QEQU    00000000000011b     ; foreground ==  3
520@@fb_fg4        QEQU    00000000000100b     ; foreground ==  4
521@@fb_fg5        QEQU    00000000000101b     ; foreground ==  5
522@@fb_fg6        QEQU    00000000000110b     ; foreground ==  6
523@@fb_fg7        QEQU    00000000000111b     ; foreground ==  7
524
525@@fb_bg0        QEQU    00000000000000b     ; background ==  0
526@@fb_bg1        QEQU    00001000000000b     ; background ==  1
527@@fb_bg2        QEQU    00010000000000b     ; background ==  2
528@@fb_bg3        QEQU    00011000000000b     ; background ==  3
529@@fb_bg4        QEQU    10000000000000b     ; background ==  4
530@@fb_bg5        QEQU    10001000000000b     ; background ==  5
531@@fb_bg6        QEQU    10010000000000b     ; background ==  6
532@@fb_bg7        QEQU    10011000000000b     ; background ==  7
533@@fb_bg8        QEQU    01000000000000b     ; background ==  8
534@@fb_bg9        QEQU    01001000000000b     ; background ==  9
535@@fb_bgA        QEQU    01010000000000b     ; background == 10
536@@fb_bgB        QEQU    01011000000000b     ; background == 11
537@@fb_bgC        QEQU    11000000000000b     ; background == 12
538@@fb_bgD        QEQU    11001000000000b     ; background == 13
539@@fb_bgE        QEQU    11010000000000b     ; background == 14
540@@fb_bgF        QEQU    11011000000000b     ; background == 15
541
542@@fb_card       QEQU    00000111111000b     ; Card # mask (GRAM/GROM index #)
543@@fb_gram       QEQU    00100000000000b     ; Selects cards from GRAM if set
544
545                ENDS
546
547;;==========================================================================;;
548;;  STIC COLOR-NAMES                                                        ;;
549;;                                                                          ;;
550;;  These are easier to remember short mnemonics for the STIC's colors.     ;;
551;;  You can use the C_xxx colors for color-stack registers, border colors   ;;
552;;  and so on where the color is stored in a contiguous field.  Use the     ;;
553;;  X_xxx color names for the foreground color on display cards in color-   ;;
554;;  stack mode, or for MOB attribute words.                                 ;;
555;;                                                                          ;;
556;;  Note that for the primary color set, C_xxx and X_xxx are identical.     ;;
557;;==========================================================================;;
558
559C_BLK   QEQU    $0              ; Black
560C_BLU   QEQU    $1              ; Blue
561C_RED   QEQU    $2              ; Red
562C_TAN   QEQU    $3              ; Tan
563C_DGR   QEQU    $4              ; Dark Green
564C_GRN   QEQU    $5              ; Green
565C_YEL   QEQU    $6              ; Yellow
566C_WHT   QEQU    $7              ; White
567C_GRY   QEQU    $8              ; Grey
568C_CYN   QEQU    $9              ; Cyan
569C_ORG   QEQU    $A              ; Orange
570C_BRN   QEQU    $B              ; Brown
571C_PNK   QEQU    $C              ; Pink
572C_LBL   QEQU    $D              ; Light Blue
573C_YGR   QEQU    $E              ; Yellow-Green
574C_PUR   QEQU    $F              ; Purple
575
576X_BLK   QEQU    $0              ; Black
577X_BLU   QEQU    $1              ; Blue
578X_RED   QEQU    $2              ; Red
579X_TAN   QEQU    $3              ; Tan
580X_DGR   QEQU    $4              ; Dark Green
581X_GRN   QEQU    $5              ; Green
582X_YEL   QEQU    $6              ; Yellow
583X_WHT   QEQU    $7              ; White
584X_GRY   QEQU    $1000           ; Grey
585X_CYN   QEQU    $1001           ; Cyan
586X_ORG   QEQU    $1002           ; Orange
587X_BRN   QEQU    $1003           ; Brown
588X_PNK   QEQU    $1004           ; Pink
589X_LBL   QEQU    $1005           ; Light Blue
590X_YGR   QEQU    $1006           ; Yellow-Green
591X_PUR   QEQU    $1007           ; Purple
592
593;; ======================================================================== ;;
594;;  End of File:  gimini.asm                                                ;;
595;; ======================================================================== ;;
596