6502_65C02_functional_tests/bin_files/65C02_extended_opcodes_test.lst
Klaus2m5 fe99e56162 fixed BRK not tested with interrupts disabled
added option to skip the remainder of a failing test in report.i65
added otion to skip undefined opcode as NOP test for the 65C02
replaced binaries with the current version of the test
2017-12-07 16:49:40 +01:00

11510 lines
574 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

AS65 Assembler for R6502 [1.42]. Copyright 1994-2007, Frank A. Kingswood Page 1
------------------------------------------------ 65C02_extended_opcodes_test.a65c ------------------------------------------------
2884 lines read, no errors in pass 1.
;
; 6 5 C 0 2 E X T E N D E D O P C O D E S T E S T
;
; Copyright (C) 2013-2017 Klaus Dormann
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
; This program is designed to test all additional 65C02 opcodes, addressing
; modes and functionality not available in the NMOS version of the 6502.
; The 6502_functional_test is a prerequisite to this test.
; NMI, IRQ, STP & WAI are covered in the 6502_interrupt_test.
;
; version 04-dec-2017
; contact info at http://2m5.de or email K@2m5.de
;
; assembled with AS65 from http://www.kingswood-consulting.co.uk/assemblers/
; command line switches: -l -m -s2 -w -x -h0
; | | | | | no page headers in listing
; | | | | 65C02 extensions
; | | | wide listing (133 char/col)
; | | write intel hex file instead of binary
; | expand macros in listing
; generate pass2 listing
;
; No IO - should be run from a monitor with access to registers.
; To run load intel hex image with a load command, than alter PC to 400 hex
; (code_segment) and enter a go command.
; Loop on program counter determines error or successful completion of test.
; Check listing for relevant traps (jump/branch *).
; Please note that in early tests some instructions will have to be used before
; they are actually tested!
;
; RESET, NMI or IRQ should not occur and will be trapped if vectors are enabled.
; Tests documented behavior of the original 65C02 only!
; Decimal ops will only be tested with valid BCD operands and the V flag will
; be ignored as it is absolutely useless in decimal mode.
;
; Debugging hints:
; Most of the code is written sequentially. if you hit a trap, check the
; immediately preceeding code for the instruction to be tested. Results are
; tested first, flags are checked second by pushing them onto the stack and
; pulling them to the accumulator after the result was checked. The "real"
; flags are no longer valid for the tested instruction at this time!
; If the tested instruction was indexed, the relevant index (X or Y) must
; also be checked. Opposed to the flags, X and Y registers are still valid.
;
; versions:
; 19-jul-2013 1st version distributed for testing
; 23-jul-2013 fixed BRA out of range due to larger trap macros
; added RAM integrity check
; 16-aug-2013 added error report to standard output option
; 23-aug-2015 change revoked
; 24-aug-2015 all self modifying immediate opcodes now execute in data RAM
; 28-aug-2015 fixed decimal adc/sbc immediate only testing carry
; 09-feb-2017 fixed RMB/SMB tested when they shouldn't be tested
; 04-dec-2017 fixed BRK not tested for actually going through the IRQ vector
; added option to skip the remainder of a failing test
; in report.i65
; added skip override to undefined opcode as NOP test
; C O N F I G U R A T I O N
;ROM_vectors writable (0=no, 1=yes)
;if ROM vectors can not be used interrupts will not be trapped
;as a consequence BRK can not be tested but will be emulated to test RTI
0001 = ROM_vectors = 1
;load_data_direct (0=move from code segment, 1=load directly)
;loading directly is preferred but may not be supported by your platform
;0 produces only consecutive object code, 1 is not suitable for a binary image
0001 = load_data_direct = 1
;I_flag behavior (0=force enabled, 1=force disabled, 2=prohibit change, 3=allow
;change) 2 requires extra code and is not recommended.
0003 = I_flag = 3
;configure memory - try to stay away from memory used by the system
;zero_page memory start address, $4e (78) consecutive Bytes required
; add 2 if I_flag = 2
000a = zero_page = $a
;data_segment memory start address, $63 (99) consecutive Bytes required
; + 12 Bytes at data_segment + $f9 (JMP indirect page cross test)
0200 = data_segment = $200
if (data_segment & $ff) != 0
ERROR ERROR ERROR low byte of data_segment MUST be $00 !!
endif
;code_segment memory start address, 10kB of consecutive space required
; add 1 kB if I_flag = 2
0400 = code_segment = $400
;added WDC only opcodes WAI & STP (0=test as NOPs, >0=no test)
0001 = wdc_op = 1
;added Rockwell & WDC opcodes BBR, BBS, RMB & SMB
;(0=test as NOPs, 1=full test, >1=no test)
0001 = rkwl_wdc_op = 1
;skip testing all undefined opcodes override
;0=test as NOP, >0=skip
0000 = skip_nop = 0
;report errors through I/O channel (0=use standard self trap loops, 1=include
;report.i65 as I/O channel, add 3 kB)
0000 = report = 0
;RAM integrity test option. Checks for undesired RAM writes.
;set lowest non RAM or RAM mirror address page (-1=disable, 0=64k, $40=16k)
;leave disabled if a monitor, OS or background interrupt is allowed to alter RAM
ffff = ram_top = -1
noopt ;do not take shortcuts
;macros for error & success traps to allow user modification
;example:
;trap macro
; jsr my_error_handler
; endm
;trap_eq macro
; bne skip\?
; trap ;failed equal (zero)
;skip\?
; endm
;
; my_error_handler should pop the calling address from the stack and report it.
; putting larger portions of code (more than 3 bytes) inside the trap macro
; may lead to branch range problems for some tests.
if report = 0
trap macro
jmp * ;failed anyway
endm
trap_eq macro
beq * ;failed equal (zero)
endm
trap_ne macro
bne * ;failed not equal (non zero)
endm
trap_cs macro
bcs * ;failed carry set
endm
trap_cc macro
bcc * ;failed carry clear
endm
trap_mi macro
bmi * ;failed minus (bit 7 set)
endm
trap_pl macro
bpl * ;failed plus (bit 7 clear)
endm
trap_vs macro
bvs * ;failed overflow set
endm
trap_vc macro
bvc * ;failed overflow clear
endm
; please observe that during the test the stack gets invalidated
; therefore a RTS inside the success macro is not possible
success macro
jmp * ;test passed, no errors
endm
endif
if report = 1
trap macro
jsr report_error
endm
trap_eq macro
bne skip\?
trap ;failed equal (zero)
skip\?
endm
trap_ne macro
beq skip\?
trap ;failed not equal (non zero)
skip\?
endm
trap_cs macro
bcc skip\?
trap ;failed carry set
skip\?
endm
trap_cc macro
bcs skip\?
trap ;failed carry clear
skip\?
endm
trap_mi macro
bpl skip\?
trap ;failed minus (bit 7 set)
skip\?
endm
trap_pl macro
bmi skip\?
trap ;failed plus (bit 7 clear)
skip\?
endm
trap_vs macro
bvc skip\?
trap ;failed overflow set
skip\?
endm
trap_vc macro
bvs skip\?
trap ;failed overflow clear
skip\?
endm
; please observe that during the test the stack gets invalidated
; therefore a RTS inside the success macro is not possible
success macro
jsr report_success
endm
endif
0001 = carry equ %00000001 ;flag bits in status
0002 = zero equ %00000010
0004 = intdis equ %00000100
0008 = decmode equ %00001000
0010 = break equ %00010000
0020 = reserv equ %00100000
0040 = overfl equ %01000000
0080 = minus equ %10000000
0001 = fc equ carry
0002 = fz equ zero
0003 = fzc equ carry+zero
0040 = fv equ overfl
0042 = fvz equ overfl+zero
0080 = fn equ minus
0081 = fnc equ minus+carry
0082 = fnz equ minus+zero
0083 = fnzc equ minus+zero+carry
00c0 = fnv equ minus+overfl
0030 = fao equ break+reserv ;bits always on after PHP, BRK
0034 = fai equ fao+intdis ;+ forced interrupt disable
00ff = m8 equ $ff ;8 bit mask
00fb = m8i equ $ff&~intdis ;8 bit mask - interrupt disable
;macros to allow masking of status bits.
;masking of interrupt enable/disable on load and compare
;masking of always on bits after PHP or BRK (unused & break) on compare
if I_flag = 0
load_flag macro
lda #\1&m8i ;force enable interrupts (mask I)
endm
cmp_flag macro
cmp #(\1|fao)&m8i ;I_flag is always enabled + always on bits
endm
eor_flag macro
eor #(\1&m8i|fao) ;mask I, invert expected flags + always on bits
endm
endif
if I_flag = 1
load_flag macro
lda #\1|intdis ;force disable interrupts
endm
cmp_flag macro
cmp #(\1|fai)&m8 ;I_flag is always disabled + always on bits
endm
eor_flag macro
eor #(\1|fai) ;invert expected flags + always on bits + I
endm
endif
if I_flag = 2
load_flag macro
lda #\1
ora flag_I_on ;restore I-flag
and flag_I_off
endm
cmp_flag macro
eor flag_I_on ;I_flag is never changed
cmp #(\1|fao)&m8i ;expected flags + always on bits, mask I
endm
eor_flag macro
eor flag_I_on ;I_flag is never changed
eor #(\1&m8i|fao) ;mask I, invert expected flags + always on bits
endm
endif
if I_flag = 3
load_flag macro
lda #\1 ;allow test to change I-flag (no mask)
endm
cmp_flag macro
cmp #(\1|fao)&m8 ;expected flags + always on bits
endm
eor_flag macro
eor #\1|fao ;invert expected flags + always on bits
endm
endif
;macros to set (register|memory|zeropage) & status
set_stat macro ;setting flags in the processor status register
load_flag \1
pha ;use stack to load status
plp
endm
set_a macro ;precharging accu & status
load_flag \2
pha ;use stack to load status
lda #\1 ;precharge accu
plp
endm
set_x macro ;precharging index & status
load_flag \2
pha ;use stack to load status
ldx #\1 ;precharge index x
plp
endm
set_y macro ;precharging index & status
load_flag \2
pha ;use stack to load status
ldy #\1 ;precharge index y
plp
endm
set_ax macro ;precharging indexed accu & immediate status
load_flag \2
pha ;use stack to load status
lda \1,x ;precharge accu
plp
endm
set_ay macro ;precharging indexed accu & immediate status
load_flag \2
pha ;use stack to load status
lda \1,y ;precharge accu
plp
endm
set_z macro ;precharging indexed zp & immediate status
load_flag \2
pha ;use stack to load status
lda \1,x ;load to zeropage
sta zpt
plp
endm
set_zx macro ;precharging zp,x & immediate status
load_flag \2
pha ;use stack to load status
lda \1,x ;load to indexed zeropage
sta zpt,x
plp
endm
set_abs macro ;precharging indexed memory & immediate status
load_flag \2
pha ;use stack to load status
lda \1,x ;load to memory
sta abst
plp
endm
set_absx macro ;precharging abs,x & immediate status
load_flag \2
pha ;use stack to load status
lda \1,x ;load to indexed memory
sta abst,x
plp
endm
;macros to test (register|memory|zeropage) & status & (mask)
tst_stat macro ;testing flags in the processor status register
php ;save status
pla ;use stack to retrieve status
pha
cmp_flag \1
trap_ne
plp ;restore status
endm
tst_a macro ;testing result in accu & flags
php ;save flags
cmp #\1 ;test result
trap_ne
pla ;load status
pha
cmp_flag \2
trap_ne
plp ;restore status
endm
tst_as macro ;testing result in accu & flags, save accu
pha
php ;save flags
cmp #\1 ;test result
trap_ne
pla ;load status
pha
cmp_flag \2
trap_ne
plp ;restore status
pla
endm
tst_x macro ;testing result in x index & flags
php ;save flags
cpx #\1 ;test result
trap_ne
pla ;load status
pha
cmp_flag \2
trap_ne
plp ;restore status
endm
tst_y macro ;testing result in y index & flags
php ;save flags
cpy #\1 ;test result
trap_ne
pla ;load status
pha
cmp_flag \2
trap_ne
plp ;restore status
endm
tst_ax macro ;indexed testing result in accu & flags
php ;save flags
cmp \1,x ;test result
trap_ne
pla ;load status
eor_flag \3
cmp \2,x ;test flags
trap_ne ;
endm
tst_ay macro ;indexed testing result in accu & flags
php ;save flags
cmp \1,y ;test result
trap_ne ;
pla ;load status
eor_flag \3
cmp \2,y ;test flags
trap_ne
endm
tst_z macro ;indexed testing result in zp & flags
php ;save flags
lda zpt
cmp \1,x ;test result
trap_ne
pla ;load status
eor_flag \3
cmp \2,x ;test flags
trap_ne
endm
tst_zx macro ;testing result in zp,x & flags
php ;save flags
lda zpt,x
cmp \1,x ;test result
trap_ne
pla ;load status
eor_flag \3
cmp \2,x ;test flags
trap_ne
endm
tst_abs macro ;indexed testing result in memory & flags
php ;save flags
lda abst
cmp \1,x ;test result
trap_ne
pla ;load status
eor_flag \3
cmp \2,x ;test flags
trap_ne
endm
tst_absx macro ;testing result in abs,x & flags
php ;save flags
lda abst,x
cmp \1,x ;test result
trap_ne
pla ;load status
eor_flag \3
cmp \2,x ;test flags
trap_ne
endm
; RAM integrity test
; verifies that none of the previous tests has altered RAM outside of the
; designated write areas.
; uses zpt word as indirect pointer, zpt+2 word as checksum
if ram_top > -1
check_ram macro
cld
lda #0
sta zpt ;set low byte of indirect pointer
sta zpt+3 ;checksum high byte
ldx #11 ;reset modifiable RAM
ccs1\? sta jxi_tab,x ;JMP indirect page cross area
dex
bpl ccs1\?
clc
ldx #zp_bss-zero_page ;zeropage - write test area
ccs3\? adc zero_page,x
bcc ccs2\?
inc zpt+3 ;carry to high byte
clc
ccs2\? inx
bne ccs3\?
ldx #hi(abs1) ;set high byte of indirect pointer
stx zpt+1
ldy #lo(abs1) ;data after write & execute test area
ccs5\? adc (zpt),y
bcc ccs4\?
inc zpt+3 ;carry to high byte
clc
ccs4\? iny
bne ccs5\?
inx ;advance RAM high address
stx zpt+1
cpx #ram_top
bne ccs5\?
sta zpt+2 ;checksum low is
cmp ram_chksm ;checksum low expected
trap_ne ;checksum mismatch
lda zpt+3 ;checksum high is
cmp ram_chksm+1 ;checksum high expected
trap_ne ;checksum mismatch
endm
else
check_ram macro
;RAM check disabled - RAM size not set
endm
endif
next_test macro ;make sure, tests don't jump the fence
lda test_case ;previous test
cmp #test_num
trap_ne ;test is out of sequence
test_num = test_num + 1
lda #test_num ;*** next tests' number
sta test_case
;check_ram ;uncomment to find altered RAM after each test
endm
if load_data_direct = 1
data
else
bss ;uninitialized segment, copy of data at end of code!
endif
; org zero_page
0000 = org 0 ;edited to provide binaries loading from 0
0000 : 00000000000000.. ds zero_page
;break test interrupt save
000a : 00 irq_a ds 1 ;a register
000b : 00 irq_x ds 1 ;x register
if I_flag = 2
;masking for I bit in status
flag_I_on ds 1 ;or mask to load flags
flag_I_off ds 1 ;and mask to load flags
endif
000c : zpt ;5 bytes store/modify test area
;add/subtract operand generation and result/flag prediction
000c : 00 adfc ds 1 ;carry flag before op
000d : 00 ad1 ds 1 ;operand 1 - accumulator
000e : 00 ad2 ds 1 ;operand 2 - memory / immediate
000f : 00 adrl ds 1 ;expected result bits 0-7
0010 : 00 adrh ds 1 ;expected result bit 8 (carry)
0011 : 00 adrf ds 1 ;expected flags NV0000ZC (-V in decimal mode)
0012 : 00 sb2 ds 1 ;operand 2 complemented for subtract
0013 : zp_bss
0013 : c3824100 zp1 db $c3,$82,$41,0 ;test patterns for LDx BIT ROL ROR ASL LSR
0017 : 7f zp7f db $7f ;test pattern for compare
;logical zeropage operands
0018 : 001f7180 zpOR db 0,$1f,$71,$80 ;test pattern for OR
001c : 0fff7f80 zpAN db $0f,$ff,$7f,$80 ;test pattern for AND
0020 : ff0f8f8f zpEO db $ff,$0f,$8f,$8f ;test pattern for EOR
;indirect addressing pointers
0024 : 1002 ind1 dw abs1 ;indirect pointer to pattern in absolute memory
0026 : 1102 dw abs1+1
0028 : 1202 dw abs1+2
002a : 1302 dw abs1+3
002c : 1402 dw abs7f
002e : 1801 inw1 dw abs1-$f8 ;indirect pointer for wrap-test pattern
0030 : 0502 indt dw abst ;indirect pointer to store area in absolute memory
0032 : 0602 dw abst+1
0034 : 0702 dw abst+2
0036 : 0802 dw abst+3
0038 : 0d01 inwt dw abst-$f8 ;indirect pointer for wrap-test store
003a : 4702 indAN dw absAN ;indirect pointer to AND pattern in absolute memory
003c : 4802 dw absAN+1
003e : 4902 dw absAN+2
0040 : 4a02 dw absAN+3
0042 : 4b02 indEO dw absEO ;indirect pointer to EOR pattern in absolute memory
0044 : 4c02 dw absEO+1
0046 : 4d02 dw absEO+2
0048 : 4e02 dw absEO+3
004a : 4302 indOR dw absOR ;indirect pointer to OR pattern in absolute memory
004c : 4402 dw absOR+1
004e : 4502 dw absOR+2
0050 : 4602 dw absOR+3
;add/subtract indirect pointers
0052 : 0502 adi2 dw ada2 ;indirect pointer to operand 2 in absolute memory
0054 : 0602 sbi2 dw sba2 ;indirect pointer to complemented operand 2 (SBC)
0056 : 0601 adiy2 dw ada2-$ff ;with offset for indirect indexed
0058 : 0701 sbiy2 dw sba2-$ff
005a : zp_bss_end
0200 = org data_segment
0200 : 0000 pg_x ds 2 ;high JMP indirect address for page cross bug
0202 : 00 test_case ds 1 ;current test number
0203 : 0000 ram_chksm ds 2 ;checksum for RAM integrity test
;add/subtract operand copy - abs tests write area
0205 : abst ;5 bytes store/modify test area
0205 : 00 ada2 ds 1 ;operand 2
0206 : 00 sba2 ds 1 ;operand 2 complemented for subtract
0207 : 000000 ds 3 ;fill remaining bytes
020a : data_bss
if load_data_direct = 1
020a : 6900 ex_adci adc #0 ;execute immediate opcodes
020c : 60 rts
020d : e900 ex_sbci sbc #0 ;execute immediate opcodes
020f : 60 rts
else
ex_adci ds 3
ex_sbci ds 3
endif
0210 : c3824100 abs1 db $c3,$82,$41,0 ;test patterns for LDx BIT ROL ROR ASL LSR
0214 : 7f abs7f db $7f ;test pattern for compare
;loads
0215 : 80800002 fLDx db fn,fn,0,fz ;expected flags for load
;shifts
0219 : rASL ;expected result ASL & ROL -carry
0219 : 86048200 rROL db $86,$04,$82,0 ; "
021d : 87058301 rROLc db $87,$05,$83,1 ;expected result ROL +carry
0221 : rLSR ;expected result LSR & ROR -carry
0221 : 61412000 rROR db $61,$41,$20,0 ; "
0225 : e1c1a080 rRORc db $e1,$c1,$a0,$80 ;expected result ROR +carry
0229 : fASL ;expected flags for shifts
0229 : 81018002 fROL db fnc,fc,fn,fz ;no carry in
022d : 81018000 fROLc db fnc,fc,fn,0 ;carry in
0231 : fLSR
0231 : 01000102 fROR db fc,0,fc,fz ;no carry in
0235 : 81808180 fRORc db fnc,fn,fnc,fn ;carry in
;increments (decrements)
0239 : 7f80ff0001 rINC db $7f,$80,$ff,0,1 ;expected result for INC/DEC
023e : 0080800200 fINC db 0,fn,fn,fz,0 ;expected flags for INC/DEC
;logical memory operand
0243 : 001f7180 absOR db 0,$1f,$71,$80 ;test pattern for OR
0247 : 0fff7f80 absAN db $0f,$ff,$7f,$80 ;test pattern for AND
024b : ff0f8f8f absEO db $ff,$0f,$8f,$8f ;test pattern for EOR
;logical accu operand
024f : 00f11f00 absORa db 0,$f1,$1f,0 ;test pattern for OR
0253 : f0ffffff absANa db $f0,$ff,$ff,$ff ;test pattern for AND
0257 : fff0f00f absEOa db $ff,$f0,$f0,$0f ;test pattern for EOR
;logical results
025b : 00ff7f80 absrlo db 0,$ff,$7f,$80
025f : 02800080 absflo db fz,fn,0,fn
0263 : data_bss_end
;define area for page crossing JMP (abs) & JMP (abs,x) test
02f9 = jxi_tab equ data_segment + $100 - 7 ;JMP (jxi_tab,x) x=6
02fd = ji_tab equ data_segment + $100 - 3 ;JMP (ji_tab+2)
0300 = jxp_tab equ data_segment + $100 ;JMP (jxp_tab-255) x=255
code
0400 = org code_segment
0400 : d8 start cld
0401 : a2ff ldx #$ff
0403 : 9a txs
0404 : a900 lda #0 ;*** test 0 = initialize
0406 : 8d0202 sta test_case
0000 = test_num = 0
;stop interrupts before initializing BSS
if I_flag = 1
sei
endif
;initialize I/O for report channel
if report = 1
jsr report_init
endif
;initialize BSS segment
if load_data_direct != 1
ldx #zp_end-zp_init-1
ld_zp lda zp_init,x
sta zp_bss,x
dex
bpl ld_zp
ldx #data_end-data_init-1
ld_data lda data_init,x
sta data_bss,x
dex
bpl ld_data
if ROM_vectors = 1
ldx #5
ld_vect lda vec_init,x
sta vec_bss,x
dex
bpl ld_vect
endif
endif
;retain status of interrupt flag
if I_flag = 2
php
pla
and #4 ;isolate flag
sta flag_I_on ;or mask
eor #lo(~4) ;reverse
sta flag_I_off ;and mask
endif
;generate checksum for RAM integrity test
if ram_top > -1
lda #0
sta zpt ;set low byte of indirect pointer
sta ram_chksm+1 ;checksum high byte
ldx #11 ;reset modifiable RAM
gcs1 sta jxi_tab,x ;JMP indirect page cross area
dex
bpl gcs1
clc
ldx #zp_bss-zero_page ;zeropage - write test area
gcs3 adc zero_page,x
bcc gcs2
inc ram_chksm+1 ;carry to high byte
clc
gcs2 inx
bne gcs3
ldx #hi(abs1) ;set high byte of indirect pointer
stx zpt+1
ldy #lo(abs1) ;data after write & execute test area
gcs5 adc (zpt),y
bcc gcs4
inc ram_chksm+1 ;carry to high byte
clc
gcs4 iny
bne gcs5
inx ;advance RAM high address
stx zpt+1
cpx #ram_top
bne gcs5
sta ram_chksm ;checksum complete
endif
next_test
0409 : ad0202 > lda test_case ;previous test
040c : c900 > cmp #test_num
> trap_ne ;test is out of sequence
040e : d0fe > bne * ;failed not equal (non zero)
>
0001 = >test_num = test_num + 1
0410 : a901 > lda #test_num ;*** next tests' number
0412 : 8d0202 > sta test_case
> ;check_ram ;uncomment to find altered RAM after each test
;testing stack operations PHX PHY PLX PLY
0415 : a999 lda #$99 ;protect a
0417 : a2ff ldx #$ff ;initialize stack
0419 : 9a txs
041a : a255 ldx #$55
041c : da phx
041d : a2aa ldx #$aa
041f : da phx
0420 : ecfe01 cpx $1fe ;on stack ?
trap_ne
0423 : d0fe > bne * ;failed not equal (non zero)
0425 : ba tsx
0426 : e0fd cpx #$fd ;sp decremented?
trap_ne
0428 : d0fe > bne * ;failed not equal (non zero)
042a : 7a ply
042b : c0aa cpy #$aa ;successful retreived from stack?
trap_ne
042d : d0fe > bne * ;failed not equal (non zero)
042f : 7a ply
0430 : c055 cpy #$55
trap_ne
0432 : d0fe > bne * ;failed not equal (non zero)
0434 : ccff01 cpy $1ff ;remains on stack?
trap_ne
0437 : d0fe > bne * ;failed not equal (non zero)
0439 : ba tsx
043a : e0ff cpx #$ff ;sp incremented?
trap_ne
043c : d0fe > bne * ;failed not equal (non zero)
043e : a0a5 ldy #$a5
0440 : 5a phy
0441 : a05a ldy #$5a
0443 : 5a phy
0444 : ccfe01 cpy $1fe ;on stack ?
trap_ne
0447 : d0fe > bne * ;failed not equal (non zero)
0449 : ba tsx
044a : e0fd cpx #$fd ;sp decremented?
trap_ne
044c : d0fe > bne * ;failed not equal (non zero)
044e : fa plx
044f : e05a cpx #$5a ;successful retreived from stack?
trap_ne
0451 : d0fe > bne * ;failed not equal (non zero)
0453 : fa plx
0454 : e0a5 cpx #$a5
trap_ne
0456 : d0fe > bne * ;failed not equal (non zero)
0458 : ecff01 cpx $1ff ;remains on stack?
trap_ne
045b : d0fe > bne * ;failed not equal (non zero)
045d : ba tsx
045e : e0ff cpx #$ff ;sp incremented?
trap_ne
0460 : d0fe > bne * ;failed not equal (non zero)
0462 : c999 cmp #$99 ;unchanged?
trap_ne
0464 : d0fe > bne * ;failed not equal (non zero)
next_test
0466 : ad0202 > lda test_case ;previous test
0469 : c901 > cmp #test_num
> trap_ne ;test is out of sequence
046b : d0fe > bne * ;failed not equal (non zero)
>
0002 = >test_num = test_num + 1
046d : a902 > lda #test_num ;*** next tests' number
046f : 8d0202 > sta test_case
> ;check_ram ;uncomment to find altered RAM after each test
; test PHX does not alter flags or X but PLX does
0472 : a0aa ldy #$aa ;protect y
set_x 1,$ff ;push
> load_flag $ff
0474 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
0476 : 48 > pha ;use stack to load status
0477 : a201 > ldx #1 ;precharge index x
0479 : 28 > plp
047a : da phx
tst_x 1,$ff
047b : 08 > php ;save flags
047c : e001 > cpx #1 ;test result
> trap_ne
047e : d0fe > bne * ;failed not equal (non zero)
>
0480 : 68 > pla ;load status
0481 : 48 > pha
> cmp_flag $ff
0482 : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0484 : d0fe > bne * ;failed not equal (non zero)
>
0486 : 28 > plp ;restore status
set_x 0,0
> load_flag 0
0487 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
0489 : 48 > pha ;use stack to load status
048a : a200 > ldx #0 ;precharge index x
048c : 28 > plp
048d : da phx
tst_x 0,0
048e : 08 > php ;save flags
048f : e000 > cpx #0 ;test result
> trap_ne
0491 : d0fe > bne * ;failed not equal (non zero)
>
0493 : 68 > pla ;load status
0494 : 48 > pha
> cmp_flag 0
0495 : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0497 : d0fe > bne * ;failed not equal (non zero)
>
0499 : 28 > plp ;restore status
set_x $ff,$ff
> load_flag $ff
049a : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
049c : 48 > pha ;use stack to load status
049d : a2ff > ldx #$ff ;precharge index x
049f : 28 > plp
04a0 : da phx
tst_x $ff,$ff
04a1 : 08 > php ;save flags
04a2 : e0ff > cpx #$ff ;test result
> trap_ne
04a4 : d0fe > bne * ;failed not equal (non zero)
>
04a6 : 68 > pla ;load status
04a7 : 48 > pha
> cmp_flag $ff
04a8 : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
04aa : d0fe > bne * ;failed not equal (non zero)
>
04ac : 28 > plp ;restore status
set_x 1,0
> load_flag 0
04ad : a900 > lda #0 ;allow test to change I-flag (no mask)
>
04af : 48 > pha ;use stack to load status
04b0 : a201 > ldx #1 ;precharge index x
04b2 : 28 > plp
04b3 : da phx
tst_x 1,0
04b4 : 08 > php ;save flags
04b5 : e001 > cpx #1 ;test result
> trap_ne
04b7 : d0fe > bne * ;failed not equal (non zero)
>
04b9 : 68 > pla ;load status
04ba : 48 > pha
> cmp_flag 0
04bb : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
04bd : d0fe > bne * ;failed not equal (non zero)
>
04bf : 28 > plp ;restore status
set_x 0,$ff
> load_flag $ff
04c0 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
04c2 : 48 > pha ;use stack to load status
04c3 : a200 > ldx #0 ;precharge index x
04c5 : 28 > plp
04c6 : da phx
tst_x 0,$ff
04c7 : 08 > php ;save flags
04c8 : e000 > cpx #0 ;test result
> trap_ne
04ca : d0fe > bne * ;failed not equal (non zero)
>
04cc : 68 > pla ;load status
04cd : 48 > pha
> cmp_flag $ff
04ce : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
04d0 : d0fe > bne * ;failed not equal (non zero)
>
04d2 : 28 > plp ;restore status
set_x $ff,0
> load_flag 0
04d3 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
04d5 : 48 > pha ;use stack to load status
04d6 : a2ff > ldx #$ff ;precharge index x
04d8 : 28 > plp
04d9 : da phx
tst_x $ff,0
04da : 08 > php ;save flags
04db : e0ff > cpx #$ff ;test result
> trap_ne
04dd : d0fe > bne * ;failed not equal (non zero)
>
04df : 68 > pla ;load status
04e0 : 48 > pha
> cmp_flag 0
04e1 : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
04e3 : d0fe > bne * ;failed not equal (non zero)
>
04e5 : 28 > plp ;restore status
set_x 0,$ff ;pull
> load_flag $ff
04e6 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
04e8 : 48 > pha ;use stack to load status
04e9 : a200 > ldx #0 ;precharge index x
04eb : 28 > plp
04ec : fa plx
tst_x $ff,$ff-zero
04ed : 08 > php ;save flags
04ee : e0ff > cpx #$ff ;test result
> trap_ne
04f0 : d0fe > bne * ;failed not equal (non zero)
>
04f2 : 68 > pla ;load status
04f3 : 48 > pha
> cmp_flag $ff-zero
04f4 : c9fd > cmp #($ff-zero|fao)&m8 ;expected flags + always on bits
>
> trap_ne
04f6 : d0fe > bne * ;failed not equal (non zero)
>
04f8 : 28 > plp ;restore status
set_x $ff,0
> load_flag 0
04f9 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
04fb : 48 > pha ;use stack to load status
04fc : a2ff > ldx #$ff ;precharge index x
04fe : 28 > plp
04ff : fa plx
tst_x 0,zero
0500 : 08 > php ;save flags
0501 : e000 > cpx #0 ;test result
> trap_ne
0503 : d0fe > bne * ;failed not equal (non zero)
>
0505 : 68 > pla ;load status
0506 : 48 > pha
> cmp_flag zero
0507 : c932 > cmp #(zero|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0509 : d0fe > bne * ;failed not equal (non zero)
>
050b : 28 > plp ;restore status
set_x $fe,$ff
> load_flag $ff
050c : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
050e : 48 > pha ;use stack to load status
050f : a2fe > ldx #$fe ;precharge index x
0511 : 28 > plp
0512 : fa plx
tst_x 1,$ff-zero-minus
0513 : 08 > php ;save flags
0514 : e001 > cpx #1 ;test result
> trap_ne
0516 : d0fe > bne * ;failed not equal (non zero)
>
0518 : 68 > pla ;load status
0519 : 48 > pha
> cmp_flag $ff-zero-minus
051a : c97d > cmp #($ff-zero-minus|fao)&m8 ;expected flags + always on bits
>
> trap_ne
051c : d0fe > bne * ;failed not equal (non zero)
>
051e : 28 > plp ;restore status
set_x 0,0
> load_flag 0
051f : a900 > lda #0 ;allow test to change I-flag (no mask)
>
0521 : 48 > pha ;use stack to load status
0522 : a200 > ldx #0 ;precharge index x
0524 : 28 > plp
0525 : fa plx
tst_x $ff,minus
0526 : 08 > php ;save flags
0527 : e0ff > cpx #$ff ;test result
> trap_ne
0529 : d0fe > bne * ;failed not equal (non zero)
>
052b : 68 > pla ;load status
052c : 48 > pha
> cmp_flag minus
052d : c9b0 > cmp #(minus|fao)&m8 ;expected flags + always on bits
>
> trap_ne
052f : d0fe > bne * ;failed not equal (non zero)
>
0531 : 28 > plp ;restore status
set_x $ff,$ff
> load_flag $ff
0532 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
0534 : 48 > pha ;use stack to load status
0535 : a2ff > ldx #$ff ;precharge index x
0537 : 28 > plp
0538 : fa plx
tst_x 0,$ff-minus
0539 : 08 > php ;save flags
053a : e000 > cpx #0 ;test result
> trap_ne
053c : d0fe > bne * ;failed not equal (non zero)
>
053e : 68 > pla ;load status
053f : 48 > pha
> cmp_flag $ff-minus
0540 : c97f > cmp #($ff-minus|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0542 : d0fe > bne * ;failed not equal (non zero)
>
0544 : 28 > plp ;restore status
set_x $fe,0
> load_flag 0
0545 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
0547 : 48 > pha ;use stack to load status
0548 : a2fe > ldx #$fe ;precharge index x
054a : 28 > plp
054b : fa plx
tst_x 1,0
054c : 08 > php ;save flags
054d : e001 > cpx #1 ;test result
> trap_ne
054f : d0fe > bne * ;failed not equal (non zero)
>
0551 : 68 > pla ;load status
0552 : 48 > pha
> cmp_flag 0
0553 : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0555 : d0fe > bne * ;failed not equal (non zero)
>
0557 : 28 > plp ;restore status
0558 : c0aa cpy #$aa ;Y unchanged
trap_ne
055a : d0fe > bne * ;failed not equal (non zero)
next_test
055c : ad0202 > lda test_case ;previous test
055f : c902 > cmp #test_num
> trap_ne ;test is out of sequence
0561 : d0fe > bne * ;failed not equal (non zero)
>
0003 = >test_num = test_num + 1
0563 : a903 > lda #test_num ;*** next tests' number
0565 : 8d0202 > sta test_case
> ;check_ram ;uncomment to find altered RAM after each test
; test PHY does not alter flags or Y but PLY does
0568 : a255 ldx #$55 ;x & a protected
set_y 1,$ff ;push
> load_flag $ff
056a : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
056c : 48 > pha ;use stack to load status
056d : a001 > ldy #1 ;precharge index y
056f : 28 > plp
0570 : 5a phy
tst_y 1,$ff
0571 : 08 > php ;save flags
0572 : c001 > cpy #1 ;test result
> trap_ne
0574 : d0fe > bne * ;failed not equal (non zero)
>
0576 : 68 > pla ;load status
0577 : 48 > pha
> cmp_flag $ff
0578 : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
057a : d0fe > bne * ;failed not equal (non zero)
>
057c : 28 > plp ;restore status
set_y 0,0
> load_flag 0
057d : a900 > lda #0 ;allow test to change I-flag (no mask)
>
057f : 48 > pha ;use stack to load status
0580 : a000 > ldy #0 ;precharge index y
0582 : 28 > plp
0583 : 5a phy
tst_y 0,0
0584 : 08 > php ;save flags
0585 : c000 > cpy #0 ;test result
> trap_ne
0587 : d0fe > bne * ;failed not equal (non zero)
>
0589 : 68 > pla ;load status
058a : 48 > pha
> cmp_flag 0
058b : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
058d : d0fe > bne * ;failed not equal (non zero)
>
058f : 28 > plp ;restore status
set_y $ff,$ff
> load_flag $ff
0590 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
0592 : 48 > pha ;use stack to load status
0593 : a0ff > ldy #$ff ;precharge index y
0595 : 28 > plp
0596 : 5a phy
tst_y $ff,$ff
0597 : 08 > php ;save flags
0598 : c0ff > cpy #$ff ;test result
> trap_ne
059a : d0fe > bne * ;failed not equal (non zero)
>
059c : 68 > pla ;load status
059d : 48 > pha
> cmp_flag $ff
059e : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
05a0 : d0fe > bne * ;failed not equal (non zero)
>
05a2 : 28 > plp ;restore status
set_y 1,0
> load_flag 0
05a3 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
05a5 : 48 > pha ;use stack to load status
05a6 : a001 > ldy #1 ;precharge index y
05a8 : 28 > plp
05a9 : 5a phy
tst_y 1,0
05aa : 08 > php ;save flags
05ab : c001 > cpy #1 ;test result
> trap_ne
05ad : d0fe > bne * ;failed not equal (non zero)
>
05af : 68 > pla ;load status
05b0 : 48 > pha
> cmp_flag 0
05b1 : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
05b3 : d0fe > bne * ;failed not equal (non zero)
>
05b5 : 28 > plp ;restore status
set_y 0,$ff
> load_flag $ff
05b6 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
05b8 : 48 > pha ;use stack to load status
05b9 : a000 > ldy #0 ;precharge index y
05bb : 28 > plp
05bc : 5a phy
tst_y 0,$ff
05bd : 08 > php ;save flags
05be : c000 > cpy #0 ;test result
> trap_ne
05c0 : d0fe > bne * ;failed not equal (non zero)
>
05c2 : 68 > pla ;load status
05c3 : 48 > pha
> cmp_flag $ff
05c4 : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
05c6 : d0fe > bne * ;failed not equal (non zero)
>
05c8 : 28 > plp ;restore status
set_y $ff,0
> load_flag 0
05c9 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
05cb : 48 > pha ;use stack to load status
05cc : a0ff > ldy #$ff ;precharge index y
05ce : 28 > plp
05cf : 5a phy
tst_y $ff,0
05d0 : 08 > php ;save flags
05d1 : c0ff > cpy #$ff ;test result
> trap_ne
05d3 : d0fe > bne * ;failed not equal (non zero)
>
05d5 : 68 > pla ;load status
05d6 : 48 > pha
> cmp_flag 0
05d7 : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
05d9 : d0fe > bne * ;failed not equal (non zero)
>
05db : 28 > plp ;restore status
set_y 0,$ff ;pull
> load_flag $ff
05dc : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
05de : 48 > pha ;use stack to load status
05df : a000 > ldy #0 ;precharge index y
05e1 : 28 > plp
05e2 : 7a ply
tst_y $ff,$ff-zero
05e3 : 08 > php ;save flags
05e4 : c0ff > cpy #$ff ;test result
> trap_ne
05e6 : d0fe > bne * ;failed not equal (non zero)
>
05e8 : 68 > pla ;load status
05e9 : 48 > pha
> cmp_flag $ff-zero
05ea : c9fd > cmp #($ff-zero|fao)&m8 ;expected flags + always on bits
>
> trap_ne
05ec : d0fe > bne * ;failed not equal (non zero)
>
05ee : 28 > plp ;restore status
set_y $ff,0
> load_flag 0
05ef : a900 > lda #0 ;allow test to change I-flag (no mask)
>
05f1 : 48 > pha ;use stack to load status
05f2 : a0ff > ldy #$ff ;precharge index y
05f4 : 28 > plp
05f5 : 7a ply
tst_y 0,zero
05f6 : 08 > php ;save flags
05f7 : c000 > cpy #0 ;test result
> trap_ne
05f9 : d0fe > bne * ;failed not equal (non zero)
>
05fb : 68 > pla ;load status
05fc : 48 > pha
> cmp_flag zero
05fd : c932 > cmp #(zero|fao)&m8 ;expected flags + always on bits
>
> trap_ne
05ff : d0fe > bne * ;failed not equal (non zero)
>
0601 : 28 > plp ;restore status
set_y $fe,$ff
> load_flag $ff
0602 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
0604 : 48 > pha ;use stack to load status
0605 : a0fe > ldy #$fe ;precharge index y
0607 : 28 > plp
0608 : 7a ply
tst_y 1,$ff-zero-minus
0609 : 08 > php ;save flags
060a : c001 > cpy #1 ;test result
> trap_ne
060c : d0fe > bne * ;failed not equal (non zero)
>
060e : 68 > pla ;load status
060f : 48 > pha
> cmp_flag $ff-zero-minus
0610 : c97d > cmp #($ff-zero-minus|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0612 : d0fe > bne * ;failed not equal (non zero)
>
0614 : 28 > plp ;restore status
set_y 0,0
> load_flag 0
0615 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
0617 : 48 > pha ;use stack to load status
0618 : a000 > ldy #0 ;precharge index y
061a : 28 > plp
061b : 7a ply
tst_y $ff,minus
061c : 08 > php ;save flags
061d : c0ff > cpy #$ff ;test result
> trap_ne
061f : d0fe > bne * ;failed not equal (non zero)
>
0621 : 68 > pla ;load status
0622 : 48 > pha
> cmp_flag minus
0623 : c9b0 > cmp #(minus|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0625 : d0fe > bne * ;failed not equal (non zero)
>
0627 : 28 > plp ;restore status
set_y $ff,$ff
> load_flag $ff
0628 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
062a : 48 > pha ;use stack to load status
062b : a0ff > ldy #$ff ;precharge index y
062d : 28 > plp
062e : 7a ply
tst_y 0,$ff-minus
062f : 08 > php ;save flags
0630 : c000 > cpy #0 ;test result
> trap_ne
0632 : d0fe > bne * ;failed not equal (non zero)
>
0634 : 68 > pla ;load status
0635 : 48 > pha
> cmp_flag $ff-minus
0636 : c97f > cmp #($ff-minus|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0638 : d0fe > bne * ;failed not equal (non zero)
>
063a : 28 > plp ;restore status
set_y $fe,0
> load_flag 0
063b : a900 > lda #0 ;allow test to change I-flag (no mask)
>
063d : 48 > pha ;use stack to load status
063e : a0fe > ldy #$fe ;precharge index y
0640 : 28 > plp
0641 : 7a ply
tst_y 1,0
0642 : 08 > php ;save flags
0643 : c001 > cpy #1 ;test result
> trap_ne
0645 : d0fe > bne * ;failed not equal (non zero)
>
0647 : 68 > pla ;load status
0648 : 48 > pha
> cmp_flag 0
0649 : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
064b : d0fe > bne * ;failed not equal (non zero)
>
064d : 28 > plp ;restore status
064e : e055 cpx #$55 ;x unchanged?
trap_ne
0650 : d0fe > bne * ;failed not equal (non zero)
next_test
0652 : ad0202 > lda test_case ;previous test
0655 : c903 > cmp #test_num
> trap_ne ;test is out of sequence
0657 : d0fe > bne * ;failed not equal (non zero)
>
0004 = >test_num = test_num + 1
0659 : a904 > lda #test_num ;*** next tests' number
065b : 8d0202 > sta test_case
> ;check_ram ;uncomment to find altered RAM after each test
; PC modifying instructions (BRA, BBR, BBS, 1, 2, 3 byte NOPs, JMP(abs,x))
; testing unconditional branch BRA
065e : a281 ldx #$81 ;protect unused registers
0660 : a07e ldy #$7e
set_a 0,$ff
> load_flag $ff
0662 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
0664 : 48 > pha ;use stack to load status
0665 : a900 > lda #0 ;precharge accu
0667 : 28 > plp
0668 : 8003 bra br1 ;branch should always be taken
trap
066a : 4c6a06 > jmp * ;failed anyway
066d : br1
tst_a 0,$ff
066d : 08 > php ;save flags
066e : c900 > cmp #0 ;test result
> trap_ne
0670 : d0fe > bne * ;failed not equal (non zero)
>
0672 : 68 > pla ;load status
0673 : 48 > pha
> cmp_flag $ff
0674 : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0676 : d0fe > bne * ;failed not equal (non zero)
>
0678 : 28 > plp ;restore status
set_a $ff,0
> load_flag 0
0679 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
067b : 48 > pha ;use stack to load status
067c : a9ff > lda #$ff ;precharge accu
067e : 28 > plp
067f : 8003 bra br2 ;branch should always be taken
trap
0681 : 4c8106 > jmp * ;failed anyway
0684 : br2
tst_a $ff,0
0684 : 08 > php ;save flags
0685 : c9ff > cmp #$ff ;test result
> trap_ne
0687 : d0fe > bne * ;failed not equal (non zero)
>
0689 : 68 > pla ;load status
068a : 48 > pha
> cmp_flag 0
068b : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
068d : d0fe > bne * ;failed not equal (non zero)
>
068f : 28 > plp ;restore status
0690 : e081 cpx #$81
trap_ne
0692 : d0fe > bne * ;failed not equal (non zero)
0694 : c07e cpy #$7e
trap_ne
0696 : d0fe > bne * ;failed not equal (non zero)
next_test
0698 : ad0202 > lda test_case ;previous test
069b : c904 > cmp #test_num
> trap_ne ;test is out of sequence
069d : d0fe > bne * ;failed not equal (non zero)
>
0005 = >test_num = test_num + 1
069f : a905 > lda #test_num ;*** next tests' number
06a1 : 8d0202 > sta test_case
> ;check_ram ;uncomment to find altered RAM after each test
06a4 : a000 ldy #0 ;branch range test
06a6 : 8061 bra bra0
06a8 : c001 bra1 cpy #1
trap_ne ;long range backward
06aa : d0fe > bne * ;failed not equal (non zero)
06ac : c8 iny
06ad : 8053 bra bra2
06af : c003 bra3 cpy #3
trap_ne ;long range backward
06b1 : d0fe > bne * ;failed not equal (non zero)
06b3 : c8 iny
06b4 : 8045 bra bra4
06b6 : c005 bra5 cpy #5
trap_ne ;long range backward
06b8 : d0fe > bne * ;failed not equal (non zero)
06ba : c8 iny
06bb : a000 ldy #0
06bd : 8004 bra brf0
06bf : c8 iny
06c0 : c8 iny
06c1 : c8 iny
06c2 : c8 iny
06c3 : 8003 brf0 bra brf1
06c5 : c8 iny
06c6 : c8 iny
06c7 : c8 iny
06c8 : c8 brf1 iny
06c9 : 8002 bra brf2
06cb : c8 iny
06cc : c8 iny
06cd : c8 brf2 iny
06ce : c8 iny
06cf : 8001 bra brf3
06d1 : c8 iny
06d2 : c8 brf3 iny
06d3 : c8 iny
06d4 : c8 iny
06d5 : 8000 bra brf4
06d7 : c8 brf4 iny
06d8 : c8 iny
06d9 : c8 iny
06da : c8 iny
06db : c00a cpy #10
trap_ne ;short range forward
06dd : d0fe > bne * ;failed not equal (non zero)
06df : 8012 bra brb0
06e1 : 88 brb4 dey
06e2 : 88 dey
06e3 : 88 dey
06e4 : 88 dey
06e5 : 800e bra brb5
06e7 : 88 brb3 dey
06e8 : 88 dey
06e9 : 88 dey
06ea : 80f5 bra brb4
06ec : 88 brb2 dey
06ed : 88 dey
06ee : 80f7 bra brb3
06f0 : 88 brb1 dey
06f1 : 80f9 bra brb2
06f3 : 80fb brb0 bra brb1
06f5 : c000 brb5 cpy #0
trap_ne ;short range backward
06f7 : d0fe > bne * ;failed not equal (non zero)
06f9 : 8015 bra bra6
06fb : c004 bra4 cpy #4
trap_ne ;long range forward
06fd : d0fe > bne * ;failed not equal (non zero)
06ff : c8 iny
0700 : 80b4 bra bra5
0702 : c002 bra2 cpy #2
trap_ne ;long range forward
0704 : d0fe > bne * ;failed not equal (non zero)
0706 : c8 iny
0707 : 80a6 bra bra3
0709 : c000 bra0 cpy #0
trap_ne ;long range forward
070b : d0fe > bne * ;failed not equal (non zero)
070d : c8 iny
070e : 8098 bra bra1
0710 : bra6
next_test
0710 : ad0202 > lda test_case ;previous test
0713 : c905 > cmp #test_num
> trap_ne ;test is out of sequence
0715 : d0fe > bne * ;failed not equal (non zero)
>
0006 = >test_num = test_num + 1
0717 : a906 > lda #test_num ;*** next tests' number
0719 : 8d0202 > sta test_case
> ;check_ram ;uncomment to find altered RAM after each test
if rkwl_wdc_op = 1
; testing BBR & BBS
bbt macro ;\1 = bitnum
lda #(1<<\1) ;testing 1 bit on
sta zpt
set_a $33,0 ;with flags off
bbr \1,zpt,fail1\?
bbs \1,zpt,ok1\?
trap ;bbs branch not taken
fail1\?
trap ;bbr branch taken
ok1\?
tst_a $33,0
set_a $cc,$ff ;with flags on
bbr \1,zpt,fail2\?
bbs \1,zpt,ok2\?
trap ;bbs branch not taken
fail2\?
trap ;bbr branch taken
ok2\?
tst_a $cc,$ff
lda zpt
cmp #(1<<\1)
trap_ne ;zp altered
lda #$ff-(1<<\1) ;testing 1 bit off
sta zpt
set_a $33,0 ;with flags off
bbs \1,zpt,fail3\?
bbr \1,zpt,ok3\?
trap ;bbr branch not taken
fail3\?
trap ;bbs branch taken
ok3\?
tst_a $33,0
set_a $cc,$ff ;with flags on
bbs \1,zpt,fail4\?
bbr \1,zpt,ok4\?
trap ;bbr branch not taken
fail4\?
trap ;bbs branch taken
ok4\?
tst_a $cc,$ff
lda zpt
cmp #$ff-(1<<\1)
trap_ne ;zp altered
endm
071c : a211 ldx #$11 ;test bbr/bbs integrity
071e : a022 ldy #$22
bbt 0
0720 : a901 > lda #(1<<0) ;testing 1 bit on
0722 : 850c > sta zpt
> set_a $33,0 ;with flags off
> load_flag 0
0724 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
0726 : 48 > pha ;use stack to load status
0727 : a933 > lda #$33 ;precharge accu
0729 : 28 > plp
>
072a : 0f0c06 > bbr 0,zpt,fail10196
072d : 8f0c06 > bbs 0,zpt,ok10196
> trap ;bbs branch not taken
0730 : 4c3007 > jmp * ;failed anyway
>
0733 : >fail10196
> trap ;bbr branch taken
0733 : 4c3307 > jmp * ;failed anyway
>
0736 : >ok10196
> tst_a $33,0
0736 : 08 > php ;save flags
0737 : c933 > cmp #$33 ;test result
> trap_ne
0739 : d0fe > bne * ;failed not equal (non zero)
>
073b : 68 > pla ;load status
073c : 48 > pha
> cmp_flag 0
073d : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
073f : d0fe > bne * ;failed not equal (non zero)
>
0741 : 28 > plp ;restore status
>
> set_a $cc,$ff ;with flags on
> load_flag $ff
0742 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
0744 : 48 > pha ;use stack to load status
0745 : a9cc > lda #$cc ;precharge accu
0747 : 28 > plp
>
0748 : 0f0c06 > bbr 0,zpt,fail20196
074b : 8f0c06 > bbs 0,zpt,ok20196
> trap ;bbs branch not taken
074e : 4c4e07 > jmp * ;failed anyway
>
0751 : >fail20196
> trap ;bbr branch taken
0751 : 4c5107 > jmp * ;failed anyway
>
0754 : >ok20196
> tst_a $cc,$ff
0754 : 08 > php ;save flags
0755 : c9cc > cmp #$cc ;test result
> trap_ne
0757 : d0fe > bne * ;failed not equal (non zero)
>
0759 : 68 > pla ;load status
075a : 48 > pha
> cmp_flag $ff
075b : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
075d : d0fe > bne * ;failed not equal (non zero)
>
075f : 28 > plp ;restore status
>
0760 : a50c > lda zpt
0762 : c901 > cmp #(1<<0)
> trap_ne ;zp altered
0764 : d0fe > bne * ;failed not equal (non zero)
>
0766 : a9fe > lda #$ff-(1<<0) ;testing 1 bit off
0768 : 850c > sta zpt
> set_a $33,0 ;with flags off
> load_flag 0
076a : a900 > lda #0 ;allow test to change I-flag (no mask)
>
076c : 48 > pha ;use stack to load status
076d : a933 > lda #$33 ;precharge accu
076f : 28 > plp
>
0770 : 8f0c06 > bbs 0,zpt,fail30196
0773 : 0f0c06 > bbr 0,zpt,ok30196
> trap ;bbr branch not taken
0776 : 4c7607 > jmp * ;failed anyway
>
0779 : >fail30196
> trap ;bbs branch taken
0779 : 4c7907 > jmp * ;failed anyway
>
077c : >ok30196
> tst_a $33,0
077c : 08 > php ;save flags
077d : c933 > cmp #$33 ;test result
> trap_ne
077f : d0fe > bne * ;failed not equal (non zero)
>
0781 : 68 > pla ;load status
0782 : 48 > pha
> cmp_flag 0
0783 : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0785 : d0fe > bne * ;failed not equal (non zero)
>
0787 : 28 > plp ;restore status
>
> set_a $cc,$ff ;with flags on
> load_flag $ff
0788 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
078a : 48 > pha ;use stack to load status
078b : a9cc > lda #$cc ;precharge accu
078d : 28 > plp
>
078e : 8f0c06 > bbs 0,zpt,fail40196
0791 : 0f0c06 > bbr 0,zpt,ok40196
> trap ;bbr branch not taken
0794 : 4c9407 > jmp * ;failed anyway
>
0797 : >fail40196
> trap ;bbs branch taken
0797 : 4c9707 > jmp * ;failed anyway
>
079a : >ok40196
> tst_a $cc,$ff
079a : 08 > php ;save flags
079b : c9cc > cmp #$cc ;test result
> trap_ne
079d : d0fe > bne * ;failed not equal (non zero)
>
079f : 68 > pla ;load status
07a0 : 48 > pha
> cmp_flag $ff
07a1 : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
07a3 : d0fe > bne * ;failed not equal (non zero)
>
07a5 : 28 > plp ;restore status
>
07a6 : a50c > lda zpt
07a8 : c9fe > cmp #$ff-(1<<0)
> trap_ne ;zp altered
07aa : d0fe > bne * ;failed not equal (non zero)
>
bbt 1
07ac : a902 > lda #(1<<1) ;testing 1 bit on
07ae : 850c > sta zpt
> set_a $33,0 ;with flags off
> load_flag 0
07b0 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
07b2 : 48 > pha ;use stack to load status
07b3 : a933 > lda #$33 ;precharge accu
07b5 : 28 > plp
>
07b6 : 1f0c06 > bbr 1,zpt,fail10231
07b9 : 9f0c06 > bbs 1,zpt,ok10231
> trap ;bbs branch not taken
07bc : 4cbc07 > jmp * ;failed anyway
>
07bf : >fail10231
> trap ;bbr branch taken
07bf : 4cbf07 > jmp * ;failed anyway
>
07c2 : >ok10231
> tst_a $33,0
07c2 : 08 > php ;save flags
07c3 : c933 > cmp #$33 ;test result
> trap_ne
07c5 : d0fe > bne * ;failed not equal (non zero)
>
07c7 : 68 > pla ;load status
07c8 : 48 > pha
> cmp_flag 0
07c9 : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
07cb : d0fe > bne * ;failed not equal (non zero)
>
07cd : 28 > plp ;restore status
>
> set_a $cc,$ff ;with flags on
> load_flag $ff
07ce : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
07d0 : 48 > pha ;use stack to load status
07d1 : a9cc > lda #$cc ;precharge accu
07d3 : 28 > plp
>
07d4 : 1f0c06 > bbr 1,zpt,fail20231
07d7 : 9f0c06 > bbs 1,zpt,ok20231
> trap ;bbs branch not taken
07da : 4cda07 > jmp * ;failed anyway
>
07dd : >fail20231
> trap ;bbr branch taken
07dd : 4cdd07 > jmp * ;failed anyway
>
07e0 : >ok20231
> tst_a $cc,$ff
07e0 : 08 > php ;save flags
07e1 : c9cc > cmp #$cc ;test result
> trap_ne
07e3 : d0fe > bne * ;failed not equal (non zero)
>
07e5 : 68 > pla ;load status
07e6 : 48 > pha
> cmp_flag $ff
07e7 : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
07e9 : d0fe > bne * ;failed not equal (non zero)
>
07eb : 28 > plp ;restore status
>
07ec : a50c > lda zpt
07ee : c902 > cmp #(1<<1)
> trap_ne ;zp altered
07f0 : d0fe > bne * ;failed not equal (non zero)
>
07f2 : a9fd > lda #$ff-(1<<1) ;testing 1 bit off
07f4 : 850c > sta zpt
> set_a $33,0 ;with flags off
> load_flag 0
07f6 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
07f8 : 48 > pha ;use stack to load status
07f9 : a933 > lda #$33 ;precharge accu
07fb : 28 > plp
>
07fc : 9f0c06 > bbs 1,zpt,fail30231
07ff : 1f0c06 > bbr 1,zpt,ok30231
> trap ;bbr branch not taken
0802 : 4c0208 > jmp * ;failed anyway
>
0805 : >fail30231
> trap ;bbs branch taken
0805 : 4c0508 > jmp * ;failed anyway
>
0808 : >ok30231
> tst_a $33,0
0808 : 08 > php ;save flags
0809 : c933 > cmp #$33 ;test result
> trap_ne
080b : d0fe > bne * ;failed not equal (non zero)
>
080d : 68 > pla ;load status
080e : 48 > pha
> cmp_flag 0
080f : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0811 : d0fe > bne * ;failed not equal (non zero)
>
0813 : 28 > plp ;restore status
>
> set_a $cc,$ff ;with flags on
> load_flag $ff
0814 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
0816 : 48 > pha ;use stack to load status
0817 : a9cc > lda #$cc ;precharge accu
0819 : 28 > plp
>
081a : 9f0c06 > bbs 1,zpt,fail40231
081d : 1f0c06 > bbr 1,zpt,ok40231
> trap ;bbr branch not taken
0820 : 4c2008 > jmp * ;failed anyway
>
0823 : >fail40231
> trap ;bbs branch taken
0823 : 4c2308 > jmp * ;failed anyway
>
0826 : >ok40231
> tst_a $cc,$ff
0826 : 08 > php ;save flags
0827 : c9cc > cmp #$cc ;test result
> trap_ne
0829 : d0fe > bne * ;failed not equal (non zero)
>
082b : 68 > pla ;load status
082c : 48 > pha
> cmp_flag $ff
082d : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
082f : d0fe > bne * ;failed not equal (non zero)
>
0831 : 28 > plp ;restore status
>
0832 : a50c > lda zpt
0834 : c9fd > cmp #$ff-(1<<1)
> trap_ne ;zp altered
0836 : d0fe > bne * ;failed not equal (non zero)
>
bbt 2
0838 : a904 > lda #(1<<2) ;testing 1 bit on
083a : 850c > sta zpt
> set_a $33,0 ;with flags off
> load_flag 0
083c : a900 > lda #0 ;allow test to change I-flag (no mask)
>
083e : 48 > pha ;use stack to load status
083f : a933 > lda #$33 ;precharge accu
0841 : 28 > plp
>
0842 : 2f0c06 > bbr 2,zpt,fail10266
0845 : af0c06 > bbs 2,zpt,ok10266
> trap ;bbs branch not taken
0848 : 4c4808 > jmp * ;failed anyway
>
084b : >fail10266
> trap ;bbr branch taken
084b : 4c4b08 > jmp * ;failed anyway
>
084e : >ok10266
> tst_a $33,0
084e : 08 > php ;save flags
084f : c933 > cmp #$33 ;test result
> trap_ne
0851 : d0fe > bne * ;failed not equal (non zero)
>
0853 : 68 > pla ;load status
0854 : 48 > pha
> cmp_flag 0
0855 : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0857 : d0fe > bne * ;failed not equal (non zero)
>
0859 : 28 > plp ;restore status
>
> set_a $cc,$ff ;with flags on
> load_flag $ff
085a : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
085c : 48 > pha ;use stack to load status
085d : a9cc > lda #$cc ;precharge accu
085f : 28 > plp
>
0860 : 2f0c06 > bbr 2,zpt,fail20266
0863 : af0c06 > bbs 2,zpt,ok20266
> trap ;bbs branch not taken
0866 : 4c6608 > jmp * ;failed anyway
>
0869 : >fail20266
> trap ;bbr branch taken
0869 : 4c6908 > jmp * ;failed anyway
>
086c : >ok20266
> tst_a $cc,$ff
086c : 08 > php ;save flags
086d : c9cc > cmp #$cc ;test result
> trap_ne
086f : d0fe > bne * ;failed not equal (non zero)
>
0871 : 68 > pla ;load status
0872 : 48 > pha
> cmp_flag $ff
0873 : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0875 : d0fe > bne * ;failed not equal (non zero)
>
0877 : 28 > plp ;restore status
>
0878 : a50c > lda zpt
087a : c904 > cmp #(1<<2)
> trap_ne ;zp altered
087c : d0fe > bne * ;failed not equal (non zero)
>
087e : a9fb > lda #$ff-(1<<2) ;testing 1 bit off
0880 : 850c > sta zpt
> set_a $33,0 ;with flags off
> load_flag 0
0882 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
0884 : 48 > pha ;use stack to load status
0885 : a933 > lda #$33 ;precharge accu
0887 : 28 > plp
>
0888 : af0c06 > bbs 2,zpt,fail30266
088b : 2f0c06 > bbr 2,zpt,ok30266
> trap ;bbr branch not taken
088e : 4c8e08 > jmp * ;failed anyway
>
0891 : >fail30266
> trap ;bbs branch taken
0891 : 4c9108 > jmp * ;failed anyway
>
0894 : >ok30266
> tst_a $33,0
0894 : 08 > php ;save flags
0895 : c933 > cmp #$33 ;test result
> trap_ne
0897 : d0fe > bne * ;failed not equal (non zero)
>
0899 : 68 > pla ;load status
089a : 48 > pha
> cmp_flag 0
089b : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
089d : d0fe > bne * ;failed not equal (non zero)
>
089f : 28 > plp ;restore status
>
> set_a $cc,$ff ;with flags on
> load_flag $ff
08a0 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
08a2 : 48 > pha ;use stack to load status
08a3 : a9cc > lda #$cc ;precharge accu
08a5 : 28 > plp
>
08a6 : af0c06 > bbs 2,zpt,fail40266
08a9 : 2f0c06 > bbr 2,zpt,ok40266
> trap ;bbr branch not taken
08ac : 4cac08 > jmp * ;failed anyway
>
08af : >fail40266
> trap ;bbs branch taken
08af : 4caf08 > jmp * ;failed anyway
>
08b2 : >ok40266
> tst_a $cc,$ff
08b2 : 08 > php ;save flags
08b3 : c9cc > cmp #$cc ;test result
> trap_ne
08b5 : d0fe > bne * ;failed not equal (non zero)
>
08b7 : 68 > pla ;load status
08b8 : 48 > pha
> cmp_flag $ff
08b9 : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
08bb : d0fe > bne * ;failed not equal (non zero)
>
08bd : 28 > plp ;restore status
>
08be : a50c > lda zpt
08c0 : c9fb > cmp #$ff-(1<<2)
> trap_ne ;zp altered
08c2 : d0fe > bne * ;failed not equal (non zero)
>
bbt 3
08c4 : a908 > lda #(1<<3) ;testing 1 bit on
08c6 : 850c > sta zpt
> set_a $33,0 ;with flags off
> load_flag 0
08c8 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
08ca : 48 > pha ;use stack to load status
08cb : a933 > lda #$33 ;precharge accu
08cd : 28 > plp
>
08ce : 3f0c06 > bbr 3,zpt,fail10301
08d1 : bf0c06 > bbs 3,zpt,ok10301
> trap ;bbs branch not taken
08d4 : 4cd408 > jmp * ;failed anyway
>
08d7 : >fail10301
> trap ;bbr branch taken
08d7 : 4cd708 > jmp * ;failed anyway
>
08da : >ok10301
> tst_a $33,0
08da : 08 > php ;save flags
08db : c933 > cmp #$33 ;test result
> trap_ne
08dd : d0fe > bne * ;failed not equal (non zero)
>
08df : 68 > pla ;load status
08e0 : 48 > pha
> cmp_flag 0
08e1 : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
08e3 : d0fe > bne * ;failed not equal (non zero)
>
08e5 : 28 > plp ;restore status
>
> set_a $cc,$ff ;with flags on
> load_flag $ff
08e6 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
08e8 : 48 > pha ;use stack to load status
08e9 : a9cc > lda #$cc ;precharge accu
08eb : 28 > plp
>
08ec : 3f0c06 > bbr 3,zpt,fail20301
08ef : bf0c06 > bbs 3,zpt,ok20301
> trap ;bbs branch not taken
08f2 : 4cf208 > jmp * ;failed anyway
>
08f5 : >fail20301
> trap ;bbr branch taken
08f5 : 4cf508 > jmp * ;failed anyway
>
08f8 : >ok20301
> tst_a $cc,$ff
08f8 : 08 > php ;save flags
08f9 : c9cc > cmp #$cc ;test result
> trap_ne
08fb : d0fe > bne * ;failed not equal (non zero)
>
08fd : 68 > pla ;load status
08fe : 48 > pha
> cmp_flag $ff
08ff : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0901 : d0fe > bne * ;failed not equal (non zero)
>
0903 : 28 > plp ;restore status
>
0904 : a50c > lda zpt
0906 : c908 > cmp #(1<<3)
> trap_ne ;zp altered
0908 : d0fe > bne * ;failed not equal (non zero)
>
090a : a9f7 > lda #$ff-(1<<3) ;testing 1 bit off
090c : 850c > sta zpt
> set_a $33,0 ;with flags off
> load_flag 0
090e : a900 > lda #0 ;allow test to change I-flag (no mask)
>
0910 : 48 > pha ;use stack to load status
0911 : a933 > lda #$33 ;precharge accu
0913 : 28 > plp
>
0914 : bf0c06 > bbs 3,zpt,fail30301
0917 : 3f0c06 > bbr 3,zpt,ok30301
> trap ;bbr branch not taken
091a : 4c1a09 > jmp * ;failed anyway
>
091d : >fail30301
> trap ;bbs branch taken
091d : 4c1d09 > jmp * ;failed anyway
>
0920 : >ok30301
> tst_a $33,0
0920 : 08 > php ;save flags
0921 : c933 > cmp #$33 ;test result
> trap_ne
0923 : d0fe > bne * ;failed not equal (non zero)
>
0925 : 68 > pla ;load status
0926 : 48 > pha
> cmp_flag 0
0927 : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0929 : d0fe > bne * ;failed not equal (non zero)
>
092b : 28 > plp ;restore status
>
> set_a $cc,$ff ;with flags on
> load_flag $ff
092c : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
092e : 48 > pha ;use stack to load status
092f : a9cc > lda #$cc ;precharge accu
0931 : 28 > plp
>
0932 : bf0c06 > bbs 3,zpt,fail40301
0935 : 3f0c06 > bbr 3,zpt,ok40301
> trap ;bbr branch not taken
0938 : 4c3809 > jmp * ;failed anyway
>
093b : >fail40301
> trap ;bbs branch taken
093b : 4c3b09 > jmp * ;failed anyway
>
093e : >ok40301
> tst_a $cc,$ff
093e : 08 > php ;save flags
093f : c9cc > cmp #$cc ;test result
> trap_ne
0941 : d0fe > bne * ;failed not equal (non zero)
>
0943 : 68 > pla ;load status
0944 : 48 > pha
> cmp_flag $ff
0945 : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0947 : d0fe > bne * ;failed not equal (non zero)
>
0949 : 28 > plp ;restore status
>
094a : a50c > lda zpt
094c : c9f7 > cmp #$ff-(1<<3)
> trap_ne ;zp altered
094e : d0fe > bne * ;failed not equal (non zero)
>
bbt 4
0950 : a910 > lda #(1<<4) ;testing 1 bit on
0952 : 850c > sta zpt
> set_a $33,0 ;with flags off
> load_flag 0
0954 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
0956 : 48 > pha ;use stack to load status
0957 : a933 > lda #$33 ;precharge accu
0959 : 28 > plp
>
095a : 4f0c06 > bbr 4,zpt,fail10336
095d : cf0c06 > bbs 4,zpt,ok10336
> trap ;bbs branch not taken
0960 : 4c6009 > jmp * ;failed anyway
>
0963 : >fail10336
> trap ;bbr branch taken
0963 : 4c6309 > jmp * ;failed anyway
>
0966 : >ok10336
> tst_a $33,0
0966 : 08 > php ;save flags
0967 : c933 > cmp #$33 ;test result
> trap_ne
0969 : d0fe > bne * ;failed not equal (non zero)
>
096b : 68 > pla ;load status
096c : 48 > pha
> cmp_flag 0
096d : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
096f : d0fe > bne * ;failed not equal (non zero)
>
0971 : 28 > plp ;restore status
>
> set_a $cc,$ff ;with flags on
> load_flag $ff
0972 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
0974 : 48 > pha ;use stack to load status
0975 : a9cc > lda #$cc ;precharge accu
0977 : 28 > plp
>
0978 : 4f0c06 > bbr 4,zpt,fail20336
097b : cf0c06 > bbs 4,zpt,ok20336
> trap ;bbs branch not taken
097e : 4c7e09 > jmp * ;failed anyway
>
0981 : >fail20336
> trap ;bbr branch taken
0981 : 4c8109 > jmp * ;failed anyway
>
0984 : >ok20336
> tst_a $cc,$ff
0984 : 08 > php ;save flags
0985 : c9cc > cmp #$cc ;test result
> trap_ne
0987 : d0fe > bne * ;failed not equal (non zero)
>
0989 : 68 > pla ;load status
098a : 48 > pha
> cmp_flag $ff
098b : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
098d : d0fe > bne * ;failed not equal (non zero)
>
098f : 28 > plp ;restore status
>
0990 : a50c > lda zpt
0992 : c910 > cmp #(1<<4)
> trap_ne ;zp altered
0994 : d0fe > bne * ;failed not equal (non zero)
>
0996 : a9ef > lda #$ff-(1<<4) ;testing 1 bit off
0998 : 850c > sta zpt
> set_a $33,0 ;with flags off
> load_flag 0
099a : a900 > lda #0 ;allow test to change I-flag (no mask)
>
099c : 48 > pha ;use stack to load status
099d : a933 > lda #$33 ;precharge accu
099f : 28 > plp
>
09a0 : cf0c06 > bbs 4,zpt,fail30336
09a3 : 4f0c06 > bbr 4,zpt,ok30336
> trap ;bbr branch not taken
09a6 : 4ca609 > jmp * ;failed anyway
>
09a9 : >fail30336
> trap ;bbs branch taken
09a9 : 4ca909 > jmp * ;failed anyway
>
09ac : >ok30336
> tst_a $33,0
09ac : 08 > php ;save flags
09ad : c933 > cmp #$33 ;test result
> trap_ne
09af : d0fe > bne * ;failed not equal (non zero)
>
09b1 : 68 > pla ;load status
09b2 : 48 > pha
> cmp_flag 0
09b3 : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
09b5 : d0fe > bne * ;failed not equal (non zero)
>
09b7 : 28 > plp ;restore status
>
> set_a $cc,$ff ;with flags on
> load_flag $ff
09b8 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
09ba : 48 > pha ;use stack to load status
09bb : a9cc > lda #$cc ;precharge accu
09bd : 28 > plp
>
09be : cf0c06 > bbs 4,zpt,fail40336
09c1 : 4f0c06 > bbr 4,zpt,ok40336
> trap ;bbr branch not taken
09c4 : 4cc409 > jmp * ;failed anyway
>
09c7 : >fail40336
> trap ;bbs branch taken
09c7 : 4cc709 > jmp * ;failed anyway
>
09ca : >ok40336
> tst_a $cc,$ff
09ca : 08 > php ;save flags
09cb : c9cc > cmp #$cc ;test result
> trap_ne
09cd : d0fe > bne * ;failed not equal (non zero)
>
09cf : 68 > pla ;load status
09d0 : 48 > pha
> cmp_flag $ff
09d1 : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
09d3 : d0fe > bne * ;failed not equal (non zero)
>
09d5 : 28 > plp ;restore status
>
09d6 : a50c > lda zpt
09d8 : c9ef > cmp #$ff-(1<<4)
> trap_ne ;zp altered
09da : d0fe > bne * ;failed not equal (non zero)
>
bbt 5
09dc : a920 > lda #(1<<5) ;testing 1 bit on
09de : 850c > sta zpt
> set_a $33,0 ;with flags off
> load_flag 0
09e0 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
09e2 : 48 > pha ;use stack to load status
09e3 : a933 > lda #$33 ;precharge accu
09e5 : 28 > plp
>
09e6 : 5f0c06 > bbr 5,zpt,fail10371
09e9 : df0c06 > bbs 5,zpt,ok10371
> trap ;bbs branch not taken
09ec : 4cec09 > jmp * ;failed anyway
>
09ef : >fail10371
> trap ;bbr branch taken
09ef : 4cef09 > jmp * ;failed anyway
>
09f2 : >ok10371
> tst_a $33,0
09f2 : 08 > php ;save flags
09f3 : c933 > cmp #$33 ;test result
> trap_ne
09f5 : d0fe > bne * ;failed not equal (non zero)
>
09f7 : 68 > pla ;load status
09f8 : 48 > pha
> cmp_flag 0
09f9 : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
09fb : d0fe > bne * ;failed not equal (non zero)
>
09fd : 28 > plp ;restore status
>
> set_a $cc,$ff ;with flags on
> load_flag $ff
09fe : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
0a00 : 48 > pha ;use stack to load status
0a01 : a9cc > lda #$cc ;precharge accu
0a03 : 28 > plp
>
0a04 : 5f0c06 > bbr 5,zpt,fail20371
0a07 : df0c06 > bbs 5,zpt,ok20371
> trap ;bbs branch not taken
0a0a : 4c0a0a > jmp * ;failed anyway
>
0a0d : >fail20371
> trap ;bbr branch taken
0a0d : 4c0d0a > jmp * ;failed anyway
>
0a10 : >ok20371
> tst_a $cc,$ff
0a10 : 08 > php ;save flags
0a11 : c9cc > cmp #$cc ;test result
> trap_ne
0a13 : d0fe > bne * ;failed not equal (non zero)
>
0a15 : 68 > pla ;load status
0a16 : 48 > pha
> cmp_flag $ff
0a17 : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0a19 : d0fe > bne * ;failed not equal (non zero)
>
0a1b : 28 > plp ;restore status
>
0a1c : a50c > lda zpt
0a1e : c920 > cmp #(1<<5)
> trap_ne ;zp altered
0a20 : d0fe > bne * ;failed not equal (non zero)
>
0a22 : a9df > lda #$ff-(1<<5) ;testing 1 bit off
0a24 : 850c > sta zpt
> set_a $33,0 ;with flags off
> load_flag 0
0a26 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
0a28 : 48 > pha ;use stack to load status
0a29 : a933 > lda #$33 ;precharge accu
0a2b : 28 > plp
>
0a2c : df0c06 > bbs 5,zpt,fail30371
0a2f : 5f0c06 > bbr 5,zpt,ok30371
> trap ;bbr branch not taken
0a32 : 4c320a > jmp * ;failed anyway
>
0a35 : >fail30371
> trap ;bbs branch taken
0a35 : 4c350a > jmp * ;failed anyway
>
0a38 : >ok30371
> tst_a $33,0
0a38 : 08 > php ;save flags
0a39 : c933 > cmp #$33 ;test result
> trap_ne
0a3b : d0fe > bne * ;failed not equal (non zero)
>
0a3d : 68 > pla ;load status
0a3e : 48 > pha
> cmp_flag 0
0a3f : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0a41 : d0fe > bne * ;failed not equal (non zero)
>
0a43 : 28 > plp ;restore status
>
> set_a $cc,$ff ;with flags on
> load_flag $ff
0a44 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
0a46 : 48 > pha ;use stack to load status
0a47 : a9cc > lda #$cc ;precharge accu
0a49 : 28 > plp
>
0a4a : df0c06 > bbs 5,zpt,fail40371
0a4d : 5f0c06 > bbr 5,zpt,ok40371
> trap ;bbr branch not taken
0a50 : 4c500a > jmp * ;failed anyway
>
0a53 : >fail40371
> trap ;bbs branch taken
0a53 : 4c530a > jmp * ;failed anyway
>
0a56 : >ok40371
> tst_a $cc,$ff
0a56 : 08 > php ;save flags
0a57 : c9cc > cmp #$cc ;test result
> trap_ne
0a59 : d0fe > bne * ;failed not equal (non zero)
>
0a5b : 68 > pla ;load status
0a5c : 48 > pha
> cmp_flag $ff
0a5d : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0a5f : d0fe > bne * ;failed not equal (non zero)
>
0a61 : 28 > plp ;restore status
>
0a62 : a50c > lda zpt
0a64 : c9df > cmp #$ff-(1<<5)
> trap_ne ;zp altered
0a66 : d0fe > bne * ;failed not equal (non zero)
>
bbt 6
0a68 : a940 > lda #(1<<6) ;testing 1 bit on
0a6a : 850c > sta zpt
> set_a $33,0 ;with flags off
> load_flag 0
0a6c : a900 > lda #0 ;allow test to change I-flag (no mask)
>
0a6e : 48 > pha ;use stack to load status
0a6f : a933 > lda #$33 ;precharge accu
0a71 : 28 > plp
>
0a72 : 6f0c06 > bbr 6,zpt,fail10406
0a75 : ef0c06 > bbs 6,zpt,ok10406
> trap ;bbs branch not taken
0a78 : 4c780a > jmp * ;failed anyway
>
0a7b : >fail10406
> trap ;bbr branch taken
0a7b : 4c7b0a > jmp * ;failed anyway
>
0a7e : >ok10406
> tst_a $33,0
0a7e : 08 > php ;save flags
0a7f : c933 > cmp #$33 ;test result
> trap_ne
0a81 : d0fe > bne * ;failed not equal (non zero)
>
0a83 : 68 > pla ;load status
0a84 : 48 > pha
> cmp_flag 0
0a85 : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0a87 : d0fe > bne * ;failed not equal (non zero)
>
0a89 : 28 > plp ;restore status
>
> set_a $cc,$ff ;with flags on
> load_flag $ff
0a8a : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
0a8c : 48 > pha ;use stack to load status
0a8d : a9cc > lda #$cc ;precharge accu
0a8f : 28 > plp
>
0a90 : 6f0c06 > bbr 6,zpt,fail20406
0a93 : ef0c06 > bbs 6,zpt,ok20406
> trap ;bbs branch not taken
0a96 : 4c960a > jmp * ;failed anyway
>
0a99 : >fail20406
> trap ;bbr branch taken
0a99 : 4c990a > jmp * ;failed anyway
>
0a9c : >ok20406
> tst_a $cc,$ff
0a9c : 08 > php ;save flags
0a9d : c9cc > cmp #$cc ;test result
> trap_ne
0a9f : d0fe > bne * ;failed not equal (non zero)
>
0aa1 : 68 > pla ;load status
0aa2 : 48 > pha
> cmp_flag $ff
0aa3 : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0aa5 : d0fe > bne * ;failed not equal (non zero)
>
0aa7 : 28 > plp ;restore status
>
0aa8 : a50c > lda zpt
0aaa : c940 > cmp #(1<<6)
> trap_ne ;zp altered
0aac : d0fe > bne * ;failed not equal (non zero)
>
0aae : a9bf > lda #$ff-(1<<6) ;testing 1 bit off
0ab0 : 850c > sta zpt
> set_a $33,0 ;with flags off
> load_flag 0
0ab2 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
0ab4 : 48 > pha ;use stack to load status
0ab5 : a933 > lda #$33 ;precharge accu
0ab7 : 28 > plp
>
0ab8 : ef0c06 > bbs 6,zpt,fail30406
0abb : 6f0c06 > bbr 6,zpt,ok30406
> trap ;bbr branch not taken
0abe : 4cbe0a > jmp * ;failed anyway
>
0ac1 : >fail30406
> trap ;bbs branch taken
0ac1 : 4cc10a > jmp * ;failed anyway
>
0ac4 : >ok30406
> tst_a $33,0
0ac4 : 08 > php ;save flags
0ac5 : c933 > cmp #$33 ;test result
> trap_ne
0ac7 : d0fe > bne * ;failed not equal (non zero)
>
0ac9 : 68 > pla ;load status
0aca : 48 > pha
> cmp_flag 0
0acb : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0acd : d0fe > bne * ;failed not equal (non zero)
>
0acf : 28 > plp ;restore status
>
> set_a $cc,$ff ;with flags on
> load_flag $ff
0ad0 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
0ad2 : 48 > pha ;use stack to load status
0ad3 : a9cc > lda #$cc ;precharge accu
0ad5 : 28 > plp
>
0ad6 : ef0c06 > bbs 6,zpt,fail40406
0ad9 : 6f0c06 > bbr 6,zpt,ok40406
> trap ;bbr branch not taken
0adc : 4cdc0a > jmp * ;failed anyway
>
0adf : >fail40406
> trap ;bbs branch taken
0adf : 4cdf0a > jmp * ;failed anyway
>
0ae2 : >ok40406
> tst_a $cc,$ff
0ae2 : 08 > php ;save flags
0ae3 : c9cc > cmp #$cc ;test result
> trap_ne
0ae5 : d0fe > bne * ;failed not equal (non zero)
>
0ae7 : 68 > pla ;load status
0ae8 : 48 > pha
> cmp_flag $ff
0ae9 : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0aeb : d0fe > bne * ;failed not equal (non zero)
>
0aed : 28 > plp ;restore status
>
0aee : a50c > lda zpt
0af0 : c9bf > cmp #$ff-(1<<6)
> trap_ne ;zp altered
0af2 : d0fe > bne * ;failed not equal (non zero)
>
bbt 7
0af4 : a980 > lda #(1<<7) ;testing 1 bit on
0af6 : 850c > sta zpt
> set_a $33,0 ;with flags off
> load_flag 0
0af8 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
0afa : 48 > pha ;use stack to load status
0afb : a933 > lda #$33 ;precharge accu
0afd : 28 > plp
>
0afe : 7f0c06 > bbr 7,zpt,fail10441
0b01 : ff0c06 > bbs 7,zpt,ok10441
> trap ;bbs branch not taken
0b04 : 4c040b > jmp * ;failed anyway
>
0b07 : >fail10441
> trap ;bbr branch taken
0b07 : 4c070b > jmp * ;failed anyway
>
0b0a : >ok10441
> tst_a $33,0
0b0a : 08 > php ;save flags
0b0b : c933 > cmp #$33 ;test result
> trap_ne
0b0d : d0fe > bne * ;failed not equal (non zero)
>
0b0f : 68 > pla ;load status
0b10 : 48 > pha
> cmp_flag 0
0b11 : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0b13 : d0fe > bne * ;failed not equal (non zero)
>
0b15 : 28 > plp ;restore status
>
> set_a $cc,$ff ;with flags on
> load_flag $ff
0b16 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
0b18 : 48 > pha ;use stack to load status
0b19 : a9cc > lda #$cc ;precharge accu
0b1b : 28 > plp
>
0b1c : 7f0c06 > bbr 7,zpt,fail20441
0b1f : ff0c06 > bbs 7,zpt,ok20441
> trap ;bbs branch not taken
0b22 : 4c220b > jmp * ;failed anyway
>
0b25 : >fail20441
> trap ;bbr branch taken
0b25 : 4c250b > jmp * ;failed anyway
>
0b28 : >ok20441
> tst_a $cc,$ff
0b28 : 08 > php ;save flags
0b29 : c9cc > cmp #$cc ;test result
> trap_ne
0b2b : d0fe > bne * ;failed not equal (non zero)
>
0b2d : 68 > pla ;load status
0b2e : 48 > pha
> cmp_flag $ff
0b2f : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0b31 : d0fe > bne * ;failed not equal (non zero)
>
0b33 : 28 > plp ;restore status
>
0b34 : a50c > lda zpt
0b36 : c980 > cmp #(1<<7)
> trap_ne ;zp altered
0b38 : d0fe > bne * ;failed not equal (non zero)
>
0b3a : a97f > lda #$ff-(1<<7) ;testing 1 bit off
0b3c : 850c > sta zpt
> set_a $33,0 ;with flags off
> load_flag 0
0b3e : a900 > lda #0 ;allow test to change I-flag (no mask)
>
0b40 : 48 > pha ;use stack to load status
0b41 : a933 > lda #$33 ;precharge accu
0b43 : 28 > plp
>
0b44 : ff0c06 > bbs 7,zpt,fail30441
0b47 : 7f0c06 > bbr 7,zpt,ok30441
> trap ;bbr branch not taken
0b4a : 4c4a0b > jmp * ;failed anyway
>
0b4d : >fail30441
> trap ;bbs branch taken
0b4d : 4c4d0b > jmp * ;failed anyway
>
0b50 : >ok30441
> tst_a $33,0
0b50 : 08 > php ;save flags
0b51 : c933 > cmp #$33 ;test result
> trap_ne
0b53 : d0fe > bne * ;failed not equal (non zero)
>
0b55 : 68 > pla ;load status
0b56 : 48 > pha
> cmp_flag 0
0b57 : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0b59 : d0fe > bne * ;failed not equal (non zero)
>
0b5b : 28 > plp ;restore status
>
> set_a $cc,$ff ;with flags on
> load_flag $ff
0b5c : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
0b5e : 48 > pha ;use stack to load status
0b5f : a9cc > lda #$cc ;precharge accu
0b61 : 28 > plp
>
0b62 : ff0c06 > bbs 7,zpt,fail40441
0b65 : 7f0c06 > bbr 7,zpt,ok40441
> trap ;bbr branch not taken
0b68 : 4c680b > jmp * ;failed anyway
>
0b6b : >fail40441
> trap ;bbs branch taken
0b6b : 4c6b0b > jmp * ;failed anyway
>
0b6e : >ok40441
> tst_a $cc,$ff
0b6e : 08 > php ;save flags
0b6f : c9cc > cmp #$cc ;test result
> trap_ne
0b71 : d0fe > bne * ;failed not equal (non zero)
>
0b73 : 68 > pla ;load status
0b74 : 48 > pha
> cmp_flag $ff
0b75 : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0b77 : d0fe > bne * ;failed not equal (non zero)
>
0b79 : 28 > plp ;restore status
>
0b7a : a50c > lda zpt
0b7c : c97f > cmp #$ff-(1<<7)
> trap_ne ;zp altered
0b7e : d0fe > bne * ;failed not equal (non zero)
>
0b80 : e011 cpx #$11
trap_ne ;x overwritten
0b82 : d0fe > bne * ;failed not equal (non zero)
0b84 : c022 cpy #$22
trap_ne ;y overwritten
0b86 : d0fe > bne * ;failed not equal (non zero)
next_test
0b88 : ad0202 > lda test_case ;previous test
0b8b : c906 > cmp #test_num
> trap_ne ;test is out of sequence
0b8d : d0fe > bne * ;failed not equal (non zero)
>
0007 = >test_num = test_num + 1
0b8f : a907 > lda #test_num ;*** next tests' number
0b91 : 8d0202 > sta test_case
> ;check_ram ;uncomment to find altered RAM after each test
bbrc macro ;\1 = bitnum
bbr \1,zpt,skip\?
eor #(1<<\1)
skip\?
endm
bbsc macro ;\1 = bitnum
bbs \1,zpt,skip\?
eor #(1<<\1)
skip\?
endm
0b94 : a900 lda #0 ;combined bit test
0b96 : 850c sta zpt
0b98 : a900 bbcl lda #0
bbrc 0
0b9a : 0f0c02 > bbr 0,zpt,skip0480
0b9d : 4901 > eor #(1<<0)
0b9f : >skip0480
bbrc 1
0b9f : 1f0c02 > bbr 1,zpt,skip0481
0ba2 : 4902 > eor #(1<<1)
0ba4 : >skip0481
bbrc 2
0ba4 : 2f0c02 > bbr 2,zpt,skip0482
0ba7 : 4904 > eor #(1<<2)
0ba9 : >skip0482
bbrc 3
0ba9 : 3f0c02 > bbr 3,zpt,skip0483
0bac : 4908 > eor #(1<<3)
0bae : >skip0483
bbrc 4
0bae : 4f0c02 > bbr 4,zpt,skip0484
0bb1 : 4910 > eor #(1<<4)
0bb3 : >skip0484
bbrc 5
0bb3 : 5f0c02 > bbr 5,zpt,skip0485
0bb6 : 4920 > eor #(1<<5)
0bb8 : >skip0485
bbrc 6
0bb8 : 6f0c02 > bbr 6,zpt,skip0486
0bbb : 4940 > eor #(1<<6)
0bbd : >skip0486
bbrc 7
0bbd : 7f0c02 > bbr 7,zpt,skip0487
0bc0 : 4980 > eor #(1<<7)
0bc2 : >skip0487
0bc2 : 450c eor zpt
trap_ne ;failed bbr bitnum in accu
0bc4 : d0fe > bne * ;failed not equal (non zero)
0bc6 : a9ff lda #$ff
bbsc 0
0bc8 : 8f0c02 > bbs 0,zpt,skip0489
0bcb : 4901 > eor #(1<<0)
0bcd : >skip0489
bbsc 1
0bcd : 9f0c02 > bbs 1,zpt,skip0490
0bd0 : 4902 > eor #(1<<1)
0bd2 : >skip0490
bbsc 2
0bd2 : af0c02 > bbs 2,zpt,skip0491
0bd5 : 4904 > eor #(1<<2)
0bd7 : >skip0491
bbsc 3
0bd7 : bf0c02 > bbs 3,zpt,skip0492
0bda : 4908 > eor #(1<<3)
0bdc : >skip0492
bbsc 4
0bdc : cf0c02 > bbs 4,zpt,skip0493
0bdf : 4910 > eor #(1<<4)
0be1 : >skip0493
bbsc 5
0be1 : df0c02 > bbs 5,zpt,skip0494
0be4 : 4920 > eor #(1<<5)
0be6 : >skip0494
bbsc 6
0be6 : ef0c02 > bbs 6,zpt,skip0495
0be9 : 4940 > eor #(1<<6)
0beb : >skip0495
bbsc 7
0beb : ff0c02 > bbs 7,zpt,skip0496
0bee : 4980 > eor #(1<<7)
0bf0 : >skip0496
0bf0 : 450c eor zpt
trap_ne ;failed bbs bitnum in accu
0bf2 : d0fe > bne * ;failed not equal (non zero)
0bf4 : e60c inc zpt
0bf6 : d0a0 bne bbcl
next_test
0bf8 : ad0202 > lda test_case ;previous test
0bfb : c907 > cmp #test_num
> trap_ne ;test is out of sequence
0bfd : d0fe > bne * ;failed not equal (non zero)
>
0008 = >test_num = test_num + 1
0bff : a908 > lda #test_num ;*** next tests' number
0c01 : 8d0202 > sta test_case
> ;check_ram ;uncomment to find altered RAM after each test
endif
; testing NOP
nop_test macro ;\1 = opcode, \2 = # of bytes
ldy #$42
ldx #4-\2
db \1 ;test nop length
if \2 = 1
dex
dex
endif
if \2 = 2
iny
dex
endif
if \2 = 3
iny
iny
endif
dex
trap_ne ;wrong number of bytes
set_a $ff-\1,0
db \1 ;test nop integrity - flags off
nop
nop
tst_a $ff-\1,0
set_a $aa-\1,$ff
db \1 ;test nop integrity - flags on
nop
nop
tst_a $aa-\1,$ff
cpy #$42
trap_ne ;y changed
cpx #0
trap_ne ;x changed
endm
if skip_nop = 0
nop_test $02,2
0c04 : a042 > ldy #$42
0c06 : a202 > ldx #4-2
0c08 : 02 > db $02 ;test nop length
> if 2 = 1
> dex
> dex
> endif
> if 2 = 2
0c09 : c8 > iny