diff --git a/specifications/emuFeatureRegistersSpec.h b/specifications/emuFeatureRegistersSpec.h index e546cf2..c80fc62 100644 --- a/specifications/emuFeatureRegistersSpec.h +++ b/specifications/emuFeatureRegistersSpec.h @@ -6,7 +6,7 @@ All emu feature registers are 32 bit accessing them in any other way will be und These registers will do nothing it there corresponding feature bit is not set on launch. */ -#define EMU_REGISTER_BASE 0xFFFFE000/*just before the m68k hardware registers, in the same bank*/ +#define EMU_REGISTER_BASE 0xFFFC0000/*EMUCS on hardware*/ #define EMU_REGISTER_SIZE 0x1000 #define EMU_REG_ADDR(x) (EMU_REGISTER_BASE | x) diff --git a/src/hardwareRegisters.c b/src/hardwareRegisters.c index 0248882..3df8712 100644 --- a/src/hardwareRegisters.c +++ b/src/hardwareRegisters.c @@ -354,7 +354,7 @@ void printUnknownHwAccess(uint32_t address, uint32_t value, uint32_t size, bool debugLog("CPU read %d bits from register 0x%03X, PC:0x%08X.\n", size, address, m68k_get_reg(NULL, M68K_REG_PPC)); } -static uint32_t getEmuRegister(uint32_t address){ +uint32_t getEmuRegister(uint32_t address){ address &= 0xFFF; switch(address){ @@ -366,7 +366,7 @@ static uint32_t getEmuRegister(uint32_t address){ return 0x00000000; } -static void setEmuRegister(uint32_t address, uint32_t value){ +void setEmuRegister(uint32_t address, uint32_t value){ address &= 0xFFF; switch(address){ case EMU_CMD: @@ -392,7 +392,6 @@ static void setEmuRegister(uint32_t address, uint32_t value){ } uint8_t getHwRegister8(uint32_t address){ - //not emu or hardware register, invalid access if((address & 0x0000F000) != 0x0000F000) return 0x00; @@ -489,7 +488,6 @@ uint8_t getHwRegister8(uint32_t address){ } uint16_t getHwRegister16(uint32_t address){ - //not emu or hardware register, invalid access if((address & 0x0000F000) != 0x0000F000) return 0x0000; @@ -570,12 +568,8 @@ uint16_t getHwRegister16(uint32_t address){ } uint32_t getHwRegister32(uint32_t address){ - //32 bit emu register read, valid - if((address & 0x0000F000) != 0x0000F000){ - if((address & 0x0000F000) == 0x0000E000) - return getEmuRegister(address); + if((address & 0x0000F000) != 0x0000F000) return 0x00000000; - } address &= 0x00000FFF; @@ -606,7 +600,6 @@ uint32_t getHwRegister32(uint32_t address){ void setHwRegister8(uint32_t address, uint8_t value){ - //not emu or hardware register, invalid access if((address & 0x0000F000) != 0x0000F000) return; @@ -754,7 +747,6 @@ void setHwRegister8(uint32_t address, uint8_t value){ } void setHwRegister16(uint32_t address, uint16_t value){ - //not emu or hardware register, invalid access if((address & 0x0000F000) != 0x0000F000) return; @@ -1034,12 +1026,8 @@ void setHwRegister16(uint32_t address, uint16_t value){ } void setHwRegister32(uint32_t address, uint32_t value){ - //32 bit emu register write, valid - if((address & 0x0000F000) != 0x0000F000){ - if((address & 0x0000F000) == 0x0000E000) - setEmuRegister(address, value); + if((address & 0x0000F000) != 0x0000F000) return; - } address &= 0x00000FFF; diff --git a/src/hardwareRegisters.h b/src/hardwareRegisters.h index d2ea9e3..143467c 100644 --- a/src/hardwareRegisters.h +++ b/src/hardwareRegisters.h @@ -33,8 +33,9 @@ enum{ CHIP_A0_ROM = 0, CHIP_A1_USB, CHIP_B0_SED, - //CHIP_CX_RAM, // CSC* is owned by CSD during normal operation + //CHIP_CX_RAM, //CSC* is owned by CSD during normal operation CHIP_DX_RAM, + CHIP_00_EMU, //used for EMUCS on hardware, used by the emu registers here CHIP_REGISTERS, CHIP_NONE, CHIP_END @@ -89,9 +90,11 @@ void setWriteProtectViolation(uint32_t address); uint8_t getHwRegister8(uint32_t address); uint16_t getHwRegister16(uint32_t address); uint32_t getHwRegister32(uint32_t address); +uint32_t getEmuRegister(uint32_t address); void setHwRegister8(uint32_t address, uint8_t value); void setHwRegister16(uint32_t address, uint16_t value); void setHwRegister32(uint32_t address, uint32_t value); +void setEmuRegister(uint32_t address, uint32_t value); //config void resetHwRegisters(); diff --git a/src/memoryAccess.c b/src/memoryAccess.c index e0767f1..755d44c 100644 --- a/src/memoryAccess.c +++ b/src/memoryAccess.c @@ -120,6 +120,9 @@ uint8_t m68k_read_memory_8(uint32_t address){ case CHIP_DX_RAM: return ramRead8(address); + case CHIP_00_EMU: + return 0x00; + case CHIP_REGISTERS: return getHwRegister8(address); @@ -154,6 +157,9 @@ uint16_t m68k_read_memory_16(uint32_t address){ case CHIP_DX_RAM: return ramRead16(address); + case CHIP_00_EMU: + return 0x0000; + case CHIP_REGISTERS: return getHwRegister16(address); @@ -188,6 +194,9 @@ uint32_t m68k_read_memory_32(uint32_t address){ case CHIP_DX_RAM: return ramRead32(address); + case CHIP_00_EMU: + return getEmuRegister(address); + case CHIP_REGISTERS: return getHwRegister32(address); @@ -225,6 +234,9 @@ void m68k_write_memory_8(uint32_t address, uint8_t value){ ramWrite8(address, value); break; + case CHIP_00_EMU: + break; + case CHIP_REGISTERS: setHwRegister8(address, value); break; @@ -263,6 +275,9 @@ void m68k_write_memory_16(uint32_t address, uint16_t value){ ramWrite16(address, value); break; + case CHIP_00_EMU: + break; + case CHIP_REGISTERS: setHwRegister16(address, value); break; @@ -301,6 +316,10 @@ void m68k_write_memory_32(uint32_t address, uint32_t value){ ramWrite32(address, value); break; + case CHIP_00_EMU: + setEmuRegister(address, value); + break; + case CHIP_REGISTERS: setHwRegister32(address, value); break; @@ -329,22 +348,20 @@ uint32_t m68k_read_disassembler_32(uint32_t address){return m68k_read_memory_32( static uint8_t getProperBankType(uint32_t bank){ - if(BANK_IN_RANGE(bank, REG_START_ADDRESS, REG_SIZE) || ((bank & 0x00FF) == 0x00FF && registersAreXXFFMapped())){ - //registers have first priority, they cover 0xFFFFF000(and 0xXXFFF000 when DMAP enabled in SCR) even if a chip select overlaps this area or CHIP_A0_ROM is in boot mode + //registers have first priority, they cover 0xFFFFF000(and 0xXXFFF000 when DMAP enabled in SCR) even if a chip select overlaps this area or CHIP_A0_ROM is in boot mode + //EMUCS also cant be covered by normal chip selects + if(BANK_IN_RANGE(bank, REG_START_ADDRESS, REG_SIZE) || ((bank & 0x00FF) == 0x00FF && registersAreXXFFMapped())) return CHIP_REGISTERS; - } - else if(chips[CHIP_A0_ROM].inBootMode || (chips[CHIP_A0_ROM].enable && BANK_IN_RANGE(bank, chips[CHIP_A0_ROM].start, chips[CHIP_A0_ROM].lineSize))){ + else if(BANK_IN_RANGE(bank, EMU_START_ADDRESS, EMU_SIZE)) + return CHIP_00_EMU; + else if(chips[CHIP_A0_ROM].inBootMode || (chips[CHIP_A0_ROM].enable && BANK_IN_RANGE(bank, chips[CHIP_A0_ROM].start, chips[CHIP_A0_ROM].lineSize))) return CHIP_A0_ROM; - } - else if(chips[CHIP_A1_USB].enable && BANK_IN_RANGE(bank, chips[CHIP_A1_USB].start, chips[CHIP_A1_USB].lineSize)){ + else if(chips[CHIP_A1_USB].enable && BANK_IN_RANGE(bank, chips[CHIP_A1_USB].start, chips[CHIP_A1_USB].lineSize)) return CHIP_A1_USB; - } - else if(chips[CHIP_B0_SED].enable && BANK_IN_RANGE(bank, chips[CHIP_B0_SED].start, chips[CHIP_B0_SED].lineSize) && sed1376ClockConnected()){ + else if(chips[CHIP_B0_SED].enable && BANK_IN_RANGE(bank, chips[CHIP_B0_SED].start, chips[CHIP_B0_SED].lineSize) && sed1376ClockConnected()) return CHIP_B0_SED; - } - else if(chips[CHIP_DX_RAM].enable && BANK_IN_RANGE(bank, chips[CHIP_DX_RAM].start, chips[CHIP_DX_RAM].lineSize * 2)){ + else if(chips[CHIP_DX_RAM].enable && BANK_IN_RANGE(bank, chips[CHIP_DX_RAM].start, chips[CHIP_DX_RAM].lineSize * 2)) return CHIP_DX_RAM; - } return CHIP_NONE; } diff --git a/src/memoryAccess.h b/src/memoryAccess.h index adfdc81..8eb688c 100644 --- a/src/memoryAccess.h +++ b/src/memoryAccess.h @@ -16,10 +16,12 @@ //after boot RAM is at 0x00000000, //ROM is at 0x10000000 //and the SED1376 is at 0x1FF80000(+ 0x20000 for framebuffer) +#define EMU_START_ADDRESS 0xFFFC0000 #define REG_START_ADDRESS 0xFFFFF000 #define SUPERMASSIVE_RAM_SIZE (128 * 0x100000)//128mb RAM #define RAM_SIZE (16 * 0x100000)//16mb RAM #define ROM_SIZE (4 * 0x100000)//4mb ROM +#define EMU_SIZE 0x20000 #define REG_SIZE 0x1000//is actually 0xE00 without bootloader #define BOOTLOADER_SIZE 0x200 #define SED1376_MR_BIT 0x20000 diff --git a/tools/palm/hwTestSuite/TstSuite.rcp b/tools/palm/hwTestSuite/TstSuite.rcp index b7df685..8d93823 100644 --- a/tools/palm/hwTestSuite/TstSuite.rcp +++ b/tools/palm/hwTestSuite/TstSuite.rcp @@ -9,9 +9,5 @@ MESSAGE "^1" BUTTONS "OK" END -//ICONFAMILY "icon_1.bmp" "icon_2.bmp" "icon_4.bmp" "icon_8.bmp" -//SMALLICON "icon_sm.bmp" // icon for P3 list view -//so fracking tired of the icon shit, it can be blank for now - APPLICATION ID 1 "TstS" VERSION ID 1 "1.00" diff --git a/tools/palm/hwTestSuite/TstSuiteRsc.h b/tools/palm/hwTestSuite/TstSuiteRsc.h index 42ba00c..3df514d 100644 --- a/tools/palm/hwTestSuite/TstSuiteRsc.h +++ b/tools/palm/hwTestSuite/TstSuiteRsc.h @@ -1 +1 @@ -#define alt_err 1000 +#define alt_err 1000 diff --git a/tools/palm/hwTestSuite/testSuite.c b/tools/palm/hwTestSuite/testSuite.c index 75ded3a..00ad325 100644 --- a/tools/palm/hwTestSuite/testSuite.c +++ b/tools/palm/hwTestSuite/testSuite.c @@ -309,4 +309,3 @@ DWord PilotMain(Word cmd, Ptr cmdBPB, Word launchFlags){ return 0; } - diff --git a/tools/palm/muExpansionDriver/MuExpDriver.rcp b/tools/palm/muExpansionDriver/MuExpDriver.rcp new file mode 100644 index 0000000..41479c3 --- /dev/null +++ b/tools/palm/muExpansionDriver/MuExpDriver.rcp @@ -0,0 +1,13 @@ +#include "MuExpDriverRsc.h" + +ALERT ID alt_incompatible +ERROR +BEGIN +TITLE "Incompatible Device" +MESSAGE "^1" + +BUTTONS "OK" +END + +APPLICATION ID 1 "MuDv" +VERSION ID 1 "1.00" diff --git a/tools/palm/muExpansionDriver/MuExpDriverRsc.h b/tools/palm/muExpansionDriver/MuExpDriverRsc.h new file mode 100644 index 0000000..00bd2a1 --- /dev/null +++ b/tools/palm/muExpansionDriver/MuExpDriverRsc.h @@ -0,0 +1 @@ +#define alt_incompatible 1000 diff --git a/tools/palm/muExpansionDriver/muExpDriver.c b/tools/palm/muExpansionDriver/muExpDriver.c index 8b13789..17fde74 100644 --- a/tools/palm/muExpansionDriver/muExpDriver.c +++ b/tools/palm/muExpansionDriver/muExpDriver.c @@ -1 +1,24 @@ +#include +#include +#include +/*dont include this anywhere else*/ +#include "MuExpDriverRsc.h" + + +void installTrapHandlers(){ + +} + +void showGui(){ + +} + +DWord PilotMain(Word cmd, Ptr cmdBPB, Word launchFlags){ + if(cmd == sysAppLaunchCmdNormalLaunch) + showGui(); + else if(cmd == sysAppLaunchCmdSystemReset) + installTrapHandlers(); + + return 0; +}