mirror of
https://github.com/captain-amygdala/pistorm.git
synced 2026-05-01 22:06:41 +00:00
Add setvar to Amiga platform for RTC and HDD0 image configuration
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
#include "../platforms.h"
|
||||
#include "amiga-autoconf.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "../platforms.h"
|
||||
#include "amiga-autoconf.h"
|
||||
#include "amiga-registers.h"
|
||||
|
||||
int handle_register_read_amiga(unsigned int addr, unsigned char type, unsigned int *val);
|
||||
int handle_register_write_amiga(unsigned int addr, unsigned int value, unsigned char type);
|
||||
@@ -165,7 +166,24 @@ int setup_platform_amiga(struct emulator_config *cfg) {
|
||||
}
|
||||
|
||||
void setvar_amiga(char *var, char *val) {
|
||||
if (var || val) {}
|
||||
if (!var)
|
||||
return;
|
||||
|
||||
if (strcmp(var, "enable_rtc_emulation") == 0) {
|
||||
int8_t rtc_enabled = 0;
|
||||
if (!val || strlen(val) == 0)
|
||||
rtc_enabled = 1;
|
||||
else {
|
||||
rtc_enabled = get_int(val);
|
||||
}
|
||||
if (rtc_enabled != -1) {
|
||||
configure_rtc_emulation_amiga(rtc_enabled);
|
||||
}
|
||||
}
|
||||
if (strcmp(var, "hdd0") == 0) {
|
||||
if (val && strlen(val) != 0)
|
||||
set_hard_drive_image_file_amiga(0, val);
|
||||
}
|
||||
}
|
||||
|
||||
void create_platform_amiga(struct platform_config *cfg, char *subsys) {
|
||||
|
||||
@@ -4,8 +4,23 @@
|
||||
#define GAYLEBASE 0xD80000 // D7FFFF
|
||||
#define GAYLESIZE 0x6FFFF
|
||||
|
||||
#define CLOCKBASE 0xDC0000
|
||||
#define CLOCKSIZE 0x010000
|
||||
|
||||
uint8_t rtc_emulation_enabled = 1;
|
||||
|
||||
void configure_rtc_emulation_amiga(uint8_t enabled) {
|
||||
if (enabled == rtc_emulation_enabled)
|
||||
return;
|
||||
|
||||
rtc_emulation_enabled = enabled;
|
||||
printf("Amiga RTC emulation is now %s.\n", (enabled) ? "enabled" : "disabled");
|
||||
}
|
||||
|
||||
int handle_register_read_amiga(unsigned int addr, unsigned char type, unsigned int *val) {
|
||||
if (addr > GAYLEBASE && addr < GAYLEBASE + GAYLESIZE) {
|
||||
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);
|
||||
@@ -28,7 +43,9 @@ int handle_register_read_amiga(unsigned int addr, unsigned char type, unsigned i
|
||||
}
|
||||
|
||||
int handle_register_write_amiga(unsigned int addr, unsigned int value, unsigned char type) {
|
||||
if (addr > GAYLEBASE && addr < GAYLEBASE + GAYLESIZE) {
|
||||
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);
|
||||
|
||||
2
platforms/amiga/amiga-registers.h
Normal file
2
platforms/amiga/amiga-registers.h
Normal file
@@ -0,0 +1,2 @@
|
||||
void configure_rtc_emulation_amiga(uint8_t enabled);
|
||||
void set_hard_drive_image_file_amiga(uint8_t index, char *filename);
|
||||
Reference in New Issue
Block a user