Skip to content

Commit

Permalink
Initial port of BeebEm to RG350 device
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyrayner committed Jan 9, 2020
1 parent 1d5932e commit ab1f647
Show file tree
Hide file tree
Showing 26 changed files with 586 additions and 28 deletions.
70 changes: 70 additions & 0 deletions Makefile_RG350
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
TOOLCHAIN = /opt/gcw0-toolchain/usr
SDL_CONFIG = $(TOOLCHAIN)/mipsel-gcw0-linux-uclibc/sysroot/usr/bin/sdl-config

#arm-open2x-linux-
#/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/include/c++/4.1.1
#/opt/open2x/gcc-4.1.1-glibc-2.3.6/include/c++/4.1.1

#INCLUDES = -I. -I/usr/local/open2x/include/c++ `sdl-open2x-config --cflags`
#INCLUDES = -I. -I/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/include/c++/4.1.1 `arm-open2x-linux-sdl-config --cflags`
INCLUDES = -I. `$(SDL_CONFIG) --cflags`


#DEPINCLUDES = $(INCLUDES) $(SDINCLUDES) -I/usr/local/open2x/include/linux -I/usr/local/open2x/include/c++
#DEPINCLUDES = $(INCLUDES) $(SDINCLUDES) -I/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/arm-open2x-linux/include/linux -I/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/include/c++/4.1.1
#DEPINCLUDES = $(INCLUDES) $(SDINCLUDES) -I/opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/arm-open2x-linux/include/linux

#CC = open2x-gcc -O6 -mcpu=arm920 -mtune=arm920t -msoft-float -ffast-math -falign-functions=32 -finline-functions -funroll-all-loops
#CC = arm-open2x-linux-gcc -O6 -mcpu=arm920 -mtune=arm920t -msoft-float -ffast-math -falign-functions=32 -finline-functions -funroll-all-loops
CC = $(TOOLCHAIN)/bin/mipsel-linux-gcc


#CFLAGS = $(INCLUDES) $(SDINCLUDES) -Wall -g -DBEEB_DOTIME $(RESOURCES) -DGP2X=1 -DSOUNDSUPPORT
# -DSOUNDSUPPORT
CFLAGS = $(INCLUDES) -Wall -g -DBEEB_DOTIME -DSOUNDSUPPORT $(RESOURCES) -G0 -O3 -march=mips32 -mtune=mips32r2
# -DEG_DEBUG

#RESOURCES=-DROMS_DIR=\"./romimg/\" -DRC_DIR=\"./\" -DOS_DIR=\"./romimg/\" -DDEFAULT_DISC=\"S:80:/mnt/sd/beebem/Zalaga.ssd\" -DVERSION=\"0.6\"
RESOURCES= -DVERSION=\"0.6\"

#LINKFLAGS = -lstdc++ `sdl-open2x-config --libs` -lm -s --static
#LINKFLAGS = -lstdc++ `arm-open2x-linux-sdl-config --libs` -lm -s --static
LINKFLAGS = -lstdc++ `$(SDL_CONFIG) --libs`
LIBS =
LIBFILES = gui/libeg.a

SRCS = 6502core.cc beebmem.cc beebwin.cc disc8271.cc main.cc mode7font.c\
sysvia.cc uservia.cc via.cc video.cc beebsound.cc atodconv.cc sdl.cc \
keyboard.cc beebconfig.cc beebem_pages.cc screensaver.c stick.cc \
virtualkeyboard.cc button.c fileselector.cc progressdialog.cc \
keyboardmapper.cc messagebox.cc uefstate.cc listbox.cc fileselector_saveas.cc dma.cc

OBJS = 6502core.o beebmem.o beebwin.o disc8271.o main.o mode7font.o\
sysvia.o uservia.o via.o video.o beebsound.o atodconv.o sdl.o \
keyboard.o beebconfig.o beebem_pages.o screensaver.o stick.o \
virtualkeyboard.o button.o fileselector.o progressdialog.o \
keyboardmapper.o messagebox.o uefstate.o listbox.o fileselector_saveas.o dma.o


.cc.o:
$(CC) -c $(CFLAGS) $<

beebem: $(OBJS) $(LIBFILES)
$(CC) -o beebem $(OBJS) $(LIBFILES) $(LIBS) $(LINKFLAGS)

