Micro8A.zip Enhanced Micro8 with a Stack new

22 September 2002.  There are still some problems with the design.

Add a 7 bit stack pointer at $0FF similar to the 6805 but bigger..
Add reset and interrupt vectors to the top of memory.
Add an external interrupt and interrupt mask flag.
Add a parallel I/O port at $000 like the 6805
Add a timer with interrupt
Changed BRN (a useless instruction) to BSR (Branch to subroutine)
Decode LSB's of immediate addressing instructions (B2, B1 and B0 of first byte) in particular the STO immediate instruction, and add a few inherent stack instructions like:

The Micro8A.zip has two boot programs. You must recompile the design, depending which one you are using. Bootrom_0.vhd prints out "Hello World" Bootrom_1.vhd is a raw binary loader that loads aprogram into #100. It assumes the file is exactly 256 bytes long. It with prompt with a question mark ("?") afterloading exactly 256 bytes. Type "G" to execute the program. I used the Hyperterm program under windows, with 8 bit serial settings at 19K2 baud and simple sent a text file without any handshake protocols. Instructions on using the epedit program to generate a raw binary file from the smal32 macro assembler are listed down the page.

With the Micro8a I moved the I/O module connector to J8.

5th October 2002

Micro8a-5oct02.zip

There is still a problem with bootrom_1.vhd.

I've updated micro8a.zip with the following changes:

1. STO & NOR no longer affect the carry flag
2. ROL & ROR used the Z flag instead of the C flag - Has been fixed
3. The Interrupt flag was set before the condition codes were pushed on the stack
4. Test benches have been generated for most intructions including interrupts

14 October 2002

Micro8a-14oct02.zip

There was a bug in the CLRA and CLRX instruction. It did not actually clear the register which meant the LODA and LODX macros did not work. There is still a problem with the bootload.asm code. I'm not sure if the memory accesses are not working properly or what. To do a compare I push the accumulator onto the stack and do a subtract, then pop the accumulator. The Push and Pull should not affect the condition codes, but it does not seem to be working reliably.

PSHA
NEGA
ADDA # 'value'
PULA
BNE error

Extended Instructions:

Note that the Immediate operators only use 8 bits of the second byte as an argument, leaving the
top 3 bits in the first byte for extra instructions. I've decode those instructions as follows:

000 00 000 ADDAI -- ADD acca immediate (2 bytes)
000 00 001 undefinded
000 00 010 INCA
000 00 011 DECA
000 00 100 COMA
000 00 101 NEGA
000 00 110 TSTA
000 00 111 CLRA
000 01 xxx ADDAA -- ADD acca absolute (2 bytes)
000 10 xxx ADDAX -- ADD acca indexed (2 bytes)
000 11 xxx ADDAI -- ADD acca PC relative (2 bytes)

001 00 000 NORAI -- NOR acca immediate (2 bytes)
001 00 001 ASRA
001 00 010 ROLA
001 00 011 RORA
001 00 100 LSLA
001 00 101 LSRA
001 00 110 undefined
001 00 111 undefined
001 01 xxx NORAA -- NOR acca absolute (2 bytes)
001 10 xxx NORAX -- NOR acca indexed (2 bytes)
001 11 xxx NORAP -- NOR acca PC relative (2 bytes)

010 00 000 RSP - Reset Stack pointer to #0FF
010 00 001 RTS - return from Subroutine
010 00 010 SWI - Software Interrupt
010 00 011 RTI - Return from interrupt
010 00 100 PSHX - Push Index Register onto the stack
010 00 101 PULX - Pull the Index register off the stack
010 00 110 PSHA - Push Accumulator onto the Stack
010 00 111 PULA - Pull Accumulator off the Stack
010 01 xxx STOAA - Store Accumulator Absolute (2 bytes)
010 01 xxx STOAX - Store Accumulator Indexed (2 bytes)
010 01 xxx STOAP - Store Accumulator PC Relative (2 bytes)

011 00 xxx - BRA - Branch Always (2 bytes )
011 01 xxx - BEQ - Branch if Zero flag set (2 bytes)
011 10 xxx - BCS - Branch carry flag set (2 bytes)
011 11 xxx - BMI - Branch if Negative flag set (Negative) (2 bytes)

100 00 000 ADDXI -- ADD Index Register Immediate (2 bytes)
100 00 001 undefinded
100 00 010 INCX
100 00 011 DECX
100 00 100 COMX
100 00 101 NEGX
100 00 110 TSTX
100 00 111 CLRX
100 00 xxx ADDXA -- ADD Index Register Absolute (2 bytes)
100 00 xxx ADDXX -- ADD Index Register Indexed (2 bytes)
100 00 xxx ADDXP -- ADD Index Register PC Relative (2 bytes)

101 00 000 NORXI -- NOR Index Register Immediate (2 bytes)
101 00 001 ASRX
101 00 010 ROLX
101 00 011 RORX
101 00 100 LSLX
101 00 101 LSRX
101 00 110 undefined
101 00 111 undefined
101 01 xxx NORXA -- NOR Index Register Absolute (2 bytes)
101 10 xxx NORXX -- NOR Index Register Indexed (2 bytes)
101 11 xxx NORXP -- NOR Index Register PC relative (2 bytes)

11000 000 SEC - Set Carry flag
11000 001 CLC - Clear Carry Flag
11000 010 SEI - Set interrupt Mask
11000 011 CLI - Clear Interrupt mask
11000 100 undefined
11000 101 undefined
11000 110 undefined
11000 111 undefined
110 01 xxx STOXA - Store Index Reg Absolute (2 bytes)
110 01 xxx STOXX - Store Index Reg Indexed (2 bytes)
110 01 xxx STOXP - Store Index Reg PC Relative (2 bytes)

111 00 xxx - BSR - Branch to Subroutine (2 bytes)
111 01 xxx - BNE - Branch if not Zero (2 bytes)
111 10 xxx - BCC - Branch carry clear (2 bytes0
111 11 xxx - BPL - Branch if Negative flag Clear (Positive) (2 bytes)

SMAL32 A Symbolic Macro Assembly Language

http://www.cs.uiowa.edu/~jones/cross/smal32/

This is the Macro Assembler Tim Boscke used for his CPLD micro.
I've added my own rather rough macros to help assemble code for the Micro8A.
The general format is a 3 character instruction followed by an "A" or "X" to denote the register
followed by an addressing mode ("I" immediate, "A" absolute, "X" Indexed, "P" PC relative)
I have also included my EPEDIT program that allows you to convert the smal32 output
into a raw binary file.

Smal-23sep02.zip - My Micro 8a Macros

Smal-14oct02.zip - My Micro 8a Macos


 I managed to get a 256 byte raw binary loader to transfer the program into RAM at $100
and execute it (bootrom_1.vhd), and the "Hello World" message program (hello.asm) worked ok.
I also tried to squeeze a secondary loader that reads the ".o" files generated by Smal32, but thats
when I got into trouble.

I have put a program in the smal32.zip file called epedit, which is an eprom editor.
I was written using Cygwin, so I am not sure if the binary will work under DOS.
The source is there, so you can compile it with your favourite Windows or DOS C compiler.

Invoke epedit:

./epedit

Set the I/O mode Type to Smal32

T O

 Load the file

L bootload.o

Then set the mode to raw binary

T B

then save the Raw binary to a file

S bootload.bin 100 1ff

assuming the file sits at #100.