From d69482b7a3e0a3af3558f37a8a4fbd294308571b Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Sun, 3 Feb 2019 11:05:40 -0800 Subject: Get new Z80 core running in CPM harness --- z80_util.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'z80_util.c') diff --git a/z80_util.c b/z80_util.c index 6a4a556..39526aa 100644 --- a/z80_util.c +++ b/z80_util.c @@ -13,8 +13,34 @@ void z80_write_8(z80_context *context) void z80_io_read8(z80_context *context) { + uint32_t tmp_mask = context->opts->gen.address_mask; + memmap_chunk const *tmp_map = context->opts->gen.memmap; + uint32_t tmp_chunks = context->opts->gen.memmap_chunks; + + context->opts->gen.address_mask = context->io_mask; + context->opts->gen.memmap = context->io_map; + context->opts->gen.memmap_chunks = context->io_chunks; + + context->scratch1 = read_byte(context->scratch1, NULL, &context->opts->gen, context); + + context->opts->gen.address_mask = tmp_mask; + context->opts->gen.memmap = tmp_map; + context->opts->gen.memmap_chunks = tmp_chunks; } void z80_io_write8(z80_context *context) { + uint32_t tmp_mask = context->opts->gen.address_mask; + memmap_chunk const *tmp_map = context->opts->gen.memmap; + uint32_t tmp_chunks = context->opts->gen.memmap_chunks; + + context->opts->gen.address_mask = context->io_mask; + context->opts->gen.memmap = context->io_map; + context->opts->gen.memmap_chunks = context->io_chunks; + + write_byte(context->scratch2, context->scratch1, NULL, &context->opts->gen, context); + + context->opts->gen.address_mask = tmp_mask; + context->opts->gen.memmap = tmp_map; + context->opts->gen.memmap_chunks = tmp_chunks; } \ No newline at end of file -- cgit v1.2.3