💾 Archived View for mirrors.apple2.org.za › archive › apple.cabi.net › Utilities › Transwarp%20Stuff… captured on 2024-02-05 at 14:54:29.
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
Complete/TML Pascal II Interface for TransWarpGS V1.1 Freeware by Kurt Herman/AO Scapino This is a Toolbox type interface for the TranswarpGS. If you are using Complete/TML Pascal II, you can put the file marked TWGS.p.o into the Toolbox Interfaces folder on your Complete/TML Pascal II program disk, or in the same folder, on your hard drive, if that is where you are running Complete/TML Pascal II from. Below is a description of each procedure, and how to call it from your Complete/TML Pascal II program. You have to add TWGS to the uses declaration at the top of your source code. Also this interface requires the use of types, memory, GSOS, and TmlUtils...ie; uses Types, Memory, GS/OS, TMLUtils, TWGS; The first function that you can call is....TWGSInstalled; This is a boolean function, that returns True if there is a TranswarpGS installed in the computer your program is running on. Otherwise it returns False.You can use the call like this... If TWGSInstalled then begin your code here..... end; NOTE: You do NOT have to call this before you call these other routines, as the other routines call TWGSInstalled. Just a little idiot proofing on my part. The next procedure is...SetTWGSMax; This procedure checks to see if there is a TWGS installed, and if one is, it sets the speed to the maximum speed of the card. Very simple. Just call it like you would a toolbox routine. That is, put SetTWGSMax; where ever you want to change the TWGS speed to maximum. The next procedure is...SetTWGSFast; This procedure checks to see if there is a TWGS installed, and if one is, it sets the speed to the fast setting of the GS, that is, the same speed as a GS without TWGS. Very simple. Just call it like you would a toolbox routine. That is, put SetTWGSFast; where ever you want to change the TWGS speed to the standard GS speed. The next procedure is...SetTWGSNormal; This procedure checks to see if there is a TWGS installed, and if one is, it sets the speed to the ol' 1mhz of the IIe,IIc ect. Very simple. Just call it like you would a toolbox routine. That is, put SetTWGSNormal; where ever you want to change the TWGS speed to 1mhz old Apple mode. The next function is...GetMaxSpeedStr; This function returns a Str32 type string, that looks like '6.250 mhz', or what ever the maximum speed of your TWGS is. Call it like this... MyMaxString:= GetMaxSpeedStr; or even easier... DrawString(GetMaxSpeedStr); VERSION 1.1 UPDATE: This update allows speeds greater than 10 mhz to be returned properly. The next function is...GetCurSpeedStr; This function returns a Str32 type string, that looks like '2.280 mhz', or what ever the speed your TWGS is currently running at. Call it like this... MyCurString:= GetCurSpeedStr; or even easier... DrawString(GetCurSpeedStr); VERSION 1.1 UPDATE: This update allows speeds greater than 10 mhz to be returned properly. These are all of the high level functions and procedures. I will now describe the low level procedures that you may wish to use if you like to do things yourself. These routines call the TWGS Rom routines and don't do all of the dirty work the above mentioned routines do. These routines do NOT check to see if the TWGS is installed. If you call these routines without a TWGS installed, your computer will go out to lunch, and you'll have to do the 3 fingered salute to bring it back. First there is.....GetMaxSpeed(MaxPtr:Ptr); This routine returns the maximum speed as a frequency value, which is an integer. In order to use it, do this... var MyMaxFreq: Integer begin GetMaxSpeed(@MyMaxFreq); Then there is.....GetCurSpeed(CurPtr:Ptr); This routine returns the current speed as a frequency value, which is an integer. In order to use it, do this... var MyCurFreq: Integer begin GetCurSpeed(@MyCurFreq); then there is.....SetCurSpeed(Freq:Integer); This routine sets the current TWGS speed. Freq must be a valid frequency, an integer type that you get as a result of GetCurSpeed, or GetMaxSpeed, or Index2Freq (mentioned later). To use this call, do this... SetCurSpeed(MyFreq); remember, MyFreq is an integer type, and represents a frequency. Use one of the other calls mentioned in the previous paragraph to get the integer used in this call. then there is.....Index2Freq(Index:Integer;FreqPtr:Ptr); This routine converts an index number, an integer value that is either 0 or 1 (Others might work, but I know not what result they will give), to a frequency value (an integer) that is used with SetCurSpeed. If you use 0(zero) as your Index value, the frequency returned is the ol' 1mhz of the early Apples. If you use 1(one) then the frequency returned is the standard GS speed, some 2.28mhz or there abouts. Call this routine like so... var MyFreq: Integer; begin Index2Freq(0,@MyFreq); the 0 in this call means MyFreq will have the 1mhz frequency value in it after this call. You could use 1 in the above call, or a variable of the integer type. then there is....Freq2Index(Freq:Integer;IndexPtr:Ptr); this routine converts a frequency value(an integer) to an Index value(also an integer). If you used GetCurSpeed, or GetMaxSpeed, or Index2Freq to get a frequency value, this call would turn that value into an Index number for you. These Index and Freq routines exist, I believe, to make keeping track of frequencies easier. You can use a simple number like 0,1 or what ever to represent a TWGS speed mode. Anyway, here is how you could use Freq2Index.... var MyIndex: Integer; begin Freq2Index(MyFreq,@MyIndex); After this call, MyIndex will be the Index number representitive of the frequency value in MyFreq. MyFreq must be a valid frequency number. I think it might be possible to change the TWGS to all sorts of intermediate speeds from 0mhz to maximum with these calls, though I have not tried to do so. VERSION 1.1 UPDATE: I originally wrote this interface to use in my own applications, to adjust timing loops so that speed sensitive operations would take the same amount of time, with and without a TWGS. Scott Johnson aka DevScott wrote a NDA using this interface, and had all sorts of problems. ALL OF THESE PROBLEMS HAVE BEEN FIXED, in this version. Thanks go to Scott for sending me on a big bug-hunt! I love stompen' them critters. Almost more fun then programmin'! There it is! Hope all you Complete/TMLPascal II/TWGS users find a use for these routines. If you have any problems with them, send some email to me, and I'll look into it. This is Freeware, by the way. Enjoy! Kurt Herman/AO Scapino