[Coco] 6809 example

Theodore Evans (Alex) alxevans at concentric.net
Mon Jan 19 00:25:41 EST 2004


On Jan 18, 2004, at 6:39 PM, Robert Gault wrote:

> Theodore (Alex) Evans wrote:
>> On Jan 18, 2004, at 4:16 PM, Robert Gault wrote:
>>> If you run your program from within EDTASM+, it will crash because 
>>> you ended it with an RTS. Programs running under EDTASM+ DEBUG must 
>>> end with SWI.
>> Point taken.  I haven't been using ESTASM+ a whole lot lately.  
>> Looking back, Barden generally had his samples go into an infinite 
>> loop so instead of "rts" or "swi" he had "done jmp done".  It was 
>> mainly presented as a counter argument to the claim that you would 
>> need to have a complex output routine to do Hello, World without an 
>> OS call would be complex.  Of course unless the routine was truly 
>> stand alone the proper way would simply be to set things up for and 
>> perform an OS call hardly a good example, though I have seen assembly 
>> language instruction which starts with just such an example.
>
> Actually things are not quite so simple if you want a generic printing 
> routine. See below.

Since the source is not strictly speaking EDTASM+, or any other 
particular assembler there is the question of whether the FCC pseudo-op 
uses ASCII, or a local native character set.  EDTASM+ uses ASCII, in 
fact most (if not all CoCo assemblers use ASII.  If we assume that the 
data values are ASCII, and not the native values you need to re-map 
them (fortunately on the CoCo these tend to come in long strings so the 
remapping is pretty simple).  In the case of a Hello, World program you 
probably actually want to make sure you are using the native values in 
your data statements rather than converting the values.  Of course the 
native character set has no support for any of the non-printing 
characters (ASCII 0-31/127).  Actually without creating a set of 
context for your problem there is no generic printing routine.  You 
could just as easily claim that the coco you are implementing it on has 
serial hardware at a certain address and simply sequentially write the 
characters (possibly after translation).  I would say that this 
requires the right data in the first place rather than remapping the 
data as it is being written into the appropriate location.

> One of the significant differences between a high and low level 
> language is the interaction with hardware. With a high level language 
> like Basic, all you need to do is say PRINT and the OS will take your 
> message and
> convert it as needed so that it matches the requirements of your screen
> hardware. With assembly language, you need to know the specification of
> your hardware and make all adjustments yourself.

In reality most assembly language programming has been done in an 
environment where there are at least some library routines present.  As 
I have said several times, I don't think that Hello, World is a good 
first program for assembly language.  A computational or data 
manipulation subroutine is probably much better.  The bubble sort which 
was posted earlier (and used by Barden in his book) has the advantages 
of being easy to understand, actually having visible results, and not 
being substantially affected by abstraction issues.

> When I copied Theodore's program, I accidentally made the FCC statement
> HELLO, WORLD. The program cleared the screen to black and then printed
> black letters on a green background. When I corrected the FCC statement
> to "Hello, world" as written, only the H and W printed correctly.

I bet you found that challenging when there are no lowercase letters on 
the system :-)

Would you prefer fcb $48,$05,$0c,$0c,$0f,$60,$17,$0f,$12,%0c,$04,$00 ?

(yes, I don't remember the right value for a comma off the top of my 
head)




More information about the Coco mailing list