-#include "../../Gayle.h"
-#include "../../config_file/config_file.h"
+// SPDX-License-Identifier: MIT
-#define GAYLEBASE 0xD80000 // D7FFFF
-#define GAYLESIZE 0x6FFFF
-
-#define CLOCKBASE 0xDC0000
-#define CLOCKSIZE 0x010000
+#include "Gayle.h"
+#include "config_file/config_file.h"
+#include "amiga-registers.h"
uint8_t rtc_emulation_enabled = 1;
+extern uint8_t gayle_emulation_enabled;
void configure_rtc_emulation_amiga(uint8_t enabled) {
if (enabled == rtc_emulation_enabled)
}
int handle_register_read_amiga(unsigned int addr, unsigned char type, unsigned int *val) {
- if (!rtc_emulation_enabled && addr >= CLOCKBASE && addr < CLOCKBASE + CLOCKSIZE)
- return -1;
- if (addr >= GAYLEBASE && addr < GAYLEBASE + GAYLESIZE) {
- switch(type) {
- case OP_TYPE_BYTE:
- *val = readGayleB(addr);
- return 1;
- break;
- case OP_TYPE_WORD:
- *val = readGayle(addr);
- return 1;
- break;
- case OP_TYPE_LONGWORD:
- *val = readGayleL(addr);
- return 1;
- break;
- case OP_TYPE_MEM:
+ if (gayle_emulation_enabled) {
+ if (!rtc_emulation_enabled && addr >= CLOCKBASE && addr < CLOCKBASE + CLOCKSIZE)
return -1;
- break;
+ if (addr >= GAYLEBASE && addr < GAYLEBASE + GAYLESIZE) {
+ switch(type) {
+ case OP_TYPE_BYTE:
+ *val = readGayleB(addr);
+ return 1;
+ break;
+ case OP_TYPE_WORD:
+ *val = readGayle(addr);
+ return 1;
+ break;
+ case OP_TYPE_LONGWORD:
+ *val = readGayleL(addr);
+ return 1;
+ break;
+ case OP_TYPE_MEM:
+ return -1;
+ break;
+ }
}
}
return -1;
}
int handle_register_write_amiga(unsigned int addr, unsigned int value, unsigned char type) {
- if (!rtc_emulation_enabled && addr >= CLOCKBASE && addr < CLOCKBASE + CLOCKSIZE)
- return -1;
- if (addr >= GAYLEBASE && addr < GAYLEBASE + GAYLESIZE) {
- switch(type) {
- case OP_TYPE_BYTE:
- writeGayleB(addr, value);
- return 1;
- break;
- case OP_TYPE_WORD:
- writeGayle(addr, value);
- return 1;
- break;
- case OP_TYPE_LONGWORD:
- writeGayleL(addr, value);
- return 1;
- break;
- case OP_TYPE_MEM:
+ if (gayle_emulation_enabled) {
+ if (!rtc_emulation_enabled && addr >= CLOCKBASE && addr < CLOCKBASE + CLOCKSIZE)
return -1;
- break;
+ if (addr >= GAYLEBASE && addr < GAYLEBASE + GAYLESIZE) {
+ switch(type) {
+ case OP_TYPE_BYTE:
+ writeGayleB(addr, value);
+ return 1;
+ break;
+ case OP_TYPE_WORD:
+ writeGayle(addr, value);
+ return 1;
+ break;
+ case OP_TYPE_LONGWORD:
+ writeGayleL(addr, value);
+ return 1;
+ break;
+ case OP_TYPE_MEM:
+ return -1;
+ break;
+ }
}
}
return -1;