item properties tabulated with a macro
new item graphics
better hex to dec code
some item code readability improvements
This commit is contained in:
spannerisms
2022-12-03 12:16:34 -05:00
parent b2fdeb6b84
commit 0397623340
15 changed files with 1666 additions and 606 deletions

View File

@@ -68,6 +68,7 @@ incsrc floodgatesoftlock.asm
incsrc heartpieces.asm incsrc heartpieces.asm
incsrc npcitems.asm incsrc npcitems.asm
incsrc utilities.asm incsrc utilities.asm
incsrc hextodec.asm
incsrc flipperkill.asm incsrc flipperkill.asm
incsrc pendantcrystalhud.asm incsrc pendantcrystalhud.asm
incsrc potions.asm incsrc potions.asm
@@ -162,6 +163,8 @@ endif
warnpc $A58000 warnpc $A58000
org $A28000 org $A28000
incsrc decompresseditemgraphics.asm
org $A38000 org $A38000
incsrc stats/main.asm incsrc stats/main.asm
@@ -198,9 +201,7 @@ incbin "data/c2807_v4.gfx"
warnpc $31A800 warnpc $31A800
org $31A800 org $31A800
GFX_New_Items:
incbin "data/newitems.gfx"
;incbin eventitems.gfx ; *EVENT*
warnpc $31B000 warnpc $31B000
org $31B000 org $31B000
@@ -320,18 +321,11 @@ db GFX_HUD_Items>>8
org $00D25A ; 0x525A - HUD Items L org $00D25A ; 0x525A - HUD Items L
db GFX_HUD_Items db GFX_HUD_Items
; this used to be a pointer to a dummy file
org $00D065 ; 005065 - New Items H
db GFX_New_Items>>16
org $00D144 ; 005114 - New Items M
db GFX_New_Items>>8
org $00D223 ; 005223 - New Items L
db GFX_New_Items
org $00D09D ; 0x509D - HUD Main H org $00D09D ; 0x509D - HUD Main H
db GFX_HUD_Main>>16 db GFX_HUD_Main>>16
org $00D17C ; 0x517C - HUD Main M org $00D17C ; 0x517C - HUD Main M
db GFX_HUD_Main>>8 db GFX_HUD_Main>>8
org $00D25B ; 0x525B - HUD Main L org $00D25B ; 0x525B - HUD Main L
db GFX_HUD_Main db GFX_HUD_Main
;================================================================================ ;================================================================================

View File

@@ -2,12 +2,12 @@ CheckReceivedItemPropertiesBeforeLoad:
LDA.b RoomIndex : BEQ .normalCode LDA.b RoomIndex : BEQ .normalCode
LDA.l RoomFade : BNE .lightOff LDA.l RoomFade : BNE .lightOff
.normalCode .normalCode
LDA.l AddReceivedItemExpanded_properties, X ;Restore Rando Code LDA.l ItemReceipts_palette, X ;Restore Rando Code
RTL RTL
.lightOff .lightOff
PHX : PHY : PHB PHX : PHY : PHB
LDA.l AddReceivedItemExpanded_properties, X ; get palette LDA.l ItemReceipts_palette, X ; get palette
REP #$30 REP #$30
AND.w #$0007 ; mask out palette AND.w #$0007 ; mask out palette

BIN
data/customitems.4bpp Normal file

Binary file not shown.

BIN
data/customitems.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -0,0 +1,771 @@
;===================================================================================================
; Up here at the top of ROM for easy viewing
;===================================================================================================
ItemReceiptGraphicsROM:
; we need some empty space here so that 0000 can mean nothing
fillbyte $00 : fill 32
incbin "data/customitems.4bpp"
;===================================================================================================
; Get the item's graphic from WRAM/ROM
; Bit 7 set indicates an explicit WRAM address
; Bit 7 reset indicates an offset into the ROM buffer
;===================================================================================================
;---------------------------------------------------------------------------------------------------
; Enters with A for parameter
;---------------------------------------------------------------------------------------------------
TransferItemReceiptToBuffer_using_GraphicsID:
PHP
PHB
REP #$30
PHX
PHY
SEP #$30
LDX.b #$00
.find_reverse
CMP.l ItemReceipts_graphics,X
BEQ .found
INX
BNE .find_reverse
.found
TXA
REP #$30
BRA ++
;---------------------------------------------------------------------------------------------------
TransferItemReceiptToBuffer_using_ReceiptID:
PHP
PHB
REP #$30
PHX
PHY
++ AND.w #$00FF
ASL
TAX
LDA.l ItemReceiptGraphicsOffsets,X
BMI .wram_buffer
.rom_address
ADC.w #ItemReceiptGraphicsROM
PHK
BRA .continue
.wram_buffer
PEA.w $7F7F
PLB
.continue
PLB
TAY
LDX.w #62
.next_write
LDA.w $003E,Y
STA.l ItemGetGFX+$00,X
LDA.w $023E,Y
STA.l ItemGetGFX+$40,X
DEY
DEY
DEX
DEX
BPL .next_write
REP #$30
PLY
PLX
PLB
PLP
RTL
;===================================================================================================
TransferItemReceiptToVRAM:
REP #$21
SEP #$10
LDA.w ItemGFXPtr
BEQ .exit
BMI .wram_address
.rom_address
ADC.w #ItemReceiptGraphicsROM
LDX.b #ItemReceiptGraphicsROM>>16
.set_address
STA.w $4202
ADC.w #$0200
STA.w $4212
STX.w $4304
STX.w $4314
LDX.b #$80
STX.w $2115
LDA.w #$1801
STA.w $4300
STA.w $4310
LDA.w #$0040
STA.w $4305
STA.w $4315
LDA.w ItemGFXTgt
STA.w $2116
LDX.b #$01
STX.w $420B
ADC.w #$0100
STA.w $2116
INX
STX.w $420B
STZ.w ItemGFXPtr
.exit
RTL
.wram_address
LDX.b #$7F
BRA .set_address
;===================================================================================================
; Decompress everything at the start of the game
;===================================================================================================
DecompBufferOffset = $18
DecompTestByte = $04
DecompCommand = $02
DecompSize = $00
DecompTileCount = $1A
DecompSaveY = $1A
Decomp3BPPScratch = $20
;===================================================================================================
DecompressAllItemGraphics:
PHP
PHB
PHD
REP #$38
; Stack change for safety
TSX
LDA.w #$1400
TCS
PHX
; direct page change for speed
LDA.w #$1200
TCD
STZ.b DecompBufferOffset
SEP #$34
STA.l $4200 ; already 0 from the LDA above
LDX.b #$5D+$73 : JSR FastSpriteDecomp
LDX.b #$5C+$73 : JSR FastSpriteDecomp
LDX.b #$5B+$73 : JSR FastSpriteDecomp
LDX.b #$5A+$73 : JSR FastSpriteDecomp
REP #$30
PLX
TXS
SEP #$20
LDA.b #$81
STA.l $4200
PLD
PLB
PLP
RTL
;===================================================================================================
; I normally hate macros like this... but I don't feel like constantly rewriting this
;===================================================================================================
macro GetNextByte()
LDA.w $0000,Y
INY
BNE ?++
; Y pulls more than it needs, but that's fine
; the high byte should only be affected if we somehow have FF as our bank
; and if that happens, we have other problems
PHB
PLY
INY
PHY
PLB
LDY.w #$8000
?++
endmacro
;===================================================================================================
; There's no long vanilla routine, and we're going to make heavy use of this
; so might as well rewrite it to be fast
;===================================================================================================
FastSpriteDecomp:
SEP #$30
LDA.l $00CFC0,X : PHA : PLB ; bank
LDA.l $00D09F,X : XBA ; high
LDA.l $00D17E,X ; low
REP #$10
TAY
LDX.w #$0000
.next_command
%GetNextByte()
CMP.b #$FF
BNE .continue
;---------------------------------------------------------------------------------------------------
JMP Unrolled3BPPConvert
;---------------------------------------------------------------------------------------------------
.continue
CMP.b #$E0
BCS .expanded
STA.b DecompTestByte
REP #$20
AND.w #$001F
BRA .normal
;---------------------------------------------------------------------------------------------------
; Putting some commands up here for branch distance
;---------------------------------------------------------------------------------------------------
.nonrepeating
%GetNextByte()
STA.l DecompBuffer2,X
INX
DEC.b DecompSize+0
BNE .nonrepeating
DEC.b DecompSize+1
BPL .nonrepeating
BRA .next_command
;---------------------------------------------------------------------------------------------------
.repeating
%GetNextByte()
STY.b DecompSaveY
LDY.b DecompSize
.next_repeating
STA.l DecompBuffer2,X
INX
DEY
BNE .next_repeating
LDY.b DecompSaveY
BRA .next_command
;---------------------------------------------------------------------------------------------------
; Rest of command handling
;---------------------------------------------------------------------------------------------------
.expanded
STA.b DecompCommand
ASL
ASL
ASL
AND.b #$E0
STA.b DecompTestByte
LDA.b DecompCommand
AND.b #$03
XBA
%GetNextByte()
REP #$20
;---------------------------------------------------------------------------------------------------
.normal
INC
STA.b DecompSize
SEP #$20
LDA.b DecompTestByte
AND.b #$E0
BEQ .nonrepeating
BMI .copy
ASL
BPL .repeating
ASL
BPL .repeating_word
;---------------------------------------------------------------------------------------------------
.incremental
%GetNextByte()
STY.b DecompSaveY
LDY.b DecompSize
.next_incremental
STA.l DecompBuffer2,X
INC
INX
DEY
BNE .next_incremental
LDY.b DecompSaveY
JMP .next_command
;---------------------------------------------------------------------------------------------------
.repeating_word
JSR .get_next_word
REP #$20
STY.b DecompSaveY
LDY.b DecompSize
.next_word
STA.l DecompBuffer2,X
INX
DEY
BEQ .done_restore_y
INX
DEY
BNE .next_word
.done_restore_y
SEP #$20
LDY.b DecompSaveY
JMP .next_command
;---------------------------------------------------------------------------------------------------
.copy
JSR .get_next_word
STY.b DecompSaveY
TAY
PHB
LDA.b #$7F
PHA
PLB
.next_copy
LDA.w DecompBuffer2,Y
STA.w DecompBuffer2,X
INX
INY
DEC.b DecompSize+0
BNE .next_copy
DEC.b DecompSize+1
BPL .next_copy
PLB
LDY.b DecompSaveY
JMP .next_command
;---------------------------------------------------------------------------------------------------
; These are only used once per command, so I'm fine with letting them be a JSR I guess
;---------------------------------------------------------------------------------------------------
.get_next_word
%GetNextByte()
XBA
%GetNextByte()
XBA
RTS
;===================================================================================================
; More macros, because lazy
;===================================================================================================
macro DoPlanesA(offset)
LDA.w DecompBuffer2+<offset>+<offset>,Y
STA.w BigDecompressionBuffer+<offset>+<offset>,X
ORA.w DecompBuffer2+<offset>+<offset>-1,Y
AND.w #$FF00
STA.b Decomp3BPPScratch
LDA.w DecompBuffer2+$10+<offset>,Y
AND.w #$00FF
TSB.b Decomp3BPPScratch
XBA
ORA.b Decomp3BPPScratch
STA.w BigDecompressionBuffer+$10+<offset>+<offset>,X
endmacro
;===================================================================================================
Unrolled3BPPConvert:
LDA.b #$7F
PHA
PLB
REP #$21
LDY.w #$0000
LDX.b DecompBufferOffset
.next_3bpp_tile
%DoPlanesA(0) ; 8 times
%DoPlanesA(1)
%DoPlanesA(2)
%DoPlanesA(3)
%DoPlanesA(4)
%DoPlanesA(5)
%DoPlanesA(6)
%DoPlanesA(7)
; carry will always be clear
; don't worry
TXA
ADC.w #32
TAX
; just trust me
TYA
ADC.w #24
TAY
CMP.w #24*64
BCS .done
JMP .next_3bpp_tile
.done
STX.b DecompBufferOffset
SEP #$30
RTS
;===================================================================================================
ItemReceiptGraphicsOffsets:
dw $0860 ; 00 - Fighter sword
dw BigDecompressionBuffer+$11C0 ; 01 - Master sword
dw BigDecompressionBuffer+$11C0 ; 02 - Tempered sword
dw BigDecompressionBuffer+$11C0 ; 03 - Butter sword
dw BigDecompressionBuffer+$09E0 ; 04 - Fighter shield
dw BigDecompressionBuffer+$1940 ; 05 - Fire shield
dw BigDecompressionBuffer+$0C80 ; 06 - Mirror shield
dw BigDecompressionBuffer+$1C80 ; 07 - Fire rod
dw BigDecompressionBuffer+$1C80 ; 08 - Ice rod
dw BigDecompressionBuffer+$1CA0 ; 09 - Hammer
dw BigDecompressionBuffer+$1C60 ; 0A - Hookshot
dw BigDecompressionBuffer+$1C00 ; 0B - Bow
dw BigDecompressionBuffer+$1DE0 ; 0C - Boomerang
dw BigDecompressionBuffer+$1CC0 ; 0D - Powder
dw BigDecompressionBuffer+$09A0 ; 0E - Bottle refill (bee)
dw BigDecompressionBuffer+$1440 ; 0F - Bombos
dw BigDecompressionBuffer+$1400 ; 10 - Ether
dw BigDecompressionBuffer+$1480 ; 11 - Quake
dw BigDecompressionBuffer+$10C0 ; 12 - Lamp
dw BigDecompressionBuffer+$11E0 ; 13 - Shovel
dw BigDecompressionBuffer+$0C40 ; 14 - Flute
dw BigDecompressionBuffer+$1C40 ; 15 - Somaria
dw BigDecompressionBuffer+$14C0 ; 16 - Bottle
dw BigDecompressionBuffer+$0C00 ; 17 - Heart piece
dw BigDecompressionBuffer+$1C40 ; 18 - Byrna
dw BigDecompressionBuffer+$1100 ; 19 - Cape
dw BigDecompressionBuffer+$1040 ; 1A - Mirror
dw BigDecompressionBuffer+$1D40 ; 1B - Glove
dw BigDecompressionBuffer+$1D40 ; 1C - Mitts
dw BigDecompressionBuffer+$1D80 ; 1D - Book
dw BigDecompressionBuffer+$1000 ; 1E - Flippers
dw BigDecompressionBuffer+$1180 ; 1F - Pearl
dw BigDecompressionBuffer+$08A0 ; 20 - Crystal
dw BigDecompressionBuffer+$0860 ; 21 - Net
dw BigDecompressionBuffer+$1900 ; 22 - Blue mail
dw BigDecompressionBuffer+$1900 ; 23 - Red mail
dw BigDecompressionBuffer+$1DC0 ; 24 - Small key
dw BigDecompressionBuffer+$1140 ; 25 - Compbutt
dw BigDecompressionBuffer+$18C0 ; 26 - Heart container from 4/4
dw BigDecompressionBuffer+$1080 ; 27 - Bomb
dw BigDecompressionBuffer+$1840 ; 28 - 3 bombs
dw BigDecompressionBuffer+$1540 ; 29 - Mushroom
dw BigDecompressionBuffer+$1DE0 ; 2A - Red boomerang
dw BigDecompressionBuffer+$1500 ; 2B - Full bottle (red)
dw BigDecompressionBuffer+$1500 ; 2C - Full bottle (green)
dw BigDecompressionBuffer+$1500 ; 2D - Full bottle (blue)
dw BigDecompressionBuffer+$1500 ; 2E - Potion refill (red)
dw BigDecompressionBuffer+$1500 ; 2F - Potion refill (green)
dw BigDecompressionBuffer+$1500 ; 30 - Potion refill (blue)
dw BigDecompressionBuffer+$1D00 ; 31 - 10 bombs
dw BigDecompressionBuffer+$15C0 ; 32 - Big key
dw BigDecompressionBuffer+$1580 ; 33 - Map
dw BigDecompressionBuffer+$0800 ; 34 - 1 rupee
dw BigDecompressionBuffer+$0800 ; 35 - 5 rupees
dw BigDecompressionBuffer+$0800 ; 36 - 20 rupees
dw BigDecompressionBuffer+$0080 ; 37 - Green pendant
dw BigDecompressionBuffer+$0080 ; 38 - Blue pendant
dw BigDecompressionBuffer+$0080 ; 39 - Red pendant
dw BigDecompressionBuffer+$0920 ; 3A - Tossed bow
dw BigDecompressionBuffer+$08E0 ; 3B - Silvers
dw BigDecompressionBuffer+$09A0 ; 3C - Full bottle (bee)
dw BigDecompressionBuffer+$0960 ; 3D - Full bottle (fairy)
dw BigDecompressionBuffer+$18C0 ; 3E - Boss heart
dw BigDecompressionBuffer+$18C0 ; 3F - Sanc heart
dw BigDecompressionBuffer+$0D20 ; 40 - 100 rupees
dw BigDecompressionBuffer+$0D60 ; 41 - 50 rupees
dw BigDecompressionBuffer+$0CC0 ; 42 - Heart
dw BigDecompressionBuffer+$0DD0 ; 43 - Arrow
dw BigDecompressionBuffer+$1880 ; 44 - 10 arrows
dw BigDecompressionBuffer+$0CE0 ; 45 - Small magic
dw BigDecompressionBuffer+$0DA0 ; 46 - 300 rupees
dw BigDecompressionBuffer+$0000 ; 47 - 20 rupees green
dw BigDecompressionBuffer+$09A0 ; 48 - Full bottle (good bee)
dw BigDecompressionBuffer+$1C20 ; 49 - Tossed fighter sword
dw BigDecompressionBuffer+$09A0 ; 4A - Bottle refill (good bee)
dw BigDecompressionBuffer+$0040 ; 4B - Boots
; Rando items
dw $04A0 ; 4C - Bomb capacity (50)
dw $05A0 ; 4D - Arrow capacity (70)
dw $01A0 ; 4E - 1/2 magic
dw $01E0 ; 4F - 1/4 magic
dw $0 ; 50 - Safe master sword
dw $0420 ; 51 - Bomb capacity (+5)
dw $0460 ; 52 - Bomb capacity (+10)
dw $0520 ; 53 - Arrow capacity (+5)
dw $0560 ; 54 - Arrow capacity (+10)
dw $0 ; 55 - Programmable item 1
dw $0 ; 56 - Programmable item 2
dw $0 ; 57 - Programmable item 3
dw $0 ; 58 - Upgrade-only silver arrows
dw $0 ; 59 - Rupoor
dw $0020 ; 5A - Nothing
dw $0 ; 5B - Red clock
dw $0 ; 5C - Blue clock
dw $0 ; 5D - Green clock
dw $0 ; 5E - Progressive sword
dw $0 ; 5F - Progressive shield
dw $0 ; 60 - Progressive armor
dw $0 ; 61 - Progressive glove
dw $0 ; 62 - RNG pool item (single)
dw $0 ; 63 - RNG pool item (multi)
dw $0 ; 64 - Progressive bow
dw $0 ; 65 - Progressive bow
dw $0 ; 66 -
dw $0 ; 67 -
dw $0 ; 68 -
dw $0 ; 69 -
dw $0060 ; 6A - Triforce
dw $0 ; 6B - Power star
dw $0 ; 6C -
dw $0 ; 6D - Server request item
dw $0 ; 6E - Server request item (dungeon drop)
dw $0 ; 6F -
dw BigDecompressionBuffer+$1580 ; 70 - Map of Light World
dw BigDecompressionBuffer+$1580 ; 71 - Map of Dark World
dw BigDecompressionBuffer+$1580 ; 72 - Map of Ganon's Tower
dw BigDecompressionBuffer+$1580 ; 73 - Map of Turtle Rock
dw BigDecompressionBuffer+$1580 ; 74 - Map of Thieves' Town
dw BigDecompressionBuffer+$1580 ; 75 - Map of Tower of Hera
dw BigDecompressionBuffer+$1580 ; 76 - Map of Ice Palace
dw BigDecompressionBuffer+$1580 ; 77 - Map of Skull Woods
dw BigDecompressionBuffer+$1580 ; 78 - Map of Misery Mire
dw BigDecompressionBuffer+$1580 ; 79 - Map of Dark Palace
dw BigDecompressionBuffer+$1580 ; 7A - Map of Swamp Palace
dw BigDecompressionBuffer+$1580 ; 7B - Map of Agahnim's Tower
dw BigDecompressionBuffer+$1580 ; 7C - Map of Desert Palace
dw BigDecompressionBuffer+$1580 ; 7D - Map of Eastern Palace
dw BigDecompressionBuffer+$1580 ; 7E - Map of Hyrule Castle
dw BigDecompressionBuffer+$1580 ; 7F - Map of Sewers
dw BigDecompressionBuffer+$1140 ; 80 - Compass of Light World
dw BigDecompressionBuffer+$1140 ; 81 - Compass of Dark World
dw BigDecompressionBuffer+$1140 ; 82 - Compass of Ganon's Tower
dw BigDecompressionBuffer+$1140 ; 83 - Compass of Turtle Rock
dw BigDecompressionBuffer+$1140 ; 84 - Compass of Thieves' Town
dw BigDecompressionBuffer+$1140 ; 85 - Compass of Tower of Hera
dw BigDecompressionBuffer+$1140 ; 86 - Compass of Ice Palace
dw BigDecompressionBuffer+$1140 ; 87 - Compass of Skull Woods
dw BigDecompressionBuffer+$1140 ; 88 - Compass of Misery Mire
dw BigDecompressionBuffer+$1140 ; 89 - Compass of Dark Palace
dw BigDecompressionBuffer+$1140 ; 8A - Compass of Swamp Palace
dw BigDecompressionBuffer+$1140 ; 8B - Compass of Agahnim's Tower
dw BigDecompressionBuffer+$1140 ; 8C - Compass of Desert Palace
dw BigDecompressionBuffer+$1140 ; 8D - Compass of Eastern Palace
dw BigDecompressionBuffer+$1140 ; 8E - Compass of Hyrule Castle
dw BigDecompressionBuffer+$1140 ; 8F - Compass of Sewers
dw $0 ; 90 - Skull key
dw $0 ; 91 - Reserved
dw BigDecompressionBuffer+$15C0 ; 92 - Big key of Ganon's Tower
dw BigDecompressionBuffer+$15C0 ; 93 - Big key of Turtle Rock
dw BigDecompressionBuffer+$15C0 ; 94 - Big key of Thieves' Town
dw BigDecompressionBuffer+$15C0 ; 95 - Big key of Tower of Hera
dw BigDecompressionBuffer+$15C0 ; 96 - Big key of Ice Palace
dw BigDecompressionBuffer+$15C0 ; 97 - Big key of Skull Woods
dw BigDecompressionBuffer+$15C0 ; 98 - Big key of Misery Mire
dw BigDecompressionBuffer+$15C0 ; 99 - Big key of Dark Palace
dw BigDecompressionBuffer+$15C0 ; 9A - Big key of Swamp Palace
dw BigDecompressionBuffer+$15C0 ; 9B - Big key of Agahnim's Tower
dw BigDecompressionBuffer+$15C0 ; 9C - Big key of Desert Palace
dw BigDecompressionBuffer+$15C0 ; 9D - Big key of Eastern Palace
dw BigDecompressionBuffer+$15C0 ; 9E - Big key of Hyrule Castle
dw BigDecompressionBuffer+$15C0 ; 9F - Big key of Sewers
dw BigDecompressionBuffer+$1DC0 ; A0 - Small key of Sewers
dw BigDecompressionBuffer+$1DC0 ; A1 - Small key of Hyrule Castle
dw BigDecompressionBuffer+$1DC0 ; A2 - Small key of Eastern Palace
dw BigDecompressionBuffer+$1DC0 ; A3 - Small key of Desert Palace
dw BigDecompressionBuffer+$1DC0 ; A4 - Small key of Agahnim's Tower
dw BigDecompressionBuffer+$1DC0 ; A5 - Small key of Swamp Palace
dw BigDecompressionBuffer+$1DC0 ; A6 - Small key of Dark Palace
dw BigDecompressionBuffer+$1DC0 ; A7 - Small key of Misery Mire
dw BigDecompressionBuffer+$1DC0 ; A8 - Small key of Skull Woods
dw BigDecompressionBuffer+$1DC0 ; A9 - Small key of Ice Palace
dw BigDecompressionBuffer+$1DC0 ; AA - Small key of Tower of Hera
dw BigDecompressionBuffer+$1DC0 ; AB - Small key of Thieves' Town
dw BigDecompressionBuffer+$1DC0 ; AC - Small key of Turtle Rock
dw BigDecompressionBuffer+$1DC0 ; AD - Small key of Ganon's Tower
dw $0 ; AE - Reserved
dw BigDecompressionBuffer+$1DC0 ; AF - Generic small key
dw $0 ; B0 -
dw $0 ; B1 -
dw $0 ; B2 -
dw $0 ; B3 -
dw $0 ; B4 -
dw $0 ; B5 -
dw $0 ; B6 -
dw $0 ; B7 -
dw $0 ; B8 -
dw $0 ; B9 -
dw $0 ; BA -
dw $0 ; BB -
dw $0 ; BC -
dw $0 ; BD -
dw $0 ; BE -
dw $0 ; BF -
dw $0 ; C0 -
dw $0 ; C1 -
dw $0 ; C2 -
dw $0 ; C3 -
dw $0 ; C4 -
dw $0 ; C5 -
dw $0 ; C6 -
dw $0 ; C7 -
dw $0 ; C8 -
dw $0 ; C9 -
dw $0 ; CA -
dw $0 ; CB -
dw $0 ; CC -
dw $0 ; CD -
dw $0 ; CE -
dw $0 ; CF -
dw $0 ; D0 -
dw $0 ; D1 -
dw $0 ; D2 -
dw $0 ; D3 -
dw $0 ; D4 -
dw $0 ; D5 -
dw $0 ; D6 -
dw $0 ; D7 -
dw $0 ; D8 -
dw $0 ; D9 -
dw $0 ; DA -
dw $0 ; DB -
dw $0 ; DC -
dw $0 ; DD -
dw $0 ; DE -
dw $0 ; DF -
dw $0 ; E0 -
dw $0 ; E1 -
dw $0 ; E2 -
dw $0 ; E3 -
dw $0 ; E4 -
dw $0 ; E5 -
dw $0 ; E6 -
dw $0 ; E7 -
dw $0 ; E8 -
dw $0 ; E9 -
dw $0 ; EA -
dw $0 ; EB -
dw $0 ; EC -
dw $0 ; ED -
dw $0 ; EE -
dw $0 ; EF -
dw $0 ; F0 -
dw $0 ; F1 -
dw $0 ; F2 -
dw $0 ; F3 -
dw $0 ; F4 -
dw $0 ; F5 -
dw $0 ; F6 -
dw $0 ; F7 -
dw $0 ; F8 -
dw $0 ; F9 -
dw $0 ; FA -
dw $0 ; FB -
dw $0 ; FC -
dw $0 ; FD -
dw $0 ; FE - Server request (async)
dw $0 ; FF -
;===================================================================================================

