1
0
mirror of https://github.com/rkujawa/rk65c02.git synced 2024-06-15 20:29:32 +00:00

Split ROM starting function into separate file.

It will also be used for other test programs than test_emulation.
This commit is contained in:
Radosław Kujawa 2017-01-26 13:11:37 +01:00
parent 80b6848108
commit 2ec6cb67ae
4 changed files with 27 additions and 17 deletions

View File

@ -3,16 +3,17 @@ LDFLAGS=-latf-c
RK6502LIB=../src/librk65c02.a
VASM=vasm6502_std
VASMFLAGS=-Fbin -c02
UTILS=utils.o
TESTS=test_bus test_emulation
TESTROMS:=$(addsuffix .rom,$(basename $(wildcard *.s)))
all : $(TESTS) $(TESTROMS)
test_bus : test_bus.o $(RK6502LIB)
test_bus : test_bus.o $(UTILS) $(RK6502LIB)
$(CC) -o $@ $(LDFLAGS) $< $(RK6502LIB)
test_emulation : test_emulation.o $(RK6502LIB)
test_emulation : test_emulation.o $(UTILS) $(RK6502LIB)
$(CC) -o $@ $(LDFLAGS) $< $(RK6502LIB)
%.rom : %.s

View File

@ -6,21 +6,7 @@
#include "bus.h"
#include "rk65c02.h"
#define ROM_LOAD_ADDR 0xC000
bool rom_start(rk65c02emu_t *, const char *);
bool
rom_start(rk65c02emu_t *e, const char *name)
{
e->regs.PC = ROM_LOAD_ADDR;
if(!bus_load_file(e->bus, ROM_LOAD_ADDR, name))
return false;
rk65c02_start(e);
return true;
}
#include "utils.h"
ATF_TC_WITHOUT_HEAD(emul_bit);
ATF_TC_BODY(emul_bit, tc)

16
test/utils.c Normal file
View File

@ -0,0 +1,16 @@
#include "bus.h"
#include "rk65c02.h"
#include "utils.h"
bool
rom_start(rk65c02emu_t *e, const char *name)
{
e->regs.PC = ROM_LOAD_ADDR;
if(!bus_load_file(e->bus, ROM_LOAD_ADDR, name))
return false;
rk65c02_start(e);
return true;
}

7
test/utils.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef _UTILS_H_
#define _UTILS_H_
#define ROM_LOAD_ADDR 0xC000
bool rom_start(rk65c02emu_t *, const char *);
#endif /* _UTILS_H_ */