diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index 802931a..ed72c05 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -26,7 +26,7 @@ org $3FFFFF ; <- 1FFFFF db #$00 ; expand file to 2mb org $1FFFF8 ; <- FFFF8 timestamp rom -db #$20, #$18, #$01, #$18 ; year/month/day +db #$20, #$18, #$01, #$19 ; year/month/day ;================================================================================ @@ -62,6 +62,8 @@ db #$20, #$18, #$01, #$18 ; year/month/day !REDRAW = "$7F5000" !GANON_WARP_CHAIN = "$7F5032"; +!TILE_UPLOAD_BUFFER = "$7EA180"; + !FORCE_HEART_SPAWN = "$7F5033"; !SKIP_HEART_SAVE = "$7F5034"; diff --git a/bugfixes.asm b/bugfixes.asm index db6c2c9..c5fbf59 100644 --- a/bugfixes.asm +++ b/bugfixes.asm @@ -35,4 +35,11 @@ DecideIfBunny: LDA $7EF357 : BEQ + : RTL : + LDA $7EF3CA : AND.b #$40 : EOR #$40 RTL +;-------------------------------------------------------------------------------- + +;-------------------------------------------------------------------------------- +;ReadInventoryPond: +; CPX.b #$1B : BNE + : LDA.b #$01 : RTL : + +; LDA $7EF340, X +;RTL ;-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/hooks.asm b/hooks.asm index 06766c2..b06d10d 100644 --- a/hooks.asm +++ b/hooks.asm @@ -342,6 +342,11 @@ PyramidFairy_BRANCH_IOTA: org $06C948 ; <- 34948 - sprite_ponds.asm : 961 PyramidFairy_BRANCH_GAMMA: ;-------------------------------------------------------------------------------- +;org $0EF7BD ; <- 777BD - sprite_ponds.asm : 1890 (LDA $7EF340, X : BMI .invalidValue : BNE VWF_ChangeItemTiles) +;JSL.l ReadInventoryPond +;org $0EF7E4 ; <- 777E4 - sprite_ponds.asm : 1922 (LDA $7EF340, X : BMI .invalidValue : BNE VWF_ChangeItemTiles) +;JSL.l ReadInventoryPond +;-------------------------------------------------------------------------------- org $1EE16E ; <- F616E - sprite_bomb_shop_entity.asm : 73 NOP #8 ; fix bomb shop dialog for dwarfless big bomb org $068A14 ; <- 30A14 - sprite_prep.asm : 716 @@ -472,6 +477,9 @@ LDA.w BottleListExpanded, X org $09895C ; 4895C - ancilla_init.asm:1344 (LDA PotionList, X) LDA.w PotionListExpanded, X ;-------------------------------------------------------------------------------- +org $098A36 ; <- 48A36 - ancilla_init.asm:1432 (LDA AddReceiveItem.item_graphics_indices, Y : STA $72) +LDA AddReceivedItemExpanded_item_graphics_indices, Y +;-------------------------------------------------------------------------------- org $06D1EB ; 351EB - sprite_absorbable.asm:364 (STA $7EF375) ; bugbug commented out until i figure out why it doesn't work JSL HandleBombAbsorbtion ;-------------------------------------------------------------------------------- @@ -1042,11 +1050,14 @@ JSL.l GetMagicBatItem ;================================================================================ ; Replacement Shopkeeper ;-------------------------------------------------------------------------------- -;org $068BEB ; <- 30BEB - Bank07.asm:1125 - (INC $0BA0, X) -;JSL.l SpritePrep_ShopKeeper : RTS +org $068BEB ; <- 30BEB - Bank07.asm:1125 - (INC $0BA0, X) +JSL.l SpritePrep_ShopKeeper : RTS ;-------------------------------------------------------------------------------- -;org $1EEEE3 ; <- F6EE3 - sprite_shopkeeper.asm:7 - (LDA $0E80, X) -;JSL.l Sprite_ShopKeeper : RTS +org $1EEEE3 ; <- F6EE3 - sprite_shopkeeper.asm:7 - (LDA $0E80, X) +JSL.l Sprite_ShopKeeper : RTS +;-------------------------------------------------------------------------------- +org $00D55E ; <- 555E - Bank00.asm:3491 (LDX.w #$2D40) +JSL.l LoadModifiedTileBufferAddress : NOP #2 ;-------------------------------------------------------------------------------- ;================================================================================ diff --git a/shopkeeper.asm b/shopkeeper.asm index d18469f..f51ba1c 100644 --- a/shopkeeper.asm +++ b/shopkeeper.asm @@ -129,18 +129,93 @@ dw $0230, $0231, $0202, $0203, $0212, $0213, $0222, $0223, $0232, $0233 .digit_offsets dw 4, 0, -4, -8 ;-------------------------------------------------------------------------------- +!TILE_UPLOAD_OFFSET_OVERRIDE = "$7F5042" +!FREE_TILE_BUFFER = "#$1180" SpritePrep_ShopKeeper: - - ;LDA.b #$AF ; Generic small key - LDA.b #$4F ; 1/4 magic - ;%UploadOAM(#$24) - JSR.w LoadDynamicTileOAMTable + REP #$20 ; set 16-bit accumulator + LDA.w !FREE_TILE_BUFFER : STA !TILE_UPLOAD_OFFSET_OVERRIDE + SEP #$20 ; set 8-bit accumulator + LDA.b #$32 ; item JSL.l GetSpriteID ; convert loot id to sprite id JSL.l GetAnimatedSpriteTile_variable - ;%UploadOAM(#$C2) - ;%UploadOAM(#$C4) + + + REP #$20 ; set 16-bit accumulator + LDA.w !FREE_TILE_BUFFER+$80 : STA !TILE_UPLOAD_OFFSET_OVERRIDE + SEP #$20 ; set 8-bit accumulator + LDA.b #$51 ; item + JSL.l GetSpriteID ; convert loot id to sprite id + JSL.l GetAnimatedSpriteTile_variable + + + REP #$20 ; set 16-bit accumulator + LDA.w !FREE_TILE_BUFFER+$100 : STA !TILE_UPLOAD_OFFSET_OVERRIDE + SEP #$20 ; set 8-bit accumulator + LDA.b #$6C ; item + JSL.l GetSpriteID ; convert loot id to sprite id + JSL.l GetAnimatedSpriteTile_variable + STA $FFFFFF + LDA #$80 : STA $2100 + JSR UploadVRAMTiles + LDA #$0F : STA $2100 RTL ;-------------------------------------------------------------------------------- +UploadVRAMTiles: + LDA $4300 : PHA ; preserve DMA parameters + LDA $4301 : PHA ; preserve DMA parameters + LDA $4302 : PHA ; preserve DMA parameters + LDA $4303 : PHA ; preserve DMA parameters + LDA $4304 : PHA ; preserve DMA parameters + LDA $4305 : PHA ; preserve DMA parameters + LDA $4306 : PHA ; preserve DMA parameters + ;-------------------------------------------------------------------------------- + LDA #$01 : STA $4300 ; set DMA transfer direction A -> B, bus A auto increment, double-byte mode + LDA #$18 : STA $4301 ; set bus B destination to VRAM register + LDA #$80 : STA $2115 ; set VRAM to increment by 2 on high register write + + LDA #$80 : STA $4302 ; set bus A source address to tile buffer + LDA #$A1 : STA $4303 + LDA #$7E : STA $4304 + + LDA #$40 : STA $4305 : STZ $4306 ; set transfer size to 0x40 + STZ $2116 ; set WRAM register source address + LDA #$5C : STA $2117 + LDA #$01 : STA $420B ; begin DMA transfer + + LDA #$40 : STA $4305 : STZ $4306 ; set transfer size to 0x40 + STZ $2116 ; set WRAM register source address + LDA #$5D : STA $2117 + LDA #$01 : STA $420B ; begin DMA transfer + + LDA #$40 : STA $4305 : STZ $4306 ; set transfer size to 0x40 + LDA #$20 : STA $2116 ; set WRAM register source address + LDA #$5C : STA $2117 + LDA #$01 : STA $420B ; begin DMA transfer + + LDA #$40 : STA $4305 : STZ $4306 ; set transfer size to 0x40 + LDA #$20 : STA $2116 ; set WRAM register source address + LDA #$5D : STA $2117 + LDA #$01 : STA $420B ; begin DMA transfer + + LDA #$40 : STA $4305 : STZ $4306 ; set transfer size to 0x40 + LDA #$40 : STA $2116 ; set WRAM register source address + LDA #$5C : STA $2117 + LDA #$01 : STA $420B ; begin DMA transfer + + LDA #$40 : STA $4305 : STZ $4306 ; set transfer size to 0x40 + LDA #$40 : STA $2116 ; set WRAM register source address + LDA #$5D : STA $2117 + LDA #$01 : STA $420B ; begin DMA transfer + ;-------------------------------------------------------------------------------- + PLA : STA $4306 ; restore DMA parameters + PLA : STA $4305 ; restore DMA parameters + PLA : STA $4304 ; restore DMA parameters + PLA : STA $4303 ; restore DMA parameters + PLA : STA $4302 ; restore DMA parameters + PLA : STA $4301 ; restore DMA parameters + PLA : STA $4300 ; restore DMA parameters +RTS +;-------------------------------------------------------------------------------- !COLUMN_LOW = "$7F5020" !COLUMN_HIGH = "$7F5021" Sprite_ShopKeeper: @@ -194,7 +269,7 @@ Sprite_ShopKeeper: LDA.b #$00 : STA !COLUMN_LOW LDA.b #$60 : STA !COLUMN_HIGH REP #$20 ; set 16-bit accumulator - LDA.w #1234 : STA $0C ; set value + LDA.w #80 : STA $0C ; set value LDA.w #-40 : STA $0E ; set coordinate JSR.w DrawPrice SEP #$20 : STA $06 ; set 8-bit accumulator & store result @@ -213,7 +288,7 @@ Sprite_ShopKeeper: LDA.b #$60 : STA !COLUMN_LOW LDA.b #$90 : STA !COLUMN_HIGH REP #$20 ; set 16-bit accumulator - LDA.w #5678 : STA $0C ; set value + LDA.w #100 : STA $0C ; set value LDA.w #8 : STA $0E ; set coordinate JSR.w DrawPrice SEP #$20 : STA $06 ; set 8-bit accumulator & store result @@ -232,7 +307,7 @@ Sprite_ShopKeeper: LDA.b #$90 : STA !COLUMN_LOW LDA.b #$FF : STA !COLUMN_HIGH REP #$20 ; set 16-bit accumulator - LDA.w #9012 : STA $0C ; set value + LDA.w #300 : STA $0C ; set value LDA.w #56 : STA $0E ; set coordinate JSR.w DrawPrice SEP #$20 : STA $06 ; set 8-bit accumulator & store result @@ -259,8 +334,8 @@ dw 0, 0 : db $10, $4C, $00, $02 ;-------------------------------------------------------------------------------- .oam_items dw -40, 40 : db $C0, $08, $00, $02 -dw 8, 40 : db $C2, $04, $00, $02 -dw 56, 40 : db $C4, $02, $00, $02 +dw 8, 40 : db $C2, $08, $00, $02 +dw 56, 40 : db $C4, $08, $00, $02 ;-------------------------------------------------------------------------------- .oam_prices dw -48, 56 : db $30, $02, $00, $00 diff --git a/tables.asm b/tables.asm index 3526799..045f65b 100644 --- a/tables.asm +++ b/tables.asm @@ -1267,7 +1267,10 @@ dw #9999 ; Rupee Limit ; $7F503E - Stats Item Total ; $7F503F - Bonk Repeat ; $7F5040 - Free Item Dialog Temporary -; $7F5041 - $7F507E - Unused +; $7F5041 - Unused +; $7F5042 - Tile Upload Offset Override (Low) +; $7F5043 - Tile Upload Offset Override (High) +; $7F5044 - $7F507E - Unused ; $7F507E - Clock Status ; $7F507F - Always Zero ; $7F5080 - $7F5083 - Clock Hours diff --git a/utilities.asm b/utilities.asm index 3b6a638..c78f4b3 100644 --- a/utilities.asm +++ b/utilities.asm @@ -459,6 +459,23 @@ DrawDynamicTileNoShadow: RTL ;-------------------------------------------------------------------------------- +;-------------------------------------------------------------------------------- +!TILE_UPLOAD_OFFSET_OVERRIDE = "$7F5042" +LoadModifiedTileBufferAddress: + PHA + LDA !TILE_UPLOAD_OFFSET_OVERRIDE : BEQ + + TAX + LDY.w #$0002 + LDA.w #$0000 : STA !TILE_UPLOAD_OFFSET_OVERRIDE + BRA .done + + + LDX.w #$2D40 + LDY.w #$0002 + .done + PLA +RTL +;-------------------------------------------------------------------------------- + ;-------------------------------------------------------------------------------- ; Sprite_IsOnscreen ; in: X - Sprite Slot