MagiC 3.0x On The Falcon030, 4th Try - Release 08/11/95 ------------------------------------------------------- 1. Preface ---------- First, I'd like to thank Sebastian-Alexander Gierth very much for translating most parts this document. It was his contribution (see section 8), you see, it's not necessary to send me money. 1.1 Additionals To The 1st Release ---------------------------------- The version of this "hack" thought for MagiC 2 should be well-known to some people, but due to the fact that today many of you are only interested in running MagiC 3 on the Falcon, I've adapted the hack to it. The procedure is nearly the same, as is this text. Nevertheless, I've decided to make a separate archive out of it, to avoid sentences like "If you have MagiC 2, you must now... But not with MagiC 3, here you have to..." and to prevent confusion. At very first: I'm *not* able to give any warranty about the correct function of this hack, therefore everyone should see that all he/she does runs *at own risk* (specially the described patches of MAGIC.RAM). I don't take any liability for damages occurring directly or indirectly by execution of the things descibed here or the use of programs contained in this archive ("indirectly" includes explicitly effects that occur by the later use of the "hacked" MagiC). I've not asked ASH for permission to publish this hack, but since they "allowed" the publication of the version for MagiC 2, I'm sure they don't have any objections. Besides, there couldn't be anything against me doing so, because of all of the programs in this archive bearing my copyright... Before you rush into the executional part with huge expectation, you should first read through section 5 about the limitations and reflect well if you want to give it a try nevertheless. Well, if someone shouldn't have noticed: This hack is made for MagiC _3.0x_, the adaptation for Magic 2 is available as MGX2FCRx.LZH. Besides, I ask you to pay a fee for my labour in form of contributions of money or other things (more details in section 8). For this work at this hack for MagiC 3 (of course most work has already been done in the version for MagiC 2), a professional programmer would have been given good cash, and therefore it would be just fair to pay me a small tribute, especially since ASH won't do anything for me... 1.2 Additionals To The 2nd Release ---------------------------------- Uh-oh, a very stupid failure: For using the second type of the patch to prepare higher resolutions (in short: video-patch), you have to look for a sequence of bytes which contains a system variable of MagiC. Unfortunately, I've forgotten that this variable has a different address in MagiC 3, and thus a different byte-sequence has to be found. So everybody who tried to use this second type of the video-patch failed because he/she couldn't find the correct byte-sequence. Sorry, I've simply overlooked that... Those who want to use the patch now will find the correct sequence in 3.2.1. 1.3 Additionals To The 3rd Release ---------------------------------- Unfortunately, I've had to notice that the bsr.w-command found in the byte-sequence for the patch in 3.2.4 has varying offsets, depending on the date of MagiC 3. Therefore, the byte-sequence could only be found in a specific version of MAGIC.RAM (as far as I remember it was release 04/03/95). Many thanks to Stefan Marion who has reported this bug to me. Fortunately, the affected bsr.w-command isn't necessary for precisely finding the correct position, so it has now been removed from the byte- sequence in 3.2.4. 1.4 Additionals To The 4th Release ---------------------------------- Because some of you had problems patching the file MAGIC.RAM, I've written a little program that does this for you. The patches are still described in here, for those who don't trust my patchprogram and want to do it themselves. Moreover, I've improved the FixMe-booter a bit (longer delay after the SCSI-reset, multiple attempts to access the rootsectors of the harddrives), because someone told me he had problems with booting from SCSI. I don't know if the new method has helped him (I really dislike not getting any feedback), but I hope that there no longer are problems with booting from SCSI. I've successfully tested booting with a Seagate ST9080A (IDE) and a Quantum LP105S (SCSI), independet of the driver (I've been able to check it with AHDI, HDDriver and HuSHI). 2. Main Differences To The Hack For MagiC 2 ------------------------------------------- For those who are interested, here's a short list of the differences between the two hacks: - The system-variable needed to make MagiC detect DD-disks correctly, is located at a different address, so MGFPATCH.PRG has to be adapted. - A new patch for MAGIC.RAM is necessary, because MagiC 3 crashes after the FixMe-bootsector has loaded the harddisk-driver. As far is I've found out, this is due to the fact that a subroutine isn't executed when the hdv_rw-vector has been changed by the bootsector (which is done by FixMe, because it runs the harddisk-driver), leading to serious problems in memory management. With the new patch, this won't happen. - MagiC 3 has the new GEMDOS-call Srealloc which is necessary for Screenblaster/BlowUP to allocate memory for the screen, but unfortunately Srealloc returns 0 (at least for BlowUP), although enough memory should be available. Therefore, MGFVIDEO.PRG has remained unchanged, which may lead to some memory loss, but in my eyes this is not a very serious problem. - For the second type of the video-patch (see 3.2.1 for details), you have to look for a slightly different byte-sequence. However, it has to be replaced with the same new values as before. 3. What Is To Do? ----------------- I will explain the procedure step by step: Installation of MagiC and the additional programs on harddisk, the necessary patches for MAGIC.RAM, preparations for higher resolutions, creation of the FixMe- bootsector and probably additional steps. 3.1 Installation Of MagiC And The Additional Programs ----------------------------------------------------- At first you have to make the Falcon boot in ST-medium what is accomplished easily with one of the many NV-RAM configuration tools. You have to care about choosing the compatibility mode with 640 * 200 in 4 colours and *not* by mistake 640 * 240 in 4 colours. The ones operating their Falcons only with the SM124 of course don't have to worry about this at all... If you don't want to do so, maybe because ST- medium just looks terrible on a VGA-monitor, you may copy STMED.PRG into the auto-folder as an alternative, more on that at the end of the next paragraph. You install MagiC by running the installation program on your boot partition (normally C:), resolution "default". Then you should place MAGXBOOT.PRG at the most possible physical beginning of the AUTO folder with a suitable utility (e.g. XBoot or DirSort), the best place is right behind the possibly existing boot selector. If you want to use STMED.PRG instead of fiddeling with the boot-configuration as described above, you now have to place it physically in front of MAGXBOOT.PRG, because otherwise MagiC will use a wrong (even dangerous for some monitors) video-mode at startup. Next, you copy MGFPATCH.PRG from this archive to the AUTO folder of the boot partition, most possibly right behind MAGXBOOT.PRG. All those who don't just want to work in ST-medium have to copy MGFVIDEO.PRG to the AUTO folder, physically *in front of* an existing NVDI. Further information to this point in section 3.3. As last additional program you have to copy MGFSNDFX.PRG to the AUTO file, the position is irrelevant here. 3.2 Necessary Patches For MAGIC.RAM ----------------------------------- For operating on the Falcon you have to do some changes in MAGIC.RAM. The changes have to be made by looking for and replacement of byte sequences, because existing of different version of this file and the offsets varying from version to version. If one of the byte sequences can't be found (unlikely) you can't perform the respective patch what can cause problems in using this MagiC on the Falcon. If the mentioned byte sequence to look for exists more than once, definite patching is impossible what also will cause problems while running the Falcon. However, this is also very unlikely, but is mentioned for reasons of security. For performing the patches you can use a disktool that can analyse a file looking for byte sequences and allows editing, or a debugger. As disktool I recommend Diskus, as debugger you can use Peacebug or Bugaboo (you have to load MAGIC.RAM by LOAD and not by LEXECUTE!). The principal method is simple: You have to look for a given byte sequence and change it wholly or partly. You have to be careful with the patch described in 3.2.2, because you have to look for 4 words, but replace 24 words. In this case you don't just have to replace the 4 found words, but also the 20 following words! Before you start patching you should first generate a copy of MAGIC.RAM for being able to proceed without having to install again if something strange occurs. Those who don't like patching "by hand" may use PATCHRAM.PRG found in this archive. When run, it first lets you select the MAGIC.RAM which should be patched. Then you have to select what type of video-patch you want to use (see 3.2.1 for details). When all patches have been successful, you are asked if you want to save the new file. If so, the program will rename the existing MAGIC.RAM to MAGIC.BAK and save a new MAGIC.RAM. PatchRAM automatically detects if a byte-sequence can't be found or is ambiguos and will abort with an appropriate message. Of course, you have to run the patched version of MAGIC.RAM only on the Falcon!!! 3.2.1 Preparation Of Higher Resolutions And Operation With SM124 ---------------------------------------------------------------- These two patches are only needed if you want to run MagiC with the SM124 or, with other monitor types, not just in ST-medium. There are two different possibilities, you have to decide for one of them, because using both would be senseless (Type 2 includes Type 1). Type 1: ------- This simple patch keeps the Falcon from performing a reset when a change in resolution is noticed. At the SM124, resolution changes are permanently noticed, at the rest of the monitors when using other resolutions than ST-low or ST-medium. Disadvantage: You can use STE-DMA- sound only on the SM124, because with the first sample data being played it's switched to ST-high (with the genuine ST-Sync-data!). Look for byte sequence 0x6010, 0x4a01, 0x6a1a and replace 0x6a1a by 0x601a in MAGIC.RAM. Type 2: ------- This larger (and more risky) patch removes the complete resolution acknowledgement from the VBL-routine in MagiC, eliminates the reset and provides DMA-sound being played on all monitor types. Disadvantage: A new jump command is created, and there's no guarantee that it will hit the right target in every version of MagiC. Look for byte sequence 0x4a38, 0x0d2c, 0x676a, replace the first two data by 0x6000, 0x00ac in MAGIC.RAM. 3.2.2 Adaptation Of The Disk-Write Routines ------------------------------------------- The floppy disk control of the Falcon is slightly different to the TT. This is why programs addressing the hardware directly hang up with two bombs when writing, and so does the MagiC-Kernel. The following patch squeezes the necessary Bittest-loop on the Falcon into the MagiC- diskroutines by replacing an 68030 test what of course doesn't matter at all. Special thanks to Uwe Seimet who explained to me the mentioned difference between TT an Falcon. For this patch look for bytesequence: 0x611e, 0x31c6, 0x8604, 0x4e75. From the found position (inclusive!) set these data (don't insert, only overwrite!): 0x6126, 0x31c6, 0x8604, 0x6018, 0x611e, 0x31c7, 0x8604, 0x6010, 0x6116, 0x3e38, 0x8604, 0x4e75, 0x610e, 0x3038, 0x8604, 0x4e75, 0x0838, 0x0003, 0x860f, 0x66f8, 0x48e7, 0xc000, 0x4e7a, 0x0002. 3.2.3 Preparation For Warm Starts By Keyboard --------------------------------------------- Normally, MagiC hangs up when trying to perform a warm start by CTRL- ALT-DEL. The same happens when changing resolution from Thing or Ease. Because of not being able to solve this problem by just putting in an additional reset routine (what is done by MGFPATCH.PRG, see after) the warm start routine of MagiC has to be replaced by a call of the "genuine" warm start routine (MagiC isn't lost, because it is in the reset vector). Look for byte sequence 0x4238, 0x0426, 0x46fc, 0x2700, 0x0c78 and replace the last three data by 0x2078, 0x0004, 0x4ed0 in MAGIC.RAM. 3.2.4 Preparation For Booting From Harddisk ------------------------------------------- As already described in section 2, a special patch is needed to successfully boot from harddisk (in addition to the FixMe-bootsector). Look for the byte sequence 0x205f, 0xb1f8, 0x0476, 0x660a and replace 0x660a with 0x6604. 3.3 Higher Resolutions ---------------------- If you want to run MagiC not only in ST-medium, you have to make more preparations. Very important: The mentioned file MGFVIDEO.INF always has to be finished with a CR/LF or LF, it mustn't be finished directly with a number! You also have to use XControl with Colour-CPX, because you'll have wrong standard colours otherwise. 3.3.1 Without NVDI ------------------ If you don't have NVDI, you can only run 640*400*2 (ST-high), but this might be better than nothing... Create the file MGFVIDEO.INF in the root directory of the boot partition or in the AUTO folder and write the following into it: 1:32768 There's nothing more to do. 3.3.2 Using NVDI And Screenblaster/BlowUp ----------------------------------------- Using Screenblaster I/II you can run higher resolutions with 2, 4 or 16 colours, using BlowUp only in 2 or 16 colours. I'm sorry that the Screenblaster III software won't run. Perhaps it works, if you write #_DEV5 into MAGX.INF, but I couldn't check this until now. You can try it anyway... First of all the memory allocated by the maximum of used resolution and colour must be calculated (although MagiC 3 knows Srealloc, there are problems with BlowUP, therefore MGFVIDEO must reserve the memory statically in advance and simulate Srealloc). The formula is: (x-resolution * y-resolution) / colour factor + 512 The colour factor is 2 for 16 colours, 4 for 4 colours and 8 for 2 colours. E.g. if you want to use maximum 800*608*16, you get 243712. Next, you have to create the file MGFVIDEO.INF in the root directory or in the AUTO folder and write the following into it: For BlowUp in 2 colours: 1: For BlowUp in 16 colours: 2: For Screenblaster: 0: Of course, you have to insert the number you have calculated before for the maximum resolution into , e.g. 243721 for 800*608*16. Using Screenblaster I/II you have to replace the 1 in line #_DEV 1 of the file MAGX.INF by the data for the desired default colour depth (the file is located in the root directory of the boot partition): 2 for 16 colours, 3 for 4 colours, 4 for 2 colours. Perhaps Screenblaster 3 works if you set a 5 here, but this is only guessed! Important: This is only for Screenblaster! Using BlowUp or no resolution enhancer there must remain the 1! Besides, it may happen that the Screenblaster-screen for choosing the resolution looks rather strange, but this shouldn't irritate anyone... 3.3.3 Using NVDI Without Resolution Enhancer -------------------------------------------- This is also possible, however you can only run 640*400*2 (ST-high) or 640*480*16 (TT-medium). For ST-high MGFVIDEO.INF in the root directory of the boot partition or in the AUTO-folder must contain: 1:32768 For TT-medium it must be: 2:154112 3.4 Creation Of The FixMe-Bootsector ------------------------------------ For booting you have to write a special bootsector on a HD-floppy disk which performs the following (assuming active MagiC): - reading the real time clock and writing the current time/date to the GEMDOS/XBIOS clock - Correction of the system cookie (setting _SND to 3, because lack of the XBIOS calls for the sound subsystem) - Reset of the SCSI bus (this can't happen in the reset routine installed by MGFPATCH, because the system timer is still inactive) - Boot try from the desired device(s) For installation of the bootsector serves FIXINST.PRG. After starting the programs asks what type of bootsector you want to create. IDE means: Booting commences at IDE device 0, then at the SCSI devices 0-7. SCSI means: Booting commences at the SCSI devices 0-7, then at the IDE device 0 (this is for users who don't have an internal harddisk to get rid of the timeout). DISK means: MagiC will boot from floppy disk. In this case there must be created an AUTO folder on the disk, which must contain first the harddisk driver and right behind it the program AUTOX.PRG (from file AUTOX of this archive). The X of AUTOX.PRG has to replaced by the character of the desired boot partition, for most cases by C. By doing so, the AUTO folder of the harddisk is executed. Next, you have to select if the VDO cookie displays STE or Falcon video- hardware. Only select STE if you don't have NVDI or you don't want to use MGFVIDEO with NVDI. Now the bootsector is written to floppy disk after a cancel dialog. There is also created a FIXME.OVL file in the root directory which in any case mustn't be deleted, because booting will fail otherwise! 3.5 Remaining Steps ------------------- The preparation of MagiC 3 is finished for the Falcon, you just have to pay attention to one important point: If you use XBOOT, you should place STMED.PRG between XBOOT and MAGXBOOT, that switches back to ST- medium after you quit XBOOT. Besides, you mustn't start XBOOT from MagiC, because XBOOT will try to set a higher resolution what is not possible at this early stage of the boot process. If you're ready you can reset your computer and see if everything works allright (the floppy disk with the fixme-bootsector of course has to be in the slot). You should first run most possibly few accessories and AUTO folder programs (except the obligatory necessary ones for MagiC), because some of them don't like MagiC. Specially, you don't have to run Falcon-specific things, otherwise ---> trash... If MagiC doesn't run allright after the reset see section 7, and if this is frustrating, you also can contact me. 4. Short Description Of The AUTO-Folder-Programs ------------------------------------------------ MGFPATCH.PRG: This resident program installs a reset routine that resets the video- and sound hardware, because otherwise the warmstart hangs up. Additionally, it links to the BIOS and XBIOS trap and enables DD floppies to be recognized correctly by temporarily changing a system variable of MagiC. MGFVIDEO.PRG: This likewise resident program links to GEMDOS and XBIOS and simulates the GEMDOS call Srealloc and some XBIOS calls of the Falcon according to the contents of MGFVIDEO.INF. They don't exist really, but are just implemented in a way that Screenblaster/BlowUp will be deceived. MGFSNDFX.PRG: Sets the sound subsystem to the STE-compatible mode. Being not resident you can start it subsequently too what can be necessary if a program with STE-DMA-sound overwrites 0xff8900 and thus switches off the frame- end-interrupts. STMED.PRG: Mini program that switches to ST-medium. AUTOX.PRG: Program to execute an AUTO folder on any other GEMDOS device (see separate manual in the folder AUTOX of this archive). 5. Limitations Of MagiC 3 On The Falcon --------------------------------------- - The serial interface seems to be unwilling to work (I can't test this myself). If you use HSMODEM it's allright! - Higher resolutions are limited (see chapter 3.3) - Background-DMA doesn't work, neither with IDE-, nor with SCSI- harddisks. Therefore, you have to deactive this option. You may be able to use background-DMA for the floppydisks with the program FLOCK_OK.PRG found on the MagiC-3-installation-disk, but I haven't tested that! - Of course, even MagiC 3 doesn't have any of the new system functions of the Falcon, therefore the sound subsystem, DSP and VIDEL only can be used by directly accessing the hardware. - There is a good reason why SndFix is not integrated into the FixMe- bootsector: Some programs with STE-DMA-sound overwrite 0xff8900, so that all frame-end-interrupts are switched off. In this case, MGSNDFX.PRG must be run again, then you should be able to play samples again. - You should only use programs with STE-DMA-sound using the SM124 or the 2nd video patch, because otherwise MagiC tries to switch to ST- high (with 71 Hz, and this will always crash...) - Booting MagiC the floppy disk with the FixMe-bootsector *must* be inserted, otherwise failure! - If you consider all these limitations, MagiC 3.0x will run properly on the Falcon. However, not eveything runs as it should, therefore it's better to wait for the official version for Falcon, if you want to use MagiC in continuous operation. In my eyes, it's nevertheless very useable when you don't need to run Falcon-specific software. 6. May I Distribute The Hack? ----------------------------- Sure. But only without fee (PD-sellers only if the disk fee is <= 10 DM) and only the original archive (packed!). This is no nasty trick, it's only thought to guarantee that no file misses and this text remains unchanged. AUTOX (in the corresponding file of the archive) may be distributed separately, further information are in the description. 7. Troubleshooting ------------------ As I said before, I'm sorry that I'm not able to guarantee the correct function of the procedures described above. As for myself, the hack was checked on two Falcons with TOS 4.01 and 4.04 (TOS version being actually irrelevant) and I know several people who also ran my hack successfully. But I also know cases where malfunction occurred (with the old version). Therefore, here's a short list with problems and possible solutions. Problem: Running MAGXBOOT.PRG the Falcon switches to a silly video mode (flickers like hell) and nothing else happens. Possible Solution: It was forgotten to let the Falcon boot in ST-medium, or there's XBOOT or another program that doesn't switch back to ST-medium in front of MAGXBOOT. In the first case, change configuration (really use the _compatibility mode_ 640*200*4), in the second case deactivate XBOOT or the responsible program or place STMED.PRG from this archive directly in front of MAGXBOOT. Problem: The harddisk driver doesn't recognize any or not all the harddisk drives if booting is performed from harddisk. Possible solution: For a quick check, use the FixMe-bootsector for floppy operation (don't forget the AUTO folder on the floppy disk, see 3.4.) or use another driver (e.g. AHDI). Problem: The harddisk driver doesn't recognize the harddisk drives if loaded from floppy disk. Possible solution: Sorry, only this: Use another driver, e.g. AHDI or HDDriver, because the active driver seems to try to access the harddisks by DMAread even when booting from floppy disk. Problem: After starting MagiC or after reset there's no booting from harddisk, instead the desktop appears with a file selector asking for an executable file. Possible solution: With huge probability it was forgotten to put in the floppy disk with the FixMe-bootsector, because MagiC won't be able to boot properly and of course isn't able to find the real desktop. Unluckily, the reset routine of MGFPatch isn't active any more, therefore you have to run a cold start. Problem: The higher resolution appears as desired, but the colors are set incorrect. Possible solution: It was forgotten to use XControl with the colour-CPX setting the right standard colours. OK, these were the most important things now coming into my mind. People having problems to run MagiC on their Falcons as described which don't occur in the list or can't be fixed with the above mentioned solutions can contact me; I will try to help as much as I can. 8. My Address And Account Number -------------------------------- Address: Thomas Binder Johann-Valentin-May-Str. 7 64665 Alsbach-Haehnlein Germany Phone: +49 62 57 / 6 43 04 InterNet: binder@rbg.informatik.th-darmstadt.de IRC: Gryf My account: Dresdner Bank AG Frankfurt am Main Account-Nr. 9 024 050 00 BLZ 500 800 00 I'd be really happy if someone would pay tribute to my work. It doesn't need to be much, I also like floppy disks, CD-ROMs, letters, postcards etc. Even a translation in other languages would be fantastic! 9. The "Bonbon" ;-) ------------------- Not everyone wants to work with MagiC permanently, and under certain circumstances it can be undesired to make a cold start or to have to switch off the computer. The mini program KILLMAGX.PRG solves this problem: Simply run it, and the computer will boot without MagiC. The program is actually adapted to any type of computer that MagiC is able to run on. 10. Final Words --------------- I hope that many people can enjoy this release of the hack for MagiC 3 and use the new features. Small hint: People who like playing MOD-files in the background should try FalcPlay 1.6 in a VT52-window, runs allright, because it only uses direct hardware accesses. This is acually not gentlemanlike, but very useful here... I wish everybody good luck with MagiC 3 on the Falcon!