6 .byte $4E, $45, $53, $1A ; "NES" Header
\r
7 .byte $02 ; PRG-BANKS
\r
8 .byte $01 ; CHR-BANKS
\r
9 .byte $01 ; Vetrical Mirror
\r
11 .byte $00, $00, $00, $00 ;
\r
12 .byte $00, $00, $00, $00 ;
\r
16 ;;0000 - 00ff zp: volatile though functions
\r
17 ;;0100 - 01ff sp: preserved through functions
\r
18 ;;0200 - 02ff dma: dedicated for dma
\r
19 ;;0300 - 07ff global: global variables.
\r
24 ; interrupt off, initialize sp.
\r
39 jsr single_inst_test
\r
49 ;;fall through from the above func
\r
50 ;;or jump into from the other failed func.
\r
54 lda ad_test_done_msg
\r
56 lda ad_test_done_msg+1
\r
65 ;;;generate invalid opcode error.
\r
68 lda ad_test_failed_msg
\r
70 lda ad_test_failed_msg+1
\r
147 sbc #$46 ;;70, -110 - 70 = 4c(76)
\r
153 sbc #$12 ;;18, -110 - 18 = -128
\r
161 ;;forward page crossing branch
\r
172 ;;repeat the same test
\r
173 ;;(in case the above test doesn't go across the page)
\r
177 ;;forward page crossing branch
\r
188 ;jmp, jsr, rts test...
\r
237 .addr @jmp_addr_done
\r
255 ;;pha,php,pla,plp test
\r
333 ;;zp, abs, absx, zpx
\r
334 asl $6b ;@6b=39 > 72
\r
341 dec $04cc ;@4cc=a1 > a0
\r
348 lsr $03cf, x ;@4cc=a0 > 50
\r
355 inc $02, x ;@ff=9f > a0
\r
363 rol $02, x ;@ff=a0 > 40
\r
364 rol $02, x ;@ff=40 > 81
\r
372 ror $02, x ;@ff=81 > c0
\r
373 ror $02, x ;@ff=40 > e0
\r
401 ;;zp, abs, absx, zpx, (ind),y
\r
402 ;;(indir, x) is ommited.
\r
405 sta $0d80, x ;@e61=b7
\r
407 sta ($a1), y ;@602=b7
\r
444 ;;a2 addr mode test
\r
461 bit $71 ;;36 bit c9 = 00.
\r
468 sta $0421 ;;@0421 = 3b
\r
470 sta $051b ;;@051b = d7
\r
472 sta $06cc ;;@06cc = eb
\r
476 eor $051b ;;3c eor d7 = eb
\r
483 ;;a.2.4 indirect,x is not implemented...
\r
491 sta $0190, y ;;@231=90
\r
493 ora $0190, y ;;@231(page cross), 90 | 17 = 97
\r
495 sbc $0342, x ;;@359, 97-2f=68
\r
510 and $68,x ;;@35, 8d & f1=81
\r
512 eor $22,y ;;@bc, ac^81=2d
\r
525 sta $0902 ;@0902=d9
\r
529 adc ($90),y ;@0902, 0a+d9=e3
\r
540 ;;;single byte instructions.
\r
541 .proc single_inst_test
\r
544 lda ad_single_test+1
\r
599 ;;-- SR Flags (bit 7 to bit 0):
\r
600 ;;-- 7 N .... Negative
\r
601 ;;-- 6 V .... Overflow
\r
602 ;;-- 5 - .... ignored
\r
603 ;;-- 4 B .... Break
\r
604 ;;-- 3 D .... Decimal (use BCD for arithmetics)
\r
605 ;;-- 2 I .... Interrupt (IRQ disable)
\r
607 ;;-- 0 C .... Carry
\r
809 ;;tax/tay/txa/tya test
\r
848 pha ;;0130 = dd, sp=012f
\r
864 ;;;;jsr test_failure
\r
866 ;;;single byte instruction test done.
\r
870 ;;;param $00, $01 = msg addr.
\r
871 ;;;print_ln display message.
\r
872 ;;;start position is the bottom of the screen.
\r
877 lda vram_current + 1
\r
889 ;;clear remaining space.
\r
902 lda vram_current + 1
\r
903 sty vram_current + 1
\r
904 adc vram_current + 1
\r
905 sta vram_current + 1
\r
906 tax ;; x = new vram_l
\r
910 adc #01 ;; a = new vram_h
\r
920 ;;;if vram pos = 23c0. reset pos.
\r
924 sta vram_current + 1
\r
944 ;;check_ppu exists caller's function if use_ppu flag is off
\r
948 ;;pop caller's return addr
\r
958 ;ppu register initialize.
\r
981 .byte $0f, $00, $10, $20
\r
982 .byte $0f, $04, $14, $24
\r
983 .byte $0f, $08, $18, $28
\r
984 .byte $0f, $0c, $1c, $2c
\r
986 .byte $0f, $00, $10, $20
\r
987 .byte $0f, $06, $16, $26
\r
988 .byte $0f, $08, $18, $28
\r
989 .byte $0f, $0a, $1a, $2a
\r
993 ;;initialize bss segment datas
\r
999 ;;vram pos start from the bottom line.
\r
1003 sta vram_current + 1
\r
1017 ;;;read only global datas
\r
1025 .byte "regression test start..."
\r
1031 .byte "test succeeded..."
\r
1034 ad_test_failed_msg:
\r
1037 .byte "test failed!!!"
\r
1043 .byte "ppu inst test..."
\r
1049 .byte "a5 inst test..."
\r
1055 .byte "a4 inst test..."
\r
1061 .byte "a3 inst test..."
\r
1067 .byte "a2 inst test..."
\r
1073 .byte "single byte inst test..."
\r
1076 ;;;;r/w global variables.
\r
1086 ;;;for DE1 internal memory constraints.
\r
1087 .segment "VECINFO_4k"
\r
1092 .segment "VECINFO"
\r
1097 ; character rom file.
\r
1099 .incbin "character.chr"
\r