8080 Trainer - more info

From: Glenn Roberts <groberts_at_mitre.org>
Date: Wed Apr 15 21:10:51 1998

Tony Duell originally asked this but the group may be interested. The MMD1
8080 trainer was based on a design by Jonathan Titus and Company (Tychon
Inc.) and was apparently described in a series of articles in the May-July
1976 Radio Electronics, however it is also described in "The 8080a Bugbook",
a Howard Sams book (ISBN 0-672-21447-4), 1977.

Tony: the two ROM sockets are for 1702 ROMS. The very simple but efficient
monitor, called KEX for "Keyboard Executive", easily fits in the 256 byte
space of one of these, leaving ROM socket 1 for "expansion".

I don't have access to the original articles on this unit but it was easy
enough to reverse engineer the assembly listing of KEX, below. I'd give
y'all instructions on using the monitor but that would take the fun out of
reading the source listing! i've also stuck the HEX file at the end of the
listing. have fun!

- Glenn

* KEX.ASM
*
* Keypad EXecutive
*
* This is a reverse engineered assembly listing
* of the 8080 trainer ROM. For more information see
* Radio Electronics May-July 1976 issues, also Chapter 2
* of "The 8080 Bugbook"
*
* Glenn Roberts 2/13/97
*
RST1 SET 003010A
RST2 SET 003020A
RST3 SET 003030A
RST4 SET 003040A
RST5 SET 003050A
RST6 SET 003060A
STACK SET 004000A
USERFWA SET 003000A
*
* Keypad equates
*
H.KEY EQU 10Q
L.KEY EQU 11Q
G.KEY EQU 12Q
S.KEY EQU 13Q
A.KEY EQU 15Q
B.KEY EQU 16Q
C.KEY EQU 17Q

        ORG 0

        JMP START
        DS 5

        JMP RST1
        DS 5

        JMP RST2
        DS 5

        JMP RST3
        DS 5

        JMP RST4
        DS 5

        JMP RST5
        DS 5

        JMP RST6
        DS 5
*
* Cold boot entry, load stack and memory pointer
*
START LXI SP,STACK
        LXI H,USERFWA

MAIN MOV C,M ; C is value to be displayed
        MOV A,H ; Output High byte
        OUT 1 ; of memory counter to left LEDs
        MOV A,L ; and low byte of memory counter
        OUT 0 ; to center LEDs
*
* Loop to process keypad input
*
KPLOOP MOV A,C ; output the value of C to
        OUT 2 ; the rightmost LEDs

L110 CALL RDKEY ; Read key from keypad
        CPI 8 ; Is it numeric octal? (0-7)
        JNC L134 ; no, test for others

        MOV B,A ; Temp save in B
        MOV A,C ; Get the current working byte
        RAL ; and move it left 3 bits
        RAL
        RAL
        ANI 11111000B ; then clear low 3 bits
        ORA B ; and insert temp value (B) there
        MOV C,A ; then move back to C
        JMP KPLOOP

L134 CPI L.KEY ; Was key "L"?
        JNZ L345 ; no
        MOV L,C ; yes, move working byte to L
        JMP MAIN ; and go to top

        CPI H.KEY ; Was key "H"?
        JNZ L156 ; no
        MOV H,C ; yes, move working byte to H
        JMP MAIN ; and go to top

L156 CPI S.KEY ; Was key "S" (step)?
        JNZ L170 ; no
        MOV M,C ; yes, move working byte to memory
        INX H ; increment memory pointer
        JMP MAIN ; and go to top

L170 CPI G.KEY ; Was key "G" (go)?
        JNZ L110 ; no
        PCHL ; yes - load Program Counter from HL

        DS 65 ; filler
*
* Delay (debounce)
*
* This routine delays for a bit over 10ms.
* Note cycle time is 1.5 microseconds
* Total delay: 62 + (294 * 24) = 7,118 cycles
* 7,118 * 1.5 = 10.677 ms.
*
DELAY PUSH PSW
        PUSH D
        LXI D,294 ; Number of times to loop

DLY1 DCX D ; Decrement DE
        MOV A,D ; and test for DE = 0
        ORA E
        JNZ DLY1 ; if not, keep looping

        POP D
        POP PSW
        RET
*
* Read a key from the keypad (with debouncing)
*
RDKEY IN 0 ; Read the keypad port
        ORA A ; set flags
        JM RDKEY ; no key depressed - loop
        CALL DELAY ; have key, debounce

RDK1 IN 0 ; Re-read the key
        ORA A ; set flags
        JP RDK1 ; key still depressed - loop
        CALL DELAY ; key released, wait

        IN 0 ; Read once more
        ORA A ; set flags
        JP RDK1

L345 ANI 00001111B ; Only lower nibble of interest
        PUSH H
        MVI H,0 ; Set HL to point to table
        ADI #TABLE
        MOV L,A
        MOV A,M
        POP H
        RET
*
* Lookup table for keypad
*
TABLE DB 0,1,2,3,4,5,6,7
        DB S.KEY
        DB 0
        DB C.KEY
        DB G.KEY
        DB H.KEY
        DB L.KEY
        DB A.KEY
        DB B.KEY

        END START

:10000000C33800BB3A32D63AC30803318022CD5EF2
:10001000C31003210842CD46C3180323CDEC3D1184
:10002000C320030842CD7041C32803AF328C3A325B
:10003000C33003153B2108423100042100034E7CEC
:10004000D3017DD30079D302CDCD00FE08D25C0070
:100050004779171717E6F8B04FC34500FE09C2E508
:100060000069C33E00FE08C26E0061C33E00FE0B85
:10007000C278007123C33E00FE0AC24800E93B116A
:100080000142017B3BFF2B3A7B3BE601C178D1E18A
:10009000CA263DFE3DC2103DCD7F3DDAE23B21DF69
:1000A0003ACD8734FE2CCC213E21DF3A11FB4101B1
:1000B0007B3BFF2B3A7B3BE601CAC03C21D53AF59E
:1000C000D51126011B7AB3C2C400D1F1C9DB00B738
:1000D000FACD00CDBF00DB00B7F2D600CDBF00DB0C
:1000E00000B7F2D600E60FE52600C6F06F7EE1C944
:1000F00000010203040506070B000F0A08090D0E94
:00003801C7
Received on Wed Apr 15 1998 - 21:10:51 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:30:41 BST