mirror of
https://github.com/Spritetm/minimacplus.git
synced 2024-06-12 21:29:35 +00:00
Upgrading to macplus... but now it will not boot :/
This commit is contained in:
parent
460baa1a7b
commit
af3b3f98cc
2
Makefile
2
Makefile
|
@ -1,6 +1,6 @@
|
||||||
TARGET:=tme
|
TARGET:=tme
|
||||||
MUSASHI_GEN_SRC:=musashi/m68kops.c musashi/m68kopac.c musashi/m68kopdm.c musashi/m68kopnz.c
|
MUSASHI_GEN_SRC:=musashi/m68kops.c musashi/m68kopac.c musashi/m68kopdm.c musashi/m68kopnz.c
|
||||||
OBJ:=$(MUSASHI_GEN_SRC:%.x=%.o) musashi/m68kcpu.o main.o emu.o disp.o iwm.o via.o rtc.o
|
OBJ:=$(MUSASHI_GEN_SRC:%.x=%.o) musashi/m68kcpu.o main.o emu.o disp.o iwm.o via.o rtc.o ncr.o
|
||||||
#musashi/m68kdasm.o
|
#musashi/m68kdasm.o
|
||||||
CFLAGS=-Wall -I. -I./musashi -Og -ggdb `sdl2-config --cflags`
|
CFLAGS=-Wall -I. -I./musashi -Og -ggdb `sdl2-config --cflags`
|
||||||
LDFLAGS=`sdl2-config --libs`
|
LDFLAGS=`sdl2-config --libs`
|
||||||
|
|
7
config.h
7
config.h
|
@ -1,5 +1,8 @@
|
||||||
|
|
||||||
|
|
||||||
#define TME_ROMSIZE (64*1024)
|
#define TME_ROMSIZE (128*1024)
|
||||||
|
|
||||||
#define TME_RAMSIZE (128*1024)
|
#define TME_RAMSIZE (512*1024)
|
||||||
|
|
||||||
|
#define TME_SCREENBUF (TME_RAMSIZE-0x5900)
|
||||||
|
#define TME_SCREENBUF_ALT (TME_RAMSIZE-0xd900)
|
||||||
|
|
20
emu.c
20
emu.c
|
@ -12,6 +12,7 @@
|
||||||
#include "iwm.h"
|
#include "iwm.h"
|
||||||
#include "via.h"
|
#include "via.h"
|
||||||
#include "rtc.h"
|
#include "rtc.h"
|
||||||
|
#include "ncr.h"
|
||||||
|
|
||||||
unsigned char *macRom;
|
unsigned char *macRom;
|
||||||
unsigned char *macRam;
|
unsigned char *macRam;
|
||||||
|
@ -28,19 +29,20 @@ unsigned int m68k_read_memory_8(unsigned int address) {
|
||||||
ret=macRam[address & (TME_RAMSIZE-1)];
|
ret=macRam[address & (TME_RAMSIZE-1)];
|
||||||
}
|
}
|
||||||
} else if (address >= 0x600000 && address < 0xA00000) {
|
} else if (address >= 0x600000 && address < 0xA00000) {
|
||||||
ret=macRam[address & (TME_RAMSIZE-1)];
|
ret=macRam[(address-0x600000) & (TME_RAMSIZE-1)];
|
||||||
} else if (address >= 0x400000 && address<0x41FFFF) {
|
} else if (address >= 0x400000 && address<0x41FFFF) {
|
||||||
int romAdr=address-0x400000;
|
int romAdr=address-0x400000;
|
||||||
if (romAdr>TME_ROMSIZE) printf("PC %x:Huh? Read from ROM mirror (%x)\n", pc, address);
|
if (romAdr>=TME_ROMSIZE) printf("PC %x:Huh? Read from ROM mirror (%x)\n", pc, address);
|
||||||
ret=macRom[romAdr&(TME_ROMSIZE-1)];
|
ret=macRom[romAdr&(TME_ROMSIZE-1)];
|
||||||
// rom_remap=0; //HACK
|
|
||||||
} else if (address >= 0xE80000 && address < 0xf00000) {
|
} else if (address >= 0xE80000 && address < 0xf00000) {
|
||||||
ret=viaRead((address>>9)&0xf);
|
ret=viaRead((address>>9)&0xf);
|
||||||
} else if (address >= 0xc00000 && address < 0xe00000) {
|
} else if (address >= 0xc00000 && address < 0xe00000) {
|
||||||
ret=iwmRead((address>>9)&0xf);
|
ret=iwmRead((address>>9)&0xf);
|
||||||
|
} else if (address >= 0x580000 && address < 0x600000) {
|
||||||
|
ret=ncrRead((address>>4)&0x7, (address>>7)&1);
|
||||||
} else {
|
} else {
|
||||||
printf("PC %x: Read from %x\n", pc, address);
|
printf("PC %x: Read from %x\n", pc, address);
|
||||||
ret=0xaa;
|
ret=0xff;
|
||||||
}
|
}
|
||||||
// printf("Rd %x = %x\n", address, ret);
|
// printf("Rd %x = %x\n", address, ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -48,14 +50,16 @@ unsigned int m68k_read_memory_8(unsigned int address) {
|
||||||
|
|
||||||
void m68k_write_memory_8(unsigned int address, unsigned int value) {
|
void m68k_write_memory_8(unsigned int address, unsigned int value) {
|
||||||
unsigned int pc=m68k_get_reg(NULL, M68K_REG_PC);
|
unsigned int pc=m68k_get_reg(NULL, M68K_REG_PC);
|
||||||
if (address < 0x400000) {
|
if (address < 0x400000 && !rom_remap) {
|
||||||
macRam[address & (TME_RAMSIZE-1)]=value;
|
macRam[address & (TME_RAMSIZE-1)]=value;
|
||||||
} else if (address >= 0x600000 && address < 0xA00000) {
|
} else if (address >= 0x600000 && address < 0xA00000) {
|
||||||
macRam[address & (TME_RAMSIZE-1)]=value;
|
macRam[(address-0x600000) & (TME_RAMSIZE-1)]=value;
|
||||||
} else if (address >= 0xE80000 && address < 0xf00000) {
|
} else if (address >= 0xE80000 && address < 0xf00000) {
|
||||||
viaWrite((address>>9)&0xf, value);
|
viaWrite((address>>9)&0xf, value);
|
||||||
} else if (address >= 0xc00000 && address < 0xe00000) {
|
} else if (address >= 0xc00000 && address < 0xe00000) {
|
||||||
iwmWrite((address>>9)&0xf, value);
|
iwmWrite((address>>9)&0xf, value);
|
||||||
|
} else if (address >= 0x580000 && address < 0x600000) {
|
||||||
|
ncrWrite((address>>4)&0x7, (address>>7)&1, value);
|
||||||
} else {
|
} else {
|
||||||
printf("PC %x: Write to %x: %x\n", pc, address, value);
|
printf("PC %x: Write to %x: %x\n", pc, address, value);
|
||||||
}
|
}
|
||||||
|
@ -82,7 +86,7 @@ void tmeStartEmu(void *rom) {
|
||||||
int x, frame=0;
|
int x, frame=0;
|
||||||
macRom=rom;
|
macRom=rom;
|
||||||
macRam=malloc(TME_RAMSIZE);
|
macRam=malloc(TME_RAMSIZE);
|
||||||
for (int x=0; x<TME_RAMSIZE; x++) macRam[x]=x;
|
for (int x=0; x<TME_RAMSIZE; x++) macRam[x]=0xaa;
|
||||||
rom_remap=1;
|
rom_remap=1;
|
||||||
viaClear(VIA_PORTA, 0x7F);
|
viaClear(VIA_PORTA, 0x7F);
|
||||||
viaSet(VIA_PORTA, 0x80);
|
viaSet(VIA_PORTA, 0x80);
|
||||||
|
@ -95,7 +99,7 @@ void tmeStartEmu(void *rom) {
|
||||||
m68k_execute(GRAN);
|
m68k_execute(GRAN);
|
||||||
viaStep(GRAN);
|
viaStep(GRAN);
|
||||||
}
|
}
|
||||||
dispDraw(&macRam[video_remap?0x12700:0x1A700]);
|
dispDraw(&macRam[video_remap?TME_SCREENBUF_ALT:TME_SCREENBUF]);
|
||||||
frame++;
|
frame++;
|
||||||
ca1^=1;
|
ca1^=1;
|
||||||
viaControlWrite(VIA_CA1, ca1);
|
viaControlWrite(VIA_CA1, ca1);
|
||||||
|
|
4
iwm.c
4
iwm.c
|
@ -27,7 +27,7 @@ void iwmWrite(unsigned int addr, unsigned int val) {
|
||||||
iwmAccess(addr);
|
iwmAccess(addr);
|
||||||
int reg=iwmLines&(IWM_Q7|IWM_Q6);
|
int reg=iwmLines&(IWM_Q7|IWM_Q6);
|
||||||
if (reg==0xC0) iwmModeReg=val;
|
if (reg==0xC0) iwmModeReg=val;
|
||||||
printf("IWM write %x (iwm reg %x) val %x\n", addr, reg, val);
|
// printf("IWM write %x (iwm reg %x) val %x\n", addr, reg, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int iwmRead(unsigned int addr) {
|
unsigned int iwmRead(unsigned int addr) {
|
||||||
|
@ -49,6 +49,6 @@ unsigned int iwmRead(unsigned int addr) {
|
||||||
if (iwmLines&IWM_ENABLE) val|=0x20; //enable
|
if (iwmLines&IWM_ENABLE) val|=0x20; //enable
|
||||||
val|=iwmModeReg&0x1F;
|
val|=iwmModeReg&0x1F;
|
||||||
}
|
}
|
||||||
printf("IWM read %x (iwm reg %x) val %x\n", addr, reg, val);
|
// printf("IWM read %x (iwm reg %x) val %x\n", addr, reg, val);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
7
main.c
7
main.c
|
@ -10,9 +10,14 @@
|
||||||
|
|
||||||
|
|
||||||
static void *loadRom(char *file) {
|
static void *loadRom(char *file) {
|
||||||
|
int i;
|
||||||
char *ret=malloc(TME_ROMSIZE);
|
char *ret=malloc(TME_ROMSIZE);
|
||||||
int f=open(file, O_RDONLY);
|
int f=open(file, O_RDONLY);
|
||||||
read(f, ret, TME_ROMSIZE);
|
i=read(f, ret, TME_ROMSIZE);
|
||||||
|
if (i!=TME_ROMSIZE) {
|
||||||
|
perror("reading rom");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
27
ncr.c
Normal file
27
ncr.c
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
static const char* const regNamesR[]={
|
||||||
|
"CURSCSIDATA","INITIATORCMD", "MODE", "TARGETCMD", "CURSCSISTATUS",
|
||||||
|
"BUSANDSTATUS", "INPUTDATA", "RESETPARINT"
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char* const regNamesW[]={
|
||||||
|
"OUTDATA","INITIATORCMD", "MODE", "TARGETCMD", "SELECTENA",
|
||||||
|
"STARTDMASEND", "STARTDMATARRECV", "STARTDMAINITRECV"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int ncrRead(unsigned int addr, unsigned int dack) {
|
||||||
|
unsigned int ret=0;
|
||||||
|
|
||||||
|
printf("SCSI: read %s val %x (dack %d)\n", regNamesR[addr], ret, dack);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ncrWrite(unsigned int addr, unsigned int dack, unsigned int val) {
|
||||||
|
|
||||||
|
printf("SCSI: write %s val %x (dack %d)\n", regNamesW[addr], val, dack);
|
||||||
|
}
|
4
ncr.h
Normal file
4
ncr.h
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int ncrRead(unsigned int addr, unsigned int dack);
|
||||||
|
void ncrWrite(unsigned int addr,unsigned int dack, unsigned int val);
|
4
via.c
4
via.c
|
@ -156,7 +156,7 @@ void viaWrite(unsigned int addr, unsigned int val) {
|
||||||
viaCheckIrq();
|
viaCheckIrq();
|
||||||
} else if (addr==0xa) {
|
} else if (addr==0xa) {
|
||||||
//SR
|
//SR
|
||||||
printf("6522: Unimplemented: Write %x to SR?\n", val);
|
// printf("6522: Unimplemented: Write %x to SR?\n", val);
|
||||||
} else if (addr==0xb) {
|
} else if (addr==0xb) {
|
||||||
//ACR
|
//ACR
|
||||||
via.acr=val;
|
via.acr=val;
|
||||||
|
@ -225,7 +225,7 @@ unsigned int viaRead(unsigned int addr) {
|
||||||
val=via.timer2>>8;
|
val=via.timer2>>8;
|
||||||
} else if (addr==0xa) {
|
} else if (addr==0xa) {
|
||||||
//SR
|
//SR
|
||||||
printf("6522: Unimplemented: Read from SR?\n");
|
// printf("6522: Unimplemented: Read from SR?\n");
|
||||||
} else if (addr==0xb) {
|
} else if (addr==0xb) {
|
||||||
//ACR
|
//ACR
|
||||||
val=via.acr;
|
val=via.acr;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user