-
Notifications
You must be signed in to change notification settings - Fork 5
/
HSTD.ASM
1965 lines (1740 loc) · 45.6 KB
/
HSTD.ASM
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
****************************************************************
*
* Software: LARRY DeMAR, EUGENE JARVIS
* Modified: Shawn Liptak 8/6/91 - Multi color fonts
*
* COPYRIGHT (C) 1991 WILLIAMS ELECTRONICS GAMES, INC.
*
*.Last mod - 1/7/92 13:34
****************************************************************
.FILE 'HSTD.ASM'
.TITLE "ROBO HIGH-SCORE-TO-DATE MANAGEMENT"
.WIDTH 132
.OPTION B,D,L,T
.MNOLIST
.INCLUDE "MPROC.EQU" ;MPROC EQUATES
.INCLUDE "DISP.EQU" ;DISPLAY PROC. EQUATES
.INCLUDE "\VIDEO\SYS\SYS.INC" ;Z UNIT SYSTEM EQUATES
.INCLUDE "\VIDEO\SYS\MACROS.HDR" ;MACROS DEFINITIONS
.INCLUDE "GAME.EQU"
.INCLUDE "IMGTBL.GLO"
.INCLUDE "LINK.EQU" ;LINKY EQUATES
.TEXT
* IN THIS MODULE
.DEF GET_HSCR
.DEF RC_BYTEI
.DEF RC_BYTE
.DEF RC_WORD
.DEF RC_LONG
.DEF RC_LONGI
.DEF WC_BYTE
.DEF WC_BYTEI
.DEF WC_WORD
.DEF WC_WORDI
.DEF WC_LONG
.DEF WC_LONGI
.DEF PT_ENTRY
.DEF INIT_TB
.DEF INIT_TAB ;GEORGES POWER UP ENTRY
.DEF P_FORK
.DEF VAL_TAB
.DEF ROM_PTRS
.DEF ALL_TAB
.DEF TOD_TAB
.DEF ISHSTD,GETINIT,GETINIT1,GETINIT2,INITTIM
.DEF SET_PAGE
.DEF A2_CHECK
.DEF DEC_HSR,INIT_HSR,GET_HSC
.DEF GETHIGH
.def INITMAT
* OTHER MODULES
.REF RD15FONT,SYSCOPY,P1DATA,P2DATA,GPALOBJ
.REF BINBCD,FON150
; .REF AFONT0,GOGO
* HELP.ASM
.REF DEF_PAGE,GET_ADJ
.TEXT
;Sound headers
BEEPSND .WORD >F3FE,>10,>80A2,0 ;LOW BEEP
**************************************************************************
*
* HIGH SCORE TABLE DEFINITIONS
*
**************************************************************************
ALL_TAB
.LONG ALL_TIME_ORIGIN ;LOCATION OF TABLE
.WORD ALL_TIME_ENTRIES-1 ;NUMBER IN THE TABLE (DON'T COUNT ZERO FILLER)
.WORD ALL_TIME_VISIBLE ;# VISIBLE (SHOW 20 ALL TIME)
.WORD ALL_TIME_SELECT ;BITS TO SELECT IT
.LONG ALL_TIME_ROM_TABLE ;ROM IMAGE OF TABLE
.WORD ALL_TIME_ENTRIES/5 ;RESET TABLE IF 1/5 OR MORE BAD
TOD_TAB
.LONG TODAYS_ORIGIN ;LOCATION OF TABLE
.WORD TODAYS_ENTRIES-1 ;NUMBER IN THE TABLE (DON'T COUNT ZERO FILLER)
.WORD TODAYS_VISIBLE ;# VISIBLE (SHOW 20 ALL TIME)
.WORD TODAYS_SELECT ;BITS TO SELECT IT
.LONG TODAYS_ROM_TABLE ;ROM IMAGE OF TABLE
.WORD TODAYS_ENTRIES/5 ;RESET TABLE IF 1/5 OR MORE BAD
P_FORK
MMTM SP,A1
MOVE *A13(PROCID),A1 ;PASS OUR ID TO FORKED PROCESS
CALLA GETPRC ;MAKE THE PROCESS
MMFM SP,A1
RETS
**************************************************************************
*
* AUTO HIGH SCORE TABLE RESET HANDLING
*
**************************************************************************
*
* DEC_HSR
*
* THIS IS CALLED WITH EACH START OR CONTINUE FOR
* A PLAYER. IT REMOVES 1 FROM THE HSTD COUNTER UNLESS
* ITS ALREADY SITTING AT ZERO.
*
**************************************************************************
DEC_HSR
MMTM SP,A0
CALLR GET_HSC ;THIS IS EASY...GET THE COUNTER
JRZ DECHX ;ITS ZERO....NO ACTION.
DEC A0 ;REMOVE A TICK
CALLR PUT_HSC ;PUT IT BACK JAK
DECHX MMFM SP,A0
RETS
**************************************************************************
*
* DELAY_HSRESET
*
* THIS IS CALLED WHEN A NEW ENTRY IS MADE IN THE ALL TIME
* HIGH SCORE TABLE. IF WE'RE CLOSE TO A HIGH SCORE
* RESET, WE PUT IT OFF AWHILE SO HE CAN SHOW HIS FRIENDS
* FOR A FEW DAYS.
*
**************************************************************************
HS_MIN EQU 750 ;ALWAYS 750 PLAYS BEFORE REMOVING A FRESH
* ;NAME.
DELAY_HSRESET:
MMTM SP,A0
CALLR GET_HSC ;THIS IS EASY...GET THE COUNTER
CMPI HS_MIN,A0 ;IS IT TOO LOW
JRHS DHX ;NOPE...NO ACTION
MOVI HS_MIN,A0 ;STOP THE RESET!
CALLR PUT_HSC ;THIS MANY PLAYS TILL RESET!
DHX:
MMFM SP,A0
RETS
**************************************************************************
*
* INIT_HSR
*
* THIS IS CALLED TO INITIALIZE THE HIGH SCORE RESET
* COUNTER TO ITS ADJUSTED VALUE.
*
**************************************************************************
INIT_HSR
MMTM SP,A0
MOVI ADJHSRES,A0
CALLA GET_ADJ ;GET THE ADJUSTED VALUE
CALLR PUT_HSC ;SET IT TO THIS VALUE
MMFM SP,A0
RETS
**************************************************************************
*
* PUT_HSC
*
* THIS IS CALLED TO SET THE HIGH SCORE RESET COUNTER
* TO THE VALUE IN A0.
*
**************************************************************************
PUT_HSC
MMTM SP,A7,A0
CALLR HSR_PAGE ;HIGH SCORE PAGE
MOVI HRESET_COUNTER,A7 ;POINT AT
CALLR WC_LONGI ;WRITE OUR PARAMETER
NOT A0 ;NEGATE IT.
CALLR WC_LONG ;AND WRITE IN SUBSEQUENT SPOT.
CALLA DEF_PAGE ;FLIP PAGE
MMFM SP,A7,A0 ;AND RETURN
RETS
**************************************************************************
*
* GET_HSC
*
* THIS IS CALLED TO FETCH THE HIGH SCORE COUNTER IN A0.
* IF IT IS INVALID, IT WILL IMMEDIATELY BE RESET TO THE
* ADJUSTED VALUE AND THIS IS WHAT WILL BE RETURNED
* IN A0. Z set if 0
*
**************************************************************************
GET_HSC
MMTM SP,A7,A1
CALLR HSR_PAGE ;POINT PAGE AT HSR
MOVI HRESET_COUNTER,A7 ;POINT AT
CALLR RC_LONGI ;READ THE VALUE
MOVE A0,A1 ;STASH IT
CALLR RC_LONG ;READ VERIFIER
NOT A0 ;SEE IF ITS VALID
CMP A0,A1
JRZ GET_HSCX ;IT IS....RETURN IT.
CALLR INIT_HSR ;REFRESH IT WITH FACTORY VALUE
*
* NOW RETURN THE FACTORY VALUE IN CASE IT DIDN'T TAKE
*
MOVI ADJHSRES,A0
CALLA GET_ADJ ;GET THE ADJUSTED VALUE
GET_HSCX
CALLA DEF_PAGE ;FLIP PAGE AWAY FROM US
MOVE A0,A0 ;SET Z FLAG BASED ON COUNTER
MMFM SP,A7,A1
RETS
HSR_PAGE
MMTM SP,A1
MOVI HSR_SELECT,A1
CALLR SET_PAGE
MMFM SP,A1
RETS
**********************************************************************
*
*DISPLAY HIGH SCORE TABLE
*
**********************************************************************
GETHIGH
movi ALL_TIME_SELECT,a1
callr SET_PAGE
movi [62,27],a10 ;Screen start address
movi ALL_TIME_ORIGIN+HS_INITS+HS_SIZE,a8 ;Table start address
JSRP HSINITDSP
movi [62,63],a10
movi ALL_TIME_ORIGIN+HS_SCORE+HS_SIZE,a8
JSRP HSNUMDSP
movi TODAYS_SELECT,a1
CALLR SET_PAGE
movi [62,227],a10
movi TODAYS_ORIGIN+HS_INITS+HS_SIZE,a8
JSRP HSINITDSP
movi [62,263],a10
movi TODAYS_ORIGIN+HS_SCORE+HS_SIZE,a8
JSRP HSNUMDSP
RETP
********************************
* DISPLAY SCORE TABLE SCORES IN ATTRACT
* A8=TABLE INDEX
* A10=DISPLAY COORD Y:X
HSNUMDSP
movk 10,a11 ;# scores
movi >1010101,a9 ;Start color 1, pal 1
hsn10 move a8,a7
callr RC_LONG ;GET THE SCORE=A0
move a7,a8
move a10,a3 ;Dest Y:X
clr a6 ;Blanking ON
move a12,-*sp,L
movk 8,a12
callr HSNUML0
move *sp+,a12,L
SLEEPK 1
addi HS_SIZE,a8
addi >120000,a10 ;Next line
dsj a11,hsn10
RETP
********************************
* DMA a BCD number (Trashes A0-A1)
* A0=#
* A3=Y:X
* A6=Blank flag (0=ON)
* A9=Color:Pal
* A12=#Digits
*Rets:
* A9=Next Color:Pal
HSNUML0
mmtm sp,a2,a3,a4,a5,a7,a8,a10,a11
move a0,a11
srl 4*3,a0
jrz hsnlp ;No comma?
subk 6,a3 ;-X
hsnlp move a11,a1
srl 28,a1 ;Next digit value into lowest 4 bits
jrnz hsn5
move a6,a6
jrz hsn50 ;Skip digit if blanking
hsn5 cmpi 3,a12
jrnz hsn13
move a6,a6
jrz hsn13 ;1st non zero?
move a1,-*sp
movi RD15FONT+11*32,a1 ;Comma
move *a1,a1,L
move a3,a10
addi >b0000,a3 ;+Y
callr font_dma
move a10,a3
addk 6,a3 ;+X
move *sp+,a1
hsn13 cmpi 9,a1
jrls hsn15 ;Digit ok?
movk 9,a1 ;Output 9 on an error
hsn15 movk 1,a6 ;Blanks off
move a3,a10
cmpi 1,a1
jrnz hsn30
addk 3,a3 ;Offset 1's X
hsn30 sll 7,a1 ;*128 (next header)
addi FON150,a1 ;Base address of image header
callr font_dma
move a10,a3
hsn50 addk 14,a3 ;step to next
sll 4,a11 ;next digit
dsj a12,hsnlp
addi >f0f0000,a9
cmpi >30300000,a9
jrls hsnx
addi >101,a9 ;Next PAL
zext a9
addi >1010000,a9 ;Color 1
hsnx mmfm sp,a2,a3,a4,a5,a7,a8,a10,a11
rets
********************************
* DMA a character (trashes A0-A5,A7-A8)
* A1=*Obj header
* A3=Y:X
* A9=Color:Pal
font_dma
move *a1(>40),a4,L ;Get sag
move *a1+,a2 ;Get X size
move a2,a7
addk 3,a7 ;Round up to 4 bit boundary
srl 2,a7
sll 5,a7 ;X size*8
addi >10000,a2 ;Y Size 1
move *a1+,a8 ;Get Y size
movi DMACNZ,a5
move a9,a1
fdlp calla QDMAN
addi >1010000,a1 ;Next color
add a7,a4 ;Set SAG for next line
addi >10000,a3 ;Y+1
dsj a8,fdlp
rets
********************************
* DISPLAY SCORE TABLE INITIALS IN ATTRACT
* A8=TABLE INDEX
* A10=DISPLAY COORD Y:X
HSINITDSP
movk 10,a11 ;10 Scores
hsid10 move a8,a7
subi HS_INITS,a7
callr RC_LONG ;Get the score in a0
move a0,a2
addi HS_INITS,a7
move a10,a3 ;Y:X
movi >01010101,a1 ;Flash if inits match score
callr A2_CHECK
jrz hsid30
movi >1f1f0303,a1 ;Color:pal
hsid30 move a12,-*sp,L
movk 3,a12
hsid50 callr RC_BYTE ;Get initial
addk 16,a7 ;Step to next initial
callr initout ;Output initial
dsj a12,hsid50
move *sp+,a12,L
addi >120000,a10 ;Next Y
move a7,a8
SLEEPK 1
addi HS_SIZE-48,a8 ;Get next guy in cmos
dsj a11,hsid10
RETP
********************************
* Output initial in RD15FONT
* A0=ASCII
* A1=COLOR:PALETTE
* A3=Y:X
* Trashes A0
*Rets:
* A3=New Y:X
initout
mmtm sp,a1,a2,a4,a5,a7,a8,a9,a10,a11
subi >21,a0 ;Start of table
cmpi >7d->21,a0
jrhi inox
sll 5,a0
addi RD15FONT,a0
move *a0,a0,L ;Get pointer
move *a0(>40),a4,L ;Get sag
move *a0+,a2 ;Get X size
move a2,a7
addk 3,a7 ;Round up to 4 bit boundary
srl 2,a7
sll 5,a7 ;X size*8
movk 12,a9
sub a2,a9
sra 1,a9 ;/2
add a9,a3 ;Add X offset so letter centered
addi >10000,a2 ;Y Size 1
move *a0+,a8 ;Get Y size
clr a11 ;A11=Line cnt
move a3,a10
movi DMACNZ,a5
inolp calla QDMAN
addk 1,a11
cmpi 15,a11
jrge ino50 ;Out of colors?
addi >1010000,a1 ;Next color
ino50 add a7,a4 ;Set SAG for next line
addi >10000,a3 ;Y+1
dsj a8,inolp
move a10,a3
sub a9,a3
inox addk 17,a3
mmfm sp,a1,a2,a4,a5,a7,a8,a9,a10,a11
rets
********************************
*OUTPUT INITIAL RD15FONT
*A0=ASCII
*A1=COLOR:PALETTE
*A3=COORD Y:X
INITOUT
mmtm sp,a2,a4,a5
subi >21,a0 ;Start of table
cmpi >7d->21,a0
jrhi initerr
SLL 5,A0
ADDI RD15FONT,A0
MOVE *A0,A0,L ;GET POINTER
MOVE *A0,A2,L ;GET SIZE
movk 12,a4
subxy a2,a4
sext a4
sra 1,a4 ;/2
add a4,a3 ;Add X offset so letter centered
move a4,-*sp
move *a0(>40),a4,L ;GET SAG
movi DMACNZ,a5
calla QDMAN
move *sp+,a0
sub a0,a3
initerr addk 17,a3
mmfm sp,a2,a4,a5
rets
**************************************************************************
*
* HIGH LEVEL HSTD ROUTINES
*
**************************************************************************
;TEN_X EQU 0F00000H
;ONE_O_X EQU 0F40000H
;ONE_X EQU 0FE0000H
;
;TIMER_TENS:
; .LONG 0,0,TEN_X,1500000H ;XV, YV, XP, YP
; .WORD 0,30 ;Z VEL 10....Z POS 0
; .LONG NO_IMG,1,0 ;IMG, Z SIZE, COLLISION VECT
; .WORD DMACNZ,5 ;WRITE NON-ZERO CONSTANT, OBJECT ID
; .LONG 0 ;NO SCANNER BLIP
;
;TIMER_UNITS:
; .LONG 0,0,ONE_X,1500000H ;XV, YV, XP, YP
; .WORD 0,30 ;Z VEL 10....Z POS 0
; .LONG NO_IMG,1,0 ;IMG, Z SIZE, COLLISION VECT
; .WORD DMACNZ,5 ;WRITE NON-ZERO CONSTANT, OBJECT ID
; .LONG 0 ;NO SCANNER BLIP
;
;NO_IMG:
; ; .WORD 4,4,0,0 ;WIDTH, HEIGHT, OFFSET,OFFSET
; .LONG IROM,0 ;SOURCE, PALETTE
;
;TIMER_COLOR EQU 0F5F5H ;CONSTANT USED FOR TIMER
;
;SETUP_TIMER:
; MOVI TIMER_UNITS,A14
; CALLR GET_DIGIT
; MOVE A0,A9 ;KEEP UNITS IN A9
;
; MOVI TIMER_TENS,A14
; CALLR GET_DIGIT
; MOVE A0,A10 ;THEY'RE SET!
; RETS
;
;GET_DIGIT:
; MMTM SP,A1
; CALLA GPALOBJ ;GET THE STUFF
; CALLA STFOBJ
;
; MOVI TIMER_COLOR,A1
; MOVE A1,*A0(OCONST),W
;
; CALLA INSOBJ ;ITS SET
; MMFM SP,A1
; RETS
;
;UPDATE_TIMER:
; MOVE A0,A3 ;FIRST DO TENS
; MOVE A3,A1
; SRL 4,A1
; JRNZ REAL_TENS
;
; MOVE A10,A0
; JRZ TENS_GONE
; CALLA DELPAL ;TRASH IT!
; CALLA DELOBJ
; CLR A10
;
; MOVI (TEN_X+ONE_X)/2,A0
; MOVE A0,*A9(OXVAL),L ;CENTER THE ONES
;
; JRUC TENS_GONE
;
;REAL_TENS:
; CMPI 1,A1 ;ARE WE DOWN TO "10"
; JRNZ NOT_ONE_0
;
; MOVI ONE_O_X,A0
; MOVE A0,*A10(OXVAL),L ;SLIDE IT OVER TO LOOK NICE!
;NOT_ONE_0:
; MOVE A10,A2 ;GET 10'S OBJECT IN A2
; CALLR UPDATE_NUMBER ;OBJECT A2 GETS NUMBER IN A1
;
;TENS_GONE:
; MOVE A3,A1
; MOVE A9,A2
; CALLR UPDATE_NUMBER
; RETS
;
;BLANK_TIMER:
; MMTM SP,A0
; CLR A0
; MOVE A0,*A9(OCONST),W
; MOVE A10,A10 ;TENS PRESENT?
; JREQ BT_NT ;NOPE
; MOVE A0,*A10(OCONST),W
;BT_NT:
; MMFM SP,A0
; RETS
;
**************************************************************************
*
* UPDATE_NUMBER
*
* OBJECT IN A2
* NIBBLE IN A1
*
* GET CORRECT NUMBER IMAGE IN THE OBJECT.
*
**************************************************************************
;UPDATE_NUMBER:
; MMTM SP,A1,A4,A6,A7,A8
; MOVI RD15FONT,A6
; ANDI 0FH,A1
; ADDI LET_0-EX_PT,A1 ;INDEX TO TABLE
; SLL 5,A1
; ADD A1,A6 ;POINT TO IMAGE (A1 FOR ANI)
; MOVE *A6,A1,L ;FETCH THE IMAGE FOR ANI
;
; MOVE A2,A8 ;OBJECT STRUCTURE FOR ANI
; MOVE *A2(OFLAGS),A4 ;FETCH THE OFLAGS
; CALLA ANI ;SET NEW ANIMATION PICTURE
;
; MOVI TIMER_COLOR,A6 ;GET THE DRAWING COLOR BACK OUT.
; MOVE A6,*A2(OCONST),W
;
; MMFM SP,A1,A4,A6,A7,A8
; RETS
;
***************************************************************************
*
* ISHSTD
*
* DID ANYONE MAKE THE HIGH SCORE TABLE.
* A0=0 NO (EQ)
* A0=1 PLAYER 1 MADE IT (NE)
* A0=2 PLAYER 2 MADE IT (NE)
* A0=3 NOBODY MADE IT (NE)
*
***************************************************************************
ISHSTD
MMTM SP,A8,A10
MOVK 1,A0
MOVE @P1DATA+PSCORE,A8,L
MOVE @P2DATA+PSCORE,A10,L
CALLR CHECK_ALL_TIME
JRNZ ISHSTD1
CALLR CHECK_TODAY
JRNZ ISHSTD1
CLR A0
ISHSTD1
SWAP A8,A10
ADDK 2,A0
CALLR CHECK_ALL_TIME
JRNZ VERY_HIGH
CALLR CHECK_TODAY
JRNZ VERY_HIGH
SUBK 2,A0
VERY_HIGH
MMFM SP,A8,A10
RETS
CHECK_ALL_TIME
MMTM SP,A0,A2,A8
MOVE A8,A0
MOVE A10,A2 ;SHOW "OTHER" SCORE IN A2
MOVI ALL_TAB,A8
CALLR CHECK_SCORE
MMFM SP,A0,A2,A8
RETS
CHECK_TODAY
MMTM SP,A0,A2,A8
MOVE A10,A2 ;SHOW "OTHER" SCORE IN A2
MOVE A8,A0
MOVI TOD_TAB,A8
CALLR CHECK_SCORE
MMFM SP,A0,A2,A8
RETS
********************************
*TIMER FOR INITIAL PROCESS
.BSS INITTIMR,16
.BSS GET1FLG,16
.BSS GET2FLG,16
INITTIM
CLR A0
MOVE A0,@GET1FLG
MOVE A0,@GET2FLG
CREATE HISCPID,INTIML
MOVI 30,A1
MOVE A1,@INITTIMR
MOVE A1,*A0(PA10),L ;SET A10 TO 60
RETS
INTIML
MOVE @INITTIMR,A0
DEC A10
JRNE INTIML1
MOVI 60,A10
DEC A0
JRN INITTIMX
MOVE A0,@INITTIMR
INTIML1 CALLA BINBCD
MOVI [19,194],A3
MOVE A12,-*SP,L
MOVK 2,A12
MOVK 1,A6
SLL 24,A0 ;SHIFT DIGITS INTO PLACE
movi >1010101,a9
callr HSNUML0
MOVE *SP+,A12,L
SLOOP 1,INTIML
INITTIMX
DIE
********************************
*GET PLAYERS INITIALS - WAIT TILL DONE
GETINIT
SLEEPK 10
CALLR DONCK
JRNE GETINIT
GETINITX
SLEEP 60 ;WAIT A SEC. THEN BOOK
RETP
********************************
*CHECK IF INITIALS DONE
DONCK
MOVE @INITTIMR,A2
JREQ DONCKX
MOVE @GET1FLG,A0
MOVE @GET2FLG,A1
ADD A0,A1
DONCKX RETS
********************************
*GET PLAYER 1 INITIALS
GETINIT1
MOVI P1ITAB,A0
MOVI LTRBOX1,A2 ;(OIMG) ;SHELL PROGRAM
JRUC GTINIT
P1ITAB
.LONG P1DATA+PSCORE ;SCORE VALUE
.byte " ",0
.LONG >00000000 ;START BOX COORD
.IF YUNIT
.LONG SWITCH,SWITCH+4,SWITCH+18 ;SWITCH LOCATIONS
.ELSE
.LONG SWITCH,SWITCH+8,SWITCH+24
.ENDIF
.LONG >002c0030 ;INITIAL DISPLAY ADDRESS
.LONG >3b3b0000 ;COLOR:PALETTE
.LONG GET1FLG
********************************
*GET PLAYER 2 INITIALS
GETINIT2
MOVI P2ITAB,A0
MOVI LTRBOX2,A2 ;OIMG
JRUC GTINIT
P2ITAB
.LONG P2DATA+PSCORE ;SCORE VALUE
.byte " ",0
.LONG >00000005 ;START BOX COORD
.IF YUNIT
.LONG SWITCH+8,SWITCH+12,SWITCH+21 ;SWITCH LOCATIONS
.ELSE
.LONG SWITCH+4,SWITCH+12,SWITCH+25
.ENDIF
.LONG >002c0124 ;INITIAL DISPLAY ADDRESS
.LONG >3b3b0000 ;COLOR:PALETTE
.LONG GET2FLG
********************************
*GET YOUR INITIALS PROCESS
*A0=POINTER TO SETUP TABLE
*A2=OIMG
*A8=POINTER TO BOX OBJECT
*A9=DEBOUNCE TIMER, INITIAL ENTRY
*A10=DEBOUNCE TIMER, MOVE JOYSTICK
*A11=INITIAL #
*PDATA=SCORE
*PDATA+>20,PDATA+>28,PDATA+>30,PDATA+>38 = INITIAL STRING
*PDATA+>40=CURRENT BOX COORD Y:X
*PDATA+>60=MOVE STICK ADDRESS
*PDATA+>80=FIRE STICK ADDRESS
*PDATA+>A0=START BUTTON ADDRESS
*PDATA+>C0=INITIALS DISPLAY Y:X OFFSET
*PDATA+>E0=COLOR:PALETTE INITIAL
*PDATA+>100=INITIAL DONE FLAG (DONE=0)
GTINIT
MOVE A13,A8
ADDI PDATA,A8
MOVE *A0+,A1,L
MOVE *A1+,*A8+,L ;PUT THE SCORE
MOVK 8,A1
GTI0L MOVE *A0+,A3,L
MOVE A3,*A8+,L
DSJS A1,GTI0L
MOVK 1,A1
MOVE A1,*A3,W ;INCREMENT DONE FLAG
CLR A11 ;CURRENT INITIAL WORKING ON
CLR A10 ;JOYSTICK DEBOUNCE TIMER
CLR A9 ;FIRE/START DEBOUNCE
*CREATE BOX OBJECT
CLR A0 ;A0=OXVAL
CLR A1 ;A1=OYVAL
MOVI 9EH,A3 ;(OZPOS)
MOVI DMAWNZ,A4 ;(OFLAGS) NON-ZERO VALUE
clr a5 ;(OID)
CLR A6 ;(OXVEL)
CLR A7 ;(OYVEL)
CALLA BEGINOBJ
GTL CMPI 3,A11 ;GET MOVE SWITCHES
JRHS GTL4 ;ENTERED 'EM ALL
CALLR DONCK
JRNE GTL0
MOVI 3,A11 ;TIMES UP STUFF EM IN
JRUC GTL3X
GTL0 MOVE *A13(PDATA+>60),A0,L ;GET MOVE SWITCH ADDRESS
MOVE *A0,A1,W
NOT A1
SLL 28,A1
SRL 28,A1
JRNE GTL1
CLR A10 ;CLEAR DEBOUNCE TIMER
JRUC GTL5
GTL1 MOVE A10,A10
JRNE GTL5
MOVK 12,A10
SLL 4,A1
ADDI IJOYTAB,A1
MOVB *A1,A0 ;GET DX
MOVB *A1(8),A1 ;GET DY
MOVE *A13(PDATA+>40),A2 ;GET X COORD
MOVE *A13(PDATA+>50),A3 ;GET Y COORD
ADD A2,A0 ;ADD DX, CHECK LIMITS
JRNN GM1
CLR A0
GM1 CMPI 5,A0
JRLS GM2
MOVK 5,A0
GM2 ADD A3,A1 ;ADD DY CHECK LIMITS
JRNN GM3
CLR A1
GM3 CMPI 4,A1
JRLS GM4
MOVK 4,A1
GM4 MOVE A0,*A13(PDATA+>40) ;SAVE COORDS
MOVE A1,*A13(PDATA+>50)
*FORM BOX XY COORD AND UPDATE IT
GTL5 MOVE *A13(PDATA+>40),A0 ;Get X
MOVE *A13(PDATA+>50),A1 ;Get Y
movk 21,a3
movk 22,a5
MPYU A0,A3 ;FORM X OFFSET
MPYU A1,A5 ;FORM Y OFFSET
move @WORLDTLX+16,a2
add a2,a3
addi 137,a3
move @WORLDTLY+16,a2
add a2,a5
addi 41,a5
MOVE A3,*A8(OXPOS) ;UPDATE POSITION
MOVE A5,*A8(OYPOS)
*UPDATE YOUR LETTER VALUE
*A0=X OFFSET
*A1=Y OFFSET
MOVK 6,A3
MPYU A1,A3
ADD A0,A3 ;THIS IS THE INDEX TO MATRIX
SLL 3,A3
ADDI INITMAT,A3
MOVB *A3,A0
MOVE A11,A4
SLL 3,A4
ADD A13,A4
ADDI PDATA+>20,A4
MOVB A0,*A4 ;STORE OUT CURRENT INITIAL
*UPDATE LETTER POSITION SELECTED
; MOVE *A13(PDATA+>80),A0,L ;FIRE STICK COORD
; MOVE *A0,A0,W ;READ IT FOLKS
; NOT A0
; SLL 28,A0
; SRL 27,A0
MOVE *A13(PDATA+>A0),A1,L
MOVE *A1,A1,W
NOT A1
SLL 31,A1
; SRL 31,A1
; ADD A1,A0
JRNE GTL3
CLR A9 ;CLEAR DEBOUNCE TIMER
JRUC GTL4
GTL3
MOVE A9,A9 ;DEBOUNCE STILL ON
JRNE GTL4
MOVI 120,A9
MOVB *A4,A0 ;CHECK FOR RUB DUDES...
CMPI >3C,A0
JRNE GTL3A ;NO....
DEC A11
JRNN GTL30
CLR A11 ;CAN'T RUB FIRST CHAR
JRUC GTL4
GTL30
MOVI BEEPSND,A0
CALLA ONESND
MOVK >20,A0
MOVB A0,*A4 ;THROW OUT A SPACE
JRUC GTL4
GTL3A
MOVI BEEPSND,A0
CALLA ONESND
INC A11
CMPI 3,A11
JRLO GTL4
GTL3X
CALLA DELOBJA8
MOVE *A13(PDATA+>100),A0,L
CLR A1
MOVE A1,*A0 ;CLEAR DONE FLAG
CALLR GTX ;UPDATE TABLE ENTRY
*UPDATE YOUR LETTER DISPLAY
GTL4
MOVE A13,A2 ;GET INITIAL STORE ADDRESS
ADDI PDATA+>20,A2
MOVK 3,A1 ;DO THREE INITIALS
MOVE *A13(PDATA+>C0),A3,L ;GET BASE SCREEN ADDRESS
GTL5L
MOVB *A2,A0
MMTM SP,A1,A2,A3
MOVE *A13(PDATA+>E0),A1,L ;GET COLOR:PALETTE
CALLR INITOUT
MMFM SP,A1,A2,A3
ADDK >16,A3 ;INC SCREEN COORD
ADDK 8,A2 ;INC DISPLAY ADDRESS
DSJS A1,GTL5L
*DEC DEBOUNCE TIMERS
MOVE A10,A10 ;DEC TIMER ?
JREQ GTL6 ;NO, ALREADY ZERO
DEC A10 ;DEC IT
GTL6
MOVE A9,A9 ;DEC TIMER ?
JREQ GTL7 ;NO, ALREADY ZERO
DEC A9 ;DEC IT
GTL7
SLEEPK 1
JRUC GTL
; CALLR DONCK
; JRNE GTL
*STUFF HI SCORE
GTX
MOVE *A13(PDATA),A0,L ;GET SCORE POINTS
MOVE A13,A1
ADDI PDATA+>20,A1 ;POINT TO INITIAL STORAGE
MOVI TOD_TAB,A8 ;ALWAYS ADD TO TODAYS (EVEN IF SPACES)
CALLR ADD_ENTRY ;ADD EM TO THIS ONE IF NEC.
MOVI ALL_TAB,A8
CALLR ADD_ENTRY ;ADD EM TO THE TABLE
JRC TOO_BAD ;DIDN'T MAKE ALL TIME
CALLR DELAY_HSRESET ;NEW ENTRY....DON'T RESET TOO QUICK
TOO_BAD RETS
********************************
*INITIAL ENTRY JOYSTICK TABLE
;RLDU
IJOYTAB
.BYTE 0,0 ;0000
.BYTE 0,-1 ;0001
.BYTE 0,1 ;0010
.BYTE 0,0 ;0011
.BYTE -1,0 ;0100