[Coco] Hello World part3
Robert Gault
robert.gault at worldnet.att.net
Wed Jan 21 15:27:52 EST 2004
It has been mentioned that assembly programming is not done in a vacuum.
There is normally an operating system (OS) present and it make sense to
use as many routines from the OS as possible in your own programs.
Here is a version of Hello World that uses ROM routines. It will clear
and print to the screen regardless of Coco3 text mode; 32, 40, 80. This
type of coding requires a knowledge of the ROMs that can only be
obtained from sources such as the Unravelled series of books. They can
be found on the Internet with a good search engine.
* HELLO WORLD USING ROM ROUTINES
PRNSTR EQU $B99C ROM PRINT STRING ROUTINE
CLRSCR EQU $A910 ROM CLEAR SCREEN
CURPOS EQU $88 CURRENT SCREEN POSITION, LOW RES
CRSLOC EQU $FE00 " " FOR HIGH RES
SMODE EQU $E7 SCREEN MODE 0=32COL,1=40COL,2=80COL
ORG $7000
START JSR CLRSCR
LDA SMODE FIND OUT WHICH TEXT SCREEN IS IN USE
BNE HRES
LDX #$4EA CENTER OF LOW RES SCREEN
STX CURPOS
BRA NEXT
HRES LDX CRSLOC
CMPA #1
BEQ MRES
LEAX 1670,X ABOUT CENTER OF 80 COL. SCREEN
BRA NEXT
MRES LEAX 824,X ABOUT CENTER OF 40 COL. SCREEN
NEXT STX CRSLOC
LEAX MESGE-1,PCR THE -1 IS NECESSARY
JSR PRNSTR
LOOP BRA LOOP
MESGE FCC /Hello, World/
FCB 0
END START
More information about the Coco
mailing list