From f0ff05081cd57e89d8b796aab2b7b1663bb1d7fb Mon Sep 17 00:00:00 2001 From: Matt Evans Date: Sun, 18 Aug 2024 17:28:46 +0100 Subject: [PATCH] Add MEMSIZE build-time parameter to set memory size By default, this is 128 (for 128KB). Usable values are 128, 512, 1024, 2048, 4096. --- Makefile | 2 ++ README.md | 11 +++++++---- include/machw.h | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 176a8f1..37e258f 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,7 @@ # DEBUG ?= 0 +MEMSIZE ?= 128 SOURCES = $(wildcard src/*.c) @@ -43,6 +44,7 @@ LIBS = $(SDL_LIBS) -lm INCLUDEFLAGS = -Iinclude/ -I$(MUSASHI) $(SDL_CFLAGS) -DMUSASHI_CNF=\"../include/m68kconf.h\" INCLUDEFLAGS += -DENABLE_DASM=1 +INCLUDEFLAGS += -DUMAC_MEMSIZE=$(MEMSIZE) CFLAGS = $(INCLUDEFLAGS) -Wall -Wextra -pedantic -DSIM ifeq ($(DEBUG),1) diff --git a/README.md b/README.md index 2da86f4..f4dc07e 100644 --- a/README.md +++ b/README.md @@ -33,12 +33,14 @@ This emulates the following hardware: * VIA shift register for keyboard * SCC DCD pin change interrupts, for mouse * Paravirtualised disc storage - * Defaults to 128K of RAM, but will run as a Mac 512K by changing - a `#define` (`RAM_SIZE`). + * Defaults to 128K of RAM, but will run as a Mac 512K by building + with `MEMSIZE=512`. Or, you could use 1024, 2048, or 4096 to + make a 1/2/4MB Mac Plus. There's no emulation for: * IWM/realistic floppy drives + * SCSI; the machine is sort of like a Mac Plus without SCSI. * More than one disc, or runtime image-switching * Sound (a lot of work for a beep) * VIA timers (Space Invaders runs too fast, probably because of this) @@ -110,7 +112,8 @@ make ``` No surprises here. No autoconf either. :D You can add a `DEBUG=1` to -make to compile in debug spew. +make to compile in debug spew, and add `MEMSIZE=` to control +the amount of memory. This will configure and build _Musashi_, umac, and `unix_main.c` as the SDL2 frontend. The _Musashi_ build generates a few files @@ -185,7 +188,7 @@ pitfalls/observations: (e.g. `Open()`, `Prime()`, `Control()`, `Status()`) the call is routed to host-side C code in `disc.c`. The emulation code doesn't support any of the advanced things a driver can be asked - to do, such as formatting – just read/[not yet write] of a block. + to do, such as formatting – just read/write of a block. When the disc is asked to be ejected, a `umac` callback is called; currently this just exits the emulator. The beginnings of multi-disc support are there, but not enabled – again, bare diff --git a/include/machw.h b/include/machw.h index 424a517..813030b 100644 --- a/include/machw.h +++ b/include/machw.h @@ -31,7 +31,7 @@ #include "rom.h" #define ROM_ADDR 0x400000 /* Regular base (and 0, when overlay=0 */ -#define RAM_SIZE (0x20000*1) +#define RAM_SIZE (1024*UMAC_MEMSIZE) #define RAM_HIGH_ADDR 0x600000 #define PV_SONY_ADDR 0xc00069 /* Magic address for replacement driver PV ops */