New baserom

Asar compatibility
Potential SRAM fix
This commit is contained in:
aerinon
2020-06-12 16:01:11 -06:00
parent 6f94ca5bee
commit a51820e2cf
13 changed files with 95 additions and 67 deletions

View File

@@ -819,7 +819,7 @@ class CollectionState(object):
del (self.prog_items[to_remove, item.player]) del (self.prog_items[to_remove, item.player])
# invalidate caches, nothing can be trusted anymore now # invalidate caches, nothing can be trusted anymore now
self.reachable_regions[item.player] = dict() self.reachable_regions[item.player] = dict()
self.blocked_connections[item.player] = set() self.blocked_connections[item.player] = dict()
self.stale[item.player] = True self.stale[item.player] = True
def __getattr__(self, item): def __getattr__(self, item):

View File

@@ -1304,8 +1304,8 @@ class DROptions(Flag):
Debug = 0x08 Debug = 0x08
Open_Desert_Wall = 0x80 # If on, pre opens the desert wall, no fire required Open_Desert_Wall = 0x80 # If on, pre opens the desert wall, no fire required
# DATA GOES DOWN HERE
# DATA GOES DOWN HERE
logical_connections = [ logical_connections = [
('Hyrule Dungeon North Abyss Catwalk Dropdown', 'Hyrule Dungeon North Abyss'), ('Hyrule Dungeon North Abyss Catwalk Dropdown', 'Hyrule Dungeon North Abyss'),
('Hyrule Castle Throne Room Tapestry', 'Hyrule Castle Behind Tapestry'), ('Hyrule Castle Throne Room Tapestry', 'Hyrule Castle Behind Tapestry'),

View File

@@ -24,7 +24,7 @@ from Fill import distribute_items_cutoff, distribute_items_staleness, distribute
from ItemList import generate_itempool, difficulties, fill_prizes from ItemList import generate_itempool, difficulties, fill_prizes
from Utils import output_path, parse_player_names from Utils import output_path, parse_player_names
__version__ = '0.1.0.7-u' __version__ = '0.1.0.8-u'
class EnemizerError(RuntimeError): class EnemizerError(RuntimeError):
pass pass

6
Rom.py
View File

@@ -22,7 +22,7 @@ from EntranceShuffle import door_addresses, exit_ids
JAP10HASH = '03a63945398191337e896e5771f77173' JAP10HASH = '03a63945398191337e896e5771f77173'
RANDOMIZERBASEHASH = 'd8639f33e6b5621f139cb6abbc641af1' RANDOMIZERBASEHASH = 'b2badac693edd0880357f5a75a3e60d7'
class JsonRom(object): class JsonRom(object):
@@ -595,7 +595,7 @@ def patch_rom(world, rom, player, team, enemized):
patch_shuffled_dark_sanc(world, rom, player) patch_shuffled_dark_sanc(world, rom, player)
# setup dr option flags based on experimental, etc. # setup dr option flags based on experimental, etc.
dr_flags = DROptions.Eternal_Mini_Bosses if world.doorShuffle[player] == 'vanilla' else DROptions.Town_Portal dr_flags = DROptions.Eternal_Mini_Bosses if world.doorShuffle[player] == 'vanilla' else DROptions.Town_Portal
if world.experimental[player]: if world.experimental[player]:
dr_flags |= DROptions.Map_Info dr_flags |= DROptions.Map_Info
dr_flags |= DROptions.Debug dr_flags |= DROptions.Debug
@@ -2137,7 +2137,7 @@ def patch_shuffled_dark_sanc(world, rom, player):
# 24B116 and 20BAD8 # 24B116 and 20BAD8
compass_r_addr = 0x123116 # a9 90 24 8f 9a c7 7e compass_r_addr = 0x123116 # a9 90 24 8f 9a c7 7e
compass_w_addr = 0x103ad8 # e2 20 ad 0c 04 c9 00 d0 compass_w_addr = 0x103af6 # e2 20 ad 0c 04 c9 00 d0
def compass_code_good(rom): def compass_code_good(rom):

View File

@@ -184,4 +184,19 @@ $a2 - MM 162 idx 0
$a8 - EP 168 idx 2 $a8 - EP 168 idx 2
$bc - TT 188 idx 1 $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

View File

@@ -29,6 +29,11 @@ jsl RecordStairType : nop
org $02a1e7 ;(PC: 121e7) org $02a1e7 ;(PC: 121e7)
jsl SpiralWarp 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) org $029369 ; <- 11369 - Bank02.asm : 3610 (STX $0464 : STY $012E)
jsl StraightStairsAdj : nop #2 jsl StraightStairsAdj : nop #2
org $029383 ; <- 11384 - Bank02.asm : 3629 (.walkingDownStaircase-> ADD $20 : STA $20) org $029383 ; <- 11384 - Bank02.asm : 3629 (.walkingDownStaircase-> ADD $20 : STA $20)
@@ -116,7 +121,8 @@ nop #3
.next .next
; also rando's hooks.asm line 1360 ; 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 jsl DrHudOverride
org $098638 ; rando's hooks.asm line 2192 org $098638 ; rando's hooks.asm line 2192
jsl CountChestKeys jsl CountChestKeys

View File

@@ -1,6 +1,6 @@
GfxFixer: GfxFixer:
{ {
lda DRMode : bne + lda.l DRMode : bne +
jsl LoadRoomHook ;this is the code we overwrote jsl LoadRoomHook ;this is the code we overwrote
jsl Dungeon_InitStarTileCh jsl Dungeon_InitStarTileCh
jsl LoadTransAuxGfx_Alt jsl LoadTransAuxGfx_Alt
@@ -12,8 +12,8 @@ GfxFixer:
jsl LoadTransAuxGfx jsl LoadTransAuxGfx
jsl Dungeon_LoadCustomTileAttr jsl Dungeon_LoadCustomTileAttr
jsl PrepTransAuxGfx jsl PrepTransAuxGfx
lda DRMode : cmp #$02 : bne + ; only do this in crossed mode lda.l DRMode : cmp #$02 : bne + ; only do this in crossed mode
ldx $a0 : lda TilesetTable, x ldx $a0 : lda.l TilesetTable, x
cmp $0aa1 : beq + ; already eq no need to decomp cmp $0aa1 : beq + ; already eq no need to decomp
sta $0aa1 sta $0aa1
tax : lda $02802e, x : tay tax : lda $02802e, x : tay

View File

@@ -7,7 +7,7 @@ DrHudOverride:
HudAdditions: HudAdditions:
{ {
lda DRFlags : and #$0008 : beq ++ lda.l DRFlags : and #$0008 : beq ++
lda $7EF423 : and #$00ff lda $7EF423 : and #$00ff
jsr HudHexToDec4DigitCopy jsr HudHexToDec4DigitCopy
LDX.b $05 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+10 ; draw 100's digit 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 : + ldx $040c : cpx #$ff : bne + : rts : +
lda DRMode : bne + : rts : + lda.l DRMode : bne + : rts : +
phb : phk : plb phb : phk : plb
lda $7ef364 : and.l $0098c0, x : beq + 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 $1a : and #$0010 : beq +
lda #$345e : sta $7ec790 : bra .next lda #$345e : sta $7ec790 : bra .next
+ lda #$207f : sta $7ec790 + 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 $7ef36d : and #$00ff : beq +
lda DungeonReminderTable, x : bra .reminder lda.w DungeonReminderTable, x : bra .reminder
+ lda #$207f + lda #$207f
.reminder sta $7ec702 .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 $7ef368 : and.l $0098c0, x : beq .restore
lda #$2811 : sta $7ec740 lda #$2811 : sta $7ec740
lda $7ef366 : and.l $0098c0, x : bne .check 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 ++ lda #$2574 : bra ++
+ cmp #$0002 : bne + + cmp #$0002 : bne +
lda #$2420 : bra ++ lda #$2420 : bra ++
@@ -49,10 +49,10 @@ HudAdditions:
lda $7ef4e0, x : jsr ConvertToDisplay : sta $7ec7a2 lda $7ef4e0, x : jsr ConvertToDisplay : sta $7ec7a2
lda #$2830 : sta $7ec7a4 lda #$2830 : sta $7ec7a4
lda ChestKeys, x : jsr ConvertToDisplay : sta $7ec7a6 lda.w ChestKeys, x : jsr ConvertToDisplay : sta $7ec7a6
lda #$2871 : sta $7ec780 lda #$2871 : sta $7ec780
lda TotalKeys, x lda.w TotalKeys, x
sep #$20 : !sub $7ef4b0, x : rep #$20 sep #$20 : !sub $7ef4b0, x : rep #$20
jsr ConvertToDisplay : sta $7ec782 jsr ConvertToDisplay : sta $7ec782

View File

@@ -12,7 +12,7 @@
CheckIfDoorsOpen: { CheckIfDoorsOpen: {
jsr TrapDoorFixer ; see normal.asm jsr TrapDoorFixer ; see normal.asm
; note we are 16bit mode right now ; note we are 16bit mode right now
lda DRMode : beq + lda.l DRMode : beq +
lda $040c : cmp #$00ff : bne .gtg lda $040c : cmp #$00ff : bne .gtg
+ lda $a0 : dec : tax : and #$000f ; hijacked code + lda $a0 : dec : tax : and #$000f ; hijacked code
sec : rtl ; set carry to indicate normal behavior sec : rtl ; set carry to indicate normal behavior
@@ -22,9 +22,9 @@ CheckIfDoorsOpen: {
stx $00 : ldy #$0000 stx $00 : ldy #$0000
.nextDoor .nextDoor
lda $a0 : asl : tax lda $a0 : asl : tax
lda KeyDoorOffset, x : beq .skipDoor lda.w KeyDoorOffset, x : beq .skipDoor
asl : sty $05 : !add $05 : tax asl : sty $05 : !add $05 : tax
lda PairedDoorTable, x : beq .skipDoor lda.w PairedDoorTable, x : beq .skipDoor
sta $02 : and #$00ff : asl a : tax sta $02 : and #$00ff : asl a : tax
lda $02 : and #$ff00 : sta $03 lda $02 : and #$ff00 : sta $03
lda $7ef000, x : and #$f000 : and $03 : beq .skipDoor lda $7ef000, x : and #$f000 : and $03 : beq .skipDoor

View File

@@ -1,5 +1,5 @@
WarpLeft: WarpLeft:
lda DRMode : beq .end lda.l DRMode : beq .end
lda $040c : cmp.b #$ff : beq .end lda $040c : cmp.b #$ff : beq .end
lda $20 : ldx $aa lda $20 : ldx $aa
jsr CalcIndex jsr CalcIndex
@@ -10,7 +10,7 @@ WarpLeft:
rtl rtl
WarpRight: WarpRight:
lda DRMode : beq .end lda.l DRMode : beq .end
lda $040c : cmp.b #$ff : beq .end lda $040c : cmp.b #$ff : beq .end
lda $20 : ldx $aa lda $20 : ldx $aa
jsr CalcIndex jsr CalcIndex
@@ -21,7 +21,7 @@ WarpRight:
rtl rtl
WarpUp: WarpUp:
lda DRMode : beq .end lda.l DRMode : beq .end
lda $040c : cmp.b #$ff : beq .end lda $040c : cmp.b #$ff : beq .end
lda $22 : ldx $a9 lda $22 : ldx $a9
jsr CalcIndex jsr CalcIndex
@@ -32,7 +32,7 @@ WarpUp:
rtl rtl
WarpDown: WarpDown:
lda DRMode : beq .end lda.l DRMode : beq .end
lda $040c : cmp.b #$ff : beq .end lda $040c : cmp.b #$ff : beq .end
lda $22 : ldx $a9 lda $22 : ldx $a9
jsr CalcIndex jsr CalcIndex
@@ -45,13 +45,13 @@ WarpDown:
; carry set = use link door like normal ; carry set = use link door like normal
; carry clear = we are in dr mode, never use linking doors ; carry clear = we are in dr mode, never use linking doors
CheckLinkDoorR: CheckLinkDoorR:
lda DRMode : bne + lda.l DRMode : bne +
lda $7ec004 : sta $a0 ; what we wrote over lda $7ec004 : sta $a0 ; what we wrote over
sec : rtl sec : rtl
+ clc : rtl + clc : rtl
CheckLinkDoorL: CheckLinkDoorL:
lda DRMode : bne + lda.l DRMode : bne +
lda $7ec003 : sta $a0 ; what we wrote over lda $7ec003 : sta $a0 ; what we wrote over
sec : rtl sec : rtl
+ clc : 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) rep #$30 : and #$00FF ;sanitize A reg (who knows what is in the high byte)
sta $00 ; offset in 00 sta $00 ; offset in 00
lda $a2 : tax ; probably okay loading $a3 in the high byte 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) 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 !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 and #$00FF : sta $a0 ; assign new room
sep #$30 sep #$30
rts rts
@@ -168,11 +168,11 @@ LookupNewRoom: ; expects data offset to be in A
; Sets high bytes of various registers ; Sets high bytes of various registers
ShiftVariablesMainDir: ShiftVariablesMainDir:
{ {
lda CoordIndex,y : tax lda.w CoordIndex,y : tax
lda $21,x : !add $02 : sta $21,x ; coordinate update 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 $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 $0605,x : !add $02 : sta $0605,x ; high bytes of these guys
lda $0607,x : !add $02 : sta $0607,x lda $0607,x : !add $02 : sta $0607,x
lda $0601,x : !add $02 : sta $0601,x lda $0601,x : !add $02 : sta $0601,x
@@ -210,13 +210,13 @@ PrepScrollToNormal:
StraightStairsAdj: StraightStairsAdj:
{ {
stx $0464 : sty $012e ; what we wrote over stx $0464 : sty $012e ; what we wrote over
lda DRMode : beq + lda.l DRMode : beq +
jsr GetTileAttribute : tax jsr GetTileAttribute : tax
lda $11 : cmp #$12 : beq .goingNorth lda $11 : cmp #$12 : beq .goingNorth
lda $a2 : cmp #$51 : bne ++ lda $a2 : cmp #$51 : bne ++
rep #$20 : lda #$0018 : !add $20 : sta $20 : sep #$20 ; special fix for throne room rep #$20 : lda #$0018 : !add $20 : sta $20 : sep #$20 ; special fix for throne room
jsr GetTileAttribute : tax jsr GetTileAttribute : tax
++ lda StepAdjustmentDown, X : bra .end ++ lda.l StepAdjustmentDown, X : bra .end
; lda $ee : beq .end ; lda $ee : beq .end
; rep #$20 : lda #$ffe0 : !add $20 : sta $20 : sep #$20 ; rep #$20 : lda #$ffe0 : !add $20 : sta $20 : sep #$20
.goingNorth .goingNorth
@@ -225,7 +225,7 @@ StraightStairsAdj:
lda #$36 : bra .end ; special fix for throne room lda #$36 : bra .end ; special fix for throne room
++ ldy $ee : cpy #$00 : beq ++ ++ ldy $ee : cpy #$00 : beq ++
inx inx
++ lda StepAdjustmentUp, X ++ lda.l StepAdjustmentUp, X
.end .end
pha : lda $0462 : and #$04 : bne ++ pha : lda $0462 : and #$04 : bne ++
pla : !add #$f6 : pha pla : !add #$f6 : pha
@@ -255,14 +255,14 @@ db $d0, $f6, $10, $1a, $f0, $00
StraightStairsFix: StraightStairsFix:
{ {
lda DRMode : bne + lda.l DRMode : bne +
!add $20 : sta $20 ;what we wrote over !add $20 : sta $20 ;what we wrote over
+ rtl + rtl
} }
StraightStairLayerFix: StraightStairLayerFix:
{ {
lda DRMode : beq + lda.l DRMode : beq +
lda $ee : rtl lda $ee : rtl
+ lda $01c322, x : rtl ; what we wrote over + lda $01c322, x : rtl ; what we wrote over
} }
@@ -270,7 +270,7 @@ StraightStairLayerFix:
DoorToStraight: DoorToStraight:
{ {
pha pha
lda DRMode : beq .skip lda.l DRMode : beq .skip
pla : bne .end pla : bne .end
pha pha
lda $a0 : cmp #$51 : bne .skip lda $a0 : cmp #$51 : bne .skip

View File

@@ -26,7 +26,7 @@ GtBossHeartCheckOverride:
lda $a0 : cmp #$1c : beq ++ lda $a0 : cmp #$1c : beq ++
cmp #$6c : beq ++ cmp #$6c : beq ++
cmp #$4d : bne + 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 lda $403 : ora #$80 : sta $403
++ clc ++ clc
rtl rtl
@@ -35,19 +35,19 @@ rtl
OnFileLoadOverride: OnFileLoadOverride:
jsl OnFileLoad ; what I wrote over 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 $7ef086 : ora #$80 : sta $7ef086
+ lda DRFlags : and #$02 : beq + + lda.l DRFlags : and #$02 : beq +
lda $7ef353 : bne + lda $7ef353 : bne +
lda #$01 : sta $7ef353 lda #$01 : sta $7ef353
+ rtl + rtl
MirrorCheckOverride: MirrorCheckOverride:
lda DRFlags : and #$02 : beq ++ lda.l DRFlags : and #$02 : beq ++
lda $7ef353 : cmp #$01 : beq + lda $7ef353 : cmp #$01 : beq +
++ lda $8A : and #$40 ; what I wrote over ++ lda $8A : and #$40 ; what I wrote over
rtl rtl
+ lda DRScroll : rtl + lda.l DRScroll : rtl
MirrorCheckOverride2: MirrorCheckOverride2:
lda $7ef353 : and #$02 : rtl lda $7ef353 : and #$02 : rtl
@@ -64,7 +64,7 @@ FixShopCode:
+ rtl + rtl
VitreousKeyReset: VitreousKeyReset:
lda DRMode : beq + lda.l DRMode : beq +
stz $0cba, x stz $0cba, x
+ jsl $0db818 ;restore old code + jsl $0db818 ;restore old code
rtl rtl

View File

@@ -1,6 +1,6 @@
RecordStairType: { RecordStairType: {
pha pha
lda DRMode : beq .norm lda.l DRMode : beq .norm
lda $040c : cmp #$ff : beq .norm lda $040c : cmp #$ff : beq .norm
lda $0e : sta $045e lda $0e : sta $045e
cmp #$26 : beq .norm ; skipping in-floor staircases cmp #$26 : beq .norm ; skipping in-floor staircases
@@ -11,7 +11,7 @@ RecordStairType: {
} }
SpiralWarp: { 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 $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! lda $045e : cmp #$5e : beq .gtg ; abort if not spiral - intended room is in A!
cmp #$5f : beq .gtg cmp #$5f : beq .gtg
@@ -22,8 +22,8 @@ SpiralWarp: {
phb : phk : plb : phx : phy ; push stuff phb : phk : plb : phx : phy ; push stuff
jsr LookupSpiralOffset jsr LookupSpiralOffset
rep #$30 : and #$00FF : asl #2 : tax rep #$30 : and #$00FF : asl #2 : tax
lda SpiralTable, x : sta $00 lda.w SpiralTable, x : sta $00
lda SpiralTable+2, x : sta $02 lda.w SpiralTable+2, x : sta $02
sep #$30 sep #$30
lda $00 : sta $a0 lda $00 : sta $a0
; shift quadrant if necessary ; shift quadrant if necessary
@@ -73,8 +73,8 @@ SpiralWarp: {
stz $045e ; clear the staircase flag stz $045e ; clear the staircase flag
; animated tiles fix ; animated tiles fix
lda DRMode : cmp #$02 : bne + ; only do this in crossed mode lda.l DRMode : cmp #$02 : bne + ; only do this in crossed mode
ldx $a0 : lda TilesetTable, x ldx $a0 : lda.l TilesetTable, x
cmp $0aa1 : beq + ; already eq no need to decomp cmp $0aa1 : beq + ; already eq no need to decomp
sta $0aa1 sta $0aa1
tax : lda $02802e, x : tay tax : lda $02802e, x : tay
@@ -133,17 +133,17 @@ LookupSpiralOffset: {
lda #$02 : sta $01 ; always 2 lda #$02 : sta $01 ; always 2
.done .done
lda $a2 : tax : lda SpiralOffset,x lda $a2 : tax : lda.w SpiralOffset,x
!add $01 ;add a thing (0 in easy case) !add $01 ;add a thing (0 in easy case)
rts rts
} }
ShiftQuadSimple: { ShiftQuadSimple: {
lda CoordIndex,y : tax lda.w CoordIndex,y : tax
lda $20,x : beq .skip lda $20,x : beq .skip
lda $21,x : !add $06 : sta $21,x ; coordinate update lda $21,x : !add $06 : sta $21,x ; coordinate update
.skip .skip
lda CamQuadIndex,y : tax lda.w CamQuadIndex,y : tax
lda $0601,x : !add $06 : sta $0601,x lda $0601,x : !add $06 : sta $0601,x
lda $0605,x : !add $06 : sta $0605,x ; high bytes of these guys lda $0605,x : !add $06 : sta $0605,x ; high bytes of these guys
rts rts
@@ -152,13 +152,13 @@ ShiftQuadSimple: {
SetCamera: { SetCamera: {
stz $04 stz $04
tyx : lda $a9,x : bne .nonZeroHalf tyx : lda $a9,x : bne .nonZeroHalf
lda CamQuadIndex,y : tax : lda $607,x : pha lda.w CamQuadIndex,y : tax : lda $607,x : pha
lda CameraIndex,y : tax : pla : cmp $e3, x : bne .noQuadAdj lda.w CameraIndex,y : tax : pla : cmp $e3, x : bne .noQuadAdj
dec $e3,x dec $e3,x
.noQuadAdj .noQuadAdj
lda $07 : bne .adj0 lda $07 : bne .adj0
lda CoordIndex,y : tax lda.w CoordIndex,y : tax
lda $20,x : beq .oddQuad lda $20,x : beq .oddQuad
cmp #$79 : bcc .adj0 cmp #$79 : bcc .adj0
!sub #$78 : sta $04 !sub #$78 : sta $04
@@ -170,21 +170,21 @@ SetCamera: {
.nonZeroHalf ;meaning either right half or bottom half .nonZeroHalf ;meaning either right half or bottom half
lda $07 : bne .setQuad lda $07 : bne .setQuad
lda CoordIndex,y : tax lda.w CoordIndex,y : tax
lda $20,x : cmp #$78 : bcs .setQuad lda $20,x : cmp #$78 : bcs .setQuad
!add #$78 : sta $04 !add #$78 : sta $04
lda CamQuadIndex,y : tax : lda $0603, x : pha lda.w CamQuadIndex,y : tax : lda $0603, x : pha
lda CameraIndex,y : tax : pla : sta $e3, x lda.w CameraIndex,y : tax : pla : sta $e3, x
.adj1 .adj1
tya : asl : !add #$08 : tax : jsr AdjCamBounds : bra .done tya : asl : !add #$08 : tax : jsr AdjCamBounds : bra .done
.setQuad .setQuad
lda CamQuadIndex,y : tax : lda $0607, x : pha lda.w CamQuadIndex,y : tax : lda $0607, x : pha
lda CameraIndex,y : tax : pla : sta $e3, x lda.w CameraIndex,y : tax : pla : sta $e3, x
tya : asl : !add #$0c : tax : jsr AdjCamBounds : bra .done tya : asl : !add #$0c : tax : jsr AdjCamBounds : bra .done
.done .done
lda CameraIndex,y : tax lda.w CameraIndex,y : tax
lda $04 : sta $e2, x lda $04 : sta $e2, x
rts rts
} }
@@ -192,13 +192,20 @@ SetCamera: {
; input, expects X to be an appropriate offset into the CamBoundBaseLine table ; input, expects X to be an appropriate offset into the CamBoundBaseLine table
; when $04 is 0 no coordinate are added ; when $04 is 0 no coordinate are added
AdjCamBounds: { AdjCamBounds: {
rep #$20 : lda CamBoundBaseLine, x : sta $05 rep #$20 : lda.w CamBoundBaseLine, x : sta $05
lda $04 : and #$00ff : beq .common lda $04 : and #$00ff : beq .common
lda CoordIndex,y : tax lda.w CoordIndex,y : tax
lda $20, x : and #$00ff : !add $05 : sta $05 lda $20, x : and #$00ff : !add $05 : sta $05
.common .common
lda OppCamBoundIndex,y : tax lda.w OppCamBoundIndex,y : tax
lda $05 : sta $0618, x lda $05 : sta $0618, x
inc #2 : sta $061A, x : sep #$20 inc #2 : sta $061A, x : sep #$20
rts 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
} }

File diff suppressed because one or more lines are too long