TweetFollow Us on Twitter

TML To LSP
Volume Number:2
Issue Number:12
Column Tag:Programmer's Forum

Notes From TML To LSP

By Thomas Scheiderich, Interez Travel Reservation Systems

For a while it seemed if you wanted to do any programming in Pascal on the Mac, you must either bear the cost of a Macintosh and a Lisa to do any serious programming, or you could always use MacPascal. Neither was an acceptable solution. Those with larger bank accounts could afford two machines but that was unacceptable for most of us. MacPascal was also unthinkable since it does not generate compiled code, but like most interpreters it is easier to develop code than the compile/link method.

Enter TML Pascal. When TML came onto the scene about a year ago, there were nothing but raves about the product. I was ecstatic when I started using it myself. The only capability that seemed to be missing was the ability to compile and link separate units. For many of us this was not a problem, as it was promised in a further release. So we all continued to develop our programs, and except for the units problem continued to rave about the program. How can you put down a product that measures up to equivalent compilers (C, Forth and Fortran) that cost three, four and five times as much. But as our programs got larger, compile times got longer and there was still no units capability. Four or five changes and compiles could take an hour or more.

Wouldn't it be nice to have the capabilities of both TML and MacPascal to do our development! And LightSpeed Pascal comes as close to this as I believe you are likely to see. I found I was developing code in hours that would have taken me days or weeks to do under TML.

This is not a review of LightSpeed Pascal, but an impression of the program I have from having used both TML and LightSpeed. I will be showing you some of the differences between the two development systems and some of the problems I encountered in my experience with the new program. It is important to note that these tests are run on a old 512K Mac with the old Roms and 400K drives.

First of all, for those of you who are currently using TML and wish to convert to LightSpeed, you will find the conversion very easy. The first step is to change the compiler directives. In your TML source you may have some lines similar to the following:

{$I MemTypes.ipas  }
{$I QuickDraw.ipas }
{$I OSIntf.ipas    }
{$I ToolIntf.ipas  }
{$I PackIntf.ipas  }
{$a+}
{$L  Grow/Rsrc }

These lines need to be removed and replaced with

{$I-}
{$R-}

The first line "{$I-}" tells the compiler that you don't want LightSpeed to do automatic initialization. You should always put this in your code or else the program may work when running in project mode and may not work when the code is converted into an application. The second line "{$R-}" tells the compiler you want range checking off. This is only necessary if you have this line in your TML code or you don't have the range checking option defined at all. This is because LightSpeed defaults to range checking on and TML defaults to range checking off. If you have range checking off in TML and range checking on in LightSpeed, code that worked under TML may not work under LightSpeed.

Second, if you are using a resource file, you must remove the ".REL" extension from the ".R." file and change it to anything else so that RMaker does not compile the resource file in REL format. LightSpeed suggests ".RSRC", but in actuality any extension or no extension will do. You must declare something, however, or RMaker won't compile the file. Then you run RMaker to create the new resource file. Next you must tell LightSpeed about the resource file by selecting "Run Options" from the Project menu. When the dialog box appears, check the resource box and choose the resource file to use (if you haven't converted the resource file from the REL format, the file won't appear).

Third, if you have your comments on multiple lines surrounded by only two curly braces you will get an error. For example:

{this comment section
must be changed}

which works in TML, must be changed to

{this comment section}
{must be changed}

for the code to work in LightSpeed.

This was all that was necessary to get my old TML code running under LightSpeed. My program is a terminal emulator for a Data General which uses multiple windows (text and drawing) and does file transfers. It currently is about 1200 lines long. I used this program for my testing and also the famous Sieve program to do comparisons between the two compilers.

The relative speeds and sizes are compared in the following tables. As can be seen from the tables, the application programs are larger (about 2k) in the LightSpeed versions. I talked to the LightSpeed people about this and apparently the program does a certain amount of routine stripping to keep the application to a reasonable size. The TML stripping linker is a little better (my application was 14K under TML version 1.0 and 8K under 1.1). Routines you reference may cause LightSpeed to pull in related routines even if they aren't used. This is apparently a tradeoff for speed. 2K seems to be close to the maximum difference between from TML and LightSpeed as can be seen from the graphs and tables.

The development speeds reflect the time it takes to make changes and and execute the programs. As can be seen you can make a change and test it in less than a minute (about 30 seconds if not saving the text). In TML this would take about 5 minutes - five to ten times longer.

The Sieve program has been used in benchmarks of other compilers and I decided to use it to compare these two. The code I used was:

