Add x49gp - a HP49G+/50G graphics calculator emulator.

This commit is contained in:
Shaun Amott 2014-01-16 19:31:03 +00:00
parent afcb0655a6
commit e89a210813
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=339966
13 changed files with 341 additions and 0 deletions

View file

@ -181,6 +181,7 @@
SUBDIR += wine-mono-devel
SUBDIR += wxmupen64plus
SUBDIR += x48
SUBDIR += x49gp
SUBDIR += xbraitenberg
SUBDIR += xcpc
SUBDIR += xhomer

84
emulators/x49gp/Makefile Normal file
View file

@ -0,0 +1,84 @@
# Created by: Shaun Amott <shaun@FreeBSD.org>
# $FreeBSD$
# Note: sdcard64.tar.gz contains just an empty 64MB FAT-16 disk image
PORTNAME= x49gp
PORTVERSION= 20100425
CATEGORIES= emulators math
MASTER_SITES= LOCAL/shaun
DISTFILES= ${DISTNAME}${EXTRACT_SUFX} sdcard64.tar.gz
MAINTAINER= shaun@FreeBSD.org
COMMENT= HP 49g+/50g graphics calculator emulator
EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX}
WRKSRC= ${WRKDIR}/x49gp/x49gp-code
USE_GCC= any
USE_XORG= x11
USE_GNOME= gtk20
USES= gmake pkgconfig
OPTIONS_SINGLE= FIRMWARE
OPTIONS_SINGLE_FIRMWARE=FIRMWARE_215 FIRMWARE_209
#OPTIONS_SINGLE_FIRMWARE=FIRMWARE_215H3 FIRMWARE_215 FIRMWARE_209
#FIRMWARE_215H3_DESC= Calculator ROM firmware version 2.15 plus HPGCC3
FIRMWARE_215_DESC= Calculator ROM firmware version 2.15
FIRMWARE_209_DESC= Calculator ROM firmware version 2.09
OPTIONS_DEFAULT=FIRMWARE_215
SUB_FILES= hp50g.sh
.if defined(WITH_DEBUG)
MAKE_ENV+= DEBUGB=1
.endif
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MFIRMWARE_215H3} || ${PORT_OPTIONS:MFIRMWARE_215}
MAKE_ARGS+=FIRMWARE=4950_215.bin
DISTFILES+=hp4950v215.zip
EXTRACT_ONLY+=hp4950v215.zip
.else
MAKE_ARGS+=FIRMWARE=4950_92.bin
.endif
#.if ${PORT_OPTIONS:MFIRMWARE_215H3}
#DISTFILES+=rom215_hpgcc3_R004.tar.gz
#EXTRACT_ONLY+=rom215_hpgcc3_R004.tar.gz
#.endif
post-patch:
.if ${PORT_OPTIONS:MFIRMWARE_215H3} || ${PORT_OPTIONS:MFIRMWARE_215}
@${CP} ${WRKDIR}/hp4950v215/*.lib ${WRKSRC}/
@${CP} ${WRKDIR}/hp4950v215/*.bin ${WRKSRC}/
@${CP} ${WRKDIR}/hp4950v215/*.scp ${WRKSRC}/
.endif
#.if ${PORT_OPTIONS:MFIRMWARE_215H3}
# @${CP} ${WRKDIR}/rom215_hpgcc3_R004/hpgccrom.bin ${WRKSRC}/4950_215.bin
#.endif
do-build:
cd ${WRKSRC} && ${GMAKE} ${MAKE_ARGS}
do-install:
@${MKDIR} ${STAGEDIR}${DATADIR}
.for f in flash-50g hp50g.png hp50g-hack.png hp49g+.png flash-49g+ sram s3c2410-sram
${INSTALL_DATA} ${WRKSRC}/${f} ${STAGEDIR}${DATADIR}/
.endfor
${INSTALL_DATA} ${FILESDIR}/config-hp50g ${STAGEDIR}${DATADIR}/
${INSTALL_DATA} ${FILESDIR}/config-hp49g+ ${STAGEDIR}${DATADIR}/
${INSTALL_PROGRAM} ${WRKSRC}/x49gp ${STAGEDIR}${PREFIX}/bin/x49gp-bin
${INSTALL_SCRIPT} ${WRKDIR}/hp50g.sh ${STAGEDIR}${PREFIX}/bin/hp50g
${RM} -f ${STAGEDIR}${PREFIX}/bin/hp49g+
${LN} ${STAGEDIR}${PREFIX}/bin/hp50g ${STAGEDIR}${PREFIX}/bin/hp49g+
${INSTALL_DATA} ${DISTDIR}/sdcard64.tar.gz ${STAGEDIR}${DATADIR}/
.include <bsd.port.mk>

6
emulators/x49gp/distinfo Normal file
View file

@ -0,0 +1,6 @@
SHA256 (x49gp-20100425.tar.gz) = ae2fd793105cfdd10b1c0c9f36c1bb27828791d4b2250015b700ddef36bf0968
SIZE (x49gp-20100425.tar.gz) = 13530661
SHA256 (sdcard64.tar.gz) = 908d0b57831ec2685dc8a8ca5d5d98f47efdf3bd66de310cae330079c096c736
SIZE (sdcard64.tar.gz) = 65560
SHA256 (hp4950v215.zip) = 79db72b67de00f648b54bab421279980c23b12c721b1aa33d49759409ddcf611
SIZE (hp4950v215.zip) = 1742733

View file

@ -0,0 +1,18 @@
[x49gp]
basename=
[gui]
name=hp49g+
image=hp49g+.png
[flash]
filename=flash-49g+
[sram]
filename=sram
[s3c2410-sram]
filename=s3c2410-sram
[s3c2410-sdi]
filename=../sdcard

View file

@ -0,0 +1,18 @@
[x49gp]
basename=
[gui]
name=hp50g
image=hp50g.png
[flash]
filename=flash-50g
[sram]
filename=sram
[s3c2410-sram]
filename=s3c2410-sram
[s3c2410-sdi]
filename=../sdcard

View file

@ -0,0 +1,58 @@
#!/bin/sh
calc=`basename $0`
if [ "${calc}" != "hp50g" -a "${calc}" != "hp49g+" ]; then
echo "Invalid calculator name"
exit 1
fi
if [ "$1" ]; then
cname="$1"
else
cname="${calc}"
fi
bdir="${HOME}/.x49gp"
sdir="${bdir}/${cname}"
datadir="%%DATADIR%%"
# Copy datafiles if we don't have any
if [ ! -d "${bdir}" ]; then
mkdir "${bdir}" || exit 1
fi
if [ ! -d "${sdir}" ]; then
echo "Creating new calculator..."
mkdir "${sdir}" || exit 1
cp "${datadir}/config-${calc}" "${sdir}/config"
if [ "${calc}" = "hp50g" ]; then
cp "${datadir}/flash-50g" "${sdir}/"
if [ "`uname -p`" = "amd64" ]; then
cp "${datadir}/hp50g-hack.png" "${sdir}/"
else
cp "${datadir}/hp50g.png" "${sdir}/"
fi
else
cp "${datadir}/flash-49g+" "${sdir}/"
cp "${datadir}/hp49g+.png" "${sdir}/"
fi
cp "${datadir}/sram" "${sdir}/"
cp "${datadir}/s3c2410-sram" "${sdir}/"
if [ -f "${datadir}/sdcard64.tar.gz" -a ! -f "${bdir}/sdcard" ]; then
tar -C "${bdir}" -xzf "${datadir}/sdcard64.tar.gz"
fi
chmod -R u+rw "${sdir}"
fi
cd "${sdir}" \
&& x49gp-bin config

View file

@ -0,0 +1,32 @@
--- Makefile.orig 2014-01-09 18:03:02.000000000 +0000
+++ Makefile 2014-01-09 18:04:14.000000000 +0000
@@ -31,10 +31,14 @@
-DDEBUG_X49GP_ENABLE_IRQ \
-DDEBUG_X49GP_UI
+ifdef DEBUGB
DEBUG = -g # -pg
+else
+DEBUG =
+endif
#2.09
-FIRMWARE = 4950_92.bin
+#FIRMWARE = 4950_92.bin
#2.10-7
#FIRMWARE = hp49g-u.bin
#HPGCC3 (copy HPGCC3 ROM first)
@@ -53,9 +57,12 @@
-fno-strict-aliasing
# Use this to debug
-# DEFINES = $(X49GP_DEBUG) $(QEMU_DEFINES)
+ifdef DEBUGB
+DEFINES = $(X49GP_DEBUG) $(QEMU_DEFINES)
+else
# Use this for speed
DEFINES = $(QEMU_DEFINES)
+endif
ifdef QEMU_OLD
QEMUSRC = qemu/prepare.sh \

View file

@ -0,0 +1,17 @@
--- main.c.orig 2014-01-09 17:47:52.000000000 +0000
+++ main.c 2014-01-09 17:47:38.000000000 +0000
@@ -25,6 +25,14 @@
#include "gdbstub.h"
+static void *oom_check(void *ptr)
+{
+ if (ptr == NULL) {
+ abort();
+ }
+ return ptr;
+}
+
static x49gp_t *x49gp;
#ifdef QEMU_OLD // LD TEMPO HACK

View file

@ -0,0 +1,11 @@
--- module.c.orig 2014-01-09 17:55:30.000000000 +0000
+++ module.c 2014-01-09 17:55:54.000000000 +0000
@@ -257,7 +257,7 @@
return NULL;
}
- path = g_build_filename(home, basename, filename, NULL);
+ path = g_build_filename(/*home,*/ basename, filename, NULL);
if (NULL == path) {
fprintf(stderr, "%s: %s:%u: Out of memory\n",
module->name, __FUNCTION__, __LINE__);

View file

@ -0,0 +1,31 @@
--- ui.c.orig 2014-01-09 17:49:18.000000000 +0000
+++ ui.c 2014-01-09 17:54:49.000000000 +0000
@@ -1729,6 +1729,8 @@
button->pixmap = gdk_pixmap_new(widget->style->bg_pixmap[0], w, h, -1);
+ assert(button->pixmap);
+
gdk_draw_drawable(button->pixmap, widget->style->black_gc,
widget->style->bg_pixmap[0],
xoffset, yoffset,
@@ -1740,6 +1742,7 @@
h -= 4;
cr = gdk_cairo_create(button->pixmap);
+ assert(cr);
cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT);
cairo_set_line_join(cr, CAIRO_LINE_JOIN_MITER);
@@ -2201,6 +2204,11 @@
imagefile = x49gp_module_get_filename(module, keyfile, "image");
x49gp_module_get_string(module, keyfile, "name", "hp49g+", &name);
+ if (access(imagefile, R_OK) == -1) {
+ fprintf(stderr, "Calculator skin file \"%s\" not accessible.\n", imagefile);
+ return 1;
+ }
+
if (!strcmp(name, "hp49g+")) {
ui->calculator = UI_CALCULATOR_HP49GP;
} else if (!strcmp(name, "hp50g")) {

11
emulators/x49gp/pkg-descr Normal file
View file

@ -0,0 +1,11 @@
An emulator for the HP 49g+/50g calculator series. This is an ARM-based
emulator (unlike emu48 / debug4x), so it is possible to run hpgcc
binaries within the emulator.
Skins for both variants of the calculator are included.
Known limitations:
- Cannot write to port 2. Libraries will eat up your RAM.
- HPGCC2/3 SD I/O is unstable.
WWW: http://sourceforge.net/projects/x49gp/

View file

@ -0,0 +1,40 @@
-------------------------------------------------------
Instructions
-------------------------------------------------------
- Start a HP 50g with "hp50g"
- Start a HP 49G+ with "hp49g+"
- You can run each calculator type independently with
its own state and settings. Or create more than two
by supplying a name:
hp50g home
hp50g work
- To reset a calculator, remove its subdirectory
under ~/.x49gp (or the whole directory).
- A 64MB SD card is included, and shared between
calculators. If you want to run multiple calculators
simultaneously, you will probably need a different
arrangement. The config file for each calculator can
be edited to change the SD card file.
- Remember to install the ARM Toolbox if you want to
use HPGCC2 binaries.
- Mount the SD card with:
mdconfig -a -f ~/.x49gp/sdcard
mount_msdosfs /dev/md0 /mnt
When finished:
umount /mnt
mdconfig -d -u 0
-------------------------------------------------------
Known limitations
-------------------------------------------------------
- Cannot write to port 2. Libs will eat up your RAM.
- HPGCC2/3 SD I/O is unstable.
-------------------------------------------------------

14
emulators/x49gp/pkg-plist Normal file
View file

@ -0,0 +1,14 @@
bin/hp49g+
bin/hp50g
bin/x49gp-bin
%%DATADIR%%/config-hp50g
%%DATADIR%%/config-hp49g+
%%DATADIR%%/flash-49g+
%%DATADIR%%/flash-50g
%%DATADIR%%/hp49g+.png
%%DATADIR%%/hp50g.png
%%DATADIR%%/hp50g-hack.png
%%DATADIR%%/s3c2410-sram
%%DATADIR%%/sdcard64.tar.gz
%%DATADIR%%/sram
@dirrm %%DATADIR%%