More merge labeling

This commit is contained in:
codemann8
2024-04-07 05:09:32 -05:00
parent 9cfeb18fef
commit 27685ac77d
70 changed files with 1386 additions and 1410 deletions

View File

@@ -1,9 +1,3 @@
!add = "clc : adc"
!addl = "clc : adc.l"
!sub = "sec : sbc"
!bge = "bcs"
!blt = "bcc"
; Free RAM notes
; Normal doors use $AB-AC for scrolling indicator
; Normal doors use $FE to store the trap door indicator

View File

@@ -188,7 +188,7 @@ Main_ShowTextMessage:
; Conditionally disable UW music changes in Door Rando
org $828ADB ; <- Bank02.asm:2088-2095 (LDX.b #$14 : LDA $A0 ...)
JSL Underworld_DoorDown_Entry : CPX #$FF
JSL Underworld_DoorDown_Entry : CPX.b #$FF
BEQ + : db $80, $1C ; BRA $028B04
NOP #6 : +

View File

@@ -5,8 +5,8 @@ HorzEdge:
cpy.b #$ff : beq +
jsr DetectWestEdge : ldy.b #$02 : bra ++
+ jsr DetectEastEdge
++ cmp #$ff : beq +
sta.b Scrap00 : asl : !add.b Scrap00 : tax
++ cmp.b #$ff : beq +
sta.b Scrap00 : asl : !ADD.b Scrap00 : tax
cpy.b #$ff : beq ++
jsr LoadWestData : bra .main
++ jsr LoadEastData
@@ -20,7 +20,7 @@ VertEdge:
jsr DetectNorthEdge : bra ++
+ jsr DetectSouthEdge
++ cmp.b #$ff : beq +
sta.b Scrap00 : asl : !add.b Scrap00 : tax
sta.b Scrap00 : asl : !ADD.b Scrap00 : tax
cpy.b #$ff : beq ++
jsr LoadNorthData : bra .main
++ jsr LoadSouthData
@@ -32,8 +32,8 @@ VertEdge:
LoadEdgeRoomHorz:
lda.b Scrap03 : sta.b RoomIndex
sty.b Scrap06
and.b #$0f : asl a : !sub.b LinkPosX+1 : !add.b Scrap06 : sta.b Scrap02
ldy #$00 : jsr ShiftVariablesMainDir
and.b #$0f : asl a : !SUB.b LinkPosX+1 : !ADD.b Scrap06 : sta.b Scrap02
ldy.b #$00 : jsr ShiftVariablesMainDir
lda.b Scrap04 : and.b #$80 : bne .edge
lda.b Scrap04 : sta.b Scrap01 ; load up flags in $01
@@ -54,7 +54,7 @@ LoadEdgeRoomHorz:
LoadEdgeRoomVert:
lda.b Scrap03 : sta.b RoomIndex
sty.b Scrap06
and.b #$f0 : lsr #3 : !sub.b LinkPosY+1 : !add.b Scrap06 : sta.b Scrap02
and.b #$f0 : lsr #3 : !SUB.b LinkPosY+1 : !ADD.b Scrap06 : sta.b Scrap02
lda.b Scrap04 : and.b #$80 : bne .edge
lda.b Scrap04 : sta.b Scrap01 ; load up flags in $01
@@ -99,7 +99,7 @@ MathStart:
rts
MathMid:
and.w #$01ff : !sub.b Scrap00 : and.w #$00ff : sta.b Scrap00
and.w #$01ff : !SUB.b Scrap00 : and.w #$00ff : sta.b Scrap00
; nothing should be bigger than $a0 at this point
lda.b Scrap05 : and.w #$00f0 : lsr #4 : tax
@@ -118,7 +118,7 @@ MathMid:
MathEnd:
beq +
lda.w #$0100
+ !add.b Scrap02 : !add.b Scrap00
+ !ADD.b Scrap02 : !ADD.b Scrap00
sta.b Scrap04
sep #$30
rts
@@ -137,7 +137,7 @@ LoadNorthData:
rts
LoadSouthMidpoint:
and.b #$0f : sta.b Scrap00 : asl : !add.b Scrap00 : tax
and.b #$0f : sta.b Scrap00 : asl : !ADD.b Scrap00 : tax
lda.w SouthEdgeInfo, x : sta.b Scrap0A ; needed now, and for nrml transition
rts
@@ -153,7 +153,7 @@ LoadSouthData:
rts
LoadNorthMidpoint:
and.b #$0f : sta.b Scrap00 : asl : !add.b Scrap00 : tax
and.b #$0f : sta.b Scrap00 : asl : !ADD.b Scrap00 : tax
lda.w NorthEdgeInfo, x : sta.b Scrap0A ; needed now, and for nrml transition
rts
@@ -169,7 +169,7 @@ LoadWestData:
rts
LoadEastMidpoint:
and.b #$0f : sta.b Scrap00 : asl : !add.b Scrap00 : tax
and.b #$0f : sta.b Scrap00 : asl : !ADD.b Scrap00 : tax
lda.w EastEdgeInfo, x : sta.b Scrap0A ; needed now, and for nrml transition
rts
@@ -185,7 +185,7 @@ LoadEastData:
LoadWestMidpoint:
and.b #$0f : sta.b Scrap00 : asl : !add.b Scrap00 : tax
and.b #$0f : sta.b Scrap00 : asl : !ADD.b Scrap00 : tax
lda.w WestEdgeInfo, x : sta.b Scrap0A ; needed now, and for nrml transition
rts
@@ -289,7 +289,7 @@ DetectEastEdge:
ldx.b #$04 : bra .end
++ ldx.b #$03 : bra .end
+ cmp.b #$84 : bne +
ldx #$05 : bra .end
ldx.b #$05 : bra .end
+ cmp.b #$cb : bne +
lda.b LinkQuadrantV : beq ++
ldx.b #$06 : bra .end

View File

@@ -46,7 +46,7 @@ pullpc
;===================================================================================================
StoreDoorInfo:
STA.w $1980,X
LDA.b $00 : STA.w $19F0,X
LDA.b Scrap00 : STA.w $19F0,X
TXA
RTL

View File

@@ -86,7 +86,7 @@ CgramAuxToMain: ; ripped this from bank02 because it ended with rts
OverridePaletteHeader:
lda.l DRMode : cmp.b #$02 : bne +
lda.l DRFlags : and.b #$20 : bne +
cpx.w #$01c2 : !bge +
cpx.w #$01c2 : !BGE +
rep #$20
txa : lsr : tax
lda.l PaletteTable, x

View File

@@ -124,7 +124,7 @@ DrHudDungeonItemsAdditions:
sta.w $1644 : sta.w $164a : sta.w $1652 : sta.w $1662 : sta.w $1684 : sta.w $16c4
ldx.w #$0000
- sta.w $1704, x : sta.w $170e, x : sta.w $1718, x
inx #2 : cpx.w #$0008 : !blt -
inx #2 : cpx.w #$0008 : !BLT -
lda.l HudFlag : and.w #$0020 : beq + : JMP ++ : +
lda.l HUDDungeonItems : and.w #$0007 : bne + : JMP ++ : +
@@ -136,7 +136,7 @@ DrHudDungeonItemsAdditions:
lda.w #$24f5 : sta.w $1724
ldx.w #$0002
- lda.w #$0000 : !addl RowOffsets,x : !addl ColumnOffsets, x : tay
- lda.w #$0000 : !ADD.l RowOffsets,x : !ADD.l ColumnOffsets, x : tay
lda.l DungeonReminderTable, x : sta.w $1644, y : iny #2
lda.w #$24f5 : sta.w $1644, y
lda.l MapField : and.l DungeonMask, x : beq + ; must have map
@@ -146,7 +146,7 @@ DrHudDungeonItemsAdditions:
.smallKey
+ iny #2
cpx.w #$001a : bne +
tya : !add.w #$003c : tay
tya : !ADD.w #$003c : tay
+ stx.b Scrap00
txa : lsr : tax
lda.w #$24f5 : sta.w $1644, y
@@ -158,7 +158,7 @@ DrHudDungeonItemsAdditions:
lda.l MapField : and.l DungeonMask, x : beq + ; must have map
plx : sep #$30 : lda.l ChestKeys, x : sta.b Scrap02
lda.l GenericKeys : bne +++
lda.b Scrap02 : !sub.l DungeonCollectedKeys, x : sta.b Scrap02
lda.b Scrap02 : !SUB.l DungeonCollectedKeys, x : sta.b Scrap02
+++ lda.b Scrap02
rep #$30
jsr ConvertToDisplay2 : sta.w $1644, y ; small key totals
@@ -180,7 +180,7 @@ DrHudDungeonItemsAdditions:
sta.w $160a : sta.w $1614 : sta.w $161e ; blank out sm key indicators
ldx.w #$0002
- lda.w #$0000 ; start of hud area
!addl RowOffsets, x : !addl ColumnOffsets, x : tay
!ADD.l RowOffsets, x : !ADD.l ColumnOffsets, x : tay
lda.l DungeonReminderTable, x : sta.w $1644, y
iny #2
lda.w #$24f5 : sta.w $1644, y ; blank out map spot
@@ -188,10 +188,10 @@ DrHudDungeonItemsAdditions:
JSR MapIndicatorShort : STA.w $1644, Y
+ iny #2
cpx.w #$001a : bne +
tya : !add.w #$003c : tay
tya : !ADD.w #$003c : tay
+ lda.l CompassField : and.l DungeonMask, x : beq + ; must have compass
phx ; total chest counts
LDA.l CompassTotalsWRAM, x : !sub.l DungeonLocationsChecked, x
LDA.l CompassTotalsWRAM, x : !SUB.l DungeonLocationsChecked, x
SEP #$30 : JSR HudHexToDec2DigitCopy : REP #$30
lda.b Scrap06 : jsr ConvertToDisplay2 : sta.w $1644, y : iny #2
lda.b Scrap07 : jsr ConvertToDisplay2 : sta.w $1644, y
@@ -201,7 +201,7 @@ DrHudDungeonItemsAdditions:
.skipBlanks iny #2
cpx.w #$001a : beq +
lda.w #$24f5 : sta.w $1644, y ; blank out spot
+ inx #2 : cpx.w #$001b : !bge ++ : JMP -
+ inx #2 : cpx.w #$001b : !BGE ++ : JMP -
++
plp : ply : plx : rtl
}
@@ -244,15 +244,15 @@ BkStatus:
+++ lda.w #$2826 : rts ; check mark
ConvertToDisplay:
and.w #$00ff : cmp.w #$000a : !blt +
!add.w #$2553 : rts
+ !add.w #$2490 : rts
and.w #$00ff : cmp.w #$000a : !BLT +
!ADD.w #$2553 : rts
+ !ADD.w #$2490 : rts
ConvertToDisplay2:
and.w #$00ff : beq ++
cmp.w #$000a : !blt +
!add.w #$2553 : rts ; 2580 with 258A as "A" for non transparent digits
+ !add.w #$2816 : rts
cmp.w #$000a : !BLT +
!ADD.w #$2553 : rts ; 2580 with 258A as "A" for non transparent digits
+ !ADD.w #$2816 : rts
++ lda.w #$2827 : rts ; 0/O for 0 or placeholder digit ;2483
CountAbsorbedKeys:

