It is 50 years since the release of 8085 and tinyBASIC. Since I have some 8085 chips, I thought of making some simple and effective design.

There are many open source designs available online.  Most of them uses many components which are not available now or having large area of board.

I was looking for something similar to Lee Hart's 1802 or Z80 design. I came across a similar design based on 8085 microprocessor.

The board having only six ICs. Out of which three are just simple logic ICs. 

There are only three main components in the design. Microprocessor, 8kB RAM and 8kB ROM. The computer operates at 4.9152MHz using external crystal. So it is very easy to make.

The good thing about this design is it comes with circuit, layout and monitor program. It fits into a Altoids tin. Due to small available space, the board was designed in four layers. But signals uses only TOP and BOTTOM layers and the inner two layers used as power planes which simplifies easy routing.

The technical article was published in march 2019 Nuts and Volts magazine. The 8085 computer was  sold as a kit and currently not available. 

8085 computer - Components

As we see it uses very few components.

The assembled board looks like above picture.

It comes with inbuilt monitor program and tinyBASIC 1.0 with some additional commands.

The memory map is very simple.

Hardware Memory Map:
    0000H - 0EFFH    EPROM: TINY BASIC
    0F00H - 0FFFH    EPROM: ALTAIR TURNKEY MONITOR
    1000H - 1BFFH    EPROM: 8085 MONITOR
    1C00H - 1FFFH    EPROM: unused
    2000H - 3FFFH    SRAM
    4000H - 5FFFH    unavailable
    6000H - 7FFFH    RESERVED (decoded with I/O)
    8000H - FFFFH    OPEN

I/O Map:
    00H - 5FH    unavailable
    60H - 7FH    external I/O port
    80H - FFH    unavailable

Input Port:    60H
Output Port:    61H

Serial interface: 2400 baud, 8N1, Flow control: None

Because of processing of the serial data, sending text files from 
TeraTerm requires delays for character and lines.  I found the following 
settings very reliable:
Transmit delay =
    50 msec/char
    200 msec/line

 I have tried all the monitor options and all of them works well without any major issues.

The original design uses 8kB EEPROM 28C64 for ROM space. But I have used 8kB NVRAM DS1225 in initial testing.

As any board testing, it started with "hello, world" program

    ORG    2000H    ;load and run from address 2000H

    LXI     D, MSG    ; load message starting address in DE
    CALL    COUT    ; send a char pointed out by DE
    CALL    MONI    ; return to MONITOR. No RESET required
    
MSG     DB      0DH,0AH,'hello, world\n',0AH,0
MONI    EQU    1000H    ; monitor start address
COUT    EQU    1021H    ; monitor routine
    END

the above program makes use of inbuilt monitor function COUT to send a character over serial port . The assembled program downloaded into target using L command and Executed using G2000 command. The result is as below

The same program using TINY BASIC

PALO ALTAIDS TINY BASIC VER 1.0

OK
>PRINT "HELLO, WORLD!"
HELLO, WORLD!

The monitor program was assembled using A85 assembler which is available now and works with Windows 11.

MONITOR ADDRESS VECTORS
The ROM subroutine addresses below may be useful for writing programs 
on the Altaids computer.

MONITOR JUMP ADDRESSES
1000 COLD Monitor cold start
1003 WARM Tiny BASIC warm start

MONITOR VECTORS TO USEFUL ROUTINES (ENTER WITH CALL OPCODE)
1006 COUT Output char in A to serial port
1009 CIN Input char from serial port to A
100C PRTWD Output H,L as 4 Hex digits to serial port
100F PRTBY Output the byte in A as 2 Hex digits to serial port
1012 GETWD Get Hex word from serial port, return in H,L
1015 GETBY Get Hex byte from serial port, return in A
1018 PIN Get byte from input port, return in A
101B POUT Send byte in A to output port
101E DSPREG Display registers (registers are restored upon return)
1021 PUTSTR Send null terminated string pointed to by DE to serial port

 Sample Assembly Language program listing using A85 assembler.

                        ; DEMO.ASM
                        ;
                        ; ALTAIDS computer demo
                        ; based on Altair demo from Popular Electronics, Feb 1975
                        ;
                        ; COMMAND TO ASSEMBLE: 
                        ;    a85 demo.asm -l demo.prn -o demo.hex
                        ; 
                        ;
   2000                     ORG    2000H
   2000   3a 80 20      DEMO:    LDA    VAR1
   2003   47                MOV    B,A
   2004   3a 81 20          LDA    VAR2
   2007   80                ADD    B
   2008   27                DAA
   2009   32 82 20          STA    VAR3
   200c   c3 00 20          JMP    DEMO
                        ;    
   2080                     ORG    2080H
   2080   07            VAR1:    DB    07H
   2081   08            VAR2:    DB    08H
   2082   00            VAR3:    DB    0
                        
   2083                     END