gui/libeg.a:
(cd gui; make -f Makefile_RG350)

depend:
makedepend -- $(INCLUDES) $(CFLAGS) $(LINKFLAGS) -- $(SRCS)
# makedepend -- $(DEPINCLUDES) $(INCLUDES) $(CFLAGS) $(LINKFLAGS) -- $(SRCS)

clean:
rm -f $(OBJS) beebem

reallyclean:
make clean
(cd gui; make clean)

# DO NOT DELETE THIS LINE -- make depend depends on it.

34 changes: 28 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,36 @@
# beebem RS-97
# beebem RG350

Port of beebem, a BBC Micro Model B emulator, for the RS-97 handheld running Open Dingux.
Port of beebem, a BBC Micro Model B emulator, for the RG350 handheld running Open Dingux.

Based on v0.6-1 of the GP2X port, the source of which can be found at:
Based on RS-97 port, which in turn is based on the v0.6-1 of the GP2X port, the source of both can be found at:
* [https://github.com/thefossilrecord/beebem-rs97](https://github.com/thefossilrecord/beebem-rs97)
* [http://beebem-unix.bbcmicro.com/download.html](http://beebem-unix.bbcmicro.com/download.html)

http://beebem-unix.bbcmicro.com/download.html

## Compile
Compile with:
`make -f Makefile_RG350`

make -f Makefile_RS97
You'll need a GCWZero toolchain to build from source.
[http://www.gcw-zero.com/develop](http://www.gcw-zero.com/develop)

You'll need a RS-97 toolchain to build from source.
## Create Distributable
* After building the '`beebem`' binary, you then need to package for RG350 as an OPK file
To make the OPK:
`cd dist`
`./make_opk.sh`


## Installation
To install package onto the RG350...

* Copy beebem.opk to `/media/sdcard/APPS/` folder

* Running beebem at least once will create the ~/.beebem/roms if not already present on your device.
* Put ROMs with _exactly_ these names into ~/.beebem/roms
`'acorn_dnfs'` - Acorn DNFS 1.2 (chip ID# 201666)
`'os12'` - Base operating system for BBC Model B (v1.2)
`'basic'` - BBC Basic Programming Language (v2)

## Usage
* Put Disk Images, for example SSD files, e.g. into /media/sdcard/ROMS/BEEB/
71 changes: 57 additions & 14 deletions beebconfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#include <gui/gui.h>

#include <sys/stat.h>

/* BeebEm configuration:
*/
BeebConfig config;
Expand Down Expand Up @@ -198,6 +200,8 @@ int Config_LoadDiscConfig(const char *filename_p)
static void Initialize_Files(const char *executable_name_p)
{
char cwd[MAX_DIR_LEN], test_buf[MAX_DIR_LEN], test_buf2[MAX_DIR_LEN], *tmp_p;
char beebem_home[MAX_DIR_LEN], beebem_home_roms[MAX_DIR_LEN], beebem_home_config[MAX_DIR_LEN];
char beebem_home_kbd[MAX_DIR_LEN], beebem_home_saves[MAX_DIR_LEN];
FILE *test;

/* Test for /startup.cnf in cwd, if not found
Expand All @@ -206,6 +210,34 @@ static void Initialize_Files(const char *executable_name_p)
*/
getcwd(cwd, MAX_DIR_LEN);

// -------------------------
char *beebem_home_str = getenv("HOME");
if(beebem_home_str) sprintf(beebem_home, "%s/.beebem", beebem_home_str);
printf("set beebem_home:%s\n",beebem_home);
if(access(beebem_home,0) == 0) {//exists
printf("~/.beebem dir exists\n");
}
else {
printf("~/.beebem dir does not exist, will create\n");
int status = mkdir(beebem_home, 0777);
if(status == -1) {
printf("error during mkdir:%s\n",beebem_home);
getcwd(beebem_home, MAX_DIR_LEN);
strcat(beebem_home, "/.beebem");
mkdir(beebem_home, 0777);
printf("set szAppHomePath:%s\n",beebem_home);
}
}
sprintf(beebem_home_roms, "%s/roms", beebem_home);
mkdir(beebem_home_roms, 0777);
sprintf(beebem_home_config, "%s/config", beebem_home);
mkdir(beebem_home_config, 0777);
sprintf(beebem_home_kbd, "%s/kbd", beebem_home);
mkdir(beebem_home_kbd, 0777);
sprintf(beebem_home_saves, "%s/saves", beebem_home);
mkdir(beebem_home_saves, 0777);
// -------------------------

strcpy(test_buf, cwd);
strcat(test_buf, "startup.cnf");

Expand Down Expand Up @@ -266,38 +298,49 @@ static void Initialize_Files(const char *executable_name_p)

/* ROM image configuration file location:
*/
strcpy(config.files.romimg_rc_loc, cwd);
strcat(config.files.romimg_rc_loc, "/config/romimg.rc");
strcpy(config.files.romimg_rc_loc, beebem_home_config);
strcat(config.files.romimg_rc_loc, "/romimg.rc");
if (access(config.files.romimg_rc_loc,0) != 0) { // home override does not exist
strcpy(config.files.romimg_rc_loc, cwd);
strcat(config.files.romimg_rc_loc, "/config/romimg.rc");
}

/* romimg_dir:
*/
strcpy(config.files.romimg_dir, cwd);
strcat(config.files.romimg_dir, "/roms/");
strcpy(config.files.romimg_dir, beebem_home_roms); // i.e. ~/.beebem/roms/
strcat(config.files.romimg_dir, "/");

/* default configuration location:
*/
strcpy(config.files.default_config_loc, cwd);
strcat(config.files.default_config_loc, "/config/default.kbd");
strcpy(config.files.default_config_loc, beebem_home_config);
strcat(config.files.default_config_loc, "/default.kbd");
if (access(config.files.default_config_loc,0) != 0) { // home override does not exist
strcpy(config.files.default_config_loc, cwd);
strcat(config.files.default_config_loc, "/config/default.kbd");
}

/* forced configuration location:
*/
strcpy(config.files.forced_config_loc, cwd);
strcat(config.files.forced_config_loc, "/config/forced.kbd");
strcpy(config.files.forced_config_loc, beebem_home_config);
strcat(config.files.forced_config_loc, "/forced.kbd");
if (access(config.files.forced_config_loc,0) != 0) { // home override does not exist
strcpy(config.files.forced_config_loc, cwd);
strcat(config.files.forced_config_loc, "/config/forced.kbd");
}

/* Default disc images dir:
*/
strcpy(config.files.disc_images_dir, cwd);
strcat(config.files.disc_images_dir, "/discs/");
strcpy(config.files.disc_images_dir, "/media/");

/* Default save state dir:
*/
strcpy(config.files.save_state_dir, cwd);
strcat(config.files.save_state_dir, "/saves/");
strcpy(config.files.save_state_dir, beebem_home_saves); // i.e. ~/.beebem/saves/
strcat(config.files.save_state_dir, "/");

/* Keyboard files archive dir:
*/
strcpy(config.files.kbd_files_dir, cwd);
strcat(config.files.kbd_files_dir, "/kbd/");
strcpy(config.files.kbd_files_dir, beebem_home_kbd); // i.e. ~/.beebem/kbd/
strcat(config.files.kbd_files_dir, "/");

/* Virtual keyboard graphic location:
*/
Expand Down
2 changes: 1 addition & 1 deletion beebem_pages.cc
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ static EG_BOOL Menu_Make(SDL_Surface *frame_buffer_p, BeebEm_Pages *gui_p)
r2.y++;

gui_p->menu.lbl_title = EG_Label_Create("menu_title", title_col
, EG_LABEL_ALIGN_CENTER, "BeebEm for GP2X (" VERSION ")", C_1_1(r2, 1, 2));
, EG_LABEL_ALIGN_CENTER, "BeebEm for RG350 (0.6.2) based on GP2X (" VERSION ")", C_1_1(r2, 1, 2));
(void) EG_Window_AddWidget(gui_p->menu.win, gui_p->menu.lbl_title);

/* Box around list of pages:
Expand Down
12 changes: 12 additions & 0 deletions dist/RG350-README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
=-=-=-=-=-=-=-=-=-=-=
BeebEm - RG350 setup
=-=-=-=-=-=-=-=-=-=-=

* Running beebem at least once will create the ~/.beebem/roms if not already present on your device.

* Put ROMs with _exactly_ these names into ~/.beebem/roms
'acorn_dnfs' - Acorn DNFS 1.2 (chip ID# 201666)
'os12' - Base operating system for BBC Model B (v1.2)
'basic' - BBC Basic Programming Language (v2)

* Put Disk Images, for example SSD files, e.g. into /media/sdcard/ROMS/BEEB/
Binary file added dist/beebem.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 117 additions & 0 deletions dist/config/default.kbd
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# default.kbd
#
# This is the default configuration file that BeebEm loads before any matching
# .kbd file. This file is intended to set defaults between loading disc images.


# Video emulation (both Graphics modes and Teletext):
# ---------------------------------------------------

# GP2x is normal way up (as you'd expect).
SET ORIENTATION=NORMAL

# GP2x is up-side down (thus the buttons Y, A, B & X become a D-Pad):
#SET ORIENTATION=FLIPPED

# Video emulation, TOP = scanlines 0-240, BOTTOM = scanlines 16-255,
# CENTER (or CENTRE) = scanlines 8-248, SCALED = Beeb's 256 scanlines are
# scaled to the GP2x's 240 scanlines (deletes every 16th scanline):
SET VSCALE=SCALED
#SET VSCALE=TOP
#SET VSCALE=BOTTOM
#SET VSCALE=CENTER

# GP2x stick uses smart mode by default:
SET STICK=SMART

# VSYNC offset (you probably don't need to change this):
SET VSYNCOFFSET=NORMAL
# #SET VSYNCOFFSET=NUDGE


# Processing speed:
# -----------------

# Set the GP2x's processor speed. Use 240 for teletext games and 200 for
# everything else, some games clock down, even with sound:

# Default to 200Mhz:
SET SPEED=200

#SET SPEED=150
#SET SPEED=160
#SET SPEED=170
#SET SPEED=180
#SET SPEED=190
#SET SPEED=200
#SET SPEED=210
#SET SPEED=220
#SET SPEED=230
#SET SPEED=240


# 8271 floppy discs:
# ------------------

# RO = Read Only, RW=Read Write.

# First floppy drive (0):
SET FD0_TAB=RO
#SET FD0_TAB=RW

# Second floppy drive (1):
SET FD1_TAB=RO
#SET FD1_TAB=RW

# Disable the hardware cursor always: '1', 'YES', 'TRUE', 'Y' equals a positive,
# everything else is considered a negative:
SET DISABLE_CURSOR=NO
#SET DISABLE_CURSOR=YES

# Default keys:
# -------------

# NOTHING = key is not mapped.
# VOLUME = key controls volume (only works on the actual volume buttons).

# Normal screen orientation:
LEFT=BBC_Z
RIGHT=BBC_X
UP=BBC_:
DOWN=BBC_/
CLICK=NOTHING

A=BBC_SPACE
B=BBC_SPACE
X=BBC_RETURN
Y=BBC_RETURN

SELECT=BBC_ESCAPE

VOLUP=VOLUME
VOLDOWN=VOLUME

L=NOTHING
R=NOTHING


# Flipped screen orientation:
R_LEFT=BBC_X
R_RIGHT=BBC_Z
R_UP=BBC_/
R_DOWN=BBC_:
R_CLICK=NOTHING

R_A=BBC_X
R_B=BBC_Z
R_X=BBC_:
R_Y=BBC_/

R_SELECT=ESCAPE

R_L=NOTHING
R_R=NOTHING

R_VOLUP=BBC_SPACE
R_VOLDOWN=BBC_RETURN

13 changes: 13 additions & 0 deletions dist/config/forced.kbd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# forced.kbd
#
# This kbd mapping file is loaded AFTER a matching disc image mapping file (if
# one is found). So these options override EVERYTHING! Use with care!


# One possible use for this would be to force BeebEm to NEVER start up with
# sound (no matter what old mapping files say)!
#SET VOLUME=0

# Disable the hardware cursor always.
#SET DISABLE_CURSOR=1
#
3 changes: 3 additions & 0 deletions dist/config/romimg.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
OS os12
ROM basic 0xf
ROM acorn_dnfs 0xd
Loading

0 comments on commit ab1f647

Please sign in to comment.