-static inline int32_t platform_read_check(uint8_t type, uint32_t addr, uint32_t *res) {
- switch (addr) {
- case CIAAPRA:
- if (mouse_hook_enabled && (mouse_buttons & 0x01)) {
- rres = (uint32_t)ps_read(type, addr);
- *res = (rres ^ 0x40);
- return 1;
- }
- return 0;
- break;
- case CIAAICR:
- if (kb_hook_enabled) {
- rres = (uint32_t)ps_read(type, addr);
- if (get_num_kb_queued() && (!send_keypress || send_keypress == 1)) {
- rres |= 0x08;
- if (!send_keypress)
- send_keypress = 1;
- }
- if (send_keypress == 2) {
- send_keypress = 0;
- }
- *res = rres;
- return 1;
- }
- return 0;
- break;
- case CIAADAT:
- if (kb_hook_enabled) {
- rres = (uint32_t)ps_read(type, addr);
- uint8_t c = 0, t = 0;
- pop_queued_key(&c, &t);
- t ^= 0x01;
- rres = ((c << 1) | t) ^ 0xFF;
- send_keypress = 2;
- *res = rres;
- return 1;
- }
- return 0;
- break;
- case JOY0DAT:
- if (mouse_hook_enabled) {
- unsigned short result = (mouse_dy << 8) | (mouse_dx);
- *res = (unsigned int)result;
- return 1;
- }
- return 0;
- break;
- case POTGOR:
- if (mouse_hook_enabled) {
- unsigned short result = (unsigned short)ps_read(type, addr);
- // bit 1 rmb, bit 2 mmb
- if (mouse_buttons & 0x06) {
- *res = (unsigned int)((result ^ ((mouse_buttons & 0x02) << 9)) // move rmb to bit 10
- & (result ^ ((mouse_buttons & 0x04) << 6))); // move mmb to bit 8
- return 1;
- }
- *res = (unsigned int)(result & 0xfffd);
- return 1;
- }
- return 0;
- break;
- default:
- break;
+static inline void ps_write(uint8_t type, uint32_t addr, uint32_t val) {
+ switch (type) {
+ case OP_TYPE_BYTE:
+ inline_write_8(addr, val);
+ return;
+ case OP_TYPE_WORD:
+ inline_write_16(addr, val);
+ return;
+ case OP_TYPE_LONGWORD:
+ inline_write_32(addr, val);
+ return;