215
hextodec.asm Normal file
View File

@@ -0,0 +1,215 @@
;===================================================================================================
; New file because of the enormous table
;===================================================================================================
;--------------------------------------------------------------------------------
; HexToDec
; in: A(w) - Word to Convert
; out: HexToDecDigit1 - HexToDecDigit5 (high - low)
;--------------------------------------------------------------------------------
HexToDec:
PHP
REP #$30
PHX
PHA
CMP.w #1000
BCS .over_1000
ASL
TAX
LDA.l FastHexTable,X
SEP #$20
AND.b #$0F
STA.l HexToDecDigit5
LDA.l FastHexTable,X
LSR
LSR
LSR
LSR
STA.l HexToDecDigit4
XBA
AND.b #$0F
STA.l HexToDecDigit3
REP #$20
LDA.l #$0000
STA.l HexToDecDigit1
PLA
PLX
PLP
RTL
;---------------------------------------------------------------------------------------------------
.over_1000
; get remainder mod100
STA.l $4204
SEP #$20
LDA.b #100
STA.l $4206
PHD
PLD
REP #$20
XBA
LDA.l $4216
AND.w #$7F
ASL
TAX
SEP #$20
LDA.l FastHexTable,X
AND.b #$0F
STA.l HexToDecDigit5
LDA.l FastHexTable,X
AND.b #$F0
LSR
LSR
LSR
LSR
STA.l HexToDecDigit4
REP #$20
LDA.l $4214
ASL
TAX
LDA.l FastHexTable,X
SEP #$20
AND.b #$0F
STA.l HexToDecDigit3
LDA.l FastHexTable,X
LSR
LSR
LSR
LSR
STA.l HexToDecDigit2
XBA
AND.b #$0F
STA.l HexToDecDigit1
REP #$20
PLA
PLX
PLP
RTL
;===================================================================================================
FastHexTable:
dw $000, $001, $002, $003, $004, $005, $006, $007, $008, $009
dw $010, $011, $012, $013, $014, $015, $016, $017, $018, $019
dw $020, $021, $022, $023, $024, $025, $026, $027, $028, $029
dw $030, $031, $032, $033, $034, $035, $036, $037, $038, $039
dw $040, $041, $042, $043, $044, $045, $046, $047, $048, $049
dw $050, $051, $052, $053, $054, $055, $056, $057, $058, $059
dw $060, $061, $062, $063, $064, $065, $066, $067, $068, $069
dw $070, $071, $072, $073, $074, $075, $076, $077, $078, $079
dw $080, $081, $082, $083, $084, $085, $086, $087, $088, $089
dw $090, $091, $092, $093, $094, $095, $096, $097, $098, $099
dw $100, $101, $102, $103, $104, $105, $106, $107, $108, $109
dw $110, $111, $112, $113, $114, $115, $116, $117, $118, $119
dw $120, $121, $122, $123, $124, $125, $126, $127, $128, $129
dw $130, $131, $132, $133, $134, $135, $136, $137, $138, $139
dw $140, $141, $142, $143, $144, $145, $146, $147, $148, $149
dw $150, $151, $152, $153, $154, $155, $156, $157, $158, $159
dw $160, $161, $162, $163, $164, $165, $166, $167, $168, $169
dw $170, $171, $172, $173, $174, $175, $176, $177, $178, $179
dw $180, $181, $182, $183, $184, $185, $186, $187, $188, $189
dw $190, $191, $192, $193, $194, $195, $196, $197, $198, $199
dw $200, $201, $202, $203, $204, $205, $206, $207, $208, $209
dw $210, $211, $212, $213, $214, $215, $216, $217, $218, $219
dw $220, $221, $222, $223, $224, $225, $226, $227, $228, $229
dw $230, $231, $232, $233, $234, $235, $236, $237, $238, $239
dw $240, $241, $242, $243, $244, $245, $246, $247, $248, $249
dw $250, $251, $252, $253, $254, $255, $256, $257, $258, $259
dw $260, $261, $262, $263, $264, $265, $266, $267, $268, $269
dw $270, $271, $272, $273, $274, $275, $276, $277, $278, $279
dw $280, $281, $282, $283, $284, $285, $286, $287, $288, $289
dw $290, $291, $292, $293, $294, $295, $296, $297, $298, $299
dw $300, $301, $302, $303, $304, $305, $306, $307, $308, $309
dw $310, $311, $312, $313, $314, $315, $316, $317, $318, $319
dw $320, $321, $322, $323, $324, $325, $326, $327, $328, $329
dw $330, $331, $332, $333, $334, $335, $336, $337, $338, $339
dw $340, $341, $342, $343, $344, $345, $346, $347, $348, $349
dw $350, $351, $352, $353, $354, $355, $356, $357, $358, $359
dw $360, $361, $362, $363, $364, $365, $366, $367, $368, $369
dw $370, $371, $372, $373, $374, $375, $376, $377, $378, $379
dw $380, $381, $382, $383, $384, $385, $386, $387, $388, $389
dw $390, $391, $392, $393, $394, $395, $396, $397, $398, $399
dw $400, $401, $402, $403, $404, $405, $406, $407, $408, $409
dw $410, $411, $412, $413, $414, $415, $416, $417, $418, $419
dw $420, $421, $422, $423, $424, $425, $426, $427, $428, $429
dw $430, $431, $432, $433, $434, $435, $436, $437, $438, $439
dw $440, $441, $442, $443, $444, $445, $446, $447, $448, $449
dw $450, $451, $452, $453, $454, $455, $456, $457, $458, $459
dw $460, $461, $462, $463, $464, $465, $466, $467, $468, $469
dw $470, $471, $472, $473, $474, $475, $476, $477, $478, $479
dw $480, $481, $482, $483, $484, $485, $486, $487, $488, $489
dw $490, $491, $492, $493, $494, $495, $496, $497, $498, $499
dw $500, $501, $502, $503, $504, $505, $506, $507, $508, $509
dw $510, $511, $512, $513, $514, $515, $516, $517, $518, $519
dw $520, $521, $522, $523, $524, $525, $526, $527, $528, $529
dw $530, $531, $532, $533, $534, $535, $536, $537, $538, $539
dw $540, $541, $542, $543, $544, $545, $546, $547, $548, $549
dw $550, $551, $552, $553, $554, $555, $556, $557, $558, $559
dw $560, $561, $562, $563, $564, $565, $566, $567, $568, $569
dw $570, $571, $572, $573, $574, $575, $576, $577, $578, $579
dw $580, $581, $582, $583, $584, $585, $586, $587, $588, $589
dw $590, $591, $592, $593, $594, $595, $596, $597, $598, $599
dw $600, $601, $602, $603, $604, $605, $606, $607, $608, $609
dw $610, $611, $612, $613, $614, $615, $616, $617, $618, $619
dw $620, $621, $622, $623, $624, $625, $626, $627, $628, $629
dw $630, $631, $632, $633, $634, $635, $636, $637, $638, $639
dw $640, $641, $642, $643, $644, $645, $646, $647, $648, $649
dw $650, $651, $652, $653, $654, $655, $656, $657, $658, $659
dw $660, $661, $662, $663, $664, $665, $666, $667, $668, $669
dw $670, $671, $672, $673, $674, $675, $676, $677, $678, $679
dw $680, $681, $682, $683, $684, $685, $686, $687, $688, $689
dw $690, $691, $692, $693, $694, $695, $696, $697, $698, $699
dw $700, $701, $702, $703, $704, $705, $706, $707, $708, $709
dw $710, $711, $712, $713, $714, $715, $716, $717, $718, $719
dw $720, $721, $722, $723, $724, $725, $726, $727, $728, $729
dw $730, $731, $732, $733, $734, $735, $736, $737, $738, $739
dw $740, $741, $742, $743, $744, $745, $746, $747, $748, $749
dw $750, $751, $752, $753, $754, $755, $756, $757, $758, $759
dw $760, $761, $762, $763, $764, $765, $766, $767, $768, $769
dw $770, $771, $772, $773, $774, $775, $776, $777, $778, $779
dw $780, $781, $782, $783, $784, $785, $786, $787, $788, $789
dw $790, $791, $792, $793, $794, $795, $796, $797, $798, $799
dw $800, $801, $802, $803, $804, $805, $806, $807, $808, $809
dw $810, $811, $812, $813, $814, $815, $816, $817, $818, $819
dw $820, $821, $822, $823, $824, $825, $826, $827, $828, $829
dw $830, $831, $832, $833, $834, $835, $836, $837, $838, $839
dw $840, $841, $842, $843, $844, $845, $846, $847, $848, $849
dw $850, $851, $852, $853, $854, $855, $856, $857, $858, $859
dw $860, $861, $862, $863, $864, $865, $866, $867, $868, $869
dw $870, $871, $872, $873, $874, $875, $876, $877, $878, $879
dw $880, $881, $882, $883, $884, $885, $886, $887, $888, $889
dw $890, $891, $892, $893, $894, $895, $896, $897, $898, $899
dw $900, $901, $902, $903, $904, $905, $906, $907, $908, $909
dw $910, $911, $912, $913, $914, $915, $916, $917, $918, $919
dw $920, $921, $922, $923, $924, $925, $926, $927, $928, $929
dw $930, $931, $932, $933, $934, $935, $936, $937, $938, $939
dw $940, $941, $942, $943, $944, $945, $946, $947, $948, $949
dw $950, $951, $952, $953, $954, $955, $956, $957, $958, $959
dw $960, $961, $962, $963, $964, $965, $966, $967, $968, $969
dw $970, $971, $972, $973, $974, $975, $976, $977, $978, $979
dw $980, $981, $982, $983, $984, $985, $986, $987, $988, $989
dw $990, $991, $992, $993, $994, $995, $996, $997, $998, $999
;===================================================================================================