PROCEDURE EXECUTE_SIEVE;
 CONST
 SIZE = 8190;
 VAR
 FLAGS : ARRAY[0..SIZE] OF BOOLEAN;
 I, PRIME, K, COUNT, ITER : INTEGER;
 TEXTSTRING : STR255;
 BEGIN
 GOTOXY(10, 10);
 DRAWSTRING('10 ITERATIONS. PRESS MOUSE WHEN READY TO GO!');
 REPEAT
 UNTIL BUTTON;
 FOR ITER := 1 TO 50 DO    {THIS IS USUALLY 1 TO 10}
 BEGIN
 COUNT := 0;
 FOR I := 0 TO SIZE DO
 FLAGS[I] := TRUE;
 FOR I := 0 TO SIZE DO
 IF FLAGS[I] THEN
 BEGIN
 PRIME := i + i + 3;
 {gotoxy(10, 12);}
 {ERASE_LINE(12, 10, 10);}
 {numtostring(prime, textstring);}
 {DRAWSTRING(TEXTSTRING);}
 k := i + prime;
 WHILE k <= size DO
 BEGIN
 flags[k] := false;
 k := k + prime;
 END;
 count := count + 1;
 END;
 END;
 gotoxy(10, 14);
 ERASE_LINE(14, 10, 15);
 numtostring(count, textstring);
 drawstring(textstring);
 gotoxy(15, 14);
 drawstring('primes');
 END;

It was rather interesting that if you display the prime numbers as they are found, TML seems a little faster and when the numbers aren't displayed LightSpeed seems a little faster. It seems that LightSpeed's computations are a little better but TML's handling of QuickDraw may be a little faster.

I would liked to have compared the units capability of the two compilers, except as of this writing, it was not available on TML. It is now released as version 2.0.

Some notes on LightSpeed:

Type cohersion cannot always be done within a procedure or a function statement. According to LightSpeed the rule is: if the variable in the procedure is a "var" parameter you cannot use type cohersion; if not a "var", you can. They say it is a high priority to make this more like Lisa Pascal by removing this restriction.

You cannot get the assembler source like you can in TML. This may be a problem if you want to optimize a piece of code. This is apparently not a high priority item with them. It would also be a little more difficult to do, according to them, because the compilation doesn't go through the normal "compile to assembler source" and then assemble that code. They go directly from Pascal source to machine code.

Segmentation is handled differently. LSP requires segmentation at unit boundaries, while TML allows the segment option to be placed directly in the code. Also, LSP uses all the space in the first segment for it's libraries so that your main program must be limited to about 5K in the first segment, with everything else in units placed in the second segment. Yet when the application is built, your program may fit entirely within segment one. Thus our 14K program required two segments with only a 5K main in segment one.

LSP also does not have objects and LS is moving slow on this. TML on the other hand supports objects in 2.0.

All in all, I was very impressed with the product and had no problems with it, once I found out about the range checking, REL resource and curly brackets differences. I think there is going to be less of a demand for MPW with this around.

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Fresh From the Land Down Under – The Tou...
After a two week hiatus, we are back with another episode of The TouchArcade Show. Eli is fresh off his trip to Australia, which according to him is very similar to America but more upside down. Also kangaroos all over. Other topics this week... | Read more »
TouchArcade Game of the Week: ‘Dungeon T...
I’m a little conflicted on this week’s pick. Pretty much everyone knows the legend of Dungeon Raid, the match-3 RPG hybrid that took the world by storm way back in 2011. Everyone at the time was obsessed with it, but for whatever reason the... | Read more »
SwitchArcade Round-Up: Reviews Featuring...
Hello gentle readers, and welcome to the SwitchArcade Round-Up for July 19th, 2024. In today’s article, we finish up the week with the unusual appearance of a review. I’ve spent my time with Hot Lap Racing, and I’m ready to give my verdict. After... | Read more »
Draknek Interview: Alan Hazelden on Thin...
Ever since I played my first release from Draknek & Friends years ago, I knew I wanted to sit down with Alan Hazelden and chat about the team, puzzle games, and much more. | Read more »
The Latest ‘Marvel Snap’ OTA Update Buff...
I don’t know about all of you, my fellow Marvel Snap (Free) players, but these days when I see a balance update I find myself clenching my… teeth and bracing for the impact to my decks. They’ve been pretty spicy of late, after all. How will the... | Read more »
‘Honkai Star Rail’ Version 2.4 “Finest D...
HoYoverse just announced the Honkai Star Rail (Free) version 2.4 “Finest Duel Under the Pristine Blue" update alongside a surprising collaboration. Honkai Star Rail 2.4 follows the 2.3 “Farewell, Penacony" update. Read about that here. | Read more »
‘Vampire Survivors+’ on Apple Arcade Wil...
Earlier this month, Apple revealed that poncle’s excellent Vampire Survivors+ () would be heading to Apple Arcade as a new App Store Great. I reached out to poncle to check in on the DLC for Vampire Survivors+ because only the first two DLCs were... | Read more »
Homerun Clash 2: Legends Derby opens for...
Since launching in 2018, Homerun Clash has performed admirably for HAEGIN, racking up 12 million players all eager to prove they could be the next baseball champions. Well, the title will soon be up for grabs again, as Homerun Clash 2: Legends... | Read more »
‘Neverness to Everness’ Is a Free To Pla...
Perfect World Games and Hotta Studio (Tower of Fantasy) announced a new free to play open world RPG in the form of Neverness to Everness a few days ago (via Gematsu). Neverness to Everness has an urban setting, and the two reveal trailers for it... | Read more »
Meditative Puzzler ‘Ouros’ Coming to iOS...
Ouros is a mediative puzzle game from developer Michael Kamm that launched on PC just a couple of months back, and today it has been revealed that the title is now heading to iOS and Android devices next month. Which is good news I say because this... | Read more »

