Posts tagged ‘assembly language’

Saying “Hello” with Macrosoft

Following the model of Eric Shepherd’s “Some Assembly Required: Hello World” article on A2Central and my last post on the Mindcraft Assembler, I’d like to present the traditional “Hello World” program for 8-bit Apple II using Macrosoft.

Macrosoft allows the programmer to achieve machine language speed with a familiar BASIC-like syntax.  Technically, Macrosoft is a macro library for the Mindcraft Assembler.

First, follow the directions included with Macrosoft to create a working disk with The Assembler and Macrosoft.  Next, just like last week’s tutorial, slide the disk into your drive and run the BOOT.SYSTEM program.  Press “E” to enter the editor.  Press “enter” once to get a “!” insert mode prompt.  Type in the following program.  Case does matter, so watch the capitalization.  Also, make sure to begin each line with a space; otherwise, the assembler will interpret your entry as a label.  Notice that, except for a few extra “boilerplate” lines, the program appears similar to BASIC.

USE MACROSOFT.3.1
UEN
MUL
BEGIN $2000
PRINT "Hello world."
CLEANUP
END

Press the “Escape” key and enter “Hello” for the “Save Pathname.”  Press “A” to assemble to program.  If you get errors, return to the editor and correct them.

Finally, press “!” to exit back to BASIC.  Change to the directory containing the HELLO program and type “BRUN HELLO”.

Saying “Hello” with the Mindcraft Assembler

Following the model of Eric Shepherd’s “Some Assembly Required: Hello World” article on A2Central, I’d like to present the traditional “Hello World” program for 8-bit Apple II using the Mindcraft Assembler.

Slide the Assembler disk into your drive or run the BOOT.SYSTEM program.  Press “E” to enter the editor.  Press “enter” once to get a “!” insert mode prompt.  Type in the following program.  Case does matter, so watch the capitalization.

            ORG       $2000
COUT        EQU       $FDED         ;Apple II character out func.

            LDX       #0            ;Offset to first character
loop        LDA       msg,X         ;Get the next character
            BEQ       done          ;->Yes!
            JSR       COUT          ;Print it out
            INX                     ;Move on to the next character
            JMP       loop          ;And continue printing
done        RTS                     ;All finished!

msg         ASC       "Hello world."
            DSC       $8D
            DSC       $00

Press the “Escape” key and enter “Hello” for the “Save Pathname.”  Press “A” to assemble to program.  If you get errors, return to the editor and correct them.

Finally, press “!” to exit back to BASIC.  Change to the directory containing the HELLO program and type “BRUN HELLO”.