;--------------------------------------------------------------------------- ; simple example that demonstrates how to read the flash ROM ;--------------------------------------------------------------------------- !src "../include/gmod3.inc" * = $0801 !word nextline !word 2016 !byte $9e !byte $32, $30, $36, $31 nextline: !byte 0,0,0 jmp start !src "../lib/gmod3.asm" ;------------------------------------------------------------------------------- start: sei ; just to place the cursor lda #$93 jsr $ffd2 sei ; clear screen ldx #0 - lda #$20 sta $0400,x sta $0500,x sta $0600,x sta $0700,x lda #$01 sta $d800,x sta $d900,x sta $da00,x sta $db00,x inx bne - ; set byte program command and flash address lda #0 sta addr2 ldx #0 stx addr1 lda #0 sta addr0 ldx #0 -- txa pha lda addrhi pha lsr lsr lsr lsr tay lda hexdigits,y sta $0400 pla and #$0f tay lda hexdigits,y sta $0401 inc $0403 ; to indicate progress lda #<($0400 + (10 * 40)) ldx #>($0400 + (10 * 40)) ; read one 256byte page jsr flash_readpage sty $0404 ; to indicate progress ldx #0 - lda $0400 + (10 * 40),x addrhi = * + 2 sta $4000,x inx bne - sty $0405 ; to indicate progress inc addrhi inc addr1 pla tax inx cpx #$20 ; 20 pages bne -- lda #5 sta $d020 lda #GMOD3_CTRL_8KGAME sta GMOD3_CTRL cli rts failure: lda #2 sta $d020 jmp * hexdigits: !scr "0123456789abcdef"