verilator/ runs the core on the host with the shared FM-7 / Apple-IIgs sim framework: windowed (ImGui/SDL2) or --headless, typing on a frame schedule, screenshots, text-screen dump, 6809 disassembly trace, floppy/SDC/cart/cassette, and RS-232 Pak serial debugging (TXD decoder, RXD driver, pty bridge, ACIA trace) with a minimal DriveWire server and a script to run the real FujiNet daemon against the sim. See verilator/README.md. - The VHDL the build uses (ROMs, RAMs, font) is converted to Verilog in verilator/rtl/; the VHDL CPU is not instantiated (CoCo3_CYC_ACC_6809). - sdram2.sv is simulated with its own controller logic and an SDR chip model. - run_tests.sh: boot, keyboard, disk, WIDTH 80 and HSCREEN tests, judged on the text screen and byte-for-byte against test-ref/ screenshots. rtl/wd1793.sv: spt_addr and buff_wr are declared at module scope instead of inside generate blocks. They are assigned outside those blocks; Quartus accepted it, Verilator rejected spt_addr and silently split buff_wr into a separate net. No change on the FPGA (FM-7 made the same fix). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
64 lines
2.5 KiB
C++
64 lines
2.5 KiB
C++
//============================================================================
|
|
// dis6809 self-check. `make distest`
|
|
//
|
|
// Covers every addressing mode, both prefix pages, the register-list and
|
|
// register-pair postbytes, and an undefined opcode. Cheap insurance: a
|
|
// disassembler that is subtly wrong is worse than none, because it produces
|
|
// confident output you will act on.
|
|
//============================================================================
|
|
|
|
#include "dis6809.h"
|
|
#include <cstdio>
|
|
#include <cstring>
|
|
static unsigned char M[0x10000];
|
|
static int rd(uint16_t a){ return M[a]; }
|
|
struct T { const char* bytes; const char* want; };
|
|
static int put(uint16_t a, const char* hex){ int n=0; while(*hex){ unsigned v; sscanf(hex,"%2x",&v); M[a+n++]=v; hex+=2; if(*hex==' ')hex++; } return n; }
|
|
int main(){
|
|
T t[] = {
|
|
{"20 09", "BRA $100b"},
|
|
{"16 01 23", "LBRA $1126"},
|
|
{"86 fd", "LDA #$fd"},
|
|
{"10 ce fc 7f", "LDS #$fc7f"},
|
|
{"1f 8b", "TFR A,DP"},
|
|
{"1e 12", "EXG X,Y"},
|
|
{"34 76", "PSHS A,B,X,Y,U"},
|
|
{"35 ff", "PULS CC,A,B,DP,X,Y,U,PC"},
|
|
{"36 40", "PSHU S"},
|
|
{"d6 04", "LDB <$04"},
|
|
{"be fb fe", "LDX $fbfe"},
|
|
{"6e 84", "JMP ,X"},
|
|
{"a6 80", "LDA ,X+"},
|
|
{"a6 81", "LDA ,X++"},
|
|
{"a6 82", "LDA ,-X"},
|
|
{"a6 83", "LDA ,--X"},
|
|
{"a6 91", "LDA [,X++]"},
|
|
{"a6 a5", "LDA B,Y"},
|
|
{"a6 c6", "LDA A,U"},
|
|
{"a6 88 7f", "LDA $7f,X"},
|
|
{"a6 89 12 34", "LDA $1234,X"},
|
|
{"a6 9f 20 00", "LDA [$2000]"},
|
|
{"a6 8c 10", "LDA $10,PCR"},
|
|
{"a6 1f", "LDA -1,X"},
|
|
{"a6 05", "LDA 5,X"},
|
|
{"e7 41", "STB 1,U"},
|
|
{"10 8e 12 34", "LDY #$1234"},
|
|
{"11 83 00 01", "CMPU #$0001"},
|
|
{"11 3f", "SWI3"},
|
|
{"39", "RTS"},
|
|
{"3d", "MUL"},
|
|
{"87", "FCB $87"},
|
|
};
|
|
int fail=0;
|
|
for (auto& e : t) {
|
|
memset(M,0,sizeof(M));
|
|
int n = put(0x1000, e.bytes);
|
|
char out[80];
|
|
int len = dis6809(0x1000, rd, out, sizeof(out));
|
|
bool ok = !strcmp(out, e.want) && (len==n || (!strcmp(e.want,"FCB $87")));
|
|
if(!ok){ printf("FAIL %-16s got \"%s\" (len %d, expected %d) want \"%s\"\n", e.bytes,out,len,n,e.want); fail++; }
|
|
}
|
|
printf(fail? "%d FAILURES\n" : "all %d cases pass\n", fail?fail:(int)(sizeof(t)/sizeof(t[0])));
|
|
return fail!=0;
|
|
}
|