2000  DEMO          2080  VAR1          2081  VAR2          2082  VAR3

We can easily download the HEX file into the computer using the monitor command L(Load). We can also enter the opcodes directly into memory locations in RAM using Enter option in the monitor menu. We can also directly run the machine code using G with starting address. If the system goes into endless loop or HALTED, then we can use hardware RESET button to restart.

I have used the TeraTerm for serial terminal. It is very easy to send BASIC in text format with TerTerm. It also supports the XMODEM which is useful for Saving a BASIC program or loading a BASIC program very fast.

The real test for the computer comes when it performs Mandelbrot Set using tiny BASIC. I have tried 2 different tinyBASIC programs. Both of them took same time to complete the task.

Mandelbrot Set - 8085
Mandelbrot Set - 8085

Since tinyBASIC can perform only Integer arithmetic, the results are different from the same code used in floating point arithmetic capable BASIC interpreter or processors.

The 80C85 computer also performed good at finding the prime numbers. There are two different methods and time taken differs by algorithm. Below is the results for primes upto 1000.

2nd run with difference algorithm

the above one is much faster than the previous one.

8085 EXTENDED INSTRUCTIONs:

The intel opcodes for the 8085 consists of 8 bits we all obviously know the NOP instruction machine code is "00".

As per theory 2^8, there are 256 valid numbers possible ranging from 0~255. But since 1976 intel claims and documented only 246 instructions. Even after 50 years intel never released or accepted there are 256 instruction code they designed for 8085.

But testers and debuggers quickly found the missing flags and instructions. There are some articles and manufacturer data sheet listed the missing 10 instruction code details. You can refer to the attachment for details.

We all know there are 16 bit addition operation can be easily performed in 8085 using BC, DE, HL and SP. In particular the DAD B instruction comes with a Instruction Code of "0000 1001" which is equal to 0x09H. But we can not find the Instruction code 0x08 in the list.

The Instruction Code 0x08 is actually meant for Double Subtraction using BC and HL registers.

DSUB (H)(L)=(H)(L)-(B)(C)

The Mnemonic for the instruction is DSUB.  The flags affected are Z,S,P,CY and it is a 3 cycle instruction taking 10 states. The content of registers B and C are subtracted from the contents of registers H and L. The result is saved in registers H and L. (H)(L) = (H)(L)-(B)(C)

I have performed this instrction on my OKI make 80C85 IC and works perfectly. The assembly code used is as follows:

DSUB (Instruction Code 08H)

;########################################################    
    TITLE "16 bit Subtraction using DSUB instruction"
;########################################################
;     DSUB Opcode 08H (H)(L)=(H)(L)-(B)(C)

    ORG    20000Q    ; Origin of the CODE

    MVI    B,60584/400Q    ; 0ECH load B with Subtrahend MS Byte
    MVI    C,60584 MOD 256    ; 0A8H Load C with Subtrahend LS Byte
    LHLD    Minuend    ; load the Minuend 
    NOP        ; Give some rest
DSUB    DB    08H    ; DSUB (H)(L)=(H)(L)-(B)(C)
    SHLD    Answer    ; STORE the result at Answer
    JMP    $-100CH    ; Jump to Monitor
    HLT        ; MOV M,M

    ORG 2020H    ; Database STARTs HERE
Minuend    DW 65244    ; 0FEDCH <- HEX-DEC->65,244
Answer    DW -1        ; 1234H <- HEX RESULT(FEDCH-ECA8H)
            ; 4660D (65,244-60,584)<- DEC RESULT        
    END DSUB

I have used the A85 assembler which is not recognizing the DSUB instruction. So I have added the opcode where it is required.

If we look at the list file, the DSUB instrction seemlessly added to the instructions correctly.

                        ;########################################################    
                            TITLE "16 bit Subtraction using DSUB instruction"
                        ;########################################################
                        ;     DSUB Opcode 08H (H)(L)=(H)(L)-(B)(C)
                        
   2000                     ORG    20000Q    ; Origin of the CODE
                        
   2000   06 ec             MVI    B,60584/400Q    ; 0ECH load B with Subtrahend MS Byte
   2002   0e a8             MVI    C,60584 MOD 256    ; 0A8H Load C with Subtrahend LS Byte
   2004   2a 20 20          LHLD    Minuend    ; load the Minuend 
   2007   00                NOP        ; Give some rest
   2008   08            DSUB    DB    08H    ; DSUB (H)(L)=(H)(L)-(B)(C)
   2009   22 22 20          SHLD    Answer    ; STORE the result at Answer
   200c   c3 00 10          JMP    $-100CH    ; Jump to Monitor
   200f   76                HLT        ; MOV M,M
                        
   2020                     ORG 2020H    ; Database STARTs HERE
   2020   dc fe         Minuend    DW 65244    ; 0FEDCH <- HEX-DEC->65,244
   2022   ff ff         Answer    DW -1        ; 1234H <- HEX RESULT(FEDCH-ECA8H)
                                    ; 4660D (65,244-60,584)<- DEC RESULT        
   2008                     END DSUB
