This commit is contained in:
Ralph 2024-01-06 14:14:25 +10:30 committed by GitHub
commit 58c620954e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 154 additions and 60 deletions

13
.gitignore vendored
View File

@ -1,13 +1,20 @@
*~
INSTALL
Makefile
Makefile.in
aclocal.m4
autom4te.cache
compile
config.guess
config.h
config.h.in
config.log
config.status
config.sub
configure
depcomp
INSTALL
install-sh
Makefile
Makefile.in
ltmain.sh
m4
missing
stamp-h1

View File

@ -1,3 +1,3 @@
John D. Corrado <jdcorrado@gmail.com>
Verhille Arnaud
Ralph Moeritz

View File

@ -1,3 +1,7 @@
2023-12-17 Ralph Moeritz
* Added -krusaderRom option (Ctrl+K) to switch between Krusader and BASIC/Monitor ROMs.
Sat Mar 03 12:21:45 EST 2012 jdcorrado
v1.0.0

View File

@ -2,7 +2,7 @@ DOC_FILES = \
AUTHORS \
ChangeLog \
NEWS \
README
README.md
EXTRA_DIST = $(DOC_FILES)

34
README
View File

@ -1,34 +0,0 @@
Pom1 is an Apple 1 emulator being ported to C from the original Java
version. It uses the Simple DirectMedia Layer library and works on most
platforms.
== Options ==
Pom1 has many options to configure and utilize the emulator. They are
accessed by Ctrl+<letter>. Some options also have corresponding command
line parameters.
Option Letter Parameter Description
--------------------------------------------------------------------------------------------
Load Memory L Load memory from a binary or ascii file.
Save Memory S Save memory to a binary or ascii file.
Quit Q Quit the emulator.
Reset R Soft reset the emulator.
Hard Reset H Hard reset the emulator.
Pixel Size P -pixelsize <n> Set the pixel size (1 or 2).
Scanlines N -scanlines Turn scanlines on or off (pixel size 2 only).
Terminal Speed T -terminalspeed <n> Set the terminal speed (Range: 1 - 120).
RAM 8K E -ram8k Use only 8KB of RAM or entire 64KB of RAM.
Write In ROM W -writeinrom Allow writing data in ROM or not.
IRQ/BRK Vector V Set address of interrupt vector.
Fullscreen F -fullscreen Switch to fullscreen or window.
Blink Cursor B -blinkcursor Set the cursor to blink or not.
Cursor Block C -blockcursor Set the cursor to block or @.
Show About A Show version and copyright information.
== Other information ==
* You can find more information about the project at the Pom1 website:
http://pom1.sourceforge.net/

53
README.md Normal file
View File

@ -0,0 +1,53 @@
Pom1 is an Apple 1 emulator ported to C from the original Java
version. It uses the SDL1 library and works on most platforms.
Options
===
Pom1 has many options to configure and utilize the emulator. They are
accessed by Ctrl+<letter>. Some options also have corresponding
command line parameters.
| Option | Letter | Parameter | Description |
|---------------------|--------|--------------------|------------------------------------------------|
| Load Memory | L | | Load memory from a binary or ascii file. |
| Save Memory | S | | Save memory to a binary or ascii file. |
| Quit | Q | | Quit the emulator. |
| Reset | R | | Soft reset the emulator. |
| Hard Reset | H | | Hard reset the emulator. |
| Pixel Size | P | -pixelsize <n> | Set the pixel size (1 or 2). |
| Scanlines | N | -scanlines | Turn scanlines on or off (pixel size 2 only). |
| Terminal Speed | T | -terminalspeed <n> | Set the terminal speed (Range: 1 - 120). |
| RAM 8K | E | -ram8k | Use only 8KB of RAM or entire 64KB of RAM. |
| Write In ROM | W | -writeinrom | Allow writing data in ROM or not. |
| IRQ/BRK Vector | V | | Set address of interrupt vector. |
| Fullscreen | F | -fullscreen | Switch to fullscreen or window. |
| Blink Cursor | B | -blinkcursor | Set the cursor to blink or not. |
| Cursor Block | C | -blockcursor | Set the cursor to block or @. |
| Show About | A | | Show version and copyright information. |
| Toggle Krusader ROM | K | -krusaderRom | Toggle between Krusader and BASIC/Monitor ROMs |
Before exiting, Pom1 writes its configuration options to
`$HOME/.pom1/pom1.cfg`; you can modify options directly in this file as well.
Building
===
Generate the `configure` script:
$ libtoolize --force
$ aclocal
$ autoheader
$ automake --force-missing --add-missing
$ autoconf
After that's it's just the usual:
$ ./configure
$ make
$ make install
Other information
===
You can find more information about the project at the Pom1 website: http://pom1.sourceforge.net/

View File

@ -1,5 +1,6 @@
AC_PREREQ([2.68])
AC_INIT([Pom1 Apple 1 Emulator], [1.0.0], [jdcorrado@gmail.com], [pom1])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_HEADERS([config.h])

View File

