GithubHelp home page GithubHelp logo

6502_65c02_functional_tests's Introduction

This is a set of functional tests for the 6502/65C02 type processors.

The 6502_functional_test.a65 is an assembler sourcecode to test all valid
opcodes and addressing modes of the original NMOS 6502 cpu.

The 65C02_extended_opcodes_test.a65c tests all additional opcodes of the
65C02 processor including undefined opcodes.

The 6502_interrupt_test.a65 is a simple test to check the interrupt system
of both processors. A feedback register is required to inject IRQ and NMI
requests.

The 6502_decimal_test.a65 is Bruce Clark's code to accurately test decimal mode
of the various 6502 cores (6502, 65c02 & 65816 in 8-bit mode) with added
configuration options (invalid bcd or not, which flags to ignore).

Detailed information about how to configure, assemble and run the tests is
included in each source file.

The assembler used is no longer available on the author's website. as65_142.zip
is now included in this repository.

And no, I will not switch to another assembler. However, GitHub user amb5l has
a CA65 compatible version in his repository.

Good luck debugging your emulator, simulator, fpga core, discrete
logic implementation or whatever you have!


6502_65c02_functional_tests's People

Contributors

allender avatar klaus2m5 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

6502_65c02_functional_tests's Issues

AS65 Assembler is difficult to find

As indicated in the source code, I followed the link to the AS65 assembler at the indicated link: http://www.kingswood-consulting.co.uk/assemblers/ which is unfortunately broken. As a retro-computing fan, I see a lot of these issues happening. In fact, nowadays it would be not a bad idea to simply include the compiler into the project to avoid any external dependencies. Another option would be to re-write the source-code to run on more widespread assemblers, or publish compiled hex-code listings alongside.

Problem with checking RMW absolute indexed page crossing