16 bit Subtraction using DSUB instruction

2022  Answer        2008  DSUB          2020  Minuend       


The program starts at RAM location 2000H(just after ROM space). The DSUB instruction is located at 2008H and the Instruction code is 08H. 

After downloading the HEX file into the target, the monitor TRACE function is not working  and struck at 2008H DSUB instruction.  But G command for Execution works fine.  System Monitor starts at 1000H. So after Execution the program goes to MONITOR instead of HALT.

I have cleared all the memory locations before downloading the HEX file. So 

*d2000 202f
2000  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ................
2010  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ................
2020  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ................

 After downloading the HEX file into target 80C85 board, the dump looks likes below

*l
:1020000006EC0EA82A20200008222220C300107609.
:04202000DCFEFFFFE4.
:00200801D7! 2007
*d2000 202f
2000  06 EC 0E A8  2A 20 20 00  08 22 22 20  C3 00 10 76  ....*  .."" ...v
2010  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ................
2020  DC FE FF FF  00 00 00 00  00 00 00 00  00 00 00 00  ................

The L command loads the HEX file and we can see the Intel HEX file content followed by memory DUMP from 2000H~202F. The code used only 16 bytes ranges from 2000H~200FH. The Minuend and Answer are located at starting from 2020H to 2023H.

  Minuend  0FEDCH

 Subtrahend  0ECA8H

Expected Answer is 1234H

After executing the program, the memory DUMP is as follows

*d2000 202f
2000  06 EC 0E A8  2A 20 20 00  08 22 22 20  C3 00 10 76  ....*  .."" ...v
2010  00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00  ................
2020  DC FE 34 12  00 00 00 00  00 00 00 00  00 00 00 00  ..4.............

 The Answer and Instruction code is highlighed from the memory DUMP. So the 8085 correctly performed the 16 bit subtraction operation.

ASMX20 Assembler:

The ASMX20 assembler directly supports the assembly codes written with the extended instruction set. We need to declare the CPU type as CPU 8085U to enable the extended instruction code support. The following code  assembled and tested using 80C85 CPU.

AHRL (Instruction Code 10H)

    CPU 8085U
;########################################################    
;    TITLE "ARHL instruction"
;########################################################
;     ARHL Opcode 10H (H)(L)=(H)(L)-(B)(C)

    ORG    2000H    ; Origin of the CODE

    LHLD    DATA16    ; load the Minuend 
    STC

    ARHL        ; ARHL Instruction

    SHLD    Answer    ; STORE the result at Answer
    JMP    $-100CH    ; Jump to Monitor
    HLT        ; MOV M,M

    ORG 2020H    ; Database STARTs HERE
DATA16    DW 4444H    ; 4444H <- HEX-DEC->
Answer    DW -1        ; 2222H <- HEX RESULT
            ;         
;    END

RDEL (Instruction Code 18H)

    CPU 8085U
;########################################################    
;    TITLE "RDEL instruction"
;########################################################
;     RDEL Opcode 18H 

    ORG    2000H    ; Origin of the CODE

    LHLD DATA16    ; Load the 16 bit data

    XCHG        ; Exchange with DE
    RDEL        ; RDEL [18H] Instruction
    XCHG        ; Exchange with HL

    SHLD    Answer    ; STORE the result at Answer
    JMP    $-100CH    ; Jump to Monitor
    HLT        ; MOV M,M

    ORG 2020H    ; Database STARTs HERE
DATA16    DW 1234H    ; 1234H <- HEX-DEC->
Answer    DW -1        ; 2468H <- HEX RESULT
            ;         
;    END

Mandelbrot Set using 8085 Assembly Language with Extended Instruction Set:

The 8085 computer runs the Mandelbrot Set Assembly code seamlessly and finishes the task in 40 seconds. The original assembly language code was written for Intel 8080 processor. The code works as it is in 8085 without any modifications.  After optimization of the code for 8085 using extended instructions of 8085, the execution speed is faster than using 8080 instructions. the Mandelbrot Set output looks like below.

We can change the assembly language code with various parameters which suits our need.

SELF MODIFYING CODE:

