/
dungeonDisplay.s
138 lines (126 loc) · 1.62 KB
/
dungeonDisplay.s
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
.equ dungeonDisplayTable, dungeonDisplayGraphics+4
.thumb
push {r4-r7}
ldr r0,=#0x20350F0
mov r1,#0x80
lsl r1,#1
ldr r3,=#0x801D668
mov lr,r3
.short 0xF800
clean:
ldr r0,=#0x2034CB0
ldr r1,=#0x440
add r1,r0
mov r2,#0
cleanLoop:
str r2,[r0]
add r0,#4
cmp r0,r1
bne cleanLoop
@check current map mode
ldr r2,=#0x20344A4
ldrb r2,[r2]
cmp r2,#4
bne end
@find out if this map is in our list
ldr r0,dungeonDisplayTable
mov r1,#0xFF
and r4,r1
loop:
ldrb r1,[r0]
cmp r1,#0
beq end
cmp r1,r4
beq match
add r0,#2
b loop
match:
ldrb r4,[r0,#1]
sub r4,#0x17
ldr r5,=#0x2034CB0
ldr r6,=#0x2002E9C
ldr r7,=#0x2002EAC
@load the graphics
ldr r0,=#0x600C020
ldr r1,dungeonDisplayGraphics
ldr r2,=#0x600CC00
graphics:
ldr r3,[r1]
str r3,[r0]
add r0,#4
add r1,#4
cmp r0,r2
bne graphics
@draw the key
ldr r0,=#0x344
add r0,r5
mov r1,#1
bl draw
@draw the map if unlocked
ldrb r0,[r7,r4]
mov r1,#1
and r0,r1
cmp r0,#0
beq noMap
ldr r0,=#0x2F2
add r0,r5
ldr r1,=#0x4007
bl draw
noMap:
@draw the compass if unlocked
ldrb r0,[r7,r4]
mov r1,#2
and r0,r1
cmp r0,#0
beq noCompass
ldr r0,=#0x372
add r0,r5
ldr r1,=#0x13
bl draw
noCompass:
@draw the big key if unlocked
ldrb r0,[r7,r4]
mov r1,#4
and r0,r1
cmp r0,#0
beq noBig
ldr r0,=#0x3F2
add r0,r5
ldr r1,=#0x100D
bl draw
noBig:
@draw key ammount
ldrb r0,[r6,r4]
cmp r0,#9
bls np
mov r0,#9
np:
mov r1,#6
mul r0,r1
mov r1,#0x19
add r1,r0
ldr r0,=#0x3C4
add r0,r5
bl draw
b end
end:
pop {r4-r7}
ldr r3,=#0x80A6807
bx r3
draw:
strh r1,[r0]
add r1,#1
strh r1,[r0,#2]
add r1,#1
strh r1,[r0,#4]
add r0,#0x40
add r1,#1
strh r1,[r0]
add r1,#1
strh r1,[r0,#2]
add r1,#1
strh r1,[r0,#4]
bx lr
.align
.ltorg
dungeonDisplayGraphics: