New baserom
Asar compatibility Potential SRAM fix
This commit is contained in:
@@ -184,4 +184,19 @@ $a2 - MM 162 idx 0
|
||||
$a8 - EP 168 idx 2
|
||||
$bc - TT 188 idx 1
|
||||
|
||||
;SRAM corruption investigation
|
||||
;call stack
|
||||
; 110c7 7.e.7 (Dungeon_SpiralStaircase_7)
|
||||
; 112b1
|
||||
|
||||
; dw $8CE2 ; = $10CE2*
|
||||
; dw $8E0F ; = $10E0F*
|
||||
; dw $8E1D ; = $10E1D*
|
||||
; dw $8D10 ; = $10D10*
|
||||
; dw $90C7 ; = $110C7*
|
||||
|
||||
;bank2 line 3323 - x is d422 - comes from 048c
|
||||
|
||||
; called by 10CE2, (Dungeon_SpiralStaircase_3)
|
||||
;122f0
|
||||
|
||||
|
||||
@@ -29,6 +29,11 @@ jsl RecordStairType : nop
|
||||
org $02a1e7 ;(PC: 121e7)
|
||||
jsl SpiralWarp
|
||||
|
||||
org $0291b3 ; <- Bank02.asm : 3303 (LDA $0462 : AND.b #$04)
|
||||
jsl SpiralPriorityHack : nop
|
||||
org $0290f9 ; <- Bank02.asm : 3188 (LDA $0462 : AND.b #$04)
|
||||
jsl SpiralPriorityHack : nop
|
||||
|
||||
org $029369 ; <- 11369 - Bank02.asm : 3610 (STX $0464 : STY $012E)
|
||||
jsl StraightStairsAdj : nop #2
|
||||
org $029383 ; <- 11384 - Bank02.asm : 3629 (.walkingDownStaircase-> ADD $20 : STA $20)
|
||||
@@ -116,7 +121,8 @@ nop #3
|
||||
.next
|
||||
|
||||
; also rando's hooks.asm line 1360
|
||||
org $a0ee13 ; <- 6FC4C - headsup_display.asm : 836 (LDA $7EF36E : AND.w #$00FF : ADD.w #$0007 : AND.w #$FFF8 : TAX)
|
||||
; 106e4e -> goes to a0ee4e
|
||||
org $a0ee4e ; <- 6FC4C - headsup_display.asm : 836 (LDA $7EF36E : AND.w #$00FF : ADD.w #$0007 : AND.w #$FFF8 : TAX)
|
||||
jsl DrHudOverride
|
||||
org $098638 ; rando's hooks.asm line 2192
|
||||
jsl CountChestKeys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
GfxFixer:
|
||||
{
|
||||
lda DRMode : bne +
|
||||
lda.l DRMode : bne +
|
||||
jsl LoadRoomHook ;this is the code we overwrote
|
||||
jsl Dungeon_InitStarTileCh
|
||||
jsl LoadTransAuxGfx_Alt
|
||||
@@ -12,8 +12,8 @@ GfxFixer:
|
||||
jsl LoadTransAuxGfx
|
||||
jsl Dungeon_LoadCustomTileAttr
|
||||
jsl PrepTransAuxGfx
|
||||
lda DRMode : cmp #$02 : bne + ; only do this in crossed mode
|
||||
ldx $a0 : lda TilesetTable, x
|
||||
lda.l DRMode : cmp #$02 : bne + ; only do this in crossed mode
|
||||
ldx $a0 : lda.l TilesetTable, x
|
||||
cmp $0aa1 : beq + ; already eq no need to decomp
|
||||
sta $0aa1
|
||||
tax : lda $02802e, x : tay
|
||||
|
||||
@@ -7,7 +7,7 @@ DrHudOverride:
|
||||
|
||||
HudAdditions:
|
||||
{
|
||||
lda DRFlags : and #$0008 : beq ++
|
||||
lda.l DRFlags : and #$0008 : beq ++
|
||||
lda $7EF423 : and #$00ff
|
||||
jsr HudHexToDec4DigitCopy
|
||||
LDX.b $05 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+10 ; draw 100's digit
|
||||
@@ -21,24 +21,24 @@ HudAdditions:
|
||||
++
|
||||
|
||||
ldx $040c : cpx #$ff : bne + : rts : +
|
||||
lda DRMode : bne + : rts : +
|
||||
lda.l DRMode : bne + : rts : +
|
||||
phb : phk : plb
|
||||
lda $7ef364 : and.l $0098c0, x : beq +
|
||||
lda CompassBossIndicator, x : and #$00ff : cmp $a0 : bne +
|
||||
lda.w CompassBossIndicator, x : and #$00ff : cmp $a0 : bne +
|
||||
lda $1a : and #$0010 : beq +
|
||||
lda #$345e : sta $7ec790 : bra .next
|
||||
+ lda #$207f : sta $7ec790
|
||||
.next lda DRMode : and #$0002 : bne + : plb : rts : +
|
||||
.next lda.w DRMode : and #$0002 : bne + : plb : rts : +
|
||||
lda $7ef36d : and #$00ff : beq +
|
||||
lda DungeonReminderTable, x : bra .reminder
|
||||
lda.w DungeonReminderTable, x : bra .reminder
|
||||
+ lda #$207f
|
||||
.reminder sta $7ec702
|
||||
+ lda DRFlags : and #$0004 : beq .restore
|
||||
+ lda.w DRFlags : and #$0004 : beq .restore
|
||||
lda $7ef368 : and.l $0098c0, x : beq .restore
|
||||
|
||||
lda #$2811 : sta $7ec740
|
||||
lda $7ef366 : and.l $0098c0, x : bne .check
|
||||
lda BigKeyStatus, x : bne + ; change this, if bk status changes to one byte
|
||||
lda.w BigKeyStatus, x : bne + ; change this, if bk status changes to one byte
|
||||
lda #$2574 : bra ++
|
||||
+ cmp #$0002 : bne +
|
||||
lda #$2420 : bra ++
|
||||
@@ -49,10 +49,10 @@ HudAdditions:
|
||||
|
||||
lda $7ef4e0, x : jsr ConvertToDisplay : sta $7ec7a2
|
||||
lda #$2830 : sta $7ec7a4
|
||||
lda ChestKeys, x : jsr ConvertToDisplay : sta $7ec7a6
|
||||
lda.w ChestKeys, x : jsr ConvertToDisplay : sta $7ec7a6
|
||||
|
||||
lda #$2871 : sta $7ec780
|
||||
lda TotalKeys, x
|
||||
lda.w TotalKeys, x
|
||||
sep #$20 : !sub $7ef4b0, x : rep #$20
|
||||
jsr ConvertToDisplay : sta $7ec782
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
CheckIfDoorsOpen: {
|
||||
jsr TrapDoorFixer ; see normal.asm
|
||||
; note we are 16bit mode right now
|
||||
lda DRMode : beq +
|
||||
lda.l DRMode : beq +
|
||||
lda $040c : cmp #$00ff : bne .gtg
|
||||
+ lda $a0 : dec : tax : and #$000f ; hijacked code
|
||||
sec : rtl ; set carry to indicate normal behavior
|
||||
@@ -22,9 +22,9 @@ CheckIfDoorsOpen: {
|
||||
stx $00 : ldy #$0000
|
||||
.nextDoor
|
||||
lda $a0 : asl : tax
|
||||
lda KeyDoorOffset, x : beq .skipDoor
|
||||
lda.w KeyDoorOffset, x : beq .skipDoor
|
||||
asl : sty $05 : !add $05 : tax
|
||||
lda PairedDoorTable, x : beq .skipDoor
|
||||
lda.w PairedDoorTable, x : beq .skipDoor
|
||||
sta $02 : and #$00ff : asl a : tax
|
||||
lda $02 : and #$ff00 : sta $03
|
||||
lda $7ef000, x : and #$f000 : and $03 : beq .skipDoor
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
WarpLeft:
|
||||
lda DRMode : beq .end
|
||||
lda.l DRMode : beq .end
|
||||
lda $040c : cmp.b #$ff : beq .end
|
||||
lda $20 : ldx $aa
|
||||
jsr CalcIndex
|
||||
@@ -10,7 +10,7 @@ WarpLeft:
|
||||
rtl
|
||||
|
||||
WarpRight:
|
||||
lda DRMode : beq .end
|
||||
lda.l DRMode : beq .end
|
||||
lda $040c : cmp.b #$ff : beq .end
|
||||
lda $20 : ldx $aa
|
||||
jsr CalcIndex
|
||||
@@ -21,7 +21,7 @@ WarpRight:
|
||||
rtl
|
||||
|
||||
WarpUp:
|
||||
lda DRMode : beq .end
|
||||
lda.l DRMode : beq .end
|
||||
lda $040c : cmp.b #$ff : beq .end
|
||||
lda $22 : ldx $a9
|
||||
jsr CalcIndex
|
||||
@@ -32,7 +32,7 @@ WarpUp:
|
||||
rtl
|
||||
|
||||
WarpDown:
|
||||
lda DRMode : beq .end
|
||||
lda.l DRMode : beq .end
|
||||
lda $040c : cmp.b #$ff : beq .end
|
||||
lda $22 : ldx $a9
|
||||
jsr CalcIndex
|
||||
@@ -45,13 +45,13 @@ WarpDown:
|
||||
; carry set = use link door like normal
|
||||
; carry clear = we are in dr mode, never use linking doors
|
||||
CheckLinkDoorR:
|
||||
lda DRMode : bne +
|
||||
lda.l DRMode : bne +
|
||||
lda $7ec004 : sta $a0 ; what we wrote over
|
||||
sec : rtl
|
||||
+ clc : rtl
|
||||
|
||||
CheckLinkDoorL:
|
||||
lda DRMode : bne +
|
||||
lda.l DRMode : bne +
|
||||
lda $7ec003 : sta $a0 ; what we wrote over
|
||||
sec : rtl
|
||||
+ clc : rtl
|
||||
@@ -155,10 +155,10 @@ LookupNewRoom: ; expects data offset to be in A
|
||||
rep #$30 : and #$00FF ;sanitize A reg (who knows what is in the high byte)
|
||||
sta $00 ; offset in 00
|
||||
lda $a2 : tax ; probably okay loading $a3 in the high byte
|
||||
lda DoorOffset,x : and #$00FF ;we only want the low byte
|
||||
lda.w DoorOffset,x : and #$00FF ;we only want the low byte
|
||||
asl #3 : sta $02 : !add $02 : !add $02 ;multiply by 24 (data size)
|
||||
!add $00 ; should now have the offset of the address I want to load
|
||||
tax : lda DoorTable,x : sta $00
|
||||
tax : lda.w DoorTable,x : sta $00
|
||||
and #$00FF : sta $a0 ; assign new room
|
||||
sep #$30
|
||||
rts
|
||||
@@ -168,11 +168,11 @@ LookupNewRoom: ; expects data offset to be in A
|
||||
; Sets high bytes of various registers
|
||||
ShiftVariablesMainDir:
|
||||
{
|
||||
lda CoordIndex,y : tax
|
||||
lda.w CoordIndex,y : tax
|
||||
lda $21,x : !add $02 : sta $21,x ; coordinate update
|
||||
lda CameraIndex,y : tax
|
||||
lda.w CameraIndex,y : tax
|
||||
lda $e3,x : !add $02 : sta $e3,x ; scroll register high byte
|
||||
lda CamQuadIndex,y : tax
|
||||
lda.w CamQuadIndex,y : tax
|
||||
lda $0605,x : !add $02 : sta $0605,x ; high bytes of these guys
|
||||
lda $0607,x : !add $02 : sta $0607,x
|
||||
lda $0601,x : !add $02 : sta $0601,x
|
||||
@@ -210,13 +210,13 @@ PrepScrollToNormal:
|
||||
StraightStairsAdj:
|
||||
{
|
||||
stx $0464 : sty $012e ; what we wrote over
|
||||
lda DRMode : beq +
|
||||
lda.l DRMode : beq +
|
||||
jsr GetTileAttribute : tax
|
||||
lda $11 : cmp #$12 : beq .goingNorth
|
||||
lda $a2 : cmp #$51 : bne ++
|
||||
rep #$20 : lda #$0018 : !add $20 : sta $20 : sep #$20 ; special fix for throne room
|
||||
jsr GetTileAttribute : tax
|
||||
++ lda StepAdjustmentDown, X : bra .end
|
||||
++ lda.l StepAdjustmentDown, X : bra .end
|
||||
; lda $ee : beq .end
|
||||
; rep #$20 : lda #$ffe0 : !add $20 : sta $20 : sep #$20
|
||||
.goingNorth
|
||||
@@ -225,7 +225,7 @@ StraightStairsAdj:
|
||||
lda #$36 : bra .end ; special fix for throne room
|
||||
++ ldy $ee : cpy #$00 : beq ++
|
||||
inx
|
||||
++ lda StepAdjustmentUp, X
|
||||
++ lda.l StepAdjustmentUp, X
|
||||
.end
|
||||
pha : lda $0462 : and #$04 : bne ++
|
||||
pla : !add #$f6 : pha
|
||||
@@ -255,14 +255,14 @@ db $d0, $f6, $10, $1a, $f0, $00
|
||||
|
||||
StraightStairsFix:
|
||||
{
|
||||
lda DRMode : bne +
|
||||
lda.l DRMode : bne +
|
||||
!add $20 : sta $20 ;what we wrote over
|
||||
+ rtl
|
||||
}
|
||||
|
||||
StraightStairLayerFix:
|
||||
{
|
||||
lda DRMode : beq +
|
||||
lda.l DRMode : beq +
|
||||
lda $ee : rtl
|
||||
+ lda $01c322, x : rtl ; what we wrote over
|
||||
}
|
||||
@@ -270,7 +270,7 @@ StraightStairLayerFix:
|
||||
DoorToStraight:
|
||||
{
|
||||
pha
|
||||
lda DRMode : beq .skip
|
||||
lda.l DRMode : beq .skip
|
||||
pla : bne .end
|
||||
pha
|
||||
lda $a0 : cmp #$51 : bne .skip
|
||||
|
||||
@@ -26,7 +26,7 @@ GtBossHeartCheckOverride:
|
||||
lda $a0 : cmp #$1c : beq ++
|
||||
cmp #$6c : beq ++
|
||||
cmp #$4d : bne +
|
||||
++ lda DRFlags : and #$01 : bne ++ ;skip if flag on
|
||||
++ lda.l DRFlags : and #$01 : bne ++ ;skip if flag on
|
||||
lda $403 : ora #$80 : sta $403
|
||||
++ clc
|
||||
rtl
|
||||
@@ -35,19 +35,19 @@ rtl
|
||||
|
||||
OnFileLoadOverride:
|
||||
jsl OnFileLoad ; what I wrote over
|
||||
lda DRFlags : and #$80 : beq + ;flag is off
|
||||
lda.l DRFlags : and #$80 : beq + ;flag is off
|
||||
lda $7ef086 : ora #$80 : sta $7ef086
|
||||
+ lda DRFlags : and #$02 : beq +
|
||||
+ lda.l DRFlags : and #$02 : beq +
|
||||
lda $7ef353 : bne +
|
||||
lda #$01 : sta $7ef353
|
||||
+ rtl
|
||||
|
||||
MirrorCheckOverride:
|
||||
lda DRFlags : and #$02 : beq ++
|
||||
lda.l DRFlags : and #$02 : beq ++
|
||||
lda $7ef353 : cmp #$01 : beq +
|
||||
++ lda $8A : and #$40 ; what I wrote over
|
||||
rtl
|
||||
+ lda DRScroll : rtl
|
||||
+ lda.l DRScroll : rtl
|
||||
|
||||
MirrorCheckOverride2:
|
||||
lda $7ef353 : and #$02 : rtl
|
||||
@@ -64,7 +64,7 @@ FixShopCode:
|
||||
+ rtl
|
||||
|
||||
VitreousKeyReset:
|
||||
lda DRMode : beq +
|
||||
lda.l DRMode : beq +
|
||||
stz $0cba, x
|
||||
+ jsl $0db818 ;restore old code
|
||||
rtl
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
RecordStairType: {
|
||||
pha
|
||||
lda DRMode : beq .norm
|
||||
lda.l DRMode : beq .norm
|
||||
lda $040c : cmp #$ff : beq .norm
|
||||
lda $0e : sta $045e
|
||||
cmp #$26 : beq .norm ; skipping in-floor staircases
|
||||
@@ -11,7 +11,7 @@ RecordStairType: {
|
||||
}
|
||||
|
||||
SpiralWarp: {
|
||||
lda DRMode : beq .abort ; abort if not DR
|
||||
lda.l DRMode : beq .abort ; abort if not DR
|
||||
lda $040c : cmp.b #$ff : beq .abort ; abort if not in dungeon
|
||||
lda $045e : cmp #$5e : beq .gtg ; abort if not spiral - intended room is in A!
|
||||
cmp #$5f : beq .gtg
|
||||
@@ -22,8 +22,8 @@ SpiralWarp: {
|
||||
phb : phk : plb : phx : phy ; push stuff
|
||||
jsr LookupSpiralOffset
|
||||
rep #$30 : and #$00FF : asl #2 : tax
|
||||
lda SpiralTable, x : sta $00
|
||||
lda SpiralTable+2, x : sta $02
|
||||
lda.w SpiralTable, x : sta $00
|
||||
lda.w SpiralTable+2, x : sta $02
|
||||
sep #$30
|
||||
lda $00 : sta $a0
|
||||
; shift quadrant if necessary
|
||||
@@ -73,8 +73,8 @@ SpiralWarp: {
|
||||
stz $045e ; clear the staircase flag
|
||||
|
||||
; animated tiles fix
|
||||
lda DRMode : cmp #$02 : bne + ; only do this in crossed mode
|
||||
ldx $a0 : lda TilesetTable, x
|
||||
lda.l DRMode : cmp #$02 : bne + ; only do this in crossed mode
|
||||
ldx $a0 : lda.l TilesetTable, x
|
||||
cmp $0aa1 : beq + ; already eq no need to decomp
|
||||
sta $0aa1
|
||||
tax : lda $02802e, x : tay
|
||||
@@ -133,17 +133,17 @@ LookupSpiralOffset: {
|
||||
lda #$02 : sta $01 ; always 2
|
||||
|
||||
.done
|
||||
lda $a2 : tax : lda SpiralOffset,x
|
||||
lda $a2 : tax : lda.w SpiralOffset,x
|
||||
!add $01 ;add a thing (0 in easy case)
|
||||
rts
|
||||
}
|
||||
|
||||
ShiftQuadSimple: {
|
||||
lda CoordIndex,y : tax
|
||||
lda.w CoordIndex,y : tax
|
||||
lda $20,x : beq .skip
|
||||
lda $21,x : !add $06 : sta $21,x ; coordinate update
|
||||
.skip
|
||||
lda CamQuadIndex,y : tax
|
||||
lda.w CamQuadIndex,y : tax
|
||||
lda $0601,x : !add $06 : sta $0601,x
|
||||
lda $0605,x : !add $06 : sta $0605,x ; high bytes of these guys
|
||||
rts
|
||||
@@ -152,13 +152,13 @@ ShiftQuadSimple: {
|
||||
SetCamera: {
|
||||
stz $04
|
||||
tyx : lda $a9,x : bne .nonZeroHalf
|
||||
lda CamQuadIndex,y : tax : lda $607,x : pha
|
||||
lda CameraIndex,y : tax : pla : cmp $e3, x : bne .noQuadAdj
|
||||
lda.w CamQuadIndex,y : tax : lda $607,x : pha
|
||||
lda.w CameraIndex,y : tax : pla : cmp $e3, x : bne .noQuadAdj
|
||||
dec $e3,x
|
||||
|
||||
.noQuadAdj
|
||||
lda $07 : bne .adj0
|
||||
lda CoordIndex,y : tax
|
||||
lda.w CoordIndex,y : tax
|
||||
lda $20,x : beq .oddQuad
|
||||
cmp #$79 : bcc .adj0
|
||||
!sub #$78 : sta $04
|
||||
@@ -170,21 +170,21 @@ SetCamera: {
|
||||
|
||||
.nonZeroHalf ;meaning either right half or bottom half
|
||||
lda $07 : bne .setQuad
|
||||
lda CoordIndex,y : tax
|
||||
lda.w CoordIndex,y : tax
|
||||
lda $20,x : cmp #$78 : bcs .setQuad
|
||||
!add #$78 : sta $04
|
||||
lda CamQuadIndex,y : tax : lda $0603, x : pha
|
||||
lda CameraIndex,y : tax : pla : sta $e3, x
|
||||
lda.w CamQuadIndex,y : tax : lda $0603, x : pha
|
||||
lda.w CameraIndex,y : tax : pla : sta $e3, x
|
||||
.adj1
|
||||
tya : asl : !add #$08 : tax : jsr AdjCamBounds : bra .done
|
||||
|
||||
.setQuad
|
||||
lda CamQuadIndex,y : tax : lda $0607, x : pha
|
||||
lda CameraIndex,y : tax : pla : sta $e3, x
|
||||
lda.w CamQuadIndex,y : tax : lda $0607, x : pha
|
||||
lda.w CameraIndex,y : tax : pla : sta $e3, x
|
||||
tya : asl : !add #$0c : tax : jsr AdjCamBounds : bra .done
|
||||
|
||||
.done
|
||||
lda CameraIndex,y : tax
|
||||
lda.w CameraIndex,y : tax
|
||||
lda $04 : sta $e2, x
|
||||
rts
|
||||
}
|
||||
@@ -192,13 +192,20 @@ SetCamera: {
|
||||
; input, expects X to be an appropriate offset into the CamBoundBaseLine table
|
||||
; when $04 is 0 no coordinate are added
|
||||
AdjCamBounds: {
|
||||
rep #$20 : lda CamBoundBaseLine, x : sta $05
|
||||
rep #$20 : lda.w CamBoundBaseLine, x : sta $05
|
||||
lda $04 : and #$00ff : beq .common
|
||||
lda CoordIndex,y : tax
|
||||
lda.w CoordIndex,y : tax
|
||||
lda $20, x : and #$00ff : !add $05 : sta $05
|
||||
.common
|
||||
lda OppCamBoundIndex,y : tax
|
||||
lda.w OppCamBoundIndex,y : tax
|
||||
lda $05 : sta $0618, x
|
||||
inc #2 : sta $061A, x : sep #$20
|
||||
rts
|
||||
}
|
||||
|
||||
SpiralPriorityHack: {
|
||||
lda.l DRMode : beq +
|
||||
lda #$01 : rtl ; always skip the priority code - until I figure out how to fix it
|
||||
+ lda $0462 : and #$04 ; what we wrote over
|
||||
rtl
|
||||
}
|
||||
Reference in New Issue
Block a user