Skip to content

Instantly share code, notes, and snippets.

@treed
Created July 11, 2011 01:31
Show Gist options
  • Save treed/1075186 to your computer and use it in GitHub Desktop.
Save treed/1075186 to your computer and use it in GitHub Desktop.
Legend of Zelda Conversation Loading Code
The code that actually loads this is executed from $882B
LDA $045F
STA $0303
INC $045F
LDY $0415 ; $0415 apparently contains the conversation to be loaded
LDA $8000,Y
STA $00
INY
LDA $8000,Y
STA $01
LDY $0416 ; The character index to be loaded?
INC $0416
LDA ($00),Y ; This actually loads the character
AND #$3F ; Strips away the control bits
CMP #$25 ; $25 is *special*? WTF
BEQ 882B ; Heh, effectively just skips drawing it; moves to the next char
STA $0305 ; storage for the character?
LDA #$10
STA $0604 ; no idea what this represents, except that the first few bytes of $060x are some kind of state which is regularly cleared
LDA ($00),Y ; Load the full byte again
AND #$C0 ; Strip away everything *but* the control bits
BEQ $8879 ; If there aren't any control bits at all, skip to $8879
LDY #$02 ; Y here seems to maybe index the line to draw on?
CMP #$C0
BEQ $886A
DEY
CMP #$40
BEQ $886A
DEY
886A: LDA $8812,Y
STA $045F
CPY #$02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment