Re: Writing Assembler!

Cliff Click <cliffc@risc.sps.mot.com>
19 Jun 1997 00:04:57 -0400

          From comp.compilers

Related articles
[16 earlier articles]
Re: Writing Assembler! albaugh@agames.com (1997-06-13)
Re: Writing Assembler! genew@vip.net (1997-06-13)
Re: Writing Assembler! jhallen@world.std.com (1997-06-13)
Re: Writing Assembler! cyber_surfer@wildcard.demon.co.uk (Cyber Surfer) (1997-06-15)
Re: Writing Assembler! rick@tip.nl (1997-06-15)
Re: Writing Assembler! csusb@csv.warwick.ac.uk (1997-06-15)
Re: Writing Assembler! cliffc@risc.sps.mot.com (Cliff Click) (1997-06-19)
| List of all articles for this month |

From: Cliff Click <cliffc@risc.sps.mot.com>
Newsgroups: comp.compilers
Date: 19 Jun 1997 00:04:57 -0400
Organization: RISC Software, Motorola
References: 97-05-156 97-05-289 97-06-022 97-06-037 97-06-069
Keywords: assembler, performance

                  Cliff Click <cliffc@risc.sps.mot.com> writes:
> >I've written several hand-generated assembler parsers in my life. All
> >are very fast (in at least one case it was 50x faster, thats fifty
> >times faster, not +50%). Computers are fast enough now (and I write
> >so very little assembly) that I no longer care. But at one time I
> >cared a great deal about assembler speed. [We routinely assembled 1Mb
> >of source code in 3 seconds on a 20Mhz 286. A modern PC probably has
> >100x the horsepower. Can your assembler do 1Mb in 0.03 seconds?
> >Probably not! Do you care? Probably not!]


Mr J R Hall wrote:
> 100x I think is an overestimate; also a large proportion of the time
> taken is IO time, which hasn't improved quite that much.
>
> I've just run NASM on a (simplified so that it could be automatically
> generated!) 1Mb source file, and it took 16.2 seconds of processor
> time (running on a SPARC machine, probably about 40-50x faster than
> the 286 mentioned above).
>
> To be honest, it took about 10 seconds just to generate it! For your 3
> seconds estimate, I take it you were assembling from memory to memory?


Yes. Has the world so soon forgotton RAM disks? :-)
Next we wrote a little download program to shove the image through the
parallel port; the embedded system had a special set of boot ROMs that
hung out on the parallel port waiting for the download. Download time
was maybe 5 seconds.


We would press the hot key in the editor and in about 10 seconds total
we could assemble the ASM, download and have the embedded system up and
running with the new code. Wheee!!!!.




> NASM's parser is hand written. It simply is easier for such a simple
> grammar, we believed, to write it by hand. The parser isn't even table
> driven; it's a recursive descent parser (we may rewrite it table
> driven at some future stage for efficiency purposes).


I agree that it's much easier (to hand write). We did use a lot of
tables - a lot of XLAT instructions to map characters to character
classes.


> You probably gain over NASM there: we have a preprocessor that does
> some string copying, etc. Also NASM is a 2-pass assembler, whereas
> your would appear to have been single pass, which would vastly improve
> performance... In the run mentioned above, NASM would probably have
> taken only 10 seconds of processor time if it were single pass.


We were 1 pass for macro expansion and basic assembling.
A 2nd half-pass did touch-up on forward references.
Because the assembler was so fast, we assembled the entire
project every time and skipped the link step.


Cliff
--
Cliff Click, Ph.D. Compiler Researcher & Designer
RISC Software, Motorola PowerPC Compilers
cliffc@risc.sps.mot.com (512) 891-7240
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.