mirror of
https://github.com/andwati/mos-6502.git
synced 2026-10-18 03:02:51 +00:00
- Added `state.c` to handle saving and loading the state of the CPU and Bus. - Implemented CRC32 checksum for data integrity verification during state operations. - Enhanced `README.md` in tests/roms to document new test commands for decimal, interrupt, Apple I, and nestest. - Created new test files: `run_apple1.c`, `run_decimal.c`, `run_interrupt.c`, `run_nestest.c`, and `run_vectors.c` to validate the new features. - Updated `run_tests.c` to include tests for state saving/loading and other functionalities. - Introduced `test_vectors.py` to facilitate downloading and running JSON test vectors for opcode verification.
21 lines
930 B
C
21 lines
930 B
C
#include <stdio.h>
|
|
#include <string.h>
|
|
#include "apple1.h"
|
|
#include "cpu.h"
|
|
#include "loader.h"
|
|
|
|
int main(int argc,char **argv)
|
|
{
|
|
static const char command[]="FF00.FF07\r";size_t sent=0,loaded;Bus6502 bus;CPU6502 cpu;Apple1IO io;
|
|
if(argc!=2){fprintf(stderr,"usage: %s wozmon.bin\n",argv[0]);return 2;}
|
|
bus_init(&bus);apple1_init(&io,&bus);
|
|
if(load_binary(&bus,argv[1],0xFF00,&loaded)||loaded!=256)return 1;
|
|
cpu_reset(&cpu,&bus);
|
|
for(unsigned long i=0;i<2000000;i++){
|
|
if(!io.key_ready&&sent<sizeof(command)-1)apple1_key(&io,(uint8_t)command[sent++]);
|
|
if(cpu_step(&cpu,&bus).status!=CPU_STEP_OK){fprintf(stderr,"illegal instruction at $%04X\n",cpu.PC);return 1;}
|
|
if(strstr(io.output,"FF00: D8 58 A0 7F 8C 12 D0 A9")){printf("Apple I WozMon boot/PIA test passed after %lu instructions\n",i+1);return 0;}
|
|
}
|
|
fprintf(stderr,"Apple I output mismatch:\n%s\n",io.output);return 1;
|
|
}
|