1; Tests dummy reads for (hopefully) ALL instructions which do them, 2; including unofficial ones. Prints opcode(s) of failed 3; instructions. Requires that APU implement $4015 IRQ flag reading. 4 5.include "shell.inc" 6 7zp_byte opcode 8zp_byte errors 9 10begin: setb SNDMODE,0 11 lda SNDCHN 12 delay 30000 13 setw addr,SNDCHN+3 14 rts 15 16failed: 17 inc errors 18 lda opcode 19 jsr print_a 20 jsr play_byte 21 rts 22 23.macro test_ x_, y_, instr 24 .local instr_ 25 lda instr_ 26 sta opcode 27 jsr begin 28 ldx #x_ 29 ldy #y_ 30instr_: instr 31 lda SNDCHN 32 and #$40 33.endmacro 34 35.macro test_x opcode 36 test_ 0,-3,{.byte opcode,<SNDCHN+3,>SNDCHN} 37 beq :+ 38 test_ -3,0,{.byte opcode,<SNDCHN+3,>SNDCHN} 39 beq :++ 40: jsr failed 41: 42.endmacro 43 44.macro test_y opcode 45 test_ -3,0,{.byte opcode,<SNDCHN+3,>SNDCHN} 46 beq :+ 47 test_ 0,-3,{.byte opcode,<SNDCHN+3,>SNDCHN} 48 beq :++ 49: jsr failed 50: 51.endmacro 52 53.macro test_i opcode 54 test_ -3,0,{.byte opcode,addr} 55 beq :+ 56 test_ 0,-3,{.byte opcode,addr} 57 beq :++ 58: jsr failed 59: 60.endmacro 61 62.macro test_xyi opcode 63 test_x opcode 64 test_y opcode-4 65 test_i opcode-12 66.endmacro 67 68main: 69 set_test 2,"Official opcodes failed" 70 71 test_xyi $1D ; ORA 72 test_xyi $3D ; AND 73 test_xyi $5D ; EOR 74 test_xyi $7D ; ADC 75 test_xyi $9D ; STA 76 test_xyi $BD ; LDA 77 test_xyi $DD ; CMP 78 test_xyi $FD ; SBC 79 80 test_x $1E ; ASL 81 test_x $3E ; ROL 82 test_x $5E ; LSR 83 test_x $7E ; ROR 84 test_x $DE ; DEC 85 test_x $FE ; INC 86 87 test_x $BC ; LDY 88 89 test_y $BE ; LDX 90 91 lda errors 92 jne test_failed 93 94 set_test 2,"Unofficial opcodes failed" 95 96 test_x $1C ; SKW 97 test_x $3C ; SKW 98 test_x $5C ; SKW 99 test_x $7C ; SKW 100 test_x $DC ; SKW 101 test_x $FC ; SKW 102 103 test_xyi $1F ; ASO 104 test_xyi $3F ; RLA 105 test_xyi $5F ; LSE 106 test_xyi $7F ; RRA 107 test_xyi $DF ; DCM 108 test_xyi $FF ; INS 109 110 test_x $9C ; SAY 111 112 test_y $BF ; LAX 113 test_y $9B ; TAS 114 test_y $9E ; XAS 115 test_y $9F ; AXA 116 test_y $BB ; LAS 117 118 test_i $93 ; AXA 119 test_i $B3 ; LAX 120 121 lda errors 122 jne test_failed 123 124 jmp tests_passed 125