I'm writing a Lynx emulator and I've used this test suit many months ago and my CPU emulation eventually passed it (after many corrections as the tests are excellent and I've found many bugs thanks to them). It turns out that I had one bug more - in RMW operations addressing absolutely with indexing (e.g. inc $80ff,x) when page crossing occurred ( here x > 0 ) the read was from correct address but write to not corrected (i.e. to page $80 not $81 in above example). It wasn't cached by this test suit.

as65.exe-generated .bin files need 10byte padding at the beginning

I tried to compile the .bin files myself on a Windows 10 VM, using the zipped as65.exe.

 ./as65.exe -l -m -w -h0 ../6502_functional_test.a65

Somehow, the resulting .bin file's codes segment starts 10bytes before 0x0400.

I fixed this using

dd if=6502_functional_test.bin of=6502_functional_test.bin.padded bs=1 seek=10 

Any idea why this happens?

Trap in 65c02 functional test code

Hi, I have a problem with the 65c02 test code:Two uninitialized memory spaces are compared and this leads to a trap.

Should really the index register y be used? x is cleared jut before. But then a loop over y is programmed...

; testing load / store accumulator LDA / STA (zp)
.
.
.

        trap_ne
        cpx #$99
        trap_ne     ;x altered during test
        cpy #$66                                                              <= Here it is clear that y is #$66
        trap_ne     ;y altered during testorg
        ldx #0
tstai2  lda abst,y                                                           <= Here $0205 + $66 = $026B is read, which is uninitialized
        eor #$c3
        cmp abs1,y                                                           <= Here $0210 + $66 = $0276 is read, which is uninitialized
        trap_ne     ;store to indirect data                           <= Compare fails and trap occurred
        txa
        sta abst,y  ;clear
        dey
        bpl tstai2
        tsx
        cpx #$ff
        trap_ne     ;sp push/pop mismatch
        next_test

"Bootable ROM" extension

Hi Klaus,

I have just been writing a small 6502 simulator in Python3 for supporting my own FPGA developments, and found your very useful test suite. I have made a little modification in your asm code to be able to produce a complete ROM image with reset vector pointing to the start of the testing code. The reset vector is written back to point original "res_trap" vector, right after the start. This feature is useful when you start the testing code on a simple virtual microcomputer which has no other executable code apart from this testing suite -> after "powering on" this machine, the test code is started immediately by the reset mechanism.

If you find this extension usable, please feel free to lift it into your test code. Attached zip contains the complete modified asm.

Thank you for attention,
Zoltan

6502_functional_test.zip

Including a .bin file from your repo

Hi

This is not a ticket - but I haven't got your email address, so ;-)

I am one of countless others who are having fun implementing a 6502 simulator. I have included
one bin file from your repo (6502_functional_test.bin). How do you want me to credit you?

Best

Morten

65C02 TRB fails

Hi,

I'm adding 65C02 support to an emulator and currently stuck on the TRB tests for 65C02

It completes an op1 loop, but appears to fail when OP2/$0B = $01
As you can see, AND $0B does not set the Zero flag because A=1 and $0B = 1.

I should note that this emulator passes the 6502 Tests with no issues so I'm really confused as to what is going on here.

ZPG values at failure time:

0008-000F  00 00 01 01 00 00 01 81

Trace log:

1CC2  98        TYA           A:01 X:C0 Y:01 F:21 S:1FF [..-....C]
1CC3  25 0B     AND $0B       A:01 X:C0 Y:01 F:21 S:1FF [..-....C]
1CC5  08        PHP           A:01 X:C0 Y:01 F:21 S:1FE [..-....C]
1CC6  68        PLA           A:31 X:C0 Y:01 F:21 S:1FF [..-....C]
1CC7  29 02     AND #$02      A:00 X:C0 Y:01 F:23 S:1FF [..-...ZC]
1CC9  85 0C     STA $0C       A:00 X:C0 Y:01 F:23 S:1FF [..-...ZC]
1CCB  98        TYA           A:01 X:C0 Y:01 F:21 S:1FF [..-....C]
1CCC  49 FF     EOR #$FF      A:FE X:C0 Y:01 F:A1 S:1FF [N.-....C]
1CCE  05 0B     ORA $0B       A:FF X:C0 Y:01 F:A1 S:1FF [N.-....C]
1CD0  49 FF     EOR #$FF      A:00 X:C0 Y:01 F:23 S:1FF [..-...ZC]
1CD2  85 0D     STA $0D       A:00 X:C0 Y:01 F:23 S:1FF [..-...ZC]
1CD4  98        TYA           A:01 X:C0 Y:01 F:21 S:1FF [..-....C]
1CD5  05 0B     ORA $0B       A:01 X:C0 Y:01 F:21 S:1FF [..-....C]
1CD7  85 0E     STA $0E       A:01 X:C0 Y:01 F:21 S:1FF [..-....C]
1CD9  84 0A     STY $0A       A:01 X:C0 Y:01 F:21 S:1FF [..-....C]
1CDB  A9 FF     LDA #$FF      A:FF X:C0 Y:01 F:A1 S:1FF [N.-....C]
1CDD  48        PHA           A:FF X:C0 Y:01 F:A1 S:1FE [N.-....C]
1CDE  A5 0B     LDA $0B       A:01 X:C0 Y:01 F:21 S:1FE [..-....C]
1CE0  28        PLP           A:01 X:C0 Y:01 F:FF S:1FF [NV-BDIZC]
1CE1  14 0A     TRB $0A       A:01 X:C0 Y:01 F:FF S:1FF [NV-BDIZC]
1CE3  08        PHP           A:01 X:C0 Y:01 F:FF S:1FE [NV-BDIZC]
1CE4  C5 0B     CMP $0B       A:01 X:C0 Y:01 F:7F S:1FE [.V-BDIZC]
1CE6  D0 FE     BNE $FE       A:01 X:C0 Y:01 F:7F S:1FE [.V-BDIZC]
1CE8  68        PLA           A:FF X:C0 Y:01 F:FD S:1FF [NV-BDI.C]
1CE9  48        PHA           A:FF X:C0 Y:01 F:FD S:1FE [NV-BDI.C]
1CEA  09 02     ORA #$02      A:FF X:C0 Y:01 F:FD S:1FE [NV-BDI.C]
1CEC  C9 FF     CMP #$FF      A:FF X:C0 Y:01 F:7F S:1FE [.V-BDIZC]
1CEE  D0 FE     BNE $FE       A:FF X:C0 Y:01 F:7F S:1FE [.V-BDIZC]
1CF0  68        PLA           A:FF X:C0 Y:01 F:FD S:1FF [NV-BDI.C]
1CF1  29 02     AND #$02      A:02 X:C0 Y:01 F:7D S:1FF [.V-BDI.C]
1CF3  C5 0C     CMP $0C       A:02 X:C0 Y:01 F:7D S:1FF [.V-BDI.C]
1CF5  D0 FE     BNE $FE       A:02 X:C0 Y:01 F:7D S:1FF [.V-BDI.C]
1CF5  D0 FE     BNE $FE       A:02 X:C0 Y:01 F:7D S:1FF [.V-BDI.C]
1CF5  D0 FE     BNE $FE       A:02 X:C0 Y:01 F:7D S:1FF [.V-BDI.C]

missing bin files

Hello!
Could you add the missing bin file for the interrupt tests and the decimal tests?
(and seeing that the other tests got an update a few weeks ago, perhaps update the two other bin files with the recent changes?)
Thanks a lot!

Issue with the functional test (TSX, LDA $102,X)

I have a question about this portion of your functional test

37c3 : ba                       tsx             ;test break on stack
37c4 : bd0201                   lda $102,x
                                cmp_flag 0      ;break test should have B=1 & unused=1 on stack
37c7 : c930            >            cmp #(0      |fao)&m8    ;expected flags + always on bits

This is what I see in my emulator:

37C3: BA         TSX                   A=42 X=FB Y=48 S=FB P=B1 PC=$37C3 P={$B1 N=1 V=0 B=1 D=0 I=0 Z=0 C=1} SP={$FB stack:[$1FF:$09 $1FE:$CF $1FD:$00 $1FC:$30 ]}
37C4: BD 02 01   LDA $0102,X           A=00 X=FB Y=48 S=FB P=33 PC=$37C4 P={$33 N=0 V=0 B=1 D=0 I=0 Z=1 C=1} SP={$FB stack:[$1FF:$09 $1FE:$CF $1FD:$00 $1FC:$30 ]}
37C7: C9 30      CMP #$30              A=00 X=FB Y=48 S=FB P=B0 PC=$37C7 P={$B0 N=1 V=0 B=1 D=0 I=0 Z=0 C=0} SP={$FB stack:[$1FF:$09 $1FE:$CF $1FD:$00 $1FC:$30 ]}
37C7: D0 30      BNE $37C7             A=00 X=FB Y=48 S=FB P=B0 PC=$37C7 P={$B0 N=1 V=0 B=1 D=0 I=0 Z=0 C=0} SP={$FB stack:[$1FF:$09 $1FE:$CF $1FD:$00 $1FC:$30 ]}

As you can see, my stack contains the expected value (#$30), however, TSX followed by LDA $102,X points toward the next available spot of the stack, not the current value. So I get 0 and the test fails.

Am I missing something?

Version of binary examples differs from latest source release

First, thank you very much for this fantastic suite.
This is not really an issue, but I've noticed that the compiled examples belong to a previous version. The 6502 LST file states 2015 and the 65c02 LST file states 2017.
I've compiled myself the 6502 and I've obtained a different HEX/BIN and LST file.

Raul

BRK instruction not tested with interrupts disabled

The 6502 test checks the BRK instruction only with the interrupt disable flag off. The additional 65C02 test makes the humble assumption that the BRK instruction works in general and does not check if the BRK is actually executed.

I will add a second pass with I flag on to the test and repeat the full BRK test for the 65C02.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.