-
Notifications
You must be signed in to change notification settings - Fork 71
Description
See https://github.com/KrisKennaway/py65/blob/master/py65/tests/devices/test_klaus.py for a test suite that runs these against py65.
I didn't commit the binaries because they're GPL'ed but two of them are checked in here: https://github.com/Klaus2m5/6502_65C02_functional_tests/tree/master/bin_files
The 6502_decimal_test I built as "as65 -l -m -w -h0 6502_decimal_test.a65"
Actually the rebuilt ones need a small tweak to load at 0x0a instead of 0x00 which the prebuilt ones are. Probably there's some way to make as65 do that.
The 65C02_extended_opcodes_test.bin is currently not passing. The first place it dies at is in the opcode tests for BBR/BBS/BBT which are not implemented on this simulator. Setting rkwl_wdc_op = 0 to test these opcodes as NOPs is not enough because (at least) the 5C opcode does not behave this way.
If you delete these nop_tests and the BBR/BBS/BBT ones (so that it still tests the RMB/SMB opcodes which are implemented here) then it correctly picks up the TSB/TRB bug that was fixed in #32
It now fails here
PC AC XR YR SP NV-BDIZC
65C02: 1585 01 0c ff fc 11111000
which is here in my version:
1576 : chkdad
; decimal ADC / SBC zp
1576 : 08 php ;save carry for subtract
1577 : a50b lda ad1
1579 : 650c adc ad2 ;perform add
157b : 08 php
157c : c50d cmp adrl ;check result
trap_ne ;bad result
157e : d0fe > bne * ;failed not equal (non zero)
1580 : 68 pla ;check flags
1581 : 2983 and #$83 ;mask N-----ZC
1583 : c50f cmp adrf
trap_ne ;bad flags
1585 : d0fe > bne * ;failed not equal (non zero)
https://github.com/Klaus2m5/6502_65C02_functional_tests/blob/master/bin_files/6502_functional_test.lst#L13099 (different address offset because I deleted code)
Adding some tracing I think it's failing when it gets to 0xb=0x99, 0xc=0x99 and carry set.
Failing test case is:
PC AC XR YR SP NV-BDIZC
65C02: 14ca 00 0c ff ff 01111011 $14CA: SEC # Carry is set
PC AC XR YR SP NV-BDIZC
65C02: 14cb 00 0c ff ff 01111011 $14CB: JSR $1576
PC AC XR YR SP NV-BDIZC
65C02: 1576 00 0c ff fd 01111011 $1576: PHP
PC AC XR YR SP NV-BDIZC
65C02: 1577 00 0c ff fc 01111011 $1577: LDA $0b ; #$99
PC AC XR YR SP NV-BDIZC
65C02: 1579 99 0c ff fc 11111001 $1579: ADC $0c ; #$99
PC AC XR YR SP NV-BDIZC
65C02: 157b 99 0c ff fc 01111001 $157B: PHP
PC AC XR YR SP NV-BDIZC
65C02: 157c 99 0c ff fb 01111001 $157C: CMP $0d ; #$99
PC AC XR YR SP NV-BDIZC
65C02: 157e 99 0c ff fb 01111011 $157E: BNE $157e
PC AC XR YR SP NV-BDIZC
65C02: 1580 99 0c ff fb 01111011 $1580: PLA
PC AC XR YR SP NV-BDIZC
65C02: 1581 79 0c ff fc 01111001 $1581: AND #$83 # mask N-----ZC
PC AC XR YR SP NV-BDIZC
65C02: 1583 01 0c ff fc 01111001 $1583: CMP $0f ; #$81
PC AC XR YR SP NV-BDIZC
65C02: 1585 01 0c ff fc 11111000 $1585: BNE $1585
i.e. it's expecting N to be set which it is not.