]> github.com/historicalsource and other repositories - mspacman-7800.git/blob - SPEED.S
Initial import.
[mspacman-7800.git] / SPEED.S
1 *\r
2 *  SPEED.S         SPEED REGISTER CODE\r
3 *\r
4 \r
5 *\r
6 * INITSPED        - INITIALIZE SPEED REGISTERS\r
7 *\r
8 INITSPED\r
9           LDY     LEVEL                  ;GET THE RIGHT INITIAL SPEEDS\r
10           CPY     #21\r
11           BMI     ISSMALL\r
12           LDX     #31+128\r
13           JMP     INITSPD\r
14 \r
15 ISSMALL   CPY     #$05\r
16           BMI     ISSMALER\r
17           LDY     #$05\r
18 ISSMALER  LDX     ISPED,Y\r
19 \r
20 \r
21 INITSPD   LDY     #31\r
22 SPDLOOP   LDA     SPEEDS,X\r
23           STA     M0SPEED0,Y\r
24           DEX\r
25           DEY\r
26           BPL     SPDLOOP\r
27 \r
28           LDX     RACK                   ;GET OFFSET FOR THE RIGHT RED THRESHOLD\r
29           CPX     #18\r
30           BMI     INITREDS\r
31           LDX     #$18\r
32 \r
33 INITREDS  LDY     REDSOFF,X\r
34           LDA     REDS,Y\r
35           STA     REDTHRSH\r
36           LDA     REDS+1,Y\r
37           STA     REDTHRSH+1\r
38           RTS\r
39 \r
40 *\r
41 * INCMSPED        - INCREMENT MONSTER SPEEDS\r
42 *\r
43 INCMSPED  LDX     #4\r
44 INCMLOOP  CLC\r
45           ROL     M0SPEED0,X\r
46           ROL     M0SPEED1,X\r
47           ROL     M0SPEED2,X\r
48           ROL     M0SPEED3,X\r
49           LDA     M0SPEED0,X\r
50           ADC     #0\r
51           STA     M0SPEED0,X\r
52           DEX\r
53           BPL     INCMLOOP\r
54           RTS\r
55 \r
56 *\r
57 * INCPSPED        - INCREMENT PAC SPEEDS\r
58 *\r
59 INCPSPED  LDX     #1\r
60 INCPLOOP  CLC\r
61           ROL     P0SPEED0,X\r
62           ROL     P0SPEED1,X\r
63           ROL     P0SPEED2,X\r
64           ROL     P0SPEED3,X\r
65           LDA     P0SPEED0,X\r
66           ADC     #0\r
67           STA     P0SPEED0,X\r
68           DEX\r
69           BPL     INCPLOOP\r
70 \r
71           RTS\r
72 \r
73 * CHKMON: SETS A IF THIS MONSTER IS TO MOVE THIS CYCLE\r
74 *         IN      X IS THE MONSTER NUMBER\r
75 *         OUT     A IS TRUE IF IT IS TIME TO MOVE\r
76 *         USES    A,Y\r
77 \r
78 CHKMON\r
79           LDA     M0STATE,X\r
80           CMP     #MSTEYES\r
81           BNE     CHKMON1\r
82           LDA     #1\r
83           RTS\r
84 CHKMON1\r
85           LDY     M0SPEED,X\r
86           LDA     M0TUNNEL,X\r
87           BEQ     CHKMON2\r
88           LDY     #SPDSLOW\r
89 CHKMON2\r
90           LDA     M0SPEED0,Y\r
91           AND     #1\r
92           RTS\r
93 \r
94 * CHKPAC: SETS A IF PAC IS TO MOVE THIS CYCLE\r
95 *         IN\r
96 *         OUT     A IS TRUE IF IT IS TIME TO MOVE\r
97 *         USES    A,Y\r
98 \r
99 CHKPAC\r
100           LDA     ISBLUE\r
101           BNE     CHKPAC1\r
102           LDA     P0SPEED0\r
103           AND     #1\r
104           RTS\r
105 CHKPAC1\r
106           LDA     P0SPEED0+1\r
107           AND     #1\r
108           RTS\r
109 \r
110 SPEEDS    DB      $22,$21,$21,$89,$89    ;MONSTER SPEEDS RACK 0\r
111           DB      $22,$08,$08,$12,$12    ;  8,6,6,9,9\r
112           DB      $22,$21,$21,$24,$24\r
113           DB      $22,$08,$08,$44,$44\r
114           DB      $4A,$2A                ;PAC SPEEDS RACK 0\r
115           DB      $52,$95                ;  13,14\r
116           DB      $95,$2A\r
117           DB      $29,$95\r
118           DB      $07,$A4                ; REVERSE TIMES(HAVE SAME RACKS)\r
119           DB      $19,$54\r
120 \r
121           DB      $2A,$24,$22,$55,$6A    ;MONSTER SPEEDS RACK 1\r
122           DB      $AA,$92,$22,$55,$AA    ;  15,10,8,16,17\r
123           DB      $55,$24,$22,$55,$D5\r
124           DB      $55,$92,$22,$55,$55\r
125           DB      $55,$6A                ;PAC SPEEDS RACK 1\r
126           DB      $55,$D5                ;  16,17\r
127           DB      $55,$6A\r
128           DB      $55,$D5\r
129           DB      $01,$A4                ; REVERSE TIMES(HAVE SAME RACKS)\r
130           DB      $06,$54\r
131 \r
132           DB      $6A,$24,$24,$6A,$5A    ;MONSTER SPEEDS RACK 2-4\r
133           DB      $AA,$92,$48,$D5,$D6    ;  17,11,9,18,19\r
134           DB      $D5,$49,$91,$6A,$B5\r
135           DB      $55,$25,$22,$D5,$AD\r
136           DB      $6A,$5A                ;PAC SPEEDS RACK 2-4\r
137           DB      $D5,$D6                ;  18,19\r
138           DB      $6A,$B5\r
139           DB      $D5,$AD\r
140           DB      $01,$A4                ; REVERSE TIMES(HAVE SAME RACKS)\r
141           DB      $06,$54\r
142 \r
143           DB      $5A,$25,$24,$6D,$6D    ;MONSTER SPEEDS RACK 5-20\r
144           DB      $D6,$25,$92,$6D,$B6    ;  19,12,10,20,20\r
145           DB      $B5,$25,$24,$6D,$6D\r
146           DB      $AD,$25,$92,$6D,$B6\r
147           DB      $6D,$6D                ;PAC SPEEDS RACK 5-20\r
148           DB      $6D,$6D                ;  20,20\r
149           DB      $6D,$6D\r
150           DB      $6D,$6D\r
151           DB      $01,$2C                ; REVERSE TIMES(HAVE SAME RACKS)\r
152           DB      $05,$DC\r
153 \r
154           DB      $5A,$24,$24,$6D,$6D    ;MONSTER SPEEDS RACK 21- \r
155           DB      $D6,$48,$92,$6D,$B6    ;  19,9,10,20,20\r
156           DB      $B5,$91,$24,$6D,$DB\r
157           DB      $AD,$22,$92,$6D,$6D\r
158           DB      $6A,$6A                ;PAC SPEEDS RACK 21- \r
159           DB      $D5,$D5                ;  18,18\r
160           DB      $6A,$6A\r
161           DB      $D5,$D5\r
162           DB      $01,$2C                ; REVERSE TIMES(HAVE SAME RACKS)\r
163           DB      $05,$DC\r
164 \r
165 \r
166 REDS      DB      $24,$1A                ;THRESHOLDS FOR RED MONSTER GETTING\r
167           DB      $2E,$1F                ;  MEAN - NOTE:  I HAVE INCREASED ALL\r
168           DB      $38,$24                ;  THESE VALUES BY $10 TO COMPENSATE\r
169           DB      $42,$29                ;  FOR THE SMALLER MAZES\r
170           DB      $4C,$2E\r
171           DB      $60,$38\r
172           DB      $74,$42\r
173           DB      $88,$4C\r
174 \r
175 *  OFFSETS INTO ABOVE TABLE BY RACK\r
176 REDSOFF   DB      $00,$00,$02,$04,$04,$04,$06,$06\r
177           DB      $06,$08,$08,$08,$0A,$0A,$0A,$0C\r
178           DB      $0C,$0C,$0E\r
179 \r
180 *  INITIAL SPEED TABLE, BY RACK THROUGH RACK 5\r
181 ISPED     DB      31,31+32,31+64,31+64,31+64,31+96\r