x48ng 0.9.9

This commit is contained in:
Gwenhael Le Moine 2023-04-30 18:16:13 +02:00
parent 4f36bc06c0
commit 97da416cbd
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
18 changed files with 103 additions and 145 deletions

80
.gitignore vendored
View file

@ -1,82 +1,6 @@
Makefile.in src/*.o
aclocal.m4
autom4te.cache/
compile
config.guess
config.h.in
config.sub
configure
depcomp
install-sh
members
missing
romdump/Makefile.in
src/Makefile.in
# gwh 2022-03-24
Makefile
X48
config.h
config.log
config.status
romdump/
romdump/Makefile
rpm/
rpm/x48.spec
src/.deps/
src/.deps/actions.Po
src/.deps/checkrom.Po
src/.deps/debugger.Po
src/.deps/device.Po
src/.deps/disasm.Po
src/.deps/dump2rom.Po
src/.deps/emulate.Po
src/.deps/errors.Po
src/.deps/init.Po
src/.deps/lcd.Po
src/.deps/main.Po
src/.deps/memory.Po
src/.deps/mkcard.Po
src/.deps/options.Po
src/.deps/register.Po
src/.deps/resources.Po
src/.deps/romio.Po
src/.deps/rpl.Po
src/.deps/serial.Po
src/.deps/timer.Po
src/.deps/x48_x11.Po
src/
src/Makefile
src/actions.o
src/checkrom
src/checkrom.o
src/debugger.o
src/device.o
src/disasm.o
src/dump2rom
src/dump2rom.o
src/emulate.o
src/errors.o
src/init.o
src/lcd.o
src/main.o
src/memory.o
src/mkcard
src/mkcard.o
src/options.o
src/register.o
src/resources.o
src/romio.o
src/rpl.o
src/serial.o
src/timer.o
src/x48
src/x48.man
src/x48_x11.o
stamp-h1
checkrom checkrom
dump2rom dump2rom
mkcard mkcard
x48 x48ng

View file

@ -1,9 +0,0 @@
You will only need readline support if you are planning to use the
x48 debugger. So ignore
With ReadLine sup. in Debuger? no
unless you want readline support in the x48 debugger.

View file

@ -1,23 +1,30 @@
# Makefile to build x48 without autotools # Makefile to build x48ng without autotools
CC = gcc CC = gcc
GUI_IS_X11 = 1 CFLAGS = -g -O2
#GUI_IS_SDL1 = 1
CFLAGS = -g -O2 #-Wall -Wextra -Wno-unused-parameter -Wno-unused-function -Wconversion -Wdouble-promotion -Wno-sign-conversion -fsanitize=undefined -fsanitize-trap
LIBS = -lm -lhistory -lreadline LIBS = -lm -lhistory -lreadline
ifdef GUI_IS_X11 #possible values: x11, sdl1
GUI = x11
ifeq ($(GUI), x11)
CFLAGS += -D 'GUI_IS_X11 = 1' CFLAGS += -D 'GUI_IS_X11 = 1'
LIBS += -lX11 -lXext LIBS += -lX11 -lXext
endif endif
ifdef GUI_IS_SDL1 ifeq ($(GUI), sdl1)
CFLAGS += $(shell pkg-config --cflags SDL_gfx readline sdl12_compat) -D 'GUI_IS_SDL1 = 1' CFLAGS += $(shell pkg-config --cflags SDL_gfx readline sdl12_compat) -D 'GUI_IS_SDL1 = 1'
LIBS += $(shell pkg-config --libs SDL_gfx readline sdl12_compat) LIBS += $(shell pkg-config --libs SDL_gfx readline sdl12_compat)
endif endif
all: mkcard checkrom dump2rom x48 FULL_WARNINGS = no
ifeq ($(FULL_WARNINGS), yes)
CFLAGS += -Wall -Wextra -Wno-unused-parameter -Wno-unused-function -Wconversion -Wdouble-promotion -Wno-sign-conversion -fsanitize=undefined -fsanitize-trap
endif
.PHONY: all clean clean-all pretty-code install
all: mkcard checkrom dump2rom x48ng
# Binaries # Binaries
mkcard: src/mkcard.o mkcard: src/mkcard.o
@ -29,7 +36,7 @@ dump2rom: src/dump2rom.o
checkrom: src/checkrom.o src/romio.o checkrom: src/checkrom.o src/romio.o
$(CC) $(CFLAGS) $(LIBS) $^ -o $@ $(CC) $(CFLAGS) $(LIBS) $^ -o $@
x48: src/main.o src/actions.o src/debugger.o src/device.o src/disasm.o src/emulate.o src/errors.o src/init.o src/lcd.o src/memory.o src/register.o src/resources.o src/romio.o src/rpl.o src/serial.o src/timer.o src/x48_gui.o src/options.o src/resources.o x48ng: src/main.o src/actions.o src/debugger.o src/device.o src/disasm.o src/emulate.o src/errors.o src/init.o src/lcd.o src/memory.o src/register.o src/resources.o src/romio.o src/rpl.o src/serial.o src/timer.o src/x48_gui.o src/options.o src/resources.o
$(CC) $(CFLAGS) $(LIBS) $^ -o $@ $(CC) $(CFLAGS) $(LIBS) $^ -o $@
# Cleaning # Cleaning
@ -37,7 +44,7 @@ clean:
rm -f src/*.o rm -f src/*.o
clean-all: clean clean-all: clean
rm -f x48 mkcard checkrom dump2rom rm -f x48ng mkcard checkrom dump2rom
# Formatting # Formatting
pretty-code: pretty-code:
@ -45,31 +52,31 @@ pretty-code:
# Installing # Installing
PREFIX = /usr PREFIX = /usr
DOCDIR = $(PREFIX)/doc/x48 DOCDIR = $(PREFIX)/doc/x48ng
MANDIR = $(PREFIX)/man/man1 MANDIR = $(PREFIX)/man
install: all install: all
install -m 755 -d -- $(DESTDIR)$(PREFIX)/bin install -m 755 -d -- $(DESTDIR)$(PREFIX)/bin
install -c -m 755 x48 $(DESTDIR)$(PREFIX)/bin/x48 install -c -m 755 x48ng $(DESTDIR)$(PREFIX)/bin/x48ng
install -m 755 -d -- $(DESTDIR)$(PREFIX)/share/x48 install -m 755 -d -- $(DESTDIR)$(PREFIX)/share/x48ng
install -c -m 755 mkcard $(DESTDIR)$(PREFIX)/share/x48/mkcard install -c -m 755 mkcard $(DESTDIR)$(PREFIX)/share/x48ng/mkcard
install -c -m 755 dump2rom $(DESTDIR)$(PREFIX)/share/x48/dump2rom install -c -m 755 dump2rom $(DESTDIR)$(PREFIX)/share/x48ng/dump2rom
install -c -m 755 checkrom $(DESTDIR)$(PREFIX)/share/x48/checkrom install -c -m 755 checkrom $(DESTDIR)$(PREFIX)/share/x48ng/checkrom
install -c -m 644 hplogo.png $(DESTDIR)$(PREFIX)/share/x48/hplogo.png install -c -m 644 hplogo.png $(DESTDIR)$(PREFIX)/share/x48ng/hplogo.png
cp -R ROMs/ $(DESTDIR)$(PREFIX)/share/x48/ cp -R ROMs/ $(DESTDIR)$(PREFIX)/share/x48ng/
find $(DESTDIR)$(PREFIX)/share/x48/ROMs/ -name "*.bz2" -exec bunzip2 {} \; find $(DESTDIR)$(PREFIX)/share/x48ng/ROMs/ -name "*.bz2" -exec bunzip2 {} \;
sed "s|PREFIX|$(PREFIX)|g" setup-home.sh > $(DESTDIR)$(PREFIX)/share/x48/setup-x48-home.sh sed "s|@PREFIX@|$(PREFIX)|g" setup-x48ng-home.sh > $(DESTDIR)$(PREFIX)/share/x48ng/setup-x48ng-home.sh
chmod 755 $(DESTDIR)$(PREFIX)/share/x48/setup-x48-home.sh chmod 755 $(DESTDIR)$(PREFIX)/share/x48ng/setup-x48ng-home.sh
install -m 755 -d -- $(DESTDIR)$(MANDIR) install -m 755 -d -- $(DESTDIR)$(MANDIR)/man1
install -c -m 644 x48.man.1 $(DESTDIR)$(MANDIR)/x48.1 install -c -m 644 x48ng.man.1 $(DESTDIR)$(MANDIR)/man1/x48ng.1
gzip -9 $(DESTDIR)$(MANDIR)/x48.1 gzip -9 $(DESTDIR)$(MANDIR)/man1/x48ng.1
install -m 755 -d -- $(DESTDIR)$(DOCDIR) install -m 755 -d -- $(DESTDIR)$(DOCDIR)
cp -R AUTHORS COPYING ChangeLog INSTALL LICENSE README doc/ romdump/ $(DESTDIR)$(DOCDIR) cp -R AUTHORS COPYING ChangeLog* LICENSE README* doc/ romdump/ $(DESTDIR)$(DOCDIR)
install -m 755 -d -- $(DESTDIR)$(PREFIX)/share/applications install -m 755 -d -- $(DESTDIR)$(PREFIX)/share/applications
sed "s|PREFIX|$(PREFIX)|g" x48.desktop > $(DESTDIR)$(PREFIX)/share/applications/x48.desktop sed "s|@PREFIX@|$(PREFIX)|g" x48ng.desktop > $(DESTDIR)$(PREFIX)/share/applications/x48ng.desktop
install 0m 755 -d -- $(DESTDIR)/etc/X11/app-defaults install -m 755 -d -- $(DESTDIR)/etc/X11/app-defaults
install -c -m 644 X48.ad $(DESTDIR)/etc/X11/app-defaults/X48 install -c -m 644 X48NG.ad $(DESTDIR)/etc/X11/app-defaults/X48NG

39
README.md Normal file
View file

@ -0,0 +1,39 @@
# x48ng -- HP48 CPU emulator
(I'm not very good at writing, see ./README_0.6.4 for the original README)
This is my fork of x48-0.6.4 where I deviate from the original code and do my own thing.
## What have I done:
1. merged in a SDL1 version I found @ https://code.google.com/archive/p/x48-sdl/source/default/source
2. removed the code supporting Solaris, HP-UX, etc.
3. removed the autotools-based build system and wrote a simple Makefile instead
4. added a x48.desktop file and an icon
## What more I would like to do:
1. clean-up further.
2. split the core emulator in a lib and have the GUI use that to cleanly separate the two.
3. have a more modern GUI: SDL2 or gosu or?…
4. support the HP49g ROM?
## Compilation
By default the X11 version is built.
To build the X11 version run `make GUI=x11`
To build the SDL1 version run `make GUI=sdl1`
## Installation
1. Run `sudo make install PREFIX=/usr DOCDIR=/usr/doc/x48ng MANDIR=/usr/man DESTDIR=/tmp/package` filling in your own values for PREFIX, DOCDIR, MANDIR and DESTDIR.
2. once installed run `/usr/share/x48/setup-x48-home.sh` to setup your ~/.x48ng/. It sets up a HP 48GX with a 128KB card in port 1 and a 4MB card in port 2
3. run `x48ng` and enjoy
## Development
- `make FULL_WARNINGS=yes` to compile with all warnings
- `make clean` and `make clean-all` to clean between compilation runs
- `make pretty-code` to format the code using `clang-format` and the provided `.clang-format`

View file

@ -37,7 +37,7 @@
*completeInitialize: False *completeInitialize: False
*resetOnStartup: False *resetOnStartup: False
*romFileName: rom.dump *romFileName: rom.dump
*homeDirectory: .hp48 *homeDirectory: .x48ng
! !
! resources controlling the debugger ! resources controlling the debugger

View file

@ -6,11 +6,10 @@ A: Well, I guess you would have to use some sort of Card copying
You should convert it into an x48 rom-file. Look at dump2rom.c. You should convert it into an x48 rom-file. Look at dump2rom.c.
There should be changes for the size of the Card!!! There should be changes for the size of the Card!!!
Then you should copy this to "$HOME/.hp48/port1" or "$HOME/.hp48/port2". Then you should copy this to "$HOME/.x48ng/port1" or "$HOME/.x48ng/port2".
Change the file to read only, use 'chmod 444 $HOME/.hp48/port1'. Change the file to read only, use 'chmod 444 $HOME/.x48ng/port1'.
The emulator will notice, this is a ROM. The emulator will notice, this is a ROM.
You are mainly on your own here, I don't have such a card, so I can't You are mainly on your own here, I don't have such a card, so I can't
try, but I hope it helps. try, but I hope it helps.

View file

@ -1,6 +0,0 @@
mkdir ~/.hp48
cp PREFIX/share/x48/ROMs/gxrom-r ~/.hp48/rom.dump
cd ~/.hp48
PREFIX/share/x48/mkcard 128K port1
PREFIX/share/x48/mkcard 4M port2
x48 -initialize

7
setup-x48ng-home.sh Normal file
View file

@ -0,0 +1,7 @@
mkdir ~/.x48ng
cp @PREFIX@/share/x48/ROMs/gxrom-r ~/.x48ng/rom
cp ~/.x48ng/rom ~/.x48ng/rom.dump
cd ~/.x48ng
@PREFIX@/share/x48/mkcard 128K port1
@PREFIX@/share/x48/mkcard 4M port2
x48 -initialize

View file

@ -10,5 +10,5 @@
"*printWarranty: False", "*useTerminal: True", "*printWarranty: False", "*useTerminal: True",
"*useSerial: False", "*serialLine: /dev/ttyS0", "*useSerial: False", "*serialLine: /dev/ttyS0",
"*completeInitialize: False", "*resetOnStartup: False", "*completeInitialize: False", "*resetOnStartup: False",
"*romFileName: rom.dump", "*homeDirectory: .hp48", "*romFileName: rom.dump", "*homeDirectory: .x48ng",
"*useDebugger: True", "*disassemblerMnemonics: class", "*useDebugger: True", "*disassemblerMnemonics: class",

View file

@ -2,10 +2,10 @@
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
/* The minor version number */ /* The minor version number */
#define VERSION_MINOR 6 #define VERSION_MINOR 9
/* The patch level */ /* The patch level */
#define PATCHLEVEL 4 #define PATCHLEVEL 9
/* description */ /* description */
#define COMPILE_VERSION 0 #define COMPILE_VERSION 0

