RetroChallenge Winter Warm-up 2008

I'm back. Here is the contest for January 2008.
http://retrochallenge.org/previous/WW2008/progress.html old link: http://retrochallenge.org/WW2008/progress.html


relocatable "Hello, world!" program for Apple 1

jan20

This routine is a little longer, but it is relocatable. This means that the program can be run from pretty much anywhere within the 64K address space without any modification required. The first thing the program does is calculate where the program itself is located. It uses this address and adds an offset to the hello world string, and echoes it.

I made the hello world string a bit longer. It's now "Hello, world!\n" which is the specific string that many of the hello world programs tend to use. It's now also a null terminated string, a C string. And, there is an extra "cosmetic" newline character at the beginning of the string. The 8th bit is set for each character being echoed to the video display.

:A2 60 86 FF 20 FF 0 BA BD 0 1 85 FF CA BD 0 1 85 FE A0 18 D0 4 20 EF FF C8 B1 FE D0 F8 60
:8D C8 C5 CC CC CF AC A0 D7 CF D2 CC C4 A1 8D 0

        ldx #$60    ; rts instruction
        stx $ff     ; write rts to memory
        jsr $00ff   ; call it to figure out where this program is located
        tsx         ; get stack pointer
        lda $0100   ; get hi address
        sta $ff     ; store hi address
        dex         ; move pointer down stack
        lda $0100   ; get lo address
        sta $fe     ; store lo address
        ldy #$18    ; offset to string
        bne start   ; branch always
loop
        jsr $ffef   ; echo character
        iny         ; next character
start
        lda ($fe),y ; get character
        bne loop    ; keep looping if not a null character
        rts
string
        "\nHello, World!\n"

24 bytes!

jan19

Nope, not 24 Tb, not 24Gb, not 24Mb, not 24Kb, but 24 bytes! The code is 12 bytes, and the data "HELLO WORLD\n" is 12 bytes.


        org $0280
        LDX #$0C    ; 12 bytes, length of string
loop
        LDA $028B,X ; get character from string
        JSR $FFEF   ; echo character
        DEX         ; next character
        BNE loop    ; last character?
        RTS
string
        "\nDLROW OLLEH" ; string reversed and high bit set

Hello World for Apple-1

jan18

280:A2 C BD 8B 2 20 EF FF CA D0 F7 60 8D C4 CC D2 CF D7 A0 CF CC CC C5 C8
280.297
280
R
Hello World for Apple-1


Sign-in Sheet

jan17

Name/handle     Mark Stock/mmphosis_____________

Country         Other___________________________

Web Page URL    www.applefritter.com/node/22285/

Blog URL        ________________________________


Describe your intended RetroChallenge goals and the equipment
you will be using:

Make a HELLO WORLD program for the Apple-1._____________________

I am running Isaac, an Apple-1 emulator.________________________

Isaac is running on Mac OS X 10.1.5 (Puma)._____________________

The hardware is a dual-USB iBook G3.____________________________

________________________________________________________________


previous contest
1