Home | Job | Pinball | Photo Album | Automotive | Press/Awards | Contact |
One area that I have not previously explored is the development of my own ROMs for the 6802. To get started in this area, I looked into several cross-assemblers, and settled on the A68. One appealing aspect is that it is a small, portable (143 kbytes) DOS command line application. My first goal was to write a small assembly program that demonstrates the basic interactions I would need and then decide later how far to take it. This initial program would 1)read ROM, 2)write and read RAM, and 3)do some PIA output toggling. It would also 4)demonstrate the Reset and Interrupt vectors.
The first thing to figure out is how to set up the code to run. From reading the datasheet on the 6802, the CPU core uses the word at the top of memory as the vector to jump to after a Reset (this is known as the Reset Vector). One important thing to note is that on System 11 (my first target system), the U27 ROM is located starting at address 0x8000. It is a 27256 (a 32kbyte) device. So it spans from CPU address 0x8000 to CPU 0xFFFF. This needs to be taken into account in the constants in the ROM. An example with a super minimal program illustrates this:
; Top of program
LOOP ORG $3FFF
JMP $BFFF
; Set up Reset Vector
ORG $7FFE
FCB $BF,$FF
END
I have been using a Dataman S4 for several years to program ROMs, and I know it has an emulator mode. I had initially assumed that I needed to connect the CPU board (the target location) to the ZIF socket where the ROM normally goes, but after emailing the manufacturer, I learned that a special emulator cable plugs into the back of the programmer.
This cable effectively turns the S4 into a ROM chip that can be easily changed and updated via its serial cable. I therefore didn't need to constantly burn and erase ROMs to try code revisions.
S4 (right) plugged into the System 11 board.
The above images shows the development environment. The S4 is plugged into the System 11 board at the U27 ROM location, and the CPU chip is plugged into a breakout board that allows me to connect in my Logic Analyzer. This latter tool allows me to observe what the CPU chip is doing and do general code debugging.
The power of this setup is shown by the fact that I can edit the assembly file and then have that code running on the board in mere seconds. I can repeat this cycle quickly without having to burn and UV erase any PROMS. As a note, the hex file that A68 generates can be transferred directly into the S4 without any processing (set S4 to hex mode).
Running the CodeThe sample program (see link below), was assembled and then loaded into the S4 ROM emulator. The Logic Analyzer result is shown on the right side of the image below. This simple program demonstrates most of the goals set above.
Assembly listing on the left and the Logic Analyzer samples of the Address and Data Bus on the right.
(c) 2021 Edward Cheung, all rights reserved.