Since the 8085 CPU is based on Von Neumann architecture, there is no difference between DATA and CODE. Taking advantage of this we can write Self Modifying Code in 8085 programs.

For example, the Instruction code for RAL(0001 0111) and RAR (0001 1111) and in Hexadecimal it is 17H and 1FH. If we notice the difference between the two is only one bit changes from 0 to 1. So if we perform a XOR operation with 00001000 (08H), the direction will change from RAL  to RAR and vice versa. We can perform the change directly on the running code.

Self Modifying Code program for 8085 using ASMX20 assembler listing below

 CPU 8085
;    TITLE "Self modifying LED program for MCS-85"

    ORG 2000H     ; RAM starts HERE
START   LXI H, 4000h     ; load HL pair with RAM end location
    SPHL        ; init Stack Pointer    

INIT    XRA A        ; clear ACCumulator
    STC        ; set CARRY bit

AGAIN    RAL        ; rotate RAL or RAR
    PUSH PSW    ; store the ACC content in stack
    CALL DELAY    ; call time delay
    CALL DELAY    ; call more time delay
    POP PSW        ; restore the ACC content back
    OUT 61H        ; send it to output port 61H
    CC XOR8
    JMP AGAIN    ; do the shift again
XOR8    LDA AGAIN    ; load the current rotate instruction    
    XRI 08H        ; this will change the direction
    STA AGAIN    ; store the modified instruction    
    XRA A        ; clear the ACC
    STC        ; set CARRY flag
    RET        ; return 

; --- 16-bit Delay Routine ---
; Input: HL pair holds the 16-bit count (up to FFFFH)
DELAY:
        LXI H, 0FFFFH/2   ; [10 T-states] Load HL with 65,535
LOOP_16:
        DCX H           ; [6 T-states] Decrement HL pair
        MOV A, L        ; [4 T-states] Move Low byte to A
        ORA H           ; [4 T-states] OR with High byte (Sets Zero flag)
        JNZ LOOP_16     ; [10/7 T-states] Jump if result not zero
        RET             ; [10 T-states]
    END         ; Added for A85

 The above program used to control LED connected to OUTput PORT 61H. During execution of the program, there will be only one instruction code will be present in the program. Either RAL or RAR but never both. When a CARRY flag is SET, the program automatically changes the direction to opposite from previous Instruction Set.

INTERFACING:

The output of the port contents are not static. We need to have additional latch to hold the value using IOW signal which is available on the header pin.

Tried 2 hexadecimal digit display using TIL311. Since TIL311 having a STROBE, we can directly connect to output port 61H.

TIL311 works well with Monitor IO command Oxx. Similarly OUTput PORT61H works with assembly code. But TIL311 not works with tinyBASIC output port commands.

Sojourner (rover)

The Sojourner rover was a vehicle that reached Mars on July 4, 1997 as part of the Mars Pathfinder mission. Sojourner was operational on Mars for 92 sols (95 Earth days), and was the first wheeled vehicle to operate on an astronomical object other than the Earth or Moon. The landing site was in the Ares Vallis channel in the Chryse Planitia region of the Oxia Palus quadrangle.

Sojourner's central processing unit (CPU) was an Intel 80C85 with a 2 MHz clock, addressing 64 kilobytes (Kb) of memory, and running a cyclic executive. It had four memory stores; 64 Kb of RAM made by IBM for the main processor, 16 Kb of radiation-hardened PROM made by Harris, 176 Kb of non-volatile storage made by Seeq Technology, and 512 Kb of temporary data storage made by Micron. The electronics were housed inside the rover's warm electronics box (WEB). The WEB is a box-like structure formed from fiberglass facesheets bonded to aluminum spars. The gaps between facesheets were filled with blocks of aerogel that worked as thermal insulation. The aerogel used on the Sojourner had a density of approximately 20 mg/cc. This insulator was designed to trap heat generated by rover's electronics; this trapped heat soaked at night through the passive insulation maintaining the electronics in the WEB at between −40 and 40 °C (−40 and 104 °F), while externally the rover experienced a temperature range between 0 and −110 °C (32 and −166 °F).

CONCLUSION:

It is a very simple and easy to build 8085 computer board. Both monitor and tinyBASIC are very useful and fun.

8085
8085 book + 8085 kit using PL2303 cable
OK
>RUN
 _____ _             ____    _    ____ ___ ____
|_   _(_)_ __  _   _| __ )  / \  / ___|_ _/ ___|
  | | | | '_ \| | | |  _ \ / _ \ \___ \| | |
  | | | | | | | |_| | |_) / ___ \ ___) | | |___
  |_| |_|_| |_|\__, |____/_/   \_\____/___\____|
               |___/

OK
>