diff options
author | Michael Pavone <pavone@retrodev.com> | 2019-02-07 09:43:25 -0800 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2019-02-07 09:43:25 -0800 |
commit | 201639b58bf8b6c3ebbed8c33778c9c9c0a691ce (patch) | |
tree | f9a20e3d951f5b73f6c7d96d0092ed8848c1a702 /z80_util.c | |
parent | e32a04deadb4f861efc34ffcd24ac405511bec47 (diff) |
Added init functions to z80_util.c so new Z80 core is closer to a drop in replacement for the old one
Diffstat (limited to 'z80_util.c')
-rw-r--r-- | z80_util.c | 30 |
1 files changed, 29 insertions, 1 deletions
@@ -1,3 +1,4 @@ +#include <string.h> void z80_read_8(z80_context *context) { @@ -43,4 +44,31 @@ void z80_io_write8(z80_context *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 +} + +//quick hack until I get a chance to change which init method these get passed to +static memmap_chunk const * tmp_io_chunks; +static uint32_t tmp_num_io_chunks, tmp_io_mask; +void init_z80_opts(z80_options * options, memmap_chunk const * chunks, uint32_t num_chunks, memmap_chunk const * io_chunks, uint32_t num_io_chunks, uint32_t clock_divider, uint32_t io_address_mask) +{ + memset(options, 0, sizeof(*options)); + options->gen.memmap = chunks; + options->gen.memmap_chunks = num_chunks; + options->gen.address_mask = 0xFFFF; + options->gen.max_address = 0xFFFF; + options->gen.clock_divider = clock_divider; + tmp_io_chunks = io_chunks; + tmp_num_io_chunks = num_io_chunks; + tmp_io_mask = io_address_mask; +} + +z80_context * init_z80_context(z80_options *options) +{ + z80_context *context = calloc(1, sizeof(z80_context)); + context->opts = options; + context->io_map = (memmap_chunk *)tmp_io_chunks; + context->io_chunks = tmp_num_io_chunks; + context->io_mask = tmp_io_mask; + return context; +} + |