View File

@@ -23,11 +23,11 @@ CheckIfDoorsOpen: {
.nextDoor
lda.b RoomIndex : asl : tax
lda.w KeyDoorOffset, x : beq .skipDoor
asl : sty.b Scrap05 : !add.b Scrap05 : tax
asl : sty.b Scrap05 : !ADD.b Scrap05 : tax
lda.w PairedDoorTable, x : beq .skipDoor
sta.b Scrap02 : and.w #$00ff : asl a : tax
lda.b Scrap02 : and.w #$ff00 : sta.b Scrap03
lda RoomDataWRAM.l, X : and.w #$f000 : and.b Scrap03 : beq .skipDoor
lda.l RoomDataWRAM.l, X : and.w #$f000 : and.b Scrap03 : beq .skipDoor
tyx : lda.w $068c : ora.l DungeonMask,x : sta.w $068c
.skipDoor
iny #2 : cpy.b Scrap00 : bne .nextDoor

View File

@@ -31,18 +31,18 @@ lda.b Scrap00 : bra .loop
.done rts
MultiBy3:
sta.b Scrap00 : asl : !add.b Scrap00
sta.b Scrap00 : asl : !ADD.b Scrap00
rts
MultiBy5:
sta.b Scrap00 : asl #2 : !add.b Scrap00
sta.b Scrap00 : asl #2 : !ADD.b Scrap00
rts
;width of divison in x: rounds toward X/2
DivideBy2:
sta.b Scrap00
lsr : bcc .done
sta.b Scrap02 : txa : lsr : cmp.b Scrap00 : !blt +
sta.b Scrap02 : txa : lsr : cmp.b Scrap00 : !BLT +
lda.b Scrap02 : inc : bra .done
+ lda.b Scrap02
.done rts
@@ -51,8 +51,8 @@ DivideBy3:
sta.b Scrap00
ldx.w #$0000
lda.w #$0002
.loop cmp.b Scrap00 : !bge .store
inx : !add.w #$0003 : bra .loop
.loop cmp.b Scrap00 : !BGE .store
inx : !ADD.w #$0003 : bra .loop
.store txa
rts
@@ -60,7 +60,7 @@ DivideBy5:
sta.b Scrap00
ldx.w #$0000
lda.w #$0003
.loop cmp.b Scrap00 : !bge .store
inx : !add.w #$0005 : bra .loop
.loop cmp.b Scrap00 : !BGE .store
inx : !ADD.w #$0005 : bra .loop
.store txa
rts

View File

@@ -3,7 +3,7 @@ WarpLeft:
JSR CheckIfCave : BCS .end
lda.b LinkPosY : ldx.b LinkQuadrantV
jsr CalcIndex
!add.b #$06 : ldy.b #$01 ; offsets in A, Y
!ADD.b #$06 : ldy.b #$01 ; offsets in A, Y
jsr LoadRoomHorz
.end
jsr Cleanup
@@ -14,7 +14,7 @@ WarpRight:
JSR CheckIfCave : BCS .end
lda.b LinkPosY : ldx.b LinkQuadrantV
jsr CalcIndex
!add.b #$12 : ldy.b #$ff ; offsets in A, Y
!ADD.b #$12 : ldy.b #$ff ; offsets in A, Y
jsr LoadRoomHorz
.end
jsr Cleanup
@@ -43,7 +43,7 @@ WarpDown:
JSR CheckIfCave : BCS .end
lda.b LinkPosX : ldx.b LinkQuadrantH
jsr CalcIndex
!add.b #$0c : ldy.b #$ff ; offsets in A, Y
!ADD.b #$0c : ldy.b #$ff ; offsets in A, Y
jsr LoadRoomVert
%StonewallCheck($43)
.end
@@ -65,9 +65,9 @@ CheckLinkDoorL:
+ clc : rtl
TrapDoorFixer:
lda.b $fe : and #$0038 : beq .end
lda.b $fe : and.w #$0038 : beq .end
xba : asl #2 : sta.b Scrap00
stz.w $0468 : lda.w $068c : ora.b Scrap00 : sta.w $068c
stz.w TrapDoorFlag : lda.w $068c : ora.b Scrap00 : sta.w $068c
.end
stz.b $fe ; clear our fe here because we don't need it anymore
rts
@@ -113,7 +113,7 @@ LoadRoomHorz:
.gtg ;Good to Go!
pla ; Throw away normal room (don't fill up the stack)
lda.b RoomIndex : and.b #$0F : asl a : !sub.b LinkPosX+1 : !add.b Scrap06 : sta.b Scrap02
lda.b RoomIndex : and.b #$0F : asl a : !SUB.b LinkPosX+1 : !ADD.b Scrap06 : sta.b Scrap02
ldy.b #$00 : jsr ShiftVariablesMainDir
lda.b Scrap01 : and.b #$80 : beq .normal
@@ -146,7 +146,7 @@ LoadRoomVert:
sta.b RoomIndex : bra .end ; Restore normal room, abort (straight staircases and open edges can get in this routine)
.gtg ;Good to Go!
pla ; Throw away normal room (don't fill up the stack)
lda.b RoomIndex : and.b #$F0 : lsr #3 : !sub.b LinkPosY+1 : !add.b Scrap06 : sta.b Scrap02
lda.b RoomIndex : and.b #$F0 : lsr #3 : !SUB.b LinkPosY+1 : !ADD.b Scrap06 : sta.b Scrap02
lda.b Scrap01 : and.b #$80 : beq .notEdge
ldy.b #$01 : jsr ShiftVariablesMainDir
@@ -173,12 +173,12 @@ LoadRoomVert:
LookupNewRoom: ; expects data offset to be in A
{
rep #$30 : and #$00FF ;sanitize A reg (who knows what is in the high byte)
rep #$30 : and.w #$00FF ;sanitize A reg (who knows what is in the high byte)
sta.b Scrap00 ; offset in 00
lda.b PreviousRoom : tax ; probably okay loading $a3 in the high byte
lda.w DoorOffset,x : and.w #$00FF ;we only want the low byte
asl #3 : sta.b Scrap02 : !add.b Scrap02 : !add.b Scrap02 ;multiply by 24 (data size)
!add.b Scrap00 ; should now have the offset of the address I want to load
asl #3 : sta.b Scrap02 : !ADD.b Scrap02 : !ADD.b Scrap02 ;multiply by 24 (data size)
!ADD.b Scrap00 ; should now have the offset of the address I want to load
tax : lda.w DoorTable,x : sta.b Scrap00
and.w #$00FF : sta.b RoomIndex ; assign new room
sep #$30
@@ -190,14 +190,14 @@ LookupNewRoom: ; expects data offset to be in A
ShiftVariablesMainDir:
{
lda.w CoordIndex,y : tax
lda.b LinkPosY+1,x : !add.b Scrap02 : sta.b LinkPosY+1,x ; coordinate update
lda.b LinkPosY+1,x : !ADD.b Scrap02 : sta.b LinkPosY+1,x ; coordinate update
lda.w CameraIndex,y : tax
lda.b $e3,x : !add.b Scrap02 : sta.b $e3,x ; scroll register high byte
lda.b $e3,x : !ADD.b Scrap02 : sta.b $e3,x ; scroll register high byte
lda.w CamQuadIndex,y : tax
lda.w $0605,x : !add.b Scrap02 : sta.w $0605,x ; high bytes of these guys
lda.w $0607,x : !add.b Scrap02 : sta.w $0607,x
lda.w $0601,x : !add.b Scrap02 : sta.w $0601,x
lda.w $0603,x : !add.b Scrap02 : sta.w $0603,x
lda.w $0605,x : !ADD.b Scrap02 : sta.w $0605,x ; high bytes of these guys
lda.w $0607,x : !ADD.b Scrap02 : sta.w $0607,x
lda.w $0601,x : !ADD.b Scrap02 : sta.w $0601,x
lda.w $0603,x : !ADD.b Scrap02 : sta.w $0603,x
rts
}
@@ -232,10 +232,10 @@ PrepScrollToInroomStairs:
inc.w $0603 : inc.w $0607
dec.w CameraScrollN+1 : dec.w CameraScrollS+1
+
lda.w InroomStairsY,y : !add.b #$20 : sta.b LinkPosY
!sub.b #$38 : sta.w $045e
lda.w InroomStairsY,y : !ADD.b #$20 : sta.b LinkPosY
!SUB.b #$38 : sta.w $045e
lda.b Scrap01 : and.b #$40 : beq +
lda.b LinkPosY : !add.b #$20 : sta.b LinkPosY
lda.b LinkPosY : !ADD.b #$20 : sta.b LinkPosY
stz.w $045f
+
dec.b LinkPosY+1
@@ -251,10 +251,10 @@ PrepScrollToInroomStairs:
dec.w $0603 : dec.w $0607
inc.w CameraScrollN+1 : inc.w CameraScrollS+1
+
lda.w InroomStairsY,y : !sub.b #$20 : sta.b LinkPosY
!add.b #$38 : sta.w $045e
lda.w InroomStairsY,y : !SUB.b #$20 : sta.b LinkPosY
!ADD.b #$38 : sta.w $045e
lda.b Scrap01 : and.b #$40 : beq +
lda.b LinkPosY : !sub.b #$20 : sta.b LinkPosY
lda.b LinkPosY : !SUB.b #$20 : sta.b LinkPosY
stz.w $045f
+
inc.b LinkPosY+1
@@ -287,7 +287,7 @@ PrepScrollToNormal:
stz.w $0476
+ stz.b Scrap05 : lda.b #$78 : sta.b Scrap04
lda.b Scrap01 : and.b #$03 : beq .end
cmp.b #$02 : !bge +
cmp.b #$02 : !BGE +
lda.b #$f8 : sta.b Scrap04 : bra .end
+ inc.b Scrap05
.end rts
@@ -306,11 +306,11 @@ StraightStairsAdj:
jsr GetTileAttribute : tax
lda.b GameSubMode : cmp.b #$12 : beq .goingNorth
lda.b PreviousRoom : cmp.b #$51 : bne ++
rep #$20 : lda.w #$0018 : !add.b LinkPosY : sta.b LinkPosY : sep #$20 ; special fix for throne room
rep #$20 : lda.w #$0018 : !ADD.b LinkPosY : sta.b LinkPosY : sep #$20 ; special fix for throne room
jsr GetTileAttribute : tax
++ lda.l StepAdjustmentDown, X : bra .end
; lda.b LinkLayer : beq .end
; rep #$20 : lda.w #$ffe0 : !add.b LinkPosY : sta.b LinkPosY : sep #$20
; rep #$20 : lda.w #$ffe0 : !ADD.b LinkPosY : sta.b LinkPosY : sep #$20
.goingNorth
cpx.b #$00 : bne ++
lda.b RoomIndex : cmp.b #$51 : bne ++
@@ -320,8 +320,8 @@ StraightStairsAdj:
++ lda.l StepAdjustmentUp, X
.end
pha : lda.w $0462 : and.b #$04 : bne ++
pla : !add.b #$f6 : pha
++ pla : !add.w $0464 : sta.w $0464
pla : !ADD.b #$f6 : pha
++ pla : !ADD.w $0464 : sta.w $0464
+ rtl
.toInroom
lda.b #$32 : sta.w $0464 : stz.w $045e
@@ -352,7 +352,7 @@ StraightStairsFix:
{
pha
lda.l DRMode : bne +
pla : !add.b LinkPosY : sta.b LinkPosY : rtl ;what we wrote over
pla : !ADD.b LinkPosY : sta.b LinkPosY : rtl ;what we wrote over
+ pla : rtl
}
@@ -405,13 +405,13 @@ StraightStairsTrapDoor:
pea.w $82802c
jml ResetThenCacheRoomEntryProperties ; $10D71 .reset label of Bank02
.jslrtsreturn
lda.w $0468 : bne ++
lda.w TrapDoorFlag : bne ++
lda.b RoomIndex : cmp.b #$ac : bne .animateTraps
lda.w $0403 : and.b #$20 : bne .animateTraps
lda.w $0403 : and.b #$10 : beq ++
.animateTraps
lda.b #$05 : sta.b GameSubMode
inc.w $0468 : stz.w $068e : stz.w $0690
inc.w TrapDoorFlag : stz.w TileMapDoorPos : stz.w DoorTimer
++ JML Underworld_SetBossOrSancMusicUponEntry_long
+ JML Dungeon_ApproachFixedColor ; what we wrote over
}
@@ -443,5 +443,6 @@ HandleSpecialDoorLanding: {
PLA
CMP.b #$34 : BNE + ; inroom stairs
PHA : LDA.b #$26 : STA.w $045E : PLA
+ RTL
+
RTL
}

View File

@@ -36,7 +36,7 @@ BlockEraseFix:
+ rtl
FixShopCode:
cpx.w #$0300 : !bge +
cpx.w #$0300 : !BGE +
sta.l RoomDataWRAM[$00].l, x
+ rtl
@@ -46,8 +46,8 @@ VitreousKeyReset:
+ JML SpritePrep_LoadProperties ; what we wrote over
GuruguruFix:
lda.b RoomIndex : cmp.b #$df : !bge +
and.b #$0f : cmp.b #$0e : !blt +
lda.b RoomIndex : cmp.b #$df : !BGE +
and.b #$0f : cmp.b #$0e : !BLT +
iny #2
+ rtl

View File

@@ -12,7 +12,7 @@ AdjustTransition:
.add jsr AdjustCamAdd : ply : bra .reset
+ lda.b $ab : and.w #$0200 : xba : tax
lda.l OffsetTable,x : jsr AdjustCamAdd
lda.b $ab : !sub.w #$0008 : sta.b $ab
lda.b $ab : !SUB.w #$0008 : sta.b $ab
ply : bra .done
.reset ; clear the $ab variable so to not disturb intra-tile doors
stz.b $ab
@@ -22,11 +22,11 @@ AdjustTransition:
}
AdjustCamAdd:
!add.w $00E2,y : pha
and.w #$01ff : cmp.w #$0111 : !blt +
cmp.w #$01f8 : !bge ++
!ADD.w $00E2,y : pha
and.w #$01ff : cmp.w #$0111 : !BLT +
cmp.w #$01f8 : !BGE ++
pla : and.w #$ff10 : pha : bra +
++ pla : and.w #$ff00 : !add.w #$0100 : pha
++ pla : and.w #$ff00 : !ADD.w #$0100 : pha
+ pla : sta.w $00E2,y : sta.w $00E0,y : rts
; expects target quad in $05 (either 0 or 1) and target pixel in $04, target room should be in $a0
@@ -45,22 +45,22 @@ ScrollY: ;change the Y offset variables
rep #$30
lda.b Scrap00 : pha
lda.b BG2V : and #$01ff : sta.b Scrap02
lda.b BG2V : and.w #$01ff : sta.b Scrap02
lda.b Scrap04 : jsr LimitYCamera : sta.b Scrap00
jsr CheckRoomLayoutY : bcc +
lda.b Scrap00 : cmp.w #$0080 : !bge ++
cmp.w #$0010 : !blt .cmpSrll
lda.b Scrap00 : cmp.w #$0080 : !BGE ++
cmp.w #$0010 : !BLT .cmpSrll
lda.w #$0010 : bra .cmpSrll
++ cmp.w #$0100 : !bge .cmpSrll
++ cmp.w #$0100 : !BGE .cmpSrll
lda.w #$0100
.cmpSrll sta.b Scrap00
; figures out scroll amt
+ lda.b Scrap00 : cmp.b Scrap02 : bne +
lda.w #$0000 : bra .next
+ !blt +
!sub.b Scrap02 : inc.b Scrap0E : bra .next
+ lda.b Scrap02 : !sub.b Scrap00
+ !BLT +
!SUB.b Scrap02 : inc.b Scrap0E : bra .next
+ lda.b Scrap02 : !SUB.b Scrap00
.next
sta.b $ab
@@ -76,11 +76,11 @@ ScrollY: ;change the Y offset variables
rts
LimitYCamera:
cmp.w #$006c : !bge +
cmp.w #$006c : !BGE +
lda.w #$0000 : bra .end
+ cmp.w #$017d : !blt +
+ cmp.w #$017d : !BLT +
lda.w #$0110 : bra .end
+ !sub.w #$006c
+ !SUB.w #$006c
.end rts
CheckRoomLayoutY:
@@ -88,7 +88,7 @@ CheckRoomLayoutY:
cmp.b #$00 : beq .lock
cmp.b #$07 : beq .free
cmp.b #$01 : beq .free
cmp.b #$04 : !bge .lock
cmp.b #$04 : !BGE .lock
cmp.b #$02 : bne +
lda.b Scrap06 : cmp.b #$ff : beq .lock
+ cmp.b #$03 : bne .free
@@ -100,26 +100,26 @@ AdjustCameraBoundsY:
jsr CheckRoomLayoutY : bcc .free
; layouts that are camera locked (quads only)
lda.b Scrap04 : and.w #$00ff : cmp.w #$007d : !blt +
lda.b Scrap04 : and.w #$00ff : cmp.w #$007d : !BLT +
lda.w #$0088 : bra ++
+ cmp.w #$006d : !bge +
+ cmp.w #$006d : !BGE +
lda.w #$0078 : bra ++
+ !add.w #$000b
+ !ADD.w #$000b
; I think we no longer need the $02 variable
++ sta.b Scrap02 : lda.b Scrap04 : and.w #$0100 : !add.b Scrap02 : bra .setBounds
++ sta.b Scrap02 : lda.b Scrap04 : and.w #$0100 : !ADD.b Scrap02 : bra .setBounds
; layouts where the camera is free
.free lda.b Scrap04 : cmp.w #$006c : !bge +
.free lda.b Scrap04 : cmp.w #$006c : !BGE +
lda.w #$0077 : bra .setBounds
+ cmp.w #$017c : !blt +
+ cmp.w #$017c : !BLT +
lda.w #$0187 : bra .setBounds
+ !add.w #$000b
+ !ADD.w #$000b
.setBounds sta.w $0618 : inc #2 : sta.w $061a
rts
LoadRoomLayout:
lda.b RoomIndex : asl : !add.b RoomIndex : tax
lda.b RoomIndex : asl : !ADD.b RoomIndex : tax
lda.l RoomData_ObjectDataPointers+1, x : sta.b $b8
lda.l RoomData_ObjectDataPointers, x : sta.b $b7
sep #$30
@@ -144,7 +144,7 @@ ScrollX: ;change the X offset variables
lda.b BG2H : and.w #$01ff : sta.b Scrap02
lda.b Scrap04 : jsr LimitXCamera : sta.b Scrap00
jsr CheckRoomLayoutX : bcc +
lda.b Scrap00 : cmp.w #$0080 : !bge ++
lda.b Scrap00 : cmp.w #$0080 : !BGE ++
lda.w #$0000 : bra .cmpSrll
++ lda.w #$0100
.cmpSrll sta.b Scrap00
@@ -152,18 +152,18 @@ ScrollX: ;change the X offset variables
;figures out scroll amt
+ lda.b Scrap00 : cmp.b Scrap02 : bne +
lda.w #$0000 : bra .next
+ !blt +
!sub.b Scrap02 : inc.b Scrap0E : bra .next
+ lda.b Scrap02 : !sub.b Scrap00
+ !BLT +
!SUB.b Scrap02 : inc.b Scrap0E : bra .next
+ lda.b Scrap02 : !SUB.b Scrap00
.next
sta.b $ab : lda.b Scrap04
cmp.w #$0078 : !bge +
cmp.w #$0078 : !BGE +
lda.w #$007f : bra ++
+ cmp.w #$0178 : !blt +
+ cmp.w #$0178 : !BLT +
lda.w #$017f : bra ++
+ !add.w #$0007
+ !ADD.w #$0007
++ sta.w $061c : inc #2 : sta.w $061e
pla : sta.b Scrap00
@@ -181,19 +181,19 @@ ScrollX: ;change the X offset variables
rts
LimitXCamera:
cmp.w #$0079 : !bge +
cmp.w #$0079 : !BGE +
lda.w #$0000 : bra .end
+ cmp.w #$0178 : !blt +
+ cmp.w #$0178 : !BLT +
lda.w #$0178
+ !sub.w #$0078
+ !SUB.w #$0078
.end rts
CheckRoomLayoutX:
jsr LoadRoomLayout ;switches to 8-bit
cmp.b #$04 : !blt .lock
cmp.b #$04 : !BLT .lock
cmp.b #$05 : bne +
lda.b Scrap06 : cmp.b #$ff : beq .lock
+ cmp #$06 : bne .free
+ cmp.b #$06 : bne .free
lda.b Scrap06 : cmp.b #$ff : bne .lock
.free rep #$30 : clc : rts
.lock rep #$30 : sec : rts
@@ -202,8 +202,8 @@ ApplyScroll:
rep #$30
lda.b $ab : and.w #$01ff : sta.b Scrap00
lda.b $ab : and.w #$0200 : beq +
lda.w $00e2, y : !add.b Scrap00 : bra .end
+ lda.w $00e2, y : !sub.b Scrap00
lda.w $00e2, y : !ADD.b Scrap00 : bra .end
+ lda.w $00e2, y : !SUB.b Scrap00
.end
sta.w $00e2, y
sta.w $00e0, y

View File

@@ -2,7 +2,7 @@ RecordStairType: {
pha
lda.l DRMode : beq .norm
REP #$30 : LDA.b PreviousRoom : CMP.w #$00E1 : BCS .norm
CMP #$00DF : BEQ .norm
CMP.w #$00DF : BEQ .norm
SEP #$30
lda.b Scrap0E
cmp.b #$25 : bcc ++ ; don't record straight staircases
@@ -38,42 +38,42 @@ SpiralWarp: {
lda.b Scrap00 : sta.b RoomIndex
; shift quadrant if necessary
stz.b Scrap07 ; this is a x quad adjuster for those blasted staircase on the edges
lda.b Scrap01 : and.b #$01 : !sub.b LinkQuadrantH
lda.b Scrap01 : and.b #$01 : !SUB.b LinkQuadrantH
bne .xQuad
lda.w $0462 : and.b #$04 : bne .xqCont
inc.b Scrap07
.xqCont lda.b LinkPosX : bne .skipXQuad ; this is an edge case
dec.b LinkPosX+1 : bra .skipXQuad ; need to -1 if $22 is 0
.xQuad sta.b Scrap06 : !add.b LinkQuadrantH : sta.b LinkQuadrantH
.xQuad sta.b Scrap06 : !ADD.b LinkQuadrantH : sta.b LinkQuadrantH
lda.w $0462 : and.b #$04 : bne .xCont
inc.b Scrap07 ; up stairs are going to -1 the quad anyway during transition, need to add this back
.xCont ldy.b #$00 : jsr ShiftQuadSimple
.skipXQuad
lda.b LinkQuadrantV : lsr : sta.b Scrap06 : lda.b Scrap01 : and.b #$02 : lsr : !sub.b Scrap06
lda.b LinkQuadrantV : lsr : sta.b Scrap06 : lda.b Scrap01 : and.b #$02 : lsr : !SUB.b Scrap06
beq .skipYQuad
sta.b Scrap06 : asl : !add.b LinkQuadrantV : sta.b LinkQuadrantV
sta.b Scrap06 : asl : !ADD.b LinkQuadrantV : sta.b LinkQuadrantV
ldy.b #$01 : jsr ShiftQuadSimple
.skipYQuad
lda.b Scrap01 : and.b #$04 : lsr : sta.w $048a ;fix layer calc 0->0 2->1
lda.b Scrap01 : and.b #$08 : lsr #2 : sta.w $0492 ;fix from layer calc 0->0 2->1
; shift lower coordinates
lda.b Scrap02 : sta.b LinkPosX : bne .adjY : lda.b LinkPosX+1 : !add.b Scrap07 : sta.b LinkPosX+1
lda.b Scrap02 : sta.b LinkPosX : bne .adjY : lda.b LinkPosX+1 : !ADD.b Scrap07 : sta.b LinkPosX+1
.adjY lda.b Scrap03 : sta.b LinkPosY : bne .upDownAdj : inc.b LinkPosY+1
.upDownAdj ldx.b #$08
lda.w $0462 : and.b #$04 : beq .upStairs
ldx.b #$fd
lda.b Scrap01 : and.b #$80 : bne .set53
; if target is also down adjust by (6,-15)
lda.b #$06 : !add.b LinkPosY : sta.b LinkPosY : lda.b #$eb : !add.b LinkPosX : sta.b LinkPosX : bra .set53
lda.b #$06 : !ADD.b LinkPosY : sta.b LinkPosY : lda.b #$eb : !ADD.b LinkPosX : sta.b LinkPosX : bra .set53
.upStairs
lda.b Scrap01 : and.b #$80 : beq .set53
; if target is also up adjust by (-6, 14)
lda.b #$fa : !add.b LinkPosY : sta.b LinkPosY : lda.b #$14 : !add.b LinkPosX : sta.b LinkPosX
lda.b #$fa : !ADD.b LinkPosY : sta.b LinkPosY : lda.b #$14 : !ADD.b LinkPosX : sta.b LinkPosX
bne .set53 : inc.b LinkPosX+1
.set53
txa : !add.b LinkPosX : sta.b $53
txa : !ADD.b LinkPosX : sta.b $53
lda.b Scrap01 : and.b #$10 : sta.b Scrap07 ; zeroHzCam check
ldy.b #$00 : jsr SetCamera
@@ -90,7 +90,7 @@ StairCleanup: {
stz.w $045e ; clear the staircase flag
; animated tiles fix
lda.l DRMode : cmp #$02 : bne + ; only do this in crossed mode
lda.l DRMode : cmp.b #$02 : bne + ; only do this in crossed mode
ldx.b RoomIndex : lda.l TilesetTable, x
cmp.w $0aa1 : beq + ; already eq no need to decomp
sta.w $0aa1
@@ -154,7 +154,7 @@ LookupSpiralOffset: {
.done
lda.b PreviousRoom : tax : lda.w SpiralOffset,x
!add.b Scrap01 ;add a thing (0 in easy case)
!ADD.b Scrap01 ;add a thing (0 in easy case)
rts
}
@@ -202,7 +202,7 @@ InroomStairsWarp: {
lda.w InroomStairsX,y : sta.b LinkPosX
lda.w InroomStairsY,y
ldy.b Scrap07 : beq +
!add #$07
!ADD.b #$07
+
sta.b LinkPosY
inc.b Scrap07
@@ -228,7 +228,7 @@ InroomStairsWarp: {
++ sta.b LinkPosY
inc.b Scrap07 : stz.b Scrap02 : lda.b #$78 : sta.b LinkPosX
lda.b Scrap01 : and.b #$03 : beq ++
cmp.b #$02 : !bge +
cmp.b #$02 : !BGE +
lda.b #$f8 : sta.b LinkPosX : stz.b Scrap07 : bra ++
+ inc.b Scrap02
++
@@ -240,14 +240,14 @@ InroomStairsWarp: {
stz.w $0476
+
lda.b Scrap02 : !sub.b LinkQuadrantH
lda.b Scrap02 : !SUB.b LinkQuadrantH
beq .skipXQuad
sta.b Scrap06 : !add.b LinkQuadrantH : sta.b LinkQuadrantH
sta.b Scrap06 : !ADD.b LinkQuadrantH : sta.b LinkQuadrantH
ldy.b #$00 : jsr ShiftQuadSimple
.skipXQuad
lda.b LinkQuadrantV : lsr : sta.b Scrap06 : lda.b Scrap03 : !sub.b Scrap06
lda.b LinkQuadrantV : lsr : sta.b Scrap06 : lda.b Scrap03 : !SUB.b Scrap06
beq .skipYQuad
sta.b Scrap06 : asl : !add.b LinkQuadrantV : sta.b LinkQuadrantV
sta.b Scrap06 : asl : !ADD.b LinkQuadrantV : sta.b LinkQuadrantV
ldy.b #$01 : jsr ShiftQuadSimple
.skipYQuad
@@ -268,11 +268,11 @@ InroomStairsWarp: {
ShiftQuadSimple: {
lda.w CoordIndex,y : tax
lda.b LinkPosY,x : beq .skip
lda.b LinkPosY+1,x : !add.b Scrap06 : sta.b LinkPosY+1,x ; coordinate update
lda.b LinkPosY+1,x : !ADD.b Scrap06 : sta.b LinkPosY+1,x ; coordinate update
.skip
lda.w CamQuadIndex,y : tax
lda.w $0601,x : !add.b Scrap06 : sta.w $0601,x
lda.w $0605,x : !add.b Scrap06 : sta.w $0605,x ; high bytes of these guys
lda.w $0601,x : !ADD.b Scrap06 : sta.w $0601,x
lda.w $0605,x : !ADD.b Scrap06 : sta.w $0605,x ; high bytes of these guys
rts
}
@@ -288,8 +288,8 @@ SetCamera: {
lda.w CoordIndex,y : tax
lda.b LinkPosY,x : beq .oddQuad
cmp.b #$79 : bcc .adj0
!sub.b #$78 : sta.b Scrap04
tya : asl : !add.b #$04 : tax : jsr AdjCamBounds : bra .done
!SUB.b #$78 : sta.b Scrap04
tya : asl : !ADD.b #$04 : tax : jsr AdjCamBounds : bra .done
.oddQuad
lda.b #$80 : sta.b Scrap04 : bra .adj1 ; this is such a weird case - quad cross boundary
.adj0
@@ -299,16 +299,16 @@ SetCamera: {
lda.b Scrap07 : bne .setQuad
lda.w CoordIndex,y : tax
lda.b LinkPosY,x : cmp.b #$78 : bcs .setQuad
!add.b #$78 : sta.b Scrap04
!ADD.b #$78 : sta.b Scrap04
lda.w CamQuadIndex,y : tax : lda.w $0603, x : pha
lda.w CameraIndex,y : tax : pla : sta.b BG2H+1, x
.adj1
tya : asl : !add.b #$08 : tax : jsr AdjCamBounds : bra .done
tya : asl : !ADD.b #$08 : tax : jsr AdjCamBounds : bra .done
.setQuad
lda.w CamQuadIndex,y : tax : lda.w $0607, x : pha
lda.w CameraIndex,y : tax : pla : sta.b BG2H+1, x
tya : asl : !add.b #$0c : tax : jsr AdjCamBounds : bra .done
tya : asl : !ADD.b #$0c : tax : jsr AdjCamBounds : bra .done
.done
lda.w CameraIndex,y : tax
@@ -322,7 +322,7 @@ AdjCamBounds: {
rep #$20 : lda.w CamBoundBaseLine, x : sta.b Scrap05
lda.b Scrap04 : and.w #$00ff : beq .common
lda.w CoordIndex,y : tax
lda.b LinkPosY, x : and.w #$00ff : !add.b Scrap05 : sta.b Scrap05
lda.b LinkPosY, x : and.w #$00ff : !ADD.b Scrap05 : sta.b Scrap05
.common
lda.w OppCamBoundIndex,y : tax
lda.b Scrap05 : sta.w CameraScrollN, x