Price Scanner via MacPrices.net

Amazon is still selling 16-inch MacBook Pros...
Prime Day in July is over, but Amazon is still selling 16-inch Apple MacBook Pros for $500-$600 off MSRP. Shipping is free. These are the lowest prices available this weekend for new 16″ Apple... Read more
Walmart continues to sell clearance 13-inch M...
Walmart continues to offer clearance, but new, Apple 13″ M1 MacBook Airs (8GB RAM, 256GB SSD) online for $699, $300 off original MSRP, in Space Gray, Silver, and Gold colors. These are new MacBooks... Read more
Apple is offering steep discounts, up to $600...
Apple has standard-configuration 16″ M3 Max MacBook Pros available, Certified Refurbished, starting at $2969 and ranging up to $600 off MSRP. Each model features a new outer case, shipping is free,... Read more
Save up to $480 with these 14-inch M3 Pro/M3...
Apple has 14″ M3 Pro and M3 Max MacBook Pros in stock today and available, Certified Refurbished, starting at $1699 and ranging up to $480 off MSRP. Each model features a new outer case, shipping is... Read more
Amazon has clearance 9th-generation WiFi iPad...
Amazon has Apple’s 9th generation 10.2″ WiFi iPads on sale for $80-$100 off MSRP, starting only $249. Their prices are the lowest available for new iPads anywhere: – 10″ 64GB WiFi iPad (Space Gray or... Read more
Apple is offering a $50 discount on 2nd-gener...
Apple has Certified Refurbished White and Midnight HomePods available for $249, Certified Refurbished. That’s $50 off MSRP and the lowest price currently available for a full-size Apple HomePod today... Read more
The latest MacBook Pro sale at Amazon: 16-inc...
Amazon is offering instant discounts on 16″ M3 Pro and 16″ M3 Max MacBook Pros ranging up to $400 off MSRP as part of their early July 4th sale. Shipping is free. These are the lowest prices... Read more
14-inch M3 Pro MacBook Pros with 36GB of RAM...
B&H Photo has 14″ M3 Pro MacBook Pros with 36GB of RAM and 512GB or 1TB SSDs in stock today and on sale for $200 off Apple’s MSRP, each including free 1-2 day shipping: – 14″ M3 Pro MacBook Pro (... Read more
14-inch M3 MacBook Pros with 16GB of RAM on s...
B&H Photo has 14″ M3 MacBook Pros with 16GB of RAM and 512GB or 1TB SSDs in stock today and on sale for $150-$200 off Apple’s MSRP, each including free 1-2 day shipping: – 14″ M3 MacBook Pro (... Read more
Amazon is offering $170-$200 discounts on new...
Amazon is offering a $170-$200 discount on every configuration and color of Apple’s M3-powered 15″ MacBook Airs. Prices start at $1129 for models with 8GB of RAM and 256GB of storage: – 15″ M3... Read more

Jobs Board

*Apple* Systems Engineer - Chenega Corporati...
…LLC,** a **Chenega Professional Services** ' company, is looking for a ** Apple Systems Engineer** to support the Information Technology Operations and Maintenance Read more
Solutions Engineer - *Apple* - SHI (United...
**Job Summary** An Apple Solution Engineer's primary role is tosupport SHI customers in their efforts to select, deploy, and manage Apple operating systems and Read more
*Apple* / Mac Administrator - JAMF Pro - Ame...
Amentum is seeking an ** Apple / Mac Administrator - JAMF Pro** to provide support with the Apple Ecosystem to include hardware and software to join our team and Read more
Operations Associate - *Apple* Blossom Mall...
Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.