Rework some emulator stuff, update sample X68000 config for OVL

This commit is contained in:
beeanyew
2020-12-03 15:05:10 +01:00
parent 2f8f943e2a
commit b613f2e9a9
4 changed files with 32 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
# Sets CPU type. Valid types are (probably) 68000, 68010, 68020, 68EC020, 68030, 68EC030, 68040, 68EC040, 68LC040 and some STTTT thing.
cpu 68EC030
cpu 68020
# Map 512KB kickstart ROM to default offset.
map type=rom address=0xF80000 size=0x80000 file=kick512.rom ovl=0
# This is for mapping a 256KB kickstart ROM. I can probably add some additional thing about kicking this file into low/high area.
@@ -8,6 +8,7 @@ map type=rom address=0xF80000 size=0x80000 file=kick512.rom ovl=0
#map type=rom address=0xF00000 size=0x90000 file=cdtv.rom
# Map 256MB of Fast RAM at 0x8000000.
map type=ram address=0x08000000 size=128M
map type=ram address=0x0 size=2M
# Map Gayle as a register range.
map type=register address=0xD80000 size=0x70000
# Number of instructions to run every main loop.

View File

@@ -170,12 +170,10 @@ static volatile unsigned char ovl;
static volatile unsigned char maprom;
void sigint_handler(int sig_num) {
printf("\n Exit Ctrl+C %d\n", sig_num);
if (mouse_fd != -1)
close(mouse_fd);
if (mem_fd)
close(mem_fd);
exit(0);
if (sig_num) { }
cpu_emulation_running = 0;
return;
}
void *iplThread(void *args) {
@@ -413,6 +411,15 @@ int main(int argc, char *argv[]) {
cpu_emulation_running ^= 1;
printf("CPU emulation is now %s\n", cpu_emulation_running ? "running" : "stopped");
}
if (c == 'R') {
cpu_pulse_reset();
m68k_pulse_reset();
printf("CPU emulation reset.\n");
}
if (c == 'q') {
printf("Quitting and exiting emulator.\n");
goto stop_cpu_emulation;
}
}
/*
if (toggle == 1){
@@ -425,19 +432,27 @@ int main(int argc, char *argv[]) {
*/
if (GET_GPIO(1) == 0){
if (GET_GPIO(1) == 0) {
srdata = read_reg();
m68k_set_irq((srdata >> 13) & 0xff);
} else {
if (CheckIrq() == 1){
if (CheckIrq() == 1) {
write16(0xdff09c, 0x8008);
m68k_set_irq(2);}
m68k_set_irq(2);
}
else
m68k_set_irq(0);
};
}
stop_cpu_emulation:;
if (mouse_fd != -1)
close(mouse_fd);
if (mem_fd)
close(mem_fd);
return 0;
}

View File

@@ -1,4 +1,5 @@
#include "config_file/config_file.h"
#include "m68k.h"
#include "Gayle.h"
#include <endian.h>
@@ -51,7 +52,7 @@ int handle_mapped_read(struct emulator_config *cfg, unsigned int addr, unsigned
return -1;
}
else if (read_addr) {
//printf("Read %s from %s (%.8X) (%d)\n", op_type_names[type], map_type_names[cfg->map_type[i]], addr, mirror);
//printf("[PC: %.8X] Read %s from %s (%.8X) (%d)\n", m68k_get_reg(NULL, M68K_REG_PC), op_type_names[type], map_type_names[cfg->map_type[i]], addr, mirror);
//printf("Readaddr: %.8lX (Base %.8lX\n", (uint64_t)(read_addr), (uint64_t)cfg->map_data[i]);
switch(type) {
case OP_TYPE_BYTE:
@@ -84,15 +85,14 @@ int handle_mapped_write(struct emulator_config *cfg, unsigned int addr, unsigned
char handle_regs = 0;
//printf("Mapped write: %.8x\n", addr);
if (mirror) { }
for (int i = 0; i < MAX_NUM_MAPPED_ITEMS; i++) {
if (cfg->map_type[i] == MAPTYPE_NONE)
continue;
switch(cfg->map_type[i]) {
case MAPTYPE_ROM:
if (cfg->map_mirror[i] != -1 && mirror && CHKRANGE(addr, cfg->map_mirror[i], cfg->map_size[i]))
return -1;
else if (CHKRANGE(addr, cfg->map_offset[i], cfg->map_size[i]))
if (CHKRANGE(addr, cfg->map_offset[i], cfg->map_size[i]))
return 1;
break;
case MAPTYPE_RAM:
@@ -112,7 +112,7 @@ int handle_mapped_write(struct emulator_config *cfg, unsigned int addr, unsigned
return handle_register_write(addr, value, type);
}
else if (write_addr) {
//printf("Write %s to %s (%.8X) (%d)\n", op_type_names[type], map_type_names[cfg->map_type[i]], addr, mirror);
//printf("[PC: %.8X] Write %s to %s (%.8X) (%d)\n", m68k_get_reg(NULL, M68K_REG_PC), op_type_names[type], map_type_names[cfg->map_type[i]], addr, mirror);
//printf("Writeaddr: %.8lX (Base %.8lX\n", (uint64_t)(write_addr), (uint64_t)cfg->map_data[i]);
switch(type) {
case OP_TYPE_BYTE:

View File

@@ -4,7 +4,7 @@ cpu 68000
# Various ROM locations
#map type=rom address=0xF00000 file=cgrom
#map type=rom address=0xFC0000 file=scsiin
#map type=rom address=0xFE0000 file=ipl
#map type=rom address=0xFE0000 file=ipl ovl=0
# 10MB of expanded RAM, for machines with 2MB internal.
map type=ram address=2M size=10M