1;;==========================================================================;;
2;; Joe Zbiciak's Space Patrol for Intellivision.                            ;;
3;; Copyright 2006, Joe Zbiciak, intvnut AT gmail.com.                       ;;
4;; http://spatula-city.org/~im14u2c/intv/                                   ;;
5;;==========================================================================;;
6
7
8;; ------------------------------------------------------------------------ ;;
9;;                                                                          ;;
10;;  "But this has taken us far afield from interface, which is not          ;;
11;;   a bad place to be, since I particularly want to move ahead to          ;;
12;;   the kludge.  Why do people have so much trouble understanding          ;;
13;;   the kludge?  What is a kludge, after all, but not enough Ks,           ;;
14;;   not enough ROMs, not enough RAMs, poor quality interface and too       ;;
15;;   few bytes to go around?  Have I explained yet about the bytes?"        ;;
16;;                                              -- UNIX Fortune File        ;;
17;;                                                                          ;;
18;; ------------------------------------------------------------------------ ;;
19
20 CFGVAR  "name" = "SDK-1600 Space Patrol"
21 CFGVAR  "short_name" = "Space Patrol"
22 CFGVAR  "author" = "Joe Zbiciak"
23 CFGVAR  "sfx_by" = "Joe Zbiciak"
24 CFGVAR  "game_art_by" = "Joe Zbiciak"
25 CFGVAR  "box_art_by" = "Teresa Zbiciak"
26 CFGVAR  "music_by" = "Arnauld Chevallier"
27 CFGVAR  "author" = "Arnauld Chevallier"
28 CFGVAR  "author" = "David Harley"
29 CFGVAR  "year" = 2006
30 CFGVAR  "license" = "GPLv2+"
31 CFGVAR  "description" = "The SDK-1600 build of Space Patrol (no LTO branding)."
32 CFGVAR  "publisher" = "SDK-1600"
33 CFGVAR  "ecs_compat" = 2    ; Enhanced by ECS
34
35        INCLUDE "bldflags.asm"  ; should be in whatever our builddir is
36
37        ROMW    16              ; This makes life mucho easier.
38
39;; ------------------------------------------------------------------------ ;;
40;;  Magic Constants                                                         ;;
41;; ------------------------------------------------------------------------ ;;
42COPYR   EQU     $13A            ; Character # for Copyright circle-C
43JZB     EQU     $121            ; Starting character # for my name...
44
45C_BLK   EQU     $0              ; Black
46C_BLU   EQU     $1              ; Blue
47C_RED   EQU     $2              ; Red
48C_TAN   EQU     $3              ; Tan
49C_DGR   EQU     $4              ; Dark Green
50C_GRN   EQU     $5              ; Green
51C_YEL   EQU     $6              ; Yellow
52C_WHT   EQU     $7              ; White
53C_GRY   EQU     $8              ; Grey
54C_CYN   EQU     $9              ; Cyan
55C_ORG   EQU     $A              ; Orange
56C_BRN   EQU     $B              ; Brown
57C_PNK   EQU     $C              ; Pink
58C_LBL   EQU     $D              ; Light Blue
59C_YGR   EQU     $E              ; Yellow-Green
60C_PUR   EQU     $F              ; Purple
61
62X_BLK   EQU     $0              ; Black
63X_BLU   EQU     $1              ; Blue
64X_RED   EQU     $2              ; Red
65X_TAN   EQU     $3              ; Tan
66X_DGR   EQU     $4              ; Dark Green
67X_GRN   EQU     $5              ; Green
68X_YEL   EQU     $6              ; Yellow
69X_WHT   EQU     $7              ; White
70X_GRY   EQU     $1000           ; Grey
71X_CYN   EQU     $1001           ; Cyan
72X_ORG   EQU     $1002           ; Orange
73X_BRN   EQU     $1003           ; Brown
74X_PNK   EQU     $1004           ; Pink
75X_LBL   EQU     $1005           ; Light Blue
76X_YGR   EQU     $1006           ; Yellow-Green
77X_PUR   EQU     $1007           ; Purple
78
79; STIC MOB attribute bits
80_X      PROC                    ; bits in the MOB's X register
81@@na    EQU     $0000
82@@xsiz  EQU     $0400           ; Doubles width
83@@visb  EQU     $0200           ; Visible vs. Invisible
84@@intr  EQU     $0100           ; Object interacts w/ others
85        ENDP
86_Y      PROC                    ; bits in the MOB's Y register
87@@na    EQU     $0000
88@@yres  EQU     $0080           ; 16-lines
89@@siz1  EQU     $0000           ; 1x height
90@@siz2  EQU     $0100           ; 2x height
91@@siz4  EQU     $0200           ; 4x height
92@@siz8  EQU     $0300           ; 8x height
93@@xmir  EQU     $0400           ; Mirror horizontally
94@@ymir  EQU     $0800           ; Mirror vertically
95        ENDP
96_A      PROC                    ; bits in the MOB's A register
97@@na    EQU     $0000
98@@grom  EQU     $0000           ; MOB's card is in GROM
99@@gram  EQU     $0800           ; MOB's card is in GRAM
100@@prio  EQU     $2000           ; MOB is behind background
101        ENDP
102
103VFAST   EQU     $FF
104VMED    EQU     $BF
105VSLOW   EQU     $6F
106VJUMP   EQU     $1B
107;VBIAS   EQU     $80
108
109MAXGP1  EQU     5               ; Max sprites in group 1 is 5
110MAXGP2  EQU     7               ; Max sprites in group 2 is 7
111MAXSPR  EQU     MAXGP1+MAXGP2   ; Max total sprites is 12.
112                                ; We mux these onto 6 MOBs.
113
114X_TITL  EQU     X_PUR           ; \_ Title screen color scheme
115C_TITL  EQU     C_PUR           ; /
116C_STAT  EQU     C_GRY           ; Status bar color
117X_GRND  EQU     X_ORG           ; \_ Ground color
118C_GRND  EQU     C_ORG           ; /
119X_ROCK  EQU     X_BRN           ; \_ Rock color
120C_ROCK  EQU     C_BRN           ; /
121
122TSKQM   EQU     $7              ; 7 task queue
123
124M_DUP   EQU     $1              ; music flag : 'duplicate on channels B/C'
125M_3CH   EQU     $2              ; music flag : '3-channel tune'
126M_TICK  EQU     $4              ; music flag : 'ticks enabled'
127
128;; ======================================================================== ;;
129;;  Magic memory locations                                                  ;;
130;; ======================================================================== ;;
131VBLANK      EQU     $20         ; Vertical-blank Handshake
132COLSTK      EQU     $21         ; Color-stack/FGBG switch
133CS0         EQU     $28         ; Color Stack 0
134CS1         EQU     $29         ; Color Stack 1
135CS2         EQU     $2A         ; Color Stack 2
136CS3         EQU     $2B         ; Color Stack 3
137CB          EQU     $2C         ; Color for border
138
139EC_LOC      EQU     $CF00
140EC_MAG      EQU     $69
141EC_POLL     EQU     $CF01
142
143;; ======================================================================== ;;
144;;  MACROS                                                                  ;;
145;; ======================================================================== ;;
146            INCLUDE "macro/util.mac"
147            INCLUDE "macro/stic.mac"
148            INCLUDE "macro/tracker.mac"
149            INCLUDE "macro/dseg.mac"
150            INCLUDE "macro/gfx.mac"
151            INCLUDE "macro/initmem.mac"
152            INCLUDE "macro/s16.mac"
153            INCLUDE "macro/p16.mac"
154            INCLUDE "macro/score.mac"
155
156
157ISRVEC      EQU     $100 ;-$101 ; ISR jump vector
158
159;; ======================================================================== ;;
160;;  SCRATCH (8-bit) MEMORY                                                  ;;
161;; ======================================================================== ;;
162TICK        SCRATCH 1           ; Global clock tick
163PTPHAS      SCRATCH 1           ; Previous top-mountain phase
164PMPHAS      SCRATCH 1           ; Previous mid-mountain phase
165PGPHAS      SCRATCH 1           ; Previous ground phase
166PPGPHA      SCRATCH 1           ; Previous ground phase
167MOFS        SCRATCH 1           ; Previous ground card offset
168PGCARD      SCRATCH 1           ; Previous ground card offset
169MIDGFX      SCRATCH 1           ; City or mountain for mid gfx.
170MIDMSK      SCRATCH 1           ; mask for CITY vs. MOUNTAIN ($3FFF/$1FFF)
171TSKIP       SCRATCH 1           ; Top vs. Mid mountain priority flag
172INCITY      SCRATCH 1           ; Zero if not in CITY.
173CRATCNT     SCRATCH 1           ; Counter until we can make new crater
174GDATA       SCRATCH 1           ; Ground pixel pattern
175HBDATA      SCRATCH 1           ; Horizontal bullet pixel pattern
176HBCOL0      SCRATCH 1           ; Horizontal bullet column (old)
177HBCOL1      SCRATCH 1           ; Horizontal bullet column (new)
178HBCNT       SCRATCH 1           ; Horizontal bullet lifetime counter
179HBCNT2      SCRATCH 1           ; Horizontal bullet fire-to-fire counter
180HBROW       SCRATCH 1           ; Horizontal bullet row
181HBKOS       SCRATCH 1           ; Horizontal bullet kill-on-scroll
182TMCLR       SCRATCH 1           ; Title message color
183TMADDR      SCRATCH 1           ; Title message address
184
185
186;SKIPRC      SCRATCH 1           ; XXX -- Skip decoding of rocks/craters
187;EXITOK      SCRATCH 1           ; XXX -- schedexit trigger, to reuse for pause
188;STCNT       SCRATCH 1           ; XXX -- Stats div-by-16 counter
189;IDLE        SCRATCH 1           ; Number of idle ticks
190
191FDROP       SCRATCH 1           ; Number of frames droped (if any)
192EMODE       SCRATCH 1           ; Operating mode for engine
193CUENUM      SCRATCH 1           ; Deferred bad-guy CUE
194BGFLAG      SCRATCH 1           ; Flag:  Bad-guy engine even/odd frame toggle
195BGMPTBL     SCRATCH 20          ; Bad-guy motion program table.
196BGEXIT      SCRATCH 5           ; BGMP Exit program table.
197MOBHIT      SCRATCH 1           ; LSB set if buggy collides w/ other MOBs
198CAUTFL      SCRATCH 1
199
200CONTS       SCRATCH 1           ; Continues left
201LIVES       SCRATCH 1           ; Lives left
202POINT       SCRATCH 1           ; Last passed checkpoint
203COURSE      SCRATCH 1           ; Course number (0..7)
204
205DEFSCO      SCRATCH 1           ; Deferred score (waiting for buggy to land)
206CURBON      SCRATCH 1           ; Current bonus threshold
207WAVE        SCRATCH 1           ; Number of currently active saucers
208WKILL       SCRATCH 1           ; Number of saucers killed in this wave
209DOSCO       SCRATCH 1           ; Flag:  Do score update
210
211.SPSTART8   SET     .SCRMEM
212SPAT        SCRATCH 12          ; Attributes for 12 sprites
213SPAT1       EQU     SPAT        ; Offset into SPAT table for Group 1
214SPAT2       EQU     SPAT  + 5   ; Offset into SPAT table for Group 2
215
216JMPSCO      SCRATCH 5           ; Jumpable-object scoring info fpr SP #0-4
217SPHSCR      SCRATCH 5           ; Horizontal-scroll flags for SP #0-4
218LANDED      SCRATCH 1           ; Flag:  Just landed safely
219
220GP1MOB      SCRATCH 1           ; Number of MOBs alloc'd to group 1
221GP1ACT      SCRATCH 1           ; Number of active sprites in group 1
222GP1CNT      SCRATCH 1           ; Multiplex counter for group 1
223GP2MOB      SCRATCH 1           ; Number of MOBs alloc'd to group 2
224GP2ACT      SCRATCH 1           ; Number of active sprites in group 2
225GP2CNT      SCRATCH 1           ; Multiplex counter for group 2
226.SPSTOP8    SET     .SCRMEM
227
228TXLO        SCRATCH 1           ; Pixel column of back end of tank
229FXLO        SCRATCH 1           ; Pixel column of follower (minelayer)
230FHCNT       SCRATCH 1           ; Follower fast-hover count
231
232RCCNT       SCRATCH 1
233RCPIC       SCRATCH 1
234RCNXT       SCRATCH 2           ; RCIDX for next level
235RCLVL       SCRATCH 2           ; RCIDX for current level
236LMCNT       SCRATCH 1           ; Level marker counter
237LMCHAR      SCRATCH 1           ; Level 'character'
238
239TIMSEC      SCRATCH 1
240TIMTIC      SCRATCH 1
241CKTOG       SCRATCH 1           ; Toggle checking bad guy/good-guy bullets
242FCNT        SCRATCH 1           ; Counter:  Rate-limit bullet firing.
243EBSY        SCRATCH 1           ; Engine Busy flag (in case we drop frames)
244SPINCNT     SCRATCH 1           ; Spinner frame counter
245SPINB       SCRATCH 1           ; Spinner bullet in the air
246WTIMER      SCRATCH 1           ; Countdown timer for WAIT
247
248GRATE       SCRATCH 1           ; Ground scrolling rate
249WANTVL      SCRATCH 1           ; desired velocity
250JVEL        SCRATCH 1           ; Current jump velocity (0 == not moving)
251DOENG       SCRATCH 1
252DNENG       SCRATCH 1
253
254DBOUT       SCRATCH 1           ; Debounced hand controller values
255DBCM        SCRATCH 1           ; Debounce counter MSB
256DBCL        SCRATCH 1           ; Debounce counter LSB
257
258TMP         SCRATCH 5           ; Temp storage for whoever needs it
259SCROLL      EQU     TMP
260
261RFRSH_M     SCRATCH 1           ; Generic counter for music refresh
262NOTE_A      SCRATCH 1           ; Current note on channel A
263NOTE_B      SCRATCH 1           ; Current note on channel B
264NOTE_C      SCRATCH 1           ; Current note on channel C
265RFRSH_A     SCRATCH 1           ; Counter for refresh on channel A
266RFRSH_B     SCRATCH 1           ; Counter for refresh on channel B
267RFRSH_C     SCRATCH 1           ; Counter for refresh on channel C
268VOL_A       SCRATCH 1           ; Current volume on channel A
269VOL_B       SCRATCH 1           ; Current volume on channel B
270VOL_C       SCRATCH 1           ; Current volume on channel C
271_INSTR_A    SCRATCH 1           ; ** available **
272_INSTR_B    SCRATCH 1           ; ** available **
273_INSTR_C    SCRATCH 1           ; ** available **
274COUNT_A     SCRATCH 1           ; Note counter on channel A
275COUNT_B     SCRATCH 1           ; Note counter on channel B
276COUNT_C     SCRATCH 1           ; Note counter on channel C
277COUNT_M     SCRATCH 1           ; Generic counter for music
278COUNT_P     SCRATCH 1           ; Pattern counter
279PAT         SCRATCH 1           ; Current pattern
280MUS_FLAGS   SCRATCH 1           ; Music flags
281
282SFXTBL      SCRATCH 8
283SFXQ        SCRATCH 1
284SFXBSY      SCRATCH 1
285SFXSTMP     SCRATCH 1           ; extra state for saucer slide-whistle SFX
286
287MUXOK       SCRATCH 1           ; Flag:  Ok to run UPMUX in ENGINE2
288
289SCORE       SCRATCH 2           ; 16-bit score
290PSCOR       SCRATCH 2           ; Peak score this game
291TOPSCO      SCRATCH 16          ; Top scores for all 8 courses.
292
293PSG0        EQU     $1F0 ;-$1FD ; PSG base address (master component)
294PSG1        EQU     $0F0 ;-$0FD ; PSG base address (ECS)
295CTRL0       EQU     $1FE        ; Right hand controller
296CTRL1       EQU     $1FF        ; Left hand controller
297
298;; ======================================================================== ;;
299;;  SYSTEM (16-bit) MEMORY                                                  ;;
300;; ======================================================================== ;;
301.SPSTART16  SET     .SYSMEM
302SDAT        SYSTEM  24          ; Shadow copy of STIC regs
303SPXYV       SYSTEM  24          ; X/Y velocity for 12 sprites
304SPXYP       SYSTEM  24          ; Sprite X/Y position, 8Q8
305.SPSTOP16   SET     .SYSMEM
306
307SPXY1       EQU     SPXYP       ; Offset into SPXYP table for Group 1
308SPXY2       EQU     SPXYP + 5*2 ; Offset into SPXYP table for Group 2
309
310RCIDX       SYSTEM  1           ; Rock/crater/spawn index
311
312GGB0        SYSTEM  1           ; good-guy bullet 0
313GGB1        SYSTEM  1           ; good-guy bullet 1
314GGB2        SYSTEM  1           ; good-guy bullet 2
315MGOFS       SYSTEM  1           ; Mid-ground graphics offset in GRAM
316GPHASE      SYSTEM  1           ; ground scroll phase
317MPHASE      SYSTEM  1           ; midmntn scroll phase
318TPHASE      SYSTEM  1           ; topmntn scroll phase
319MPTR        SYSTEM  1           ; mountain gfx ROM pointer
320WPTR        SYSTEM  1           ; wheel gfx ROM pointer
321RPTR        SYSTEM  1           ; rock/crater gfx ROM pointer
322JHGT        SYSTEM  1           ; Current jump height (0 == on ground)
323MGRAM       SYSTEM  1           ; GRAM address for mountain data
324
325SONG        SYSTEM  1           ; Tracker variables
326POS_A       SYSTEM  1
327POS_B       SYSTEM  1
328POS_C       SYSTEM  1
329
330SDATP       SYSTEM  1
331
332STACK       SYSTEM  20
333
334BGTTMP      EQU     $35E        ; Temporary variable used by BGT routines
335RSEED       EQU     $35F
336
337GROM        EQU     $3000
338GRAM        EQU     $3800
339ISRRET      EQU     $1014
340
341
342;; ------------------------------------------------------------------------ ;;
343;;  Magic memory locations in ECS                                           ;;
344;; ------------------------------------------------------------------------ ;;
345ECSOK       EQU     $4040       ; flag saying whether extra features exist.
346
347;; ------------------------------------------------------------------------ ;;
348;;  GRAM layout in-game                                                     ;;
349;;      00              Space character                                     ;;
350;;      01 - 07         "Joseph Zbiciak" graphic                            ;;
351;;      03 - 04         "Time" graphic                                      ;;
352;;      05 - 07         "Caution" graphic                                   ;;
353;;      08 - 0F         Middle "mountain" graphics (8 cards)                ;;
354;;      10 - 19         Numeric digits (10 cards)                           ;;
355;;      1A              Circle-C copyright symbol                           ;;
356;;      1A              "Pt" graphic                                        ;;
357;;      1B              Ground terrain (1 cards)                            ;;
358;;      21              Creep #1 (orange ship)                              ;;
359;;      22              Creep #2 (blue ship)                                ;;
360;;      23              Creep #3 (white spinner)                            ;;
361;;      24              Creep missle                                        ;;
362;;      25              Buggy vert missle                                   ;;
363;;      26              Buggy horiz missle                                  ;;
364;;      27              Buggy body                                          ;;
365;;      28 - 29         Buggy wheels/guns (2 cards)                         ;;
366;;      2A              Solid ground-piece                                  ;;
367;;      2B              Creep crater-blaster missle                         ;;
368;;      2C - 37         Rock / Crater graphics (12 cards)                   ;;
369;;      38 - 3F         Top "mountain" graphics (8 cards)                   ;;
370;; ------------------------------------------------------------------------ ;;
371TCARD       EQU     $38
372CCARD       EQU     $08
373MCARD       EQU     $08
374RCARD       EQU     $2C
375GCARD       EQU     $1B
376HBCARD      EQU     $1C
377BCARD       EQU     $27
378WCARD       EQU     $28
379SCARD       EQU     $23
380TMCARD      EQU     $04
381PTCARD      EQU     $1A
382
383TOPGR       EQU     GRAM + TCARD * 8        ; Top mountains
384MIDGR       EQU     GRAM + MCARD * 8        ; Middle mountains
385RGRAM       EQU     GRAM + RCARD * 8        ; Rock / Crater
386GGRAM       EQU     GRAM + GCARD * 8        ; Ground terrain
387BGRAM       EQU     GRAM + BCARD * 8        ; Buggy body
388WGRAM       EQU     GRAM + WCARD * 8 + 5    ; Buggy wheels
389HBGRAM      EQU     GRAM + HBCARD* 8 + 3    ; Horizontal bullet
390SGRAM       EQU     GRAM + SCARD * 8        ; Spinner
391
392TMCARDx     EQU     $800 + TMCARD * 8       ; "Time" graphic
393PTCARDx     EQU     $800 + PTCARD * 8       ; "Pt" graphic
394HBCARDx     EQU     HBCARD*8 + X_BLK + $0800
395LMPCARDx    EQU     RCARD*8 + X_TITL + $0800
396RCARDx      EQU     RCARD*8 + X_ROCK + $0800 + $8000
397RCARD2x     EQU     (RCARD + 2)*8 + X_ROCK + $0800 + $8000
398GCARDx      EQU     GCARD*8       + X_GRND + $0800
399
400TROW_n      EQU     3
401CROW_n      EQU     6
402MROW_n      EQU     7
403GROW_n      EQU     8
404TROW_p      EQU     TROW_n * 8
405CROW_p      EQU     CROW_n * 8
406MROW_p      EQU     MROW_n * 8
407GROW_p      EQU     GROW_n * 8
408TROW        EQU     $200 + TROW_n*20
409CROW        EQU     $200 + CROW_n*20
410MROW        EQU     $200 + MROW_n*20
411GROW        EQU     $200 + GROW_n*20
412
413STROW1      EQU     0*20 + $200
414STROW2      EQU     7*20 + $200
415RKROW       EQU     1*20 + $200
416
417
418;; ======================================================================== ;;
419;;  FONT AND DATA                                                           ;;
420;; ======================================================================== ;;
421
422    IF 0
423            ; Temporary scratch memory
424            ORG     $C100, $C100, "+RW"
425SNDSTRM     RMB     8           ; Sound stream table
426;STACK       RMB     128         ; For now, for debugging purposes
427STKDEEP     RMB     1
428    ENDI
429
430    IF (DEFINED DOIDLEHST) <> 0
431            ORG     $CE00, $CE00, "+RW"
432IDLEHST     RMB     256
433    ENDI
434
435            ORG     $D000
436_SPATBL     EQU $
437            INCLUDE "gfx/spatbl.asm"
438_SPATBL.size EQU $ - _SPATBL
439
440
441_SPAWN      EQU $
442            INCLUDE "bg/bgmpind.asm"
443            INCLUDE "world/spawns.asm"
444_SPAWN.size EQU $ - _SPAWN
445
446            INCLUDE "gfx/rcsdata.asm"
447
448_WORLD      EQU $
449            INCLUDE "world/world.asm"
450_WORLD.size EQU $ - _WORLD
451
452_OS2        EQU $
453            INCLUDE "util/initmem.asm"
454_OS2.size   EQU $ - _OS2
455
456CKSUM       DECLE   0                   ; checksum
457
458        IF ($ < $D000) OR ($ > $E000)
459            ERR     "D000 overflow"
460        ENDI
461
462_D000.end   EQU     $
463
464            LISTING "off"
465            REPEAT  $E000 - $
466            DECLE   $FFFF
467            ENDR
468            LISTING "prev"
469
470            ORG     $F000
471
472_GFX        EQU $
473            INCLUDE "gfx/topmount.asm"
474            INCLUDE "gfx/midmount.asm"
475            INCLUDE "gfx/midcity1.asm"
476            INCLUDE "gfx/midcity2.asm"
477            INCLUDE "gfx/midcity3.asm"
478            INCLUDE "gfx/midcity4.asm"
479            INCLUDE "gfx/rockbg.asm"
480            INCLUDE "gfx/rockcrat.asm"
481            INCLUDE "gfx/spin1.asm"     ; \_ must be adjacent
482            INCLUDE "gfx/spin2.asm"     ; /
483            INCLUDE "gfx/title.asm"
484            INCLUDE "gfx/hut.asm"
485            INCLUDE "gfx/ground.asm"
486            INCLUDE "gfx/wheels.asm"
487_GFX.size   EQU $ - _GFX
488
489_FONT       EQU $
490            INCLUDE "genasm/font.asm"
491            INCLUDE "genasm/joefnt.asm"
492            INCLUDE "genasm/creepfnt.asm"
493            INCLUDE "genasm/creep2.asm"
494            INCLUDE "genasm/creep3.asm"
495            INCLUDE "genasm/creep4.asm"
496_FONT.size  EQU $ - _FONT
497
498
499
500_SFX        EQU $
501            INCLUDE "snd/sfx.asm"
502            INCLUDE "snd/music.asm"
503_SFX.size   EQU $ - _SFX
504
505_SCTBL      EQU $
506            INCLUDE "genasm/sctbl.asm"
507_SCTBL.size EQU $ - _SCTBL
508
509_POW10      EQU $
510            INCLUDE "util/pow10.asm"
511_POW10.size EQU $ - _POW10
512
513
514        IF ($ < $F000) OR ($ > $10000)
515            ERR     "F000 overflow"
516        ENDI
517
518_F000.end   EQU     $
519
520            LISTING "off"
521            REPEAT  $10000 - $
522            DECLE   $FFFF
523            ENDR
524            LISTING "prev"
525
526;; ======================================================================== ;;
527;;  ROM HEADER                                                              ;;
528;; ======================================================================== ;;
529            ORG     $5000       ; Standard Mattel cartridge memory map
530_TOPLEV     EQU $
531;; ------------------------------------------------------------------------ ;;
532ROMHDR:     WORD    $0000       ; RTAB (ignored)
533            DECLE   $01,$00     ; Movable object data (ignored)
534            WORD    START       ; Program start address (ignored)
535            WORD    $0000       ; Background graphics
536            WORD    ROMHDR + 2  ; Card table -- stored above in header. :-)
537            WORD    TITLE       ; Title string.
538
539            DECLE   $3C0        ; run title code, clicks off, INTY2 on, no ECS
540;           DECLE   $00         ; -> to STIC $32
541;           DECLE   $00         ; 0 = color stack, 1 = f/b mode
542;           DECLE   0, 0, 0, 0  ; color stack elements 1 - 4
543;           DECLE   $00         ; border color
544;; ------------------------------------------------------------------------ ;;
545_TOPLEV.size EQU $ - _TOPLEV
546
547
548;;==========================================================================;;
549;;  MAJOR SUBSYSTEMS AND SUPPORT CODE                                       ;;
550;;==========================================================================;;
551
552_BGMP       EQU $
553            INCLUDE "bg/bgthink.asm"
554            INCLUDE "bg/bgsaucer.asm"
555            INCLUDE "bg/bgfollow.asm"
556_BGMP.size  EQU $ - _BGMP
557
558_ENG1       EQU     $
559            INCLUDE "engine/engine1.asm"
560_ENG1.size  EQU     $ - _ENG1
561
562_ENG2       EQU     $
563            INCLUDE "engine/engine2.asm"
564            INCLUDE "engine/runeng.asm"
565            INCLUDE "engine/tictsk.asm"
566            INCLUDE "engine/tank.asm"
567_ENG2.size  EQU     $ - _ENG2
568
569_BGENG      EQU     $
570            INCLUDE "bg/bgengine.asm"
571_BGENG.size EQU     $ - _BGENG
572
573_GAME       EQU     $
574            INCLUDE "game/names.asm"
575            INCLUDE "game/data.asm"
576    IF (DEFINED OLDMENU) = 0
577            INCLUDE "game/mission.asm"
578    ELSE
579            INCLUDE "game/menu.asm"
580    ENDI
581            INCLUDE "game/ckpoint.asm"
582            INCLUDE "game/gameloop.asm"
583            INCLUDE "game/level.asm"
584;           INCLUDE "game/title.asm"
585            INCLUDE "game/gameover.asm"
586            INCLUDE "game/score.asm"
587_GAME.size  EQU     $ - _GAME
588
589_SENG       EQU     $
590            INCLUDE "engine/sfxeng.asm"
591            INCLUDE "engine/tracker.asm"
592_SENG.size  EQU     $ - _SENG
593
594_OS         EQU     $
595            INCLUDE "os/main_os.asm"
596            INCLUDE "os/rand.asm"
597            INCLUDE "os/setisr.asm"
598            INCLUDE "os/wnk.asm"
599            INCLUDE "util/p16.asm"
600;           INCLUDE "util/prnum32.asm"
601            INCLUDE "util/prnum16.asm"
602            INCLUDE "util/fillmem.asm"
603;           INCLUDE "util/hex16.asm"
604            INCLUDE "util/menuinp.asm"
605            INCLUDE "misc/shltbl.asm"
606            INCLUDE "os/debounce.asm"
607
608            EMIT_CST8
609            EMIT_CST16
610_OS.size    EQU     $ - _OS
611
612_5000.end   EQU     $
613
614        IF ($ < $5000) OR ($ > $7000)
615            ERR     "5000 overflow"
616        ENDI
617
618            LISTING "off"
619            REPEAT  $7000 - $
620            DECLE   $FFFF
621            ENDR
622            LISTING "prev"
623
624;* ======================================================================== *;
625;*  This program is free software; you can redistribute it and/or modify    *;
626;*  it under the terms of the GNU General Public License as published by    *;
627;*  the Free Software Foundation; either version 2 of the License, or       *;
628;*  (at your option) any later version.                                     *;
629;*                                                                          *;
630;*  This program is distributed in the hope that it will be useful,         *;
631;*  but WITHOUT ANY WARRANTY; without even the implied warranty of          *;
632;*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU       *;
633;*  General Public License for more details.                                *;
634;*                                                                          *;
635;*  You should have received a copy of the GNU General Public License       *;
636;*  along with this program; if not, write to the Free Software             *;
637;*  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.               *;
638;* ======================================================================== *;
639;*                   Copyright (c) 2006, Joseph Zbiciak                     *;
640;* ======================================================================== *;
641