Created
July 8, 2011 15:28
-
-
Save jbaiter/1072084 to your computer and use it in GitHub Desktop.
ff4 dte routine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arch snes.cpu; lorom // Load settings for SNES/WDC65816 in LoROM mode | |
.org $00b4a2 | |
jsl check_codes_cont | |
fill 3,$ff | |
.org $01ecb0 | |
check_codes_cont | |
cmp #$c3 | |
bne + | |
jml $00b501 | |
+; jsl dte_routine::init | |
rtl | |
namespace dte_routine | |
init | |
cmp #$40 // DTE charcodes start here | |
bcc end | |
clc | |
cmp #$80 // DTE charcodes end here | |
bcs end | |
runcheck | |
stx $fffe // Backup X | |
sec | |
sbc #$40 // Start charcodes from 0, not 30 | |
clc | |
ldx $ffff // Load DTE Flagbyte from RAM | |
cpx #$9d // If this is set, we're at the 2nd char | |
beq secondchar | |
firstchar | |
ldx #$9d // set flag to true | |
dec $0772 // decrement load_idx | |
asl a // dte_num = charcode*2 | |
jmp base | |
secondchar | |
asl a // dte_num = charcode*2 | |
clc | |
adc #$01 // select 2nd char of pair | |
ldx #$00 // set flag to false | |
base | |
stx $ffff // store flag in RAM | |
tax | |
lda dte_table,x // load character from DTE table | |
ldx $fffe // Restore X | |
end | |
rtl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment