Hello World! on modern processors.

From: Sellam Ismail <foo_at_siconic.com>
Date: Tue Aug 21 22:42:53 2001

On Tue, 21 Aug 2001, Fred Cisin (XenoSoft) wrote:

> > Yes, but per my earlier example.... are we shooting for less instructions in
> > the program or less intructions executed in total for the program? (ie, your
> > 23 byte example is calling dos system services, so.... lots of additional
> > instructions there).
>
> So far, nobody has set the rules for the game.
> And if it is NOT to use OS API stuff, should we also outlaw using the OS
> to start and end the program or even to load it?
> How about routines in ROM? (PC BIOS INT 10h function 0Eh will display a
> character)

Ok, here's my entry on the Apple ][ using no ROM routines:

0300: LDY #$00
0302: LDA $030C,Y
0305: BEQ $030B
0305: STA $0400,Y
0308: INY
0309: BNE $0302
030B: RTS ; or BRK
030C: C8 C5 CC CC CF A0 D7 CF D2 CC C4 00 ; "HELLO WORLD"

Damn, 26 bytes. Can't be any smaller, so Jay's Prime example still beats
it. Curse you, 6502!!! :)

Well, actually it could be one byte smaller:

0300: LDY #$00
0302: LDA $030B,Y
0305: BPL $0316
0305: STA $0400,Y
0308: INY
0309: BNE $0302
030B: C8 C5 CC CC CF A0 D7 CF D2 CC C4 00 ; "HELLO WORLD"

The BPL instruction will branch to location $0316 when it hits a value
less than #$80 (128), which happens to contain #$00, which is the null
terminator for the string which causes the loop to exit, but which also
happens to be the BRK (BReaK) instruction in 6502, which will cause a hard
interrupt and terminate the program.

Sellam Ismail Vintage Computer Festival
------------------------------------------------------------------------------
International Man of Intrigue and Danger http://www.vintage.org
Received on Tue Aug 21 2001 - 22:42:53 BST

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