obj/m68kopdm.o \
obj/m68kopnz.o \
obj/m68kdasm.o \
+\
+ obj/gui.o \
+\
obj/blitter.o \
obj/cdrom.o \
obj/cdintf.o \
obj/event.o \
obj/file.o \
obj/gpu.o \
- obj/gui.o \
obj/jagdasm.o \
obj/jaguar.o \
obj/jerry.o \
@echo "*** Compiling $<..."
@$(CC) $(CPPFLAGS) $(INCS) -c $< -o $@
+obj/%.o: src/gui/%.cpp
+ @echo "*** Compiling $<..."
+ @$(CC) $(CPPFLAGS) $(INCS) -c $< -o $@
+
$(TARGET)$(EXESUFFIX): $(OBJS)
@echo "*** Linking it all together..."
@$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
- ZLIB v1.2.3
- libcdio v0.80 or higher
- OpenGL libraries
-- supported OS (BeOS, Linux, FreeBSD and WIN32 through mingw); other OSs may
- work to but you may need to change some items in the Makefile.
+- supported OS (BeOS, Linux, FreeBSD and WIN32 through mingw, MacOS); other OSs
+ may work to but you may need to change some items in the Makefile.
Optionally you need a Atari Jaguar boot ROM (and/or CD boot ROM) which is
available on the Internet. We can't include the boot ROM since it's still
+++ /dev/null
-//
-// OS specific CDROM interface (linux)
-//
-// by James L. Hammons and Niels Wagenaar
-//
-// NOTE : This CD-ROM code *could* work with other UN*X related OS. However,
-// we/I are not sure on this matter.
-//
-// This is very experimental and I have the feeling that this won't even compile.
-// Hell, I don't even have a Linux dev system (broken) or Jaguar CD releases to
-// test this code :(
-//
-// Big thanks to the DOSBOX team which provided us with great knowlegde about
-// CD-ROM access and Linux/UN*X.
-
-#ifdef LINUX_JAGUAR_CDROM
-
-// *** OS dependent CDROM stuffola ***
-#include <fcntl.h>
-#include <unistd.h>
-#include <linux/cdrom.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-// *** End OS dependent ***
-#include "log.h"
-#include "string.h"
-
-// *** Virtual Jaguar dependent ***
-//#include "SDL.h" // Yes, we use SDL for initializing the CD-ROM and
-// // give us access to certain CD-ROM states. But not just yet.
-
-// *** SDL CD-ROM dependent *** // Not yet needed!
-// SDL_CD *cdrom; // Our variable for SDL CD-ROM access.
-// CDstatus status; // Let us get our status.
-// char *status_str;
-
-// *** Local variables ***
-char device_name[512] ; // Devicename, for example /dev/cdrom
-
-//
-// Linux support functions
-// OS specific implementation of OS agnostic functions
-//
-
-bool CDIntfInit(void)
-{
- // Setting device_name to /deb/cdrom. /dev/cdrom is the default CD-ROM
- // drive on most UN*X systems. Well, I think it is.
- //
- // In the future we can probably use SDL for getting CDROM states and
- // CD-ROM specific information.
- strcpy(device_name, "/dev/cdrom");
-
- // Let us open the device_name and check if we can open the CD-ROM.
- int cdrom_fd = open(device_name, O_RDONLY | O_NONBLOCK);
-
- if (cdrom_fd <= 0)
- {
- // CD-ROM isn't accessable.
- // Write the error in the log file and return false.
- WriteLog("CDINTF: CDIntfInit - Unable to open CDROM!\n");
- return false;
- }
- else
- {
- // CD-ROM is accessable.
- // Write the success in the log file and return true.
- WriteLog("CDINTF: CDIntfInit - Succesfully opened CDROM!\n");
- close(device_name);
- return true;
- }
-
-}
-
-void CDIntfDone(void)
-{
- // Just in case : closing device_name.
- WriteLog("CDINTF: CDIntfDone - Closing CDROM!\n");
- close(device_name);
-}
-
-bool CDIntfReadBlock(uint32 sector, uint8 * buffer)
-{
- unsigned int buflen = CD_FRAMESIZE_RAW; // Raw read, 2352 bytes per sector
- //unsigned char *buf = new unsigned int[buflen]; // DOSBOX, do we need this?
- int ret;
- struct cdrom_read cdrom_read;
-
- // Let us open the device_name and check if we can open the CD-ROM.
- int cdrom_fd = open(device_name, O_RDONLY | O_NONBLOCK);
- if (cdrom_fd <= 0)
- {
- // CD-ROM isn't accessable.
- // Write the error in the log file and return false.
- WriteLog("CDINTF: CDIntfReadBlock - Unable to open CDROM!\n");
- return false;
- }
-
- // Setting up the cdrom_read struct :
- cdrom_read.cdread_lba = sector; // Which sector to read.
- cdrom_read.cdread_bufaddr = (char*)buffer; // Where to put the data (?)
- cdrom_read.cdread_buflen = buflen; // 2352 bytes/sector -> RAW read
-
- // Let us read the content we want. -1 (false) when it didn't work.
- ret = ioctl(cdrom_fd, CDROMREADRAW, &cdrom_read);
-
- // Close the CD-ROM.
- close(cdrom_fd);
-
- // The following was taken from DOSBOX. After reading the content, they write
- // back the information from buf (based upon the size of buflen) to buffer.
- // I think that this is not needed. *fingers crossed*
- //
- // MEM_BlockWrite(buffer, buf, buflen);
- // delete[] buf;
-
- // Uncomment the following for debug reasons.
- //
- // WriteLog("CDINTF: CDIntfReadBlock - Reading sector %d!\n", sector);
-
- return (ret > 0);
-
-}
-
-uint32 CDIntfGetNumSessions(void)
-{
- // Still need relevant code here...
- return 2;
-}
-
-void CDIntfSelectDrive(uint32 driveNum)
-{
- WriteLog("CDINTF: SelectDrive unimplemented!\n");
-}
-
-uint32 CDIntfGetCurrentDrive(void)
-{
- WriteLog("CDINTF: GetCurrentDrive unimplemented!\n");
- return 0;
-}
-
-const uint8 * CDIntfGetDriveName(uint32)
-{
- WriteLog("CDINTF: GetDriveName unimplemented!\n");
- return NULL;
-}
-
-uint8 CDIntfGetSessionInfo(uint32 session, uint32 offset)
-{
- WriteLog("CDINTF: GetSessionInfo unimplemented!\n");
- return 0xFF;
-}
-
-uint8 CDIntfGetTrackInfo(uint32 track, uint32 offset)
-{
- WriteLog("CDINTF: GetTrackInfo unimplemented!\n");
- return 0xFF;
-}
-
-#else
-
-#include "log.h"
-
-//
-// Linux support functions
-// OS specific implementation of OS agnostic functions
-//
-
-bool CDIntfInit(void)
-{
- WriteLog("CDINTF: Init unimplemented!\n");
- return false;
-}
-
-void CDIntfDone(void)
-{
-}
-
-bool CDIntfReadBlock(uint32 sector, uint8 * buffer)
-{
- WriteLog("CDINTF: ReadBlock unimplemented!\n");
- return false;
-}
-
-uint32 CDIntfGetNumSessions(void)
-{
- // Still need relevant code here... !!! FIX !!!
- return 2;
-}
-
-void CDIntfSelectDrive(uint32 driveNum)
-{
- WriteLog("CDINTF: SelectDrive unimplemented!\n");
-}
-
-uint32 CDIntfGetCurrentDrive(void)
-{
- WriteLog("CDINTF: GetCurrentDrive unimplemented!\n");
- return 0;
-}
-
-const uint8 * CDIntfGetDriveName(uint32)
-{
- WriteLog("CDINTF: GetDriveName unimplemented!\n");
- return NULL;
-}
-
-uint8 CDIntfGetSessionInfo(uint32 session, uint32 offset)
-{
- WriteLog("CDINTF: GetSessionInfo unimplemented!\n");
- return 0xFF;
-}
-
-uint8 CDIntfGetTrackInfo(uint32 track, uint32 offset)
-{
- WriteLog("CDINTF: GetTrackInfo unimplemented!\n");
- return 0xFF;
-}
-#endif
+++ /dev/null
-//
-// OS specific CDROM interface (Mac OS X)
-//
-// by James L. Hammons & ?
-//
-
-#include "log.h"
-
-//
-// OS X support functions
-// OS specific implementation of OS agnostic functions
-//
-
-bool CDIntfInit(void)
-{
- WriteLog("CDINTF: Init unimplemented!\n");
- return false;
-}
-
-void CDIntfDone(void)
-{
-}
-
-bool CDIntfReadBlock(uint32 sector, uint8 * buffer)
-{
- WriteLog("CDINTF: ReadBlock unimplemented!\n");
- return false;
-}
-
-uint32 CDIntfGetNumSessions(void)
-{
- // Still need relevant code here... !!! FIX !!!
- return 2;
-}
-
-void CDIntfSelectDrive(uint32 driveNum)
-{
- WriteLog("CDINTF: SelectDrive unimplemented!\n");
-}
-
-uint32 CDIntfGetCurrentDrive(void)
-{
- WriteLog("CDINTF: GetCurrentDrive unimplemented!\n");
- return 0;
-}
-
-const uint8 * CDIntfGetDriveName(uint32)
-{
- WriteLog("CDINTF: GetDriveName unimplemented!\n");
- return NULL;
-}
-
-uint8 CDIntfGetSessionInfo(uint32 session, uint32 offset)
-{
- WriteLog("CDINTF: GetSessionInfo unimplemented!\n");
- return 0xFF;
-}
-
-uint8 CDIntfGetTrackInfo(uint32 track, uint32 offset)
-{
- WriteLog("CDINTF: GetTrackInfo unimplemented!\n");
- return 0xFF;
-}
+++ /dev/null
-//
-// OS specific CDROM interface (Win32)
-//
-// by James L. Hammons
-//
-// Currently, we use the ASPI layer for Win32, but this may or may not
-// work on NT based Windows. If necessary, we'll put in the required
-// NT based code, but for now, it's ASPI or nothing.
-//
-
-// STILL TO DO:
-//
-// - Convert this shit to platform independent libcdio
-//
-
-// *** OS dependent CDROM stuffola ***
-#include <windows.h>
-#include "wnaspi32.h"
-#include "scsidefs.h"
-// *** End OS dependent ***
-#include "log.h"
-
-using namespace std;
-
-// Local variables
-
-static uint8 maxHostAdapters = 0, numCDDrives = 0, driveNum;
-static uint8 haID[8], tID[8];
-static uint8 driveName[8][26];
-static uint8 tracks[100][3]; // One-based index
-static uint32 numTracks = 0;
-static uint8 sessions[40][5]; // Zero-based index
-static uint32 numSessions = 0;
-static bool readTOC = false;
-
-static HINSTANCE hASPILib = NULL; // Handle to ASPI for Win32 (WNASPI.DLL)
-static uint32 (* ASPI_GetASPI32SupportInfo)(void); // WNASPI.DLL function pointers
-static uint32 (* ASPI_SendASPI32Command)(LPSRB);
-
-// Private function prototypes
-
-static bool InitASPI(void);
-static bool SendAsyncASPICmd(uint8, uint8, uint8 *, uint8, uint8 *, uint32, uint8);
-/*static*/ bool GetRawTOC(void);
-
-
-//
-// Initialize the Win32 ASPI layer
-//
-static bool InitASPI(void)
-{
- hASPILib = LoadLibrary("WNASPI32");
-
- if (!hASPILib)
- {
- WriteLog("CDINTF: Could not load WNASPI32.DLL!\n");
- return false;
- }
-
- ASPI_GetASPI32SupportInfo = (uint32 (*)(void))GetProcAddress(hASPILib, "GetASPI32SupportInfo");
- ASPI_SendASPI32Command = (uint32 (*)(LPSRB))GetProcAddress(hASPILib, "SendASPI32Command");
-
- if (!ASPI_GetASPI32SupportInfo || !ASPI_SendASPI32Command)
- {
- WriteLog("CDINTF: Could not import functions from WNASPI32.DLL!\n");
- return false;
- }
-
- uint32 supportInfo = ASPI_GetASPI32SupportInfo(); // Initialize ASPI layer
- uint8 retCode = (supportInfo >> 8) & 0xFF;
- maxHostAdapters = supportInfo & 0xFF;
-
- if (retCode != SS_COMP && retCode != SS_NO_ADAPTERS)
- {
- WriteLog("CDINTF: Could not initialise using GetASPI32SupportInfo function!\n");
- return false;
- }
-
- if (retCode == SS_NO_ADAPTERS)
- {
- WriteLog("CDINTF: ASPI initialized, but no host adapters were found!\n");
- return false;
- }
-
-/* // Set timeouts for ALL devices to 15 seconds. Nothing we deal with should
- // take that long to do ANYTHING. We are just doing inquiries to most
- // devices, and then simple reads to CDs, disks, etc. so 10 seconds (even
- // if they have to spin up) should be plenty.
-
- SRB_GetSetTimeouts srbTimeouts;
-//This doesn't seem to do anything, and isn't even mentioned in Adaptec's ASPI paper...
-//(It *is* mentioned elsewhere, in other Adaptec documentation, and it does nothing because it
-// errors out!)
-//It *does* return code $81 (SS_INVALID_HA) which means it doesn't like $FF for the HAID...
-//OK, it works with Adaptec's driver, but not the default MS driver...
-//Looks like we really don't need it anyway.
-//If we really wanted to, we could do it in CDIntfInit()...!
- memset(&srbTimeouts, 0, sizeof(SRB_GetSetTimeouts));
- srbTimeouts.SRB_Cmd = SC_GETSET_TIMEOUTS;
- srbTimeouts.SRB_Flags = SRB_DIR_OUT;
- srbTimeouts.SRB_HaId = 0xFF;
- srbTimeouts.SRB_Target = 0xFF;
- srbTimeouts.SRB_Lun = 0xFF;
- srbTimeouts.SRB_Timeout = 15 * 2;
- ASPI_SendASPI32Command(&srbTimeouts);
- WriteLog("CDINTF: Set Timeout command returned %02X...\n", srbTimeouts.SRB_Status);//*/
-
- WriteLog("CDINTF: Successfully initialized.\n");
- return true;
-}
-
-//
-// Sends the passed in Command Description Block to the APSI layer for processing.
-// Since this uses the asynchronous EXEC_SCSI_CMD, we also wait for completion by
-// using a semaphore.
-//
-static bool SendAsyncASPICmd(uint8 hostID, uint8 targID, uint8 * cdb, uint8 CDBLen,
- uint8 * buffer, uint32 bufferLen, uint8 SRBFlags)
-{
- SRB_ExecSCSICmd SRB; // The SRB variable with CDB included
-
- memset(&SRB, 0, sizeof(SRB));
- memcpy(SRB.CDBByte, cdb, CDBLen); // Copy CDB into SRB's CDB
-
- SRB.SRB_Cmd = SC_EXEC_SCSI_CMD;
- SRB.SRB_Flags = SRBFlags | SRB_EVENT_NOTIFY;
- SRB.SRB_HaId = hostID;
- SRB.SRB_Target = targID;
- SRB.SRB_BufPointer = buffer;
- SRB.SRB_BufLen = bufferLen;
- SRB.SRB_CDBLen = CDBLen;
- SRB.SRB_SenseLen = SENSE_LEN;
-
- HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
-
- if (!hEvent)
- {
- WriteLog("CDINTF: Couldn't create event!\n");
- return false;
- }
-
- SRB.SRB_PostProc = (void *)hEvent;
- ASPI_SendASPI32Command(&SRB);
-
- if (SRB.SRB_Status == SS_PENDING)
- WaitForSingleObject(hEvent, INFINITE);
-
- CloseHandle(hEvent);
-
- if (SRB.SRB_Status != SS_COMP)
- {
- WriteLog("CDINTF: SCSI command %02X failed [Error: %02X].\n", SRB.CDBByte[0], SRB.SRB_Status);
- return false;
- }
-
- return true;
-}
-
-//
-// OS specific implementation of OS agnostic functions
-//
-
-bool CDIntfInit(void)
-{
- if (!InitASPI())
- {
- WriteLog("CDINTF: Failed to init Win32 ASPI layer!\n");
- return false;
- }
-
- SRB_HAInquiry srbHAInquiry;
- SRB_GDEVBlock srbGDEVBlock;
- uint8 inquiryCDB[6], inquiryBuf[36];
-
- for(uint8 HAID=0; HAID<maxHostAdapters; HAID++)
- {
- memset(&srbHAInquiry, 0, sizeof(srbHAInquiry));
- srbHAInquiry.SRB_Cmd = SC_HA_INQUIRY;
- srbHAInquiry.SRB_HaId = HAID;
-
- ASPI_SendASPI32Command(&srbHAInquiry);
-
- if (srbHAInquiry.SRB_Status != SS_COMP)
- continue;
-
- // Do a host adapter inquiry to get max target count. If the
- // target count isn't 8 or 16 then go with a default of 8.
-
- uint8 maxTargets = srbHAInquiry.HA_Unique[3];
- if (maxTargets != 8 && maxTargets != 16)
- maxTargets = 8;
-
- // Loop over all the targets on this host adapter.
-
- for(uint8 target=0; target<maxTargets; target++)
- {
- // Issue get device type call to see if there is a device we're
- // interested in at this address. We're interested in CDROMs.
-
- memset(&srbGDEVBlock, 0, sizeof(srbGDEVBlock));
- srbGDEVBlock.SRB_Cmd = SC_GET_DEV_TYPE;
- srbGDEVBlock.SRB_HaId = HAID;
- srbGDEVBlock.SRB_Target = target;
-
- ASPI_SendASPI32Command(&srbGDEVBlock);
-
- if (srbGDEVBlock.SRB_Status != SS_COMP || srbGDEVBlock.SRB_DeviceType != DTYPE_CDROM)
- continue;
-
- memset(inquiryCDB, 0, 6); // Issue an INQUIRY.
- inquiryCDB[0] = SCSI_INQUIRY;
- inquiryCDB[4] = 36; // Size in bytes of inquiry buffer.
-
- bool successful = SendAsyncASPICmd(HAID, target, inquiryCDB, 6, inquiryBuf, 36, SRB_DIR_IN);
-
- // Make sure the inquiry worked. Check if it failed, or if the inquiry data
- // returns a different device type than we got before (guards against certain
- // device drivers and against vendor unique devices).
-
- if (!successful || inquiryBuf[0] != DTYPE_CDROM)
- continue;
-
- haID[numCDDrives] = HAID, tID[numCDDrives] = target;
-
- // Here we do a 'stringTrimRight' on the vendor and product strings...
-
- uint32 vendorSize = 0, productSize = 0;
-
- for(int i=7; i>=0; i--)
- {
- if (inquiryBuf[8+i] != ' ')
- {
- vendorSize = i + 1;
- break;
- }
- }
-
- for(int i=15; i>=0; i--)
- {
- if (inquiryBuf[16+i] != ' ')
- {
- productSize = i + 1;
- break;
- }
- }
-
- memcpy(driveName[numCDDrives], inquiryBuf + 8, vendorSize);
- driveName[numCDDrives][vendorSize] = ' ';
- memcpy(driveName[numCDDrives] + vendorSize + 1, inquiryBuf + 16, productSize);
- driveName[numCDDrives][vendorSize + productSize + 1] = 0;
-
- WriteLog("CDINTF: Found CD-ROM device [%s]. HAID:%u, TID:%u LUN:0\n", driveName[numCDDrives], haID[numCDDrives], tID[numCDDrives]);
-
- numCDDrives++;
- }
- }
-
- if (numCDDrives == 0)
- {
- WriteLog("CDINTF: No CDROM type drives found.\n");
- return false;
- }
-
-//Most likely, will need to read a default out of the config file. But for now... !!! FIX !!!
- driveNum = 0; // For now, default to first drive found
-
- return true;
-}
-
-void CDIntfDone(void)
-{
- if (hASPILib)
- FreeLibrary(hASPILib); // Unload ASPI library if it was loaded.
-}
-
-bool CDIntfReadBlock(uint32 sector, uint8 * buffer)
-{
- uint8 cdb[12];
-
- memset(cdb, 0, sizeof(cdb));
- // 0: command, 2-5: block # (hi->lo) 6-8: number of blocks to read, 9: read type,
- // 10: subchannel select
- cdb[0] = 0xBE; // Code for ReadCD CDB12 command
- cdb[2] = (sector >> 24) & 0xFF;
- cdb[3] = (sector >> 16) & 0xFF;
- cdb[4] = (sector >> 8) & 0xFF;
- cdb[5] = sector & 0xFF;
- cdb[8] = 1; // No. of sectors to read from CD (LSB)
- cdb[9] = 0xF8; // Raw read, 2352 bytes per sector
- cdb[10] = 1; // Selects read RAW 96 bytes/sector sub-channel data (Raw P-W)
-
- return SendAsyncASPICmd(haID[driveNum], tID[driveNum], cdb, 12, buffer, 2352+96, SRB_DIR_IN);
-}
-
-uint32 CDIntfGetNumSessions(void)
-{
-// WriteLog("CDINTF: GetNumSessions unimplemented!\n");
- // Still need relevant code here... !!! FIX !!! [DONE]
- if (!readTOC)
- GetRawTOC();
-
- return numSessions - 1;
-}
-
-void CDIntfSelectDrive(uint32 driveNum)
-{
- if (driveNum < numCDDrives)
- driveNum = driveNum;
-}
-
-uint32 CDIntfGetCurrentDrive(void)
-{
- return driveNum;
-}
-
-const uint8 * CDIntfGetDriveName(uint32 driveNum)
-{
- if (driveNum > numCDDrives)
- return NULL;
-
- return driveName[driveNum];
-}
-
-//This stuff could probably be OK in the unified cdintf.cpp file...
-uint8 CDIntfGetSessionInfo(uint32 session, uint32 offset)
-{
-// Need better error handling than this... !!! FIX !!!
- if (!readTOC)
- if (!GetRawTOC())
- return 0xFF;
-
- if (session >= numSessions || offset > 4)
- return 0xFF; // Bad index passed in...
-
- return sessions[session][offset];
-}
-
-uint8 CDIntfGetTrackInfo(uint32 track, uint32 offset)
-{
-// Need better error handling than this... !!! FIX !!!
- if (!readTOC)
- if (!GetRawTOC())
- return 0xFF;
-
- if (track > numTracks || offset > 2)
- return 0xFF; // Bad index passed in...
-
- return tracks[track][offset];
-}
-
-//OK, now the rest is OK, but this is still locking up like a MF!
-// Testing, testing...
-//Still don't know why this is locking up! Especially as the following function works! Aarrrgggghhhhh!
-//It was the dataLen. For some reason, it needs at *least* 11 more bytes (could be less!)
-/*static*/ bool GetRawTOC(void)
-{
- uint8 cmd[10];
- uint8 reqData[4];
-
- // Read disk TOC length
- memset(cmd, 0, 10);
- cmd[0] = SCSI_READ_TOC;
- cmd[2] = 2; // Get session info also
- cmd[6] = 1; // Session # to start reading
- cmd[8] = 4; // Buffer length
-
- if (!SendAsyncASPICmd(haID[driveNum], tID[driveNum], cmd, 10, reqData, 4, SRB_DIR_IN))
- {
- WriteLog("TOC: Cannot read disk TOC length.\n");
- return false;
- }
-
- // Header is total TOC space needed + header (0-1), min session (2), max session (3)
-// uint32 dataLen = ((reqData[0] << 8) | reqData[1]);
- uint32 dataLen = ((reqData[0] << 8) | reqData[1]) + 11; // Why the extra???
-
- WriteLog("TOC: Raw TOC data len: %d\n", dataLen);
-
- uint8 * data = new uint8[dataLen];
-
- // Read disk TOC
- cmd[7] = dataLen >> 8;
- cmd[8] = dataLen;
-
- if (!SendAsyncASPICmd(haID[driveNum], tID[driveNum], cmd, 10, data, dataLen, SRB_DIR_IN))
- {
- delete[] data;
- WriteLog("TOC: Cannot read disk TOC.\n");
- return false;
- }
-
- int numEntries = (((data[0] << 8) | data[1]) - 2) / 11;
- uint8 * p = data + 4;
-
- numSessions = data[3], numTracks = 0;
- // Important entries are 0, 3, 8, 9, 10 (session #, track #, M, S, F)
-// WriteLog("TOC: [Sess] [adrCtl] [?] [point] [?] [?] [?] [?] [pmin] [psec] [pframe]\n");
- uint32 firstTrackOffset = 0;
- for(int i=0; i<numEntries; i++, p+=11)
- {
-/* WriteLog("TOC: %d %02x %02d %2x %02d:%02d:%02d %02d %02d:%02d:%02d",
- p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10]);
-
- if (p[3] > 0 && p[3] < 99)
- WriteLog(" <-- Track #%u", p[3]);
-
- WriteLog("\n");//*/
-
- // We do session # - 1 to make it zero-based, since this is what the Jaguar
- // CD BIOS expects. We leave the tracks one-based.
-
- uint32 s = p[0] - 1, t = p[3];
-
- if (t < 100)
- {
- if (t == 1)
- firstTrackOffset = (((p[8] * 60) + p[9]) * 75) + p[10];
-
- tracks[t][0] = p[8], tracks[t][1] = p[9], tracks[t][2] = p[10];
-
- // For some reason, the TOC returned from the "session TOC" command
- // causes all tracks to have a 150 block (from what I've seen) offset
- // from what's reported. Apparently it's not possible to read those
- // first 150 blocks using the current incarnation of CDIntf_ReadBlock.
- // So we subtract the offset out here...
-
- uint32 curTrack = (((tracks[t][0] * 60) + tracks[t][1]) * 75) + tracks[t][2];
- curTrack -= firstTrackOffset;
- tracks[t][2] = curTrack % 75;
- curTrack /= 75;
- tracks[t][1] = curTrack % 60;
- tracks[t][0] = curTrack / 60;
-
- if (t > numTracks)
- numTracks = t;
- }
- else if (t == 0xA0)
- sessions[s][0] = p[8];
- else if (t == 0xA1)
- sessions[s][1] = p[8];
- else if (t == 0xA2)
- sessions[s][2] = p[8], sessions[s][3] = p[9], sessions[s][4] = p[10];
- }
-
-WriteLog("CDINTF: Disc summary\n # of sessions: %u, # of tracks: %u\n", numSessions, numTracks);
-WriteLog(" Session info:\n");
-for(uint32 i=0; i<numSessions; i++)
- WriteLog(" %u: min track=%2u, max track=%2u, lead out=%2d:%02d:%02d\n", i+1, sessions[i][0], sessions[i][1], sessions[i][2], sessions[i][3], sessions[i][4]);
-WriteLog(" Track info:\n");
-for(uint32 i=1; i<=numTracks; i++)
- WriteLog(" %2u: start=%2d:%02d:%02d\n", i, tracks[i][0], tracks[i][1], tracks[i][2]);
-
- delete[] data;
- readTOC = true;
-
- return true;
-}
RTail=DB, RHead=60D9, BUFFER_SIZE-1=FFFF
From while: Tail=60DA, Head=60D8
*/
+#warning Spinlock problem--!!! FIX !!!
+#warning Odd: The right FIFO is empty, but the left FIFO is full!
// Spin until buffer has been drained (for too fast processors!)...
uint32 spin = 0;
while (((RightFIFOTailPtr + 2) & (BUFFER_SIZE - 1)) == RightFIFOHeadPtr)//;
#include "gui.h"
-#include <algorithm>
-#include <ctype.h> // For toupper()
-#include <SDL.h>
-#include <string>
+#include <stdarg.h>
#include <sys/types.h> // For MacOS <dirent.h> dependency
#include <dirent.h>
+#include <SDL.h>
+#include <string>
#include <vector>
-#include "crc32.h"
-#include "event.h"
-#include "file.h"
+#include <algorithm>
+#include <ctype.h> // For toupper()
+#include "settings.h"
+#include "tom.h"
+#include "video.h"
+#include "clock.h"
#include "font1.h"
#include "font14pt.h" // Also 15, 16, 17, 18
#include "guielements.h"
-#include "jaguar.h"
-#include "log.h"
+#include "crc32.h"
+#include "zlib.h"
+#include "unzip.h"
#include "sdlemu_opengl.h"
-#include "settings.h"
-#include "tom.h"
-#include "video.h"
+#include "log.h"
+#include "jaguar.h"
+#include "eeprom.h"
using namespace std; // For STL stuff
Window * About(void);
Window * MiscOptions(void);
+int gzfilelength(gzFile gd);
+
+// External variables
+
+extern uint8 * jaguar_mainRam;
+extern uint8 * jaguar_mainRom;
+extern uint8 * jaguar_bootRom;
+extern uint8 * jaguar_CDBootROM;
+extern bool BIOSLoaded;
+extern bool CDBIOSLoaded;
+
// Local global variables
-bool showGUI = false;
bool exitGUI = false; // GUI (emulator) done variable
int mouseX = 0, mouseY = 0;
uint32 background[1280 * 256]; // GUI background buffer
-bool showMessage = false;
-//uint32 showMessageTimeout;
-//char messageBuffer[200];
-bool finished = false;
const char separator[] = "--------------------------------------------------------";
// Select the first element of each string:
string::const_iterator p1 = s1.begin(), p2 = s2.begin();
- while (p1 != s1.end() && p2 != s2.end()) // Don�t run past the end
+ while (p1 != s1.end() && p2 != s2.end()) // Don't run past the end
{
if (toupper(*p1) != toupper(*p2)) // Compare upper-cased chars
return (toupper(*p1) < toupper(*p2) ? -1 : 1);// Report which was lexically greater
AddElement(load);
load->SetNotificationElement(this);
-#warning !!! FIX !!! Directory might not exist--this shouldn't cause VJ to crash!
+//!!! FIX !!! Directory might not exist--this shouldn't cause VJ to crash!
DIR * dp = opendir(vjs.ROMPath);
dirent * de;
// GUI stuff--it's not crunchy, it's GUI! ;-)
//
-void GUIInit(void)
+void InitGUI(void)
{
SDL_ShowCursor(SDL_DISABLE);
SDL_GetMouseState(&mouseX, &mouseY);
pointerBGSave[1] = 8;
// Need to set things up so that it loads and runs a file if given on the command line. !!! FIX !!! [DONE]
-// extern uint32 * backbuffer;
+ extern uint32 * backbuffer;
// bool done = false;
SDL_Event event;
Window * mainWindow = NULL;
//This is crappy!!! !!! FIX !!!
//Is this even needed any more? Hmm. Maybe. Dunno.
WriteLog("GUI: Resetting Jaguar...\n");
- JaguarReset();
+ jaguar_reset();
WriteLog("GUI: Clearing BG save...\n");
// Set up our background save...
// memset(background, 0x11, tom_getVideoModeWidth() * 240 * 2);
//1111 -> 000100 01000 10001 -> 0001 0000 0100 0010 1000 1100 -> 10 42 8C
- for(uint32 i=0; i<TOMGetVideoModeWidth()*240; i++)
+ for(uint32 i=0; i<tom_getVideoModeWidth()*240; i++)
// background[i] = 0xFF8C4210;
backbuffer[i] = 0xFF8C4210;
}
else if (event.type == SDL_KEYDOWN)
{
-// Ugly kludge for windowed<-->fullscreen switching...
-uint8 * keystate = SDL_GetKeyState(NULL);
-
-if ((keystate[SDLK_LALT] || keystate[SDLK_RALT]) & keystate[SDLK_RETURN])
- ToggleFullscreen();
-
if (mainWindow)
mainWindow->HandleKey(event.key.keysym.sym);
else
Window * ResetJaguar(void)
{
- JaguarReset();
+ jaguar_reset();
return RunEmu();
}
Window * ResetJaguarCD(void)
{
- memcpy(jaguarMainRom, jaguarCDBootROM, 0x40000);
+ memcpy(jaguar_mainRom, jaguar_CDBootROM, 0x40000);
jaguarRunAddress = 0x802000;
- jaguarMainRomCRC32 = crc32_calcCheckSum(jaguarMainRom, 0x40000);
- JaguarReset();
+ jaguar_mainRom_crc32 = crc32_calcCheckSum(jaguar_mainRom, 0x40000);
+ jaguar_reset();
//This is a quick kludge to get the CDBIOS to boot properly...
//Wild speculation: It could be that this memory location is wired into the CD unit
//somehow, which lets it know whether or not a cart is present in the unit...
- jaguarMainRom[0x0040B] = 0x03;
+ jaguar_mainRom[0x0040B] = 0x03;
return RunEmu();
}
bool debounceRunKey = true;
Window * RunEmu(void)
{
-// extern uint32 * backbuffer;
+ extern uint32 * backbuffer;
uint32 * overlayPixels = (uint32 *)sdlemuGetOverlayPixels();
memset(overlayPixels, 0x00, 640 * 480 * 4); // Clear out overlay...
//This is crappy... !!! FIX !!!
-// extern bool finished, showGUI;
+ extern bool finished, showGUI;
sdlemuDisableOverlay();
cartType = 0;
else if (jaguarRomSize == 0x400000)
cartType = 1;
- else if (jaguarMainRomCRC32 == 0x687068D5)
+ else if (jaguar_mainRom_crc32 == 0x687068D5)
cartType = 2;
- else if (jaguarMainRomCRC32 == 0x55A0669C)
+ else if (jaguar_mainRom_crc32 == 0x55A0669C)
cartType = 3;
const char * cartTypeName[5] = { "2M Cartridge", "4M Cartridge", "CD BIOS", "CD Dev BIOS", "Homebrew" };
//Add in a new function for clearing patches of screen (ClearOverlayRect)
-// Also: Take frame rate into account when calculating fade time...
-
// Some QnD GUI stuff here...
if (showGUI)
{
{
DrawString2(overlayPixels, 8, 24*FONT_HEIGHT, 0x007F63FF, transparency, "Running...");
DrawString2(overlayPixels, 8, 26*FONT_HEIGHT, 0x001FFF3F, transparency, "%s, run address: %06X", cartTypeName[cartType], jaguarRunAddress);
- DrawString2(overlayPixels, 8, 27*FONT_HEIGHT, 0x001FFF3F, transparency, "CRC: %08X", jaguarMainRomCRC32);
+ DrawString2(overlayPixels, 8, 27*FONT_HEIGHT, 0x001FFF3F, transparency, "CRC: %08X", jaguar_mainRom_crc32);
if (showMsgFrames == 0)
{
// Save the background for the GUI...
// In this case, we squash the color to monochrome, then force it to blue + green...
- for(uint32 i=0; i<TOMGetVideoModeWidth() * 256; i++)
+ for(uint32 i=0; i<tom_getVideoModeWidth() * 256; i++)
{
uint32 pixel = backbuffer[i];
uint8 b = (pixel >> 16) & 0xFF, g = (pixel >> 8) & 0xFF, r = pixel & 0xFF;
Window * About(void)
{
char buf[512];
+// sprintf(buf, "Virtual Jaguar CVS %s", __DATE__);
sprintf(buf, "SVN %s", __DATE__);
//fprintf(fp, "VirtualJaguar v1.0.8 (Last full build was on %s %s)\n", __DATE__, __TIME__);
//VirtualJaguar v1.0.8 (Last full build was on Dec 30 2004 20:01:31)
return window;
}
-// Function prototype
-Window * CrashGracefullyCallback(void);
-//NOTE: Probably should set a flag as well telling it to do a full reset
-// of the Jaguar hardware if this happens...
-void GUICrashGracefully(const char * reason)
+//
+// Generic ROM loading
+//
+uint32 JaguarLoadROM(uint8 * rom, char * path)
{
- finished = true; // We're finished for now!
+// We really should have some kind of sanity checking for the ROM size here to prevent
+// a buffer overflow... !!! FIX !!!
+ uint32 romSize = 0;
- // Since this is used in the menu code as well, we could create another
- // internal function called "PushWindowOnQueue" or somesuch
- SDL_Event event;
- event.type = SDL_USEREVENT;
- event.user.code = MENU_ITEM_CHOSEN;
- event.user.data1 = (void *)CrashGracefullyCallback;
- SDL_PushEvent(&event);
+WriteLog("JaguarLoadROM: Attempting to load file '%s'...", path);
+ char * ext = strrchr(path, '.');
+if (ext == NULL)
+ WriteLog("FAILED!\n");
+else
+ WriteLog("Succeeded in finding extension (%s)!\n", ext);
+
+ if (ext != NULL)
+ {
+ WriteLog("VJ: Loading \"%s\"...", path);
+
+ if (strcasecmp(ext, ".zip") == 0)
+ {
+ // Handle ZIP file loading here...
+ WriteLog("(ZIPped)...");
+
+ if (load_zipped_file(0, 0, path, NULL, &rom, &romSize) == -1)
+ {
+ WriteLog("Failed!\n");
+ return 0;
+ }
+ }
+ else
+ {
+/* FILE * fp = fopen(path, "rb");
+
+ if (fp == NULL)
+ {
+ WriteLog("Failed!\n");
+ return 0;
+ }
+
+ fseek(fp, 0, SEEK_END);
+ romSize = ftell(fp);
+ fseek(fp, 0, SEEK_SET);
+ fread(rom, 1, romSize, fp);
+ fclose(fp);*/
+
+ // Handle gzipped files transparently [Adam Green]...
+
+ gzFile fp = gzopen(path, "rb");
+
+ if (fp == NULL)
+ {
+ WriteLog("Failed!\n");
+ return 0;
+ }
+
+ romSize = gzfilelength(fp);
+ gzseek(fp, 0, SEEK_SET);
+ gzread(fp, rom, romSize);
+ gzclose(fp);
+ }
+
+ WriteLog("OK (%i bytes)\n", romSize);
+ }
+
+ return romSize;
}
-Window * CrashGracefullyCallback(void)
+//
+// Jaguar file loading
+//
+bool JaguarLoadFile(char * path)
{
- Window * window = new Window(8, 16, 304, 192);
+// jaguarRomSize = JaguarLoadROM(mem, path);
+ jaguarRomSize = JaguarLoadROM(jaguar_mainRom, path);
- window->AddElement(new Text(8, 8+0*FONT_HEIGHT, "We CRASHED!!!"));
+/*//This is not *nix friendly for some reason...
+// if (!UserSelectFile(path, newPath))
+ if (!UserSelectFile((strlen(path) == 0 ? (char *)"." : path), newPath))
+ {
+ WriteLog("VJ: Could not find valid ROM in directory \"%s\"...\nAborting!\n", path);
+ log_done();
+ exit(0);
+ }*/
- return window;
+ if (jaguarRomSize == 0)
+ {
+// WriteLog("VJ: Could not load ROM from file \"%s\"...\nAborting!\n", newPath);
+ WriteLog("GUI: Could not load ROM from file \"%s\"...\nAborting load!\n", path);
+// Need to do something else here, like throw up an error dialog instead of aborting. !!! FIX !!!
+// log_done();
+// exit(0);
+ return false; // This is a start...
+ }
+
+ jaguar_mainRom_crc32 = crc32_calcCheckSum(jaguar_mainRom, jaguarRomSize);
+ WriteLog("CRC: %08X\n", (unsigned int)jaguar_mainRom_crc32);
+ eeprom_init();
+
+ jaguarRunAddress = 0x802000;
+
+ char * ext = strrchr(path, '.'); // Get the file's extension for non-cartridge checking
+
+//NOTE: Should fix JaguarLoadROM() to replace .zip with what's *in* the zip (.abs, .j64, etc.)
+ if (strcasecmp(ext, ".rom") == 0)
+ {
+ // File extension ".ROM": Alpine image that loads/runs at $802000
+ WriteLog("GUI: Setting up homebrew (ROM)... Run address: 00802000, length: %08X\n", jaguarRomSize);
+
+ for(int i=jaguarRomSize-1; i>=0; i--)
+ jaguar_mainRom[0x2000 + i] = jaguar_mainRom[i];
+
+ memset(jaguar_mainRom, 0xFF, 0x2000);
+/* memcpy(jaguar_mainRam, jaguar_mainRom, jaguarRomSize);
+ memset(jaguar_mainRom, 0xFF, 0x600000);
+ memcpy(jaguar_mainRom + 0x2000, jaguar_mainRam, jaguarRomSize);
+ memset(jaguar_mainRam, 0x00, 0x400000);*/
+
+/*
+Stubulator ROM vectors...
+handler 001 at $00E00008
+handler 002 at $00E008DE
+handler 003 at $00E008E2
+handler 004 at $00E008E6
+handler 005 at $00E008EA
+handler 006 at $00E008EE
+handler 007 at $00E008F2
+handler 008 at $00E0054A
+handler 009 at $00E008FA
+handler 010 at $00000000
+handler 011 at $00000000
+handler 012 at $00E008FE
+handler 013 at $00E00902
+handler 014 at $00E00906
+handler 015 at $00E0090A
+handler 016 at $00E0090E
+handler 017 at $00E00912
+handler 018 at $00E00916
+handler 019 at $00E0091A
+handler 020 at $00E0091E
+handler 021 at $00E00922
+handler 022 at $00E00926
+handler 023 at $00E0092A
+handler 024 at $00E0092E
+handler 025 at $00E0107A
+handler 026 at $00E0107A
+handler 027 at $00E0107A
+handler 028 at $00E008DA
+handler 029 at $00E0107A
+handler 030 at $00E0107A
+handler 031 at $00E0107A
+handler 032 at $00000000
+
+Let's try setting up the illegal instruction vector for a stubulated jaguar...
+*/
+/* SET32(jaguar_mainRam, 0x08, 0x00E008DE);
+ SET32(jaguar_mainRam, 0x0C, 0x00E008E2);
+ SET32(jaguar_mainRam, 0x10, 0x00E008E6); // <-- Should be here (it is)...
+ SET32(jaguar_mainRam, 0x14, 0x00E008EA);//*/
+
+ // Try setting the vector to say, $1000 and putting an instruction there that loops forever:
+ // This kludge works! Yeah!
+ SET32(jaguar_mainRam, 0x10, 0x00001000);
+ SET16(jaguar_mainRam, 0x1000, 0x60FE); // Here: bra Here
+ }
+ else if (strcasecmp(ext, ".abs") == 0)
+ {
+ // File extension ".ABS": Atari linker output file with header (w/o is useless to us here)
+
+/*
+ABS Format sleuthing (LBUGDEMO.ABS):
+
+000000 60 1B 00 00 05 0C 00 04 62 C0 00 00 04 28 00 00
+000010 12 A6 00 00 00 00 00 80 20 00 FF FF 00 80 25 0C
+000020 00 00 40 00
+
+DRI-format file detected...
+Text segment size = 0x0000050c bytes
+Data segment size = 0x000462c0 bytes
+BSS Segment size = 0x00000428 bytes
+Symbol Table size = 0x000012a6 bytes
+Absolute Address for text segment = 0x00802000
+Absolute Address for data segment = 0x0080250c
+Absolute Address for BSS segment = 0x00004000
+
+(CRZDEMO.ABS):
+000000 01 50 00 03 00 00 00 00 00 03 83 10 00 00 05 3b
+000010 00 1c 00 03 00 00 01 07 00 00 1d d0 00 03 64 98
+000020 00 06 8b 80 00 80 20 00 00 80 20 00 00 80 3d d0
+
+000030 2e 74 78 74 00 00 00 00 00 80 20 00 00 80 20 00 .txt (+36 bytes)
+000040 00 00 1d d0 00 00 00 a8 00 00 00 00 00 00 00 00
+000050 00 00 00 00 00 00 00 20
+000058 2e 64 74 61 00 00 00 00 00 80 3d d0 00 80 3d d0 .dta (+36 bytes)
+000068 00 03 64 98 00 00 1e 78 00 00 00 00 00 00 00 00
+000078 00 00 00 00 00 00 00 40
+000080 2e 62 73 73 00 00 00 00 00 00 50 00 00 00 50 00 .bss (+36 bytes)
+000090 00 06 8b 80 00 03 83 10 00 00 00 00 00 00 00 00
+0000a0 00 00 00 00 00 00 00 80
+
+Header size is $A8 bytes...
+
+BSD/COFF format file detected...
+3 sections specified
+Symbol Table offset = 230160 ($00038310)
+Symbol Table contains 1339 symbol entries ($0000053B)
+The additional header size is 28 bytes ($001C)
+Magic Number for RUN_HDR = 0x00000107
+Text Segment Size = 7632 ($00001DD0)
+Data Segment Size = 222360 ($00036498)
+BSS Segment Size = 428928 ($00068B80)
+Starting Address for executable = 0x00802000
+Start of Text Segment = 0x00802000
+Start of Data Segment = 0x00803dd0
+*/
+ if (jaguar_mainRom[0] == 0x60 && jaguar_mainRom[1] == 0x1B)
+ {
+ uint32 loadAddress = GET32(jaguar_mainRom, 0x16), //runAddress = GET32(jaguar_mainRom, 0x2A),
+ codeSize = GET32(jaguar_mainRom, 0x02) + GET32(jaguar_mainRom, 0x06);
+ WriteLog("GUI: Setting up homebrew (ABS-1)... Run address: %08X, length: %08X\n", loadAddress, codeSize);
+
+ if (loadAddress < 0x800000)
+ memcpy(jaguar_mainRam + loadAddress, jaguar_mainRom + 0x24, codeSize);
+ else
+ {
+ for(int i=codeSize-1; i>=0; i--)
+ jaguar_mainRom[(loadAddress - 0x800000) + i] = jaguar_mainRom[i + 0x24];
+/* memcpy(jaguar_mainRam, jaguar_mainRom + 0x24, codeSize);
+ memset(jaguar_mainRom, 0xFF, 0x600000);
+ memcpy(jaguar_mainRom + (loadAddress - 0x800000), jaguar_mainRam, codeSize);
+ memset(jaguar_mainRam, 0x00, 0x400000);*/
+ }
+
+ jaguarRunAddress = loadAddress;
+ }
+ else if (jaguar_mainRom[0] == 0x01 && jaguar_mainRom[1] == 0x50)
+ {
+ uint32 loadAddress = GET32(jaguar_mainRom, 0x28), runAddress = GET32(jaguar_mainRom, 0x24),
+ codeSize = GET32(jaguar_mainRom, 0x18) + GET32(jaguar_mainRom, 0x1C);
+ WriteLog("GUI: Setting up homebrew (ABS-2)... Run address: %08X, length: %08X\n", runAddress, codeSize);
+
+ if (loadAddress < 0x800000)
+ memcpy(jaguar_mainRam + loadAddress, jaguar_mainRom + 0xA8, codeSize);
+ else
+ {
+ for(int i=codeSize-1; i>=0; i--)
+ jaguar_mainRom[(loadAddress - 0x800000) + i] = jaguar_mainRom[i + 0xA8];
+/* memcpy(jaguar_mainRam, jaguar_mainRom + 0xA8, codeSize);
+ memset(jaguar_mainRom, 0xFF, 0x600000);
+ memcpy(jaguar_mainRom + (loadAddress - 0x800000), jaguar_mainRam, codeSize);
+ memset(jaguar_mainRam, 0x00, 0x400000);*/
+ }
+
+ jaguarRunAddress = runAddress;
+ }
+ else
+ {
+ WriteLog("GUI: Couldn't find correct ABS format: %02X %02X\n", jaguar_mainRom[0], jaguar_mainRom[1]);
+ return false;
+ }
+ }
+ else if (strcasecmp(ext, ".jag") == 0)
+ {
+ // File extension ".JAG": Atari server file with header
+//NOTE: The bytes 'JAGR' should also be at position $1C...
+// Also, there's *always* a $601A header at position $00...
+ if (jaguar_mainRom[0] == 0x60 && jaguar_mainRom[1] == 0x1A)
+ {
+ uint32 loadAddress = GET32(jaguar_mainRom, 0x22), runAddress = GET32(jaguar_mainRom, 0x2A);
+//This is not always right! Especially when converted via bin2jag1!!!
+//We should have access to the length of the furshlumiger file that was loaded anyway!
+//Now, we do! ;-)
+// uint32 progLength = GET32(jaguar_mainRom, 0x02);
+//jaguarRomSize
+//jaguarRunAddress
+// WriteLog("Jaguar: Setting up PD ROM... Run address: %08X, length: %08X\n", runAddress, progLength);
+// memcpy(jaguar_mainRam + loadAddress, jaguar_mainRom + 0x2E, progLength);
+ WriteLog("GUI: Setting up homebrew (JAG)... Run address: %08X, length: %08X\n", runAddress, jaguarRomSize - 0x2E);
+ memcpy(jaguar_mainRam + loadAddress, jaguar_mainRom + 0x2E, jaguarRomSize - 0x2E);
+// SET32(jaguar_mainRam, 4, runAddress);
+ jaguarRunAddress = runAddress;
+ }
+ else
+ return false;
+ }
+ // .J64 (Jaguar cartridge ROM image) is implied by the FileList object...
+
+ return true;
+}
+
+//
+// Get the length of a (possibly) gzipped file
+//
+int gzfilelength(gzFile gd)
+{
+ int size = 0, length = 0;
+ unsigned char buffer[0x10000];
+
+ gzrewind(gd);
+
+ do
+ {
+ // Read in chunks until EOF
+ size = gzread(gd, buffer, 0x10000);
+
+ if (size <= 0)
+ break;
+
+ length += size;
+ }
+ while (!gzeof(gd));
+
+ gzrewind(gd);
+ return length;
}
#ifndef __GUI_H__
#define __GUI_H__
+#include "types.h"
+
#ifdef __cplusplus
extern "C" {
#endif
-void GUIInit(void);
+void InitGUI(void);
void GUIDone(void);
bool GUIMain(char *);
-void GUICrashGracefully(const char *);
-// Exported vars
+// Not sure why these are in *this* file, but here they are... :-/
-extern bool showGUI;
-extern bool exitGUI; // Hmm.
-extern bool finished; // Current emulator loop is finished
+uint32 JaguarLoadROM(uint8 * rom, char * path);
+bool JaguarLoadFile(char * path);
#ifdef __cplusplus
}
+++ /dev/null
-//***************************************************************************
-//
-// Name: SCSIDEFS.H
-//
-// Description: SCSI definitions ('C' Language)
-//
-//***************************************************************************
-
-//***************************************************************************
-// %%% TARGET STATUS VALUES %%%
-//***************************************************************************
-#define STATUS_GOOD 0x00 // Status Good
-#define STATUS_CHKCOND 0x02 // Check Condition
-#define STATUS_CONDMET 0x04 // Condition Met
-#define STATUS_BUSY 0x08 // Busy
-#define STATUS_INTERM 0x10 // Intermediate
-#define STATUS_INTCDMET 0x14 // Intermediate-condition met
-#define STATUS_RESCONF 0x18 // Reservation conflict
-#define STATUS_COMTERM 0x22 // Command Terminated
-#define STATUS_QFULL 0x28 // Queue full
-
-//***************************************************************************
-// %%% SCSI MISCELLANEOUS EQUATES %%%
-//***************************************************************************
-#define MAXLUN 7 // Maximum Logical Unit Id
-#define MAXTARG 7 // Maximum Target Id
-#define MAX_SCSI_LUNS 64 // Maximum Number of SCSI LUNs
-#define MAX_NUM_HA 8 // Maximum Number of SCSI HA's
-
-//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
-//
-// %%% SCSI COMMAND OPCODES %%%
-//
-///\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
-
-//***************************************************************************
-// %%% Commands for all Device Types %%%
-//***************************************************************************
-#define SCSI_CHANGE_DEF 0x40 // Change Definition (Optional)
-#define SCSI_COMPARE 0x39 // Compare (O)
-#define SCSI_COPY 0x18 // Copy (O)
-#define SCSI_COP_VERIFY 0x3A // Copy and Verify (O)
-#define SCSI_INQUIRY 0x12 // Inquiry (MANDATORY)
-#define SCSI_LOG_SELECT 0x4C // Log Select (O)
-#define SCSI_LOG_SENSE 0x4D // Log Sense (O)
-#define SCSI_MODE_SEL6 0x15 // Mode Select 6-byte (Device Specific)
-#define SCSI_MODE_SEL10 0x55 // Mode Select 10-byte (Device Specific)
-#define SCSI_MODE_SEN6 0x1A // Mode Sense 6-byte (Device Specific)
-#define SCSI_MODE_SEN10 0x5A // Mode Sense 10-byte (Device Specific)
-#define SCSI_READ_BUFF 0x3C // Read Buffer (O)
-#define SCSI_REQ_SENSE 0x03 // Request Sense (MANDATORY)
-#define SCSI_SEND_DIAG 0x1D // Send Diagnostic (O)
-#define SCSI_TST_U_RDY 0x00 // Test Unit Ready (MANDATORY)
-#define SCSI_WRITE_BUFF 0x3B // Write Buffer (O)
-
-//***************************************************************************
-// %%% Commands Unique to Direct Access Devices %%%
-//***************************************************************************
-#define SCSI_COMPARE 0x39 // Compare (O)
-#define SCSI_FORMAT 0x04 // Format Unit (MANDATORY)
-#define SCSI_LCK_UN_CAC 0x36 // Lock Unlock Cache (O)
-#define SCSI_PREFETCH 0x34 // Prefetch (O)
-#define SCSI_MED_REMOVL 0x1E // Prevent/Allow medium Removal (O)
-#define SCSI_READ6 0x08 // Read 6-byte (MANDATORY)
-#define SCSI_READ10 0x28 // Read 10-byte (MANDATORY)
-#define SCSI_RD_CAPAC 0x25 // Read Capacity (MANDATORY)
-#define SCSI_RD_DEFECT 0x37 // Read Defect Data (O)
-#define SCSI_READ_LONG 0x3E // Read Long (O)
-#define SCSI_REASS_BLK 0x07 // Reassign Blocks (O)
-#define SCSI_RCV_DIAG 0x1C // Receive Diagnostic Results (O)
-#define SCSI_RELEASE 0x17 // Release Unit (MANDATORY)
-#define SCSI_REZERO 0x01 // Rezero Unit (O)
-#define SCSI_SRCH_DAT_E 0x31 // Search Data Equal (O)
-#define SCSI_SRCH_DAT_H 0x30 // Search Data High (O)
-#define SCSI_SRCH_DAT_L 0x32 // Search Data Low (O)
-#define SCSI_SEEK6 0x0B // Seek 6-Byte (O)
-#define SCSI_SEEK10 0x2B // Seek 10-Byte (O)
-#define SCSI_SEND_DIAG 0x1D // Send Diagnostics (MANDATORY)
-#define SCSI_SET_LIMIT 0x33 // Set Limits (O)
-#define SCSI_START_STP 0x1B // Start/Stop Unit (O)
-#define SCSI_SYNC_CACHE 0x35 // Synchronize Cache (O)
-#define SCSI_VERIFY 0x2F // Verify (O)
-#define SCSI_WRITE6 0x0A // Write 6-Byte (MANDATORY)
-#define SCSI_WRITE10 0x2A // Write 10-Byte (MANDATORY)
-#define SCSI_WRT_VERIFY 0x2E // Write and Verify (O)
-#define SCSI_WRITE_LONG 0x3F // Write Long (O)
-#define SCSI_WRITE_SAME 0x41 // Write Same (O)
-
-//***************************************************************************
-// %%% Commands Unique to Sequential Access Devices %%%
-//***************************************************************************
-#define SCSI_ERASE 0x19 // Erase (MANDATORY)
-#define SCSI_LOAD_UN 0x1B // Load/Unload (O)
-#define SCSI_LOCATE 0x2B // Locate (O)
-#define SCSI_RD_BLK_LIM 0x05 // Read Block Limits (MANDATORY)
-#define SCSI_READ_POS 0x34 // Read Position (O)
-#define SCSI_READ_REV 0x0F // Read Reverse (O)
-#define SCSI_REC_BF_DAT 0x14 // Recover Buffer Data (O)
-#define SCSI_RESERVE 0x16 // Reserve Unit (MANDATORY)
-#define SCSI_REWIND 0x01 // Rewind (MANDATORY)
-#define SCSI_SPACE 0x11 // Space (MANDATORY)
-#define SCSI_VERIFY_T 0x13 // Verify (Tape) (O)
-#define SCSI_WRT_FILE 0x10 // Write Filemarks (MANDATORY)
-
-//***************************************************************************
-// %%% Commands Unique to Printer Devices %%%
-//***************************************************************************
-#define SCSI_PRINT 0x0A // Print (MANDATORY)
-#define SCSI_SLEW_PNT 0x0B // Slew and Print (O)
-#define SCSI_STOP_PNT 0x1B // Stop Print (O)
-#define SCSI_SYNC_BUFF 0x10 // Synchronize Buffer (O)
-
-//***************************************************************************
-// %%% Commands Unique to Processor Devices %%%
-//***************************************************************************
-#define SCSI_RECEIVE 0x08 // Receive (O)
-#define SCSI_SEND 0x0A // Send (O)
-
-//***************************************************************************
-// %%% Commands Unique to Write-Once Devices %%%
-//***************************************************************************
-#define SCSI_MEDIUM_SCN 0x38 // Medium Scan (O)
-#define SCSI_SRCHDATE10 0x31 // Search Data Equal 10-Byte (O)
-#define SCSI_SRCHDATE12 0xB1 // Search Data Equal 12-Byte (O)
-#define SCSI_SRCHDATH10 0x30 // Search Data High 10-Byte (O)
-#define SCSI_SRCHDATH12 0xB0 // Search Data High 12-Byte (O)
-#define SCSI_SRCHDATL10 0x32 // Search Data Low 10-Byte (O)
-#define SCSI_SRCHDATL12 0xB2 // Search Data Low 12-Byte (O)
-#define SCSI_SET_LIM_10 0x33 // Set Limits 10-Byte (O)
-#define SCSI_SET_LIM_12 0xB3 // Set Limits 10-Byte (O)
-#define SCSI_VERIFY10 0x2F // Verify 10-Byte (O)
-#define SCSI_VERIFY12 0xAF // Verify 12-Byte (O)
-#define SCSI_WRITE12 0xAA // Write 12-Byte (O)
-#define SCSI_WRT_VER10 0x2E // Write and Verify 10-Byte (O)
-#define SCSI_WRT_VER12 0xAE // Write and Verify 12-Byte (O)
-
-//***************************************************************************
-// %%% Commands Unique to CD-ROM Devices %%%
-//***************************************************************************
-#define SCSI_PLAYAUD_10 0x45 // Play Audio 10-Byte (O)
-#define SCSI_PLAYAUD_12 0xA5 // Play Audio 12-Byte 12-Byte (O)
-#define SCSI_PLAYAUDMSF 0x47 // Play Audio MSF (O)
-#define SCSI_PLAYA_TKIN 0x48 // Play Audio Track/Index (O)
-#define SCSI_PLYTKREL10 0x49 // Play Track Relative 10-Byte (O)
-#define SCSI_PLYTKREL12 0xA9 // Play Track Relative 12-Byte (O)
-#define SCSI_READCDCAP 0x25 // Read CD-ROM Capacity (MANDATORY)
-#define SCSI_READHEADER 0x44 // Read Header (O)
-#define SCSI_SUBCHANNEL 0x42 // Read Subchannel (O)
-#define SCSI_READ_TOC 0x43 // Read TOC (O)
-
-//***************************************************************************
-// %%% Commands Unique to Scanner Devices %%%
-//***************************************************************************
-#define SCSI_GETDBSTAT 0x34 // Get Data Buffer Status (O)
-#define SCSI_GETWINDOW 0x25 // Get Window (O)
-#define SCSI_OBJECTPOS 0x31 // Object Postion (O)
-#define SCSI_SCAN 0x1B // Scan (O)
-#define SCSI_SETWINDOW 0x24 // Set Window (MANDATORY)
-
-//***************************************************************************
-// %%% Commands Unique to Optical Memory Devices %%%
-//***************************************************************************
-#define SCSI_UpdateBlk 0x3D // Update Block (O)
-
-//***************************************************************************
-// %%% Commands Unique to Medium Changer Devices %%%
-//***************************************************************************
-#define SCSI_EXCHMEDIUM 0xA6 // Exchange Medium (O)
-#define SCSI_INITELSTAT 0x07 // Initialize Element Status (O)
-#define SCSI_POSTOELEM 0x2B // Position to Element (O)
-#define SCSI_REQ_VE_ADD 0xB5 // Request Volume Element Address (O)
-#define SCSI_SENDVOLTAG 0xB6 // Send Volume Tag (O)
-
-//***************************************************************************
-// %%% Commands Unique to Communication Devices %%%
-//***************************************************************************
-#define SCSI_GET_MSG_6 0x08 // Get Message 6-Byte (MANDATORY)
-#define SCSI_GET_MSG_10 0x28 // Get Message 10-Byte (O)
-#define SCSI_GET_MSG_12 0xA8 // Get Message 12-Byte (O)
-#define SCSI_SND_MSG_6 0x0A // Send Message 6-Byte (MANDATORY)
-#define SCSI_SND_MSG_10 0x2A // Send Message 10-Byte (O)
-#define SCSI_SND_MSG_12 0xAA // Send Message 12-Byte (O)
-
-//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
-//
-// %%% END OF SCSI COMMAND OPCODES %%%
-//
-///\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
-
-//***************************************************************************
-// %%% Request Sense Data Format %%%
-//***************************************************************************
-typedef struct {
-
- BYTE ErrorCode; // Error Code (70H or 71H)
- BYTE SegmentNum; // Number of current segment descriptor
- BYTE SenseKey; // Sense Key(See bit definitions too)
- BYTE InfoByte0; // Information MSB
- BYTE InfoByte1; // Information MID
- BYTE InfoByte2; // Information MID
- BYTE InfoByte3; // Information LSB
- BYTE AddSenLen; // Additional Sense Length
- BYTE ComSpecInf0; // Command Specific Information MSB
- BYTE ComSpecInf1; // Command Specific Information MID
- BYTE ComSpecInf2; // Command Specific Information MID
- BYTE ComSpecInf3; // Command Specific Information LSB
- BYTE AddSenseCode; // Additional Sense Code
- BYTE AddSenQual; // Additional Sense Code Qualifier
- BYTE FieldRepUCode; // Field Replaceable Unit Code
- BYTE SenKeySpec15; // Sense Key Specific 15th byte
- BYTE SenKeySpec16; // Sense Key Specific 16th byte
- BYTE SenKeySpec17; // Sense Key Specific 17th byte
- BYTE AddSenseBytes; // Additional Sense Bytes
-
-} SENSE_DATA_FMT;
-
-//***************************************************************************
-// %%% REQUEST SENSE ERROR CODE %%%
-//***************************************************************************
-#define SERROR_CURRENT 0x70 // Current Errors
-#define SERROR_DEFERED 0x71 // Deferred Errors
-
-//***************************************************************************
-// %%% REQUEST SENSE BIT DEFINITIONS %%%
-//***************************************************************************
-#define SENSE_VALID 0x80 // Byte 0 Bit 7
-#define SENSE_FILEMRK 0x80 // Byte 2 Bit 7
-#define SENSE_EOM 0x40 // Byte 2 Bit 6
-#define SENSE_ILI 0x20 // Byte 2 Bit 5
-
-//***************************************************************************
-// %%% REQUEST SENSE SENSE KEY DEFINITIONS %%%
-//***************************************************************************
-#define KEY_NOSENSE 0x00 // No Sense
-#define KEY_RECERROR 0x01 // Recovered Error
-#define KEY_NOTREADY 0x02 // Not Ready
-#define KEY_MEDIUMERR 0x03 // Medium Error
-#define KEY_HARDERROR 0x04 // Hardware Error
-#define KEY_ILLGLREQ 0x05 // Illegal Request
-#define KEY_UNITATT 0x06 // Unit Attention
-#define KEY_DATAPROT 0x07 // Data Protect
-#define KEY_BLANKCHK 0x08 // Blank Check
-#define KEY_VENDSPEC 0x09 // Vendor Specific
-#define KEY_COPYABORT 0x0A // Copy Abort
-#define KEY_EQUAL 0x0C // Equal (Search)
-#define KEY_VOLOVRFLW 0x0D // Volume Overflow
-#define KEY_MISCOMP 0x0E // Miscompare (Search)
-#define KEY_RESERVED 0x0F // Reserved
-
-//***************************************************************************
-// %%% PERIPHERAL DEVICE TYPE DEFINITIONS %%%
-//***************************************************************************
-#define DTYPE_DASD 0x00 // Disk Device
-#define DTYPE_SEQD 0x01 // Tape Device
-#define DTYPE_PRNT 0x02 // Printer
-#define DTYPE_PROC 0x03 // Processor
-#define DTYPE_WORM 0x04 // Write-once read-multiple
-#define DTYPE_CROM 0x05 // CD-ROM device
-#define DTYPE_CDROM 0x05 // CD-ROM device
-#define DTYPE_SCAN 0x06 // Scanner device
-#define DTYPE_OPTI 0x07 // Optical memory device
-#define DTYPE_JUKE 0x08 // Medium Changer device
-#define DTYPE_COMM 0x09 // Communications device
-#define DTYPE_RESL 0x0A // Reserved (low)
-#define DTYPE_RESH 0x1E // Reserved (high)
-#define DTYPE_UNKNOWN 0x1F // Unknown or no device type
-
-//***************************************************************************
-// %%% ANSI APPROVED VERSION DEFINITIONS %%%
-//***************************************************************************
-#define ANSI_MAYBE 0x0 // Device may or may not be ANSI approved stand
-#define ANSI_SCSI1 0x1 // Device complies to ANSI X3.131-1986 (SCSI-1)
-#define ANSI_SCSI2 0x2 // Device complies to SCSI-2
-#define ANSI_RESLO 0x3 // Reserved (low)
-#define ANSI_RESHI 0x7 // Reserved (high)
if (vjs.useOpenGL)
{
- // Initializing SDL attributes with OpenGL
- SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);
- SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+ // Initializing SDL attributes with OpenGL
+ SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);
+ SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
mainSurfaceFlags = SDL_OPENGL;
}
else
+++ /dev/null
-/******************************************************************************
-**
-** Module Name: wnaspi32.h
-**
-** Description: Header file for ASPI for Win32. This header includes
-** macro and type declarations, and can be included without
-** modification when using Borland C++ or Microsoft Visual
-** C++ with 32-bit compilation. If you are using a different
-** compiler then you MUST ensure that structures are packed
-** onto byte alignments, and that C++ name mangling is turned
-** off.
-**
-** Notes: This file created using 4 spaces per tab.
-**
-******************************************************************************/
-
-#ifndef __WNASPI32_H__
-#define __WNASPI32_H__
-
-// Make sure structures are packed and undecorated.
-
-#ifdef __BORLANDC__
-#pragma option -a1
-#endif //__BORLANDC__
-
-#ifdef _MSC_VER
-#pragma pack(1)
-#endif //__MSC_VER
-
-#ifdef __GCCWIN32__
-#pragma pack(1)
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif //__cplusplus
-
-//*****************************************************************************
-// %%% SCSI MISCELLANEOUS EQUATES %%%
-//*****************************************************************************
-
-#define SENSE_LEN 14 // Default sense buffer length
-#define SRB_DIR_SCSI 0x00 // Direction determined by SCSI
-#define SRB_POSTING 0x01 // Enable ASPI posting
-#define SRB_ENABLE_RESIDUAL_COUNT 0x04 // Enable residual byte count reporting
-#define SRB_DIR_IN 0x08 // Transfer from SCSI target to host
-#define SRB_DIR_OUT 0x10 // Transfer from host to SCSI target
-#define SRB_EVENT_NOTIFY 0x40 // Enable ASPI event notification
-
-#define RESIDUAL_COUNT_SUPPORTED 0x02 // Extended buffer flag
-#define MAX_SRB_TIMEOUT 108000lu // 30 hour maximum timeout in s
-#define DEFAULT_SRB_TIMEOUT 108000lu // Max timeout by default
-
-
-//*****************************************************************************
-// %%% ASPI Command Definitions %%%
-//*****************************************************************************
-
-#define SC_HA_INQUIRY 0x00 // Host adapter inquiry
-#define SC_GET_DEV_TYPE 0x01 // Get device type
-#define SC_EXEC_SCSI_CMD 0x02 // Execute SCSI command
-#define SC_ABORT_SRB 0x03 // Abort an SRB
-#define SC_RESET_DEV 0x04 // SCSI bus device reset
-#define SC_SET_HA_PARMS 0x05 // Set HA parameters
-#define SC_GET_DISK_INFO 0x06 // Get Disk information
-#define SC_RESCAN_SCSI_BUS 0x07 // ReBuild SCSI device map
-#define SC_GETSET_TIMEOUTS 0x08 // Get/Set target timeouts
-
-//*****************************************************************************
-// %%% SRB Status %%%
-//*****************************************************************************
-
-#define SS_PENDING 0x00 // SRB being processed
-#define SS_COMP 0x01 // SRB completed without error
-#define SS_ABORTED 0x02 // SRB aborted
-#define SS_ABORT_FAIL 0x03 // Unable to abort SRB
-#define SS_ERR 0x04 // SRB completed with error
-
-#define SS_INVALID_CMD 0x80 // Invalid ASPI command
-#define SS_INVALID_HA 0x81 // Invalid host adapter number
-#define SS_NO_DEVICE 0x82 // SCSI device not installed
-
-#define SS_INVALID_SRB 0xE0 // Invalid parameter set in SRB
-#define SS_OLD_MANAGER 0xE1 // ASPI manager doesn't support Windows
-#define SS_BUFFER_ALIGN 0xE1 // Buffer not aligned (replaces OLD_MANAGER in Win32)
-#define SS_ILLEGAL_MODE 0xE2 // Unsupported Windows mode
-#define SS_NO_ASPI 0xE3 // No ASPI managers resident
-#define SS_FAILED_INIT 0xE4 // ASPI for windows failed init
-#define SS_ASPI_IS_BUSY 0xE5 // No resources available to execute cmd
-#define SS_BUFFER_TOO_BIG 0xE6 // Buffer size too big to handle!
-#define SS_MISMATCHED_COMPONENTS 0xE7 // The DLLs/EXEs of ASPI don't version check
-#define SS_NO_ADAPTERS 0xE8 // No host adapters to manage
-#define SS_INSUFFICIENT_RESOURCES 0xE9 // Couldn't allocate resources needed to init
-#define SS_ASPI_IS_SHUTDOWN 0xEA // Call came to ASPI after PROCESS_DETACH
-#define SS_BAD_INSTALL 0xEB // The DLL or other components are installed wrong
-
-//*****************************************************************************
-// %%% Host Adapter Status %%%
-//*****************************************************************************
-
-#define HASTAT_OK 0x00 // Host adapter did not detect an // error
-#define HASTAT_SEL_TO 0x11 // Selection Timeout
-#define HASTAT_DO_DU 0x12 // Data overrun data underrun
-#define HASTAT_BUS_FREE 0x13 // Unexpected bus free
-#define HASTAT_PHASE_ERR 0x14 // Target bus phase sequence // failure
-#define HASTAT_TIMEOUT 0x09 // Timed out while SRB was waiting to beprocessed.
-#define HASTAT_COMMAND_TIMEOUT 0x0B // Adapter timed out processing SRB.
-#define HASTAT_MESSAGE_REJECT 0x0D // While processing SRB, the // adapter received a MESSAGE
-#define HASTAT_BUS_RESET 0x0E // A bus reset was detected.
-#define HASTAT_PARITY_ERROR 0x0F // A parity error was detected.
-#define HASTAT_REQUEST_SENSE_FAILED 0x10 // The adapter failed in issuing
-
-//*****************************************************************************
-// %%% SRB - HOST ADAPTER INQUIRY - SC_HA_INQUIRY (0) %%%
-//*****************************************************************************
-
-typedef struct // Offset
-{ // HX/DEC
- BYTE SRB_Cmd; // 00/000 ASPI command code = SC_HA_INQUIRY
- BYTE SRB_Status; // 01/001 ASPI command status byte
- BYTE SRB_HaId; // 02/002 ASPI host adapter number
- BYTE SRB_Flags; // 03/003 ASPI request flags
- DWORD SRB_Hdr_Rsvd; // 04/004 Reserved, MUST = 0
- BYTE HA_Count; // 08/008 Number of host adapters present
- BYTE HA_SCSI_ID; // 09/009 SCSI ID of host adapter
- BYTE HA_ManagerId[16]; // 0A/010 String describing the manager
- BYTE HA_Identifier[16]; // 1A/026 String describing the host adapter
- BYTE HA_Unique[16]; // 2A/042 Host Adapter Unique parameters
- WORD HA_Rsvd1; // 3A/058 Reserved, MUST = 0
-}
-SRB_HAInquiry, *PSRB_HAInquiry, FAR *LPSRB_HAInquiry;
-
-//*****************************************************************************
-// %%% SRB - GET DEVICE TYPE - SC_GET_DEV_TYPE (1) %%%
-//*****************************************************************************
-
-typedef struct // Offset
-{ // HX/DEC
- BYTE SRB_Cmd; // 00/000 ASPI command code = SC_GET_DEV_TYPE
- BYTE SRB_Status; // 01/001 ASPI command status byte
- BYTE SRB_HaId; // 02/002 ASPI host adapter number
- BYTE SRB_Flags; // 03/003 Reserved, MUST = 0
- DWORD SRB_Hdr_Rsvd; // 04/004 Reserved, MUST = 0
- BYTE SRB_Target; // 08/008 Target's SCSI ID
- BYTE SRB_Lun; // 09/009 Target's LUN number
- BYTE SRB_DeviceType; // 0A/010 Target's peripheral device type
- BYTE SRB_Rsvd1; // 0B/011 Reserved, MUST = 0
-}
-SRB_GDEVBlock, *PSRB_GDEVBlock, FAR *LPSRB_GDEVBlock;
-
-//*****************************************************************************
-// %%% SRB - EXECUTE SCSI COMMAND - SC_EXEC_SCSI_CMD (2) %%%
-//*****************************************************************************
-
-typedef struct // Offset
-{ // HX/DEC
- BYTE SRB_Cmd; // 00/000 ASPI command code = SC_EXEC_SCSI_CMD
- BYTE SRB_Status; // 01/001 ASPI command status byte
- BYTE SRB_HaId; // 02/002 ASPI host adapter number
- BYTE SRB_Flags; // 03/003 ASPI request flags
- DWORD SRB_Hdr_Rsvd; // 04/004 Reserved
- BYTE SRB_Target; // 08/008 Target's SCSI ID
- BYTE SRB_Lun; // 09/009 Target's LUN number
- WORD SRB_Rsvd1; // 0A/010 Reserved for Alignment
- DWORD SRB_BufLen; // 0C/012 Data Allocation Length
- BYTE FAR *SRB_BufPointer; // 10/016 Data Buffer Pointer
- BYTE SRB_SenseLen; // 14/020 Sense Allocation Length
- BYTE SRB_CDBLen; // 15/021 CDB Length
- BYTE SRB_HaStat; // 16/022 Host Adapter Status
- BYTE SRB_TargStat; // 17/023 Target Status
- VOID FAR *SRB_PostProc; // 18/024 Post routine
- BYTE SRB_Rsvd2[20]; // 1C/028 Reserved, MUST = 0
- BYTE CDBByte[16]; // 30/048 SCSI CDB
- BYTE SenseArea[SENSE_LEN+2]; // 50/064 Request Sense buffer
-}
-SRB_ExecSCSICmd, *PSRB_ExecSCSICmd, FAR *LPSRB_ExecSCSICmd;
-
-//*****************************************************************************
-// %%% SRB - ABORT AN SRB - SC_ABORT_SRB (3) %%%
-//*****************************************************************************
-
-typedef struct // Offset
-{ // HX/DEC
- BYTE SRB_Cmd; // 00/000 ASPI command code = SC_ABORT_SRB
- BYTE SRB_Status; // 01/001 ASPI command status byte
- BYTE SRB_HaId; // 02/002 ASPI host adapter number
- BYTE SRB_Flags; // 03/003 Reserved
- DWORD SRB_Hdr_Rsvd; // 04/004 Reserved
- VOID FAR *SRB_ToAbort; // 08/008 Pointer to SRB to abort
-}
-SRB_Abort, *PSRB_Abort, FAR *LPSRB_Abort;
-
-//*****************************************************************************
-// %%% SRB - BUS DEVICE RESET - SC_RESET_DEV (4) %%%
-//*****************************************************************************
-
-typedef struct // Offset
-{ // HX/DEC
- BYTE SRB_Cmd; // 00/000 ASPI command code = SC_RESET_DEV
- BYTE SRB_Status; // 01/001 ASPI command status byte
- BYTE SRB_HaId; // 02/002 ASPI host adapter number
- BYTE SRB_Flags; // 03/003 ASPI request flags
- DWORD SRB_Hdr_Rsvd; // 04/004 Reserved
- BYTE SRB_Target; // 08/008 Target's SCSI ID
- BYTE SRB_Lun; // 09/009 Target's LUN number
- BYTE SRB_Rsvd1[12]; // 0A/010 Reserved for Alignment
- BYTE SRB_HaStat; // 16/022 Host Adapter Status
- BYTE SRB_TargStat; // 17/023 Target Status
- VOID FAR *SRB_PostProc; // 18/024 Post routine
- BYTE SRB_Rsvd2[36]; // 1C/028 Reserved, MUST = 0
-}
-SRB_BusDeviceReset, *PSRB_BusDeviceReset, FAR *LPSRB_BusDeviceReset;
-
-//*****************************************************************************
-// %%% SRB - GET DISK INFORMATION - SC_GET_DISK_INFO %%%
-//*****************************************************************************
-
-typedef struct // Offset
-{ // HX/DEC
- BYTE SRB_Cmd; // 00/000 ASPI command code = SC_GET_DISK_INFO
- BYTE SRB_Status; // 01/001 ASPI command status byte
- BYTE SRB_HaId; // 02/002 ASPI host adapter number
- BYTE SRB_Flags; // 03/003 Reserved, MUST = 0
- DWORD SRB_Hdr_Rsvd; // 04/004 Reserved, MUST = 0
- BYTE SRB_Target; // 08/008 Target's SCSI ID
- BYTE SRB_Lun; // 09/009 Target's LUN number
- BYTE SRB_DriveFlags; // 0A/010 Driver flags
- BYTE SRB_Int13HDriveInfo; // 0B/011 Host Adapter Status
- BYTE SRB_Heads; // 0C/012 Preferred number of heads translation
- BYTE SRB_Sectors; // 0D/013 Preferred number of sectors translation
- BYTE SRB_Rsvd1[10]; // 0E/014 Reserved, MUST = 0
-}
-SRB_GetDiskInfo, *PSRB_GetDiskInfo, FAR *LPSRB_GetDiskInfo;
-
-//*****************************************************************************
-// %%% SRB - RESCAN SCSI BUS(ES) ON SCSIPORT %%%
-//*****************************************************************************
-
-typedef struct // Offset
-{ // HX/DEC
- BYTE SRB_Cmd; // 00/000 ASPI command code = SC_RESCAN_SCSI_BUS
- BYTE SRB_Status; // 01/001 ASPI command status byte
- BYTE SRB_HaId; // 02/002 ASPI host adapter number
- BYTE SRB_Flags; // 03/003 Reserved, MUST = 0
- DWORD SRB_Hdr_Rsvd; // 04/004 Reserved, MUST = 0
-}
-SRB_RescanPort, *PSRB_RescanPort, FAR *LPSRB_RescanPort;
-
-//*****************************************************************************
-// %%% SRB - GET/SET TARGET TIMEOUTS %%%
-//*****************************************************************************
-
-typedef struct // Offset
-{ // HX/DEC
- BYTE SRB_Cmd; // 00/000 ASPI command code = SC_GETSET_TIMEOUTS
- BYTE SRB_Status; // 01/001 ASPI command status byte
- BYTE SRB_HaId; // 02/002 ASPI host adapter number
- BYTE SRB_Flags; // 03/003 ASPI request flags
- DWORD SRB_Hdr_Rsvd; // 04/004 Reserved, MUST = 0
- BYTE SRB_Target; // 08/008 Target's SCSI ID
- BYTE SRB_Lun; // 09/009 Target's LUN number
- DWORD SRB_Timeout; // 0A/010 Timeout in half seconds
-}
-SRB_GetSetTimeouts, *PSRB_GetSetTimeouts, FAR *LPSRB_GetSetTimeouts;
-
-//*****************************************************************************
-// %%% ASPIBUFF - Structure For Controllng I/O Buffers %%%
-//*****************************************************************************
-
-typedef struct tag_ASPI32BUFF // Offset
-{ // HX/DEC
- PBYTE AB_BufPointer; // 00/000 Pointer to the ASPI allocated buffer
- DWORD AB_BufLen; // 04/004 Length in bytes of the buffer
- DWORD AB_ZeroFill; // 08/008 Flag set to 1 if buffer should be zeroed
- DWORD AB_Reserved; // 0C/012 Reserved
-}
-ASPI32BUFF, *PASPI32BUFF, FAR *LPASPI32BUFF;
-
-//*****************************************************************************
-// %%% PROTOTYPES - User Callable ASPI for Win32 Functions %%%
-//*****************************************************************************
-
-typedef void *LPSRB;
-
-#if defined(__BORLANDC__)
-
-DWORD _import GetASPI32SupportInfo( void );
-DWORD _import SendASPI32Command( LPSRB );
-BOOL _import GetASPI32Buffer( PASPI32BUFF );
-BOOL _import FreeASPI32Buffer( PASPI32BUFF );
-BOOL _import TranslateASPI32Address( PDWORD, PDWORD );
-
-#elif defined(_MSC_VER)
-
-__declspec(dllimport) DWORD GetASPI32SupportInfo( void );
-__declspec(dllimport) DWORD SendASPI32Command( LPSRB );
-__declspec(dllimport) BOOL GetASPI32Buffer( PASPI32BUFF );
-__declspec(dllimport) BOOL FreeASPI32Buffer( PASPI32BUFF );
-__declspec(dllimport) BOOL TranslateASPI32Address( PDWORD, PDWORD );
-
-#else
-
-extern DWORD GetASPI32SupportInfo( void );
-extern DWORD GetASPI32Command( LPSRB );
-extern BOOL GetASPI32Buffer( PASPI32BUFF );
-extern BOOL FreeASPI32Buffer( PASPI32BUFF );
-extern BOOL TranslateASPI32Address( PDWORD, PDWORD );
-
-#endif
-
-// Restore compiler default packing and close off the C declarations.
-
-#ifdef __BORLANDC__
-#pragma option -a.
-#endif //__BORLANDC__
-
-#ifdef _MSC_VER
-#pragma pack()
-#endif //_MSC_VER
-
-#ifdef __GCCWIN32__
-#pragma pack()
-#endif
-
-#ifdef __cplusplus
-}
-#endif //__cplusplus
-
-#endif //__WNASPI32_H__