View File

@@ -624,13 +624,13 @@ JSL.l EndingSequenceTableLookupOverride : NOP #2
;================================================================================ ;================================================================================
; Master Sword Overlay Fix ; Master Sword Overlay Fix
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $0987b2 ; <- ancilla_init.asm : 1051 (LDA.b #$09) org $0987B2 ; <- ancilla_init.asm : 1051 (LDA.b #$09)
JSL.l PedestalPullOverlayFix JSL.l PedestalPullOverlayFix
org $0987b8 ; <- ancilla_init.asm : 1055 (STA $039F, X) org $0987B8 ; <- ancilla_init.asm : 1055 (STA $039F, X)
NOP #3 NOP #3
org $0987df ; <- ancilla_init.asm : 1077 (STA $039F, X) org $0987DF ; <- ancilla_init.asm : 1077 (STA $039F, X)
NOP #3 NOP #3
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -886,43 +886,47 @@ org $0799F7 ; 399F7 - Bank07.asm:4107 (JSL AddReceivedItem)
JSL.l AddReceivedItemExpanded JSL.l AddReceivedItemExpanded
org $098611 ; 48611 - ancilla_init.asm:720 (LDA .item_target_addr+0, X) org $098611 ; 48611 - ancilla_init.asm:720 (LDA .item_target_addr+0, X)
LDA.w AddReceivedItemExpanded_item_target_addr+0, X LDA.w ItemReceipts_target+0, X
org $098616 ; 48616 - ancilla_init.asm:721 (LDA .item_target_addr+1, X) org $098616 ; 48616 - ancilla_init.asm:721 (LDA .item_target_addr+1, X)
LDA.w AddReceivedItemExpanded_item_target_addr+1, X LDA.w ItemReceipts_target+1, X
org $09861F ; 4861F - ancilla_init.asm:724 (LDA .item_values, Y) org $09861F ; 4861F - ancilla_init.asm:724 (LDA .item_values, Y)
LDA.w AddReceivedItemExpanded_item_values, Y LDA.w ItemReceipts_value, Y
org $098627 ; 48627 - ancilla_init.asm:731 (LDA .item_target_addr+0, X) org $098627 ; 48627 - ancilla_init.asm:731 (LDA .item_target_addr+0, X)
LDA.w AddReceivedItemExpanded_item_target_addr+0, X LDA.w ItemReceipts_target+0, X
org $09862C ; 4862C - ancilla_init.asm:722 (LDA .item_target_addr+1, X) org $09862C ; 4862C - ancilla_init.asm:722 (LDA .item_target_addr+1, X)
LDA.w AddReceivedItemExpanded_item_target_addr+1, X LDA.w ItemReceipts_target+1, X
org $098635 ; 48635 - ancilla_init.asm:727 (LDA .item_values, Y) org $098635 ; 48635 - ancilla_init.asm:727 (LDA .item_values, Y)
LDA.w AddReceivedItemExpanded_item_values, Y LDA.w ItemReceipts_value, Y
org $0986AA ; 486AA - ancilla_init.asm:848 (LDA .item_masks, X) org $0986AA ; 486AA - ancilla_init.asm:848 (LDA .item_masks, X)
LDA.w AddReceivedItemExpanded_item_masks, X LDA.w AddReceivedItemExpanded_item_masks, X
org $098769 ; 48769 - ancilla_init.asm:1005 (LDA .item_graphics_indices, Y) org $098769 ; 48769 - ancilla_init.asm:1005 (LDA .item_graphics_indices, Y)
LDA.w AddReceivedItemExpanded_item_graphics_indices, Y LDA.w ItemReceipts_graphics, Y
org $09878C
JSL TransferItemReceiptToBuffer_using_GraphicsID
org $09884D ; 4884D - ancilla_init.asm:1137 (LDA $836C, Y) org $09884D ; 4884D - ancilla_init.asm:1137 (LDA $836C, Y)
LDA.w AddReceivedItemExpanded_y_offsets, Y LDA.w ItemReceipts_offset_y, Y
org $09885B ; 4885B - ancilla_init.asm:1139 (LDA .x_offsets, X) - I think the disassembly is wrong here, should have been LDA .x_offsets, Y org $09885B ; 4885B - ancilla_init.asm:1139 (LDA .x_offsets, X) - I think the disassembly is wrong here, should have been LDA .x_offsets, Y
LDA.w AddReceivedItemExpanded_x_offsets, Y LDA.w ItemReceipts_offset_x, Y
org $0988B7 ; 488B7 - ancilla_init.asm:1199 (LDA .wide_item_flag, Y) org $0988B7 ; 488B7 - ancilla_init.asm:1199 (LDA .wide_item_flag, Y)
LDA.w AddReceivedItemExpanded_wide_item_flag, Y LDA.w ItemReceipts_width, Y
org $0988EF ; 488EF - ancilla_init.asm:1248 (LDA $836C, Y) org $0988EF ; 488EF - ancilla_init.asm:1248 (LDA $836C, Y)
LDA.w AddReceivedItemExpanded_y_offsets, Y LDA.w ItemReceipts_offset_y, Y
org $098908 ; 48908 - ancilla_init.asm:1258 (LDA .x_offsets, Y) org $098908 ; 48908 - ancilla_init.asm:1258 (LDA .x_offsets, Y)
LDA.w AddReceivedItemExpanded_x_offsets, Y LDA.w ItemReceipts_offset_x, Y
org $08C6C8 ; 446C8 - ancilla_receive_item.asm:538 (LDA AddReceiveItem.properties, X) org $08C6C8 ; 446C8 - ancilla_receive_item.asm:538 (LDA AddReceiveItem.properties, X)
JSL CheckReceivedItemPropertiesBeforeLoad JSL CheckReceivedItemPropertiesBeforeLoad
org $08C6DE ; 446DE - ancilla_receive_item.asm:550 (LDA .wide_item_flag, X) org $08C6DE ; 446DE - ancilla_receive_item.asm:550 (LDA .wide_item_flag, X)
LDA.l AddReceivedItemExpanded_wide_item_flag, X LDA.l ItemReceipts_width, X
org $08C6F9 ; 446F9 - ancilla_receive_item.asm:570 (LDA AddReceiveItem.properties, X) org $08C6F9 ; 446F9 - ancilla_receive_item.asm:570 (LDA AddReceiveItem.properties, X)
JSL CheckReceivedItemPropertiesBeforeLoad JSL CheckReceivedItemPropertiesBeforeLoad

View File

@@ -67,6 +67,8 @@ Init_PostRAMClear:
JSL MSUInit JSL MSUInit
JSL InitRNGPointerTable JSL InitRNGPointerTable
JSL InitCompassTotalsRAM JSL InitCompassTotalsRAM
JSL DecompressAllItemGraphics
JML $00D463 ; The original target of the jump table that we hijacked JML $00D463 ; The original target of the jump table that we hijacked

View File

@@ -9,8 +9,8 @@ NewDrawHud:
LDA.l BombsEquipment ; bombs LDA.l BombsEquipment ; bombs
JSR HudHexToDec2Digit ;requires 8 bit registers! JSR HudHexToDec2Digit ;requires 8 bit registers!
REP #$20 REP #$20
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDBombCount ; Draw bombs 10 digit LDX.b Scrap06 : TXA : ORA.w #$2490 : STA.l HUDBombCount ; Draw bombs 10 digit
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDBombCount+2 ; Draw bombs 1 digit LDX.b Scrap07 : TXA : ORA.w #$2490 : STA.l HUDBombCount+2 ; Draw bombs 1 digit
BRA + BRA +
.infinite_bombs .infinite_bombs
@@ -25,10 +25,10 @@ NewDrawHud:
LDA.l DisplayRupees ; Drawing bombs (above) always ends with 16-bit A, so, no need to REP here LDA.l DisplayRupees ; Drawing bombs (above) always ends with 16-bit A, so, no need to REP here
JSR HudHexToDec4Digit JSR HudHexToDec4Digit
LDX.b Scrap04 : TXA : ORA.w #$2400 : STA.l HUDRupees ; 1000s LDX.b Scrap04 : TXA : ORA.w #$2490 : STA.l HUDRupees ; 1000s
LDX.b Scrap05 : TXA : ORA.w #$2400 : STA.l HUDRupees+2 ; 100s LDX.b Scrap05 : TXA : ORA.w #$2490 : STA.l HUDRupees+2 ; 100s
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDRupees+4 ; 10s LDX.b Scrap06 : TXA : ORA.w #$2490 : STA.l HUDRupees+4 ; 10s
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDRupees+6 ; 1s LDX.b Scrap07 : TXA : ORA.w #$2490 : STA.l HUDRupees+6 ; 1s
;================================================================================ ;================================================================================
; Draw arrow count ; Draw arrow count
@@ -41,8 +41,8 @@ NewDrawHud:
LDA.l CurrentArrows ; arrows LDA.l CurrentArrows ; arrows
JSR HudHexToDec2Digit JSR HudHexToDec2Digit
REP #$20 REP #$20
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDArrowCount ; Draw arrows 10 digit LDX.b Scrap06 : TXA : ORA.w #$2490 : STA.l HUDArrowCount ; Draw arrows 10 digit
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDArrowCount+2 ; Draw arrows 1 digit LDX.b Scrap07 : TXA : ORA.w #$2490 : STA.l HUDArrowCount+2 ; Draw arrows 1 digit
BRA + BRA +
.infinite_arrows .infinite_arrows
@@ -63,17 +63,17 @@ NewDrawHud:
LDA.l GoalItemIcon : STA.l HUDGoalIndicator ; draw star icon LDA.l GoalItemIcon : STA.l HUDGoalIndicator ; draw star icon
LDX.b Scrap05 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+2 ; draw 100's digit LDX.b Scrap05 : TXA : ORA.w #$2490 : STA.l HUDGoalIndicator+2 ; draw 100's digit
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+4 ; draw 10's digit LDX.b Scrap06 : TXA : ORA.w #$2490 : STA.l HUDGoalIndicator+4 ; draw 10's digit
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+6 ; draw 1's digit LDX.b Scrap07 : TXA : ORA.w #$2490 : STA.l HUDGoalIndicator+6 ; draw 1's digit
LDA.l GoalItemRequirement : CMP.w #$FFFF : BEQ .skip LDA.l GoalItemRequirement : CMP.w #$FFFF : BEQ .skip
LDA.l GoalItemRequirement LDA.l GoalItemRequirement
JSR HudHexToDec4Digit JSR HudHexToDec4Digit
LDA.w #$2830 : STA.l HUDGoalIndicator+8 ; draw slash LDA.w #$2830 : STA.l HUDGoalIndicator+8 ; draw slash
LDX.b Scrap05 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+10 ; draw 100's digit LDX.b Scrap05 : TXA : ORA.w #$2490 : STA.l HUDGoalIndicator+10 ; draw 100's digit
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+12 ; draw 10's digit LDX.b Scrap06 : TXA : ORA.w #$2490 : STA.l HUDGoalIndicator+12 ; draw 10's digit
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+14 ; draw 1's digit LDX.b Scrap07 : TXA : ORA.w #$2490 : STA.l HUDGoalIndicator+14 ; draw 1's digit
BRA .done BRA .done
.skip .skip
LDA.w #$207F ; transparent tile LDA.w #$207F ; transparent tile
@@ -98,13 +98,13 @@ NewDrawHud:
JSR HudHexToDec2Digit : REP #$20 JSR HudHexToDec2Digit : REP #$20
; if 10s digit is 0, draw transparent tile instead of 0 ; if 10s digit is 0, draw transparent tile instead of 0
LDX.b Scrap06 : TXA : CPX.b #$90 : BNE + LDX.b Scrap06 : TXA : BNE +
LDA.w #$007F LDA.w #$007F
+ +
ORA.w #$2400 : STA.l HUDKeyDigits ORA.w #$2490 : STA.l HUDKeyDigits
; 1s digit ; 1s digit
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDKeyDigits+2 LDX.b Scrap07 : TXA : ORA.w #$2490 : STA.l HUDKeyDigits+2
BRA .done_keys BRA .done_keys
.not_in_dungeon .not_in_dungeon
@@ -215,31 +215,16 @@ RTL
; out: $04 - $07 (high - low) ; out: $04 - $07 (high - low)
;================================================================================ ;================================================================================
HudHexToDec4Digit: HudHexToDec4Digit:
LDY.b #$90 JSL HexToDec
-
CMP.w #1000 : !BLT + REP #$20
INY
SBC.w #1000 : BRA - LDA.l HexToDecDigit2
+ STA.b Scrap04
STY.b Scrap04 : LDY.b #$90 ; Store 1000s digit & reset Y
- LDA.l HexToDecDigit4
CMP.w #100 : !BLT + STA.b Scrap06
INY
SBC.w #100 : BRA -
+
STY.b Scrap05 : LDY.b #$90 ; Store 100s digit & reset Y
-
CMP.w #10 : !BLT +
INY
SBC.w #10 : BRA -
+
STY.b Scrap06 : LDY.b #$90 ; Store 10s digit & reset Y
CMP.w #1 : !BLT +
-
INY
DEC : BNE -
+
STY.b Scrap07 ; Store 1s digit
RTS RTS
;================================================================================ ;================================================================================
@@ -248,17 +233,27 @@ RTS
; out: $06 - $07 (high - low) ; out: $06 - $07 (high - low)
;================================================================================ ;================================================================================
HudHexToDec2Digit: HudHexToDec2Digit:
LDY.b #$90 PHP
-
CMP.b #10 : !BLT + REP #$30
INY PHX
SBC.b #10 : BRA -
+ AND.w #$00FF
STY.b Scrap06 : LDY.b #$90 ; Store 10s digit and reset Y ASL
CMP.b #1 : !BLT + TAX
-
INY SEP #$20
DEC : BNE - LDA.l FastHexTable,X
+ AND.b #$0F
STY.b Scrap07 ; Store 1s digit STA.b Scrap07
RTS
LDA.l FastHexTable,X
LSR
LSR
LSR
LSR
STA.b Scrap06
PLX
PLP
RTS

View File

@@ -39,7 +39,7 @@
; #$80 - Compasses ; #$80 - Compasses
; #$90 - Big Keys ; #$90 - Big Keys
; #$A0 - Small Keys ; #$A0 - Small Keys
; #$FE - Server Request (Asychronous Chest) ; #$FE - Server Request (Asynchronous Chest)
; #$FF - Null Chest ; #$FF - Null Chest
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; Service Indexes ; Service Indexes
@@ -76,7 +76,7 @@ GetAnimatedSpriteBufferPointer_table:
dw $09C0, $0030, $0060, $0090, $00C0, $0300, $0318, $0330 dw $09C0, $0030, $0060, $0090, $00C0, $0300, $0318, $0330
dw $0348, $0360, $0378, $0390, $0930, $03F0, $0420, $0450 dw $0348, $0360, $0378, $0390, $0930, $03F0, $0420, $0450
dw $0468, $0600, $0630, $0660, $0690, $06C0, $06F0, $0720 ; disassembly (incorrectly?) says this is $0270 dw $0468, $0600, $0630, $0660, $0690, $06C0, $06F0, $0720
dw $0750, $0768, $0900, $0930, $0960, $0990, $09F0, $0000 dw $0750, $0768, $0900, $0930, $0960, $0990, $09F0, $0000
dw $00F0, $0A20, $0A50, $0660, $0600, $0618, $0630, $0648 dw $00F0, $0A20, $0A50, $0660, $0600, $0618, $0630, $0648
@@ -486,313 +486,6 @@ AddReceivedItemExpanded:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;DATA AddReceivedItemExpanded ;DATA AddReceivedItemExpanded
{ {
; This is a temporary measure for Fish to have consistent addresses
org $A08800
.y_offsets
db -5, -5, -5, -5, -5, -4, -4, -5
db -5, -4, -4, -4, -2, -4, -4, -4
db -4, -4, -4, -4, -4, -4, -4, -4
db -4, -4, -4, -4, -4, -4, -4, -4
db -4, -4, -4, -5, -4, -4, -4, -4
db -4, -4, -2, -4, -4, -4, -4, -4
db -4, -4, -4, -4, -2, -2, -2, -4
db -4, -4, -4, -4, -4, -4, -4, -4
db -4, -4, -2, -2, -4, -2, -4, -4
db -4, -5, -4, -4
;new
db -4, -4, -4, -4
db -5 ; Master Sword (Safe)
db -4, -4, -4, -4 ; +5/+10 Bomb Arrows
db -4, -4, -4 ; 3x Programmable Item
db -4 ; Upgrade-Only Sivler Arrows
db -4 ; 1 Rupoor
db -4 ; Null Item
db -4, -4, -4 ; Red, Blue & Green Clocks
db -4, -4, -4, -4 ; Progressive Sword, Shield, Armor & Gloves
db -4, -4 ; RNG Single & Multi
db -4, -4 ; Progressive Bow x2
db -4, -4, -4, -4 ; Unused
db -4, -4, -4 ; Goal Item Single, Multi & Alt Multi
db -4, -4, -4 ; Unused
db -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4 ; Free Map
db -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4 ; Free Compass
db -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4 ; Free Big Key
db -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4 ; Free Small Key
db -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4 ; Unused
db -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4 ; Unused
db -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4 ; Unused
db -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4 ; Unused
.x_offsets
db 4, 4, 4, 4, 4, 0, 0, 4
db 4, 4, 4, 4, 5, 0, 0, 0
db 0, 0, 0, 4, 0, 4, 0, 0
db 4, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 4, 0, 0, 0
db 0, 0, 5, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 4, 4, 4, 0
db 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 4, 4, 0, 4, 0, 0
db 0, 4, 0, 0
;new
db 0, 0, 0, 0
db 4 ; Master Sword (Safe)
db 0, 0, 0, 0 ; +5/+10 Bomb Arrows
db 0, 0, 0 ; 3x Programmable Item
db 0 ; Upgrade-Only Sivler Arrows
db 4 ; 1 Rupoor
db 0 ; Null Item
db 0, 0, 0 ; Red, Blue & Green Clocks
db 0, 0, 0, 0 ; Progressive Sword, Shield, Armor & Gloves
db 0, 0 ; RNG Single & Multi
db 0, 0 ; Progressive Bow x2
db 0, 0, 0, 0 ; Unused
db 0, 0, 0 ; Goal Item Single, Multi & Alt Multi
db 0, 0, 0 ; Unused
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; Free Map
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; Free Compass
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; Free Big Key
;db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; *EVENT*
db 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ; Free Small Key
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; Unused
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; Unused
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; Unused
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; Unused
.item_graphics_indices
db $06, $18, $18, $18, $2D, $20, $2E, $09
db $09, $0A, $08, $05, $10, $0B, $2C, $1B
db $1A, $1C, $14, $19, $0C, $07, $1D, $2F
db $07, $15, $12, $0D, $0D, $0E, $11, $17
db $28, $27, $04, $04, $0F, $16, $03, $13
db $01, $1E, $10, $00, $00, $00, $00, $00
db $00, $30, $22, $21, $24, $24, $24, $23
db $23, $23, $29, $2A, $2C, $2B, $03, $03
db $34, $35, $31, $33, $02, $32, $36, $37
db $2C, $06, $0C, $38
;new
db $39, $3A, $3B, $3C
;5x
db $18 ; Master Sword (Safe)
db $3D, $3E, $3F, $40 ; +5/+10 Bomb Arrows
db $00, $00, $00 ; 3x Programmable Item
db $41 ; Upgrade-Only Sivler Arrows
db $24 ; 1 Rupoor
db $47 ; Null Item
db $48, $48, $48 ; Red, Blue & Green Clocks
db $FF, $FF, $04, $0D ; Progressive Sword, Shield, Armor & Gloves
db $FF, $FF ; RNG Single & Multi
db $FF, $FF ; Progressive Bow x2
db $FF, $FF, $FF, $FF ; Unused
db $49, $4A, $49 ; Goal Item Single, Multi & Alt Multi
db $FF, $FF, $FF ; Unused
db $21, $21, $21, $21, $21, $21, $21, $21, $21, $21, $21, $21, $21, $21, $21, $21 ; Free Map
db $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16 ; Free Compass
db $22, $22, $22, $22, $22, $22, $22, $22, $22, $22, $22, $22, $22, $22, $22, $22 ; Free Big Key
db $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F ; Free Small Key
;db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; *EVENT*
;db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; *EVENT*
;db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; *EVENT*
;db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; *EVENT*
db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused
db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused
db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused
db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused
.wide_item_flag
db $00, $00, $00, $00, $00, $02, $02, $00
db $00, $00, $00, $00, $00, $02, $02, $02
db $02, $02, $02, $00, $02, $00, $02, $02
db $00, $02, $02, $02, $02, $02, $02, $02
db $02, $02, $02, $02, $00, $02, $02, $02
db $02, $02, $00, $02, $02, $02, $02, $02
db $02, $02, $02, $02, $00, $00, $00, $02
db $02, $02, $02, $02, $02, $02, $02, $02
db $02, $02, $00, $00, $02, $00, $02, $02
db $02, $00, $02, $02
;new
db $02, $02, $02, $02
db $00 ; Master Sword (Safe)
db $02, $02, $02, $02 ; +5/+10 Bomb Arrows
db $02, $02, $02 ; 3x Programmable Item
db $02 ; Upgrade-Only Sivler Arrows
db $00 ; 1 Rupoor
db $02 ; Null Item
db $02, $02, $02 ; Red, Blue & Green Clocks
db $02, $02, $02, $02 ; Progressive Sword, Shield, Armor & Gloves
db $02, $02 ; RNG Single & Multi
db $02, $02 ; Progressive Bow x2
db $02, $02, $02, $02 ; Unused
db $02, $02, $02 ; Goal Item Single, Multi & Alt Multi
db $02, $02, $02 ; Unused
db $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02 ; Free Map
db $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02 ; Free Compass
db $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02 ; Free Big Key
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; Free Small Key
db $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02 ; Unused
db $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02 ; Unused
db $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02 ; Unused
db $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02 ; Unused
db $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02 ; Unused
.properties
db 5, -1, 5, 5, 5, 5, 5, 1
db 2, 1, 1, 1, 2, 2, 2, 4
db 4, 4, 1, 1, 2, 1, 1, 1
db 2, 1, 2, 1, 4, 4, 2, 1
db 6, 1, 2, 1, 2, 2, 1, 2
db 2, 4, 1, 1, 4, 2, 1, 4
db 2, 2, 4, 4, 4, 2, 1, 4
db 1, 2, 2, 1, 2, 2, 1, 1
db 4, 4, 1, 2, 2, 4, 4, 4
db 2, 5, 2, 1
;new
db 4, 4, 4, 4
db 5 ; Master Sword (Safe)
db 4, 4, 4, 4 ; +5/+10 Bomb Arrows
db 4, 4, 4 ; 3x Programmable Item
db 1 ; Upgrade-Only Sivler Arrows
db 3 ; 1 Rupoor
db 1 ; Null Item
db 1, 2, 4 ; Red, Blue & Green Clocks
db $FF, $FF, $FF, $FF ; Progressive Sword, Shield, Armor & Gloves
db $FF, $FF ; RNG Single & Multi
db 0, 0 ; Progressive Bow
db 0, 0, 0, 0 ; Unused
db 4, 4, 4 ; Goal Item Single, Multi & Alt Multi
db 0, 0, 0 ; Unused
db 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ; Free Map
db 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ; Free Compass
db 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ; Free Big Key
db 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ; Free Small Key
db 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ; Unused
db 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ; Unused
db 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ; Unused
db 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ; Unused
db 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ; Unused
; \item Target SRAM addresses for items you receive
.item_target_addr
dw $F359, $F359, $F359, $F359, $F35A, $F35A, $F35A, $F345
dw $F346, $F34B, $F342, $F340, $F341, $F344, $F35C, $F347
dw $F348, $F349, $F34A, $F34C, $F34C, $F350, $F35C, $F36B
dw $F351, $F352, $F353, $F354, $F354, $F34E, $F356, $F357
dw $F37A, $F34D, $F35B, $F35B, $F36F, $F364, $F36C, $F375
dw $F375, $F344, $F341, $F35C, $F35C, $F35C, $F36D, $F36E
dw $F36E, $F375, $F366, $F368, $F360, $F360, $F360, $F374
dw $F374, $F374, $F340, $F340, $F35C, $F35C, $F36C, $F36C
dw $F360, $F360, $F372, $F376, $F376, $F373, $F360, $F360
dw $F35C, $F359, $F34C, $F355
;new
dw $F375, $F376, $F373, $F373
dw $F359 ; Master Sword (Safe)
dw $F375, $F375, $F376, $F376 ; +5/+10 Bomb Arrows
dw $F41A, $F41C, $F41E ; 3x Programmable Item
dw $F340 ; Upgrade-Only Silver Arrows
dw $F360 ; 1 Rupoor
dw $F36A ; Null Item
dw $F454, $F454, $F454 ; Red, Blue & Green Clocks
dw $F359, $F35A, $F35B, $F354 ; Progressive Sword, Shield, Armor & Gloves
dw $F36A, $F36A ; RNG Single & Multi
dw $F340, $F340 ; Progressive Bow x2
dw $F36A, $F36A, $F36A, $F36A ; Unused
dw $F36A, $F36A, $F36A ; Goal Item Single, Multi & Alt Multi
dw $F36A, $F36A, $F36A ; Unused
dw $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A ; Free Map
dw $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A ; Free Compass
dw $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A ; Free Big Key
dw $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A ; Free Small Key
dw $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A ; Unused
dw $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A ; Unused
dw $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A ; Unused
dw $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A ; Unused
dw $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A ; Unused
}
; DATA Values to write to the above SRAM locations.
{
.item_values
db $01, $02, $03, $04, $01, $02, $03, $01
db $01, $01, $01, $01, $01, $02, $FF, $01
db $01, $01, $01, $01, $02, $01, $FF, $FF
db $01, $01, $02, $01, $02, $01, $01, $01
db $FF, $01, $FF, $02, $FF, $FF, $FF, $FF
db $FF, $FF, $02, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FB, $EC, $FF
db $FF, $FF, $01, $03, $FF, $FF, $FF, $FF
db $9C, $CE, $FF, $01, $0A, $FF, $FF, $FF
db $FF, $01, $03, $01
;new
db $32, $46, $80, $80
db $02 ; Master Sword (Safe)
db $FF, $FF, $FF, $FF ; +5/+10 Bomb Arrows
db $FF, $FF, $FF ; 3x Programmable Item
db $FF ; Upgrade-Only Sivler Arrows
db $FF ; 1 Rupoor
db $FF ; Null Item
db $FF, $FF, $FF ; Red, Blue & Green Clocks
db $FF, $FF, $FF, $FF ; Progressive Sword, Shield, Armor & Gloves
db $FF, $FF ; RNG Single & Multi
db $FF, $FF ; Progressive Bow
db $FF, $FF, $FF, $FF ; Unused
db $FF, $FF, $FF ; Goal Item Single, Multi & Alt Multi
db $FF, $FF, $FF ; Unused
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Free Map
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Free Compass
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Free Big Key
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Free Small Key
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Unused
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Unused
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Unused
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Unused
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Unused
;0x00 - Sewer Passage
;0x02 - Hyrule Castle
;0x04 - Eastern Palace
;0x06 - Desert Palace
;0x08 - Hyrule Castle 2
;0x0A - Swamp Palace
;0x0C - Dark Palace
;0x0E - Misery Mire
;0x10 - Skull Woods
;0x12 - Ice Palace
;0x14 - Tower of Hera
;0x16 - Gargoyle's Domain
;0x18 - Turtle Rock
;0x1A - Ganon's Tower
.item_masks ; these are dungeon correlations to $7EF364 - $7EF369 so it knows where to store compasses, etc .item_masks ; these are dungeon correlations to $7EF364 - $7EF369 so it knows where to store compasses, etc
; sewers and castle get 2 bits active so that they can share their items elegantly ; sewers and castle get 2 bits active so that they can share their items elegantly
dw $C000, $C000, $2000, $1000, $0800, $0400, $0200, $0100 dw $C000, $C000, $2000, $1000, $0800, $0400, $0200, $0100
@@ -815,6 +508,290 @@ org $A08800
dw $3EC0, $0AD0, $082C, $1003, $A905, $8D02, $0309, $20C0 dw $3EC0, $0AD0, $082C, $1003, $A905, $8D02, $0309, $20C0
dw $44D0 dw $44D0
} }
ItemReceipts:
.offset_y : fillbyte $00 : fill 256
.offset_x : fillbyte $00 : fill 256
.graphics : fillbyte $00 : fill 256 ; item_graphics_indices
.width : fillbyte $00 : fill 256 ; wide_item_flag
.palette : fillbyte $00 : fill 256 ; properties
.target : fillword $0000 : fill 256*2 ; item_target_addr
.value : fillbyte $00 : fill 256 ; item_values
macro ReceiptProps(id, y, x, gfx, width, pal, sram, value)
pushpc
org ItemReceipts_offset_y+<id> : db <y>
org ItemReceipts_offset_x+<id> : db <x>
org ItemReceipts_graphics+<id> : db <gfx>
org ItemReceipts_width+<id> : db <width>
org ItemReceipts_palette+<id> : db <pal>
org ItemReceipts_target+<id>+<id> : dw <sram>
org ItemReceipts_value+<id> : db <value>
pullpc
endmacro
%ReceiptProps($00, -5, 0, $06, 2, $02, $F359, $01) ; 00 - Fighter sword
%ReceiptProps($01, -5, 4, $18, 0, $FF, $F359, $02) ; 01 - Master sword - TODO gfx value?
%ReceiptProps($02, -5, 4, $18, 0, $05, $F359, $03) ; 02 - Tempered sword - TODO gfx value?
%ReceiptProps($03, -5, 4, $18, 0, $05, $F359, $04) ; 03 - Butter sword - TODO gfx value?
%ReceiptProps($04, -5, 4, $2D, 0, $05, $F35A, $01) ; 04 - Fighter shield
%ReceiptProps($05, -4, 0, $20, 2, $05, $F35A, $02) ; 05 - Fire shield
%ReceiptProps($06, -4, 0, $2E, 2, $05, $F35A, $03) ; 06 - Mirror shield
%ReceiptProps($07, -5, 4, $09, 0, $01, $F345, $01) ; 07 - Fire rod
%ReceiptProps($08, -5, 4, $09, 0, $02, $F346, $01) ; 08 - Ice rod
%ReceiptProps($09, -4, 4, $0A, 0, $01, $F34B, $01) ; 09 - Hammer
%ReceiptProps($0A, -4, 4, $08, 0, $01, $F342, $01) ; 0A - Hookshot
%ReceiptProps($0B, -4, 4, $05, 0, $01, $F340, $01) ; 0B - Bow
%ReceiptProps($0C, -2, 5, $10, 0, $02, $F341, $01) ; 0C - Boomerang
%ReceiptProps($0D, -4, 0, $0B, 2, $02, $F344, $02) ; 0D - Powder
%ReceiptProps($0E, -4, 0, $2C, 2, $02, $F35C, $FF) ; 0E - Bottle refill (bee)
%ReceiptProps($0F, -4, 0, $1B, 2, $04, $F347, $01) ; 0F - Bombos
%ReceiptProps($10, -4, 0, $1A, 2, $04, $F348, $01) ; 10 - Ether
%ReceiptProps($11, -4, 0, $1C, 2, $04, $F349, $01) ; 11 - Quake
%ReceiptProps($12, -4, 0, $14, 2, $01, $F34A, $01) ; 12 - Lamp
%ReceiptProps($13, -4, 4, $19, 0, $01, $F34C, $01) ; 13 - Shovel
%ReceiptProps($14, -4, 0, $0C, 2, $02, $F34C, $02) ; 14 - Flute
%ReceiptProps($15, -4, 4, $07, 0, $01, $F350, $01) ; 15 - Somaria
%ReceiptProps($16, -4, 0, $1D, 2, $01, $F35C, $FF) ; 16 - Bottle
%ReceiptProps($17, -4, 0, $2F, 2, $01, $F36B, $FF) ; 17 - Heart piece
%ReceiptProps($18, -4, 4, $07, 0, $02, $F351, $01) ; 18 - Byrna
%ReceiptProps($19, -4, 0, $15, 2, $01, $F352, $01) ; 19 - Cape
%ReceiptProps($1A, -4, 0, $12, 2, $02, $F353, $02) ; 1A - Mirror
%ReceiptProps($1B, -4, 0, $0D, 2, $01, $F354, $01) ; 1B - Glove
%ReceiptProps($1C, -4, 0, $0D, 2, $04, $F354, $02) ; 1C - Mitts
%ReceiptProps($1D, -4, 0, $0E, 2, $04, $F34E, $01) ; 1D - Book
%ReceiptProps($1E, -4, 0, $11, 2, $02, $F356, $01) ; 1E - Flippers
%ReceiptProps($1F, -4, 0, $17, 2, $01, $F357, $01) ; 1F - Pearl
%ReceiptProps($20, -4, 0, $28, 2, $06, $F37A, $FF) ; 20 - Crystal
%ReceiptProps($21, -4, 0, $27, 2, $01, $F34D, $01) ; 21 - Net
%ReceiptProps($22, -4, 0, $04, 2, $02, $F35B, $FF) ; 22 - Blue mail
%ReceiptProps($23, -5, 0, $04, 2, $01, $F35B, $02) ; 23 - Red mail
%ReceiptProps($24, -4, 4, $0F, 0, $02, $F36F, $FF) ; 24 - Small key
%ReceiptProps($25, -4, 0, $16, 2, $02, $F364, $FF) ; 25 - Compbutt
%ReceiptProps($26, -4, 0, $03, 2, $01, $F36C, $FF) ; 26 - Heart container from 4/4
%ReceiptProps($27, -4, 0, $13, 2, $02, $F375, $FF) ; 27 - Bomb
%ReceiptProps($28, -4, 0, $01, 2, $02, $F375, $FF) ; 28 - 3 bombs
%ReceiptProps($29, -4, 0, $1E, 2, $04, $F344, $FF) ; 29 - Mushroom
%ReceiptProps($2A, -2, 5, $10, 0, $01, $F341, $02) ; 2A - Red boomerang
%ReceiptProps($2B, -4, 0, $00, 2, $01, $F35C, $FF) ; 2B - Full bottle (red)
%ReceiptProps($2C, -4, 0, $00, 2, $04, $F35C, $FF) ; 2C - Full bottle (green)
%ReceiptProps($2D, -4, 0, $00, 2, $02, $F35C, $FF) ; 2D - Full bottle (blue)
%ReceiptProps($2E, -4, 0, $00, 2, $01, $F36D, $FF) ; 2E - Potion refill (red)
%ReceiptProps($2F, -4, 0, $00, 2, $04, $F36E, $FF) ; 2F - Potion refill (green)
%ReceiptProps($30, -4, 0, $00, 2, $02, $F36E, $FF) ; 30 - Potion refill (blue)
%ReceiptProps($31, -4, 0, $30, 2, $02, $F375, $FF) ; 31 - 10 bombs
%ReceiptProps($32, -4, 0, $22, 2, $04, $F366, $FF) ; 32 - Big key
%ReceiptProps($33, -4, 0, $21, 2, $04, $F368, $FF) ; 33 - Map
%ReceiptProps($34, -2, 4, $24, 0, $04, $F360, $FF) ; 34 - 1 rupee
%ReceiptProps($35, -2, 4, $24, 0, $02, $F360, $FB) ; 35 - 5 rupees
%ReceiptProps($36, -2, 4, $24, 0, $01, $F360, $EC) ; 36 - 20 rupees
%ReceiptProps($37, -4, 0, $23, 2, $04, $F374, $FF) ; 37 - Green pendant
%ReceiptProps($38, -4, 0, $23, 2, $01, $F374, $FF) ; 38 - Blue pendant
%ReceiptProps($39, -4, 0, $23, 2, $02, $F374, $FF) ; 39 - Red pendant
%ReceiptProps($3A, -4, 0, $29, 2, $02, $F340, $01) ; 3A - Tossed bow
%ReceiptProps($3B, -4, 0, $2A, 2, $01, $F340, $03) ; 3B - Silvers
%ReceiptProps($3C, -4, 0, $2C, 2, $02, $F35C, $FF) ; 3C - Full bottle (bee)
%ReceiptProps($3D, -4, 0, $2B, 2, $02, $F35C, $FF) ; 3D - Full bottle (fairy)
%ReceiptProps($3E, -4, 0, $03, 2, $01, $F36C, $FF) ; 3E - Boss heart
%ReceiptProps($3F, -4, 0, $03, 2, $01, $F36C, $FF) ; 3F - Sanc heart
%ReceiptProps($40, -4, 0, $34, 2, $04, $F360, $9C) ; 40 - 100 rupees
%ReceiptProps($41, -4, 0, $35, 2, $04, $F360, $CE) ; 41 - 50 rupees
%ReceiptProps($42, -2, 4, $31, 0, $01, $F372, $FF) ; 42 - Heart
%ReceiptProps($43, -2, 4, $33, 0, $02, $F376, $01) ; 43 - Arrow
%ReceiptProps($44, -4, 0, $02, 2, $02, $F376, $0A) ; 44 - 10 arrows
%ReceiptProps($45, -2, 4, $32, 0, $04, $F373, $FF) ; 45 - Small magic
%ReceiptProps($46, -4, 0, $36, 2, $04, $F360, $FF) ; 46 - 300 rupees
%ReceiptProps($47, -4, 0, $37, 2, $04, $F360, $FF) ; 47 - 20 rupees green
%ReceiptProps($48, -4, 0, $2C, 2, $02, $F35C, $FF) ; 48 - Full bottle (good bee)
%ReceiptProps($49, -5, 4, $06, 0, $05, $F359, $01) ; 49 - Tossed fighter sword
%ReceiptProps($4A, -4, 0, $0C, 2, $02, $F34C, $03) ; 4A - Bottle refill (good bee)
%ReceiptProps($4B, -4, 0, $38, 2, $01, $F355, $01) ; 4B - Boots
%ReceiptProps($4C, -4, 0, $39, 2, $04, $F375, $32) ; 4C - Bomb capacity (50)
%ReceiptProps($4D, -4, 0, $3A, 2, $04, $F376, $46) ; 4D - Arrow capacity (70)
%ReceiptProps($4E, -4, 0, $3B, 2, $F9, $F373, $80) ; 4E - 1/2 magic
%ReceiptProps($4F, -4, 0, $3C, 2, $04, $F373, $80) ; 4F - 1/4 magic
%ReceiptProps($50, -5, 4, $18, 0, $05, $F359, $02) ; 50 - Safe master sword - TODO gfx value
%ReceiptProps($51, -4, 0, $3D, 2, $04, $F375, $FF) ; 51 - Bomb capacity (+5)
%ReceiptProps($52, -4, 0, $3E, 2, $04, $F375, $FF) ; 52 - Bomb capacity (+10)
%ReceiptProps($53, -4, 0, $3F, 2, $04, $F376, $FF) ; 53 - Arrow capacity (+5)
%ReceiptProps($54, -4, 0, $40, 2, $04, $F376, $FF) ; 54 - Arrow capacity (+10)
%ReceiptProps($55, -4, 0, $00, 2, $04, $F41A, $FF) ; 55 - Programmable item 1
%ReceiptProps($56, -4, 0, $00, 2, $04, $F41C, $FF) ; 56 - Programmable item 2
%ReceiptProps($57, -4, 0, $00, 2, $04, $F41E, $FF) ; 57 - Programmable item 3
%ReceiptProps($58, -4, 0, $41, 2, $01, $F340, $FF) ; 58 - Upgrade-only silver arrows
%ReceiptProps($59, -4, 4, $24, 0, $03, $F360, $FF) ; 59 - Rupoor
%ReceiptProps($5A, -4, 0, $47, 2, $01, $F36A, $FF) ; 5A - Nothing
%ReceiptProps($5B, -4, 0, $48, 2, $01, $F454, $FF) ; 5B - Red clock
%ReceiptProps($5C, -4, 0, $48, 2, $02, $F454, $FF) ; 5C - Blue clock
%ReceiptProps($5D, -4, 0, $48, 2, $04, $F454, $FF) ; 5D - Green clock
%ReceiptProps($5E, -4, 0, $FE, 2, $FF, $F359, $FF) ; 5E - Progressive sword
%ReceiptProps($5F, -4, 0, $FF, 2, $FF, $F35A, $FF) ; 5F - Progressive shield
%ReceiptProps($60, -4, 0, $FD, 2, $FF, $F35B, $FF) ; 60 - Progressive armor
%ReceiptProps($61, -4, 0, $0D, 2, $FF, $F354, $FF) ; 61 - Progressive glove
%ReceiptProps($62, -4, 0, $FF, 2, $FF, $F36A, $FF) ; 62 - RNG pool item (single)
%ReceiptProps($63, -4, 0, $FF, 2, $FF, $F36A, $FF) ; 63 - RNG pool item (multi)
%ReceiptProps($64, -4, 0, $FF, 2, $00, $F340, $FF) ; 64 - Progressive bow
%ReceiptProps($65, -4, 0, $FF, 2, $00, $F340, $FF) ; 65 - Progressive bow
%ReceiptProps($66, -4, 0, $FF, 2, $00, $F36A, $FF) ; 66 -
%ReceiptProps($67, -4, 0, $FF, 2, $00, $F36A, $FF) ; 67 -
%ReceiptProps($68, -4, 0, $FF, 2, $00, $F36A, $FF) ; 68 -
%ReceiptProps($69, -4, 0, $FF, 2, $00, $F36A, $FF) ; 69 -
%ReceiptProps($6A, -4, 0, $49, 2, $04, $F36A, $FF) ; 6A - Triforce
%ReceiptProps($6B, -4, 0, $4A, 2, $04, $F36A, $FF) ; 6B - Power star
%ReceiptProps($6C, -4, 0, $49, 2, $04, $F36A, $FF) ; 6C -
%ReceiptProps($6D, -4, 0, $FF, 2, $00, $F36A, $FF) ; 6D - Server request item
%ReceiptProps($6E, -4, 0, $FF, 2, $00, $F36A, $FF) ; 6E - Server request item (dungeon drop)
%ReceiptProps($6F, -4, 0, $FF, 2, $00, $F36A, $FF) ; 6F -
%ReceiptProps($70, -4, 0, $21, 2, $04, $F36A, $FF) ; 70 - Map of Light World
%ReceiptProps($71, -4, 0, $21, 2, $04, $F36A, $FF) ; 71 - Map of Dark World
%ReceiptProps($72, -4, 0, $21, 2, $04, $F36A, $FF) ; 72 - Map of Ganon's Tower
%ReceiptProps($73, -4, 0, $21, 2, $04, $F36A, $FF) ; 73 - Map of Turtle Rock
%ReceiptProps($74, -4, 0, $21, 2, $04, $F36A, $FF) ; 74 - Map of Thieves' Town
%ReceiptProps($75, -4, 0, $21, 2, $04, $F36A, $FF) ; 75 - Map of Tower of Hera
%ReceiptProps($76, -4, 0, $21, 2, $04, $F36A, $FF) ; 76 - Map of Ice Palace
%ReceiptProps($77, -4, 0, $21, 2, $04, $F36A, $FF) ; 77 - Map of Skull Woods
%ReceiptProps($78, -4, 0, $21, 2, $04, $F36A, $FF) ; 78 - Map of Misery Mire
%ReceiptProps($79, -4, 0, $21, 2, $04, $F36A, $FF) ; 79 - Map of Dark Palace
%ReceiptProps($7A, -4, 0, $21, 2, $04, $F36A, $FF) ; 7A - Map of Swamp Palace
%ReceiptProps($7B, -4, 0, $21, 2, $04, $F36A, $FF) ; 7B - Map of Agahnim's Tower
%ReceiptProps($7C, -4, 0, $21, 2, $04, $F36A, $FF) ; 7C - Map of Desert Palace
%ReceiptProps($7D, -4, 0, $21, 2, $04, $F36A, $FF) ; 7D - Map of Eastern Palace
%ReceiptProps($7E, -4, 0, $21, 2, $04, $F36A, $FF) ; 7E - Map of Hyrule Castle
%ReceiptProps($7F, -4, 0, $21, 2, $04, $F36A, $FF) ; 7F - Map of Sewers
%ReceiptProps($80, -4, 0, $16, 2, $02, $F36A, $FF) ; 80 - Compass of Light World
%ReceiptProps($81, -4, 0, $16, 2, $02, $F36A, $FF) ; 81 - Compass of Dark World
%ReceiptProps($82, -4, 0, $16, 2, $02, $F36A, $FF) ; 82 - Compass of Ganon's Tower
%ReceiptProps($83, -4, 0, $16, 2, $02, $F36A, $FF) ; 83 - Compass of Turtle Rock
%ReceiptProps($84, -4, 0, $16, 2, $02, $F36A, $FF) ; 84 - Compass of Thieves' Town
%ReceiptProps($85, -4, 0, $16, 2, $02, $F36A, $FF) ; 85 - Compass of Tower of Hera
%ReceiptProps($86, -4, 0, $16, 2, $02, $F36A, $FF) ; 86 - Compass of Ice Palace
%ReceiptProps($87, -4, 0, $16, 2, $02, $F36A, $FF) ; 87 - Compass of Skull Woods
%ReceiptProps($88, -4, 0, $16, 2, $02, $F36A, $FF) ; 88 - Compass of Misery Mire
%ReceiptProps($89, -4, 0, $16, 2, $02, $F36A, $FF) ; 89 - Compass of Dark Palace
%ReceiptProps($8A, -4, 0, $16, 2, $02, $F36A, $FF) ; 8A - Compass of Swamp Palace
%ReceiptProps($8B, -4, 0, $16, 2, $02, $F36A, $FF) ; 8B - Compass of Agahnim's Tower
%ReceiptProps($8C, -4, 0, $16, 2, $02, $F36A, $FF) ; 8C - Compass of Desert Palace
%ReceiptProps($8D, -4, 0, $16, 2, $02, $F36A, $FF) ; 8D - Compass of Eastern Palace
%ReceiptProps($8E, -4, 0, $16, 2, $02, $F36A, $FF) ; 8E - Compass of Hyrule Castle
%ReceiptProps($8F, -4, 0, $16, 2, $02, $F36A, $FF) ; 8F - Compass of Sewers
%ReceiptProps($90, -4, 0, $22, 2, $04, $F36A, $FF) ; 90 - Skull key
%ReceiptProps($91, -4, 0, $22, 2, $04, $F36A, $FF) ; 91 - Reserved
%ReceiptProps($92, -4, 0, $22, 2, $04, $F36A, $FF) ; 92 - Big key of Ganon's Tower
%ReceiptProps($93, -4, 0, $22, 2, $04, $F36A, $FF) ; 93 - Big key of Turtle Rock
%ReceiptProps($94, -4, 0, $22, 2, $04, $F36A, $FF) ; 94 - Big key of Thieves' Town
%ReceiptProps($95, -4, 0, $22, 2, $04, $F36A, $FF) ; 95 - Big key of Tower of Hera
%ReceiptProps($96, -4, 0, $22, 2, $04, $F36A, $FF) ; 96 - Big key of Ice Palace
%ReceiptProps($97, -4, 0, $22, 2, $04, $F36A, $FF) ; 97 - Big key of Skull Woods
%ReceiptProps($98, -4, 0, $22, 2, $04, $F36A, $FF) ; 98 - Big key of Misery Mire
%ReceiptProps($99, -4, 0, $22, 2, $04, $F36A, $FF) ; 99 - Big key of Dark Palace
%ReceiptProps($9A, -4, 0, $22, 2, $04, $F36A, $FF) ; 9A - Big key of Swamp Palace
%ReceiptProps($9B, -4, 0, $22, 2, $04, $F36A, $FF) ; 9B - Big key of Agahnim's Tower
%ReceiptProps($9C, -4, 0, $22, 2, $04, $F36A, $FF) ; 9C - Big key of Desert Palace
%ReceiptProps($9D, -4, 0, $22, 2, $04, $F36A, $FF) ; 9D - Big key of Eastern Palace
%ReceiptProps($9E, -4, 0, $22, 2, $04, $F36A, $FF) ; 9E - Big key of Hyrule Castle
%ReceiptProps($9F, -4, 0, $22, 2, $04, $F36A, $FF) ; 9F - Big key of Sewers
%ReceiptProps($A0, -4, 4, $0F, 0, $04, $F36A, $FF) ; A0 - Small key of Sewers
%ReceiptProps($A1, -4, 4, $0F, 0, $04, $F36A, $FF) ; A1 - Small key of Hyrule Castle
%ReceiptProps($A2, -4, 4, $0F, 0, $04, $F36A, $FF) ; A2 - Small key of Eastern Palace
%ReceiptProps($A3, -4, 4, $0F, 0, $04, $F36A, $FF) ; A3 - Small key of Desert Palace
%ReceiptProps($A4, -4, 4, $0F, 0, $04, $F36A, $FF) ; A4 - Small key of Agahnim's Tower
%ReceiptProps($A5, -4, 4, $0F, 0, $04, $F36A, $FF) ; A5 - Small key of Swamp Palace
%ReceiptProps($A6, -4, 4, $0F, 0, $04, $F36A, $FF) ; A6 - Small key of Dark Palace
%ReceiptProps($A7, -4, 4, $0F, 0, $04, $F36A, $FF) ; A7 - Small key of Misery Mire
%ReceiptProps($A8, -4, 4, $0F, 0, $04, $F36A, $FF) ; A8 - Small key of Skull Woods
%ReceiptProps($A9, -4, 4, $0F, 0, $04, $F36A, $FF) ; A9 - Small key of Ice Palace
%ReceiptProps($AA, -4, 4, $0F, 0, $04, $F36A, $FF) ; AA - Small key of Tower of Hera
%ReceiptProps($AB, -4, 4, $0F, 0, $04, $F36A, $FF) ; AB - Small key of Thieves' Town
%ReceiptProps($AC, -4, 4, $0F, 0, $04, $F36A, $FF) ; AC - Small key of Turtle Rock
%ReceiptProps($AD, -4, 4, $0F, 0, $04, $F36A, $FF) ; AD - Small key of Ganon's Tower
%ReceiptProps($AE, -4, 4, $0F, 0, $04, $F36A, $FF) ; AE - Reserved
%ReceiptProps($AF, -4, 4, $0F, 0, $04, $F36A, $FF) ; AF - Generic small key
%ReceiptProps($B0, -4, 0, $49, 2, $04, $F36A, $FF) ; B0 -
%ReceiptProps($B1, -4, 0, $49, 2, $04, $F36A, $FF) ; B1 -
%ReceiptProps($B2, -4, 0, $49, 2, $04, $F36A, $FF) ; B2 -
%ReceiptProps($B3, -4, 0, $49, 2, $04, $F36A, $FF) ; B3 -
%ReceiptProps($B4, -4, 0, $49, 2, $04, $F36A, $FF) ; B4 -
%ReceiptProps($B5, -4, 0, $49, 2, $04, $F36A, $FF) ; B5 -
%ReceiptProps($B6, -4, 0, $49, 2, $04, $F36A, $FF) ; B6 -
%ReceiptProps($B7, -4, 0, $49, 2, $04, $F36A, $FF) ; B7 -
%ReceiptProps($B8, -4, 0, $49, 2, $04, $F36A, $FF) ; B8 -
%ReceiptProps($B9, -4, 0, $49, 2, $04, $F36A, $FF) ; B9 -
%ReceiptProps($BA, -4, 0, $49, 2, $04, $F36A, $FF) ; BA -
%ReceiptProps($BB, -4, 0, $49, 2, $04, $F36A, $FF) ; BB -
%ReceiptProps($BC, -4, 0, $49, 2, $04, $F36A, $FF) ; BC -
%ReceiptProps($BD, -4, 0, $49, 2, $04, $F36A, $FF) ; BD -
%ReceiptProps($BE, -4, 0, $49, 2, $04, $F36A, $FF) ; BE -
%ReceiptProps($BF, -4, 0, $49, 2, $04, $F36A, $FF) ; BF -
%ReceiptProps($C0, -4, 0, $49, 2, $04, $F36A, $FF) ; C0 -
%ReceiptProps($C1, -4, 0, $49, 2, $04, $F36A, $FF) ; C1 -
%ReceiptProps($C2, -4, 0, $49, 2, $04, $F36A, $FF) ; C2 -
%ReceiptProps($C3, -4, 0, $49, 2, $04, $F36A, $FF) ; C3 -
%ReceiptProps($C4, -4, 0, $49, 2, $04, $F36A, $FF) ; C4 -
%ReceiptProps($C5, -4, 0, $49, 2, $04, $F36A, $FF) ; C5 -
%ReceiptProps($C6, -4, 0, $49, 2, $04, $F36A, $FF) ; C6 -
%ReceiptProps($C7, -4, 0, $49, 2, $04, $F36A, $FF) ; C7 -
%ReceiptProps($C8, -4, 0, $49, 2, $04, $F36A, $FF) ; C8 -
%ReceiptProps($C9, -4, 0, $49, 2, $04, $F36A, $FF) ; C9 -
%ReceiptProps($CA, -4, 0, $49, 2, $04, $F36A, $FF) ; CA -
%ReceiptProps($CB, -4, 0, $49, 2, $04, $F36A, $FF) ; CB -
%ReceiptProps($CC, -4, 0, $49, 2, $04, $F36A, $FF) ; CC -
%ReceiptProps($CD, -4, 0, $49, 2, $04, $F36A, $FF) ; CD -
%ReceiptProps($CE, -4, 0, $49, 2, $04, $F36A, $FF) ; CE -
%ReceiptProps($CF, -4, 0, $49, 2, $04, $F36A, $FF) ; CF -
%ReceiptProps($D0, -4, 0, $49, 2, $04, $F36A, $FF) ; D0 -
%ReceiptProps($D1, -4, 0, $49, 2, $04, $F36A, $FF) ; D1 -
%ReceiptProps($D2, -4, 0, $49, 2, $04, $F36A, $FF) ; D2 -
%ReceiptProps($D3, -4, 0, $49, 2, $04, $F36A, $FF) ; D3 -
%ReceiptProps($D4, -4, 0, $49, 2, $04, $F36A, $FF) ; D4 -
%ReceiptProps($D5, -4, 0, $49, 2, $04, $F36A, $FF) ; D5 -
%ReceiptProps($D6, -4, 0, $49, 2, $04, $F36A, $FF) ; D6 -
%ReceiptProps($D7, -4, 0, $49, 2, $04, $F36A, $FF) ; D7 -
%ReceiptProps($D8, -4, 0, $49, 2, $04, $F36A, $FF) ; D8 -
%ReceiptProps($D9, -4, 0, $49, 2, $04, $F36A, $FF) ; D9 -
%ReceiptProps($DA, -4, 0, $49, 2, $04, $F36A, $FF) ; DA -
%ReceiptProps($DB, -4, 0, $49, 2, $04, $F36A, $FF) ; DB -
%ReceiptProps($DC, -4, 0, $49, 2, $04, $F36A, $FF) ; DC -
%ReceiptProps($DD, -4, 0, $49, 2, $04, $F36A, $FF) ; DD -
%ReceiptProps($DE, -4, 0, $49, 2, $04, $F36A, $FF) ; DE -
%ReceiptProps($DF, -4, 0, $49, 2, $04, $F36A, $FF) ; DF -
%ReceiptProps($E0, -4, 0, $49, 2, $04, $F36A, $FF) ; E0 -
%ReceiptProps($E1, -4, 0, $49, 2, $04, $F36A, $FF) ; E1 -
%ReceiptProps($E2, -4, 0, $49, 2, $04, $F36A, $FF) ; E2 -
%ReceiptProps($E3, -4, 0, $49, 2, $04, $F36A, $FF) ; E3 -
%ReceiptProps($E4, -4, 0, $49, 2, $04, $F36A, $FF) ; E4 -
%ReceiptProps($E5, -4, 0, $49, 2, $04, $F36A, $FF) ; E5 -
%ReceiptProps($E6, -4, 0, $49, 2, $04, $F36A, $FF) ; E6 -
%ReceiptProps($E7, -4, 0, $49, 2, $04, $F36A, $FF) ; E7 -
%ReceiptProps($E8, -4, 0, $49, 2, $04, $F36A, $FF) ; E8 -
%ReceiptProps($E9, -4, 0, $49, 2, $04, $F36A, $FF) ; E9 -
%ReceiptProps($EA, -4, 0, $49, 2, $04, $F36A, $FF) ; EA -
%ReceiptProps($EB, -4, 0, $49, 2, $04, $F36A, $FF) ; EB -
%ReceiptProps($EC, -4, 0, $49, 2, $04, $F36A, $FF) ; EC -
%ReceiptProps($ED, -4, 0, $49, 2, $04, $F36A, $FF) ; ED -
%ReceiptProps($EE, -4, 0, $49, 2, $04, $F36A, $FF) ; EE -
%ReceiptProps($EF, -4, 0, $49, 2, $04, $F36A, $FF) ; EF -
%ReceiptProps($F0, -4, 0, $49, 2, $04, $F36A, $FF) ; F0 -
%ReceiptProps($F1, -4, 0, $49, 2, $04, $F36A, $FF) ; F1 -
%ReceiptProps($F2, -4, 0, $49, 2, $04, $F36A, $FF) ; F2 -
%ReceiptProps($F3, -4, 0, $49, 2, $04, $F36A, $FF) ; F3 -
%ReceiptProps($F4, -4, 0, $49, 2, $04, $F36A, $FF) ; F4 -
%ReceiptProps($F5, -4, 0, $49, 2, $04, $F36A, $FF) ; F5 -
%ReceiptProps($F6, -4, 0, $49, 2, $04, $F36A, $FF) ; F6 -
%ReceiptProps($F7, -4, 0, $49, 2, $04, $F36A, $FF) ; F7 -
%ReceiptProps($F8, -4, 0, $49, 2, $04, $F36A, $FF) ; F8 -
%ReceiptProps($F9, -4, 0, $49, 2, $04, $F36A, $FF) ; F9 -
%ReceiptProps($FA, -4, 0, $49, 2, $04, $F36A, $FF) ; FA -
%ReceiptProps($FB, -4, 0, $49, 2, $04, $F36A, $FF) ; FB -
%ReceiptProps($FC, -4, 0, $49, 2, $04, $F36A, $FF) ; FC -
%ReceiptProps($FD, -4, 0, $49, 2, $04, $F36A, $FF) ; FD -
%ReceiptProps($FE, -4, 0, $49, 2, $04, $F36A, $FF) ; FE - Server request (async)
%ReceiptProps($FF, -4, 0, $49, 2, $04, $F36A, $FF) ; FF -
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
BottleListExpanded: BottleListExpanded:
db $16, $2B, $2C, $2D, $3D, $3C, $48 db $16, $2B, $2C, $2D, $3D, $3C, $48
@@ -1021,14 +998,14 @@ AttemptItemSubstitution:
- -
LDA.l ItemSubstitutionRules, X LDA.l ItemSubstitutionRules, X
CMP.b #$FF : BEQ .exit CMP.b #$FF : BEQ .exit
CMP.b 1,s : BNE .noMatch CMP.b 1,S : BNE .noMatch
.match .match
PHX PHX
TXA : LSR #2 : TAX TXA : LSR #2 : TAX
LDA.l ItemLimitCounts, X LDA.l ItemLimitCounts, X
PLX PLX
CMP.l ItemSubstitutionRules+1, X : !BLT + CMP.l ItemSubstitutionRules+1, X : !BLT +
LDA.l ItemSubstitutionRules+2, X : STA.b 1,s LDA.l ItemSubstitutionRules+2, X : STA.b 1,S
+: BEQ .exit +: BEQ .exit
.noMatch .noMatch
INX #4 INX #4

View File

@@ -51,19 +51,21 @@ ItemCheck_TreeKid:
RTL RTL
ItemCheck_TreeKid2: ItemCheck_TreeKid2:
LDA.l NpcFlags : AND.b #$08 : LSR #$02 ; FluteAardvark_InitialStateFromFluteState - 225: LDA FluteEquipment : AND.b #$03 LDA.l NpcFlags : AND.b #$08 : CMP.b #$08 ; FluteAardvark_InitialStateFromFluteState - 225: LDA FluteEquipment : AND.b #$03
RTL RTL
ItemCheck_TreeKid3: ItemCheck_TreeKid3:
JSL $0DD030 ; FluteAardvark_Draw - thing we wrote over JSL $0DD030 ; FluteAardvark_Draw - thing we wrote over
LDA.l NpcFlags : AND.b #$08 LDA.l NpcFlags : AND.b #$08
BEQ .normal BNE .done
BRA .done
LDA.b #$05 LDA.b #$05
.normal
.normal
LDA.w SpriteActivity, X LDA.w SpriteActivity, X
.done
RTL .done
RTL
ItemCheck_Sahasrala: ItemCheck_Sahasrala:
LDA.l NpcFlags : AND.b #$10 LDA.l NpcFlags : AND.b #$10
@@ -74,7 +76,7 @@ ItemCheck_Library:
RTL RTL
ItemCheck_Mushroom: ItemCheck_Mushroom:
LDA.l NpcFlags+1 : ROL #4 ; does the same thing as below LDA.l NpcFlags+1 : AND.b #$10 : CMP.b #$10 ; does the same thing as below
RTL RTL
ItemCheck_Powder: ItemCheck_Powder:

16
ram.asm
View File

@@ -186,6 +186,8 @@ RaceGameFlag = $7E021B ;
; ;
MessageJunk = $7E0223 ; Zeroed but never used (?) MessageJunk = $7E0223 ; Zeroed but never used (?)
; ;
CoolScratch = $7E0224 ; 0x5C bytes of free ram
;
ItemReceiptID = $7E02D8 ; ItemReceiptID = $7E02D8 ;
ItemReceiptPose = $7E02DA ; $00 = No pose | $01 = One hand up | $02 = Two hands up ItemReceiptPose = $7E02DA ; $00 = No pose | $01 = One hand up | $02 = Two hands up
; ;
@@ -264,6 +266,12 @@ OWScreenSize = $7E0712 ; Flags overworld screen size.
; ;
OWTransitionFlag = $7E0ABF ; Used for certain transitions like smith, witch, etc. OWTransitionFlag = $7E0ABF ; Used for certain transitions like smith, witch, etc.
; ;
ItemGFXPtr = $7E0AFA ; Pointer for item receipt graphics transfers
; $0000 - no transfer, do nothing
; bit 7 reset - offset into ROM table
; bit 7 set - explicit bank7 address
ItemGFXTgt = $7E0AFC ; target VRAM address
;
ArcVariable = $7E0B08 ; Arc variable. Word length. ArcVariable = $7E0B08 ; Arc variable. Word length.
OverlordXLow = $7E0B08 ; $08 bytes. OverlordXLow = $7E0B08 ; $08 bytes.
OverlordXHigh = $7E0B10 ; $08 bytes. OverlordXHigh = $7E0B10 ; $08 bytes.
@@ -381,6 +389,8 @@ ScratchBufferV = $7E1EB0 ; Volatile scratch buffer. Can clobber at will
TileUploadBuffer = $7EA180 ; 0x300 bytes TileUploadBuffer = $7EA180 ; 0x300 bytes
; ;
ItemGetGFX = $7EBD40 ; Item receipt graphics location
;
RoomFade = $7EC005 ; Flags fade to black on room transitions. Word length. RoomFade = $7EC005 ; Flags fade to black on room transitions. Word length.
FadeTimer = $7EC007 ; Timer for transition fading and mosaics. Word length. FadeTimer = $7EC007 ; Timer for transition fading and mosaics. Word length.
FadeDirection = $7EC009 ; Word length FadeDirection = $7EC009 ; Word length
@@ -445,6 +455,9 @@ BigRAM = $7EC900 ; Big buffer of free ram (0x1F00)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DecompressionBuffer = $7F0000 ; Decompression Buffer. $2000 bytes. DecompressionBuffer = $7F0000 ; Decompression Buffer. $2000 bytes.
DecompBuffer2 = $7F4000 ; Another buffer
base $7F5000 base $7F5000
RedrawFlag: skip 1 ; RedrawFlag: skip 1 ;
skip 2 ; Unused skip 2 ; Unused
@@ -554,6 +567,9 @@ DialogBuffer: skip $100 ; Dialog Buffer
PrivateBlockWRAM = $7F7700 ; Reserved for 3rd party use. $500 bytes. PrivateBlockWRAM = $7F7700 ; Reserved for 3rd party use. $500 bytes.
; See also: $200 bytes at PrivateBlockPersistent, copied to SRAM. ; See also: $200 bytes at PrivateBlockPersistent, copied to SRAM.
BigDecompressionBuffer = $7F8000 ; Reserved for large gfx decompression buffer. $5000 bytes. BigDecompressionBuffer = $7F8000 ; Reserved for large gfx decompression buffer. $5000 bytes.
; KEEP THIS AT $8000+
; its location at an address with bit 7 set is used for detecting
; ROM location versus RAM locations
; ;
MiniGameTime = $7FFE00 ; Time spent in mini game. 32-bits. MiniGameTime = $7FFE00 ; Time spent in mini game. 32-bits.
MiniGameTimeFinal = $7FFE04 ; Final mini game time. 32 bits. MiniGameTimeFinal = $7FFE04 ; Final mini game time. 32 bits.

View File

@@ -1061,13 +1061,22 @@ org $308358
AllowAccidentalMajorGlitch: AllowAccidentalMajorGlitch:
db $00 db $00
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; GFX pointer (0x180359 - 0x18035B) ; GFX pointers (0x180359 - 0x18035B)
; For 3rd party sprite stuff ; For 3rd party sprite stuff
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $308359 org $308359
dl GfxPalettes dl GfxPalettes
org $30835C
dl ItemReceiptGraphicsOffsets
org $30835F
dl ItemReceiptGraphicsOffsets
; reserving up to 7F for more pointers as needed
;================================================================================ ;================================================================================
; 0x18035C - 0x1814FF (unused) ; 0x180380 - 0x1814FF (unused)
;================================================================================ ;================================================================================
; $309500 (0x181500) - $309FFF (0x181FFF) original 0x39C bytes ; $309500 (0x181500) - $309FFF (0x181FFF) original 0x39C bytes
; Replacement Ending Sequence Text Data ; Replacement Ending Sequence Text Data
@@ -1430,14 +1439,14 @@ db $04
;org $06B2AA ; <- 332AA sprite_smithy_bros.asm : 152 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing) ;org $06B2AA ; <- 332AA sprite_smithy_bros.asm : 152 (JSL Sprite_ShowSolicitedMessageIfPlayerFacing)
;JSL Sprite_ShowMessageFromPlayerContact ; Inverted uses Sprite_ShowMessageFromPlayerContact ;JSL Sprite_ShowMessageFromPlayerContact ; Inverted uses Sprite_ShowMessageFromPlayerContact
;;--------------------------------------------------------------------------------- ;;---------------------------------------------------------------------------------
org $00886e ; <- Bank00.asm : 1050 (LDA Overworld_TileAttr, X) org $00886E ; <- Bank00.asm : 1050 (LDA Overworld_TileAttr, X)
LDA.l Overworld_TileAttr, X ; use "JML InvertedTileAttributeLookup" for inverted LDA.l Overworld_TileAttr, X ; use "JML InvertedTileAttributeLookup" for inverted
Overworld_GetTileAttrAtLocation_continue: Overworld_GetTileAttrAtLocation_continue:
;================================================================================ ;================================================================================
org $0DDBEC ; <- 6DBEC org $0DDBEC ; <- 6DBEC
dw #10000 ; Rupee Limit +1 dw 10000 ; Rupee Limit +1
org $0DDBF1 ; <- 6DBF1 org $0DDBF1 ; <- 6DBF1
dw #9999 ; Rupee Limit dw 9999 ; Rupee Limit
;================================================================================ ;================================================================================
;2B:Bottle Already Filled w/ Red Potion ;2B:Bottle Already Filled w/ Red Potion
;2C:Bottle Already Filled w/ Green Potion ;2C:Bottle Already Filled w/ Green Potion

