Okay, so I managed to examine the dump some more and trying to strip the startup code to its bare minimum.
However, on this particular newer dump, the code is significantly more complex than the previous one, due to the TFT init routines (that covers many other models apart from the GC9306), and also many other unknown registers such as 0x413x are being accessed.
Instead of stripping it first to see if it works or not, I grabbed the whole first 512K (0x80000) of the code and pasted into another empty bin file.
The startup code is just too much work to strip at the start so I filled the majority of the menu code from 0x6E000-0x6EFFFF with zeros and replaced it with another jump to another area away from that first 512K - to 0x82000:
; org 0x6E000:
cpyToRAM_Loop LDA $E800,X
STA $0400,X
DEX
BPL cpyToRAM_Loop
JMP $0400
; org 0x6E800:
LDA #$00
STA $4100
LDA #$05
STA $4107
LDA #$01
STA $4108
LDA #$02
Converting this back to 6502 machine code and paste it, it should look like this:
These NOAC's bankswitching methods have to be copied into the RAM area and run it for it to work. Else, it won't go to the new address.
Of course, I tested this in the EmuVT 1.36 to see if it jumps to the address. When it does, I actually proceeded into writing more code at the 0x82000 onwards.
Note: The backlight seemed to be only switched on after the TFT init routine!
Compile this in ASM6F and paste the code into the section 0x82000:
helloText EQU $A200
; ------------------
; main program here:
; ------------------
.org $A000
main_app:
; diasble interrupts on APU:
lda #$40
sta $4017
lda #$00
sta $4010
vblankwait1:
; First wait for vblank to make sure PPU is ready
bit $2002
bpl vblankwait1
enableBacklight:
lda #$1f
sta $413f
lda #$0b
sta $4138
lda #$0f
sta $4139
; clear RAM:
tax
Init_ClearRAM:
sta $000,x
sta $100,x
sta $200,x
sta $300,x
sta $400,x
sta $500,x
sta $600,x
sta $700,x
inx
bne Init_ClearRAM
Init_PPU_chr:
lda #$00
sta $2012
lda #$00
sta $2013
lda #$00
sta $2014
lda #$00
sta $2015
lda #$00
sta $2016
lda #$00
sta $2017
lda #$20
sta $2018
lda #%00000000
sta $201A
; fill background with one value for 8 tiles:
lda $2002
lda #$20
sta $2006
lda #$00
sta $2006
ldy #$00
FillAllBackground:
FillBackground:
lda #$00
sta $2007
inx
cpx #$ff
bne FillBackground
iny
cpy #$04
bne FillAllBackground
; Fill palette with 0x0f, 0x30, 0x30, 0x30:
; $3f00 = 0x0f
FillPalette:
lda $2002
lda #$3f
sta $2006
lda #$00
sta $2006
ldx #$00
FillPalleteLoop:
lda #$0e
sta $2007
lda #$0e
sta $2007
lda #$2a
sta $2007
lda #$0e
sta $2007
inx
cpx #$04
bne FillPalleteLoop
PrintText:
lda $2002
lda #$20
sta $2006
lda #$00
sta $2006
ldx #$00
Print0:
lda helloText, x
cmp #$00
beq PrintDone
sbc #$20
sta $2007
inx
jmp Print0
PrintDone:
Init_PPU:
lda #%10000000
sta $2000
lda #%00001010
sta $2001
lda #$0
sta $2005
sta $2005
here:
jmp here
; ------------------
NMI:
rti
.org helloText
.db "HELLO WORLD!", #$00
Wait - you need to put the CHR into the area 0x80000 too. Sample CHR file provided - get the "chicago_oblique_basic.chr". I got the sample CHR from the NesDev forums, and paste it at the 0x80000 area. It should look like this:
After all is done, program this bin into the NOR flash using the T56 programmer (or any other equivalent). You should be seeing this one:
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.