!src "../include/gmod3.inc" !src "common.inc" ;------------------------------------------------------------------------------ zeropagecharset = $08 ; 8 statusbits = $10 scrptr = $20 atmp = $30 xtmp = $31 ytmp = $32 gotvalue=$35 gotx =$36 goty =$37 romaddr = $40 ; 2 cmpaddr = $42 ; 2 cmpa = $44 cmpx = $45 cmpy = $46 mhztoggle = $47 mhzenable = $48 rand = $50 ; 2 ptr1 = $52 ; 2 ptr2 = $54 ; 2 banklo = $56 bankhi = $57 testbanklo = $58 testbankhi = $59 testcount = $5a ; 2 zeropagesprite = $c0 ; $3f ;------------------------------------------------------------------------------ memblock1 = $0400 + (5 * 40) memblock2 = $0400 + (12 * 40) STATUSBIT_ERROR = %10000000 STATUSBIT_BANK_CHANGED = %01000000 STATUSBIT_READ_START = %00100000 UPDATA = $dd01 UPDDR = $dd03 ;------------------------------------------------------------------------------ !macro movesprites { inc $d001+(0*2) lda $d001+(1*2) adc #2 sta $d001+(1*2) lda $d001+(2*2) adc #3 sta $d001+(2*2) lda $d001+(3*2) adc #5 sta $d001+(3*2) lda $d001+(4*2) adc #7 sta $d001+(4*2) lda $d001+(5*2) adc #11 sta $d001+(5*2) lda $d001+(6*2) adc #13 sta $d001+(6*2) lda $d001+(7*2) adc #17 sta $d001+(7*2) } ;------------------------------------------------------------------------------- * = $0800 !byte 0 !word nextline !word 2016 !byte $9e !byte $32, $30, $36, $31 !byte 0 nextline: !byte 0,0 jmp start ;------------------------------------------------------------------------------- start: sei lda #$1b sta $d011 lda #$15 sta $d018 lda #$c8 sta $d016 ldx #$f stx $d020 inx stx $d021 lda #$37 sta $01 ; enable the cartridge so we can run test.prg standalone lda #GMOD3_CTRL_8KGAME | GMOD3_CTRL_BITBANG_DISABLED sta GMOD3_CTRL lda #STATUSBIT_ERROR | STATUSBIT_BANK_CHANGED | STATUSBIT_READ_START sta UPDDR lda #0 sta statusbits sta UPDATA jsr clrscr jsr doselftest inc $0400 ;----------------------------------------------------------------------- alltestsloop: jsr dolineartestupper jsr doromcodetestrandom inc $0403 jsr doromcodetest inc $0403 jsr dolineartest inc $0403 jmp alltestsloop ;------------------------------------------------------------------------------- clrscr: 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 - rts printright: inc scrptr bne + inc scrptr+1 + rts printhex: sta atmp stx xtmp sty ytmp lsr lsr lsr lsr tax ldy #0 lda hextab,x sta (scrptr),y iny lda atmp and #$0f tax lda hextab,x sta (scrptr),y lda scrptr clc adc #2 sta scrptr bcc + inc scrptr+1 + lda atmp ldx xtmp ldy ytmp rts hextab: !scr "0123456789abcdef" initsprites: ldx #8 ldy #0 lda #$30 - sta $d000,y clc adc #$18 iny iny dex bne - ldx #63 lda #$ca - sta zeropagesprite,x dex bpl - lda #3 sta $07f8 sta $07f9 sta $07fa sta $07fb sta $07fc sta $07fd sta $07fe sta $07ff lda #$ff sta $d015 rts waitforspace: lda #$ff sta $dc02 lda #$00 sta $dc03 lda #%01111111 sta $dc00 - lda $dc01 and #%00010000 beq - - lda $dc01 and #%00010000 bne - rts ;------------------------------------------------------------------------------- !macro UPDATEPRNG16 { lsr rand+1 ror rand bcc + lda rand+1 eor #$b4 ; 1...ffff period sta rand+1 + } initrand: lda #1 sta rand lda #0 sta rand+1 rts prng16: +UPDATEPRNG16 rts ;------------------------------------------------------------------------------- !src "selftest.asm" !src "lineartest.asm" !src "romcodetest.asm" ;------------------------------------------------------------------------------- !align 255,0 onetimepad: !binary "random.bin"