comparison jcart.c @ 2499:d74d3998482c

Make some progress on compiling full emulator with new 68K core
author Michael Pavone <pavone@retrodev.com>
date Tue, 30 Apr 2024 00:02:14 -0700
parents 395f684c5379
children
comparison
equal deleted inserted replaced
2498:dffda054d218 2499:d74d3998482c
21 void *jcart_write_w(uint32_t address, void *context, uint16_t value) 21 void *jcart_write_w(uint32_t address, void *context, uint16_t value)
22 { 22 {
23 m68k_context *m68k= context; 23 m68k_context *m68k= context;
24 io_port *ports = get_ports(m68k); 24 io_port *ports = get_ports(m68k);
25 value = value << 6 & 0x40; 25 value = value << 6 & 0x40;
26 io_data_write(ports, value, m68k->current_cycle); 26 io_data_write(ports, value, m68k->cycles);
27 io_data_write(ports + 1, value, m68k->current_cycle); 27 io_data_write(ports + 1, value, m68k->cycles);
28 return context; 28 return context;
29 } 29 }
30 30
31 void *jcart_write_b(uint32_t address, void *context, uint8_t value) 31 void *jcart_write_b(uint32_t address, void *context, uint8_t value)
32 { 32 {
40 { 40 {
41 m68k_context *m68k= context; 41 m68k_context *m68k= context;
42 io_port *ports = get_ports(m68k); 42 io_port *ports = get_ports(m68k);
43 //according to Eke, bit 14 is forced low, at least on the Micro Machines 2 cart 43 //according to Eke, bit 14 is forced low, at least on the Micro Machines 2 cart
44 //TODO: Test behavior of actual cart 44 //TODO: Test behavior of actual cart
45 uint16_t value = io_data_read(ports, m68k->current_cycle) << 8; 45 uint16_t value = io_data_read(ports, m68k->cycles) << 8;
46 value |= io_data_read(ports + 1, m68k->current_cycle); 46 value |= io_data_read(ports + 1, m68k->cycles);
47 return value; 47 return value;
48 } 48 }
49 49
50 uint8_t jcart_read_b(uint32_t address, void *context) 50 uint8_t jcart_read_b(uint32_t address, void *context)
51 { 51 {
52 m68k_context *m68k= context; 52 m68k_context *m68k= context;
53 io_port *ports = get_ports(m68k); 53 io_port *ports = get_ports(m68k);
54 return io_data_read(ports + (address & 1), m68k->current_cycle); 54 return io_data_read(ports + (address & 1), m68k->cycles);
55 } 55 }
56 56
57 void jcart_adjust_cycles(genesis_context *context, uint32_t deduction) 57 void jcart_adjust_cycles(genesis_context *context, uint32_t deduction)
58 { 58 {
59 io_port *ports = get_ports(context->m68k); 59 io_port *ports = get_ports(context->m68k);
60 io_adjust_cycles(ports, context->m68k->current_cycle, deduction); 60 io_adjust_cycles(ports, context->m68k->cycles, deduction);
61 io_adjust_cycles(ports + 1, context->m68k->current_cycle, deduction); 61 io_adjust_cycles(ports + 1, context->m68k->cycles, deduction);
62 } 62 }
63 63
64 void jcart_gamepad_down(genesis_context *context, uint8_t gamepad_num, uint8_t button) 64 void jcart_gamepad_down(genesis_context *context, uint8_t gamepad_num, uint8_t button)
65 { 65 {
66 io_port *ports = get_ports(context->m68k); 66 io_port *ports = get_ports(context->m68k);