1;;==========================================================================;;
2;; Joe Zbiciak's Tag-Along Todd 2, with Voice!                              ;;
3;; Copyright 2002, Joe Zbiciak, intvnut AT gmail.com.                       ;;
4;; http://spatula-city.org/~im14u2c/intv/                                   ;;
5;;==========================================================================;;
6
7;* ======================================================================== *;
8;*  TO BUILD IN BIN+CFG FORMAT:                                             *;
9;*      as1600 -o tagalong2v.bin -l tagalong2v.lst tagalong2v.asm           *;
10;*                                                                          *;
11;*  TO BUILD IN ROM FORMAT:                                                 *;
12;*      as1600 -o tagalong2v.rom -l tagalong2v.lst tagalong2v.asm           *;
13;* ======================================================================== *;
14 CFGVAR "name" = "SDK-1600 Tag-Along Todd #2 Voice"
15 CFGVAR "short_name" = "Tag-Along Todd #2v"
16 CFGVAR "author" = "Joe Zbiciak"
17 CFGVAR "year" = 2002
18 CFGVAR "license" = "GPLv2+"
19 CFGVAR "desc" = "Second iter of Tag-Along Todd, w/ fancy title screen & voice."
20 CFGVAR "publisher" = "SDK-1600"
21
22            ROMW    16              ; Use 16-bit ROM
23
24;------------------------------------------------------------------------------
25; Include system information
26;------------------------------------------------------------------------------
27            INCLUDE "../library/gimini.asm"     ; System offsets, etc.
28            INCLUDE "../library/resrom.asm"     ; RESROM indices
29
30;------------------------------------------------------------------------------
31; Global constants and configuration.
32;------------------------------------------------------------------------------
33TSKQM       EQU     $7              ; Task queue is 8 entries large
34MAXTSK      EQU     2               ; Only one task
35CAN         EQU     258 * 8 + C_DGR ; The can you're trying to collect
36ARROW       EQU     259 * 8 + C_YEL ; The arrow for the menu.
37
38PH_TITLE    EQU     43
39PH_LETSPLAY EQU     44
40PH_GAMEOVER EQU     45
41PH_FINALSCO EQU     46
42
43
44;------------------------------------------------------------------------------
45; Allocate 8-bit variables in Scratch RAM
46;------------------------------------------------------------------------------
47SCRATCH     ORG     $100, $100, "-RWBN"
48
49ISRVEC      RMB     2               ; Always at $100 / $101
50
51            ; Task-oriented 8-bit variables
52TSKQHD      RMB     1               ; Task queue head
53TSKQTL      RMB     1               ; Task queue tail
54TSKDQ       RMB     2*(TSKQM+1)     ; Task data queue
55TSKACT      RMB     1               ; Number of active tasks
56
57            ; Hand-controller 8-bit variables
58SH_TMP      RMB     1               ; Temp storage.
59SH_LR0      RMB     3               ;\
60SH_FL0      EQU     SH_LR0 + 1      ; |-- Three bytes for left controller
61SH_LV0      EQU     SH_LR0 + 2      ;/
62SH_LR1      RMB     3               ;\
63SH_FL1      EQU     SH_LR1 + 1      ; |-- Three bytes for right controller
64SH_LV1      EQU     SH_LR1 + 2      ;/
65
66            ; DEC16 temp storage
67DEC_0       RMB     2
68DEC_1       EQU     DEC_0 + 1
69
70            ; Misc other stuff
71GAME_LEN    RMB     1               ; Length of game in seconds
72TIMELEFT    RMB     1               ; Time left in game.
73SCORE       RMB     1               ; Score
74NUM_CANS    RMB     1               ; Number of cans still onscreen.
75M_ROW       RMB     1               ; menu row for arrow
76
77            ; Intellivoice-specific variables
78IV.QH       RMB     1               ; Intellivoice: phrase queue head
79IV.QT       RMB     1               ; Intellivoice: phrase queue tail
80IV.Q        RMB     8               ; Intellivoice: phrase queue
81IV.FLEN     RMB     1               ; Intellivoice: FIFO'd data length
82
83_SCRATCH    EQU     $               ; end of scratch area
84
85
86
87;------------------------------------------------------------------------------
88; Allocate 16-bit variables in System RAM
89;------------------------------------------------------------------------------
90SYSTEM      ORG     $2F0, $2F0, "-RWBN"
91STACK       RMB     32              ; Reserve 32 words for the stack
92
93            ; Task-oriented 16-bit variables
94TSKQ        RMB     (TSKQM + 1)     ; Task queue
95TSKTBL      RMB     (MAXTSK * 4)    ; Timer task table
96
97            ; Hand-controller 16-bit variables
98SHDISP      RMB     1               ; ScanHand dispatch
99
100            ; STIC shadow
101STICSH      RMB     24              ; Room for X, Y, and A regs only.
102
103            ; Misc other stuff
104PLYR        PROC
105@@TXV       RMB     1               ; Target X velocity
106@@XV        RMB     1               ; X velocity
107@@XP        RMB     1               ; X position
108@@TYV       RMB     1               ; Target Y velocity
109@@YV        RMB     1               ; Y velocity
110@@YP        RMB     1               ; Y position
111            ENDP
112
113TODD        PROC                    ; TODD's STATS
114@@TXV       RMB     1               ; Target X velocity
115@@XV        RMB     1               ; X velocity
116@@XP        RMB     1               ; X position
117@@TYV       RMB     1               ; Target Y velocity
118@@YV        RMB     1               ; Y velocity
119@@YP        RMB     1               ; Y position
120            ENDP
121
122RNDHI       RMB     1
123RNDLO       RMB     1
124
125MOB_BUSY    RMB     1               ; If non-zero, disables MOB updates
126
127SKILL       RMB     1               ; Skill level [1 - 9]
128DURATION    RMB     1               ; Game duration [1 - 9]
129INIT_VEL    RMB     1               ; Initial velocity
130TODD_VEL    RMB     1               ; Todd's velocity (game difficulty)
131
132            ; Intellivoice-specific variables
133IV.FPTR     RMB     1               ; Intellivoice: FIFO'd data pointer
134IV.PPTR     RMB     1               ; Intellivoice: Phrase pointer
135
136_SYSTEM     EQU     $               ; end of system area
137
138
139;------------------------------------------------------------------------------
140; EXEC-friendly ROM header.
141;------------------------------------------------------------------------------
142            ORG     $5000           ; Use default memory map
143ROMHDR:     BIDECLE ZERO            ; MOB picture base   (points to NULL list)
144            BIDECLE ZERO            ; Process table      (points to NULL list)
145            BIDECLE MAIN            ; Program start address
146            BIDECLE ZERO            ; Bkgnd picture base (points to NULL list)
147            BIDECLE ONES            ; GRAM pictures      (points to NULL list)
148            BIDECLE TITLE           ; Cartridge title/date
149            DECLE   $03C0           ; No ECS title, run code after title,
150                                    ; ... no clicks
151ZERO:       DECLE   $0000           ; Screen border control
152            DECLE   $0000           ; 0 = color stack, 1 = f/b mode
153ONES:       DECLE   C_BLU, C_BLU    ; Initial color stack 0 and 1: Blue
154            DECLE   C_BLU, C_BLU    ; Initial color stack 2 and 3: Blue
155            DECLE   C_BLU           ; Initial border color: Blue
156;------------------------------------------------------------------------------
157
158
159;; ======================================================================== ;;
160;;  TITLE  -- Display our modified title screen & copyright date.           ;;
161;; ======================================================================== ;;
162TITLE:      STRING  102, "Tag-Along Todd #2a", 0
163
164;; ======================================================================== ;;
165;;  MAIN:  Here's our main program code.                                    ;;
166;; ======================================================================== ;;
167MAIN:       PROC
168            DIS
169            MVII    #STACK, R6      ; Set up our stack
170
171            MVII    #$25D,  R1      ;\
172            MVII    #$102,  R4      ; |-- Clear all of memory
173            CALL    FILLZERO        ;/
174
175            MVO     PC,     MOB_BUSY; Disable MOBs for now.
176
177            CALL    IV_INIT         ; Initialize Intellivoice (if present)
178
179            MVII    #INITISR, R0    ;\    Do GRAM initialization in ISR.
180            MVO     R0,     ISRVEC  ; |__ INITISR will the point to the
181            SWAP    R0              ; |   regular ISR when it's done.
182            MVO     R0,     ISRVEC+1;/
183
184            MVO     PC,     RNDHI
185
186            EIS
187@@gameloop:
188            CALL    TSCREEN         ; Show title screen
189            CALL    RUNQ
190
191            CALL    MENU            ; Get information
192            CALL    RUNQ
193
194            CALL    GAME            ; Run the game
195            CALL    RUNQ
196
197            CALL    GAMEOVER        ; Game over!
198            CALL    RUNQ
199
200            B       @@gameloop
201            ENDP
202
203;; ======================================================================== ;;
204;;  HEXIT   Dispatch table that just calls SCHEDEXIT for everything.        ;;
205;; ======================================================================== ;;
206HEXIT       PROC
207            DECLE   EXITPRESS
208            DECLE   EXITPRESS
209            DECLE   EXITPRESS
210            ENDP
211
212;; ======================================================================== ;;
213;;  EXITPRESS -- Schedule an exit only when a key is pressed, not released. ;;
214;; ======================================================================== ;;
215EXITPRESS   PROC
216            SWAP    R2,     2       ; test bit 7 of R2
217            BPL     SCHEDEXIT       ; if clear, schedule the exit
218            JR      R5              ; if set, ignore the keypress.
219            ENDP
220
221;; ======================================================================== ;;
222;;  TSCREEN -- Title screen.                                                ;;
223;; ======================================================================== ;;
224TSCREEN     PROC
225            PSHR    R5
226
227            CALL    CLRSCR
228
229            CALL    PRINT.FLS
230            DECLE   C_BLU, $200 + 1*20 + 2
231                    ;01234567890123456789
232            STRING    ">>> SDK-1600 <<<  "
233            STRING  "      presents",0
234
235            CALL    PRINT.FLS
236            DECLE   C_DGR, $200 + 6*20 + 2
237                    ;01234567890123456789
238            STRING    "Tag-Along Todd 2",0
239
240            CALL    PRINT.FLS
241            DECLE   C_BLK, $200 + 10*20 + 3
242                    ;01234567890123456789
243            STRING     "Copyright 2002", 0
244
245            CALL    IV_PLAYW
246            DECLE   PH_TITLE
247
248            CLRR    R0
249            MVO     R0,     TSKACT      ; No active tasks
250
251            MVII    #HEXIT, R0
252            MVO     R0,     SHDISP      ; Any controller input -> Exit screen
253
254            MVO     PC,     MOB_BUSY    ; Disable MOB updates
255
256            MVII    #STICSH, R4         ;\
257            MVII    #24,    R1          ; |-- Clear away the MOBs
258            CALL    FILLZERO            ;/
259
260            PULR    PC
261            ENDP
262
263;; ======================================================================== ;;
264;;  M_HAND  Dispatch table for menu.                                        ;;
265;; ======================================================================== ;;
266M_HAND      PROC
267            DECLE   M_DIGIT     ; Keypad dispatch
268            DECLE   0           ; Action-button dispatch -> disabled
269            DECLE   M_DISC      ; DISC dispatch
270            ENDP
271
272;; ======================================================================== ;;
273;;  MENU    Display a menu onscreen.                                        ;;
274;; ======================================================================== ;;
275MENU        PROC
276            PSHR    R5
277
278            CALL    CLRSCR
279
280            ;; ------------------------------------------------------------ ;;
281            ;;  Display the menu screen.                                    ;;
282            ;; ------------------------------------------------------------ ;;
283            CALL    PRINT.FLS
284            DECLE   C_DGR,  $200 + 2*20 + 1
285                    ;01234567890123456789
286            STRING  "Skill level [1-9]:", 0
287
288            CALL    PRINT.FLS
289            DECLE   C_DGR,  $200 + 5*20 + 1
290                    ;01234567890123456789
291            STRING  "Duration    [1-9]:", 0
292
293            CALL    PRINT.FLS
294            DECLE   C_BLU,  $200 + 3*20 + 9
295            STRING  "5", 0
296
297            CALL    PRINT.FLS
298            DECLE   C_BLU,  $200 + 6*20 + 9
299            STRING  "5", 0
300
301            CALL    PRINT.FLS
302            DECLE   C_BLU,  $200 + 9*20 + 8
303            STRING  "Go!", 0
304
305            ;; ------------------------------------------------------------ ;;
306            ;;  Set the defaults.                                           ;;
307            ;; ------------------------------------------------------------ ;;
308            MVII    #$A0,   R0
309            MVO     R0,     INIT_VEL
310            MVII    #50,    R0
311            MVO     R0,     GAME_LEN
312            MVII    #5,     R0
313            MVO     R0,     SKILL
314            MVO     R0,     DURATION
315
316            MVII    #3*20,  R0
317            MVO     R0,     M_ROW
318
319            ;; ------------------------------------------------------------ ;;
320            ;;  Set the dispatch and menu animate task.                     ;;
321            ;; ------------------------------------------------------------ ;;
322            MVII    #M_HAND,R0
323            MVO     R0,     SHDISP
324
325            CALL    STARTTASK           ;\
326            DECLE   0                   ; |__ Blink the little arrow
327            DECLE   M_BLINK             ; |
328            DECLE   30,     30          ;/
329
330            MVII    #1,     R0
331            MVO     R0,     TSKACT
332            PULR    PC
333            ENDP
334
335;; ======================================================================== ;;
336;;  M_DIGIT -- Enter a digit on the current menu row.                       ;;
337;;             Pressing enter moves to next row, or if at last, starts game ;;
338;; ======================================================================== ;;
339M_DIGIT     PROC
340            ANDI    #$FF,   R2          ; ignore controller #.
341            CMPI    #$80,   R2
342            BLT     @@press             ; ignore release events.
343@@leave:    JR      R5
344
345@@press:    TSTR    R2
346            BEQ     @@leave             ; ignore 'zero'
347            CMPI    #10,    R2
348            BEQ     @@leave             ; ignore 'clear'
349            BLT     @@digit
350
351            ;; ------------------------------------------------------------ ;;
352            ;;  Handle the [Enter] key:  Move to next row in menu, or if    ;;
353            ;;  on last row of menu, start the game.                        ;;
354            ;; ------------------------------------------------------------ ;;
355@@enter:    MVI     M_ROW,  R4
356            ADDI    #$200 + 12, R4
357            CLRR    R0
358            MVO@    R0,     R4          ; Clear arrow from current row
359
360            MVI     M_ROW,  R1
361            ADDI    #3*20,  R1          ; move to next row
362            CMPI    #9*20,  R1          ; were we on last row?
363            BGT     SCHEDEXIT           ; Enter on last row starts game.
364
365            MVO     R1,     M_ROW
366            ADDI    #$200 + 12, R1
367            MVII    #ARROW, R0
368            MVO@    R0,     R1          ; Put arrow on current row
369            JR      R5
370
371            ;; ------------------------------------------------------------ ;;
372            ;;  Handle digits [1] through [9].                              ;;
373            ;; ------------------------------------------------------------ ;;
374@@digit:    MVI     M_ROW,  R4
375            CMPI    #6*20,  R4
376            BGT     @@leave             ; Ignore digits when in last row
377            BEQ     @@update_duration
378
379            ;; ------------------------------------------------------------ ;;
380            ;;  If we are on the top row, the input updates skill level.    ;;
381            ;; ------------------------------------------------------------ ;;
382            MVO     R2,     SKILL
383            MOVR    R2,     R1          ; Update skill level
384            SLL     R1,     2
385            SLL     R1,     2
386            SLL     R1,     1
387            MVO     R1,     INIT_VEL    ; Todd's velocity = 0x20 * skill
388            B       @@disp
389
390            ;; ------------------------------------------------------------ ;;
391            ;;  If we are on the middle row, the input updates the game     ;;
392            ;;  duration.                                                   ;;
393            ;; ------------------------------------------------------------ ;;
394@@update_duration:
395            MVO     R2,     DURATION
396            MOVR    R2,     R1
397            SLL     R1,     2
398            ADDR    R2,     R1
399            SLL     R1,     1
400            MVO     R1,     GAME_LEN    ; Game length = 10 seconds * digit.
401
402            ;; ------------------------------------------------------------ ;;
403            ;;  Either way, if we're on the upper two rows, show the digit. ;;
404            ;; ------------------------------------------------------------ ;;
405@@disp:     ADDI    #$200+9,R4          ; offset to digit position in row.
406            MOVR    R2,     R1
407            SLL     R1,     2           ; move digit to card field in word
408            SLL     R1,     1
409            ADDI    #$80 + C_BLU, R1    ; add offset for '0', make digit blue
410            MVO@    R1,     R4          ; show it.
411
412            JR      R5
413            ENDP
414
415;; ======================================================================== ;;
416;;  M_DISC  -- Move the selection arrow between menu rows.                  ;;
417;; ======================================================================== ;;
418M_DISC      PROC
419            ANDI    #$FF,   R2          ; ignore controller #.
420            CMPI    #$80,   R2
421            BLT     @@press             ; ignore release events.
422@@leave:    JR      R5
423@@press:
424            MVI     M_ROW,  R0          ; Get menu row
425            MOVR    R0,     R1          ; save old position
426
427            CMPI    #2,     R2
428            BLT     @@leave             ; Ignore 'east' (directions 0, 1)
429            CMPI    #13,    R2
430            BGT     @@leave             ; Ignore 'east' (directions 14, 15)
431            CMPI    #5,     R2
432            BLE     @@move_up           ; Directions 2 - 5:  Move up
433            CMPI    #10,    R2
434            BLT     @@leave             ; Ignore 'west' (directions 6 - 9)
435
436
437@@move_dn:  ADDI    #3*20,  R0          ; Move down to next item
438            CMPI    #9*20,  R0          ; Is it past the end?
439            BGT     @@leave             ; Yes:  Ignore the input
440            MVO     R0,     M_ROW       ; No:   Save the update
441
442            ADDI    #$200 + 12, R1      ;\    Move to old arrow's position
443            CLRR    R0                  ; |-- and clear the old arrow
444            MVO@    R0,     R1          ;/
445
446            ADDI    #3*20,  R1          ;\    Move to new arrow's position
447            MVII    #ARROW, R0          ; |-- and draw the new arrow.
448            MVO@    R0,     R1          ;/
449            JR      R5                  ; return.
450
451@@move_up   SUBI    #3*20,  R0          ; Move up to prev item
452            CMPI    #3*20,  R0          ; Is it past the top
453            BLT     @@leave             ; Yes:  Ignore the input
454            MVO     R0,     M_ROW       ; No:   Save the update
455
456            ADDI    #$200 + 12, R1      ;\    Move to old arrow's position
457            CLRR    R0                  ; |-- and clear the old arrow
458            MVO@    R0,     R1          ;/
459
460            SUBI    #3*20,  R1          ;\    Move to new arrow's position
461            MVII    #ARROW, R0          ; |-- and draw the new arrow.
462            MVO@    R0,     R1          ;/
463            JR      R5                  ; return.
464
465            ENDP
466
467;; ======================================================================== ;;
468;;  M_BLINK -- Blink the arrow on the menu.                                 ;;
469;; ======================================================================== ;;
470M_BLINK     PROC
471            MVI     M_ROW,  R1          ; Get menu row
472            ADDI    #$200 + 12, R1      ; Offset to arrow position
473            MVII    #ARROW, R2          ;\
474            XOR@    R1,     R2          ; |-- Toggle the arrow on and off.
475            MVO@    R2,     R1          ;/
476            JR      R5                  ; return.
477            ENDP
478
479;; ======================================================================== ;;
480;;  GAMEOVER -- Game-over screen.                                           ;;
481;; ======================================================================== ;;
482GAMEOVER    PROC
483            PSHR    R5
484
485            ;; ------------------------------------------------------------ ;;
486            ;;  Say "Game Over!"                                            ;;
487            ;; ------------------------------------------------------------ ;;
488            CALL    IV_PLAY
489            DECLE   PH_GAMEOVER
490
491            ;; ------------------------------------------------------------ ;;
492            ;;  Make a long 'ding'.                                         ;;
493            ;;  Channel A Period = $0200     Channel A Volume = Envelope    ;;
494            ;;  Envelope Period  = $3FFF     Envelope type = 0000           ;;
495            ;;  Enables = Tone only on A, B, C.                             ;;
496            ;; ------------------------------------------------------------ ;;
497            MVII    #$02,   R1
498            MVO     R1,     PSG0.chn_a_hi
499            MVII    #$38,   R1
500            MVO     R1,     PSG0.chan_enable
501            MVO     R1,     PSG0.chn_a_vol
502            MVII    #$FF,   R1
503            MVO     R1,     PSG0.envlp_lo
504            MVII    #$3F,   R1
505            MVO     R1,     PSG0.envlp_hi
506            CLRR    R1
507            MVO     R1,     PSG0.chn_a_lo
508            MVO     R1,     PSG0.envelope
509
510            ;; ------------------------------------------------------------ ;;
511            ;;  Show the "Game Over!" message.  Also show the skill level   ;;
512            ;;  and game duration, in case the player wants to make a       ;;
513            ;;  screen-shot.                                                ;;
514            ;; ------------------------------------------------------------ ;;
515            CALL    PRINT.FLS
516            DECLE   C_RED, $200 + 4*20 + 4
517                    ;01234567890123456789
518            STRING      " GAME OVER! ",0
519
520            CALL    PRINT.FLS
521            DECLE   C_BLU, $200 + 6*20 + 5
522                    ;01234567890123456789
523            STRING       " Skill:  ", 0
524
525            MVI     SKILL,  R0
526            SLL     R0,     2
527            SLL     R0,     1
528            ADDI    #$80 + C_DGR, R0
529            MVO@    R0,     R4
530
531            CALL    PRINT.FLS
532            DECLE   C_BLU, $200 + 7*20 + 4
533                    ;01234567890123456789
534            STRING      " Length:  ", 0
535
536            MVI     DURATION, R0
537            SLL     R0,     2
538            SLL     R0,     1
539            ADDI    #$80 + C_DGR, R0
540            MVO@    R0,     R4
541
542
543            ;; ------------------------------------------------------------ ;;
544            ;;  Force the MOBs to not update.  Clear them from the screen.  ;;
545            ;; ------------------------------------------------------------ ;;
546            MVO     PC,     MOB_BUSY
547
548            MVII    #STICSH, R4
549            MVII    #24,    R1
550            CALL    FILLZERO
551
552            ;; ------------------------------------------------------------ ;;
553            ;;  Say "Final score"                                           ;;
554            ;; ------------------------------------------------------------ ;;
555            CALL    IV_PLAY
556            DECLE   PH_FINALSCO
557
558            MVI     SCORE,  R0
559            CALL    IV_SAYNUM16
560
561            ;; ------------------------------------------------------------ ;;
562            ;;  Disable hand controllers for now, but schedule them to be   ;;
563            ;;  set up in 2 seconds.  When they do get set up, pressing     ;;
564            ;;  any key will go back to the menu.  This task is a one-shot. ;;
565            ;; ------------------------------------------------------------ ;;
566            CALL    STARTTASK
567            DECLE   0
568            DECLE   @@set_hexit
569            DECLE   241,    241     ; Set up HEXIT as dispatch after 1 second
570
571            CLRR    R0
572            MVO     R0,     SHDISP  ; Until then, drop all controller input
573
574            MVII    #1,     R0
575            MVO     R0,     TSKACT
576
577            PULR    PC              ; return to "RUNQ".
578
579
580            ;; ------------------------------------------------------------ ;;
581            ;;  This will get called in 1 second to set up the hand-        ;;
582            ;;  controller dispatch.  The HEXIT dispatch will cause any     ;;
583            ;;  keypress input to exit "GAME OVER" mode and go to the menu. ;;
584            ;; ------------------------------------------------------------ ;;
585@@set_hexit:
586            MVII    #HEXIT, R0
587            MVO     R0,     SHDISP
588            JR      R5
589            ENDP
590
591;; ======================================================================== ;;
592;;  GAME -- Set up the game state.                                          ;;
593;; ======================================================================== ;;
594GAME        PROC
595            PSHR    R5
596
597            ;; ------------------------------------------------------------ ;;
598            ;;  Set up the display.                                         ;;
599            ;; ------------------------------------------------------------ ;;
600            CALL    CLRSCR
601
602            MVII    #$2000, R0
603            MVO     R0,     $200 + 11*20    ; Bottom row is blue
604
605            CALL    PRINT.FLS
606            DECLE   C_YEL,  $200 + 11*20 + 1
607                    ;01234567890123456789
608            STRING   "Time:     Cans:    ",0
609
610            MVII    #$80 + C_WHT, R0
611            MVO     R0,     $200 + 11*20 + 18   ; 0 in 'score'
612
613            ;; ------------------------------------------------------------ ;;
614            ;;  Set up our hand-controller dispatch.                        ;;
615            ;; ------------------------------------------------------------ ;;
616            MVII    #HAND,  R0      ;\__ Set up scanhand dispatch table
617            MVO     R0,     SHDISP  ;/
618
619            ;; ------------------------------------------------------------ ;;
620            ;;  Set up Todd's AI.                                           ;;
621            ;; ------------------------------------------------------------ ;;
622            CALL    STARTTASK
623            DECLE   0
624            DECLE   TODDTASK
625            DECLE   120, 40         ; 3Hz (three times a second)
626
627            ;; ------------------------------------------------------------ ;;
628            ;;  Set up round timer.                                         ;;
629            ;; ------------------------------------------------------------ ;;
630            CALL    STARTTASK
631            DECLE   1
632            DECLE   GAMETIME
633            DECLE   2, 120
634
635            MVI     GAME_LEN, R0
636            INCR    R0
637            MVO     R0,     TIMELEFT
638
639
640            ;; ------------------------------------------------------------ ;;
641            ;;  Reset info for you and Todd.                                ;;
642            ;; ------------------------------------------------------------ ;;
643            MVII    #PLYR,  R4
644            MVII    #12,    R1
645            CALL    FILLZERO
646
647            ;; ------------------------------------------------------------ ;;
648            ;;  Put you and Todd onscreen.                                  ;;
649            ;; ------------------------------------------------------------ ;;
650            MVII    #$1000, R0
651            MVO     R0,     PLYR.XP
652            MVO     R0,     PLYR.YP
653
654            MVII    #$9B00, R0
655            MVO     R0,     TODD.XP
656            MVII    #$5500, R0
657            MVO     R0,     TODD.YP
658
659            MVI     INIT_VEL,R0
660            MVO     R0,     TODD_VEL
661
662            ;; ------------------------------------------------------------ ;;
663            ;;  Randomly display a dozen goodies.                           ;;
664            ;; ------------------------------------------------------------ ;;
665            CALL    DISPDOZ
666
667            ;; ------------------------------------------------------------ ;;
668            ;;  Enable MOBs.                                                ;;
669            ;; ------------------------------------------------------------ ;;
670            CLRR    R0
671            MVO     R0,     MOB_BUSY
672
673            ;; ------------------------------------------------------------ ;;
674            ;;  Reset our score                                             ;;
675            ;; ------------------------------------------------------------ ;;
676            MVO     R0,     SCORE
677
678            ;; ------------------------------------------------------------ ;;
679            ;;  Todd says "Lets Play!"                                      ;;
680            ;; ------------------------------------------------------------ ;;
681            CALL    IV_PLAY
682            DECLE   PH_LETSPLAY
683
684            CALL    IV_PLAY
685            DECLE   RESROM.pa2
686
687            CALL    IV_WAIT
688
689            ;; ------------------------------------------------------------ ;;
690            ;;  Start all the tasks only after Todd is done speaking.       ;;
691            ;; ------------------------------------------------------------ ;;
692            MVII    #2,     R0
693            MVO     R0,     TSKACT
694
695            PULR    PC
696            ENDP
697
698;; ======================================================================== ;;
699;;  DISPDOZ  -- Display a dozen goodies.                                    ;;
700;; ======================================================================== ;;
701DISPDOZ     PROC
702            PSHR    R5
703
704            MVII    #CAN,   R2          ; Value to write to display pop can.
705            MVII    #12,    R1          ; dozen == 12.  :-)
706            MVO     R1,     NUM_CANS    ; Re-initialize our can counter.
707
708@@gloop     MVII    #$8,    R0          ;\__ Generate 8 random bits
709            CALL    RAND                ;/
710
711            CMPI    #20*11, R0          ; Clamp to 0..219 (first 11 rows.)
712            BGE     @@gloop             ; Too big?  Get another.
713
714            ADDI    #$200,  R0          ; Make into a display offset.
715            MOVR    R0,     R3          ; ... in a pointer-capable register
716            CMP@    R3,     R2          ; Already a can there?
717            BEQ     @@gloop             ; Yes:  Pick somewhere else.
718
719            MVO@    R2,     R3          ; No:  Put a can there
720            DECR    R1
721            BNEQ    @@gloop
722
723
724            PULR    PC
725            ENDP
726
727;; ======================================================================== ;;
728;;  GAMETIME -- The game timer.  Counts down remaining time in game.        ;;
729;; ======================================================================== ;;
730GAMETIME    PROC
731
732            ;; ------------------------------------------------------------ ;;
733            ;;  Todd gradually gets faster.                                 ;;
734            ;; ------------------------------------------------------------ ;;
735            MVI     TODD_VEL, R0
736            INCR    R0
737            MVO     R0,     TODD_VEL
738
739            ;; ------------------------------------------------------------ ;;
740            ;;  Count down the timer.                                       ;;
741            ;; ------------------------------------------------------------ ;;
742            MVI     TIMELEFT, R0
743            DECR    R0
744            BMI     SCHEDEXIT           ; Game is over if timer expires.
745            MVO     R0,     TIMELEFT
746
747            ;; ------------------------------------------------------------ ;;
748            ;;  Make a short 'ding'.                                        ;;
749            ;; ------------------------------------------------------------ ;;
750            MVII    #$40,   R1
751            MVO     R1,     PSG0.chn_a_lo
752            CLRR    R1
753            MVO     R1,     PSG0.chn_a_hi
754            MVII    #$38,   R1
755            MVO     R1,     PSG0.chan_enable
756            MVO     R1,     PSG0.chn_a_vol
757            MVII    #$3F,   R1
758            MVO     R1,     PSG0.envlp_lo
759            CLRR    R1
760            MVO     R1,     PSG0.envlp_hi
761            MVO     R1,     PSG0.envelope
762
763            ;; ------------------------------------------------------------ ;;
764            ;;  Display 2-digit clock.  Time-left is still in R0.           ;;
765            ;; ------------------------------------------------------------ ;;
766            MVII    #3,     R2          ; 2-digit field
767            MVII    #C_WHT, R3
768            MVII    #$200+11*20+7, R4   ; Where to put time.
769            B       DEC16A
770
771            ENDP
772
773;; ======================================================================== ;;
774;;  SINTBL  -- Sine table.  sin(disc_dir) * 511                             ;;
775;; ======================================================================== ;;
776SINTBL      PROC
777            DECLE   $0000
778            DECLE   $00C3
779            DECLE   $0169
780            DECLE   $01D8
781            DECLE   $01FF
782            DECLE   $01D8
783            DECLE   $0169
784            DECLE   $00C3
785            DECLE   $0000
786            DECLE   $FF3D
787            DECLE   $FE97
788            DECLE   $FE28
789            DECLE   $FE01
790            DECLE   $FE28
791            DECLE   $FE97
792            DECLE   $FF3D
793            ENDP
794
795;; ======================================================================== ;;
796;;  HAND    Dispatch table.                                                 ;;
797;; ======================================================================== ;;
798HAND        PROC
799            DECLE   HIT_KEYPAD
800            DECLE   HIT_ACTION
801            DECLE   HIT_DISC
802            ENDP
803
804;; ======================================================================== ;;
805;;  HIT_KEYPAD -- Someone hit a key on a keypad.                            ;;
806;; ======================================================================== ;;
807HIT_KEYPAD  PROC
808            JR      R5
809            ENDP
810
811;; ======================================================================== ;;
812;;  HIT_ACTION -- Someone hit a key on a keypad.                            ;;
813;; ======================================================================== ;;
814HIT_ACTION  PROC
815            JR      R5
816            ENDP
817
818;; ======================================================================== ;;
819;;  HIT_DISC   -- Someone hit a key on a keypad.                            ;;
820;; ======================================================================== ;;
821HIT_DISC    PROC
822            PSHR    R5
823
824            ANDI    #$FF,   R2      ; Ignore controller number
825            CMPI    #$80,   R2
826            BLT     @@pressed
827
828            CLRR    R0
829            MVO     R0,     PLYR.TXV
830            MVO     R0,     PLYR.TYV
831            PULR    PC
832
833@@pressed:  MOVR    R2,     R1
834            ADDI    #4,     R1
835            ANDI    #$F,    R1
836            ADDI    #SINTBL,R2          ; sine pointer
837            ADDI    #SINTBL,R1          ; cosine pointer
838            MVI@    R2,     R2          ; sine for our direction
839            MVI@    R1,     R1          ; cosine for our direction
840            NEGR    R2
841            SARC    R1                  ; slow down a bit
842            SARC    R2                  ; slow down a bit
843            MVO     R2,     PLYR.TYV    ; Set our target Y velocity to sine
844            MVO     R1,     PLYR.TXV    ; Set our target X velocity to cosine
845
846            PULR    PC
847
848            ENDP
849
850;; ======================================================================== ;;
851;;  TODDTASK   -- Todd wants to find you!                                   ;;
852;; ======================================================================== ;;
853TODDTASK    PROC
854
855            ;; ------------------------------------------------------------ ;;
856            ;;  This is really simple:  Todd will pick one of 8 directions  ;;
857            ;;  to walk in to try to move towards you.  He picks this only  ;;
858            ;;  based on whether you're left/right or above/below him.      ;;
859            ;; ------------------------------------------------------------ ;;
860
861            CLRR    R0                  ; set X vel to 0
862            CLRR    R1                  ; set Y vel to 0
863            MVI     PLYR.XP,    R2
864            MVI     TODD.XP,    R3
865            SLR     R2,         2
866            SLR     R3,         2
867
868            CMPR    R3,         R2
869            BEQ     @@xp0               ; Equal?  X-vel stays 0
870            MVI     TODD_VEL,   R0      ; Player > Todd?  Move right
871            BGT     @@xp0               ; Player < Todd?  Move left
872            NEGR    R0
873@@xp0
874
875            SUBR    R3,         R2      ;\
876            BPL     @@dx_pos            ; |
877            NEGR    R2                  ; |__ If X coords are close enough
878@@dx_pos    CMPI    #2,         R2      ; |   anyway, force target Xvel to 0
879            BGE     @@xp_ok             ; |
880            CLRR    R0                  ;/
881@@xp_ok
882
883            MVI     PLYR.YP,    R2
884            MVI     TODD.YP,    R3
885            SLR     R2,         2
886            SLR     R3,         2
887
888            CMPR    R3,         R2
889            BEQ     @@yp0               ; Equal?  X-vel stays 0
890            MVI     TODD_VEL,   R1      ; Player > Todd?  Move right
891            BGT     @@yp0               ; Player < Todd?  Move left
892            NEGR    R1
893@@yp0
894
895            SUBR    R3,         R2      ;\
896            BPL     @@dy_pos            ; |
897            NEGR    R2                  ; |__ If Y coords are close enough
898@@dy_pos    CMPI    #2,         R2      ; |   anyway, force target Yvel to 0
899            BGE     @@yp_ok             ; |
900            CLRR    R1                  ;/
901@@yp_ok
902            MVO     R0,     TODD.TXV    ; Set Todd's target X velocity
903            MVO     R1,     TODD.TYV    ; Set Todd's target Y velocity
904
905            JR      R5                  ; Leave
906            ENDP
907
908;; ======================================================================== ;;
909;;  MOB_UPDATE -- This updates the player's and Todd's position and vel.    ;;
910;; ======================================================================== ;;
911MOB_UPDATE  PROC
912            PSHR    R5
913
914            ;; ------------------------------------------------------------ ;;
915            ;;  Bring our actual velocity closer to our target velocity,    ;;
916            ;;  and apply the velocity to our position.  The routine        ;;
917            ;;  @@update_velocity takes a pointer to a record with target   ;;
918            ;;  velocity, current velocity, and current position.  It       ;;
919            ;;  returns with R0 == current velocity, and R3 pointing to     ;;
920            ;;  the current velocity location.                              ;;
921            ;; ------------------------------------------------------------ ;;
922            CALL    @@update_velocity   ; Update player's X velocity
923            DECLE   PLYR.TXV
924            INCR    R3                  ; Point to X position
925            ADD@    R3,     R0          ; Add position to velocity
926            CALL    @@clipx             ; Clip X position to display
927            MVO@    R0,     R3          ; Store updated position
928
929            CALL    @@update_velocity   ; Update player's Y velocity
930            DECLE   PLYR.TYV
931            INCR    R3                  ; Point to Y position
932            ADD@    R3,     R0          ; Add position to velocity
933            CALL    @@clipy             ; Clip Y position to display
934            MVO@    R0,     R3          ; Store updated position
935
936            CALL    @@update_velocity   ; Update Todd's X velocity
937            DECLE   TODD.TXV
938            INCR    R3                  ; Point to X position
939            ADD@    R3,     R0          ; Add position to velocity
940            CALL    @@clipx             ; Clip X position to display
941            MVO@    R0,     R3          ; Store updated position
942
943            CALL    @@update_velocity   ; Update Todd's Y velocity
944            DECLE   TODD.TYV
945            INCR    R3                  ; Point to Y position
946            ADD@    R3,     R0          ; Add position to velocity
947            CALL    @@clipy             ; Clip Y position to display
948            MVO@    R0,     R3          ; Store updated position
949
950
951            ;; ------------------------------------------------------------ ;;
952            ;;  Merge our position with our MOB registers.                  ;;
953            ;; ------------------------------------------------------------ ;;
954            MVII    #@@mobr,    R4      ; MOB information template
955            MVII    #STICSH,    R5
956
957            MVI     PLYR.XP,    R0      ;\
958            SWAP    R0                  ; |
959            ANDI    #$00FF,     R0      ; |- Player X position
960            XOR@    R4,         R0      ; |
961            MVO@    R0,         R5      ;/
962
963            MVI     TODD.XP,    R0      ;\
964            SWAP    R0                  ; |
965            ANDI    #$00FF,     R0      ; |- Todd X position
966            XOR@    R4,         R0      ; |
967            MVO@    R0,         R5      ;/
968
969            ADDI    #6,         R5
970
971            MVI     PLYR.YP,    R0      ;\
972            SWAP    R0                  ; |
973            ANDI    #$007F,     R0      ; |- Player Y position
974            XOR@    R4,         R0      ; |
975            MVO@    R0,         R5      ;/
976
977            MVI     TODD.YP,    R0      ;\
978            SWAP    R0                  ; |
979            ANDI    #$007F,     R0      ; |- Todd Y position
980            XOR@    R4,         R0      ; |
981            MVO@    R0,         R5      ;/
982
983            ADDI    #6,         R5
984
985            MVI@    R4,         R0      ; \_ Player's A register
986            MVO@    R0,         R5      ; /
987            MVI@    R4,         R0      ; \_ Todd's A register
988            MVO@    R0,         R5      ; /
989
990            CLRR    R0
991            MVO     R0,         MOB_BUSY
992
993            ;; ------------------------------------------------------------ ;;
994            ;;  See if we're on a pop can.                                  ;;
995            ;; ------------------------------------------------------------ ;;
996            MVI     PLYR.YP,R1      ;\
997            SWAP    R1              ; |
998            SUBI    #4,     R1      ; |
999            ANDI    #$F8,   R1      ; |
1000            MOVR    R1,     R2      ; |-- Generate row offset from Y coord.
1001            ADDR    R1,     R2      ; |
1002            SLR     R1,     1       ; |
1003            ADDR    R1,     R2      ;/
1004
1005            MVI     PLYR.XP,R1      ;\
1006            SWAP    R1              ; |
1007            SUBI    #4,     R1      ; |
1008            ANDI    #$F8,   R1      ; |__ Generate column offset from X coord.
1009            SLR     R1,     2       ; |
1010            SLR     R1,     1       ; |
1011            ADDR    R1,     R2      ;/
1012
1013            ADDI    #$200,  R2      ; Index into screen
1014            MVI@    R2,     R1
1015            CMPI    #CAN,   R1      ; A pop can here?
1016            BNEQ    @@no_can
1017
1018            CLRR    R1
1019            MVO@    R1,     R2      ; Pick it up (clear it from screen)
1020
1021            MVI     SCORE,  R0
1022            INCR    R0
1023            MVO     R0,     SCORE   ; Add 1 to score
1024
1025            MVII    #$200+11*20+16, R4
1026            MVII    #$2,    R2      ; 3-digit field
1027            MVII    #C_WHT+$8000,R3 ; no leading zeros, score in white
1028            CALL    DEC16           ; Show updated score
1029
1030            MVI     NUM_CANS, R0    ;\
1031            DECR    R0              ; |-- Decrement remaining can count
1032            MVO     R0, NUM_CANS    ;/
1033            BNEQ    @@some_left
1034            CALL    DISPDOZ         ; Display another dozen if we run out.
1035@@some_left:
1036@@no_can:
1037
1038            ;; ------------------------------------------------------------ ;;
1039            ;;  See if Todd's caught us.  He's caught us if our coords are  ;;
1040            ;;  both within 4 pixels of each other.  This tight tolerance   ;;
1041            ;;  allows us to brush past Todd and not get caught.  :-)       ;;
1042            ;; ------------------------------------------------------------ ;;
1043            MVI     PLYR.XP,R0
1044            SUB     TODD.XP,R0
1045            ADCR    PC              ; skip NEGR if diff is positive
1046            NEGR    R0              ; make diff positive
1047            CMPI    #$400,  R0
1048            BC      @@todd_ok
1049
1050            MVI     PLYR.YP,R0
1051            SUB     TODD.YP,R0
1052            ADCR    PC              ; skip NEGR if diff is positive
1053            NEGR    R0              ; make diff positive
1054            CMPI    #$400,  R0
1055            BC      @@todd_ok
1056
1057            PULR    R5
1058            B       SCHEDEXIT       ; If Todd catches up to us, it's gameover
1059
1060@@todd_ok
1061            PULR    PC
1062
1063            ;; ------------------------------------------------------------ ;;
1064            ;;  Bits to copy into MOB registers.                            ;;
1065            ;; ------------------------------------------------------------ ;;
1066@@mobr      DECLE   STIC.mobx_visb      ; make player visible
1067            DECLE   STIC.mobx_visb      ; make Todd visible
1068
1069            DECLE   STIC.moby_yres      ; make player 8x16 MOB
1070            DECLE   STIC.moby_yres      ; make Todd 8x16 MOB
1071
1072            DECLE   STIC.moba_fg1 + STIC.moba_gram + 0*8    ; Player is blue
1073            DECLE   STIC.moba_fg2 + STIC.moba_gram + 0*8    ; Todd is red
1074
1075
1076            ;; ------------------------------------------------------------ ;;
1077            ;;  Velocity update.  Add 1/4th the difference of our target    ;;
1078            ;;  velocity to our actual velocity.  We round the difference   ;;
1079            ;;  towards larger magnitude (eg. up if +ve, down if -ve) so    ;;
1080            ;;  that this finally converges on our target velocity.         ;;
1081            ;; ------------------------------------------------------------ ;;
1082@@update_velocity:
1083            MVI@    R5,         R3      ; Addr of target and current velocity
1084            MVI@    R3,         R0      ; Get target velocity
1085            INCR    R3                  ; Point to current velocity
1086            SUB@    R3,         R0      ; Find diff between target and current
1087            BMI     @@round_dn          ; Round -ve to -oo
1088            ADDI    #3,         R0      ; Round +ve to +oo
1089@@round_dn  SARC    R0,         2       ; Divide by 4 (right-shift by 2)
1090            ADD@    R3,         R0      ; Add update to current velocity
1091            MVO@    R0,         R3      ; Make updated velocity current.
1092            JR      R5
1093
1094            ;; ------------------------------------------------------------ ;;
1095            ;;  Clipping code.  clipx clips for X dimension, clipy clips    ;;
1096            ;;  for Y dimension.  Goal:  Keep player and Todd onscreen.     ;;
1097            ;; ------------------------------------------------------------ ;;
1098@@clipx     CMPI    #$0900,     R0      ;\
1099            BC      @@xt_ok             ; |
1100            MVII    #$0900,     R0      ; |
1101            JR      R5                  ; |__ Limit X to 9 <= X <= 158
1102@@xt_ok     CMPI    #$9F00,     R0      ; |   (Note unsigned compares)
1103            BNC     @@xb_ok             ; |
1104            MVII    #$9F00,     R0      ; |
1105@@xb_ok     JR      R5                  ;/
1106
1107@@clipy     CMPI    #$0900,     R0      ;\
1108            BC      @@yt_ok             ; |
1109            MVII    #$0900,     R0      ; |
1110            JR      R5                  ; |__ Limit Y to 9 <= Y <= 86
1111@@yt_ok     CMPI    #$5700,     R0      ; |   (Note unsigned compares)
1112            BNC     @@yb_ok             ; |
1113            MVII    #$5700,     R0      ; |
1114@@yb_ok     JR      R5                  ;/
1115
1116            ENDP
1117
1118
1119;; ======================================================================== ;;
1120;;  ISR -- Just keep the screen on, and copy the STIC shadow over.          ;;
1121;; ======================================================================== ;;
1122ISR         PROC
1123
1124            ;; ------------------------------------------------------------ ;;
1125            ;;  Basics:  Update color stack and video enable.               ;;
1126            ;; ------------------------------------------------------------ ;;
1127            MVO     R0,     STIC.viden  ; Enable display
1128            MVI     STIC.mode, R0       ; ...in color-stack mode
1129
1130            MVII    #C_GRY, R0          ;\___ Set main display to grey
1131            MVO     R0,     STIC.cs0    ;/
1132            MVII    #C_BLU, R0
1133            MVO     R0,     STIC.cs1    ;\___ Set border, bottom to blue
1134            MVO     R0,     STIC.bord   ;/
1135
1136            ;; ------------------------------------------------------------ ;;
1137            ;;  Update STIC shadow and queue updates for MOB velocities.    ;;
1138            ;; ------------------------------------------------------------ ;;
1139
1140            CALL    MEMCPY              ;\__ Copy over the STIC shadow.
1141            DECLE   $0000, STICSH, 24   ;/
1142
1143            MVI     MOB_BUSY, R0        ; Skip MOB updates if told to.
1144            TSTR    R0
1145            BNEQ    @@no_mobs
1146            MVO     PC,     MOB_BUSY
1147
1148            MVII    #MOB_UPDATE, R0
1149            JSRD    R5,   QTASK     ; Note JSRD:  Must disable ints for QTASK!
1150@@no_mobs:
1151
1152            ;; ------------------------------------------------------------ ;;
1153            ;;  Feed the Intellivoice.                                      ;;
1154            ;; ------------------------------------------------------------ ;;
1155            CALL    IV_ISR
1156
1157            ;; ------------------------------------------------------------ ;;
1158            ;;  Update timer-based tasks and return via stock interrupt     ;;
1159            ;;  return code.                                                ;;
1160            ;; ------------------------------------------------------------ ;;
1161            MVII    #$1014, R5          ; return from interrupt address.
1162            B       DOTIMER             ; Update timer-based tasks.
1163            ENDP
1164
1165;; ======================================================================== ;;
1166;;  INITISR -- Copy our GRAM image over, and then do the plain ISR.         ;;
1167;; ======================================================================== ;;
1168INITISR     PROC
1169            PSHR    R5
1170
1171            CALL    MEMUNPK
1172            DECLE   $3800, GRAMIMG, GRAMIMG.end - GRAMIMG
1173
1174            MVII    #ISR,   R0
1175            MVO     R0,     ISRVEC
1176            SWAP    R0
1177            MVO     R0,     ISRVEC + 1
1178
1179            PULR    PC
1180            ENDP
1181
1182;; ======================================================================== ;;
1183;;  GRAMIMG -- Arrow pictures and other graphics to load into GRAM.         ;;
1184;;  These are stored two bytes-per-word.  Use MEMUNPK to load into GRAM.    ;;
1185;; ======================================================================== ;;
1186GRAMIMG     PROC
1187
1188@@person:   ; Crappy person graphic.   (2 cards)
1189            ; ...#.... 0
1190            ; ..###... 1
1191            ; ..###... 2
1192            ; ...#.... 3
1193            ; ...#.... 4
1194            ; .#####.. 5
1195            ; #.###.#. 6
1196            ; #.###.#. 7
1197            ; #.###.#. 8
1198            ; #.###.#. 9
1199            ; ..###... A
1200            ; ..#.#... B
1201            ; ..#.#... C
1202            ; ..#.#... D
1203            ; ..#.#... E
1204            ; .##.##.. F
1205            DECLE   %0011100000010000 ;10
1206            DECLE   %0001000000111000 ;32
1207            DECLE   %0111110000010000 ;54
1208            DECLE   %1011101010111010 ;76
1209            DECLE   %1011101010111010 ;98
1210            DECLE   %0010100000111000 ;BA
1211            DECLE   %0010100000101000 ;DC
1212            DECLE   %0110110000101000 ;FE
1213
1214@@can:      ; Pop Can graphic
1215            ; ........ 0
1216            ; ........ 1
1217            ; .###.... 2
1218            ; #...#... 3
1219            ; .#####.. 4
1220            ; ..#####. 5
1221            ; ...###.. 6
1222            ; ........ 7
1223            DECLE   %0000000000000000 ;10
1224            DECLE   %1000100001110000 ;32
1225            DECLE   %0011111001111100 ;54
1226            DECLE   %0000000000011100 ;76
1227
1228@@arrow:    ; Arrow graphic
1229            ; ........ 0
1230            ; ........ 1
1231            ; ..##.... 2
1232            ; .##..... 3
1233            ; ######## 4
1234            ; .##..... 5
1235            ; ..##.... 6
1236            ; ........ 7
1237            DECLE   %0000000000000000 ; 10
1238            DECLE   %0110000000110000 ; 32
1239            DECLE   %0110000011111111 ; 54
1240            DECLE   %0000000000110000 ; 76
1241
1242@@end:
1243            ENDP
1244
1245;; ======================================================================== ;;
1246;;  IV_PHRASE_TBL -- These are phrases that will be spoken.                 ;;
1247;; ======================================================================== ;;
1248IV_PHRASE_TBL PROC
1249            DECLE       PHRASE.title
1250            DECLE       PHRASE.letsplay
1251            DECLE       PHRASE.gameover
1252            DECLE       PHRASE.finalscor
1253            ENDP
1254
1255PHRASE      PROC
1256@@title     DECLE       _JH, _OW, RESROM.pa2
1257            DECLE       _ZZ, RESROM.pa1, _BB1, _EY, _CH, _EH, _KK1, RESROM.pa2
1258            DECLE       _PP, _RR1, _IY, _ZZ, _ZH, _EH, _NN1, _TT1, _SS, _SS
1259            DECLE       RESROM.pa2
1260            DECLE       _TT2, _AX, _GG3, RESROM.pa1
1261            DECLE       _AX, _LL, _AO, _NG1, _GG2, RESROM.pa2
1262            DECLE       _TT2, _AO, _AO, RESROM.pa1, _DD1, RESROM.pa2
1263            DECLE       _TT2, _UW2, RESROM.pa2
1264            DECLE       0
1265
1266@@letsplay  DECLE       _LL, _EH, _EH, RESROM.pa1, _TT2, _SS, RESROM.pa2
1267            DECLE       _PP, _LL, _EH, _EY, RESROM.pa2
1268            DECLE       0
1269
1270@@gameover  DECLE       RESROM.pa5
1271            DECLE       _GG3, _EY, _MM, RESROM.pa2
1272            DECLE       _OW, _VV, _ER1, RESROM.pa5
1273            DECLE       0
1274
1275@@finalscor DECLE       _FF, _AY, _NN2, _AX, _LL, RESROM.pa2
1276            DECLE       _SS, _SS, RESROM.pa1, _KK3, _OR, RESROM.pa3
1277            DECLE       0
1278            ENDP
1279
1280
1281
1282;; ======================================================================== ;;
1283;;  LIBRARY INCLUDES                                                        ;;
1284;; ======================================================================== ;;
1285            INCLUDE "../library/print.asm"      ; PRINT.xxx routines
1286            INCLUDE "../library/fillmem.asm"    ; CLRSCR/FILLZERO/FILLMEM
1287            INCLUDE "../library/memcpy.asm"     ; MEMCPY
1288            INCLUDE "../library/memunpk.asm"    ; MEMUNPK
1289            INCLUDE "../library/rand.asm"       ; RAND
1290            INCLUDE "../library/dec16only.asm"  ; DEC16
1291            INCLUDE "../task/scanhand.asm"      ; SCANHAND
1292            INCLUDE "../task/timer.asm"         ; Timer-based task stuff
1293            INCLUDE "../task/taskq.asm"         ; RUNQ/QTASK
1294            INCLUDE "../library/ivoice.asm"     ; IV_xxx routines.
1295            INCLUDE "../library/saynum16.asm"   ; IV_SAYNUM16
1296            INCLUDE "../library/al2.asm"        ; AL2 allophone library.
1297
1298;* ======================================================================== *;
1299;*  This program is free software; you can redistribute it and/or modify    *;
1300;*  it under the terms of the GNU General Public License as published by    *;
1301;*  the Free Software Foundation; either version 2 of the License, or       *;
1302;*  (at your option) any later version.                                     *;
1303;*                                                                          *;
1304;*  This program is distributed in the hope that it will be useful,         *;
1305;*  but WITHOUT ANY WARRANTY; without even the implied warranty of          *;
1306;*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU       *;
1307;*  General Public License for more details.                                *;
1308;*                                                                          *;
1309;*  You should have received a copy of the GNU General Public License       *;
1310;*  along with this program; if not, write to the Free Software             *;
1311;*  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.               *;
1312;* ======================================================================== *;
1313;*                   Copyright (c) 2002, Joseph Zbiciak                     *;
1314;* ======================================================================== *;
1315