🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #2673

TopSpeed and assembler

#2673
From: Marco van de Voort
Date: Tue, 01 Aug 1995 22:49
37 lines
2628 bytes
Hallo Trond!

Friday June 30 1995 09:56, Trond Solem wrote to All:


 >> I have been interested in learning to program for awhile now...
 >> and am currently trying to learn C... maybe Modula 2 but I have two
 >> questions before I start trying:
 >>
 >>         1> Is Modula 2 faster or equal to Assembly?

 TS> Well, it's possible to write good and bad asm code, but no compiled
 TS> language is faster than good asm. If you write small programs (<1000 or so)
 TS> any language will do, but when you program grows to several tentousen
 TS> lines, a good language is required.

Not true, you CAN do it using assembler, and you can do it good. However it
will cost more time and effort.
I wrote back on the C-64 a complete database in assembler, no problem.

I however DO NOT recommend this, specially with modern computers, it's not necessary anymore. Write routines that need to be fast in assembler, and do the
rest in Modula-2.

It can also be handy to write procedures you use very often in assembler, I did this for a nice CRT module (Window is too big for small programs, it can't use other screensizes then 80x25. And I REALLY don't like the clearscreen when initializing Window), CRC routines and some elementary other routines (Adjust strings, fill strings with a number of characters, and some date routines (conversion of unix dates, and LeapYear etc)).

I also recommend (when using TopSpeed) to do all Lib.Intr and Lib.Dos calls in assembler, specially when it's nested in a LOOP, FOR, REPEAT or WHILE statement. This because the routines Intr and Dos are quite bulky, and a Intr in a LOOP can often be changed to a assembler loop with a intr call in it, which again saves a lot of code and time. The same for Out/In instructions in loops.

 >>         2> Can C and Modula 2 work together?  I mean, a program that is
 >> half c and hald MOD2?

 TS> Yes, a modula-2 program can call routines written in C. I do it in my
 TS> current project, but I'm slowed down by those buggy routines. I'm tempted
 TS> to rewrite the whole ting in m-2 to eliminate the bugs.

Depends on the compiler you're using. With enough assembler interfacing you could everything make work together, but that's NOT very practical.

Marco  (M.W.T.J.v.d.Voort@stud.tue.nl or MarcoV@stack.urc.tue.nl)
Technical Details
Message-ID: <807534257.AA00867@puddle.fidonet.org>
Path: arc1-ca.pugleaf.net!news.sprintlink.net!psgrain!puddle!internet

Show Full Headers
Complete Article Headers
From: Marco.van.de.Voort@p18.f402.n284.z2.fidonet.org (Marco van de Voort)
Path: arc1-ca.pugleaf.net!news.sprintlink.net!psgrain!puddle!internet
Newsgroups: comp.lang.modula2
Subject: TopSpeed and assembler
Message-ID: <807534257.AA00867@puddle.fidonet.org>
Date: Tue, 01 Aug 1995 14:49:01 -0800
X-FTN-To: Trond Solem