View File

@@ -92,7 +92,7 @@ IsMedallion:
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
LoadNarrowObject: LoadNarrowObject:
LDA.l AddReceivedItemExpanded_wide_item_flag, X : STA.b ($92), Y ; AddReceiveItem.wide_item_flag? LDA.l ItemReceipts_width, X : STA.b ($92), Y ; AddReceiveItem.wide_item_flag?
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CheckTabletItem: CheckTabletItem:

View File

@@ -35,120 +35,134 @@ GetSpriteID:
.normal .normal
PHX PHX
PHB : PHK : PLB TAX : LDA.l ItemReceipts_graphics, X ; look up item gfx
;-------- PLX
TAX : LDA.l .gfxSlots, X ; look up item gfx CMP.b #$F8 : !BGE .special_handling
PLB : PLX
CMP.b #$F8 : !BGE .specialHandling
RTL
.specialHandling
CMP.b #$F9 : BNE ++ ; Progressive Magic
LDA.l MagicConsumption : BNE +++
LDA.b #$3B : RTL ; Half Magic
+++
LDA.b #$3C : RTL ; Quarter Magic
++ CMP.b #$FA : BNE ++ ; RNG Item (Single)
JSL.l GetRNGItemSingle : JMP GetSpriteID
++ CMP.b #$FB : BNE ++ ; RNG Item (Multi)
JSL.l GetRNGItemMulti : JMP GetSpriteID
++ CMP.b #$FD : BNE ++ ; Progressive Armor
LDA.l ArmorEquipment : CMP.l ProgressiveArmorLimit : !BLT + ; Progressive Armor Limit
LDA.l ProgressiveArmorReplacement
JMP GetSpriteID
+
LDA.b #$04 : RTL
++ CMP.b #$FE : BNE ++ ; Progressive Sword
LDA.l HighestSword
CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit
LDA.l ProgressiveSwordReplacement
JMP GetSpriteID
+ : CMP.b #$00 : BNE + ; No Sword
LDA.b #$43 : RTL
+ : CMP.b #$01 : BNE + ; Fighter Sword
LDA.b #$44 : RTL
+ : CMP.b #$02 : BNE + ; Master Sword
LDA.b #$45 : RTL
+ ; CMP.b #$03 : BNE + ; Tempered Sword
LDA.b #$46 : RTL
+
++ : CMP.b #$FF : BNE ++ ; Progressive Shield
LDA.l HighestShield
CMP.l ProgressiveShieldLimit : !BLT + ; Progressive Shield Limit
LDA.l ProgressiveShieldReplacement
JMP GetSpriteID
+ : CMP.b #$00 : BNE + ; No Shield
LDA.b #$2D : RTL
+ : CMP.b #$01 : BNE + ; Fighter Shield
LDA.b #$20 : RTL
+ ; Everything Else
LDA.b #$2E : RTL
++ : CMP.b #$F8 : BNE ++ ; Progressive Bow
LDA.l BowEquipment : INC : LSR
CMP.l ProgressiveBowLimit : !BLT +
LDA.l ProgressiveBowReplacement
JMP GetSpriteID
+ : CMP.b #$00 : BNE + ; No Bow
LDA.b #$29 : RTL
+ ; Any Bow
LDA.b #$2A : RTL
++
RTL RTL
;DATA - Loot Identifier to Sprite ID ;---------------------------------------------------------------------------------------------------
{
.gfxSlots
db $06, $44, $45, $46, $2D, $20, $2E, $09
db $09, $0A, $08, $05, $10, $0B, $2C, $1B
db $1A, $1C, $14, $19, $0C, $07, $1D, $2F .special_handling
db $07, $15, $12, $0D, $0D, $0E, $11, $17 PHX
AND.b #$07
ASL
TAX
db $28, $27, $04, $04, $0F, $16, $03, $13 REP #$20
db $01, $1E, $10, $00, $00, $00, $00, $00 LDA.l .handlers,X
db $00, $30, $22, $21, $24, $24, $24, $23 PLX
db $23, $23, $29, $2A, $2C, $2B, $03, $03 PHA
db $34, $35, $31, $33, $02, $32, $36, $37 SEP #$20
db $2C, $43, $0C, $38, $39, $3A, $F9, $3C RTS
; db $2C, $06, $0C, $38, $FF, $FF, $FF, $FF
;5x .handlers
db $44 ; Safe Master Sword dw .handler_F8-1
db $3D, $3E, $3F, $40 ; Bomb & Arrow +5/+10 dw .handler_F9-1
db $2C, $00, $00 ; 3x Programmable Item dw .handler_FA-1
db $41 ; Upgrade-Only Silver Arrows dw .handler_FB-1
db $24 ; 1 Rupoor dw .handler_FC-1
db $47 ; Null Item dw .handler_FD-1
db $48, $48, $48 ; Red, Blue & Green Clocks dw .handler_FE-1
db $FE, $FF ; Progressive Sword & Shield dw .handler_FF-1
;6x ;---------------------------------------------------------------------------------------------------
db $FD, $0D ; Progressive Armor & Gloves
db $FA, $FB ; RNG Single & Multi
db $F8, $F8 ; Progressive Bow x2
db $FF, $FF, $FF, $FF ; Unused
db $49, $4A, $49 ; Goal Item Single, Multi & Alt Multi
db $39, $39, $39 ; Server Request F0, F1, F2
;7x .handler_F8
db $21, $21, $21, $21, $21, $21, $21, $21, $21, $21, $21, $21, $21, $21, $21, $21 ; Free Map LDA.l BowEquipment
INC
LSR
CMP.l ProgressiveBowLimit
BCC ++
;8x LDA.l ProgressiveBowReplacement
db $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16, $16 ; Free Compass JMP GetSpriteID
;9x ++ CMP.b #$00
db $22, $22, $22, $22, $22, $22, $22, $22, $22, $22, $22, $22, $22, $22, $22, $22 ; Free Big Key LDA.b #$29
ADC.b #$00
RTL
;Ax ;---------------------------------------------------------------------------------------------------
db $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F ; Free Small Key
.handler_F9
LDA.l MagicConsumption
CMP.b #$00
LDA.b #$3B
ADC.b #$00
RTL
;---------------------------------------------------------------------------------------------------
.handler_FA
JSL GetRNGItemSingle
JMP GetSpriteID
;---------------------------------------------------------------------------------------------------
.handler_FB
JSL GetRNGItemMulti
JMP GetSpriteID
;---------------------------------------------------------------------------------------------------
.handler_FC
RTL
;---------------------------------------------------------------------------------------------------
.handler_FD
LDA.l ArmorEquipment
CMP.l ProgressiveArmorLimit
BCC ++
LDA.l ProgressiveArmorReplacement
JMP GetSpriteID
++ LDA.b #$04
RTL
;---------------------------------------------------------------------------------------------------
.handler_FE
LDA.l HighestSword
CMP.l ProgressiveSwordLimit
BCC ++
LDA.l ProgressiveSwordReplacement
JMP GetSpriteID
; 00 => 43
; 01 => 44
; 02 => 45
; 03 => 46
++ ADC.b #$43
RTL
;---------------------------------------------------------------------------------------------------
.handler_FF
LDA.l HighestShield
CMP.l ProgressiveShieldLimit
BCC ++
LDA.l ProgressiveShieldReplacement
JMP GetSpriteID
++ CMP.b #$01 ; no shield
BEQ .fighter_shield ; if exactly 1
; if 0 => 2D (carry is clear)
; all others are 2E (carry set for +1)
LDA.b #$2D
ADC.b #$00
RTL
.fighter_shield
LDA.b #$20
RTL
db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused
db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused
db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused
db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused
db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Reserved
}
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -173,67 +187,159 @@ GetSpritePalette:
+ +
PLA : .notBottle PLA : .notBottle
PHX PHX
PHB : PHK : PLB
;--------
TAX : LDA.l GfxPalettes, X ; look up item gfx TAX : LDA.l GfxPalettes, X ; look up item gfx
PLB : PLX PLX
CMP.b #$F8 : !BGE .specialHandling CMP.b #$F8 : !BGE .special_handling
RTL
.specialHandling
CMP.b #$FD : BNE ++ ; Progressive Sword
LDA.l HighestSword
CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit
LDA.l ProgressiveSwordReplacement
JMP GetSpritePalette
+ : CMP.b #$00 : BNE + ; No Sword
LDA.b #$04 : RTL
+ : CMP.b #$01 : BNE + ; Fighter Sword
LDA.b #$04 : RTL
+ : CMP.b #$02 : BNE + ; Master Sword
LDA.b #$02 : RTL
+ ; Everything Else
LDA.b #$08 : RTL
++ : CMP.b #$FE : BNE ++ ; Progressive Shield
LDA.l HighestShield
CMP.l ProgressiveShieldLimit : !BLT + ; Progressive Shield Limit
LDA.l ProgressiveShieldReplacement
JMP GetSpritePalette
+ : CMP.b #$00 : BNE + ; No Shield
LDA.b #$04 : RTL
+ : CMP.b #$01 : BNE + ; Fighter Shield
LDA.b #$02 : RTL
+ ; Everything Else
LDA.b #$08 : RTL
++ : CMP.b #$FF : BNE ++ ; Progressive Armor
LDA.l HighestMail
CMP.l ProgressiveArmorLimit : !BLT + ; Progressive Armor Limit
LDA.l ProgressiveArmorReplacement
JMP GetSpritePalette
+ : CMP.b #$00 : BNE + ; Green Tunic
LDA.b #$04 : RTL
+ ; Everything Else
LDA.b #$02 : RTL
++ : CMP.b #$FC : BNE ++ ; Progressive Gloves
LDA.l GloveEquipment : BNE + ; No Gloves
LDA.b #$02 : RTL
+ ; Everything Else
LDA.b #$08 : RTL
++ : CMP.b #$F8 : BNE ++ ; Progressive Bow
LDA.l BowEquipment : INC : LSR
CMP.l ProgressiveBowLimit : !BLT +
LDA.l ProgressiveBowReplacement
JMP GetSpritePalette
+ : CMP.b #$00 : BNE + ; No Bow
LDA.b #$08 : RTL
+ ; Any Bow
LDA.b #$02 : RTL
++ : CMP.b #$FA : BNE ++ ; RNG Item (Single)
JSL.l GetRNGItemSingle : JMP GetSpritePalette
++ : CMP.b #$FB : BNE ++ ; RNG Item (Multi)
JSL.l GetRNGItemMulti : JMP GetSpritePalette
++
RTL RTL
;---------------------------------------------------------------------------------------------------
.special_handling
PHX
AND.b #$07
ASL
TAX
REP #$20
LDA.l .handlers,X
PLX
PHA
SEP #$20
RTS
.handlers
dw .handler_F8-1
dw .handler_F9-1
dw .handler_FA-1
dw .handler_FB-1
dw .handler_FC-1
dw .handler_FD-1
dw .handler_FE-1
dw .handler_FF-1
;---------------------------------------------------------------------------------------------------
.handler_F8
LDA.l BowEquipment
INC
LSR
CMP.l ProgressiveBowLimit
BCC ++
LDA.l ProgressiveBowReplacement
JMP GetSpritePalette
++ CMP.b #$00
BNE ++
LDA.b #$08
RTL
++ LDA.b #$02
RTL
LDA.b #$29
ADC.b #$00
RTL
;---------------------------------------------------------------------------------------------------
.handler_F9
RTL
;---------------------------------------------------------------------------------------------------
.handler_FA
JSL GetRNGItemSingle
JMP GetSpritePalette
;---------------------------------------------------------------------------------------------------
.handler_FB
JSL GetRNGItemMulti
JMP GetSpritePalette
;---------------------------------------------------------------------------------------------------
.handler_FC
LDA.l GloveEquipment
BNE ++
LDA.b #$02
RTL
++ LDA.b #$08
RTL
;---------------------------------------------------------------------------------------------------
.handler_FD
LDA.l HighestSword
CMP.l ProgressiveSwordLimit
BCC ++
LDA.l ProgressiveSwordReplacement
JMP GetSpritePalette
; 00 => 04
; 01 => 04
; 02 => 02
; 03 => 08
++ CMP.b #$02
BEQ ++ ; 2 exits with 2
LDA.b #$04
BCC ++ ; 0 or 1 get 4
; everything else is 8
ASL
++ RTL
;---------------------------------------------------------------------------------------------------
.handler_FE
LDA.l HighestShield
CMP.l ProgressiveShieldLimit
BCC ++
LDA.l ProgressiveShieldReplacement
JMP GetSpritePalette
; 0 => 4
; 1 => 2
; 2 => 8
++ CMP.b #$01 ; no shield
BEQ .fighter_shield ; if exactly 1, ASL for 2
LDA.b #$04 ; load 4 for 0
BCC ++ ; exit if < 1, otherwise, ASL for 8
.fighter_shield
ASL
++ RTL
;---------------------------------------------------------------------------------------------------
.handler_FF
LDA.l ArmorEquipment
CMP.l ProgressiveArmorLimit
BCC ++
LDA.l ProgressiveArmorReplacement
JMP GetSpritePalette
++ CMP.b #$01 ; carry set means nonzero
LDA.b #$02
BCS ++ ; nonzero gets 2
ASL ; ASL for 4 if zero
++ RTL
;---------------------------------------------------------------------------------------------------
;DATA - Loot Identifier to Sprite Palette ;DATA - Loot Identifier to Sprite Palette
{ {
GfxPalettes: GfxPalettes:
@@ -375,7 +481,8 @@ PrepDynamicTile:
PHA : PHX : PHY PHA : PHX : PHY
JSR.w LoadDynamicTileOAMTable JSR.w LoadDynamicTileOAMTable
JSL.l GetSpriteID ; convert loot id to sprite id JSL.l GetSpriteID ; convert loot id to sprite id
JSL.l GetAnimatedSpriteTile_variable ;JSL.l GetAnimatedSpriteTile_variable
JSL TransferItemReceiptToBuffer_using_GraphicsID
PLY : PLX : PLA PLY : PLX : PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -501,13 +608,13 @@ RTL
; out: Carry - 1 = On Screen, 0 = Off Screen ; out: Carry - 1 = On Screen, 0 = Off Screen
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
Sprite_IsOnscreen: Sprite_IsOnscreen:
JSR _Sprite_IsOnscreen_DoWork JSR .check_sprite
BCS + BCS +
REP #$20 REP #$20
LDA.b BG2H : PHA : !SUB.w #$0F : STA.b BG2H LDA.b BG2H : PHA : !SUB.w #$0F : STA.b BG2H
LDA.b BG2V : PHA : !SUB.w #$0F : STA.b BG2V LDA.b BG2V : PHA : !SUB.w #$0F : STA.b BG2V
SEP #$20 SEP #$20
JSR _Sprite_IsOnscreen_DoWork JSR .check_sprite
REP #$20 REP #$20
PLA : STA.b BG2V PLA : STA.b BG2V
PLA : STA.b BG2H PLA : STA.b BG2H
@@ -515,7 +622,7 @@ Sprite_IsOnscreen:
+ +
RTL RTL
_Sprite_IsOnscreen_DoWork: .check_sprite
LDA.w SpritePosXLow, X : CMP.b BG2H LDA.w SpritePosXLow, X : CMP.b BG2H
LDA.w SpritePosXHigh, X : SBC.b BG2H+1 : BNE .offscreen LDA.w SpritePosXHigh, X : SBC.b BG2H+1 : BNE .offscreen
@@ -558,44 +665,12 @@ RTL
SkipDrawEOR: SkipDrawEOR:
LDA.l SpriteSkipEOR : BEQ .normal LDA.l SpriteSkipEOR : BEQ .normal
LDA.w #$0000 : STA.l SpriteSkipEOR LDA.w #$0000 : STA.l SpriteSkipEOR
LDA.w Scrap04 : AND.w #$F0FF : STA.w Scrap04 LDA.w #$0F00 : TRB.b Scrap04
.normal .normal
LDA.b ($08), Y : EOR.w Scrap04 ; thing we wrote over LDA.b ($08), Y : EOR.w Scrap04 ; thing we wrote over
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; HexToDec
; in: A(w) - Word to Convert
; out: HexToDecDigit1 - HexToDecDigit5 (high - low)
;--------------------------------------------------------------------------------
HexToDec:
PHA
PHA
LDA.w #$9090
STA.b Scrap04 : STA.b Scrap06 ; temporarily store our decimal values here for speed
PLA
-
CMP.w #1000 : !BLT +
INC.b Scrap04
!SUB.w #1000 : BRA -
+ -
CMP.w #100 : !BLT +
INC.b Scrap05
!SUB.w #100 : BRA -
+ -
CMP.w #10 : !BLT +
INC.b Scrap06
!SUB.w #10 : BRA -
+ -
CMP.w #1 : !BLT +
INC.b Scrap07
!SUB.w #1 : BRA -
+
LDA.b Scrap04 : STA.l HexToDecDigit2 ; move to digit storage
LDA.b Scrap06 : STA.l HexToDecDigit4
PLA
RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; CountBits ; CountBits