NES boot loader specification
NES boot loader usage
A boot loader is a tiny program which receives a larger program from a PC connected to the NES via RS-232 at 57600 bits per second. The larger program is loaded into zero-page and executed there, where it can then communicate with the PC to determine what to do next. The format and protocol include a checksum, but still allow a very small implementation that does no checking. The smallest I've come up with is 30 bytes. Other implementations are included on the usage page.
Code: Select all
; NTSC version
ldx #0 ; Number of bytes received
byte: lda #$01
start: bit $4017 ; Wait for start bit
beq start
lsr ; A = 0
nop
dbit: ldy #3 ; Delay between bits
lsr $4017 ; Read bit. First time reads 1 for start bit.
dly: dey ; Delay
bne dly
rol a ; Move bit into shift register
sta 0,x ; Delay, and store received byte on final iter
bcc dbit
inx
bne byte
jmp $0007 ; Execute received code