ram.asm initial commit. Replaced all address defines with labels
Value defines styled without quotes, # moved to load/store/cmp site Added registers.asm (copied from spannerisms JP disassembly) Added a bunch of length annotations Deleted old or trivial commented out code Deleted: ganonfixes.asm, map.asm, seedtag.asm Replaced obsolete credits.asm with creditsnew.asm Moved scratch space at $7F5020-3F to mirrored WRAM (7E1E70-8F) Moved clock RAM to mirrored WRAM (7E1E90-9F) dialog.asm: FreeDungeonItemNotice preserves callee-preserved scratch RAM Toast buffer moved to mirrored WRAM (7E1E0E-0F) servicerequest.asm: long store to $012E converted to word length store
This commit is contained in:
@@ -12,10 +12,10 @@ HeartPieceGet:
|
||||
|
||||
.skipLoad
|
||||
|
||||
STZ $02E9 ; 0 = Receiving item from an NPC or message
|
||||
STZ.w $02E9 ; 0 = Receiving item from an NPC or message
|
||||
|
||||
CPY.b #$26 : BNE .notHeart ; don't add a 1/4 heart if it's not a heart piece
|
||||
LDA HeartPieceQuarter : INC A : AND.b #$03 : STA HeartPieceQuarter : BNE .unfinished_heart ; add up heart quarters
|
||||
LDA.l HeartPieceQuarter : INC A : AND.b #$03 : STA.l HeartPieceQuarter : BNE .unfinished_heart ; add up heart quarters
|
||||
BRA .giveItem
|
||||
|
||||
.notHeart
|
||||
@@ -46,27 +46,24 @@ HeartContainerGet:
|
||||
|
||||
BRA HeartPieceGet_skipLoad
|
||||
;--------------------------------------------------------------------------------
|
||||
!REDRAW = "$7F5000"
|
||||
DrawHeartPieceGFX:
|
||||
PHP
|
||||
JSL.l Sprite_IsOnscreen : BCC .offscreen
|
||||
|
||||
PHA : PHY
|
||||
LDA !REDRAW : BEQ .skipInit ; skip init if already ready
|
||||
LDA.l RedrawFlag : BEQ .skipInit ; skip init if already ready
|
||||
JSL.l HeartPieceSpritePrep
|
||||
JMP .done ; don't draw on the init frame
|
||||
|
||||
.skipInit
|
||||
LDA $0E80, X ; Retrieve stored item type
|
||||
LDA.w $0E80, X ; Retrieve stored item type
|
||||
|
||||
.skipLoad
|
||||
|
||||
PHA
|
||||
JSL.l IsNarrowSprite : BCC +
|
||||
LDA $0E60, X : ORA.b #$20 : STA $0E60, X
|
||||
LDA.w $0E60, X : ORA.b #$20 : STA.w $0E60, X
|
||||
+
|
||||
;LDA $0E60, X : ORA.b #$10 : STA $0E60, X
|
||||
|
||||
PLA
|
||||
|
||||
JSL.l DrawDynamicTile
|
||||
@@ -78,18 +75,17 @@ DrawHeartPieceGFX:
|
||||
PLP
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
!REDRAW = "$7F5000"
|
||||
DrawHeartContainerGFX:
|
||||
PHP
|
||||
JSL.l Sprite_IsOnscreen : BCC DrawHeartPieceGFX_offscreen
|
||||
|
||||
PHA : PHY
|
||||
LDA !REDRAW : BEQ .skipInit ; skip init if already ready
|
||||
LDA.l RedrawFlag : BEQ .skipInit ; skip init if already ready
|
||||
JSL.l HeartContainerSpritePrep
|
||||
BRA DrawHeartPieceGFX_done ; don't draw on the init frame
|
||||
|
||||
.skipInit
|
||||
LDA $0E80, X ; Retrieve stored item type
|
||||
LDA.w $0E80, X ; Retrieve stored item type
|
||||
|
||||
BRA DrawHeartPieceGFX_skipLoad
|
||||
;--------------------------------------------------------------------------------
|
||||
@@ -107,7 +103,7 @@ HeartContainerSound:
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
NormalItemSkipSound:
|
||||
LDA $0C5E, X ; thing we wrote over
|
||||
LDA.w $0C5E, X ; thing we wrote over
|
||||
|
||||
CPY.b #$20 : BEQ + ; Skip for Crystal
|
||||
CPY.b #$37 : BEQ + ; Skip for Pendants
|
||||
@@ -115,7 +111,7 @@ NormalItemSkipSound:
|
||||
CPY.b #$39 : BEQ +
|
||||
|
||||
PHA
|
||||
JSL.l CheckIfBossRoom
|
||||
JSL.l CheckIfBossRoom
|
||||
PLA
|
||||
RTL
|
||||
+
|
||||
@@ -123,58 +119,56 @@ RTL
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
HeartUpgradeSpawnDecision: ; this should return #$00 to make the hp spawn
|
||||
LDA !FORCE_HEART_SPAWN : BEQ .normal_behavior
|
||||
LDA.l ForceHeartSpawn : BEQ .normal_behavior
|
||||
|
||||
DEC : STA !FORCE_HEART_SPAWN
|
||||
LDA #$00
|
||||
DEC : STA.l ForceHeartSpawn
|
||||
LDA.b #$00
|
||||
RTL
|
||||
|
||||
.normal_behavior
|
||||
LDA OverworldEventDataWRAM, X
|
||||
LDA.l OverworldEventDataWRAM, X
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
SaveHeartCollectedStatus:
|
||||
LDA !SKIP_HEART_SAVE : BEQ .normal_behavior
|
||||
LDA.l SkipHeartSave : BEQ .normal_behavior
|
||||
|
||||
DEC : STA !SKIP_HEART_SAVE
|
||||
DEC : STA.l SkipHeartSave
|
||||
RTL
|
||||
|
||||
.normal_behavior
|
||||
LDA OverworldEventDataWRAM, X : ORA.b #$40 : STA OverworldEventDataWRAM, X
|
||||
LDA.l OverworldEventDataWRAM, X : ORA.b #$40 : STA.l OverworldEventDataWRAM, X
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
!REDRAW = "$7F5000"
|
||||
HeartPieceSpritePrep:
|
||||
PHA
|
||||
|
||||
LDA ServerRequestMode : BEQ + : : +
|
||||
LDA.l ServerRequestMode : BEQ + : : +
|
||||
|
||||
LDA #$01 : STA !REDRAW
|
||||
LDA $5D : CMP #$14 : BEQ .skip ; skip if we're mid-mirror
|
||||
LDA.b #$01 : STA.l RedrawFlag
|
||||
LDA.b $5D : CMP.b #$14 : BEQ .skip ; skip if we're mid-mirror
|
||||
|
||||
LDA #$00 : STA !REDRAW
|
||||
LDA.b #$00 : STA.l RedrawFlag
|
||||
JSL.l LoadHeartPieceRoomValue ; load item type
|
||||
STA $0E80, X ; Store item type
|
||||
STA.w $0E80, X ; Store item type
|
||||
JSL.l PrepDynamicTile
|
||||
|
||||
.skip
|
||||
PLA
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
!REDRAW = "$7F5000"
|
||||
HeartContainerSpritePrep:
|
||||
PHA
|
||||
|
||||
LDA #$00 : STA !REDRAW
|
||||
LDA.b #$00 : STA.l RedrawFlag
|
||||
JSL.l LoadHeartContainerRoomValue ; load item type
|
||||
STA $0E80, X ; Store item type
|
||||
STA.w $0E80, X ; Store item type
|
||||
JSL.l PrepDynamicTile
|
||||
|
||||
PLA
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
LoadHeartPieceRoomValue:
|
||||
LDA $1B : BEQ .outdoors ; check if we're indoors or outdoors
|
||||
LDA.b $1B : BEQ .outdoors ; check if we're indoors or outdoors
|
||||
.indoors
|
||||
JSL.l LoadIndoorValue
|
||||
JMP .done
|
||||
@@ -183,38 +177,37 @@ LoadHeartPieceRoomValue:
|
||||
.done
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
!REDRAW = "$7F5000"
|
||||
HPItemReset:
|
||||
JSL $09AD58 ; GiveRupeeGift - thing we wrote over
|
||||
PHA : LDA #$01 : STA !REDRAW : PLA
|
||||
PHA : LDA.b #$01 : STA.l RedrawFlag : PLA
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
MaybeMarkDigSpotCollected:
|
||||
PHA : PHP
|
||||
LDA $1B : BNE +
|
||||
LDA.b $1B : BNE +
|
||||
REP #$20 ; set 16-bit accumulator
|
||||
LDA $8A
|
||||
LDA.b $8A
|
||||
CMP.w #$2A : BNE +
|
||||
LDA HasGroveItem : ORA.w #$0001 : STA HasGroveItem
|
||||
LDA.l HasGroveItem : ORA.w #$0001 : STA.l HasGroveItem
|
||||
+
|
||||
PLP : PLA
|
||||
RTL
|
||||
;--------------------------------------------------------------------------------
|
||||
macro GetPossiblyEncryptedItem(ItemLabel,TableLabel)
|
||||
LDA IsEncrypted : BNE ?encrypted
|
||||
LDA.l IsEncrypted : BNE ?encrypted
|
||||
LDA.l <ItemLabel>
|
||||
BRA ?done
|
||||
?encrypted:
|
||||
PHX : PHP
|
||||
REP #$30 ; set 16-bit accumulator & index registers
|
||||
LDA $00 : PHA : LDA $02 : PHA
|
||||
LDA.b Scrap00 : PHA : LDA.b Scrap02 : PHA
|
||||
|
||||
LDA.w #<TableLabel> : STA $00
|
||||
LDA.w #<TableLabel>>>16 : STA $02
|
||||
LDA.w #<TableLabel> : STA.b Scrap00
|
||||
LDA.w #<TableLabel>>>16 : STA.b Scrap02
|
||||
LDA.w #<ItemLabel>-<TableLabel>
|
||||
JSL RetrieveValueFromEncryptedTable
|
||||
|
||||
PLX : STX $02 : PLX : STX $01
|
||||
PLX : STX.b Scrap02 : PLX : STX.b Scrap01
|
||||
PLP : PLX
|
||||
?done:
|
||||
endmacro
|
||||
@@ -222,7 +215,7 @@ endmacro
|
||||
LoadIndoorValue:
|
||||
PHP
|
||||
REP #$20 ; set 16-bit accumulator
|
||||
LDA $A0 ; these are all decimal because i got them that way
|
||||
LDA.b $A0 ; these are all decimal because i got them that way
|
||||
CMP.w #225 : BNE +
|
||||
%GetPossiblyEncryptedItem(HeartPiece_Forest_Thieves, HeartPieceIndoorValues)
|
||||
JMP .done
|
||||
@@ -233,7 +226,7 @@ LoadIndoorValue:
|
||||
%GetPossiblyEncryptedItem(HeartPiece_Spectacle_Cave, HeartPieceIndoorValues)
|
||||
JMP .done
|
||||
+ CMP.w #283 : BNE +
|
||||
LDA $22 : XBA : AND.w #$0001 ; figure out where link is
|
||||
LDA.b $22 : XBA : AND.w #$0001 ; figure out where link is
|
||||
BNE ++
|
||||
%GetPossiblyEncryptedItem(HeartPiece_Circle_Bushes, HeartPieceIndoorValues)
|
||||
JMP .done
|
||||
@@ -247,7 +240,7 @@ LoadIndoorValue:
|
||||
%GetPossiblyEncryptedItem(HeartPiece_Smith_Pegs, HeartPieceIndoorValues)
|
||||
JMP .done
|
||||
+ CMP.w #135 : BNE +
|
||||
LDA StandingKey_Hera
|
||||
LDA.l StandingKey_Hera
|
||||
JMP .done
|
||||
+
|
||||
LDA.w #$0017 ; default to a normal hp
|
||||
@@ -267,9 +260,9 @@ RTL
|
||||
LoadOutdoorValue:
|
||||
PHP
|
||||
REP #$20 ; set 16-bit accumulator
|
||||
LDA $8A
|
||||
LDA.b $8A
|
||||
CMP.w #$03 : BNE +
|
||||
LDA $22 : CMP.w #1890 : !BLT ++
|
||||
LDA.b $22 : CMP.w #1890 : !BLT ++
|
||||
%GetPossiblyEncryptedItem(HeartPiece_Spectacle, HeartPieceOutdoorValues)
|
||||
JMP .done
|
||||
++
|
||||
@@ -285,7 +278,7 @@ LoadOutdoorValue:
|
||||
%GetPossiblyEncryptedItem(HauntedGroveItem, HeartPieceOutdoorValues)
|
||||
JMP .done
|
||||
+ CMP.w #$30 : BNE +
|
||||
LDA $22 : CMP.w #512 : !BGE ++
|
||||
LDA.b $22 : CMP.w #512 : !BGE ++
|
||||
%GetPossiblyEncryptedItem(HeartPiece_Desert, HeartPieceOutdoorValues)
|
||||
JMP .done
|
||||
++
|
||||
@@ -335,7 +328,7 @@ LoadHeartContainerRoomValue:
|
||||
LoadBossValue:
|
||||
PHP
|
||||
REP #$20 ; set 16-bit accumulator
|
||||
LDA $A0 ; these are all decimal because i got them that way
|
||||
LDA.b $A0 ; these are all decimal because i got them that way
|
||||
CMP.w #200 : BNE +
|
||||
%GetPossiblyEncryptedItem(HeartContainer_ArmosKnights, HeartContainerBossValues)
|
||||
JMP .done
|
||||
@@ -378,7 +371,7 @@ CheckIfBossRoom:
|
||||
; Carry set if we're in a boss room, unset otherwise.
|
||||
;--------------------------------------------------------------------------------
|
||||
REP #$20 ; set 16-bit accumulator
|
||||
LDA $A0 ; these are all decimal because i got them that way
|
||||
LDA.b $A0 ; these are all decimal because i got them that way
|
||||
CMP.w #200 : BEQ .done
|
||||
CMP.w #51 : BEQ .done
|
||||
CMP.w #7 : BEQ .done
|
||||
|
||||
Reference in New Issue
Block a user