"hello world program"

From: Jay West <west_at_tseinc.com>
Date: Wed Aug 22 10:11:33 2001

The "hello world" discussion got me thinking... how short could it be in Assembler... Here's an example in Pick assembler (aka reality/microdata, general automation zebra, adds mentor, Ultimate, etc.)....

    FRAME 504
    SRA R14,MSG
LOOP WRITE R14
    INC R14
    BCU R14,X'FF',LOOP
    HALT
MSG EQU *
    TEXT C'HELLO WORLD',X'FF'

It's been YEARS since I worked with this instruction set, but I believe that the above would turn into 11 words or 22 bytes total. In practice, HALT would be inconsiderate to other users, I seem to recall the gracefull termination back to the TCL-I processor was "ENT MD999" but that's not a primitive and takes more instructions ;) If memory serves, none of the above are macros, they are all actual instructions. Of course, if you're allowed to use system routines, then it can be done in significantly less instructions (in userland at least) with

    FRAME 504
    BSL PRINT
MSG EQU *
    TEXT C'HELLO WORLD',X'FF'
    HALT

Of course, this example isn't indicative of the number of instructions executed because it calls system services to do it's job (like dos's INT 21H I believe it is).


Jay West

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.classiccmp.org/pipermail/cctalk/attachments/20010822/0dcf4018/attachment.html
Received on Wed Aug 22 2001 - 10:11:33 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:33:34 BST