mirror of
https://github.com/rkujawa/rk65c02.git
synced 2024-09-28 04:57:28 +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:
parent
80b6848108
commit
2ec6cb67ae
@ -3,16 +3,17 @@ LDFLAGS=-latf-c
|
|||||||
RK6502LIB=../src/librk65c02.a
|
RK6502LIB=../src/librk65c02.a
|
||||||
VASM=vasm6502_std
|
VASM=vasm6502_std
|
||||||
VASMFLAGS=-Fbin -c02
|
VASMFLAGS=-Fbin -c02
|
||||||
|
UTILS=utils.o
|
||||||
|
|
||||||
TESTS=test_bus test_emulation
|
TESTS=test_bus test_emulation
|
||||||
TESTROMS:=$(addsuffix .rom,$(basename $(wildcard *.s)))
|
TESTROMS:=$(addsuffix .rom,$(basename $(wildcard *.s)))
|
||||||
|
|
||||||
all : $(TESTS) $(TESTROMS)
|
all : $(TESTS) $(TESTROMS)
|
||||||
|
|
||||||
test_bus : test_bus.o $(RK6502LIB)
|
test_bus : test_bus.o $(UTILS) $(RK6502LIB)
|
||||||
$(CC) -o $@ $(LDFLAGS) $< $(RK6502LIB)
|
$(CC) -o $@ $(LDFLAGS) $< $(RK6502LIB)
|
||||||
|
|
||||||
test_emulation : test_emulation.o $(RK6502LIB)
|
test_emulation : test_emulation.o $(UTILS) $(RK6502LIB)
|
||||||
$(CC) -o $@ $(LDFLAGS) $< $(RK6502LIB)
|
$(CC) -o $@ $(LDFLAGS) $< $(RK6502LIB)
|
||||||
|
|
||||||
%.rom : %.s
|
%.rom : %.s
|
||||||
|
@ -6,21 +6,7 @@
|
|||||||
|
|
||||||
#include "bus.h"
|
#include "bus.h"
|
||||||
#include "rk65c02.h"
|
#include "rk65c02.h"
|
||||||
|
#include "utils.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;
|
|
||||||
}
|
|
||||||
|
|
||||||
ATF_TC_WITHOUT_HEAD(emul_bit);
|
ATF_TC_WITHOUT_HEAD(emul_bit);
|
||||||
ATF_TC_BODY(emul_bit, tc)
|
ATF_TC_BODY(emul_bit, tc)
|
||||||
|
16
test/utils.c
Normal file
16
test/utils.c
Normal 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
7
test/utils.h
Normal 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_ */
|
Loading…
Reference in New Issue
Block a user