1
0
mirror of https://github.com/rkujawa/rk65c02.git synced 2024-12-04 04:51:27 +00:00

Add test for stepping mode.

This commit is contained in:
Radosław Kujawa 2017-01-26 23:22:40 +01:00
parent 1da576c821
commit bfb042cd1a
3 changed files with 45 additions and 1 deletions

View File

@ -5,11 +5,14 @@ VASM=vasm6502_std
VASMFLAGS=-Fbin -c02
UTILS=utils.o
TESTS=test_bus test_emulation
TESTS=test_bus test_emulation test_stepping
TESTROMS:=$(addsuffix .rom,$(basename $(wildcard *.s)))
all : $(TESTS) $(TESTROMS)
test_stepping : test_step.o $(UTILS) $(RK6502LIB)
$(CC) -o $@ $(LDFLAGS) $< $(RK6502LIB)
test_bus : test_bus.o $(UTILS) $(RK6502LIB)
$(CC) -o $@ $(LDFLAGS) $< $(RK6502LIB)

36
test/test_stepping.c Normal file
View File

@ -0,0 +1,36 @@
#include <atf-c.h>
#include <stdio.h>
#include "bus.h"
#include "rk65c02.h"
#include "utils.h"
ATF_TC_WITHOUT_HEAD(step1);
ATF_TC_BODY(step1, tc)
{
rk65c02emu_t e;
bus_t b;
b = bus_init();
e = rk65c02_init(&b);
e->regs.PC = ROM_LOAD_ADDR;
ATF_REQUIRE(bus_load_file(e->bus, ROM_LOAD_ADDR,
"test_stepping_step1.rom"));
rk65c02_step(e, 1);
ATF_CHECK(e->regs.PC == ROM_LOAD_ADDR+1);
rk65c02_step(e, 1);
ATF_CHECK(e->regs.PC == ROM_LOAD_ADDR+2);
}
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, step1);
return (atf_no_error());
}

View File

@ -0,0 +1,5 @@
start: nop
nop
nop
stp