sorenroug/osnine-java

FYI: test structure

Closed this issue · 1 comments

gtoal commented

The cpu tests are currently structured for executing on a 6809 itself - but that is the only method of execution, if you want to test under emulation, you have to emulate a system that supports these C programs with a runtime library etc and run the entire program as if it were running on a 6809 with console output. However what is often wanted it to test a bare emulator independent of target architecture (or the emulator is for an embedded system with no text I/O, such as the Vectrex). The code as it stands is not capable of doing this, for several reasons. For example there are several places where the byte order within a word assumes IBM/Motorola ordering, so the current C code could not run on systems with DEC/Intel ordering.

I've started a restructuring of the code where an emulator running on a host system can execute 6809 code that is stored in array memory[] which is the common interface between the host and the virtual machine - no other variables can communicate between the two systems. At the moment it supports a binary translation rather than a true emulation, but the major changes needed are the same for both. The program runs primarily on the host and it calls the interpreter to execute only the code fragments in the memory[] array.

Handling this with a static binary translator is actually a bit trickier than just an emulator would have been as the tests have to generate C code, compile it, and link it in and execute it. To avoid OS-specific hassles with dynamic loading, this has turned the process into a 2-pass compilation, which is easiest to handle by just running the code and typing make twice.

So this isn't really ready for release or a fork but I thought you might be interested in seeing the direction I'm taking it and and may have some advice or requests.

gtoal.com/SBTPROJECT/6809sbt/sorenroug-cpu-tests/

regards,

Graham

I appreciate that you can use the CPU tests, but they were actually designed to only run on real hardware. My 6809 emulator is written in Java and I have about 70% coverage of the CPU instructions in the test folder. Occasionally I need to check what a real 6809 would do and I wrote the cputests for this purpose. My 6809 hardware runs OS-9 and I had a few choices of languages: Assembler, C, Pascal or Basic09. I wrote them in C. They are compiled and executed under OS-9. This is also the reason the code is pre ansi-C. The compiler is from 1982.