More merge labeling
This commit is contained in:
116
owrando.asm
116
owrando.asm
@@ -152,7 +152,7 @@ org $9bed95 ; < ? - palettes.asm:748 ()
|
||||
jsl OWWorldCheck16 : nop
|
||||
|
||||
org $82b16e ; AND #$3F : ORA 7EF3CA
|
||||
and #$7f : eor #$40 : nop #2
|
||||
and.b #$7f : eor.b #$40 : nop #2
|
||||
|
||||
org $89C3C4
|
||||
jsl OWBonkDropPrepSprite : nop #2
|
||||
@@ -290,7 +290,7 @@ OWMirrorSpriteSkipDraw:
|
||||
sec : rtl
|
||||
|
||||
.vanilla
|
||||
LDA.w $0FC6 : CMP.b #$03 ; what we wrote over
|
||||
LDA.w GfxChrHalfSlotVerify : CMP.b #$03 ; what we wrote over
|
||||
RTL
|
||||
}
|
||||
OWLightWorldOrCrossed:
|
||||
@@ -322,7 +322,7 @@ OWFluteCancel2:
|
||||
}
|
||||
OWSmithAccept:
|
||||
{
|
||||
lda FollowerIndicator : cmp.b #$07 : beq +
|
||||
lda.l FollowerIndicator : cmp.b #$07 : beq +
|
||||
cmp.b #$08 : beq +
|
||||
clc : rtl
|
||||
+ sec : rtl
|
||||
@@ -359,7 +359,7 @@ LoadMapDarkOrMixed:
|
||||
CMP.b #!FLAG_OW_MIXED : REP #$30 : BEQ .mixed
|
||||
LDX.w #$03FE ; draw vanilla Dark World (what we wrote over)
|
||||
.copy_next
|
||||
LDA.w WorldMap_DarkWorldTilemap,X : STA.w $1000,X
|
||||
LDA.w WorldMap_DarkWorldTilemap,X : STA.w GFXStripes,X
|
||||
DEX : DEX : BPL .copy_next
|
||||
BRL .end
|
||||
.mixed
|
||||
@@ -526,7 +526,7 @@ OWBonkDrops:
|
||||
; JSLSpriteSFX_QueueSFX3WithPan
|
||||
|
||||
.load_item_and_mw
|
||||
LDA 3,S : TAX : INX : LDA.w OWBonkPrizeData,X
|
||||
LDA.b 3,S : TAX : INX : LDA.w OWBonkPrizeData,X
|
||||
PHA : INX : LDA.w OWBonkPrizeData,X : BEQ +
|
||||
; multiworld item
|
||||
DEX : PLA ; A = item id; X = row + 3
|
||||
@@ -579,11 +579,11 @@ OWBonkDrops:
|
||||
PLA : BNE + ; S = FlagBitmask, X (row + 2)
|
||||
TYX : JSL Sprite_IsOnscreen : BCC +
|
||||
LDA.b IndoorsFlag : BEQ ++
|
||||
LDA.l RoomDataWRAM[$0120].high : ORA 1,S : STA.l RoomDataWRAM[$0120].high
|
||||
LDA.w $0400 : ORA 1,S : STA.w $0400
|
||||
LDA.l RoomDataWRAM[$0120].high : ORA.b 1,S : STA.l RoomDataWRAM[$0120].high
|
||||
LDA.w $0400 : ORA.b 1,S : STA.w $0400
|
||||
BRA .increment_collection
|
||||
++
|
||||
LDX.b OverworldIndex : LDA.l OverworldEventDataWRAM,X : ORA 1,S : STA.l OverworldEventDataWRAM,X
|
||||
LDX.b OverworldIndex : LDA.l OverworldEventDataWRAM,X : ORA.b 1,S : STA.l OverworldEventDataWRAM,X
|
||||
|
||||
.increment_collection
|
||||
REP #$20
|
||||
@@ -626,7 +626,7 @@ OWBonkDrops:
|
||||
; determines the initial spawn point of item
|
||||
PLX : INX : INX : INX
|
||||
LDA.w SpritePosYLow,Y : SEC : SBC.w OWBonkPrizeData,X : STA.w SpritePosYLow,Y
|
||||
LDA.w SpritePosYHigh,Y : SBC #$00 : STA.w SpritePosYHigh,Y
|
||||
LDA.w SpritePosYHigh,Y : SBC.b #$00 : STA.w SpritePosYHigh,Y
|
||||
|
||||
BRA .return+2
|
||||
|
||||
@@ -661,7 +661,7 @@ OWBonkDropCollected:
|
||||
LDA.l RoomDataWRAM[$0120].high : AND.b 3,S : BEQ .return ; S = Collected, FlagBitmask, X (row + 2)
|
||||
SEC : RTS
|
||||
+
|
||||
LDX.b OverworldIndex : LDA.l OverworldEventDataWRAM,X : AND 3,S : BEQ .return ; S = Collected, FlagBitmask, X (row + 2)
|
||||
LDX.b OverworldIndex : LDA.l OverworldEventDataWRAM,X : AND.b 3,S : BEQ .return ; S = Collected, FlagBitmask, X (row + 2)
|
||||
SEC : RTS
|
||||
|
||||
.return
|
||||
@@ -758,7 +758,7 @@ OWEdgeTransition:
|
||||
LDA.l Overworld_ActualScreenID,X : ORA.l CurrentWorld ; what we wrote over
|
||||
TAX : LDA.l OWMode+1 : AND.b #!FLAG_OW_MIXED : BEQ .vanilla
|
||||
LDA.l OWTileWorldAssoc,X : CMP.l CurrentWorld : BEQ .vanilla ; if dest screen mismatches the current world
|
||||
TXA : EOR #$40 : RTL
|
||||
TXA : EOR.b #$40 : RTL
|
||||
|
||||
.vanilla
|
||||
TXA : RTL
|
||||
@@ -794,18 +794,18 @@ OWShuffle:
|
||||
ldx.b OverworldIndex : lda.l OWTileWorldAssoc,X : eor.l CurrentWorld : beq +
|
||||
; fake world, will treat this OW area as opposite world
|
||||
txa : eor.b #$40 : tax
|
||||
+ txa : and #$40 : !add.w OverworldSlotPosition : rep #$30 : and #$00ff : asl #3
|
||||
+ txa : and.b #$40 : !ADD.w OverworldSlotPosition : rep #$30 : and.w #$00ff : asl #3
|
||||
|
||||
adc 1,S : tax
|
||||
adc.b 1,S : tax
|
||||
asl.w OverworldSlotPosition : pla
|
||||
;x = offset to edgeoffsets table
|
||||
|
||||
sep #$20 : lda.l OWEdgeOffsets,x : and #$ff : beq .noTransition : pha ;get number of transitions
|
||||
sep #$20 : lda.l OWEdgeOffsets,x : and.b #$ff : beq .noTransition : pha ;get number of transitions
|
||||
;s1 = number of transitions left to check
|
||||
|
||||
inx : lda.l OWEdgeOffsets,x ;record id of first transition in table
|
||||
;multiply ^ by 16, 16bytes per record
|
||||
sta.w CPUMULTA : lda #16 : sta.w CPUMULTB ;wait 8 cycles
|
||||
sta.w CPUMULTA : lda.b #16 : sta.w CPUMULTB ;wait 8 cycles
|
||||
pla ;a = number of trans
|
||||
rep #$20
|
||||
and.w #$00ff
|
||||
@@ -814,7 +814,7 @@ OWShuffle:
|
||||
.nextTransition
|
||||
pha
|
||||
jsr OWSearchTransition_entry : bcs .newDestination
|
||||
txa : !add.w #$0010 : tax
|
||||
txa : !ADD.w #$0010 : tax
|
||||
pla : dec : bne .nextTransition : bra .noTransition
|
||||
|
||||
.newDestination
|
||||
@@ -836,8 +836,8 @@ OWSearchTransition:
|
||||
;A-16 XY-16
|
||||
lda.w TransitionDirection : bne + ;north
|
||||
lda.l OWNorthEdges,x : dec
|
||||
cmp.b LinkPosX : !bge .exitloop
|
||||
lda.l OWNorthEdges+2,x : cmp.b LinkPosX : !blt .exitloop
|
||||
cmp.b LinkPosX : !BGE .exitloop
|
||||
lda.l OWNorthEdges+2,x : cmp.b LinkPosX : !BLT .exitloop
|
||||
;MATCH
|
||||
lda.l OWNorthEdges+14,x : tay ;y = record id of dest
|
||||
lda.l OWNorthEdges+12,x ;a = current terrain
|
||||
@@ -845,8 +845,8 @@ OWSearchTransition:
|
||||
bra .matchfound
|
||||
+ dec : bne + ;south
|
||||
lda.l OWSouthEdges,x : dec
|
||||
cmp.b LinkPosX : !bge .exitloop
|
||||
lda.l OWSouthEdges+2,x : cmp.b LinkPosX : !blt .exitloop
|
||||
cmp.b LinkPosX : !BGE .exitloop
|
||||
lda.l OWSouthEdges+2,x : cmp.b LinkPosX : !BLT .exitloop
|
||||
;MATCH
|
||||
lda.l OWSouthEdges+14,x : tay ;y = record id of dest
|
||||
lda.l OWSouthEdges+12,x ;a = current terrain
|
||||
@@ -854,16 +854,16 @@ OWSearchTransition:
|
||||
bra .matchfound
|
||||
+ dec : bne + ; west
|
||||
lda.l OWWestEdges,x : dec
|
||||
cmp.b LinkPosY : !bge .exitloop
|
||||
lda.l OWWestEdges+2,x : cmp.b LinkPosY : !blt .exitloop
|
||||
cmp.b LinkPosY : !BGE .exitloop
|
||||
lda.l OWWestEdges+2,x : cmp.b LinkPosY : !BLT .exitloop
|
||||
;MATCH
|
||||
lda.l OWWestEdges+14,x : tay ;y = record id of dest
|
||||
lda.l OWWestEdges+12,x ;a = current terrain
|
||||
ldx.w #OWEastEdges ;x = address of table
|
||||
bra .matchfound
|
||||
+ lda.l OWEastEdges,x : dec ;east
|
||||
cmp.b LinkPosY : !bge .exitloop
|
||||
lda.l OWEastEdges+2,x : cmp.b LinkPosY : !blt .exitloop
|
||||
cmp.b LinkPosY : !BGE .exitloop
|
||||
lda.l OWEastEdges+2,x : cmp.b LinkPosY : !BLT .exitloop
|
||||
;MATCH
|
||||
lda.l OWEastEdges+14,x : tay ;y = record id of dest
|
||||
lda.l OWEastEdges+12,x ;a = current terrain
|
||||
@@ -877,7 +877,7 @@ OWSearchTransition:
|
||||
OWNewDestination:
|
||||
{
|
||||
tya : sta.w CPUMULTA : lda.b #16 : sta.w CPUMULTB ;wait 8 cycles
|
||||
rep #$20 : txa : nop : !add.w CPUPRODUCT : tax ;a = offset to dest record
|
||||
rep #$20 : txa : nop : !ADD.w CPUPRODUCT : tax ;a = offset to dest record
|
||||
lda.w $0008,x : sta.b Scrap04 ;save dest OW slot/ID
|
||||
ldy.b LinkPosY : lda.w TransitionDirection : dec #2 : bpl + : ldy.b LinkPosX : + sty.b Scrap06
|
||||
|
||||
@@ -888,21 +888,21 @@ OWNewDestination:
|
||||
LDA.l OWMode : AND.w #$0007 : BEQ .noLayoutShuffle ;temporary fix until VRAM issues are solved
|
||||
lda.w $0006,x : sta.b Scrap06 ;set coord
|
||||
lda.w $000a,x : sta.b OverworldMap16Buffer ;VRAM
|
||||
tya : and.w #$01ff : cmp.b 3,s : !blt .adjustMainAxis
|
||||
dec : cmp.b 1,s : !bge .adjustMainAxis
|
||||
inc : pha : lda.b Scrap06 : and.w #$fe00 : !add.b 1,s : sta.b Scrap06 : pla
|
||||
tya : and.w #$01ff : cmp.b 3,s : !BLT .adjustMainAxis
|
||||
dec : cmp.b 1,s : !BGE .adjustMainAxis
|
||||
inc : pha : lda.b Scrap06 : and.w #$fe00 : !ADD.b 1,s : sta.b Scrap06 : pla
|
||||
|
||||
; adjust and set other VRAM addresses
|
||||
lda.w $0006,x : pha : lda.b Scrap06 : !sub 1,s
|
||||
lda.w $0006,x : pha : lda.b Scrap06 : !SUB 1,s
|
||||
jsl DivideByTwoPreserveSign : jsl DivideByTwoPreserveSign : jsl DivideByTwoPreserveSign : jsl DivideByTwoPreserveSign : pha ; number of tiles
|
||||
lda.w TransitionDirection : dec #2 : bmi +
|
||||
pla : pea.w $0000 : bra ++ ;pla : asl #7 : pha : bra ++ ; y-axis shifts VRAM by increments of 0x80 (disabled for now)
|
||||
+ pla : asl : pha ; x-axis shifts VRAM by increments of 0x02
|
||||
++ lda.b OverworldMap16Buffer : !add 1,s : sta.b OverworldMap16Buffer : pla : pla
|
||||
++ lda.b OverworldMap16Buffer : !ADD.b 1,s : sta.b OverworldMap16Buffer : pla : pla
|
||||
|
||||
.adjustMainAxis
|
||||
LDA.b OverworldMap16Buffer : SEC : SBC #$0400 : AND #$0F00 : ASL : XBA : STA.b OverworldTilemapIndexY ; vram
|
||||
LDA.b OverworldMap16Buffer : SEC : SBC #$0010 : AND #$003E : LSR : STA.b OverworldTilemapIndexX
|
||||
LDA.b OverworldMap16Buffer : SEC : SBC.w #$0400 : AND.w #$0F00 : ASL : XBA : STA.b OverworldTilemapIndexY ; vram
|
||||
LDA.b OverworldMap16Buffer : SEC : SBC.w #$0010 : AND.w #$003E : LSR : STA.b OverworldTilemapIndexX
|
||||
|
||||
.noLayoutShuffle
|
||||
LDA.w $000F,X : AND.w #$00FF : STA.w RandoOverworldWalkDist ; position to walk to after transition (if non-zero)
|
||||
@@ -920,47 +920,47 @@ OWNewDestination:
|
||||
pla : pla : sep #$10 : ldy.w TransitionDirection
|
||||
ldx.w OWCoordIndex,y : lda.b LinkPosY,x : and.w #$fe00 : pha
|
||||
lda.b LinkPosY,x : and.w #$01ff : pha ;s1 = relative cur, s3 = ow cur
|
||||
lda.b Scrap06 : and #$fe00 : !sub.b 3,s : pha ;set coord, s1 = ow diff, s3 = relative cur, s5 = ow cur
|
||||
lda.b Scrap06 : and.w #$01ff : !sub.b 3,s : pha ;s1 = rel diff, s3 = ow diff, s5 = relative cur, s7 = ow cur
|
||||
lda.b Scrap06 : and.w #$fe00 : !SUB.b 3,s : pha ;set coord, s1 = ow diff, s3 = relative cur, s5 = ow cur
|
||||
lda.b Scrap06 : and.w #$01ff : !SUB.b 3,s : pha ;s1 = rel diff, s3 = ow diff, s5 = relative cur, s7 = ow cur
|
||||
lda.b Scrap06 : sta.b LinkPosY,x : and.w #$fe00 : sta.b Scrap06 ;set coord
|
||||
ldx.w OWBGIndex,y : lda.b BG2H,x : !add.b 1,s : adc.b 3,s : sta.b BG2H,x
|
||||
ldx.w OWCameraIndex,y : lda.w CameraScrollN,x : !add.b 1,s : adc.b 3,s : sta.w CameraScrollN,x
|
||||
ldx.w OWCameraIndex,y : lda.w CameraScrollS,x : !add.b 1,s : adc.b 3,s : sta.w CameraScrollS,x
|
||||
ldx.w OWBGIndex,y : lda.b BG2H,x : !ADD.b 1,s : adc.b 3,s : sta.b BG2H,x
|
||||
ldx.w OWCameraIndex,y : lda.w CameraScrollN,x : !ADD.b 1,s : adc.b 3,s : sta.w CameraScrollN,x
|
||||
ldx.w OWCameraIndex,y : lda.w CameraScrollS,x : !ADD.b 1,s : adc.b 3,s : sta.w CameraScrollS,x
|
||||
pla : jsl DivideByTwoPreserveSign : pha
|
||||
ldx.w OWBGIndex,y : lda.b BG1H,x : !add.b 1,s : sta.b BG1H,x : pla
|
||||
ldx.w OWBGIndex,y : lda.b BG1H,x : !add.b 1,s : sta.b BG1H,x : pla
|
||||
ldx.w OWBGIndex,y : lda.b BG1H,x : !ADD.b 1,s : sta.b BG1H,x : pla
|
||||
ldx.w OWBGIndex,y : lda.b BG1H,x : !ADD.b 1,s : sta.b BG1H,x : pla
|
||||
pla : pla
|
||||
|
||||
;fix camera unlock
|
||||
lda.b BG2H,x : !sub.b Scrap06 : bpl +
|
||||
lda.b BG2H,x : !SUB.b Scrap06 : bpl +
|
||||
pha : lda.b Scrap06 : sta.b BG2H,x
|
||||
ldx.w OWCameraIndex,y : lda.w CameraScrollN,x : !sub.b 1,s : sta.w CameraScrollN,x
|
||||
lda.w CameraScrollS,x : !sub.b 1,s : sta.w CameraScrollS,x : pla
|
||||
ldx.w OWCameraIndex,y : lda.w CameraScrollN,x : !SUB.b 1,s : sta.w CameraScrollN,x
|
||||
lda.w CameraScrollS,x : !SUB.b 1,s : sta.w CameraScrollS,x : pla
|
||||
bra .adjustOppositeAxis
|
||||
+ lda.b Scrap06 : ldx.w OWCameraRangeIndex,y : !add.w OWCameraRange,x : sta.b Scrap06
|
||||
ldx.w OWBGIndex,y : !sub.b BG2H,x : bcs .adjustOppositeAxis
|
||||
+ lda.b Scrap06 : ldx.w OWCameraRangeIndex,y : !ADD.w OWCameraRange,x : sta.b Scrap06
|
||||
ldx.w OWBGIndex,y : !SUB.b BG2H,x : bcs .adjustOppositeAxis
|
||||
pha : lda.b Scrap06 : sta.b BG2H,x
|
||||
ldx.w OWCameraIndex,y : lda.w CameraScrollN,x : !add.b 1,s : sta.w CameraScrollN,x
|
||||
lda.w CameraScrollS,x : !add.b 1,s : sta.w CameraScrollS,x : pla
|
||||
ldx.w OWCameraIndex,y : lda.w CameraScrollN,x : !ADD.b 1,s : sta.w CameraScrollN,x
|
||||
lda.w CameraScrollS,x : !ADD.b 1,s : sta.w CameraScrollS,x : pla
|
||||
|
||||
.adjustOppositeAxis
|
||||
;opposite coord stuff
|
||||
rep #$30 : lda OWOppDirectionOffset,y : and.w #$00ff : bit.w #$0080 : beq +
|
||||
rep #$30 : lda.w OWOppDirectionOffset,y : and.w #$00ff : bit.w #$0080 : beq +
|
||||
ora.w #$ff00 ;extend 8-bit negative to 16-bit negative
|
||||
+ pha : cpy.w #$0002 : lda.w OverworldSlotPosition : !bge +
|
||||
and.w #$00f0 : pha : lda.b Scrap04 : asl : and.w #$0070 : !sub.b 1,s : tax : pla : txa
|
||||
!add 1,s : tax : pla : txa : asl : asl : asl : asl : asl : pha : bra ++
|
||||
+ and.w #$000f : pha : lda.b Scrap04 : asl : and.w #$000f : !sub.b 1,s : !add.b 3,s
|
||||
+ pha : cpy.w #$0002 : lda.w OverworldSlotPosition : !BGE +
|
||||
and.w #$00f0 : pha : lda.b Scrap04 : asl : and.w #$0070 : !SUB.b 1,s : tax : pla : txa
|
||||
!ADD.b 1,s : tax : pla : txa : asl : asl : asl : asl : asl : pha : bra ++
|
||||
+ and.w #$000f : pha : lda.b Scrap04 : asl : and.w #$000f : !SUB.b 1,s : !ADD.b 3,s
|
||||
sep #$10 : tax : phx : ldx.b #$0 : phx : rep #$10 : pla : plx : plx : pha
|
||||
|
||||
++ sep #$10 : ldx OWOppCoordIndex,y : lda.b LinkPosY,x : !add.b 1,s : sta.b LinkPosY,x ;set coord
|
||||
ldx OWOppBGIndex,y : lda.b BG2H,x : !add.b 1,s : sta.b BG2H,x
|
||||
ldx OWOppCameraIndex,y : lda.w CameraScrollN,x : !add.b 1,s : sta.w CameraScrollN,x
|
||||
ldx OWOppCameraIndex,y : lda.w CameraScrollS,x : !add.b 1,s : sta.w CameraScrollS,x
|
||||
ldx OWOppBGIndex,y : lda.b BG1H,x : !add.b 1,s : sta.b BG1H,x
|
||||
lda.w TransitionDirection : asl : tax : lda.w CameraTargetN,x : !add.b 1,s : sta.w CameraTargetN,x : pla
|
||||
++ sep #$10 : ldx.w OWOppCoordIndex,y : lda.b LinkPosY,x : !ADD.b 1,s : sta.b LinkPosY,x ;set coord
|
||||
ldx.w OWOppBGIndex,y : lda.b BG2H,x : !ADD.b 1,s : sta.b BG2H,x
|
||||
ldx.w OWOppCameraIndex,y : lda.w CameraScrollN,x : !ADD.b 1,s : sta.w CameraScrollN,x
|
||||
ldx.w OWOppCameraIndex,y : lda.w CameraScrollS,x : !ADD.b 1,s : sta.w CameraScrollS,x
|
||||
ldx.w OWOppBGIndex,y : lda.b BG1H,x : !ADD.b 1,s : sta.b BG1H,x
|
||||
lda.w TransitionDirection : asl : tax : lda.w CameraTargetN,x : !ADD.b 1,s : sta.w CameraTargetN,x : pla
|
||||
|
||||
sep #$30 : lda.b Scrap04 : and.b #$3f : !add OWOppSlotOffset,y : asl : sta.w OverworldSlotPosition
|
||||
sep #$30 : lda.b Scrap04 : and.b #$3f : !ADD.w OWOppSlotOffset,y : asl : sta.w OverworldSlotPosition
|
||||
|
||||
; crossed OW shuffle and terrain
|
||||
ldx.b Scrap05 : ldy.b Scrap08 : jsr OWWorldTerrainUpdate
|
||||
|
||||
Reference in New Issue
Block a user