]> github.com/historicalsource and other repositories - mspacman-7800.git/blob - INTRSECT.S
Initial import.
[mspacman-7800.git] / INTRSECT.S
1 *\r
2 * INTRSECT.S      PAC-FRUIT AND PAC-MONSTER INTERSECT ROUTINES\r
3 *\r
4 \r
5 * PFINTR          PAC-FRUIT INTERSECT ROUTINE\r
6 *         IN:\r
7 *         USES:\r
8 \r
9 PFINTR\r
10           LDA     FENABLE                ;MAKE SURE FRUIT ON\r
11           BEQ     PFIEND\r
12           LDA     FSCORE                 ;MAKE SURE FRUIT NOT SCORE\r
13           BNE     PFIEND\r
14 \r
15           LDA     PHPOS\r
16           SEC\r
17           SBC     FHPOS\r
18           STA     TEMP0\r
19           BPL     PFINTR1\r
20           LDA     #0\r
21           SEC\r
22           SBC     TEMP0\r
23           STA     TEMP0                  ; TEMP0 = ABS(PHPOS-FHPOS)\r
24 PFINTR1   CMP     #$06\r
25           BCS     PFIEND\r
26 \r
27           LDA     PVPOS\r
28           SEC\r
29           SBC     FVPOS\r
30           STA     TEMP1\r
31           BPL     PFINTR2\r
32           LDA     #0\r
33           SEC\r
34           SBC     TEMP1\r
35           STA     TEMP1                  ; TEMP1 = ABS(PVPOS-FVPOS)\r
36 PFINTR2   LDY     TEMP0\r
37           CMP     INTRSECT,Y\r
38           BCS     PFIEND\r
39 \r
40           LDY     FFRUIT\r
41           LDA     FRTSCORH,Y\r
42           STA     TEMP11\r
43           LDA     FRTSCORL,Y\r
44           STA     TEMP12\r
45           JSR     ADDTOTAL\r
46           JMP     EATFRT\r
47 \r
48 PFIEND    RTS\r
49 \r
50 * PMINTR          PAC-MONSTER INTERSECT ROUTINE\r
51 *         IN:\r
52 *         USES:\r
53 \r
54 PMINTR\r
55           LDX     #3\r
56 PMILOOP\r
57           LDA     PHPOS\r
58           SEC\r
59           SBC     M0HPOS,X\r
60           STA     TEMP0\r
61           BPL     PMINTR1\r
62           LDA     #0\r
63           SEC\r
64           SBC     TEMP0\r
65           STA     TEMP0                  ; TEMP0 = ABS(PHPOS-MHPOS)\r
66 PMINTR1   CMP     #$06\r
67           BCS     PMIEND\r
68 \r
69           LDA     PVPOS\r
70           SEC\r
71           SBC     M0VPOS,X\r
72           STA     TEMP1\r
73           BPL     PMINTR2\r
74           LDA     #0\r
75           SEC\r
76           SBC     TEMP1\r
77           STA     TEMP1                  ; TEMP1 = ABS(PVPOS-MVPOS)\r
78 PMINTR2   LDY     TEMP0\r
79           CMP     INTRSECT,Y\r
80           BCS     PMIEND\r
81 \r
82           LDA     M0STATE,X\r
83           BNE     PMIEND\r
84           LDA     M0BLUE,X\r
85           BNE     PMINTR3\r
86           JSR     KILLPAC\r
87           JMP     DECLIVES\r
88 PMINTR3\r
89           CMP     #$08\r
90           BNE     PMIEND\r
91           JSR     MONDEATH\r
92           JSR     TURNEYES\r
93           LDY     GREEDCNT\r
94           LDA     MONSCORH,Y\r
95           STA     TEMP11\r
96           LDA     MONSCORL,Y\r
97           STA     TEMP12\r
98           JSR     ADDTOTAL\r
99           INC     GREEDCNT\r
100 \r
101 PMIEND    DEX\r
102           BPL     PMILOOP\r
103           RTS\r
104 \r
105 *\r
106 * MONDEATH        -MONSTER DEATH CODE\r
107 *         IN      X IS MONSTER NUMBER\r
108 \r
109 MONDEATH\r
110           JSR     SCORSTMP\r
111           JSR     ERASEPAC\r
112           JSR     CLEARTUN\r
113           LDA     #$11\r
114           JSR     DOTUNE\r
115           LDA     RTLOCAL\r
116           STA     RTSAVE\r
117           LDA     RTLOCAL+1\r
118           STA     RTSAVE+1\r
119 \r
120           CLC\r
121           ADC     #1\r
122           STA     SCORWAIT\r
123           LDA     #60\r
124           STA     SCORTIME\r
125 DEATHLP\r
126           JSR     SEEBNORM\r
127           LDA     RTLOCAL+1\r
128           CMP     SCORWAIT\r
129           BMI     DEATHLP\r
130           JSR     TIGHT\r
131           LDA     RTLOCAL+1\r
132           CLC\r
133           ADC     #1\r
134           STA     SCORWAIT\r
135 DEATHEND\r
136           DEC     SCORTIME\r
137           BPL     DEATHLP\r
138 \r
139           LDA     RTSAVE+1\r
140           STA     RTLOCAL+1\r
141           LDA     RTSAVE\r
142           STA     RTLOCAL\r
143           STX     TEMP16\r
144           JSR     WRITEPAC\r
145           LDX     TEMP16\r
146           RTS\r
147 \r
148 INTRSECT  DB      $05,$04,$03,$02,$01,$00\r
149 MONSCORH  DB      $00,$00,$00,$01\r
150 MONSCORL  DB      $20,$40,$80,$60\r
151 FRTSCORH  DB      $00,$00,$00,$00,$00,$01,$02,$05\r
152 FRTSCORL  DB      $05,$10,$20,$50,$70,$00,$00,$00\r