[Coco] Hello World part2
Roger Taylor
rtaylor at bayou.com
Wed Jan 21 13:44:24 EST 2004
At 08:32 AM 1/21/2004 -0500, you wrote:
>Here is a slightly modified version of Theodore's Hello World program. It
>is selectable for true lowercase or color mode for text. Unfortunately
>numbers and punctuation have only one color set.
>
>* SLIGHTLY MODIFIED PROGRAM POSTED BY THEODORE EVANS
>* NEXT LINE SELECTS BLACK LETTERS GREEN BACKGROUND
>* GREEN LETTERS BLACK BACKGROUND OR TRUE LOWERCASE
>* ON GREEN BACKGROUND
>
>LETTER EQU -1 0=BLACK ON GREEN, 1=GREEN ON BLACK, -1=TRUE
>
>* NEXT LINE CAN BE CHANGED OR REMOVED
> ORG $7000
>* HELLO, WORLD
>* CLEAR SCREEN
>START LDX #$0400
> LDA #$20
> COND LETTER.NEQ.0
> ADDA #$40
> ENDC
>CLRLP STA ,X+
> CMPX #$0600
> BLO CLRLP
> COND LETTER.EQU.-1
> LDA $FF22
> ORA #%00010000 ACTIVATE LOWERCASE
> STA $FF22
> ENDC
>* WRITE 'HELLO, WORLD' TO MIDDLE OF SCREEN
> LDX #$04EA
> LDY #HELLO
>WRTLP LDA ,Y+
> BEQ QUIT
> COND LETTER.EQU.0
> CMPA #$20
> BEQ NOFLP
> ENDC
> CMPA #'@
> BLO FLIP
> CMPA #$60
> BLO NOFLP
> ANDA #$DF
>FLIP EORA #$40
>NOFLP STA ,X+
> BNE WRTLP
>QUIT BRA QUIT
>HELLO FCC 'Hello, World'
> FCB 0
> END START
I wanted to add for those using CCASM/Portal-9 that all of the operations
that use the syntax such as ".EQU." have been removed and replaced with the
more common operator characters like "=" in this case.
The reason for this was to allow dot notation structure names/fields, such
as "color.red", or "student.name", and even something like "logical.or",
which would translate into the "or" field of the structure called "logical".
There is also an automatic symbol "." that returns the value of the program
counter even if embedded within a list of constants, or even an instruction
such as "LDA #." . This is not the same as the "*" automatic symbol, but
it's similar. "." can be used to return the address of an operand or
subpart of any instruction or list of data. Anyway, it's very hard to try
to implement so many different uses for the "." character without one use
interfering with the others. The reason for removing the prehistoric
.OPERATION. syntax was to make way for a much more powerful feature, and
that is dot-notated records, structures, and unions.
Some minor things in EDTASM source code that you'll have to change for
compatibility with CCASM are as follows.
.AND. -- change to --> &
.OR. -- change to --> ! or |
.EOR. -- change to --> ~
.XOR. -- change to --> ~
.NOT. -- change to --> ^
.EQU. -- change to --> =
A simple find and replace will do the trick. I've converted tons of source
already and see no problem other than the fact that you can't assemble the
resulting CCASM source code from EDTASM any longer. I guess this is one of
the things that keeps the two from being identical.
An example of something that needs to be changed:
ldd #BIT7.OR.BIT0.AND.BIT3
lda #.NOT.5
would become:
ldd #BIT7!BIT0&BIT3
lda #^5
----------
Roger Taylor
More information about the Coco
mailing list