My Head Is A 6809E Assembler

Lately, I’ve found myself doing a couple of things.

One, I’m playing the 1994 DOS game Sid Meier’s Colonization again.

Two, I’m programming for the TRS-80 Color Computer 2 again, via MESS.

Yes, I’m programming for a long-dead platform. In a way, it is better than some of my interests, which have been to program for platforms that were dead and didn’t know it.  This way it is more like practicing speaking latin.

Some of the things I’ve learned (or relearned):

  1. at boot time, the memory management on the CoCo2 (in Extended Color Disk Basic) can be achieved by typing PCLEAR4:CLEAR200,&H7FFF:FILES2,256
  2. if you are only interested in using PMODE1 (128px by 96px by 2bpp), you can reserve 2 graphics pages and set it up so that memory locations &H2000-&H7FFF (a whopping 24K!) can be used for machine language programming, leaving a small amount of room for a tool in BASIC to help with it.

And here is that tool:

20 P0=&H2000
30 PRINT HEX$(P0);”:”;
50 IF I$=”” THEN 30
60 I=INSTR(“^@!><?”+CHR$(34),LEFT$(I$,1))
70 ON I GOTO 130,140,150,160,260,320,450
80 FOR N=1 TO LEN(I$)/2
90 POKE P0,VAL(“&H”+MID$(I$,N*2-1,2))
100 P0=P0+1
110 NEXT N
120 GOTO 30
140 P0=VAL(“&H”+MID$(I$,2,LEN(I$)-1)):GOTO 30
150 EXEC VAL(“&H”+MID$(I$,2,LEN(I$)-1)):GOTO 30
160 I$=MID$(I$,2)
170 I0=INSTR(I$,”,”)
180 I1=INSTR(I0+1,I$,”,”)
190 I2=INSTR(I1+1,I$,”,”)
200 F$=LEFT$(I$,I0-1)
210 V0=VAL(“&H”+MID$(I$,I0+1,I1-I0-1))
220 V1=VAL(“&H”+MID$(I$,I1+1,I2-I1-1))
230 V2=VAL(“&H”+MID$(I$,I2+1))
240 SAVEM F$,V0,V1,V2
250 GOTO 30
260 I$=MID$(I$,2)
270 I0=INSTR(I$,”,”)
280 F$=LEFT$(I$,I0-1)
290 V0=VAL(“&H”+MID$(I$,I0+1))
300 LOADM F$,V0
310 GOTO 30
320 I$=MID$(I$,2)
330 I0=INSTR(I$,”-“)
340 V0=VAL(“&H”+LEFT$(I$,I0-1))
350 V1=VAL(“&H”+MID$(I$,I0+1))
360 PRINTHEX$(V0);”:”;
370 FOR V=V0 TO V1
380 N=PEEK(V)
390 N$=HEX$(N)
400 IF LEN(N$)=1 THEN N$=”0″+N$
410 PRINT N$;
420 NEXT V
440 GOTO 30
450 I$=MID$(I$,2)
460 FOR I=1 TO LEN(I$)
470 POKE P0,ASC(MID$(I$,I,1))
480 P0=P0+1
490 NEXT I
500 GOTO 30


This tool allows me to:

  • put in raw hex values and have then written into memory (e.g. AD9F7F0039)
  • change the memory location to which I am writing (e.g. @4000)
  • list a range of memory locations and retrieve their hex values (e.g. ?4000-400F)
  • start executing at a particular location (e.g. !4000)
  • save to disk (e.g. >FILENAME.EXT,4000,4FFF,4000)
  • load from disk(e.g. <FILENAME.EXE,0)
  • write screen copyable text from a string (e.g. “HELLO, WORLD!)

The only thing it doesn’t do is assemble code, so I do it on paper.

Yes, I know that EDTASM is available. No, I don’t want to use it.  I enjoy hand assembling 6809E code.  Some people make fishing lures or whittle wood.

That is all. Enjoy your day.


One Response to “My Head Is A 6809E Assembler”

  1. John Hattan Says:

    Wrote my first commercial game in Coco BASIC. Sold it to Color Computer News, which went out of print before they got to it. Then I sold it to Hot CoCo, which did the same thing. I think I have screenshots from it in an old box somewhere.

    I oughta drag it out. The kiddo will certainly like seeing it.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: