MapRZ2 V1.0 RetinaZ2mapped V1.0 RetinaZ2mappedRE V1.0 by Christoph Niedeggen 1995-1996 Index 1. Disclaimer 2. Purpose 3. Files in the archive 4. Getting started 5. Principle of MapRZ2 6. Possible Improvements 7. Known Bugs 8. Configuration used by me 9. How to contact me 10. Thanks to Appendix A: Used Memory Map Appendix B: MMU address translation settings (68851, 68030) 1. Disclaimer MapRZ2, RetinaZ2mapped and RetinaZ2mappedRE are in the public domain. Use this software at your own risk. In no event will the author, Christoph Niedeggen, be liable for any direct, indirect, or consequential damages resulting out of the use of or inability to use this software. The program is not in a finished state since I had to stop the development in January and cannot continue until about July/August 1996 (I am currently studying in England and my Amiga is still in Germany.) However, I think it might be useful for some people in its current state and probably someone already wants to continue the development. Improvements of the program for non-commercial purposes are welcome. Please contact me if you plan to do so. Without being able to use my Amiga I am not able to answer all potential questions, but please feel free to send me comments and suggestions about MapRZ2. 2. Purpose The Retina Z2 hardware only supports segmented access to the display memory via a 64k window. Normally this is not a problem because the Retina hardware is accessed by 'retina.library', but some programs benefit from direct access to the display memory. MapRZ2 uses an MMU (currently 68851 or 68030) to map the segmented RetinaZ2 memory to a linear chunk in the virtual memory space. RetinaZ2mapped and RetinaZ2mappedRE (RE = RetinaEmu) are external video drivers for ShapeShifter which take advantage of MapRZ2. Because the display does not have to be refreshed anymore (currently just in 256 colour mode), the emulation becomes much quicker - the access speed to the display memory is now just limited by the Retina hardware. Another big advantage is that no display buffer in Fast RAM is necessary, thus leaving more memory for the emulation. Because MapRZ2 is a program on its own, the linear display memory could be used for other programs as well, e.g. it might be possible to write a RetinaZ2 driver for the CyberGraphics system. Up to now the segmented mode has prevented to write such a driver. 3. Files in the archive Source/make batchfile to generate executables with PhxAss Source/MapRZ2.asm source code for MapRZ2 Source/RetinaZ2mapped.asm source code for SS EVD driver Source/RetinaZ2mappedRE.asm source code for SS EVD driver VGADOC/clock.txt information about various clock circuits VGADOC/intro.txt some information about VGA programming on PCs VGADOC/ncr.txt information about special NCR VGA registers VGADOC/ramdac.txt information about various RAMDACs VGADOC/readme.txt main readme of VGADOC v4 VGADOC/vgaregs.txt information about general VGA registers Video_Drivers/RetinaZ2mapped SS EVD driver, works without RetinaEmu Video_Drivers/RetinaZ2mappedRE SS EVD driver, needs RetinaEmu to be running MapRZ2 main program MapRZ2.doc this documentation 4. Getting started - Copy the two files in 'Video_Drivers' to the 'Video Drivers' directory of ShapeShifter. - Turn FastROM off. Otherwise you lose 512 kBytes of memory since this is not handled by MapRZ2 yet. - Run the program MapRZ2. After that it's possible to access the Retina display memory at $01c00000 - $01ffffff. - Start ShapeShifter. - Select one of the new drivers. The 'RE' version needs RetinaEmu to be running, the other one runs without it and therefore saves some memory. - Select 8 bit and enter the desired screen resolution. - Set refresh rate to 10. The refresh is just used to set the pointer to the Bus Error Handler at $8 to the Handler of MapRZ2 after the Mac OS has altered it and before the Video RAM is accessed. It might be useful to chose a different rate for different processors (10 works fine on a 68030 with 25 MHz.) 5. Principle of MapRZ2 The MMU is used to treat the 64k Retina memory window (RMW) and the virtual Retina memory (VRM) in a special way: As long as the Retina is accessed the usual way, just the RMW is used. In this case, programs access the RMW directly and the VRM is marked invalid for the MMU so that accesses to it can be detected. Once the VRM is accessed, MapRZ2 switches to the linear Mode: Important registers (see below) of the NRC VGA chip are saved, the VGA chip is set to a two 32k segments mode (see below), the RMW is marked invalid for the MMU and the accessed 32k page of VRM is set valid, pointing to one of the two 32k segments of the Retina. 'Important' VGA registers are any registers which influence the way the 64k segment is accessed - at least all registers that are changed by 'retina.library' and RetinaEmu. Since I did not have a documentation to the NCR VGA chip when I wrote MapRZ2, I found these registers by partially disassembling the Retina software. Therefore other registers could be affected as well - even though I did not realise any misbehaviour with V1.0 of MapRZ2. The VGA chip offers the possibility to split the 64k segment into two halves. To use two 32k segments instead of one 64k segment is very useful if display memory is copied from one location to another, which occurs e.g. every time a window is moved. Otherwise the 64k segment pointer would have to be changed for every single byte (or longword ;-) If an invalid page is accessed in linear mode, the 'older' 32k segment is used: The according page is set invalid, the new page valid and the segment pointer to the equivalent location. Finally, if the RMW is accessed again, both valid 32k pages of the VRM are set invalid, the saved VGA registers are restored and the RMW is marked valid, pointing to the Retina hardware. 6. Possible Improvements - FastROM option with support of an already installed FastROM/KickROM - Option to select the address where the linear Retina memory block is installed (probably with auto detect of free memory areas) - Replacement of the 'pflusha' commands by the 'pflush' command (I did not have enough information about this) - Support of other processors (68040, 68060) - Option to uninstall MapRZ2 - Better support of the Bus Error Handler by ShapeShifter (to avoid the altered use of the Screen Refresh.) Probably Christian Bauer could implement a new pointer to the Video Driver Interface that is called just once after the Mac OS has changed this pointer and before the video memory is accessed. But even without this it might be possible to turn off the refresh (or to set the rate very slow) after it has successfully changed the pointer. - Better names for the variables and constants related to the VGA chip (RETINA_REGNUM, RETINA_REGVAL, SEG_..., RetinaRegB, RetinaSeg...). I chose them before I downloaded VGADOC, which explains the function of the different registers and suggests better names for them. - Support of 4, 16 and 24 bit modes. Usual refresh routines might be used as I doubt that other modes than the 8 bit mode are compatible to the NCR VGA chip. - RetinaZ2 support for the CyberGraphics system. CyberGraphics needs linear display memory and therefore it was not possible to write a driver for the RetinaZ2 yet. Since MapRZ2 is a program on its own that allows linear access to the Retina memory, it now should be possible to provide such a driver. In fact it should not differ too much from the RetinaZ3 driver, because the used NCR VGA chips are quite similar. Since this driver would just use the virtual 'linear mode', it would not be necessary to save registers of the VGA chip by the Bus Error handler and therefore this handler could be shorter and quicker. 7. Known Bugs With the new display drivers, Macintosh debuggers like MacsBug don't work anymore. I assume that the Bus Error Exception does not work together with other exceptions when the debugger is running. Virtual Memory Systems may not work because they also use the Bus Error Handler. However, it might be possible to use several Bus Error Handlers in a quite system friendly way (they have to check if the faulty address affects them and call the next handler if not.) The current version uses the memory area $01000000-$01ffffff which might not work together with some system configurations. Soft Kickstarts don't work because MapRZ2 doesn't support FastROM yet. 8. Configuration used by me A2000, OS 3.1, A2630 with 8 MBytes, RetinaZ2 with 4 MBytes and software V2.3, Evolution V3.0 harddrive 9. How to contact me until (mid/end) June 1996 Christoph Niedeggen 5 Stannington Avenue Newcastle upon Tyne NE6 5AA England e-mail: C.W.Niedeggen@ncl.ac.uk from July/August 1996 Christoph Niedeggen Jodokusstr. 1 D-53332 Bornheim Germany e-mail: Eggen@genesis.informatik.rwth-aachen.de 10. Thanks to Christian Bauer for ShapeShifter Frank Wille for PhxAss Martin Apel for ADis Finn Thøgersen for VGADOC (full version at ) Juergen Wahlmann for beta testing and his help Escom for continuing the development of the Amiga Sting for his great music Appendix A: Used Memory Map 00000000-001fffff 2M Chip RAM (no caching) 00200000-009fffff 8M Fast RAM 00a00000-00bbffff 1792K reserved 00bc0000-00bfffff 256K CIAs (no caching) 00c00000-00d7ffff 1536K Ranger RAM / reserved 00d80000-00dbffff 256K reserved 00dc0000-00dfffff 256K clock chip and Custom Chips (no caching) 00e00000-00e7ffff 512K reserved 00e80000-00efffff 512K AutoConfig area, including Retina hardware (no caching) 00f00000-00f7ffff 512K reserved 00f80000-00ffffff 512K ROM (write protected, might be mapped to FastRAM) 01000000-0101ffff 128K mirrored Retina hardware for access by Bus Error Handler 01020000-0103ffff 128K reserved 01040000-01bfffff 12032K reserved 01c00000-01ffffff 4M linear Retina memory 02000000-ffffffff 4064M mapped linearly Appendix B: MMU address translation settings (68851, 68030) 31 15 0 | | | aaaa aaaa bbbb bb cc c ooo oooo oooo oooo _________ _______ ____ __________________ A-FIELD B-FIELD C-F Remaining Offset page size at level C: 32 KBytes page size at level B: 256 KBytes page size at level A: 16 MBytes