NetBoot/romdrv1.2/romdrv.c

1 line
30 KiB
C
Raw Normal View History

#include <Memory.h> #include <Devices.h> #include <Files.h> #include <Disks.h> #include <Errors.h> #include <Events.h> #include <OSUtils.h> #include <QuickDraw.h> #include "fc8-decompress-68000.h" #define NUM_CACHE_BLOCKS 16 #define CACHE_BLOCK_SIZE (64L*1024) #define NEED_DRVSTAT 1 #define NEED_ACCRUN 0 /* If NEED_ACCRUN is set, the dNeedTime (0x60) flag should be set in the header, and the * delayticks field in the header should be set to something sensible. */ unsigned long kRomDrvSize = 0x00380000L; Ptr kRomDrvLocation = (Ptr)0x40880000; // Macintosh low-memory globals unsigned long* BufPtr = (unsigned long*)0x010C; unsigned long* MemTop = (unsigned long*)0x0108; unsigned char* MMU32Bit = (unsigned char*)0x0CB2; unsigned char* LLKeyMap = (unsigned char*)0x0174; #pragma parameter __D0 ReadXPRam(__D0, __D1, __A0) short ReadXPRam(short size, short offset, char *where) = {0x4840, 0x3001, _ReadXPRam}; typedef void (*RomDrvCopyFunc)(unsigned char *, unsigned char *, unsigned long); struct CacheRecord { unsigned int isValid : 1; unsigned int isModified : 1; unsigned short hitCount; unsigned long timestamp; unsigned long diskOffset; unsigned char* pData; }; typedef struct CacheRecord CacheRecord; struct RomDrvContext { DrvSts2 drvsts; Ptr origcopyfunc; Ptr ramdisk; RomDrvCopyFunc copyfunc; unsigned char * disk; char initialized; char useram; char ram24at8mb; char usecache; char showedFullError; unsigned short numModifiedBlocks; unsigned long marker; unsigned long ioCount; unsigned long blocksLoaded; unsigned long blocksFlushed; CacheRecord cacheRecords[NUM_CACHE_BLOCKS]; }; typedef struct RomDrvContext RomDrvContext; #define ICON_NONE 0 #define ICON_DISK 1 #define ICON_TITLE 2 const unsigned char DiskIcon[258] = { 0xf, 0xff, 0xff, 0xe0, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x11, 0xff, 0xff, 0x10, 0x12, 0x1, 0x00, 0x90, 0x12, 0x00, 0x81, 0x90, 0x12, 0x00, 0x7e, 0x90, 0x12, 0x11, 0x3c, 0x90, 0x12, 0x11, 0x3c, 0x90, 0x12, 0x1, 0x18, 0x90, 0x12, 0x1, 0x00, 0x90, 0x12, 0x3, 0x00, 0x90, 0x12, 0x00, 0x00, 0x90, 0x12, 0x8, 0x40, 0x90, 0x12, 0x7, 0x80, 0x90, 0x12, 0x00, 0x00, 0x90, 0x12, 0x00, 0x00, 0x90, 0x11, 0xff, 0xff, 0x10, 0x10, 0x00, 0x00, 0x10, 0x8, 0x00, 0x00, 0x20, 0x3f, 0xff, 0xff, 0xf8, 0x20, 0x00, 0x00, 0x8, 0x2f, 0xff, 0xff, 0xe8, 0x20, 0x00, 0x00, 0x8, 0x2f, 0xff, 0xff, 0xe8, 0x20, 0x00, 0x00, 0x8, 0x20, 0x00, 0x00, 0x8, 0x20, 0x00, 0xf, 0xe8, 0x2c, 0x00, 0x00, 0x8, 0x20, 0x00, 0x00, 0x68, 0x20, 0x00, 0x00, 0x8, 0x3f, 0xff, 0xff, 0xf8, // mask 0xf, 0xff, 0xff, 0xe0, 0x1f, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xf0, 0xf, 0xff, 0xff, 0xe0, 0x3f, 0xff, 0xff, 0xf8, 0x3f, 0xff, 0xff, 0xf8, 0x3f,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