aiie/tests/6502_functional_test_verbose.lst
2018-06-15 23:13:06 -04:00

18731 lines
875 KiB
Plaintext

AS65 Assembler for R6502 [1.42]. Copyright 1994-2007, Frank A. Kingswood Page 1
---------------------------------------------------- 6502_functional_test.a65 ----------------------------------------------------
6321 lines read, no errors in pass 1.
;
; 6 5 0 2 F U N C T I O N A L T E S T
;
; Copyright (C) 2012-2015 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 opcodes of a 6502 emulator using all
; addressing modes with focus on propper setting of the processor status
; register bits.
;
; 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 -h0
; | | | | no page headers in listing
; | | | 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 NMOS 6502 only! No unofficial
; opcodes. Additional opcodes of newer versions of the CPU (65C02, 65816) will
; not be tested. Decimal ops will only be tested with valid BCD operands and
; N V Z flags will be ignored.
;
; 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:
; 28-jul-2012 1st version distributed for testing
; 29-jul-2012 fixed references to location 0, now #0
; added license - GPLv3
; 30-jul-2012 added configuration options
; 01-aug-2012 added trap macro to allow user to change error handling
; 01-dec-2012 fixed trap in branch field must be a branch
; 02-mar-2013 fixed PLA flags not tested
; 19-jul-2013 allowed ROM vectors to be loaded when load_data_direct = 0
; added test sequence check to detect if tests jump their fence
; 23-jul-2013 added RAM integrity check option
; 16-aug-2013 added error report to standard output option
; 13-dec-2014 added binary/decimal opcode table switch test
; 14-dec-2014 improved relative address test
; 23-aug-2015 added option to disable self modifying tests
; 24-aug-2015 all self modifying immediate opcodes now execute in data RAM
; added small branch offset pretest
; 21-oct-2015 added option to disable decimal mode ADC & SBC tests
; 04-dec-2017 fixed BRK only tested with interrupts enabled
; added option to skip the remainder of a failing test
; in report.i65
; 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. SEI & CLI can only be
;tested if you allow changing the interrupt status (I_flag = 3)
0003 = I_flag = 3
;configure memory - try to stay away from memory used by the system
;zero_page memory start address, $50 (80) consecutive Bytes required
; add 2 if I_flag = 2
000a = zero_page = $a
;data_segment memory start address, $6A (106) consecutive Bytes required
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, 13kB of consecutive space required
; add 2.5 kB if I_flag = 2
0400 = code_segment = $400
;self modifying code may be disabled to allow running in ROM
;0=part of the code is self modifying and must reside in RAM
;1=tests disabled: branch range
0000 = disable_selfmod = 0
;report errors through I/O channel (0=use standard self trap loops, 1=include
;report.i65 as I/O channel, add 3.5 kB)
0001 = report = 1
;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
;disable test decimal mode ADC & SBC, 0=enable, 1=disable,
;2=disable including decimal flag in processor status
0000 = disable_decimal = 0
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
0038 = faod equ fao+decmode ;+ ignore decimal
003c = faid equ fai+decmode ;+ ignore decimal
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 test of decimal bit
;masking of interrupt enable/disable on load and compare
;masking of always on bits after PHP or BRK (unused & break) on compare
if disable_decimal < 2
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
else
if I_flag = 0
load_flag macro
lda #\1&m8i ;force enable interrupts (mask I)
endm
cmp_flag macro
ora #decmode ;ignore decimal mode bit
cmp #(\1|faod)&m8i ;I_flag is always enabled + always on bits
endm
eor_flag macro
ora #decmode ;ignore decimal mode bit
eor #(\1&m8i|faod) ;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
ora #decmode ;ignore decimal mode bit
cmp #(\1|faid)&m8 ;I_flag is always disabled + always on bits
endm
eor_flag macro
ora #decmode ;ignore decimal mode bit
eor #(\1|faid) ;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
ora #decmode ;ignore decimal mode bit
cmp #(\1|faod)&m8i ;expected flags + always on bits, mask I
endm
eor_flag macro
eor flag_I_on ;I_flag is never changed
ora #decmode ;ignore decimal mode bit
eor #(\1&m8i|faod) ;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
ora #decmode ;ignore decimal mode bit
cmp #(\1|faod)&m8 ;expected flags + always on bits
endm
eor_flag macro
ora #decmode ;ignore decimal mode bit
eor #\1|faod ;invert expected flags + always on bits
endm
endif
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_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
if disable_selfmod = 0
sta range_adr ;reset self modifying code
endif
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
000a = org 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 (only binary 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 : 1702 ind1 dw abs1 ;indirect pointer to pattern in absolute memory
0026 : 1802 dw abs1+1
0028 : 1902 dw abs1+2
002a : 1a02 dw abs1+3
002c : 1b02 dw abs7f
002e : 1f01 inw1 dw abs1-$f8 ;indirect pointer for wrap-test pattern
0030 : 0302 indt dw abst ;indirect pointer to store area in absolute memory
0032 : 0402 dw abst+1
0034 : 0502 dw abst+2
0036 : 0602 dw abst+3
0038 : 0b01 inwt dw abst-$f8 ;indirect pointer for wrap-test store
003a : 4e02 indAN dw absAN ;indirect pointer to AND pattern in absolute memory
003c : 4f02 dw absAN+1
003e : 5002 dw absAN+2
0040 : 5102 dw absAN+3
0042 : 5202 indEO dw absEO ;indirect pointer to EOR pattern in absolute memory
0044 : 5302 dw absEO+1
0046 : 5402 dw absEO+2
0048 : 5502 dw absEO+3
004a : 4a02 indOR dw absOR ;indirect pointer to OR pattern in absolute memory
004c : 4b02 dw absOR+1
004e : 4c02 dw absOR+2
0050 : 4d02 dw absOR+3
;add/subtract indirect pointers
0052 : 0302 adi2 dw ada2 ;indirect pointer to operand 2 in absolute memory
0054 : 0402 sbi2 dw sba2 ;indirect pointer to complemented operand 2 (SBC)
0056 : 0401 adiy2 dw ada2-$ff ;with offset for indirect indexed
0058 : 0501 sbiy2 dw sba2-$ff
005a : zp_bss_end
0200 = org data_segment
0200 : 00 test_case ds 1 ;current test number
0201 : 0000 ram_chksm ds 2 ;checksum for RAM integrity test
;add/subtract operand copy - abs tests write area
0203 : abst ;5 bytes store/modify test area
0203 : 00 ada2 ds 1 ;operand 2
0204 : 00 sba2 ds 1 ;operand 2 complemented for subtract
0205 : 000000 ds 3 ;fill remaining bytes
0208 : data_bss
if load_data_direct = 1
0208 : 2900 ex_andi and #0 ;execute immediate opcodes
020a : 60 rts
020b : 4900 ex_eori eor #0 ;execute immediate opcodes
020d : 60 rts
020e : 0900 ex_orai ora #0 ;execute immediate opcodes
0210 : 60 rts
0211 : 6900 ex_adci adc #0 ;execute immediate opcodes
0213 : 60 rts
0214 : e900 ex_sbci sbc #0 ;execute immediate opcodes
0216 : 60 rts
else
ex_andi ds 3
ex_eori ds 3
ex_orai ds 3
ex_adci ds 3
ex_sbci ds 3
endif
0217 : c3824100 abs1 db $c3,$82,$41,0 ;test patterns for LDx BIT ROL ROR ASL LSR
021b : 7f abs7f db $7f ;test pattern for compare
;loads
021c : 80800002 fLDx db fn,fn,0,fz ;expected flags for load
;shifts
0220 : rASL ;expected result ASL & ROL -carry
0220 : 86048200 rROL db $86,$04,$82,0 ; "
0224 : 87058301 rROLc db $87,$05,$83,1 ;expected result ROL +carry
0228 : rLSR ;expected result LSR & ROR -carry
0228 : 61412000 rROR db $61,$41,$20,0 ; "
022c : e1c1a080 rRORc db $e1,$c1,$a0,$80 ;expected result ROR +carry
0230 : fASL ;expected flags for shifts
0230 : 81018002 fROL db fnc,fc,fn,fz ;no carry in
0234 : 81018000 fROLc db fnc,fc,fn,0 ;carry in
0238 : fLSR
0238 : 01000102 fROR db fc,0,fc,fz ;no carry in
023c : 81808180 fRORc db fnc,fn,fnc,fn ;carry in
;increments (decrements)
0240 : 7f80ff0001 rINC db $7f,$80,$ff,0,1 ;expected result for INC/DEC
0245 : 0080800200 fINC db 0,fn,fn,fz,0 ;expected flags for INC/DEC
;logical memory operand
024a : 001f7180 absOR db 0,$1f,$71,$80 ;test pattern for OR
024e : 0fff7f80 absAN db $0f,$ff,$7f,$80 ;test pattern for AND
0252 : ff0f8f8f absEO db $ff,$0f,$8f,$8f ;test pattern for EOR
;logical accu operand
0256 : 00f11f00 absORa db 0,$f1,$1f,0 ;test pattern for OR
025a : f0ffffff absANa db $f0,$ff,$ff,$ff ;test pattern for AND
025e : fff0f00f absEOa db $ff,$f0,$f0,$0f ;test pattern for EOR
;logical results
0262 : 00ff7f80 absrlo db 0,$ff,$7f,$80
0266 : 02800080 absflo db fz,fn,0,fn
026a : data_bss_end
code
0400 = org code_segment
0400 : d8 start cld
0401 : a2ff ldx #$ff
0403 : 9a txs
0404 : a900 lda #0 ;*** test 0 = initialize
0406 : 8d0002 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
0409 : 204c44 jsr report_init
endif
;pretest small branch offset
040c : a205 ldx #5
040e : 4c3604 jmp psb_test
0411 : psb_bwok
0411 : a005 ldy #5
0413 : d008 bne psb_forw
trap ;branch should be taken
0415 : 205b44 > jsr report_error
0418 : 88 dey ;forward landing zone
0419 : 88 dey
041a : 88 dey
041b : 88 dey
041c : 88 dey
041d : psb_forw
041d : 88 dey
041e : 88 dey
041f : 88 dey
0420 : 88 dey
0421 : 88 dey
0422 : f017 beq psb_fwok
trap ;forward offset
0424 : 205b44 > jsr report_error
0427 : ca dex ;backward landing zone
0428 : ca dex
0429 : ca dex
042a : ca dex
042b : ca dex
042c : psb_back
042c : ca dex
042d : ca dex
042e : ca dex
042f : ca dex
0430 : ca dex
0431 : f0de beq psb_bwok
trap ;backward offset
0433 : 205b44 > jsr report_error
0436 : psb_test
0436 : d0f4 bne psb_back
trap ;branch should be taken
0438 : 205b44 > jsr report_error
043b : psb_fwok
;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
if disable_selfmod = 0
sta range_adr ;reset self modifying code
endif
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
043b : ad0002 > lda test_case ;previous test
043e : c900 > cmp #test_num
> trap_ne ;test is out of sequence
0440 : f003 > beq skip0006
> trap ;failed not equal (non zero)
0442 : 205b44 > jsr report_error
>
0445 : >skip0006
>
0001 = >test_num = test_num + 1
0445 : a901 > lda #test_num ;*** next tests' number
0447 : 8d0002 > sta test_case
> ;check_ram ;uncomment to find altered RAM after each test
if disable_selfmod = 0
;testing relative addressing with BEQ
044a : a0fe ldy #$fe ;testing maximum range, not -1/-2 (invalid/self adr)
044c : range_loop
044c : 88 dey ;next relative address
044d : 98 tya
044e : aa tax ;precharge count to end of loop
044f : 1008 bpl range_fw ;calculate relative address
0451 : 18 clc ;avoid branch self or to relative address of branch
0452 : 6902 adc #2
0454 : ea nop ;offset landing zone - tolerate +/-5 offset to branch
0455 : ea nop
0456 : ea nop
0457 : ea nop
0458 : ea nop
0459 : range_fw
0459 : ea nop
045a : ea nop
045b : ea nop
045c : ea nop
045d : ea nop
045e : 497f eor #$7f ;complement except sign
0460 : 8dec04 sta range_adr ;load into test target
0463 : a900 lda #0 ;should set zero flag in status register
0465 : 4ceb04 jmp range_op
0468 : ca dex ; offset landing zone - backward branch too far
0469 : ca dex
046a : ca dex
046b : ca dex
046c : ca dex
;relative address target field with branch under test in the middle
046d : ca dex ;-128 - max backward
046e : ca dex
046f : ca dex
0470 : ca dex
0471 : ca dex
0472 : ca dex
0473 : ca dex
0474 : ca dex
0475 : ca dex ;-120
0476 : ca dex
0477 : ca dex
0478 : ca dex
0479 : ca dex
047a : ca dex
047b : ca dex
047c : ca dex
047d : ca dex
047e : ca dex
047f : ca dex ;-110
0480 : ca dex
0481 : ca dex
0482 : ca dex
0483 : ca dex
0484 : ca dex
0485 : ca dex
0486 : ca dex
0487 : ca dex
0488 : ca dex
0489 : ca dex ;-100
048a : ca dex
048b : ca dex
048c : ca dex
048d : ca dex
048e : ca dex
048f : ca dex
0490 : ca dex
0491 : ca dex
0492 : ca dex
0493 : ca dex ;-90
0494 : ca dex
0495 : ca dex
0496 : ca dex
0497 : ca dex
0498 : ca dex
0499 : ca dex
049a : ca dex
049b : ca dex
049c : ca dex
049d : ca dex ;-80
049e : ca dex
049f : ca dex
04a0 : ca dex
04a1 : ca dex
04a2 : ca dex
04a3 : ca dex
04a4 : ca dex
04a5 : ca dex
04a6 : ca dex
04a7 : ca dex ;-70
04a8 : ca dex
04a9 : ca dex
04aa : ca dex
04ab : ca dex
04ac : ca dex
04ad : ca dex
04ae : ca dex
04af : ca dex
04b0 : ca dex
04b1 : ca dex ;-60
04b2 : ca dex
04b3 : ca dex
04b4 : ca dex
04b5 : ca dex
04b6 : ca dex
04b7 : ca dex
04b8 : ca dex
04b9 : ca dex
04ba : ca dex
04bb : ca dex ;-50
04bc : ca dex
04bd : ca dex
04be : ca dex
04bf : ca dex
04c0 : ca dex
04c1 : ca dex
04c2 : ca dex
04c3 : ca dex
04c4 : ca dex
04c5 : ca dex ;-40
04c6 : ca dex
04c7 : ca dex
04c8 : ca dex
04c9 : ca dex
04ca : ca dex
04cb : ca dex
04cc : ca dex
04cd : ca dex
04ce : ca dex
04cf : ca dex ;-30
04d0 : ca dex
04d1 : ca dex
04d2 : ca dex
04d3 : ca dex
04d4 : ca dex
04d5 : ca dex
04d6 : ca dex
04d7 : ca dex
04d8 : ca dex
04d9 : ca dex ;-20
04da : ca dex
04db : ca dex
04dc : ca dex
04dd : ca dex
04de : ca dex
04df : ca dex
04e0 : ca dex
04e1 : ca dex
04e2 : ca dex
04e3 : ca dex ;-10
04e4 : ca dex
04e5 : ca dex
04e6 : ca dex
04e7 : ca dex
04e8 : ca dex
04e9 : ca dex
04ea : ca dex ;-3
04eb : range_op ;test target with zero flag=0, z=1 if previous dex
04ec = range_adr = *+1 ;modifiable relative address
04eb : f03e beq *+64 ;+64 if called without modification
04ed : ca dex ;+0
04ee : ca dex
04ef : ca dex
04f0 : ca dex
04f1 : ca dex
04f2 : ca dex
04f3 : ca dex
04f4 : ca dex
04f5 : ca dex
04f6 : ca dex
04f7 : ca dex ;+10
04f8 : ca dex
04f9 : ca dex
04fa : ca dex
04fb : ca dex
04fc : ca dex
04fd : ca dex
04fe : ca dex
04ff : ca dex
0500 : ca dex
0501 : ca dex ;+20
0502 : ca dex
0503 : ca dex
0504 : ca dex
0505 : ca dex
0506 : ca dex
0507 : ca dex
0508 : ca dex
0509 : ca dex
050a : ca dex
050b : ca dex ;+30
050c : ca dex
050d : ca dex
050e : ca dex
050f : ca dex
0510 : ca dex
0511 : ca dex
0512 : ca dex
0513 : ca dex
0514 : ca dex
0515 : ca dex ;+40
0516 : ca dex
0517 : ca dex
0518 : ca dex
0519 : ca dex
051a : ca dex
051b : ca dex
051c : ca dex
051d : ca dex
051e : ca dex
051f : ca dex ;+50
0520 : ca dex
0521 : ca dex
0522 : ca dex
0523 : ca dex
0524 : ca dex
0525 : ca dex
0526 : ca dex
0527 : ca dex
0528 : ca dex
0529 : ca dex ;+60
052a : ca dex
052b : ca dex
052c : ca dex
052d : ca dex
052e : ca dex
052f : ca dex
0530 : ca dex
0531 : ca dex
0532 : ca dex
0533 : ca dex ;+70
0534 : ca dex
0535 : ca dex
0536 : ca dex
0537 : ca dex
0538 : ca dex
0539 : ca dex
053a : ca dex
053b : ca dex
053c : ca dex
053d : ca dex ;+80
053e : ca dex
053f : ca dex
0540 : ca dex
0541 : ca dex
0542 : ca dex
0543 : ca dex
0544 : ca dex
0545 : ca dex
0546 : ca dex
0547 : ca dex ;+90
0548 : ca dex
0549 : ca dex
054a : ca dex
054b : ca dex
054c : ca dex
054d : ca dex
054e : ca dex
054f : ca dex
0550 : ca dex
0551 : ca dex ;+100
0552 : ca dex
0553 : ca dex
0554 : ca dex
0555 : ca dex
0556 : ca dex
0557 : ca dex
0558 : ca dex
0559 : ca dex
055a : ca dex
055b : ca dex ;+110
055c : ca dex
055d : ca dex
055e : ca dex
055f : ca dex
0560 : ca dex
0561 : ca dex
0562 : ca dex
0563 : ca dex
0564 : ca dex
0565 : ca dex ;+120
0566 : ca dex
0567 : ca dex
0568 : ca dex
0569 : ca dex
056a : ca dex
056b : ca dex
056c : ea nop ;offset landing zone - forward branch too far
056d : ea nop
056e : ea nop
056f : ea nop
0570 : ea nop
0571 : f008 beq range_ok ;+127 - max forward
trap ; bad range
0573 : 205b44 > jsr report_error
0576 : ea nop ;offset landing zone - tolerate +/-5 offset to branch
0577 : ea nop
0578 : ea nop
0579 : ea nop
057a : ea nop
057b : range_ok
057b : ea nop
057c : ea nop
057d : ea nop
057e : ea nop
057f : ea nop
0580 : c000 cpy #0
0582 : f003 beq range_end
0584 : 4c4c04 jmp range_loop
0587 : range_end ;range test successful
endif
next_test
0587 : ad0002 > lda test_case ;previous test
058a : c901 > cmp #test_num
> trap_ne ;test is out of sequence
058c : f003 > beq skip0010
> trap ;failed not equal (non zero)
058e : 205b44 > jsr report_error
>
0591 : >skip0010
>
0002 = >test_num = test_num + 1
0591 : a902 > lda #test_num ;*** next tests' number
0593 : 8d0002 > sta test_case
> ;check_ram ;uncomment to find altered RAM after each test
;partial test BNE & CMP, CPX, CPY immediate
0596 : c001 cpy #1 ;testing BNE true
0598 : d003 bne test_bne
trap
059a : 205b44 > jsr report_error
059d : test_bne
059d : a900 lda #0
059f : c900 cmp #0 ;test compare immediate
trap_ne
05a1 : f003 > beq skip0013
> trap ;failed not equal (non zero)
05a3 : 205b44 > jsr report_error
>
05a6 : >skip0013
trap_cc
05a6 : b003 > bcs skip0015
> trap ;failed carry clear
05a8 : 205b44 > jsr report_error
>
05ab : >skip0015
trap_mi
05ab : 1003 > bpl skip0017
> trap ;failed minus (bit 7 set)
05ad : 205b44 > jsr report_error
>
05b0 : >skip0017
05b0 : c901 cmp #1
trap_eq
05b2 : d003 > bne skip0019
> trap ;failed equal (zero)
05b4 : 205b44 > jsr report_error
>
05b7 : >skip0019
trap_cs
05b7 : 9003 > bcc skip0021
> trap ;failed carry set
05b9 : 205b44 > jsr report_error
>
05bc : >skip0021
trap_pl
05bc : 3003 > bmi skip0023
> trap ;failed plus (bit 7 clear)
05be : 205b44 > jsr report_error
>
05c1 : >skip0023
05c1 : aa tax
05c2 : e000 cpx #0 ;test compare x immediate
trap_ne
05c4 : f003 > beq skip0025
> trap ;failed not equal (non zero)
05c6 : 205b44 > jsr report_error
>
05c9 : >skip0025
trap_cc
05c9 : b003 > bcs skip0027
> trap ;failed carry clear
05cb : 205b44 > jsr report_error
>
05ce : >skip0027
trap_mi
05ce : 1003 > bpl skip0029
> trap ;failed minus (bit 7 set)
05d0 : 205b44 > jsr report_error
>
05d3 : >skip0029
05d3 : e001 cpx #1
trap_eq
05d5 : d003 > bne skip0031
> trap ;failed equal (zero)
05d7 : 205b44 > jsr report_error
>
05da : >skip0031
trap_cs
05da : 9003 > bcc skip0033
> trap ;failed carry set
05dc : 205b44 > jsr report_error
>
05df : >skip0033
trap_pl
05df : 3003 > bmi skip0035
> trap ;failed plus (bit 7 clear)
05e1 : 205b44 > jsr report_error
>
05e4 : >skip0035
05e4 : a8 tay
05e5 : c000 cpy #0 ;test compare y immediate
trap_ne
05e7 : f003 > beq skip0037
> trap ;failed not equal (non zero)
05e9 : 205b44 > jsr report_error
>
05ec : >skip0037
trap_cc
05ec : b003 > bcs skip0039
> trap ;failed carry clear
05ee : 205b44 > jsr report_error
>
05f1 : >skip0039
trap_mi
05f1 : 1003 > bpl skip0041
> trap ;failed minus (bit 7 set)
05f3 : 205b44 > jsr report_error
>
05f6 : >skip0041
05f6 : c001 cpy #1
trap_eq
05f8 : d003 > bne skip0043
> trap ;failed equal (zero)
05fa : 205b44 > jsr report_error
>
05fd : >skip0043
trap_cs
05fd : 9003 > bcc skip0045
> trap ;failed carry set
05ff : 205b44 > jsr report_error
>
0602 : >skip0045
trap_pl
0602 : 3003 > bmi skip0047
> trap ;failed plus (bit 7 clear)
0604 : 205b44 > jsr report_error
>
0607 : >skip0047
next_test
0607 : ad0002 > lda test_case ;previous test
060a : c902 > cmp #test_num
> trap_ne ;test is out of sequence
060c : f003 > beq skip0050
> trap ;failed not equal (non zero)
060e : 205b44 > jsr report_error
>
0611 : >skip0050
>
0003 = >test_num = test_num + 1
0611 : a903 > lda #test_num ;*** next tests' number
0613 : 8d0002 > sta test_case
> ;check_ram ;uncomment to find altered RAM after each test
;testing stack operations PHA PHP PLA PLP
0616 : a2ff ldx #$ff ;initialize stack
0618 : 9a txs
0619 : a955 lda #$55
061b : 48 pha
061c : a9aa lda #$aa
061e : 48 pha
061f : cdfe01 cmp $1fe ;on stack ?
trap_ne
0622 : f003 > beq skip0052
> trap ;failed not equal (non zero)
0624 : 205b44 > jsr report_error
>
0627 : >skip0052
0627 : ba tsx
0628 : 8a txa ;overwrite accu
0629 : c9fd cmp #$fd ;sp decremented?
trap_ne
062b : f003 > beq skip0054
> trap ;failed not equal (non zero)
062d : 205b44 > jsr report_error
>
0630 : >skip0054
0630 : 68 pla
0631 : c9aa cmp #$aa ;successful retreived from stack?
trap_ne
0633 : f003 > beq skip0056
> trap ;failed not equal (non zero)
0635 : 205b44 > jsr report_error
>
0638 : >skip0056
0638 : 68 pla
0639 : c955 cmp #$55
trap_ne
063b : f003 > beq skip0058
> trap ;failed not equal (non zero)
063d : 205b44 > jsr report_error
>
0640 : >skip0058
0640 : cdff01 cmp $1ff ;remains on stack?
trap_ne
0643 : f003 > beq skip0060
> trap ;failed not equal (non zero)
0645 : 205b44 > jsr report_error
>
0648 : >skip0060
0648 : ba tsx
0649 : e0ff cpx #$ff ;sp incremented?
trap_ne
064b : f003 > beq skip0062
> trap ;failed not equal (non zero)
064d : 205b44 > jsr report_error
>
0650 : >skip0062
next_test
0650 : ad0002 > lda test_case ;previous test
0653 : c903 > cmp #test_num
> trap_ne ;test is out of sequence
0655 : f003 > beq skip0065
> trap ;failed not equal (non zero)
0657 : 205b44 > jsr report_error
>
065a : >skip0065
>
0004 = >test_num = test_num + 1
065a : a904 > lda #test_num ;*** next tests' number
065c : 8d0002 > sta test_case
> ;check_ram ;uncomment to find altered RAM after each test
;testing branch decisions BPL BMI BVC BVS BCC BCS BNE BEQ
set_stat $ff ;all on
> load_flag $ff
065f : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
0661 : 48 > pha ;use stack to load status
0662 : 28 > plp
0663 : 101a bpl nbr1 ;branches should not be taken
0665 : 501b bvc nbr2
0667 : 901c bcc nbr3
0669 : d01d bne nbr4
066b : 3003 bmi br1 ;branches should be taken
trap
066d : 205b44 > jsr report_error
0670 : 7003 br1 bvs br2
trap
0672 : 205b44 > jsr report_error
0675 : b003 br2 bcs br3
trap
0677 : 205b44 > jsr report_error
067a : f00f br3 beq br4
trap
067c : 205b44 > jsr report_error
067f : nbr1
trap ;previous bpl taken
067f : 205b44 > jsr report_error
0682 : nbr2
trap ;previous bvc taken
0682 : 205b44 > jsr report_error
0685 : nbr3
trap ;previous bcc taken
0685 : 205b44 > jsr report_error
0688 : nbr4
trap ;previous bne taken
0688 : 205b44 > jsr report_error
068b : 08 br4 php
068c : ba tsx
068d : e0fe cpx #$fe ;sp after php?
trap_ne
068f : f003 > beq skip0077
> trap ;failed not equal (non zero)
0691 : 205b44 > jsr report_error
>
0694 : >skip0077
0694 : 68 pla
cmp_flag $ff ;returned all flags on?
0695 : c9ff > cmp #($ff |fao)&m8 ;expected flags + always on bits
trap_ne
0697 : f003 > beq skip0080
> trap ;failed not equal (non zero)
0699 : 205b44 > jsr report_error
>
069c : >skip0080
069c : ba tsx
069d : e0ff cpx #$ff ;sp after php?
trap_ne
069f : f003 > beq skip0082
> trap ;failed not equal (non zero)
06a1 : 205b44 > jsr report_error
>
06a4 : >skip0082
set_stat 0 ;all off
> load_flag 0
06a4 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
06a6 : 48 > pha ;use stack to load status
06a7 : 28 > plp
06a8 : 301a bmi nbr11 ;branches should not be taken
06aa : 701b bvs nbr12
06ac : b01c bcs nbr13
06ae : f01d beq nbr14
06b0 : 1003 bpl br11 ;branches should be taken
trap
06b2 : 205b44 > jsr report_error
06b5 : 5003 br11 bvc br12
trap
06b7 : 205b44 > jsr report_error
06ba : 9003 br12 bcc br13
trap
06bc : 205b44 > jsr report_error
06bf : d00f br13 bne br14
trap
06c1 : 205b44 > jsr report_error
06c4 : nbr11
trap ;previous bmi taken
06c4 : 205b44 > jsr report_error
06c7 : nbr12
trap ;previous bvs taken
06c7 : 205b44 > jsr report_error
06ca : nbr13
trap ;previous bcs taken
06ca : 205b44 > jsr report_error
06cd : nbr14
trap ;previous beq taken
06cd : 205b44 > jsr report_error
06d0 : 08 br14 php
06d1 : 68 pla
cmp_flag 0 ;flags off except break (pushed by sw) + reserved?
06d2 : c930 > cmp #(0 |fao)&m8 ;expected flags + always on bits
trap_ne
06d4 : f003 > beq skip0095
> trap ;failed not equal (non zero)
06d6 : 205b44 > jsr report_error
>
06d9 : >skip0095
;crosscheck flags
set_stat zero
> load_flag zero
06d9 : a902 > lda #zero ;allow test to change I-flag (no mask)
>
06db : 48 > pha ;use stack to load status
06dc : 28 > plp
06dd : d002 bne brzs1
06df : f003 beq brzs2
06e1 : brzs1
trap ;branch zero/non zero
06e1 : 205b44 > jsr report_error
06e4 : b002 brzs2 bcs brzs3
06e6 : 9003 bcc brzs4
06e8 : brzs3
trap ;branch carry/no carry
06e8 : 205b44 > jsr report_error
06eb : 3002 brzs4 bmi brzs5
06ed : 1003 bpl brzs6
06ef : brzs5
trap ;branch minus/plus
06ef : 205b44 > jsr report_error
06f2 : 7002 brzs6 bvs brzs7
06f4 : 5003 bvc brzs8
06f6 : brzs7
trap ;branch overflow/no overflow
06f6 : 205b44 > jsr report_error
06f9 : brzs8
set_stat carry
> load_flag carry
06f9 : a901 > lda #carry ;allow test to change I-flag (no mask)
>
06fb : 48 > pha ;use stack to load status
06fc : 28 > plp
06fd : f002 beq brcs1
06ff : d003 bne brcs2
0701 : brcs1
trap ;branch zero/non zero
0701 : 205b44 > jsr report_error
0704 : 9002 brcs2 bcc brcs3
0706 : b003 bcs brcs4
0708 : brcs3
trap ;branch carry/no carry
0708 : 205b44 > jsr report_error
070b : 3002 brcs4 bmi brcs5
070d : 1003 bpl brcs6
070f : brcs5
trap ;branch minus/plus
070f : 205b44 > jsr report_error
0712 : 7002 brcs6 bvs brcs7
0714 : 5003 bvc brcs8
0716 : brcs7
trap ;branch overflow/no overflow
0716 : 205b44 > jsr report_error
0719 : brcs8
set_stat minus
> load_flag minus
0719 : a980 > lda #minus ;allow test to change I-flag (no mask)
>
071b : 48 > pha ;use stack to load status
071c : 28 > plp
071d : f002 beq brmi1
071f : d003 bne brmi2
0721 : brmi1
trap ;branch zero/non zero
0721 : 205b44 > jsr report_error
0724 : b002 brmi2 bcs brmi3
0726 : 9003 bcc brmi4
0728 : brmi3
trap ;branch carry/no carry
0728 : 205b44 > jsr report_error
072b : 1002 brmi4 bpl brmi5
072d : 3003 bmi brmi6
072f : brmi5
trap ;branch minus/plus
072f : 205b44 > jsr report_error
0732 : 7002 brmi6 bvs brmi7
0734 : 5003 bvc brmi8
0736 : brmi7
trap ;branch overflow/no overflow
0736 : 205b44 > jsr report_error
0739 : brmi8
set_stat overfl
> load_flag overfl
0739 : a940 > lda #overfl ;allow test to change I-flag (no mask)
>
073b : 48 > pha ;use stack to load status
073c : 28 > plp
073d : f002 beq brvs1
073f : d003 bne brvs2
0741 : brvs1
trap ;branch zero/non zero
0741 : 205b44 > jsr report_error
0744 : b002 brvs2 bcs brvs3
0746 : 9003 bcc brvs4
0748 : brvs3
trap ;branch carry/no carry
0748 : 205b44 > jsr report_error
074b : 3002 brvs4 bmi brvs5
074d : 1003 bpl brvs6
074f : brvs5
trap ;branch minus/plus
074f : 205b44 > jsr report_error
0752 : 5002 brvs6 bvc brvs7
0754 : 7003 bvs brvs8
0756 : brvs7
trap ;branch overflow/no overflow
0756 : 205b44 > jsr report_error
0759 : brvs8
set_stat $ff-zero
> load_flag $ff-zero
0759 : a9fd > lda #$ff-zero ;allow test to change I-flag (no mask)
>
075b : 48 > pha ;use stack to load status
075c : 28 > plp
075d : f002 beq brzc1
075f : d003 bne brzc2
0761 : brzc1
trap ;branch zero/non zero
0761 : 205b44 > jsr report_error
0764 : 9002 brzc2 bcc brzc3
0766 : b003 bcs brzc4
0768 : brzc3
trap ;branch carry/no carry
0768 : 205b44 > jsr report_error
076b : 1002 brzc4 bpl brzc5
076d : 3003 bmi brzc6
076f : brzc5
trap ;branch minus/plus
076f : 205b44 > jsr report_error
0772 : 5002 brzc6 bvc brzc7
0774 : 7003 bvs brzc8
0776 : brzc7
trap ;branch overflow/no overflow
0776 : 205b44 > jsr report_error
0779 : brzc8
set_stat $ff-carry
> load_flag $ff-carry
0779 : a9fe > lda #$ff-carry ;allow test to change I-flag (no mask)
>
077b : 48 > pha ;use stack to load status
077c : 28 > plp
077d : d002 bne brcc1
077f : f003 beq brcc2
0781 : brcc1
trap ;branch zero/non zero
0781 : 205b44 > jsr report_error
0784 : b002 brcc2 bcs brcc3
0786 : 9003 bcc brcc4
0788 : brcc3
trap ;branch carry/no carry
0788 : 205b44 > jsr report_error
078b : 1002 brcc4 bpl brcc5
078d : 3003 bmi brcc6
078f : brcc5
trap ;branch minus/plus
078f : 205b44 > jsr report_error
0792 : 5002 brcc6 bvc brcc7
0794 : 7003 bvs brcc8
0796 : brcc7
trap ;branch overflow/no overflow
0796 : 205b44 > jsr report_error
0799 : brcc8
set_stat $ff-minus
> load_flag $ff-minus
0799 : a97f > lda #$ff-minus ;allow test to change I-flag (no mask)
>
079b : 48 > pha ;use stack to load status
079c : 28 > plp
079d : d002 bne brpl1
079f : f003 beq brpl2
07a1 : brpl1
trap ;branch zero/non zero
07a1 : 205b44 > jsr report_error
07a4 : 9002 brpl2 bcc brpl3
07a6 : b003 bcs brpl4
07a8 : brpl3
trap ;branch carry/no carry
07a8 : 205b44 > jsr report_error
07ab : 3002 brpl4 bmi brpl5
07ad : 1003 bpl brpl6
07af : brpl5
trap ;branch minus/plus
07af : 205b44 > jsr report_error
07b2 : 5002 brpl6 bvc brpl7
07b4 : 7003 bvs brpl8
07b6 : brpl7
trap ;branch overflow/no overflow
07b6 : 205b44 > jsr report_error
07b9 : brpl8
set_stat $ff-overfl
> load_flag $ff-overfl
07b9 : a9bf > lda #$ff-overfl ;allow test to change I-flag (no mask)
>
07bb : 48 > pha ;use stack to load status
07bc : 28 > plp
07bd : d002 bne brvc1
07bf : f003 beq brvc2
07c1 : brvc1
trap ;branch zero/non zero
07c1 : 205b44 > jsr report_error
07c4 : 9002 brvc2 bcc brvc3
07c6 : b003 bcs brvc4
07c8 : brvc3
trap ;branch carry/no carry
07c8 : 205b44 > jsr report_error
07cb : 1002 brvc4 bpl brvc5
07cd : 3003 bmi brvc6
07cf : brvc5
trap ;branch minus/plus
07cf : 205b44 > jsr report_error
07d2 : 7002 brvc6 bvs brvc7
07d4 : 5003 bvc brvc8
07d6 : brvc7
trap ;branch overflow/no overflow
07d6 : 205b44 > jsr report_error
07d9 : brvc8
next_test
07d9 : ad0002 > lda test_case ;previous test
07dc : c904 > cmp #test_num
> trap_ne ;test is out of sequence
07de : f003 > beq skip0146
> trap ;failed not equal (non zero)
07e0 : 205b44 > jsr report_error
>
07e3 : >skip0146
>
0005 = >test_num = test_num + 1
07e3 : a905 > lda #test_num ;*** next tests' number
07e5 : 8d0002 > sta test_case
> ;check_ram ;uncomment to find altered RAM after each test
; test PHA does not alter flags or accumulator but PLA does
07e8 : a255 ldx #$55 ;x & y protected
07ea : a0aa ldy #$aa
set_a 1,$ff ;push
> load_flag $ff
07ec : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
07ee : 48 > pha ;use stack to load status
07ef : a901 > lda #1 ;precharge accu
07f1 : 28 > plp
07f2 : 48 pha
tst_a 1,$ff
07f3 : 08 > php ;save flags
07f4 : c901 > cmp #1 ;test result
> trap_ne
07f6 : f003 > beq skip0151
> trap ;failed not equal (non zero)
07f8 : 205b44 > jsr report_error
>
07fb : >skip0151
>
07fb : 68 > pla ;load status
07fc : 48 > pha
> cmp_flag $ff
07fd : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
07ff : f003 > beq skip0154
> trap ;failed not equal (non zero)
0801 : 205b44 > jsr report_error
>
0804 : >skip0154
>
0804 : 28 > plp ;restore status
set_a 0,0
> load_flag 0
0805 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
0807 : 48 > pha ;use stack to load status
0808 : a900 > lda #0 ;precharge accu
080a : 28 > plp
080b : 48 pha
tst_a 0,0
080c : 08 > php ;save flags
080d : c900 > cmp #0 ;test result
> trap_ne
080f : f003 > beq skip0159
> trap ;failed not equal (non zero)
0811 : 205b44 > jsr report_error
>
0814 : >skip0159
>
0814 : 68 > pla ;load status
0815 : 48 > pha
> cmp_flag 0
0816 : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0818 : f003 > beq skip0162
> trap ;failed not equal (non zero)
081a : 205b44 > jsr report_error
>
081d : >skip0162
>
081d : 28 > plp ;restore status
set_a $ff,$ff
> load_flag $ff
081e : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
0820 : 48 > pha ;use stack to load status
0821 : a9ff > lda #$ff ;precharge accu
0823 : 28 > plp
0824 : 48 pha
tst_a $ff,$ff
0825 : 08 > php ;save flags
0826 : c9ff > cmp #$ff ;test result
> trap_ne
0828 : f003 > beq skip0167
> trap ;failed not equal (non zero)
082a : 205b44 > jsr report_error
>
082d : >skip0167
>
082d : 68 > pla ;load status
082e : 48 > pha
> cmp_flag $ff
082f : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0831 : f003 > beq skip0170
> trap ;failed not equal (non zero)
0833 : 205b44 > jsr report_error
>
0836 : >skip0170
>
0836 : 28 > plp ;restore status
set_a 1,0
> load_flag 0
0837 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
0839 : 48 > pha ;use stack to load status
083a : a901 > lda #1 ;precharge accu
083c : 28 > plp
083d : 48 pha
tst_a 1,0
083e : 08 > php ;save flags
083f : c901 > cmp #1 ;test result
> trap_ne
0841 : f003 > beq skip0175
> trap ;failed not equal (non zero)
0843 : 205b44 > jsr report_error
>
0846 : >skip0175
>
0846 : 68 > pla ;load status
0847 : 48 > pha
> cmp_flag 0
0848 : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
084a : f003 > beq skip0178
> trap ;failed not equal (non zero)
084c : 205b44 > jsr report_error
>
084f : >skip0178
>
084f : 28 > plp ;restore status
set_a 0,$ff
> load_flag $ff
0850 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
0852 : 48 > pha ;use stack to load status
0853 : a900 > lda #0 ;precharge accu
0855 : 28 > plp
0856 : 48 pha
tst_a 0,$ff
0857 : 08 > php ;save flags
0858 : c900 > cmp #0 ;test result
> trap_ne
085a : f003 > beq skip0183
> trap ;failed not equal (non zero)
085c : 205b44 > jsr report_error
>
085f : >skip0183
>
085f : 68 > pla ;load status
0860 : 48 > pha
> cmp_flag $ff
0861 : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0863 : f003 > beq skip0186
> trap ;failed not equal (non zero)
0865 : 205b44 > jsr report_error
>
0868 : >skip0186
>
0868 : 28 > plp ;restore status
set_a $ff,0
> load_flag 0
0869 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
086b : 48 > pha ;use stack to load status
086c : a9ff > lda #$ff ;precharge accu
086e : 28 > plp
086f : 48 pha
tst_a $ff,0
0870 : 08 > php ;save flags
0871 : c9ff > cmp #$ff ;test result
> trap_ne
0873 : f003 > beq skip0191
> trap ;failed not equal (non zero)
0875 : 205b44 > jsr report_error
>
0878 : >skip0191
>
0878 : 68 > pla ;load status
0879 : 48 > pha
> cmp_flag 0
087a : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
087c : f003 > beq skip0194
> trap ;failed not equal (non zero)
087e : 205b44 > jsr report_error
>
0881 : >skip0194
>
0881 : 28 > plp ;restore status
set_a 0,$ff ;pull
> load_flag $ff
0882 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
0884 : 48 > pha ;use stack to load status
0885 : a900 > lda #0 ;precharge accu
0887 : 28 > plp
0888 : 68 pla
tst_a $ff,$ff-zero
0889 : 08 > php ;save flags
088a : c9ff > cmp #$ff ;test result
> trap_ne
088c : f003 > beq skip0199
> trap ;failed not equal (non zero)
088e : 205b44 > jsr report_error
>
0891 : >skip0199
>
0891 : 68 > pla ;load status
0892 : 48 > pha
> cmp_flag $ff-zero
0893 : c9fd > cmp #($ff-zero|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0895 : f003 > beq skip0202
> trap ;failed not equal (non zero)
0897 : 205b44 > jsr report_error
>
089a : >skip0202
>
089a : 28 > plp ;restore status
set_a $ff,0
> load_flag 0
089b : a900 > lda #0 ;allow test to change I-flag (no mask)
>
089d : 48 > pha ;use stack to load status
089e : a9ff > lda #$ff ;precharge accu
08a0 : 28 > plp
08a1 : 68 pla
tst_a 0,zero
08a2 : 08 > php ;save flags
08a3 : c900 > cmp #0 ;test result
> trap_ne
08a5 : f003 > beq skip0207
> trap ;failed not equal (non zero)
08a7 : 205b44 > jsr report_error
>
08aa : >skip0207
>
08aa : 68 > pla ;load status
08ab : 48 > pha
> cmp_flag zero
08ac : c932 > cmp #(zero|fao)&m8 ;expected flags + always on bits
>
> trap_ne
08ae : f003 > beq skip0210
> trap ;failed not equal (non zero)
08b0 : 205b44 > jsr report_error
>
08b3 : >skip0210
>
08b3 : 28 > plp ;restore status
set_a $fe,$ff
> load_flag $ff
08b4 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
08b6 : 48 > pha ;use stack to load status
08b7 : a9fe > lda #$fe ;precharge accu
08b9 : 28 > plp
08ba : 68 pla
tst_a 1,$ff-zero-minus
08bb : 08 > php ;save flags
08bc : c901 > cmp #1 ;test result
> trap_ne
08be : f003 > beq skip0215
> trap ;failed not equal (non zero)
08c0 : 205b44 > jsr report_error
>
08c3 : >skip0215
>
08c3 : 68 > pla ;load status
08c4 : 48 > pha
> cmp_flag $ff-zero-minus
08c5 : c97d > cmp #($ff-zero-minus|fao)&m8 ;expected flags + always on bits
>
> trap_ne
08c7 : f003 > beq skip0218
> trap ;failed not equal (non zero)
08c9 : 205b44 > jsr report_error
>
08cc : >skip0218
>
08cc : 28 > plp ;restore status
set_a 0,0
> load_flag 0
08cd : a900 > lda #0 ;allow test to change I-flag (no mask)
>
08cf : 48 > pha ;use stack to load status
08d0 : a900 > lda #0 ;precharge accu
08d2 : 28 > plp
08d3 : 68 pla
tst_a $ff,minus
08d4 : 08 > php ;save flags
08d5 : c9ff > cmp #$ff ;test result
> trap_ne
08d7 : f003 > beq skip0223
> trap ;failed not equal (non zero)
08d9 : 205b44 > jsr report_error
>
08dc : >skip0223
>
08dc : 68 > pla ;load status
08dd : 48 > pha
> cmp_flag minus
08de : c9b0 > cmp #(minus|fao)&m8 ;expected flags + always on bits
>
> trap_ne
08e0 : f003 > beq skip0226
> trap ;failed not equal (non zero)
08e2 : 205b44 > jsr report_error
>
08e5 : >skip0226
>
08e5 : 28 > plp ;restore status
set_a $ff,$ff
> load_flag $ff
08e6 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
08e8 : 48 > pha ;use stack to load status
08e9 : a9ff > lda #$ff ;precharge accu
08eb : 28 > plp
08ec : 68 pla
tst_a 0,$ff-minus
08ed : 08 > php ;save flags
08ee : c900 > cmp #0 ;test result
> trap_ne
08f0 : f003 > beq skip0231
> trap ;failed not equal (non zero)
08f2 : 205b44 > jsr report_error
>
08f5 : >skip0231
>
08f5 : 68 > pla ;load status
08f6 : 48 > pha
> cmp_flag $ff-minus
08f7 : c97f > cmp #($ff-minus|fao)&m8 ;expected flags + always on bits
>
> trap_ne
08f9 : f003 > beq skip0234
> trap ;failed not equal (non zero)
08fb : 205b44 > jsr report_error
>
08fe : >skip0234
>
08fe : 28 > plp ;restore status
set_a $fe,0
> load_flag 0
08ff : a900 > lda #0 ;allow test to change I-flag (no mask)
>
0901 : 48 > pha ;use stack to load status
0902 : a9fe > lda #$fe ;precharge accu
0904 : 28 > plp
0905 : 68 pla
tst_a 1,0
0906 : 08 > php ;save flags
0907 : c901 > cmp #1 ;test result
> trap_ne
0909 : f003 > beq skip0239
> trap ;failed not equal (non zero)
090b : 205b44 > jsr report_error
>
090e : >skip0239
>
090e : 68 > pla ;load status
090f : 48 > pha
> cmp_flag 0
0910 : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0912 : f003 > beq skip0242
> trap ;failed not equal (non zero)
0914 : 205b44 > jsr report_error
>
0917 : >skip0242
>
0917 : 28 > plp ;restore status
0918 : e055 cpx #$55 ;x & y unchanged?
trap_ne
091a : f003 > beq skip0244
> trap ;failed not equal (non zero)
091c : 205b44 > jsr report_error
>
091f : >skip0244
091f : c0aa cpy #$aa
trap_ne
0921 : f003 > beq skip0246
> trap ;failed not equal (non zero)
0923 : 205b44 > jsr report_error
>
0926 : >skip0246
next_test
0926 : ad0002 > lda test_case ;previous test
0929 : c905 > cmp #test_num
> trap_ne ;test is out of sequence
092b : f003 > beq skip0249
> trap ;failed not equal (non zero)
092d : 205b44 > jsr report_error
>
0930 : >skip0249
>
0006 = >test_num = test_num + 1
0930 : a906 > lda #test_num ;*** next tests' number
0932 : 8d0002 > sta test_case
> ;check_ram ;uncomment to find altered RAM after each test
; partial pretest EOR #
set_a $3c,0
> load_flag 0
0935 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
0937 : 48 > pha ;use stack to load status
0938 : a93c > lda #$3c ;precharge accu
093a : 28 > plp
093b : 49c3 eor #$c3
tst_a $ff,fn
093d : 08 > php ;save flags
093e : c9ff > cmp #$ff ;test result
> trap_ne
0940 : f003 > beq skip0254
> trap ;failed not equal (non zero)
0942 : 205b44 > jsr report_error
>
0945 : >skip0254
>
0945 : 68 > pla ;load status
0946 : 48 > pha
> cmp_flag fn
0947 : c9b0 > cmp #(fn|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0949 : f003 > beq skip0257
> trap ;failed not equal (non zero)
094b : 205b44 > jsr report_error
>
094e : >skip0257
>
094e : 28 > plp ;restore status
set_a $c3,0
> load_flag 0
094f : a900 > lda #0 ;allow test to change I-flag (no mask)
>
0951 : 48 > pha ;use stack to load status
0952 : a9c3 > lda #$c3 ;precharge accu
0954 : 28 > plp
0955 : 49c3 eor #$c3
tst_a 0,fz
0957 : 08 > php ;save flags
0958 : c900 > cmp #0 ;test result
> trap_ne
095a : f003 > beq skip0262
> trap ;failed not equal (non zero)
095c : 205b44 > jsr report_error
>
095f : >skip0262
>
095f : 68 > pla ;load status
0960 : 48 > pha
> cmp_flag fz
0961 : c932 > cmp #(fz|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0963 : f003 > beq skip0265
> trap ;failed not equal (non zero)
0965 : 205b44 > jsr report_error
>
0968 : >skip0265
>
0968 : 28 > plp ;restore status
next_test
0969 : ad0002 > lda test_case ;previous test
096c : c906 > cmp #test_num
> trap_ne ;test is out of sequence
096e : f003 > beq skip0268
> trap ;failed not equal (non zero)
0970 : 205b44 > jsr report_error
>
0973 : >skip0268
>
0007 = >test_num = test_num + 1
0973 : a907 > lda #test_num ;*** next tests' number
0975 : 8d0002 > sta test_case
> ;check_ram ;uncomment to find altered RAM after each test
; PC modifying instructions except branches (NOP, JMP, JSR, RTS, BRK, RTI)
; testing NOP
0978 : a224 ldx #$24
097a : a042 ldy #$42
set_a $18,0
> load_flag 0
097c : a900 > lda #0 ;allow test to change I-flag (no mask)
>
097e : 48 > pha ;use stack to load status
097f : a918 > lda #$18 ;precharge accu
0981 : 28 > plp
0982 : ea nop
tst_a $18,0
0983 : 08 > php ;save flags
0984 : c918 > cmp #$18 ;test result
> trap_ne
0986 : f003 > beq skip0273
> trap ;failed not equal (non zero)
0988 : 205b44 > jsr report_error
>
098b : >skip0273
>
098b : 68 > pla ;load status
098c : 48 > pha
> cmp_flag 0
098d : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
098f : f003 > beq skip0276
> trap ;failed not equal (non zero)
0991 : 205b44 > jsr report_error
>
0994 : >skip0276
>
0994 : 28 > plp ;restore status
0995 : e024 cpx #$24
trap_ne
0997 : f003 > beq skip0278
> trap ;failed not equal (non zero)
0999 : 205b44 > jsr report_error
>
099c : >skip0278
099c : c042 cpy #$42
trap_ne
099e : f003 > beq skip0280
> trap ;failed not equal (non zero)
09a0 : 205b44 > jsr report_error
>
09a3 : >skip0280
09a3 : a2db ldx #$db
09a5 : a0bd ldy #$bd
set_a $e7,$ff
> load_flag $ff
09a7 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
09a9 : 48 > pha ;use stack to load status
09aa : a9e7 > lda #$e7 ;precharge accu
09ac : 28 > plp
09ad : ea nop
tst_a $e7,$ff
09ae : 08 > php ;save flags
09af : c9e7 > cmp #$e7 ;test result
> trap_ne
09b1 : f003 > beq skip0285
> trap ;failed not equal (non zero)
09b3 : 205b44 > jsr report_error
>
09b6 : >skip0285
>
09b6 : 68 > pla ;load status
09b7 : 48 > pha
> cmp_flag $ff
09b8 : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
09ba : f003 > beq skip0288
> trap ;failed not equal (non zero)
09bc : 205b44 > jsr report_error
>
09bf : >skip0288
>
09bf : 28 > plp ;restore status
09c0 : e0db cpx #$db
trap_ne
09c2 : f003 > beq skip0290
> trap ;failed not equal (non zero)
09c4 : 205b44 > jsr report_error
>
09c7 : >skip0290
09c7 : c0bd cpy #$bd
trap_ne
09c9 : f003 > beq skip0292
> trap ;failed not equal (non zero)
09cb : 205b44 > jsr report_error
>
09ce : >skip0292
next_test
09ce : ad0002 > lda test_case ;previous test
09d1 : c907 > cmp #test_num
> trap_ne ;test is out of sequence
09d3 : f003 > beq skip0295
> trap ;failed not equal (non zero)
09d5 : 205b44 > jsr report_error
>
09d8 : >skip0295
>
0008 = >test_num = test_num + 1
09d8 : a908 > lda #test_num ;*** next tests' number
09da : 8d0002 > sta test_case
> ;check_ram ;uncomment to find altered RAM after each test
; jump absolute
set_stat $0
> load_flag $0
09dd : a900 > lda #$0 ;allow test to change I-flag (no mask)
>
09df : 48 > pha ;use stack to load status
09e0 : 28 > plp
09e1 : a946 lda #'F'
09e3 : a241 ldx #'A'
09e5 : a052 ldy #'R' ;N=0, V=0, Z=0, C=0
09e7 : 4c8c42 jmp test_far
09ea : ea nop
09eb : ea nop
trap_ne ;runover protection
09ec : f003 > beq skip0299
> trap ;failed not equal (non zero)
09ee : 205b44 > jsr report_error
>
09f1 : >skip0299
09f1 : e8 inx
09f2 : e8 inx
09f3 : far_ret
trap_eq ;returned flags OK?
09f3 : d003 > bne skip0301
> trap ;failed equal (zero)
09f5 : 205b44 > jsr report_error
>
09f8 : >skip0301
trap_pl
09f8 : 3003 > bmi skip0303
> trap ;failed plus (bit 7 clear)
09fa : 205b44 > jsr report_error
>
09fd : >skip0303
trap_cc
09fd : b003 > bcs skip0305
> trap ;failed carry clear
09ff : 205b44 > jsr report_error
>
0a02 : >skip0305
trap_vc
0a02 : 7003 > bvs skip0307
> trap ;failed overflow clear
0a04 : 205b44 > jsr report_error
>
0a07 : >skip0307
0a07 : c9ec cmp #('F'^$aa) ;returned registers OK?
trap_ne
0a09 : f003 > beq skip0309
> trap ;failed not equal (non zero)
0a0b : 205b44 > jsr report_error
>
0a0e : >skip0309
0a0e : e042 cpx #('A'+1)
trap_ne
0a10 : f003 > beq skip0311
> trap ;failed not equal (non zero)
0a12 : 205b44 > jsr report_error
>
0a15 : >skip0311
0a15 : c04f cpy #('R'-3)
trap_ne
0a17 : f003 > beq skip0313
> trap ;failed not equal (non zero)
0a19 : 205b44 > jsr report_error
>
0a1c : >skip0313
0a1c : ca dex
0a1d : c8 iny
0a1e : c8 iny
0a1f : c8 iny
0a20 : 49aa eor #$aa ;N=0, V=1, Z=0, C=1
0a22 : 4c2e0a jmp test_near
0a25 : ea nop
0a26 : ea nop
trap_ne ;runover protection
0a27 : f003 > beq skip0315
> trap ;failed not equal (non zero)
0a29 : 205b44 > jsr report_error
>
0a2c : >skip0315
0a2c : e8 inx
0a2d : e8 inx
0a2e : test_near
trap_eq ;passed flags OK?
0a2e : d003 > bne skip0317
> trap ;failed equal (zero)
0a30 : 205b44 > jsr report_error
>
0a33 : >skip0317
trap_mi
0a33 : 1003 > bpl skip0319
> trap ;failed minus (bit 7 set)
0a35 : 205b44 > jsr report_error
>
0a38 : >skip0319
trap_cc
0a38 : b003 > bcs skip0321
> trap ;failed carry clear
0a3a : 205b44 > jsr report_error
>
0a3d : >skip0321
trap_vc
0a3d : 7003 > bvs skip0323
> trap ;failed overflow clear
0a3f : 205b44 > jsr report_error
>
0a42 : >skip0323
0a42 : c946 cmp #'F' ;passed registers OK?
trap_ne
0a44 : f003 > beq skip0325
> trap ;failed not equal (non zero)
0a46 : 205b44 > jsr report_error
>
0a49 : >skip0325
0a49 : e041 cpx #'A'
trap_ne
0a4b : f003 > beq skip0327
> trap ;failed not equal (non zero)
0a4d : 205b44 > jsr report_error
>
0a50 : >skip0327
0a50 : c052 cpy #'R'
trap_ne
0a52 : f003 > beq skip0329
> trap ;failed not equal (non zero)
0a54 : 205b44 > jsr report_error
>
0a57 : >skip0329
next_test
0a57 : ad0002 > lda test_case ;previous test
0a5a : c908 > cmp #test_num
> trap_ne ;test is out of sequence
0a5c : f003 > beq skip0332
> trap ;failed not equal (non zero)
0a5e : 205b44 > jsr report_error
>
0a61 : >skip0332
>
0009 = >test_num = test_num + 1
0a61 : a909 > lda #test_num ;*** next tests' number
0a63 : 8d0002 > sta test_case
> ;check_ram ;uncomment to find altered RAM after each test
; jump indirect
set_stat 0
> load_flag 0
0a66 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
0a68 : 48 > pha ;use stack to load status
0a69 : 28 > plp
0a6a : a949 lda #'I'
0a6c : a24e ldx #'N'
0a6e : a044 ldy #'D' ;N=0, V=0, Z=0, C=0
0a70 : 6cd242 jmp (ptr_tst_ind)
0a73 : ea nop
trap_ne ;runover protection
0a74 : f003 > beq skip0336
> trap ;failed not equal (non zero)
0a76 : 205b44 > jsr report_error
>
0a79 : >skip0336
0a79 : 88 dey
0a7a : 88 dey
0a7b : ind_ret
0a7b : 08 php ;either SP or Y count will fail, if we do not hit
0a7c : 88 dey
0a7d : 88 dey
0a7e : 88 dey
0a7f : 28 plp
trap_eq ;returned flags OK?
0a80 : d003 > bne skip0338
> trap ;failed equal (zero)
0a82 : 205b44 > jsr report_error
>
0a85 : >skip0338
trap_pl
0a85 : 3003 > bmi skip0340
> trap ;failed plus (bit 7 clear)
0a87 : 205b44 > jsr report_error
>
0a8a : >skip0340
trap_cc
0a8a : b003 > bcs skip0342
> trap ;failed carry clear
0a8c : 205b44 > jsr report_error
>
0a8f : >skip0342
trap_vc
0a8f : 7003 > bvs skip0344
> trap ;failed overflow clear
0a91 : 205b44 > jsr report_error
>
0a94 : >skip0344
0a94 : c9e3 cmp #('I'^$aa) ;returned registers OK?
trap_ne
0a96 : f003 > beq skip0346
> trap ;failed not equal (non zero)
0a98 : 205b44 > jsr report_error
>
0a9b : >skip0346
0a9b : e04f cpx #('N'+1)
trap_ne
0a9d : f003 > beq skip0348
> trap ;failed not equal (non zero)
0a9f : 205b44 > jsr report_error
>
0aa2 : >skip0348
0aa2 : c03e cpy #('D'-6)
trap_ne
0aa4 : f003 > beq skip0350
> trap ;failed not equal (non zero)
0aa6 : 205b44 > jsr report_error
>
0aa9 : >skip0350
0aa9 : ba tsx ;SP check
0aaa : e0ff cpx #$ff
trap_ne
0aac : f003 > beq skip0352
> trap ;failed not equal (non zero)
0aae : 205b44 > jsr report_error
>
0ab1 : >skip0352
next_test
0ab1 : ad0002 > lda test_case ;previous test
0ab4 : c909 > cmp #test_num
> trap_ne ;test is out of sequence
0ab6 : f003 > beq skip0355
> trap ;failed not equal (non zero)
0ab8 : 205b44 > jsr report_error
>
0abb : >skip0355
>
000a = >test_num = test_num + 1
0abb : a90a > lda #test_num ;*** next tests' number
0abd : 8d0002 > sta test_case
> ;check_ram ;uncomment to find altered RAM after each test
; jump subroutine & return from subroutine
set_stat 0
> load_flag 0
0ac0 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
0ac2 : 48 > pha ;use stack to load status
0ac3 : 28 > plp
0ac4 : a94a lda #'J'
0ac6 : a253 ldx #'S'
0ac8 : a052 ldy #'R' ;N=0, V=0, Z=0, C=0
0aca : 202943 jsr test_jsr
0acc = jsr_ret = *-1 ;last address of jsr = return address
0acd : 08 php ;either SP or Y count will fail, if we do not hit
0ace : 88 dey
0acf : 88 dey
0ad0 : 88 dey
0ad1 : 28 plp
trap_eq ;returned flags OK?
0ad2 : d003 > bne skip0359
> trap ;failed equal (zero)
0ad4 : 205b44 > jsr report_error
>
0ad7 : >skip0359
trap_pl
0ad7 : 3003 > bmi skip0361
> trap ;failed plus (bit 7 clear)
0ad9 : 205b44 > jsr report_error
>
0adc : >skip0361
trap_cc
0adc : b003 > bcs skip0363
> trap ;failed carry clear
0ade : 205b44 > jsr report_error
>
0ae1 : >skip0363
trap_vc
0ae1 : 7003 > bvs skip0365
> trap ;failed overflow clear
0ae3 : 205b44 > jsr report_error
>
0ae6 : >skip0365
0ae6 : c9e0 cmp #('J'^$aa) ;returned registers OK?
trap_ne
0ae8 : f003 > beq skip0367
> trap ;failed not equal (non zero)
0aea : 205b44 > jsr report_error
>
0aed : >skip0367
0aed : e054 cpx #('S'+1)
trap_ne
0aef : f003 > beq skip0369
> trap ;failed not equal (non zero)
0af1 : 205b44 > jsr report_error
>
0af4 : >skip0369
0af4 : c04c cpy #('R'-6)
trap_ne
0af6 : f003 > beq skip0371
> trap ;failed not equal (non zero)
0af8 : 205b44 > jsr report_error
>
0afb : >skip0371
0afb : ba tsx ;sp?
0afc : e0ff cpx #$ff
trap_ne
0afe : f003 > beq skip0373
> trap ;failed not equal (non zero)
0b00 : 205b44 > jsr report_error
>
0b03 : >skip0373
next_test
0b03 : ad0002 > lda test_case ;previous test
0b06 : c90a > cmp #test_num
> trap_ne ;test is out of sequence
0b08 : f003 > beq skip0376
> trap ;failed not equal (non zero)
0b0a : 205b44 > jsr report_error
>
0b0d : >skip0376
>
000b = >test_num = test_num + 1
0b0d : a90b > lda #test_num ;*** next tests' number
0b0f : 8d0002 > sta test_case
> ;check_ram ;uncomment to find altered RAM after each test
; break & return from interrupt
if ROM_vectors = 1
load_flag 0 ;with interrupts enabled if allowed!
0b12 : a900 > lda #0 ;allow test to change I-flag (no mask)
0b14 : 48 pha
0b15 : a942 lda #'B'
0b17 : a252 ldx #'R'
0b19 : a04b ldy #'K'
0b1b : 28 plp ;N=0, V=0, Z=0, C=0
0b1c : 00 brk
else
lda #hi brk_ret0 ;emulated break
pha
lda #lo brk_ret0
pha
load_flag fao ;set break & unused on stack
pha
load_flag intdis ;during interrupt
pha
lda #'B'
ldx #'R'
ldy #'K'
plp ;N=0, V=0, Z=0, C=0
jmp irq_trap
endif
0b1d : 88 dey ;should not be executed
0b1e : brk_ret0 ;address of break return
0b1e : 08 php ;either SP or Y count will fail, if we do not hit
0b1f : 88 dey
0b20 : 88 dey
0b21 : 88 dey
0b22 : c9e8 cmp #'B'^$aa ;returned registers OK?
;the IRQ vector was never executed if A & X stay unmodified
trap_ne
0b24 : f003 > beq skip0379
> trap ;failed not equal (non zero)
0b26 : 205b44 > jsr report_error
>
0b29 : >skip0379
0b29 : e053 cpx #'R'+1
trap_ne
0b2b : f003 > beq skip0381
> trap ;failed not equal (non zero)
0b2d : 205b44 > jsr report_error
>
0b30 : >skip0381
0b30 : c045 cpy #'K'-6
trap_ne
0b32 : f003 > beq skip0383
> trap ;failed not equal (non zero)
0b34 : 205b44 > jsr report_error
>
0b37 : >skip0383
0b37 : 68 pla ;returned flags OK (unchanged)?
cmp_flag 0
0b38 : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
trap_ne
0b3a : f003 > beq skip0386
> trap ;failed not equal (non zero)
0b3c : 205b44 > jsr report_error
>
0b3f : >skip0386
0b3f : ba tsx ;sp?
0b40 : e0ff cpx #$ff
trap_ne
0b42 : f003 > beq skip0388
> trap ;failed not equal (non zero)
0b44 : 205b44 > jsr report_error
>
0b47 : >skip0388
if ROM_vectors = 1
load_flag $ff ;with interrupts disabled if allowed!
0b47 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
0b49 : 48 pha
0b4a : a9bd lda #$ff-'B'
0b4c : a2ad ldx #$ff-'R'
0b4e : a0b4 ldy #$ff-'K'
0b50 : 28 plp ;N=1, V=1, Z=1, C=1
0b51 : 00 brk
else
lda #hi brk_ret1 ;emulated break
pha
lda #lo brk_ret1
pha
load_flag $ff
pha ;set break & unused on stack
pha ;actual flags
lda #$ff-'B'
ldx #$ff-'R'
ldy #$ff-'K'
plp ;N=1, V=1, Z=1, C=1
jmp irq_trap
endif
0b52 : 88 dey ;should not be executed
0b53 : brk_ret1 ;address of break return
0b53 : 08 php ;either SP or Y count will fail, if we do not hit
0b54 : 88 dey
0b55 : 88 dey
0b56 : 88 dey
0b57 : c917 cmp #($ff-'B')^$aa ;returned registers OK?
;the IRQ vector was never executed if A & X stay unmodified
trap_ne
0b59 : f003 > beq skip0391
> trap ;failed not equal (non zero)
0b5b : 205b44 > jsr report_error
>
0b5e : >skip0391
0b5e : e0ae cpx #$ff-'R'+1
trap_ne
0b60 : f003 > beq skip0393
> trap ;failed not equal (non zero)
0b62 : 205b44 > jsr report_error
>
0b65 : >skip0393
0b65 : c0ae cpy #$ff-'K'-6
trap_ne
0b67 : f003 > beq skip0395
> trap ;failed not equal (non zero)
0b69 : 205b44 > jsr report_error
>
0b6c : >skip0395
0b6c : 68 pla ;returned flags OK (unchanged)?
cmp_flag $ff
0b6d : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
trap_ne
0b6f : f003 > beq skip0398
> trap ;failed not equal (non zero)
0b71 : 205b44 > jsr report_error
>
0b74 : >skip0398
0b74 : ba tsx ;sp?
0b75 : e0ff cpx #$ff
trap_ne
0b77 : f003 > beq skip0400
> trap ;failed not equal (non zero)
0b79 : 205b44 > jsr report_error
>
0b7c : >skip0400
next_test
0b7c : ad0002 > lda test_case ;previous test
0b7f : c90b > cmp #test_num
> trap_ne ;test is out of sequence
0b81 : f003 > beq skip0403
> trap ;failed not equal (non zero)
0b83 : 205b44 > jsr report_error
>
0b86 : >skip0403
>
000c = >test_num = test_num + 1
0b86 : a90c > lda #test_num ;*** next tests' number
0b88 : 8d0002 > sta test_case
> ;check_ram ;uncomment to find altered RAM after each test
; test set and clear flags CLC CLI CLD CLV SEC SEI SED
set_stat $ff
> load_flag $ff
0b8b : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
0b8d : 48 > pha ;use stack to load status
0b8e : 28 > plp
0b8f : 18 clc
tst_stat $ff-carry
0b90 : 08 > php ;save status
0b91 : 68 > pla ;use stack to retrieve status
0b92 : 48 > pha
> cmp_flag $ff-carry
0b93 : c9fe > cmp #($ff-carry|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0b95 : f003 > beq skip0409
> trap ;failed not equal (non zero)
0b97 : 205b44 > jsr report_error
>
0b9a : >skip0409
>
0b9a : 28 > plp ;restore status
0b9b : 38 sec
tst_stat $ff
0b9c : 08 > php ;save status
0b9d : 68 > pla ;use stack to retrieve status
0b9e : 48 > pha
> cmp_flag $ff
0b9f : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0ba1 : f003 > beq skip0413
> trap ;failed not equal (non zero)
0ba3 : 205b44 > jsr report_error
>
0ba6 : >skip0413
>
0ba6 : 28 > plp ;restore status
if I_flag = 3
0ba7 : 58 cli
tst_stat $ff-intdis
0ba8 : 08 > php ;save status
0ba9 : 68 > pla ;use stack to retrieve status
0baa : 48 > pha
> cmp_flag $ff-intdis
0bab : c9fb > cmp #($ff-intdis|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0bad : f003 > beq skip0417
> trap ;failed not equal (non zero)
0baf : 205b44 > jsr report_error
>
0bb2 : >skip0417
>
0bb2 : 28 > plp ;restore status
0bb3 : 78 sei
tst_stat $ff
0bb4 : 08 > php ;save status
0bb5 : 68 > pla ;use stack to retrieve status
0bb6 : 48 > pha
> cmp_flag $ff
0bb7 : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0bb9 : f003 > beq skip0421
> trap ;failed not equal (non zero)
0bbb : 205b44 > jsr report_error
>
0bbe : >skip0421
>
0bbe : 28 > plp ;restore status
endif
0bbf : d8 cld
tst_stat $ff-decmode
0bc0 : 08 > php ;save status
0bc1 : 68 > pla ;use stack to retrieve status
0bc2 : 48 > pha
> cmp_flag $ff-decmode
0bc3 : c9f7 > cmp #($ff-decmode|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0bc5 : f003 > beq skip0425
> trap ;failed not equal (non zero)
0bc7 : 205b44 > jsr report_error
>
0bca : >skip0425
>
0bca : 28 > plp ;restore status
0bcb : f8 sed
tst_stat $ff
0bcc : 08 > php ;save status
0bcd : 68 > pla ;use stack to retrieve status
0bce : 48 > pha
> cmp_flag $ff
0bcf : c9ff > cmp #($ff|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0bd1 : f003 > beq skip0429
> trap ;failed not equal (non zero)
0bd3 : 205b44 > jsr report_error
>
0bd6 : >skip0429
>
0bd6 : 28 > plp ;restore status
0bd7 : b8 clv
tst_stat $ff-overfl
0bd8 : 08 > php ;save status
0bd9 : 68 > pla ;use stack to retrieve status
0bda : 48 > pha
> cmp_flag $ff-overfl
0bdb : c9bf > cmp #($ff-overfl|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0bdd : f003 > beq skip0433
> trap ;failed not equal (non zero)
0bdf : 205b44 > jsr report_error
>
0be2 : >skip0433
>
0be2 : 28 > plp ;restore status
set_stat 0
> load_flag 0
0be3 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
0be5 : 48 > pha ;use stack to load status
0be6 : 28 > plp
tst_stat 0
0be7 : 08 > php ;save status
0be8 : 68 > pla ;use stack to retrieve status
0be9 : 48 > pha
> cmp_flag 0
0bea : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0bec : f003 > beq skip0439
> trap ;failed not equal (non zero)
0bee : 205b44 > jsr report_error
>
0bf1 : >skip0439
>
0bf1 : 28 > plp ;restore status
0bf2 : 38 sec
tst_stat carry
0bf3 : 08 > php ;save status
0bf4 : 68 > pla ;use stack to retrieve status
0bf5 : 48 > pha
> cmp_flag carry
0bf6 : c931 > cmp #(carry|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0bf8 : f003 > beq skip0443
> trap ;failed not equal (non zero)
0bfa : 205b44 > jsr report_error
>
0bfd : >skip0443
>
0bfd : 28 > plp ;restore status
0bfe : 18 clc
tst_stat 0
0bff : 08 > php ;save status
0c00 : 68 > pla ;use stack to retrieve status
0c01 : 48 > pha
> cmp_flag 0
0c02 : c930 > cmp #(0 |fao)&m8 ;expected flags + always on bits
>
> trap_ne
0c04 : f003 > beq skip0447
> trap ;failed not equal (non zero)
0c06 : 205b44 > jsr report_error
>
0c09 : >skip0447
>
0c09 : 28 > plp ;restore status
if I_flag = 3
0c0a : 78 sei
tst_stat intdis
0c0b : 08 > php ;save status
0c0c : 68 > pla ;use stack to retrieve status
0c0d : 48 > pha
> cmp_flag intdis
0c0e : c934 > cmp #(intdis|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0c10 : f003 > beq skip0451
> trap ;failed not equal (non zero)
0c12 : 205b44 > jsr report_error
>
0c15 : >skip0451
>
0c15 : 28 > plp ;restore status
0c16 : 58 cli
tst_stat 0
0c17 : 08 > php ;save status
0c18 : 68 > pla ;use stack to retrieve status
0c19 : 48 > pha
> cmp_flag 0
0c1a : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0c1c : f003 > beq skip0455
> trap ;failed not equal (non zero)
0c1e : 205b44 > jsr report_error
>
0c21 : >skip0455
>
0c21 : 28 > plp ;restore status
endif
0c22 : f8 sed
tst_stat decmode
0c23 : 08 > php ;save status
0c24 : 68 > pla ;use stack to retrieve status
0c25 : 48 > pha
> cmp_flag decmode
0c26 : c938 > cmp #(decmode|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0c28 : f003 > beq skip0459
> trap ;failed not equal (non zero)
0c2a : 205b44 > jsr report_error
>
0c2d : >skip0459
>
0c2d : 28 > plp ;restore status
0c2e : d8 cld
tst_stat 0
0c2f : 08 > php ;save status
0c30 : 68 > pla ;use stack to retrieve status
0c31 : 48 > pha
> cmp_flag 0
0c32 : c930 > cmp #(0 |fao)&m8 ;expected flags + always on bits
>
> trap_ne
0c34 : f003 > beq skip0463
> trap ;failed not equal (non zero)
0c36 : 205b44 > jsr report_error
>
0c39 : >skip0463
>
0c39 : 28 > plp ;restore status
set_stat overfl
> load_flag overfl
0c3a : a940 > lda #overfl ;allow test to change I-flag (no mask)
>
0c3c : 48 > pha ;use stack to load status
0c3d : 28 > plp
tst_stat overfl
0c3e : 08 > php ;save status
0c3f : 68 > pla ;use stack to retrieve status
0c40 : 48 > pha
> cmp_flag overfl
0c41 : c970 > cmp #(overfl|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0c43 : f003 > beq skip0469
> trap ;failed not equal (non zero)
0c45 : 205b44 > jsr report_error
>
0c48 : >skip0469
>
0c48 : 28 > plp ;restore status
0c49 : b8 clv
tst_stat 0
0c4a : 08 > php ;save status
0c4b : 68 > pla ;use stack to retrieve status
0c4c : 48 > pha
> cmp_flag 0
0c4d : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0c4f : f003 > beq skip0473
> trap ;failed not equal (non zero)
0c51 : 205b44 > jsr report_error
>
0c54 : >skip0473
>
0c54 : 28 > plp ;restore status
next_test
0c55 : ad0002 > lda test_case ;previous test
0c58 : c90c > cmp #test_num
> trap_ne ;test is out of sequence
0c5a : f003 > beq skip0476
> trap ;failed not equal (non zero)
0c5c : 205b44 > jsr report_error
>
0c5f : >skip0476
>
000d = >test_num = test_num + 1
0c5f : a90d > lda #test_num ;*** next tests' number
0c61 : 8d0002 > sta test_case
> ;check_ram ;uncomment to find altered RAM after each test
; testing index register increment/decrement and transfer
; INX INY DEX DEY TAX TXA TAY TYA
0c64 : a2fe ldx #$fe
set_stat $ff
> load_flag $ff
0c66 : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
0c68 : 48 > pha ;use stack to load status
0c69 : 28 > plp
0c6a : e8 inx ;ff
tst_x $ff,$ff-zero
0c6b : 08 > php ;save flags
0c6c : e0ff > cpx #$ff ;test result
> trap_ne
0c6e : f003 > beq skip0481
> trap ;failed not equal (non zero)
0c70 : 205b44 > jsr report_error
>
0c73 : >skip0481
>
0c73 : 68 > pla ;load status
0c74 : 48 > pha
> cmp_flag $ff-zero
0c75 : c9fd > cmp #($ff-zero|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0c77 : f003 > beq skip0484
> trap ;failed not equal (non zero)
0c79 : 205b44 > jsr report_error
>
0c7c : >skip0484
>
0c7c : 28 > plp ;restore status
0c7d : e8 inx ;00
tst_x 0,$ff-minus
0c7e : 08 > php ;save flags
0c7f : e000 > cpx #0 ;test result
> trap_ne
0c81 : f003 > beq skip0487
> trap ;failed not equal (non zero)
0c83 : 205b44 > jsr report_error
>
0c86 : >skip0487
>
0c86 : 68 > pla ;load status
0c87 : 48 > pha
> cmp_flag $ff-minus
0c88 : c97f > cmp #($ff-minus|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0c8a : f003 > beq skip0490
> trap ;failed not equal (non zero)
0c8c : 205b44 > jsr report_error
>
0c8f : >skip0490
>
0c8f : 28 > plp ;restore status
0c90 : e8 inx ;01
tst_x 1,$ff-minus-zero
0c91 : 08 > php ;save flags
0c92 : e001 > cpx #1 ;test result
> trap_ne
0c94 : f003 > beq skip0493
> trap ;failed not equal (non zero)
0c96 : 205b44 > jsr report_error
>
0c99 : >skip0493
>
0c99 : 68 > pla ;load status
0c9a : 48 > pha
> cmp_flag $ff-minus-zero
0c9b : c97d > cmp #($ff-minus-zero|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0c9d : f003 > beq skip0496
> trap ;failed not equal (non zero)
0c9f : 205b44 > jsr report_error
>
0ca2 : >skip0496
>
0ca2 : 28 > plp ;restore status
0ca3 : ca dex ;00
tst_x 0,$ff-minus
0ca4 : 08 > php ;save flags
0ca5 : e000 > cpx #0 ;test result
> trap_ne
0ca7 : f003 > beq skip0499
> trap ;failed not equal (non zero)
0ca9 : 205b44 > jsr report_error
>
0cac : >skip0499
>
0cac : 68 > pla ;load status
0cad : 48 > pha
> cmp_flag $ff-minus
0cae : c97f > cmp #($ff-minus|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0cb0 : f003 > beq skip0502
> trap ;failed not equal (non zero)
0cb2 : 205b44 > jsr report_error
>
0cb5 : >skip0502
>
0cb5 : 28 > plp ;restore status
0cb6 : ca dex ;ff
tst_x $ff,$ff-zero
0cb7 : 08 > php ;save flags
0cb8 : e0ff > cpx #$ff ;test result
> trap_ne
0cba : f003 > beq skip0505
> trap ;failed not equal (non zero)
0cbc : 205b44 > jsr report_error
>
0cbf : >skip0505
>
0cbf : 68 > pla ;load status
0cc0 : 48 > pha
> cmp_flag $ff-zero
0cc1 : c9fd > cmp #($ff-zero|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0cc3 : f003 > beq skip0508
> trap ;failed not equal (non zero)
0cc5 : 205b44 > jsr report_error
>
0cc8 : >skip0508
>
0cc8 : 28 > plp ;restore status
0cc9 : ca dex ;fe
set_stat 0
> load_flag 0
0cca : a900 > lda #0 ;allow test to change I-flag (no mask)
>
0ccc : 48 > pha ;use stack to load status
0ccd : 28 > plp
0cce : e8 inx ;ff
tst_x $ff,minus
0ccf : 08 > php ;save flags
0cd0 : e0ff > cpx #$ff ;test result
> trap_ne
0cd2 : f003 > beq skip0513
> trap ;failed not equal (non zero)
0cd4 : 205b44 > jsr report_error
>
0cd7 : >skip0513
>
0cd7 : 68 > pla ;load status
0cd8 : 48 > pha
> cmp_flag minus
0cd9 : c9b0 > cmp #(minus|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0cdb : f003 > beq skip0516
> trap ;failed not equal (non zero)
0cdd : 205b44 > jsr report_error
>
0ce0 : >skip0516
>
0ce0 : 28 > plp ;restore status
0ce1 : e8 inx ;00
tst_x 0,zero
0ce2 : 08 > php ;save flags
0ce3 : e000 > cpx #0 ;test result
> trap_ne
0ce5 : f003 > beq skip0519
> trap ;failed not equal (non zero)
0ce7 : 205b44 > jsr report_error
>
0cea : >skip0519
>
0cea : 68 > pla ;load status
0ceb : 48 > pha
> cmp_flag zero
0cec : c932 > cmp #(zero|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0cee : f003 > beq skip0522
> trap ;failed not equal (non zero)
0cf0 : 205b44 > jsr report_error
>
0cf3 : >skip0522
>
0cf3 : 28 > plp ;restore status
0cf4 : e8 inx ;01
tst_x 1,0
0cf5 : 08 > php ;save flags
0cf6 : e001 > cpx #1 ;test result
> trap_ne
0cf8 : f003 > beq skip0525
> trap ;failed not equal (non zero)
0cfa : 205b44 > jsr report_error
>
0cfd : >skip0525
>
0cfd : 68 > pla ;load status
0cfe : 48 > pha
> cmp_flag 0
0cff : c930 > cmp #(0|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0d01 : f003 > beq skip0528
> trap ;failed not equal (non zero)
0d03 : 205b44 > jsr report_error
>
0d06 : >skip0528
>
0d06 : 28 > plp ;restore status
0d07 : ca dex ;00
tst_x 0,zero
0d08 : 08 > php ;save flags
0d09 : e000 > cpx #0 ;test result
> trap_ne
0d0b : f003 > beq skip0531
> trap ;failed not equal (non zero)
0d0d : 205b44 > jsr report_error
>
0d10 : >skip0531
>
0d10 : 68 > pla ;load status
0d11 : 48 > pha
> cmp_flag zero
0d12 : c932 > cmp #(zero|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0d14 : f003 > beq skip0534
> trap ;failed not equal (non zero)
0d16 : 205b44 > jsr report_error
>
0d19 : >skip0534
>
0d19 : 28 > plp ;restore status
0d1a : ca dex ;ff
tst_x $ff,minus
0d1b : 08 > php ;save flags
0d1c : e0ff > cpx #$ff ;test result
> trap_ne
0d1e : f003 > beq skip0537
> trap ;failed not equal (non zero)
0d20 : 205b44 > jsr report_error
>
0d23 : >skip0537
>
0d23 : 68 > pla ;load status
0d24 : 48 > pha
> cmp_flag minus
0d25 : c9b0 > cmp #(minus|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0d27 : f003 > beq skip0540
> trap ;failed not equal (non zero)
0d29 : 205b44 > jsr report_error
>
0d2c : >skip0540
>
0d2c : 28 > plp ;restore status
0d2d : a0fe ldy #$fe
set_stat $ff
> load_flag $ff
0d2f : a9ff > lda #$ff ;allow test to change I-flag (no mask)
>
0d31 : 48 > pha ;use stack to load status
0d32 : 28 > plp
0d33 : c8 iny ;ff
tst_y $ff,$ff-zero
0d34 : 08 > php ;save flags
0d35 : c0ff > cpy #$ff ;test result
> trap_ne
0d37 : f003 > beq skip0545
> trap ;failed not equal (non zero)
0d39 : 205b44 > jsr report_error
>
0d3c : >skip0545
>
0d3c : 68 > pla ;load status
0d3d : 48 > pha
> cmp_flag $ff-zero
0d3e : c9fd > cmp #($ff-zero|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0d40 : f003 > beq skip0548
> trap ;failed not equal (non zero)
0d42 : 205b44 > jsr report_error
>
0d45 : >skip0548
>
0d45 : 28 > plp ;restore status
0d46 : c8 iny ;00
tst_y 0,$ff-minus
0d47 : 08 > php ;save flags
0d48 : c000 > cpy #0 ;test result
> trap_ne
0d4a : f003 > beq skip0551
> trap ;failed not equal (non zero)
0d4c : 205b44 > jsr report_error
>
0d4f : >skip0551
>
0d4f : 68 > pla ;load status
0d50 : 48 > pha
> cmp_flag $ff-minus
0d51 : c97f > cmp #($ff-minus|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0d53 : f003 > beq skip0554
> trap ;failed not equal (non zero)
0d55 : 205b44 > jsr report_error
>
0d58 : >skip0554
>
0d58 : 28 > plp ;restore status
0d59 : c8 iny ;01
tst_y 1,$ff-minus-zero
0d5a : 08 > php ;save flags
0d5b : c001 > cpy #1 ;test result
> trap_ne
0d5d : f003 > beq skip0557
> trap ;failed not equal (non zero)
0d5f : 205b44 > jsr report_error
>
0d62 : >skip0557
>
0d62 : 68 > pla ;load status
0d63 : 48 > pha
> cmp_flag $ff-minus-zero
0d64 : c97d > cmp #($ff-minus-zero|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0d66 : f003 > beq skip0560
> trap ;failed not equal (non zero)
0d68 : 205b44 > jsr report_error
>
0d6b : >skip0560
>
0d6b : 28 > plp ;restore status
0d6c : 88 dey ;00
tst_y 0,$ff-minus
0d6d : 08 > php ;save flags
0d6e : c000 > cpy #0 ;test result
> trap_ne
0d70 : f003 > beq skip0563
> trap ;failed not equal (non zero)
0d72 : 205b44 > jsr report_error
>
0d75 : >skip0563
>
0d75 : 68 > pla ;load status
0d76 : 48 > pha
> cmp_flag $ff-minus
0d77 : c97f > cmp #($ff-minus|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0d79 : f003 > beq skip0566
> trap ;failed not equal (non zero)
0d7b : 205b44 > jsr report_error
>
0d7e : >skip0566
>
0d7e : 28 > plp ;restore status
0d7f : 88 dey ;ff
tst_y $ff,$ff-zero
0d80 : 08 > php ;save flags
0d81 : c0ff > cpy #$ff ;test result
> trap_ne
0d83 : f003 > beq skip0569
> trap ;failed not equal (non zero)
0d85 : 205b44 > jsr report_error
>
0d88 : >skip0569
>
0d88 : 68 > pla ;load status
0d89 : 48 > pha
> cmp_flag $ff-zero
0d8a : c9fd > cmp #($ff-zero|fao)&m8 ;expected flags + always on bits
>
> trap_ne
0d8c : f003 > beq skip0572
> trap ;failed not equal (non zero)
0d8e : 205b44 > jsr report_error
>
0d91 : >skip0572
>
0d91 : 28 > plp ;restore status
0d92 : 88 dey ;fe
set_stat 0
> load_flag 0
0d93 : a900 > lda #0 ;allow test to change I-flag (no mask)
>
0d95 : 48 > pha ;use stack to load status
0d96 : 28 > plp
0d97 : c8 iny ;ff
tst_y $ff,0+minus
0d98 : 08 > php ;save flags
0d99 : c0ff > cpy #$ff ;test result
> trap_ne