-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmoveLibs.asm
More file actions
53 lines (52 loc) · 718 Bytes
/
Copy pathmoveLibs.asm
File metadata and controls
53 lines (52 loc) · 718 Bytes
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
move:
CP 'W'
JR Z,moveU
CP 'A'
JR Z,moveL
CP 'S'
JR Z,moveD
JR moveR
moveU:
LD A, (BC)
DEC A
AND 00011111B
LD (BC),A
RET
moveD:
LD A, (BC)
INC A
AND 00011111B
LD (BC),A
RET
moveL:
LD A, (DE)
DEC A
AND 00011111B
LD (DE),A
RET
moveR:
LD A, (DE)
INC A
AND 00011111B
LD (DE),A
RET
isMoveValid:
CP 'W'
JR Z,moveUValid
CP 'A'
JR Z,moveLValid
CP 'S'
JR Z,moveDValid
JR moveRValid
moveUValid:
BIT upBit,D
RET
moveDValid:
BIT downBit,D
RET
moveLValid:
BIT leftBit,D
RET
moveRValid:
BIT rightBit,D
RET