ET-3400 ROM - Programming gains and losses

To write the program I wanted I was going to use ideas from the examples in the ET-3400 manual to help me create my little demo program.

I also needed an assembler for 6800 code. 

Turns out both of those tasks had already been mostly done previously and I had forgotten about them.

I couldn't find a suitable free assembler for Windows. I had used the Task Assembler (aka TASC) in DOS in the distant past for some Z80 code, and I think it could also assemble for different processors. Anyway that was so long ago and I couldn't spend the time looking for it. I also couldn't find a version of TASC on the www that I could access. All my Google searches pointed to CRASM which was for Linux and that rang a bell...

I rebooted into my Ubuntu partition and it turns out that I had already installed CRASM probably last year and had forgotten about it. Good, one down, next...

I was looking through the ET-3400 example programs and it turns out that Example 4 on page 61-62 was virtually what I was going to write. No need to re-invent the wheel, I'll just use that and patch it a bit for a different message output, but first I need to type it all in to the ET-3400 one byte at a time and make sure it ran OK. It did, but then I also need to learn how to use CRASM so I can assemble it. I wasn't about to do hand assembly this late in the project even though I would have got there in the end.

The example in the ET-3400 manual was not written with CRASM in mind so I has to amend it a bit. I tried to print it out so I could hand write my patches to the program and that's when I remembered I had an issue with the CUPS printing on this OS and hadn't fixed it.

Next step was to re-install CUPS after removing it, then using the CUPS web page I had to add my network printer. Thats when the next problem popped up. I couldn't sign into the CUPS web portal as an admin, so I first had to add myself to the LPADMIN user group. Eventually I got it all setup and I was able to print the original program out.

Before I try amend the program I need to make sure CRASM will assemble the program into the same object code. CRASM needed some different syntax for some commands and directives.

In particular it needs to know the target processor with this command:

    CPU = 6800

Then it needs to know where to assemble the code. Thats done like this:

    * = $0000

To indicate the start of the program and end of program you have to add the following at the start and end:

    CODE

Since I was using several monitor routines I had to declare them at the top of the program, but instead I had already made up a short list of built in monitor routines in a separate file. Rather than retype that I just added:

    INCLUDE ET3400MON.TXT

and that gets sucked into the assembly process as though I had entered it into the new program.

After that I tried assembling the program in a Terminal window as follows:

~Documents/ET3400$ crasm -o retro.hex retro.txt

That produced a few errors so I had to change the following lines:

all comments needed a ; before them.

LDA A 0,X was changed to LDAA 0,X

STA A OUT+3-MESSA,X was changed to STAA OUT+3-MESSA,X

INC A becomes INCA,

FCB $08, $08, $08, $08, $08, $08 becomes DB $08, $08, $08, $08, $08, $08 

So just some formatting needed. I then assembled it successfully in CRASM without errors. Well it did assemble and I noticed slight differences. The original code in the ET-3400 manual uses 6800 Direct mode, which shortens and speeds up the command and only access the lower 256 bytes of memory ($00..$FF). On the 6502 this is called Zero-page addressing. Anyway it seems CRASM doesn't support Direct mode, so resulting code might run a bit slower, not that you would see.

Having gotten a successful assembly my next job is to patch it to run in ROM so I can burn it into the EEPROM above $E000 in my new top 8K ROM. That will also mean no self modifying code, which it currently uses.




Comments

Popular posts from this blog

ET-3400 ROM - Message Program Assembly

ET-3400 ROM - Program Test Video and Final Blog Post.

ET-3400 ROM - Draft PCB layout