From d3cb9bd1b83971e37df108c080300e2ba1706c00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Strohh=C3=A4cker?= Date: Sun, 14 Jan 2007 18:44:01 +0000 Subject: [PATCH] different PCJr cart loading supported Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2764 --- include/bios.h | 2 + src/dos/dos_programs.cpp | 206 ++++++++++++++++++++++++++++++++++----- src/hardware/memory.cpp | 9 +- src/ints/bios_disk.cpp | 3 +- 4 files changed, 194 insertions(+), 26 deletions(-) diff --git a/include/bios.h b/include/bios.h index 39b06531..66b09ba4 100644 --- a/include/bios.h +++ b/include/bios.h @@ -107,6 +107,8 @@ /* The Section handling Bios Disk Access */ #define BIOS_MAX_DISK 10 +#define MAX_SWAPPABLE_DISKS 20 + struct diskGeo { Bit32u ksize; /* Size in kilobytes */ Bit16u secttrack; /* Sectors per track */ diff --git a/src/dos/dos_programs.cpp b/src/dos/dos_programs.cpp index 76f9c5af..285c5baf 100644 --- a/src/dos/dos_programs.cpp +++ b/src/dos/dos_programs.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_programs.cpp,v 1.64 2007-01-08 19:45:39 qbix79 Exp $ */ +/* $Id: dos_programs.cpp,v 1.65 2007-01-14 18:44:01 c2woody Exp $ */ #include #include @@ -356,7 +356,7 @@ extern Bit32u floppytype; class BOOT : public Program { private: - FILE *getFSFile(Bit8u * filename, Bit32u *ksize, Bit32u *bsize) { + FILE *getFSFile(Bit8u * filename, Bit32u *ksize, Bit32u *bsize,bool tryload=false) { Bit8u drive; FILE *tmpfile; char fullname[DOS_PATHLENGTH]; @@ -370,13 +370,13 @@ private: tmpfile = ldp->GetSystemFilePtr(fullname, "r"); if(tmpfile == NULL) { - WriteOut(MSG_Get("PROGRAM_BOOT_NOT_EXIST")); + if (!tryload) WriteOut(MSG_Get("PROGRAM_BOOT_NOT_EXIST")); return NULL; } fclose(tmpfile); tmpfile = ldp->GetSystemFilePtr(fullname, "rb+"); if(tmpfile == NULL) { - WriteOut(MSG_Get("PROGRAM_BOOT_NOT_OPEN")); + if (!tryload) WriteOut(MSG_Get("PROGRAM_BOOT_NOT_OPEN")); return NULL; } @@ -411,10 +411,14 @@ private: public: void Run(void) { - FILE *usefile; + FILE *usefile_1=NULL; + FILE *usefile_2=NULL; Bitu i; - Bit32u floppysize, rombytesize; + Bit32u floppysize; + Bit32u rombytesize_1=0; + Bit32u rombytesize_2=0; Bit8u drive; + std::string cart_cmd=""; if(!cmd->GetCount()) { printError(); @@ -442,12 +446,33 @@ public: continue; } + if((temp_line == "-e") || (temp_line == "-E")) { + /* Command mode for PCJr cartridges */ + i++; + if(cmd->FindCommand(i+1, temp_line)) { + for(size_t i=0;i0x1000) break; + clen=rombuf[ct]; + } + if (ct>6) { + WriteOut(MSG_Get("PROGRAM_BOOT_CART_LIST_CMDS"),cmdlist); + } else { + WriteOut(MSG_Get("PROGRAM_BOOT_CART_NO_CMDS")); + } + for(Bitu dct=0;dct0x1000) break; + clen=rombuf[ct]; + } + if (cfound_at<=0) { + if (ct>6) { + WriteOut(MSG_Get("PROGRAM_BOOT_CART_LIST_CMDS"),cmdlist); + } else { + WriteOut(MSG_Get("PROGRAM_BOOT_CART_NO_CMDS")); + } + for(Bitu dct=0;dct0) { + /* run cartridge setup */ + SegSet16(ds,dos.psp()); + SegSet16(es,dos.psp()); + CALLBACK_RunRealFar(romseg,cfound_at); + } else { + for(Bitu dct=0;dct