@ -98,6 +98,8 @@ void loadConfiguration(void)
setBlinkCursor(value[0] & 0x01);
else if (!strcmp(buffer, "blockCursor"))
setBlockCursor(value[0] & 0x01);
else if (!strcmp(buffer, "krusaderRom"))
setKrusaderRom((value[0] & 0x01));
}
fclose(fp);
@ -181,6 +183,12 @@ void saveConfiguration(void)
buffer[14] = '\0';
fputs(buffer, fp);
strcpy(buffer, "krusaderRom=");
buffer[12] = getKrusaderRom() | 0x30;
buffer[13] = '\n';
buffer[14] = '\0';
fputs(buffer, fp);
fclose(fp);
}
}

View File

@ -192,6 +192,11 @@ int handleInput(void)
showAbout();
return 1;
}
else if (event.key.keysym.sym == SDLK_k) {
setKrusaderRom(!getKrusaderRom());
printf("stdout: krusaderRom=%d\n", getKrusaderRom());
return 1;
}
}
if (readKbdCr() == 0x27 && !_fp && event.type == SDL_KEYDOWN && !(event.key.keysym.unicode & 0xFF80) && event.key.keysym.unicode)

View File

@ -62,9 +62,10 @@ int main(int argc, char *argv[])
setPixelSize(temp);
}
}
else if (!strcasecmp("-scanlines", argv[i]))
else if (!strcasecmp("-scanlines", argv[i])) {
if (getPixelSize() > 1)
setScanlines(1);
}
else if (!strcasecmp("-terminalspeed", argv[i]) && i + 1 < argc)
{
temp = atoi(argv[i + 1]);
@ -82,6 +83,8 @@ int main(int argc, char *argv[])
setBlinkCursor(1);
else if (!strcasecmp("-blockcursor", argv[i]))
setBlockCursor(1);
else if (!strcasecmp("-krusaderrom", argv[i]))
setKrusaderRom(1);
}
}

View File

@ -21,9 +21,12 @@
#include <string.h>
#include "configuration.h"
#include "pia6820.h"
#include "memory.h"
static unsigned char mem[65536];
static int ram8k = 0, writeInRom = 1;
static unsigned char mem[0x10000]; // 64K
static int ram8k = 0;
static int writeInRom = 1;
static int krusaderRom = 0;
static int loadMonitor(void)
{
@ -40,7 +43,7 @@ static int loadMonitor(void)
if (fp)
{
fread(&mem[0xFF00], 1, 256, fp);
fread(&mem[0xFF00], 1, 0x100, fp);
fclose(fp);
}
else
@ -64,7 +67,7 @@ static int loadBasic(void)
if (fp)
{
fread(&mem[0xE000], 1, 4096, fp);
fread(&mem[0xE000], 1, 0x1000, fp);
fclose(fp);
}
else
@ -73,22 +76,60 @@ static int loadBasic(void)
return 1;
}
static int loadKrusader() {
const char *romdir = getRomDirectory();
char *filename;
FILE *fp;
filename = (char *)malloc(strlen(romdir) + 14);
sprintf(filename, "%s/krusader.rom", romdir);
void resetMemory(void)
{
memset(mem, 0, 57344);
if (!loadMonitor())
{
fprintf(stderr, "stderr: Could not load monitor\n");
exit(1);
}
fp = fopen(filename, "rb");
if (!loadBasic())
{
fprintf(stderr, "stderr: Could not load basic\n");
exit(1);
}
free(filename);
if (fp) {
fread(&mem[0xE000], 1, 0x2000, fp);
fclose(fp);
}
else {
return 0;
}
return 1;
}
static void loadRoms() {
if (krusaderRom) {
if (!loadKrusader()) {
fprintf(stderr, "stderr: Could not load krusader\n");
exit(1);
}
}
else {
if (!loadMonitor()) {
fprintf(stderr, "stderr: Could not load monitor\n");
exit(1);
}
if (!loadBasic()) {
fprintf(stderr, "stderr: Could not load basic\n");
exit(1);
}
}
}
int getKrusaderRom() {
return krusaderRom;
}
void setKrusaderRom(int b) {
krusaderRom = b;
}
void resetMemory(void) {
memset(mem, 0, 0xFFFF);
loadRoms();
}
void setRam8k(int b)

View File

@ -19,6 +19,8 @@
#ifndef __MEMORY_H__
#define __MEMORY_H__
int getKrusaderRom();
void setKrusaderRom(int b);
void resetMemory(void);
void setRam8k(int b);
int getRam8k(void);

View File

@ -2,4 +2,7 @@
export POM1ROMDIR="@prefix@/share/@PACKAGE@/roms"
pom1-@PACKAGE_VERSION@ $@
SCRIPT=$(readlink -f "$0")
SCRIPTDIR=$(dirname "$SCRIPT")
$SCRIPTDIR/pom1-@PACKAGE_VERSION@ $@

View File

@ -1,7 +1,8 @@
ROMFILES = \
basic.rom \
charmap.rom \
monitor.rom
monitor.rom \
krusader.rom
romdir = $(prefix)/share/@PACKAGE@/roms
rom_DATA = $(ROMFILES)

BIN
src/roms/krusader.rom Normal file

Binary file not shown.