summaryrefslogtreecommitdiff
path: root/z80_util.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2019-02-03 11:05:40 -0800
committerMichael Pavone <pavone@retrodev.com>2019-02-03 11:05:40 -0800
commitd69482b7a3e0a3af3558f37a8a4fbd294308571b (patch)
treea9575d5f664c94e3b3b7154c0a0ac69b8c97ffca /z80_util.c
parent822f91d0a3dd99351d881868f780058949099ffe (diff)
Get new Z80 core running in CPM harness
Diffstat (limited to 'z80_util.c')
-rw-r--r--z80_util.c26
1 files changed, 26 insertions, 0 deletions
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