Mercurial > repos > blastem
comparison m68k_util.c @ 2577:5f725429d08f
WIP changes to new CPU core for rotate instructions and to get interrupts more functional
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 07 Feb 2025 08:57:24 -0800 |
parents | d44fe974fb85 |
children | 939b818df589 |
comparison
equal
deleted
inserted
replaced
2576:c9bfed9156dc | 2577:5f725429d08f |
---|---|
24 write_word(context->scratch2, context->scratch1, context->mem_pointers, &context->opts->gen, context); | 24 write_word(context->scratch2, context->scratch1, context->mem_pointers, &context->opts->gen, context); |
25 } | 25 } |
26 | 26 |
27 void m68k_sync_cycle(m68k_context *context, uint32_t target_cycle) | 27 void m68k_sync_cycle(m68k_context *context, uint32_t target_cycle) |
28 { | 28 { |
29 //TODO: interrupt stuff | 29 context->sync_cycle = target_cycle; //why? |
30 context->sync_cycle = target_cycle; | 30 context->sync_components(context, 0); |
31 } | 31 } |
32 | 32 |
33 void init_m68k_opts(m68k_options *opts, memmap_chunk * memmap, uint32_t num_chunks, uint32_t clock_divider, sync_fun sync_components, int_ack_fun int_ack) | 33 static sync_fun *sync_comp_tmp; |
34 static int_ack_fun int_ack_tmp; | |
35 void init_m68k_opts(m68k_options *opts, memmap_chunk * memmap, uint32_t num_chunks, uint32_t clock_divider, sync_fun *sync_components, int_ack_fun int_ack) | |
34 { | 36 { |
35 memset(opts, 0, sizeof(*opts)); | 37 memset(opts, 0, sizeof(*opts)); |
36 opts->gen.memmap = memmap; | 38 opts->gen.memmap = memmap; |
37 opts->gen.memmap_chunks = num_chunks; | 39 opts->gen.memmap_chunks = num_chunks; |
38 opts->gen.address_mask = 0xFFFFFF; | 40 opts->gen.address_mask = 0xFFFFFF; |
39 opts->gen.byte_swap = 1; | 41 opts->gen.byte_swap = 1; |
40 opts->gen.max_address = 0x1000000; | 42 opts->gen.max_address = 0x1000000; |
41 opts->gen.bus_cycles = 4; | 43 opts->gen.bus_cycles = 4; |
42 opts->gen.clock_divider = clock_divider; | 44 opts->gen.clock_divider = clock_divider; |
45 sync_comp_tmp = sync_components; | |
46 int_ack_tmp = int_ack; | |
43 } | 47 } |
44 | 48 |
45 m68k_context *init_68k_context(m68k_options * opts, m68k_reset_handler reset_handler) | 49 m68k_context *init_68k_context(m68k_options * opts, m68k_reset_handler *reset_handler) |
46 { | 50 { |
47 m68k_context *context = calloc(1, sizeof(m68k_context)); | 51 m68k_context *context = calloc(1, sizeof(m68k_context)); |
48 context->opts = opts; | 52 context->opts = opts; |
49 context->reset_handler = reset_handler; | 53 context->reset_handler = reset_handler; |
50 context->int_cycle = 0xFFFFFFFFU; | 54 context->int_cycle = 0xFFFFFFFFU; |
55 context->sync_components = sync_comp_tmp; | |
56 sync_comp_tmp = NULL; | |
57 context->int_ack_handler = int_ack_tmp; | |
58 int_ack_tmp = NULL; | |
51 return context; | 59 return context; |
52 } | 60 } |
53 | 61 |
54 void m68k_reset(m68k_context *context) | 62 void m68k_reset(m68k_context *context) |
55 { | 63 { |