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:
parent
1da576c821
commit
bfb042cd1a
@ -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
36
test/test_stepping.c
Normal 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());
|
||||
|
||||
}
|
||||
|
5
test/test_stepping_step1.s
Normal file
5
test/test_stepping_step1.s
Normal file
@ -0,0 +1,5 @@
|
||||
start: nop
|
||||
nop
|
||||
nop
|
||||
stp
|
||||
|
Loading…
Reference in New Issue
Block a user