HUD disassemblies
Zeldix :: Zelda III Hacking :: Workshop
Page 1 of 1
HUD disassemblies
I was going to put these up sometime after i'm done with Parallel Universe.
Note this is pure disassembly, for what the actual memory address does refer to a variable listing document by MathOnNapkins (should be somewhere).
The basic concept for HUD is - tiles (in the snes vhoppptt tttttttt format) are written in 7EC700 - 7EC84F (for play screen) and 1100 to 177F (for subscreen)
For the playscreen there's some code already which performs a memory move (MVN) instruction from a set memory address (6Fxxx in the rom or around there somwhere) - this paints the "base" which includes most of the graphics (magic meter border, rupee symbols etc) - also the place which the HUD editor which was around edits mostly. For everything else, custom assembly/code is written to put the right tile values in those memory addresses before the screen refresh occurs (also known as the NMI interrupt). You'll also notice the tile list doesn't go to the bottom of the playscreen - the original developers only used memory up to the end of the bottom right corner of the magic meter.
For the subscreen all components are done via assembly/code.
Note this is pure disassembly, for what the actual memory address does refer to a variable listing document by MathOnNapkins (should be somewhere).
The basic concept for HUD is - tiles (in the snes vhoppptt tttttttt format) are written in 7EC700 - 7EC84F (for play screen) and 1100 to 177F (for subscreen)
For the playscreen there's some code already which performs a memory move (MVN) instruction from a set memory address (6Fxxx in the rom or around there somwhere) - this paints the "base" which includes most of the graphics (magic meter border, rupee symbols etc) - also the place which the HUD editor which was around edits mostly. For everything else, custom assembly/code is written to put the right tile values in those memory addresses before the screen refresh occurs (also known as the NMI interrupt). You'll also notice the tile list doesn't go to the bottom of the playscreen - the original developers only used memory up to the end of the bottom right corner of the magic meter.
For the subscreen all components are done via assembly/code.
HUD screen disassembly details
Euclid
23/5/2012
This it the start of the routine which redraws the screen every frame.
$0D/DD21 20 94 FB JSR $FB94 [$0D:FB94]
This one is for the coming back from start. Note the addresses are so close!
$0D/FA8A 20 91 FB JSR $FB91 [$0D:FB91]
Now here's the routine to draw HUD:
$0D/FB91 20 FD FA JSR $FAFD [$00:FAFD] ; first routine, NOT being reused on a redraw, draws misc items, details later.
$0D/FB94 E2 30 SEP #$30 ; from here onwards the code is being reused on a redraw
$0D/FB96 A9 FD LDA #$FD
$0D/FB98 85 0A STA $0A [$00:000A]
$0D/FB9A A9 F9 LDA #$F9
$0D/FB9C 85 0B STA $0B [$00:000B]
$0D/FB9E A9 0D LDA #$0D
$0D/FBA0 85 0C STA $0C [$00:000C] ; Note 0DF9FD - graphic address
$0D/FBA2 A9 68 LDA #$68
$0D/FBA4 85 07 STA $07 [$00:0007]
$0D/FBA6 A9 C7 LDA #$C7
$0D/FBA8 85 08 STA $08 [$00:0008]
$0D/FBAA A9 7E LDA #$7E
$0D/FBAC 85 09 STA $09 [$00:0009] ; target start addr 0x7EC768
$0D/FBAE C2 30 REP #$30
$0D/FBB0 AF 6C F3 7E LDA $7EF36C[$7E:F36C]
$0D/FBB4 29 FF 00 AND #$00FF
$0D/FBB7 85 00 STA $00 [$00:0000]
$0D/FBB9 85 02 STA $02 [$00:0002]
$0D/FBBB 85 04 STA $04 [$00:0004]
$0D/FBBD 20 AB FD JSR $FDAB [$00:FDAB] ; this draws the HP "base" in the location (for details on the loop seelater)
$0D/FBC0 E2 30 SEP #$30
$0D/FBC2 A9 03 LDA #$03
$0D/FBC4 85 0A STA $0A [$00:000A]
$0D/FBC6 A9 FA LDA #$FA
$0D/FBC8 85 0B STA $0B [$00:000B]
$0D/FBCA A9 0D LDA #$0D
$0D/FBCC 85 0C STA $0C [$00:000C] ; Note 0DFA03 - graphic address
$0D/FBCE A9 68 LDA #$68
$0D/FBD0 85 07 STA $07 [$00:0007]
$0D/FBD2 A9 C7 LDA #$C7
$0D/FBD4 85 08 STA $08 [$00:0008]
$0D/FBD6 A9 7E LDA #$7E
$0D/FBD8 85 09 STA $09 [$00:0009] ; target start addr 0x7EC768
$0D/FBDA AF 6C F3 7E LDA $7EF36C[$7E:F36C] ; was nintendo trying something here? i don't see the use of this lot of code at all.
$0D/FBDE CF 6D F3 7E CMP $7EF36D[$7E:F36D] ; the branches all go to the same spot
$0D/FBE2 F0 09 BEQ $09 [$FBED] ; no variables are saved
$0D/FBE4 38 SEC ; no subroutines etc.
$0D/FBE5 E9 04 SBC #$04 ; sounds like stupid code
$0D/FBE7 CF 6D F3 7E CMP $7EF36D[$7E:F36D] ; especially this CMP and branch which does nothing.
$0D/FBEB B0 00 BCS $00 [$FBED] ; end stupidness
$0D/FBED AF 6D F3 7E LDA $7EF36D[$7E:F36D]
$0D/FBF1 18 CLC
$0D/FBF2 69 03 ADC #$03
$0D/FBF4 C2 30 REP #$30
$0D/FBF6 29 FC 00 AND #$00FC
$0D/FBF9 85 00 STA $00 [$00:0000]
$0D/FBFB 85 04 STA $04 [$00:0004]
$0D/FBFD AF 6C F3 7E LDA $7EF36C[$7E:F36C]
$0D/FC01 29 FF 00 AND #$00FF
$0D/FC04 85 02 STA $02 [$00:0002]
$0D/FC06 20 AB FD JSR $FDAB [$00:FDAB] ; deja vu right? This draws the HP "colored bits" in the location.
$0D/FC09 C2 30 REP #$30
$0D/FC0B AF 7B F3 7E LDA $7EF37B[$7E:F37B]
$0D/FC0F 29 FF 00 AND #$00FF
$0D/FC12 C9 01 00 CMP #$0001
$0D/FC15 90 15 BCC $15 [$FC2C]
$0D/FC17 A9 F7 28 LDA #$28F7
$0D/FC1A 8F 04 C7 7E STA $7EC704[$7E:C704]
$0D/FC1E A9 51 28 LDA #$2851
$0D/FC21 8F 06 C7 7E STA $7EC706[$7E:C706]
$0D/FC25 A9 FA 28 LDA #$28FA
$0D/FC28 8F 08 C7 7E STA $7EC708[$7E:C708] ; this draws the 1/2 symbol on top of the magic bar.
$0D/FC2C AF 6E F3 7E LDA $7EF36E[$7E:F36E]
$0D/FC30 29 FF 00 AND #$00FF
$0D/FC33 18 CLC
$0D/FC34 69 07 00 ADC #$0007
$0D/FC37 29 F8 FF AND #$FFF8
$0D/FC3A AA TAX
$0D/FC3B BD EF FD LDA $FDEF,x[$00:FDEF]
$0D/FC3E 8F 46 C7 7E STA $7EC746[$7E:C746]
$0D/FC42 BD F1 FD LDA $FDF1,x[$00:FDF1]
$0D/FC45 8F 86 C7 7E STA $7EC786[$7E:C786]
$0D/FC49 BD F3 FD LDA $FDF3,x[$00:FDF3]
$0D/FC4C 8F C6 C7 7E STA $7EC7C6[$7E:C7C6]
$0D/FC50 BD F5 FD LDA $FDF5,x[$00:FDF5]
$0D/FC53 8F 06 C8 7E STA $7EC806[$7E:C806] ; this code here draws the magic bar, very smart by the programmers btw.
$0D/FC57 AF 62 F3 7E LDA $7EF362[$7E:F362]
$0D/FC5B 20 F7 F0 JSR $F0F7 [$00:F0F7] ; see binary_to_decimal Routine,
$0D/FC5E C2 30 REP #$30
$0D/FC60 A5 03 LDA $03 [$00:0003]
$0D/FC62 29 FF 00 AND #$00FF
$0D/FC65 09 00 24 ORA #$2400
$0D/FC68 8F 50 C7 7E STA $7EC750[$7E:C750]
$0D/FC6C A5 04 LDA $04 [$00:0004]
$0D/FC6E 29 FF 00 AND #$00FF
$0D/FC71 09 00 24 ORA #$2400
$0D/FC74 8F 52 C7 7E STA $7EC752[$7E:C752]
$0D/FC78 A5 05 LDA $05 [$00:0005]
$0D/FC7A 29 FF 00 AND #$00FF
$0D/FC7D 09 00 24 ORA #$2400
$0D/FC80 8F 54 C7 7E STA $7EC754[$7E:C754] ; this code here draws rupees.
$0D/FC84 AF 43 F3 7E LDA $7EF343[$7E:F343]
$0D/FC88 29 FF 00 AND #$00FF
$0D/FC8B 20 F7 F0 JSR $F0F7 [$00:F0F7] ; see binary_to_decimal Routine,
$0D/FC8E C2 30 REP #$30
$0D/FC90 A5 04 LDA $04 [$00:0004]
$0D/FC92 29 FF 00 AND #$00FF
$0D/FC95 09 00 24 ORA #$2400
$0D/FC98 8F 58 C7 7E STA $7EC758[$7E:C758]
$0D/FC9C A5 05 LDA $05 [$00:0005]
$0D/FC9E 29 FF 00 AND #$00FF
$0D/FCA1 09 00 24 ORA #$2400
$0D/FCA4 8F 5A C7 7E STA $7EC75A[$7E:C75A] ; this code here draws # Bombs.
$0D/FCA8 AF 77 F3 7E LDA $7EF377[$7E:F377]
$0D/FCAC 29 FF 00 AND #$00FF
$0D/FCAF 20 F7 F0 JSR $F0F7 [$00:F0F7]
$0D/FCB2 C2 30 REP #$30
$0D/FCB4 A5 04 LDA $04 [$00:0004]
$0D/FCB6 29 FF 00 AND #$00FF
$0D/FCB9 09 00 24 ORA #$2400
$0D/FCBC 8F 5E C7 7E STA $7EC75E[$7E:C75E]
$0D/FCC0 A5 05 LDA $05 [$00:0005]
$0D/FCC2 29 FF 00 AND #$00FF
$0D/FCC5 09 00 24 ORA #$2400
$0D/FCC8 8F 60 C7 7E STA $7EC760[$7E:C760] ; this code here draws # arrows.
$0D/FCCC A9 7F 00 LDA #$007F
$0D/FCCF 85 05 STA $05 [$00:0005]
$0D/FCD1 AF 6F F3 7E LDA $7EF36F[$7E:F36F]
$0D/FCD5 29 FF 00 AND #$00FF
$0D/FCD8 C9 FF 00 CMP #$00FF
$0D/FCDB F0 03 BEQ $03 [$FCE0] ; 0 keys (which is applicable to overworld) don't calculate - also means don't draw.
$0D/FCDD 20 F7 F0 JSR $F0F7 [$00:F0F7] ; see binary_to_decimal Routine,
$0D/FCE0 C2 30 REP #$30
$0D/FCE2 A5 05 LDA $05 [$00:0005]
$0D/FCE4 29 FF 00 AND #$00FF
$0D/FCE7 09 00 24 ORA #$2400
$0D/FCEA 8F 64 C7 7E STA $7EC764[$7E:C764]
$0D/FCEE C9 7F 24 CMP #$247F ; see why it set 7F into it earlier?
$0D/FCF1 D0 04 BNE $04 [$FCF7]
$0D/FCF3 8F 24 C7 7E STA $7EC724[$7E:C724] ; keys.
$0D/FCF7 E2 30 SEP #$30 ; Finished. Some very tightly packed code!
$0D/FCF9 60 RTS ; the amount of extra things you can fit into this is minimal!
; however if the subscreen is done then this becomes a lot easier
There is some bits of code scattered around which deals with HUD, here it is:
$0A/FD0C C2 30 REP #$30 ; NOTE entrance to this routine is a JMP/JSR, don't move this line.
$0A/FD0E AD A0 04 LDA $04A0 [$00:04A0]
$0A/FD11 29 FF 00 AND #$00FF
$0A/FD14 F0 7A BEQ $7A [$FD90] ; this branches to a RTL.
$0A/FD90 C2 20 REP #$20
$0A/FD92 A9 7F 00 LDA #$007F
$0A/FD95 8F F2 C7 7E STA $7EC7F2[$7E:C7F2] ; 1F!
$0A/FD99 8F 32 C8 7E STA $7EC832[$7E:C832] ; 1F!
$0A/FD9D 8F F4 C7 7E STA $7EC7F4[$7E:C7F4] ; 1F!
$0A/FDA1 8F 34 C8 7E STA $7EC834[$7E:C834] ; 1F!
$0A/FDA5 E2 30 SEP #$30
$0A/FDA7 6B RTL
$0A/FD7C B9 E0 FC LDA $FCE0,y[$0A:FCE4]
$0A/FD7F 9F F2 C7 7E STA $7EC7F2,x[$7E:C7F4]
$0A/FD83 B9 F6 FC LDA $FCF6,y[$0A:FCFA]
$0A/FD86 9F 32 C8 7E STA $7EC832,x[$7E:C834]
$0A/FD25 A9 1E 25 LDA #$251E
$0A/FD28 8F F2 C7 7E STA $7EC7F2[$7E:C7F2]
$0A/FD2C 1A INC A
$0A/FD2D 8F 34 C8 7E STA $7EC834[$7E:C834]
$0A/FD31 1A INC A
$0A/FD32 8F 32 C8 7E STA $7EC832[$7E:C832]
$0A/FD36 A9 0F 25 LDA #$250F
$0A/FD39 8F F4 C7 7E STA $7EC7F4[$7E:C7F4]
Hearts refilling
$0D/F14F E2 30 SEP #$30 A:2436 X:00FF Y:00FE P:eNvMXdizc
$0D/F151 A9 68 LDA #$68 A:2436 X:00FF Y:00FE P:eNvMXdizc
$0D/F153 85 00 STA $00 [$00:0000] A:2468 X:00FF Y:00FE P:envMXdizc
$0D/F155 A9 C7 LDA #$C7 A:2468 X:00FF Y:00FE P:envMXdizc
$0D/F157 85 01 STA $01 [$00:0001] A:24C7 X:00FF Y:00FE P:eNvMXdizc
$0D/F159 A9 7E LDA #$7E A:24C7 X:00FF Y:00FE P:eNvMXdizc
$0D/F15B 85 02 STA $02 [$00:0002] A:247E X:00FF Y:00FE P:envMXdizc
$0D/F15D CE 08 02 DEC $0208 [$0D:0208] A:247E X:00FF Y:00FE P:envMXdizc
$0D/F160 D0 4F BNE $4F [$F1B1] A:247E X:00FF Y:00FE P:envMXdizc
$0D/F1B1 18 CLC A:247E X:00FF Y:00FE P:envMXdizc
$0D/F1B2 60 RTS A:247E X:00FF Y:00FE P:envMXdizc
As part of the HUD - the dialog box border:
$0E/D2AB C2 30 REP #$30 A:6244 X:0000 Y:0000 P:envMXdiZc
$0E/D2AD AD D0 1C LDA $1CD0 [$0E:1CD0] A:6244 X:0000 Y:0000 P:envmxdiZc
$0E/D2B0 EB XBA A:6244 X:0000 Y:0000 P:envmxdizc
$0E/D2B1 9D 02 10 STA $1002,x[$0E:1002] A:4462 X:0000 Y:0000 P:envmxdizc
$0E/D2B4 E8 INX A:4462 X:0000 Y:0000 P:envmxdizc
$0E/D2B5 E8 INX A:4462 X:0001 Y:0000 P:envmxdizc
$0E/D2B6 EB XBA A:4462 X:0002 Y:0000 P:envmxdizc
$0E/D2B7 18 CLC A:6244 X:0002 Y:0000 P:envmxdizc
$0E/D2B8 69 20 00 ADC #$0020 A:6244 X:0002 Y:0000 P:envmxdizc
$0E/D2BB 8D D0 1C STA $1CD0 [$0E:1CD0] A:6264 X:0002 Y:0000 P:envmxdizc
$0E/D2BE A9 00 2F LDA #$2F00 A:6264 X:0002 Y:0000 P:envmxdizc
$0E/D2C1 9D 02 10 STA $1002,x[$0E:1004] A:2F00 X:0002 Y:0000 P:envmxdizc
$0E/D2C4 E8 INX A:2F00 X:0002 Y:0000 P:envmxdizc
$0E/D2C5 E8 INX A:2F00 X:0003 Y:0000 P:envmxdizc
$0E/D2C6 B9 7F D3 LDA $D37F,y[$0E:D37F] A:2F00 X:0004 Y:0000 P:envmxdizc
$0E/D2C9 9D 02 10 STA $1002,x[$0E:1006] A:28F3 X:0004 Y:0000 P:envmxdizc
$0E/D2CC E8 INX A:28F3 X:0004 Y:0000 P:envmxdizc
$0E/D2CD E8 INX A:28F3 X:0005 Y:0000 P:envmxdizc
$0E/D2CE C8 INY A:28F3 X:0006 Y:0000 P:envmxdizc
$0E/D2CF C8 INY A:28F3 X:0006 Y:0001 P:envmxdizc
$0E/D2D0 A9 16 00 LDA #$0016 A:28F3 X:0006 Y:0002 P:envmxdizc
$0E/D2D3 85 0E STA $0E [$00:000E] A:0016 X:0006 Y:0002 P:envmxdizc
$0E/D2D5 B9 7F D3 LDA $D37F,y[$0E:D381] A:0016 X:0006 Y:0002 P:envmxdizc
$0E/D2D8 9D 02 10 STA $1002,x[$0E:1008] A:28F4 X:0006 Y:0002 P:envmxdizc
$0E/D2DB E8 INX A:28F4 X:0006 Y:0002 P:envmxdizc
$0E/D2DC E8 INX A:28F4 X:0007 Y:0002 P:envmxdizc
$0E/D2DD C6 0E DEC $0E [$00:000E] A:28F4 X:0008 Y:0002 P:envmxdizc
$0E/D2DF D0 F7 BNE $F7 [$D2D8] A:28F4 X:0008 Y:0002 P:envmxdizc
$0E/D2E1 C8 INY A:28F4 X:0032 Y:0002 P:envmxdiZc
$0E/D2E2 C8 INY A:28F4 X:0032 Y:0003 P:envmxdizc
$0E/D2E3 B9 7F D3 LDA $D37F,y[$0E:D383] A:28F4 X:0032 Y:0004 P:envmxdizc
$0E/D2E6 9D 02 10 STA $1002,x[$0E:1034] A:68F3 X:0032 Y:0004 P:envmxdizc
$0E/D2E9 E8 INX A:68F3 X:0032 Y:0004 P:envmxdizc
$0E/D2EA E8 INX A:68F3 X:0033 Y:0004 P:envmxdizc
$0E/D2EB 60 RTS A:68F3 X:0034 Y:0004 P:envmxdizc
First routine:
$0D/FAFD E2 30 SEP #$30
$0D/FAFF AF 40 F3 7E LDA $7EF340[$7E:F340] ;
$0D/FB03 F0 37 BEQ $37 [$FB3C]
$0D/FB05 C9 03 CMP #$03
$0D/FB07 90 24 BCC $24 [$FB2D]
$0D/FB09 A9 86 LDA #$86
$0D/FB0B 8F 1E C7 7E STA $7EC71E[$7E:C71E]
$0D/FB0F A9 24 LDA #$24
$0D/FB11 8F 1F C7 7E STA $7EC71F[$7E:C71F]
$0D/FB15 A9 87 LDA #$87
$0D/FB17 8F 20 C7 7E STA $7EC720[$7E:C720]
$0D/FB1B A9 24 LDA #$24
$0D/FB1D 8F 21 C7 7E STA $7EC721[$7E:C721]
$0D/FB21 A2 04 LDX #$04
$0D/FB23 AF 77 F3 7E LDA $7EF377[$7E:F377]
$0D/FB27 D0 0E BNE $0E [$FB37]
$0D/FB29 A2 03 LDX #$03
$0D/FB2B 80 0A BRA $0A [$FB37]
$0D/FB2D A2 02 LDX #$02
$0D/FB2F AF 77 F3 7E LDA $7EF377[$7E:F377]
$0D/FB33 D0 02 BNE $02 [$FB37]
$0D/FB35 A2 01 LDX #$01
$0D/FB37 8A TXA
$0D/FB38 8F 40 F3 7E STA $7EF340[$7E:F340] ; this code deals with the bow/arrows change to "no arrows" graphic.
$0D/FB3C C2 30 REP #$30 ; this code draws the item box.
$0D/FB3E AE 02 02 LDX $0202 [$00:0202]
$0D/FB41 F0 4D BEQ $4D [$FB90] ; no item selected, ignore.
$0D/FB43 BF 3F F3 7E LDA $7EF33F,x[$7E:F33F] ; pick item, position 1 = bow, etc.
$0D/FB47 29 FF 00 AND #$00FF
$0D/FB4A E0 04 00 CPX #$0004
$0D/FB4D D0 03 BNE $03 [$FB52] ; hookshot is position 4, have to set the number to 1 (probably graphic issues)
$0D/FB4F A9 01 00 LDA #$0001
$0D/FB52 E0 10 00 CPX #$0010
$0D/FB55 D0 0A BNE $0A [$FB61] ; that's the bottles!
$0D/FB57 9B TXY
$0D/FB58 AA TAX
$0D/FB59 BF 5B F3 7E LDA $7EF35B,x[$7E:F35B] ; load the correct bottle graphic.
$0D/FB5D 29 FF 00 AND #$00FF
$0D/FB60 BB TYX
$0D/FB61 85 02 STA $02 [$00:0002] ; store position of graphic.
$0D/FB63 8A TXA
$0D/FB64 3A DEC A
$0D/FB65 0A ASL A
$0D/FB66 AA TAX ; relative position is ((mem_addr_of_item - 7EF340) * 2)
$0D/FB67 BD 93 FA LDA $FA93,x[$00:FA93] ; loads graphic pointer.
$0D/FB6A 85 04 STA $04 [$00:0004]
$0D/FB6C A5 02 LDA $02 [$00:0002]
$0D/FB6E 0A ASL A
$0D/FB6F 0A ASL A
$0D/FB70 0A ASL A
$0D/FB71 A8 TAY
$0D/FB72 B1 04 LDA ($04),y[$00:5555] ; loads the graphic in $0D bank, upper left NOTE see data area for a description of where they are.
$0D/FB74 8F 4A C7 7E STA $7EC74A[$7E:C74A]
$0D/FB78 C8 INY
$0D/FB79 C8 INY
$0D/FB7A B1 04 LDA ($04),y[$00:5555] ; upper right
$0D/FB7C 8F 4C C7 7E STA $7EC74C[$7E:C74C]
$0D/FB80 C8 INY
$0D/FB81 C8 INY
$0D/FB82 B1 04 LDA ($04),y[$00:5555]
$0D/FB84 8F 8A C7 7E STA $7EC78A[$7E:C78A] ; lower left
$0D/FB88 C8 INY
$0D/FB89 C8 INY
$0D/FB8A B1 04 LDA ($04),y[$00:5555]
$0D/FB8C 8F 8C C7 7E STA $7EC78C[$7E:C78C] ; lower right
$0D/FB90 60 RTS
hearts routine (only used by the 2 places above)
$0D/FDAB A2 00 00 LDX #$0000
$0D/FDAE A5 00 LDA $00 [$00:0000]
$0D/FDB0 C9 08 00 CMP #$0008
$0D/FDB3 90 0F BCC $0F [$FDC4]
$0D/FDB5 E9 08 00 SBC #$0008
$0D/FDB8 85 00 STA $00 [$00:0000]
$0D/FDBA A0 04 00 LDY #$0004
$0D/FDBD 20 D9 FD JSR $FDD9 [$00:FDD9]
$0D/FDC0 E8 INX
$0D/FDC1 E8 INX
$0D/FDC2 80 EA BRA $EA [$FDAE]
$0D/FDC4 C9 05 00 CMP #$0005
$0D/FDC7 90 05 BCC $05 [$FDCE]
$0D/FDC9 A0 04 00 LDY #$0004
$0D/FDCC 80 0B BRA $0B [$FDD9]
$0D/FDCE C9 01 00 CMP #$0001
$0D/FDD1 90 05 BCC $05 [$FDD8]
$0D/FDD3 A0 02 00 LDY #$0002
$0D/FDD6 80 01 BRA $01 [$FDD9]
$0D/FDD8 60 RTS
$0D/FDD9 E0 14 00 CPX #$0014
$0D/FDDC 90 0B BCC $0B [$FDE9]
$0D/FDDE A2 00 00 LDX #$0000
$0D/FDE1 A5 07 LDA $07 [$00:0007]
$0D/FDE3 18 CLC
$0D/FDE4 69 40 00 ADC #$0040
$0D/FDE7 85 07 STA $07 [$00:0007]
$0D/FDE9 B7 0A LDA [$0A],y[$55:5555]
$0D/FDEB 9B TXY
$0D/FDEC 97 07 STA [$07],y[$55:5555]
$0D/FDEE 60 RTS
binary_to_decimal Routine:
***NOTE*** Never - change the entrance position of this routine, it's being reused in MANY PLACES.
quite simple, takes in number in accumlator, spits out result in addresses, 03, 04, and 05.
$0D/F0F7 C2 30 REP #$30
$0D/F0F9 9C 03 00 STZ $0003 [$00:0003]
$0D/F0FC A2 00 00 LDX #$0000
$0D/F0FF A0 02 00 LDY #$0002
$0D/F102 D9 F9 F9 CMP $F9F9,y[$00:F9F9]
$0D/F105 90 08 BCC $08 [$F10F]
$0D/F107 38 SEC
$0D/F108 F9 F9 F9 SBC $F9F9,y[$00:F9F9]
$0D/F10B F6 03 INC $03,x [$00:0003]
$0D/F10D 80 F3 BRA $F3 [$F102]
$0D/F10F E8 INX
$0D/F110 88 DEY
$0D/F111 88 DEY
$0D/F112 10 EE BPL $EE [$F102]
$0D/F114 85 05 STA $05 [$00:0005]
$0D/F116 E2 30 SEP #$30
$0D/F118 A2 02 LDX #$02
$0D/F11A B5 03 LDA $03,x [$00:0003]
$0D/F11C C9 7F CMP #$7F
$0D/F11E F0 02 BEQ $02 [$F122]
$0D/F120 09 90 ORA #$90
$0D/F122 95 03 STA $03,x [$00:0003]
$0D/F124 CA DEX
$0D/F125 10 F3 BPL $F3 [$F11A]
$0D/F127 60 RTS
----------
Data:
Addresses for graphics - Note these are snes ppu pointer things, 2 bytes each - follows the vhopppcc cccccccc pattern.
8 bytes each - top left, top right, bottom left bottom right in this order.
06F629 - BOW - WHEN NOTHING
06F631 - BOW - WHEN ALL USED UP
06F639 - BOW - NORMAL
06F641 - BOW - ???
06F649 - BOW - SILVER
06F651 - BOOMERANG - WHEN NOTHING
06F659 - BOOMERANG - blue
06F661 - BOOMERANG - red
06F669 - HOOKSHOT - when nothing
06F671 - HOOKSHOT
06F679 - bomb - empty
06F681 - bomb
06F689 - mushroom slot - when nothing
06F691 - mushroom
06F699 - powder
06F6A1 - fire rod slot when nothing
06F6A9 - fire rod
06F6B1 - ice rod slot when nothing
06F6B9 - ice rod
06F6C1 - bombos slot when nothing
06F6C9 - bombos
06F6D1 - ether slot when empty
06F6D9 - ether
06F6E1 - quake slot when empty
06F6E9 - quake
06F6F1 - lamp slot when empty
06F6F9 - lamp slot
06F701 - hammer slot when empty
06F709 - hammer slot
06F711 - shovel/flute slot when empty
06F719 - shovel
06F721 - flute
06F729 - flute (again)
06F731 - bug catching net slot when empty
06F739 - bug catching net
06F741 - book slot when empty
06F749 - book
06F751 - bottle slot when empty
06F759 - mushroom (?)
06F761 - empty bottle
06F769 - Red Potion
06F771 - Green Potion
06F779 - Blue Potion
06F781 - Fairy
06F789 - Bee
06F791 - Good Bee
06F799 - red cane slot when empty
06F7A1 - red cane
06F7A9 - blue cane slot when empty
06F7B1 - blue cane
06F7B9 - cape slot when empty
06F7C1 - cape
06F7C9 - mirror slot when empty
06F7D1 - map (?)
06F7D9 - mirror
06F7D1 - unused? arrow symbol on top, bomb symbol on bottom on play screen.
06F839 - sword when none
06F841 - sword 1
06F849 - sword 2
06F851 - sword 3
06F859 - sword 4
06F861 - shield when none
06F869 - shield 1
06F871 - shield 2
06F879 - shield 3
06F881 - armor 1 (green)
06F889 - armor 2 (blue)
06F891 - armor 3 (red)
Item descriptions:
6F1C9 - 6F619
Same format as above,
2 lines per item, 16 bytes per line.
Some descriptions uses custom graphics (eg/ BOOMERANG because it doesn't fit in a line)
Will not go into the details, but will give the order which items come up.
1. bow
2. boomerang
3. hookshot
4. bomb
5. mushroom
6. fire rod
7. ice rod
8. bombos
9. ether
10. quake
11. lamp
12. magic hammer
13. shovel
14. bug catching net
15. book of mudura
16.
17. blue cane
18. red cane
19. magic cape
20.
21. mushroom (again)
...
Subscreen disassembly details
Euclid
10/6/2012
Entrance routine is from this point - do not change this location.
$0D/DDAB 20 99 E3 JSR $E399 [$00:E399] ; unsure exactly what this does yet.
$0D/DDAE A9 01 LDA #$01
$0D/DDB0 20 C8 E3 JSR $E3C8 [$00:E3C8] ; in my old notes it says "change palette".
$0D/DDB3 20 D9 E3 JSR $E3D9 [$00:E3D9] ; draws the top left (item) are of the subscreen (note this function is called in the refresh)
$0D/DDB6 A9 01 LDA #$01
$0D/DDB8 20 C8 E3 JSR $E3C8 [$00:E3C8]
$0D/DDBB 20 47 E6 JSR $E647 [$00:E647] ; top right (item box) border only.
$0D/DDBE A9 01 LDA #$01
$0D/DDC0 20 C8 E3 JSR $E3C8 [$00:E3C8]
$0D/DDC3 20 B6 E6 JSR $E6B6 [$00:E6B6] ; most of the bottom left box - excluding the 4 items and the words (eg/ run, swim etc)
$0D/DDC6 20 B7 E7 JSR $E7B7 [$00:E7B7] ; most other items in the bottom left box - excluding the very right one in the bottom box.
$0D/DDC9 20 C8 E9 JSR $E9C8 [$00:E9C8] ; triforce/crystals box.
$0D/DDCC 20 E9 EC JSR $ECE9 [$00:ECE9] ; that very right item in the bottom left box.
$0D/DDCF 20 04 ED JSR $ED04 [$00:ED04] ; wasted bytes (Just look at the subroutine!)
$0D/DDD2 A9 01 LDA #$01
$0D/DDD4 20 C8 E3 JSR $E3C8 [$00:E3C8]
$0D/DDD7 20 29 ED JSR $ED29 [$00:ED29] ; borders of the bottom right box
$0D/DDDA 20 21 EE JSR $EE21 [$00:EE21] ; shield
$0D/DDDD 20 3C EE JSR $EE3C [$00:EE3C] ; Armor
$0D/DDE0 20 57 EE JSR $EE57 [$00:EE57] ; big key (dungeon)
$0D/DDE3 20 39 EF JSR $EF39 [$00:EF39] ; compass (dungeon)
...
$0D/DE35 20 3A EB JSR $EB3A [$0D:EB3A] ; words
Here's the redraw code:
$0D/DF8A 20 C8 E3 JSR $E3C8 [$0D:E3C8] ;
$0D/DF8D 20 D9 E3 JSR $E3D9 [$0D:E3D9] ; draws the top left (item) are of the subscreen
$0D/DF90 20 3A EB JSR $EB3A [$0D:EB3A] ; words!
Euclid- Since : 2012-06-21
Zeldix :: Zelda III Hacking :: Workshop
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum