forked from CaitSith2/z3randomizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
icepalacegraphics.asm
81 lines (68 loc) · 1.94 KB
/
icepalacegraphics.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
ShouldOverrideFileLoad:
; Y = Graphics file being loaded
CPY #$0A ; 0A = Ice/Mire floor file
BNE .no
LDA $040C ; Dungeon number
CMP #$12 ; Ice Palace
BEQ .yes
.no
CLC : RTS
.yes
SEC : RTS
BgGraphicsLoading:
; Instructions overwritten
STZ $00
STX $01
STA $02
JSR ShouldOverrideFileLoad
BCS .useSpecialIcePalaceFile
JML BgGraphicsLoadingResume
.useSpecialIcePalaceFile
; We're loading the floor tiles in Ice Palace. Instead of the normal file,
; load another one that replaces the bridge tiles with the Bombos medallion
;LDA $FFFFFF
LDA.b #IcePalaceFloorGfx>>16
STA $02
REP #$20
LDA.w #IcePalaceFloorGfx
STA $00
LDX.b #64*2 ; Tiles to load * 2
-
; Unrolled loop to upload half a tile
LDA [$00] : STA $2118 : INC $00 : INC $00
LDA [$00] : STA $2118 : INC $00 : INC $00
LDA [$00] : STA $2118 : INC $00 : INC $00
LDA [$00] : STA $2118 : INC $00 : INC $00
LDA [$00] : STA $2118 : INC $00 : INC $00
LDA [$00] : STA $2118 : INC $00 : INC $00
LDA [$00] : STA $2118 : INC $00 : INC $00
LDA [$00] : STA $2118 : INC $00 : INC $00
DEX
BNE -
SEP #$20
JML BgGraphicsLoadingCancel
ReloadingFloors:
SEP #$30 ; 8 AXY
LDA $7EC2F8 ; Floor file that has been decompressed
TAY
JSR ShouldOverrideFileLoad
REP #$30 ; 16 AXY
BCS .replaceWithSpecialIcePalaceFile
; Instructions overwritten by hook
LDX.w #$0000
LDY.w #$0040
JML ReloadingFloorsResume
.replaceWithSpecialIcePalaceFile
; Block move our hardcoded graphics into the output buffer
LDX.w #IcePalaceFloorGfx ; Source
LDY.w #$0000 ; Target
LDA.w #$0800 ; Length
PHB
;MVN $7F, IcePalaceFloorGfx>>16
MVN $B17F ; CHANGE THIS IF YOU MOVE THE GRAPHICS FILE - kkat
PLB
; Pretend that we ran the original routine
LDX.w #$0800
LDA.w #$6600
STA $03
JML ReloadingFloorsCancel