Added ZX Interface II Rom cartridge loading feature

This commit is contained in:
fabio.olimpieri 2014-05-04 16:03:00 +00:00
parent 2596ca34ab
commit 337799cccb
8 changed files with 46 additions and 8 deletions

View File

@ -116,6 +116,7 @@ dist: $(BUILD)
mkdir -p $@/fbzx-wii/spectrum-roms
mkdir -p $@/fbzx-wii/tapes
mkdir -p $@/fbzx-wii/snapshots
mkdir -p $@/fbzx-wii/snapshots/rom-cartridges
mkdir -p $@/fbzx-wii/microdrives
mkdir -p $@/fbzx-wii/scr
mkdir -p $@/fbzx-wii/scr2
@ -145,6 +146,7 @@ dist: $(BUILD)
cp AMSTRAD CAPABILITIES COPYING FAQ README README.TZX VERSIONS VERSIONS.wii $@/apps/fbzx-wii/doc
touch $@/fbzx-wii/tapes/dummy
touch $@/fbzx-wii/snapshots/dummy
touch $@/fbzx-wii/snapshots/rom-cartridges/dummy
touch $@/fbzx-wii/microdrives/dummy
touch $@/fbzx-wii/scr/dummy
touch $@/fbzx-wii/scr2/dummy

View File

@ -126,6 +126,7 @@ dist: $(BUILD)
mkdir -p $@/fbzx-wii/spectrum-roms
mkdir -p $@/fbzx-wii/tapes
mkdir -p $@/fbzx-wii/snapshots
mkdir -p $@/fbzx-wii/snapshots/rom-cartridges
mkdir -p $@/fbzx-wii/microdrives
mkdir -p $@/fbzx-wii/scr
mkdir -p $@/fbzx-wii/scr2
@ -155,6 +156,7 @@ dist: $(BUILD)
cp AMSTRAD CAPABILITIES COPYING FAQ README README.TZX VERSIONS VERSIONS.wii README_WIN.txt $@/fbzx-wii/doc
touch $@/fbzx-wii/tapes/dummy
touch $@/fbzx-wii/snapshots/dummy
touch $@/fbzx-wii/snapshots/rom-cartridges/dummy
touch $@/fbzx-wii/microdrives/dummy
touch $@/fbzx-wii/scr/dummy
touch $@/fbzx-wii/scr2/dummy

View File

@ -1,5 +1,5 @@
FBZX Wii was written to run on WII, for testing purpose FBZX Wii was adapted
to run also on Windows. Anyhow the windows version is yet usable.
to run also on Windows even if some WII features cannot be used.
These are the basic instructions:
@ -20,7 +20,8 @@ FBZX WII Menu
Menu key (it is the key near CTRL Rigth) or gamepad 7 key to access FBZX Wii menu.
Left ALT key to toggle Full Screen.
The virtual keyboard is accessed passing the mouse on the screen or through CTRL Rigth or gamepad button 6 (if depends on the selected option).
The virtual keyboard is accessed passing the mouse on the screen or through CTRL Rigth
or gamepad button 6 (it depends on the auto virtual ketboard option).
* In menu
Gamepad pad or keyboard keys for menu navigation.
@ -47,7 +48,7 @@ Gamepad -------- WII
******************
Original FBZX Menu
******************
F1-F12 to access the original FBZX (not Wii) menu (not all the features are available here).
F1-F12 to access the original FBZX menu (not all the features are available here).
F1 key to access FBZX help menu.

View File

@ -178,6 +178,8 @@ void computer_init () { //Called only on start-up
ordenador.npixels=4;
ordenador.progressive=0;
ordenador.audio_mode=2; //ACB
rom_cartridge[0] = 0;
}
void computer_set_palete() {
@ -1725,7 +1727,9 @@ void ResetComputer () {
Z80free_reset (&procesador);
load_rom (ordenador.mode128k);
rom_cartridge[0] = 0;
// reset the AY-3-8912
for (bucle = 0; bucle < 16; bucle++)

View File

@ -79,6 +79,7 @@ char load_path_snaps[MAX_PATH_LENGTH];
char load_path_taps[MAX_PATH_LENGTH];
char load_path_scr1[MAX_PATH_LENGTH];
char load_path_poke[MAX_PATH_LENGTH];
char rom_cartridge[MAX_PATH_LENGTH];
unsigned int colors[80];
unsigned int jump_frames,curr_frames, turbo_n;
@ -366,6 +367,23 @@ char *load_a_rom(char **filenames) {
return (NULL);
}
char *load_rom_cartridge(void) {
FILE *fichero;
int size;
printf("Opening %s\n", rom_cartridge);
fichero=fopen(rom_cartridge,"rb");
if(fichero==NULL) {
return (rom_cartridge);
}
size=fread(ordenador.memoria,1,16384,fichero);
if (size != 16384) return (rom_cartridge);
fclose(fichero);
return (0);
}
void load_rom(char type) {
char *retval;
@ -377,7 +395,7 @@ void load_rom(char type) {
case 0:
filenames[0]="spectrum-roms/48.rom";
filenames[1]=NULL;
retval=load_a_rom(filenames);
if (rom_cartridge[0]) retval = load_rom_cartridge(); else retval=load_a_rom(filenames);
if (retval) {
printf("Can't load file %s\n",retval);
exit(1);

View File

@ -44,6 +44,7 @@ extern char load_path_snaps[MAX_PATH_LENGTH];
extern char load_path_taps[MAX_PATH_LENGTH];
extern char load_path_scr1[MAX_PATH_LENGTH];
extern char load_path_poke[MAX_PATH_LENGTH];
extern char rom_cartridge[MAX_PATH_LENGTH];
extern unsigned int colors[80];
extern unsigned int jump_frames,curr_frames, turbo_n;

View File

@ -1665,7 +1665,17 @@ static int save_load_snapshot(int which)
if (!filename)
return 0;
//Load ROM Cartridge
if ((ext_matches(filename, ".rom")|ext_matches(filename, ".ROM"))&(which == 0))
{
set_machine_model(0);
strcpy(rom_cartridge, filename);
free((void*)filename);
ResetComputer ();
return -1;
}
if (ext_matches(filename, ".z80")|ext_matches(filename, ".Z80")|
ext_matches(filename, ".sna")|ext_matches(filename, ".SNA"))
{

View File

@ -317,7 +317,7 @@ static const char **get_file_list_zip(const char *path)
}
const char *exts[] = {".tap", ".TAP", ".tzx", ".TZX", ".z80",".Z80",".sna", ".SNA",
".mdr", ".MDR", ".scr", ".SCR", ".conf", ".CONF",".pok", ".POK" ,NULL};
".mdr", ".MDR", ".scr", ".SCR", ".conf", ".CONF",".pok", ".POK" ,".rom", ".ROM", NULL};
if (ext_matches_list(filename_inzip, exts))
{
@ -369,7 +369,7 @@ static const char **get_file_list(const char *base_dir)
{
char buf[255];
const char *exts[] = {".tap", ".TAP", ".tzx", ".TZX", ".z80",".Z80",".sna", ".SNA",
".mdr", ".MDR", ".scr", ".SCR", ".conf", ".CONF",".pok", ".POK", ".zip", ".ZIP",NULL};
".mdr", ".MDR", ".scr", ".SCR", ".conf", ".CONF",".pok", ".POK", ".zip", ".ZIP",".rom", ".ROM",NULL};
struct stat st;
snprintf(buf, 255, "%s/%s", base_dir, de->d_name);