Skip to content

Commit

Permalink
Merge pull request #213 from rjpontefract/rp/68000_memory
Browse files Browse the repository at this point in the history
CiscOS memory map changes
  • Loading branch information
SteveFosdick authored Oct 21, 2023
2 parents 2c3bdbd + 4dbf13d commit ac1baae
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 32 deletions.
59 changes: 29 additions & 30 deletions src/mc68000tube.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

#include "b-em.h"
#include "cpu_debug.h"
#include "tube.h"
Expand All @@ -21,23 +22,22 @@ static uint8_t readmem(uint32_t addr)
return data;
}
}
if (addr < MC68000_RAM_SIZE) {
uint8_t data = mc68000_ram[addr];
//log_debug("mc68000: read %08X as RAM -> %02X", addr, data);
uint32_t top = addr & 0xFFFF0000;
if (top == 0xFFFF0000) {
uint8_t data = mc68000_rom[addr & 0x7FFF];
//log_debug("mc68000: read %08X as high ROM -> %02X", addr, data);
return data;
}
else {
uint32_t top = addr & 0xFFFF0000;
if (top == 0xFFFF0000) {
uint8_t data = mc68000_rom[addr & 0x7FFF];
//log_debug("mc68000: read %08X as high ROM -> %02X", addr, data);
return data;
}
else if (top == 0xFFFE0000) {
uint8_t data = tube_parasite_read(addr);
//log_debug("mc68000: read %08X as I/O -> %02X (%d cycles left)", addr, data, m68k_cycles_remaining());
return data;
}
else if (top == 0xFFFE0000) {
uint8_t data = tube_parasite_read(addr);
//log_debug("mc68000: read %08X as I/O -> %02X (%d cycles left)", addr, data, m68k_cycles_remaining());
return data;
}
else
{
uint8_t data = mc68000_ram[addr % MC68000_RAM_SIZE];
log_debug("mc68000: read %08X as RAM -> %02X", addr, data);
return data;
}
log_debug("mc68000: read %08X unmapped", addr);
return 0xff;
Expand Down Expand Up @@ -84,21 +84,20 @@ unsigned int m68k_read_disassembler_32 (unsigned int address)

static void writemem(uint32_t addr, uint8_t data)
{
if (addr < MC68000_RAM_SIZE) {
//log_debug("mc68000: write %08X as RAM <- %02X", addr, data);
mc68000_ram[addr] = data;
}
else {
uint32_t top = addr & 0xFFFF0000;
if (top == 0xfffe0000) {
//log_debug("mc68000: write %09X as I/O <- %02X", addr, data);
tube_parasite_write(addr, data);
}
else if (top == 0xffff0000)
log_debug("mc68000: write %08X as ROM (ignored) <- %02X", addr, data);
else
log_debug("mc68000: write %08X as unmapped (ignored) <- %02X", addr, data);
}
uint32_t top = addr & 0xFFFF0000;
if (top == 0xFFFE0000) {
//log_debug("mc68000: write %09X as I/O <- %02X", addr, data);
tube_parasite_write(addr, data);
}
else if (top == 0xFFFF0000)
{
log_debug("mc68000: write %08X as ROM (ignored) <- %02X", addr, data);
}
else
{
log_debug("mc68000: write %08X as RAM <- %02X", addr, data);
mc68000_ram[addr % MC68000_RAM_SIZE] = data;
}
}

void m68k_write_memory_8(unsigned int address, unsigned int value)
Expand Down
2 changes: 1 addition & 1 deletion src/mc68000tube.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <stdbool.h>

#define MC68000_RAM_SIZE 0x3F0000
#define MC68000_RAM_SIZE 0x800000
#define MC68000_ROM_SIZE 0x8000

extern bool tube_68000_init(void *rom);
Expand Down
7 changes: 6 additions & 1 deletion src/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ typedef struct
int speed_multiplier;
} TUBE;

#define NUM_TUBES 13
#ifdef M68K
# define NUM_TUBES 14
#else
# define NUM_TUBES 13
#endif

extern TUBE tubes[NUM_TUBES];

extern int curmodel, curtube, oldmodel, selecttube;
Expand Down

0 comments on commit ac1baae

Please sign in to comment.