View file

@ -76,7 +76,7 @@ const char* errinit_text[] = { "",
" ram: ram file", " ram: ram file",
" hp48: HP state file", " hp48: HP state file",
"", "",
"These files must be in ~/.hp48", "These files must be in ~/.x48ng",
"", "",
"Install these files and try again.", "Install these files and try again.",
0 }; 0 };
@ -91,7 +91,7 @@ int main( int argc, char** argv ) {
int rv, i; int rv, i;
/* unsigned t1, t2; */ /* unsigned t1, t2; */
printf( "x48-sdl\n" ); printf( "x48ng\n" );
// SDL Initialization // SDL Initialization
SDLInit(); SDLInit();

View file

@ -10,7 +10,7 @@
void usage( void ) { void usage( void ) {
fprintf( stdout, "\n\ fprintf( stdout, "\n\
x48 Version %d.%d.%d, Copyright (c) 1994-2005 by Eddie C. Dost <ecd@dressler.de>.\n\ %s Version %d.%d.%d\n\
\n\ \n\
usage:\n\t%s [-options ...]\n\ usage:\n\t%s [-options ...]\n\
\n\ \n\
@ -42,14 +42,14 @@ where options include:\n\
-/+debug turn on/off debugger\n\ -/+debug turn on/off debugger\n\
-disasm <string> use <string> (\'HP\' or \'class\') mnemonics\n\ -disasm <string> use <string> (\'HP\' or \'class\') mnemonics\n\
-reset perform a reset (PC = 0) on startup\n\ -reset perform a reset (PC = 0) on startup\n\
-initialize force initialization x48 from ROM-dump\n\ -initialize force initialization x48ng from ROM-dump\n\
-rom <filename> if initializing, read ROM from <filename>\n\ -rom <filename> if initializing, read ROM from <filename>\n\
-home <directory> use directory ~/<directory> to save x48 files\n\ -home <directory> use directory ~/<directory> to save x48ng files\n\
-xrm <resource> set Xresource <resource>\n\ -xrm <resource> set Xresource <resource>\n\
-/+throttle turn off/on speed emulation\n\ -/+throttle turn off/on speed emulation\n\
-/+netbook turn off/on netbook layout\n\ -/+netbook turn off/on netbook layout\n\
\n", \n",
VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL, progname ); progname, VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL, progname );
fflush( stdout ); fflush( stdout );
exit( 1 ); exit( 1 );
@ -57,7 +57,7 @@ where options include:\n\
void show_version( void ) { void show_version( void ) {
fprintf( stdout, "\n\ fprintf( stdout, "\n\
%s Version %d.%d.%d, x48 is Copyright (c) 1994-2005 by Eddie C. Dost <ecd@dressler.de>.\n\n", %s Version %d.%d.%d",
progname, VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL ); progname, VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL );
} }
@ -65,8 +65,7 @@ void show_copyright( void ) {
fprintf( stdout, "\n\ fprintf( stdout, "\n\
COPYRIGHT\n\ COPYRIGHT\n\
\n\ \n\
X48 is an Emulator/Debugger for the HP-48 Handheld Calculator.\n\ x48ng is an Emulator/Debugger for the HP-48 Handheld Calculator.\n\
Copyright (C) 1994 by Eddie C. Dost <ecd@dressler.de>.\n\
\n\ \n\
This program is free software; you can redistribute it and/or modify\n\ This program is free software; you can redistribute it and/or modify\n\
it under the terms of the GNU General Public License as published by\n\ it under the terms of the GNU General Public License as published by\n\

View file

@ -326,7 +326,7 @@ void get_resources(
// homeDirectory // homeDirectory
// Have homeDirectory in the user's home // Have homeDirectory in the user's home
strcpy( homeDirectory, ".hp48" ); // live files are stored in ~/.hp48 strcpy( homeDirectory, ".x48ng" ); // live files are stored in ~/.x48ng
// As a fallback, assume that a ROM will be available at the same location // As a fallback, assume that a ROM will be available at the same location
// as the executable We assume that the rom file is in the same // as the executable We assume that the rom file is in the same
@ -357,4 +357,3 @@ void get_resources(
throttle = 0; throttle = 0;
} }
#endif #endif

View file

@ -33,7 +33,7 @@
#ifdef GUI_IS_X11 #ifdef GUI_IS_X11
static char* defaults[] = { static char* defaults[] = {
#include "X48.ad.h" #include "X48NG.ad.h"
0 }; 0 };
#ifdef HAVE_XSHM #ifdef HAVE_XSHM
@ -7222,7 +7222,7 @@ void SDLShowInformation() {
" port1: card 1 memory", " port1: card 1 memory",
" port2: card 2 memory", " port2: card 2 memory",
"", "",
"These files must be in ~/.hp48", "These files must be in ~/.x48ng",
"", "",
0 }; 0 };
SDLMessageBox( 310, 280, info_title, info_text, 0xf0c0c0e0, 0xff000000, 0 ); SDLMessageBox( 310, 280, info_title, info_text, 0xf0c0c0e0, 0xff000000, 0 );
@ -7244,4 +7244,3 @@ void SDLShowInformation() {
0 ); 0 );
} }
#endif #endif

View file

@ -3,6 +3,6 @@ Encoding=UTF-8
Version=1.0 Version=1.0
Type=Application Type=Application
Terminal=false Terminal=false
Exec=PREFIX/bin/x48 Exec=@PREFIX@/bin/x48
Name=x48 Name=x48
Icon=PREFIX/share/x48/hplogo.png Icon=@PREFIX@/share/x48/hplogo.png