-
Notifications
You must be signed in to change notification settings - Fork 0
/
Unit.asm
164 lines (127 loc) · 1.34 KB
/
Unit.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
include "Common.asm"
include "Video.asm"
;in: HL - xy, C - direct, B - hight
;out: B (0,1)
;chg: A, B
;bytes:
;ticks:
CAN_GO:
MOV A,L
ADD C
MOV L,A
LDA V_CUR_SCR
XRA L
ANI 11100000b
MOV C,B
MVI B,0
CPI 0
RNZ
;LDA V_CUR_SCR
;ORA L
;MOV L,A
MOV A,C
CPI 2
JZ CAN_GO_2
INR H
MOV A,M
CPI V_CAN_GO
RNC
DCR H
CAN_GO_2:
DCR H
MOV A,M
CPI V_CAN_GO
RNC
INR H
MOV A,M
CPI V_CAN_GO
RNC
MVI B,1
RET
FALL:
STA V_YOU_VERT
MOV C,A
LDA V_YOU_Y
MOV H,A
ADD C
STA V_YOU_Y
LDA V_YOU_X
MOV L,A
MOV A,H
SUB C
MOV H,A
SHLD V_TEMP_16
DCR L
CALL PUT_TILE
LHLD V_TEMP_16
CALL PUT_TILE
LHLD V_TEMP_16
INR L
CALL PUT_TILE
LHLD V_YOU_X
INR H
MOV A,M
CPI V_CAN_UP
JNC FALL_PUT_128
INR H
MOV A,M
CPI V_CAN_GO
JNC FALL_PUT_128
;LDA V_TYPE
;ANI 01111111b
;CPI 2
;RZ
;MVI A,2
;STA V_TYPE
RET
FALL_PUT_128:
MVI A,128
STA V_TYPE
RET
DO_DEAD:
MVI A,255
STA V_TYPE
RET
CHECK_FALL:
LHLD V_YOU_X
INR H
MOV A,M
CPI V_CAN_UP
JNC C_F2
INR H
MOV A,M
CPI V_CAN_GO
RNC
LDA V_TYPE
ANI 01111111b
CPI 2
RZ
MVI A,2
STA V_TYPE
RET
C_F2:
INR H
MOV A,M
CPI V_CAN_DEAD
JNC DO_DEAD
DCR L
MOV A,M
CPI V_CAN_GO
RNC
CPI V_CAN_UP
RC
INR L
MOV A,M
CPI V_CAN_GO
RNC
CPI V_CAN_UP
RC
INR L
MOV A,M
CPI V_CAN_GO
RNC
CPI V_CAN_UP
RC
MVI A,1
JMP FALL
;RET