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

Whitethorn Games combines two completely...
If you have ever gone fishing then you know that it is a lesson in patience, sitting around waiting for a bite that may never come. Well, that's because you have been doing it wrong, since as Whitehorn Games now demonstrates in new release Skate... | Read more »
Call of Duty Warzone is a Waiting Simula...
It's always fun when a splashy multiplayer game comes to mobile because they are few and far between, so I was excited to see the notification about Call of Duty: Warzone Mobile (finally) launching last week and wanted to try it out. As someone who... | Read more »
Albion Online introduces some massive ne...
Sandbox Interactive has announced an upcoming update to its flagship MMORPG Albion Online, containing massive updates to its existing guild Vs guild systems. Someone clearly rewatched the Helms Deep battle in Lord of the Rings and spent the next... | Read more »
Chucklefish announces launch date of the...
Chucklefish, the indie London-based team we probably all know from developing Terraria or their stint publishing Stardew Valley, has revealed the mobile release date for roguelike deck-builder Wildfrost. Developed by Gaziter and Deadpan Games, the... | Read more »
Netmarble opens pre-registration for act...
It has been close to three years since Netmarble announced they would be adapting the smash series Solo Leveling into a video game, and at last, they have announced the opening of pre-orders for Solo Leveling: Arise. [Read more] | Read more »
PUBG Mobile celebrates sixth anniversary...
For the past six years, PUBG Mobile has been one of the most popular shooters you can play in the palm of your hand, and Krafton is celebrating this milestone and many years of ups by teaming up with hit music man JVKE to create a special song for... | Read more »
ASTRA: Knights of Veda refuse to pump th...
In perhaps the most recent example of being incredibly eager, ASTRA: Knights of Veda has dropped its second collaboration with South Korean boyband Seventeen, named so as it consists of exactly thirteen members and a video collaboration with Lee... | Read more »
Collect all your cats and caterpillars a...
If you are growing tired of trying to build a town with your phone by using it as a tiny, ineffectual shover then fear no longer, as Independent Arts Software has announced the upcoming release of Construction Simulator 4, from the critically... | Read more »
Backbone complete its lineup of 2nd Gene...
With all the ports of big AAA games that have been coming to mobile, it is becoming more convenient than ever to own a good controller, and to help with this Backbone has announced the completion of their 2nd generation product lineup with their... | Read more »
Zenless Zone Zero opens entries for its...
miHoYo, aka HoYoverse, has become such a big name in mobile gaming that it's hard to believe that arguably their flagship title, Genshin Impact, is only three and a half years old. Now, they continue the road to the next title in their world, with... | Read more »

Price Scanner via MacPrices.net

B&H has Apple’s 13-inch M2 MacBook Airs o...
B&H Photo has 13″ MacBook Airs with M2 CPUs and 256GB of storage in stock and on sale for up to $150 off Apple’s new MSRP, starting at only $849. Free 1-2 day delivery is available to most US... Read more
M2 Mac minis on sale for $100-$200 off MSRP,...
B&H Photo has Apple’s M2-powered Mac minis back in stock and on sale today for $100-$200 off MSRP. Free 1-2 day shipping is available for most US addresses: – Mac mini M2/256GB SSD: $499, save $... Read more
Mac Studios with M2 Max and M2 Ultra CPUs on...
B&H Photo has standard-configuration Mac Studios with Apple’s M2 Max & Ultra CPUs in stock today and on Easter sale for $200 off MSRP. Their prices are the lowest available for these models... Read more
Deal Alert! B&H Photo has Apple’s 14-inch...
B&H Photo has new Gray and Black 14″ M3, M3 Pro, and M3 Max MacBook Pros on sale for $200-$300 off MSRP, starting at only $1399. B&H offers free 1-2 day delivery to most US addresses: – 14″ 8... Read more
Department Of Justice Sets Sights On Apple In...
NEWS – The ball has finally dropped on the big Apple. The ball (metaphorically speaking) — an antitrust lawsuit filed in the U.S. on March 21 by the Department of Justice (DOJ) — came down following... Read more
New 13-inch M3 MacBook Air on sale for $999,...
Amazon has Apple’s new 13″ M3 MacBook Air on sale for $100 off MSRP for the first time, now just $999 shipped. Shipping is free: – 13″ MacBook Air (8GB RAM/256GB SSD/Space Gray): $999 $100 off MSRP... Read more
Amazon has Apple’s 9th-generation WiFi iPads...
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
Discounted 14-inch M3 MacBook Pros with 16GB...
Apple retailer Expercom has 14″ MacBook Pros with M3 CPUs and 16GB of standard memory discounted by up to $120 off Apple’s MSRP: – 14″ M3 MacBook Pro (16GB RAM/256GB SSD): $1691.06 $108 off MSRP – 14... Read more
Clearance 15-inch M2 MacBook Airs on sale for...
B&H Photo has Apple’s 15″ MacBook Airs with M2 CPUs (8GB RAM/256GB SSD) in stock today and on clearance sale for $999 in all four colors. Free 1-2 delivery is available to most US addresses.... Read more
Clearance 13-inch M1 MacBook Airs drop to onl...
B&H has Apple’s base 13″ M1 MacBook Air (Space Gray, Silver, & Gold) in stock and on clearance sale today for $300 off MSRP, only $699. Free 1-2 day shipping is available to most addresses in... Read more

Jobs Board

Medical Assistant - Surgical Oncology- *Apple...
Medical Assistant - Surgical Oncology- Apple Hill Location: WellSpan Medical Group, York, PA Schedule: Full Time Sign-On Bonus Eligible Remote/Hybrid Regular Apply Read more
Omnichannel Associate - *Apple* Blossom Mal...
Omnichannel 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
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
Business Analyst | *Apple* Pay - Banco Popu...
Business Analyst | Apple PayApply now " Apply now + Apply Now + Start applying with LinkedIn Start + Please wait Date:Mar 19, 2024 Location: San Juan-Cupey, PR Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.