mirror of
https://github.com/Spritetm/minimacplus.git
synced 2024-11-18 15:05:13 +00:00
Happy Mac!
This commit is contained in:
parent
5ac2e47a73
commit
5e88ad2df0
2
Makefile
2
Makefile
@ -1,6 +1,6 @@
|
||||
TARGET:=tme
|
||||
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
|
||||
OBJ:=$(MUSASHI_GEN_SRC:%.x=%.o) musashi/m68kcpu.o main.o emu.o disp.o iwm.o via.o
|
||||
#musashi/m68kdasm.o
|
||||
CFLAGS=-Wall -I. -I./musashi -ggdb `sdl2-config --cflags`
|
||||
LDFLAGS=`sdl2-config --libs`
|
||||
|
31
emu.c
31
emu.c
@ -8,22 +8,13 @@
|
||||
#include "config.h"
|
||||
#include "m68k.h"
|
||||
#include "disp.h"
|
||||
#include "iwm.h"
|
||||
#include "via.h"
|
||||
|
||||
unsigned char *macRom;
|
||||
unsigned char *macRam;
|
||||
|
||||
void viaWrite(unsigned int addr, unsigned int val) {
|
||||
printf("VIA write %x val %x\n", addr, val);
|
||||
}
|
||||
|
||||
|
||||
unsigned int viaRead(unsigned int addr) {
|
||||
unsigned int val=0;
|
||||
printf("VIA read %x val %x\n", addr, val);
|
||||
return val;
|
||||
}
|
||||
|
||||
int rom_remap;
|
||||
int rom_remap, video_remap=0, audio_remap=0;
|
||||
|
||||
unsigned int m68k_read_memory_8(unsigned int address) {
|
||||
unsigned int ret;
|
||||
@ -44,7 +35,7 @@ unsigned int m68k_read_memory_8(unsigned int address) {
|
||||
} else if (address >= 0xE80000 && address < 0xf00000) {
|
||||
ret=viaRead((address>>8)&0xf);
|
||||
} else if (address >= 0xc00000 && address < 0xe00000) {
|
||||
ret=iwmRead((address>>8)&0xf);
|
||||
ret=iwmRead((address>>9)&0xf);
|
||||
} else {
|
||||
printf("PC %x: Read from %x\n", pc, address);
|
||||
ret=0xaa;
|
||||
@ -62,7 +53,7 @@ void m68k_write_memory_8(unsigned int address, unsigned int value) {
|
||||
} else if (address >= 0xE80000 && address < 0xf00000) {
|
||||
viaWrite((address>>8)&0xf, value);
|
||||
} else if (address >= 0xc00000 && address < 0xe00000) {
|
||||
iwmWrite((address>>8)&0xf, value);
|
||||
iwmWrite((address>>9)&0xf, value);
|
||||
} else {
|
||||
printf("PC %x: Write to %x: %x\n", pc, address, value);
|
||||
}
|
||||
@ -80,7 +71,7 @@ void tmeStartEmu(void *rom) {
|
||||
dispInit();
|
||||
while(1) {
|
||||
m68k_execute(8000000/60);
|
||||
dispDraw(&macRam[0x1A700]);
|
||||
dispDraw(&macRam[video_remap?0x12700:0x1A700]);
|
||||
// printf("Int!\n");
|
||||
// m68k_set_irq(2);
|
||||
}
|
||||
@ -112,3 +103,13 @@ void m68k_write_memory_16(unsigned int address, unsigned int value) {
|
||||
m68k_write_memory_8(address, (value>>8)&0xff);
|
||||
m68k_write_memory_8(address+1, value&0xff);
|
||||
}
|
||||
|
||||
void viaCbPortAWrite(unsigned int val) {
|
||||
video_remap=(val&(1<<6))?1:0;
|
||||
rom_remap=(val&(1<<4))?1:0;
|
||||
audio_remap=(val&(1<<3))?1:0;
|
||||
}
|
||||
|
||||
void viaCbPortBWrite(unsigned int val) {
|
||||
}
|
||||
|
||||
|
99
via.c
Normal file
99
via.c
Normal file
@ -0,0 +1,99 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include "via.h"
|
||||
#include "m68k.h"
|
||||
|
||||
void viaCbPortAWrite(unsigned int val);
|
||||
void viaCbPortBWrite(unsigned int val);
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t ddra;
|
||||
uint8_t ddrb;
|
||||
} Via;
|
||||
|
||||
static Via via;
|
||||
|
||||
void viaWrite(unsigned int addr, unsigned int val) {
|
||||
if (addr==0x0) {
|
||||
//ORB
|
||||
} else if (addr==0x1) {
|
||||
//ORA
|
||||
viaCbPortAWrite(val);
|
||||
} else if (addr==0x2) {
|
||||
//DDRB
|
||||
via.ddrb=val;
|
||||
} else if (addr==0x3) {
|
||||
//DDRA
|
||||
via.ddra=val;
|
||||
} else if (addr==0x4) {
|
||||
//T1L-L
|
||||
} else if (addr==0x5) {
|
||||
//T1C-H
|
||||
} else if (addr==0x6) {
|
||||
//T1L-L
|
||||
} else if (addr==0x7) {
|
||||
//T1L-H
|
||||
} else if (addr==0x8) {
|
||||
//T2L-l
|
||||
} else if (addr==0x9) {
|
||||
//T2C-H
|
||||
} else if (addr==0xa) {
|
||||
//SR
|
||||
} else if (addr==0xb) {
|
||||
//ACR
|
||||
} else if (addr==0xc) {
|
||||
//PCR
|
||||
} else if (addr==0xd) {
|
||||
//IFR
|
||||
} else if (addr==0xe) {
|
||||
//IER
|
||||
} else if (addr==0xf) {
|
||||
//ORA
|
||||
}
|
||||
printf("VIA write %x val %x\n", addr, val);
|
||||
}
|
||||
|
||||
|
||||
unsigned int viaRead(unsigned int addr) {
|
||||
unsigned int pc=m68k_get_reg(NULL, M68K_REG_PC);
|
||||
unsigned int val=0;
|
||||
if (addr==0x0) {
|
||||
//ORB
|
||||
} else if (addr==0x1) {
|
||||
//ORA
|
||||
} else if (addr==0x2) {
|
||||
//DDRB
|
||||
val=via.ddrb;
|
||||
} else if (addr==0x3) {
|
||||
//DDRA
|
||||
val=via.ddra;
|
||||
} else if (addr==0x4) {
|
||||
//T1L-L
|
||||
} else if (addr==0x5) {
|
||||
//T1C-H
|
||||
} else if (addr==0x6) {
|
||||
//T1L-L
|
||||
} else if (addr==0x7) {
|
||||
//T1L-H
|
||||
} else if (addr==0x8) {
|
||||
//T2L-l
|
||||
} else if (addr==0x9) {
|
||||
//T2C-H
|
||||
} else if (addr==0xa) {
|
||||
//SR
|
||||
} else if (addr==0xb) {
|
||||
//ACR
|
||||
} else if (addr==0xc) {
|
||||
//PCR
|
||||
} else if (addr==0xd) {
|
||||
//IFR
|
||||
} else if (addr==0xe) {
|
||||
//IER
|
||||
} else if (addr==0xf) {
|
||||
//ORA
|
||||
}
|
||||
printf("PC %x VIA read %x val %x\n", pc, addr, val);
|
||||
return val;
|
||||
}
|
Loading…
Reference in New Issue
Block a user