From: Christian B. <cb...@st...> - 2001-02-01 17:32:49
|
Hi! On Tue, Jan 30, 2001 at 04:42:28PM +0100, Gwenole Beauchesne wrote: > Therefore, I traced down changes to those LowMem globals (0x1d4, 0x1d8, > and 0x1dc) and the most "frequent" ones are those initialized by some > code located at ROMBase + 0x92a. The code there is a little bit > obfuscated Let's see... SetupHWBases A00910: MOVE.L ($DD0),D0 ;AddrMapFlags (basesValid) A00914: MOVEA.L ($DD8),A0 ;UniversalInfoPtr A00918: ADDA.L (A0),A0 ;decoderInfoPtr A0091A: LEA ($A0094A,PC),A2 A0091E: MOVE.W (A2)+,D3 ;Offset in DecoderInfo (/4) A00920: BMI $A00930 A00922: MOVEA.W (A2)+,A3 ;Address of LM global A00924: BTST D3,D0 ;Base valid? A00926: BEQ $A0091E A00928: LSL.W #2,D3 ;Yes, set LM global A0092A: MOVE.L (0,A0,D3.W),(A3) A0092E: BRA $A0091E ... A0094A: 0002 01D4 ;VIA 1 Base A0094E: 0003 01D8 ;SCC Read Base A00952: 0004 01DC ;SCC Write Base A00956: 0011 01D8 ;SCC IOP Read A0095A: 0011 01DC ;SCC IOP Write A0095E: 0005 01E0 ;IWM Base A00962: 0010 01E0 ;SWIM IOP A00966: 0006 0B0A ;PWMBuf1 A0096A: 0006 0312 ;PWMBuf2 A0096E: 0007 0266 ;SoundBase (RAMSndBuf) A00972: 0008 0C00 ;SCSI Base A00976: 0009 0C04 ;SCSI DMA A0097A: 000A 0C08 ;SCSI Hsk A0097E: 000B 0CEC ;VIA 2 Base A00982: 000C 0CC0 ;ASC Base A00986: 000D 0CEC ;RBV Base A0098A: 000F 0C00 ;SCSI Base A0098E: 000F 0C04 ;SCSI DMA A00992: 000F 0C08 ;SCSI Hsk A00996: 0012 0CEC ;OSS Base A0099A: FFFF ;End The UniversalInfo contains as its first element (decoderInfoPtr) a pointer to a list of hardware base addresses. The AddrMapFlags (which also comes from the UniversalInfo) contains one bit for each of these addresses, signifying its validity. So you can replace hardware addresses by patching the DecoderInfo of the UniversalInfo used in the ROM (for example at the beginning of rom_patches.cpp/ patch_rom_32()). IIRC, ShapeShifter on the Amiga does this in exactly this way (all addresses except for the ASC base are redirected to ScratchMem). I chose not to do this in Basilisk II because it was more helpful during development to have Mac hardware accesses cause a segfault (so it drops into a debugger and you can see what went wrong). For a production version of B2 it seems better to silenty ignore illegal accesses (and have a "debug" option to turn on strict checking). Bye, Christian -- / Coding on PowerPC and proud of it \/ http://www.uni-mainz.de/~bauec002/ |