TSR-80 micro computer MC-10 emulator.

User projects written in or related to FreeBASIC.
oog
Posts: 124
Joined: Jul 08, 2011 20:34

Re: TSR-80 micro computer MC-10 emulator.

Post by oog »

I found a photo of the mainboard:
http://www.cpcwiki.eu/forum/other-retro ... o8hg2pg660

There are two white keyboard plugs below the CPU. In the picture we see see wires from the left keyboard plug to Pin 2 and Pin 4 of the MC14503B. We also see a 10K Resistor array right above keyboard plug.
So your schematic of the keyboard seems to be ok for R20 and U14.
What we don't see is the glue logic for the disable pins of U14.

From the website http://slowcomputing.org/ssouth/mc10/ we get the information
2.3.3 Keyboard
The MC-10's forty-eight key, calculator-style keyboard connects to the mainboard through two, eight-conductor ribbon cables. Keyboard status can be obtained by reading from $BFFF in memory -- I'll post more information here soon.
So the disable pins of U14 seems to be decoded to address $BFFF. When low, the inputs of U14 are switched to the data bus (D0-D5) and the CPU can read the selected row of the keyboard.

So the signals KR0 to KR7 must be outputs to select a keyboard row. If P1 is not configured as output, then maybe the KR signals are connected anywhere else? From the mainboard photo I can't see, where the right keyboard plug is connected to.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: TSR-80 micro computer MC-10 emulator.

Post by D.J.Peters »

@oog thank you very mutch

Nice PCB picture you found with many details.

I found out i readed the wrong Motorola data sheet
a '1' in the data direction register meas output and 0 input.

After I disassembled the keyboard scan function it's clear for me how it works now.

By the way I got a real vintage TSR-80 MC-10 yesterday.
I ordered the part from eBay ($55) on my birthday 1 OCT 2014
in this short time from USA Iowa to Germany not bad.

Now I can research the MC-10 with my simple DSO (digital storage oscilloscope)
and the address and data bus with a 32 bit Logic Analyzer.

Joshy
Last edited by D.J.Peters on Dec 14, 2021 14:59, edited 1 time in total.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: TSR-80 micro computer MC-10 emulator.

Post by D.J.Peters »

First working test of the keypad and BASIC.
Image
Next more complicated step are the Cassette / Tape interface
for saving and loading BASIC, Machine Language or dimed Arrays.
There are many *.wav files with vintage BASIC stuff floating around.

Joshy
Last edited by D.J.Peters on Oct 03, 2017 4:36, edited 3 times in total.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: TSR-80 micro computer MC-10 emulator.

Post by D.J.Peters »

D.J.Peters wrote:Part 6: Cycle correct emulation and audio.
Looks like it's a must have.
Without a cycle and timing accurate emulation the SOUND command can't produce the right square wave.

Without a stable timing the pitch (via FBSound) will be wrong.

Without a cycle correct emulation the 50% duty cycle of the square wave are not guaranteed.

Joshy

The disassembled SOUND(pitch, duration) command:
file: sound.asm

Code: Select all

FFA5 8D F5     CMD_SOUND         BSR     LBL_FF9C    ; get param PITCH in B
FFA7 37                          PSHB                ; push PITCH
FFA8 8D EF                       BSR     LBL_FF99    ; get ',' and param DURATION in B
FFAA 32                          PULA                ; A=PITCH, B=DURATION
FFAB 36        LBL_FFAB          PSHA                ; [SP+2] PITCH
FFAC 37                          PSHB                ; [SP+1] DURATION
FFAD 4F                          CLRA
    
FFAE DE 09     LBL_FFAE          LDX  RAM_09         ; X = free running CPU cycle counter
FFB0 D6 08                       LDAB RAM_08         ; B=TCSR clr OCF (output compare flag)
FFB2 DF 0B                       STX  RAM_0B         ; OCR = curent CPU cycle counter (output compare register)

FFB4 88 80     LBL_FFB4          EORA #$80           ; toggle SPEAKER bit
FFB6 B7 BF FF                    STAA RAM_BFFF_IO    ; write SPEAKER bit (! VMCR=0 !)
FFB9 30                          TSX                 ; X=SP+1
FFBA E6 01                       LDAB 1,X            ; B=PITCH [SP+2]

FFBC 08        LBL_FFBC          INX                 ;  3 cylces
FFBD 08                          INX                 ;  6 cylces
FFBE 5C                          INCB                ;  8 cylces PITCH+=1 (! FF+1 = 00 !)
FFBF 26 FB                       BNE  LBL_FFBC       ; 11 cycles if PITCH<>0 then goto LBL_FFBC

FFC1 D6 08                       LDAB RAM_08         ; B=TCSR
FFC3 C4 40                       ANDB #$40           ; OCF (output compare flag)
FFC5 27 ED                       BEQ  LBL_FFB4       ; if OCF=0 then goto LBL_FFB4
FFC7 30                          TSX                 ; X=SP+1
FFC8 6A 00                       DEC  ,X             ; [SP+1] DURATION-=1
FFCA 26 E2                       BNE  LBL_FFAE       ; if DURATION>0 goto LBL_FFAE
FFCC 4F                          CLRA                ; A=0
FFCD B7 BF FF                    STAA RAM_BFFF_IO    ; clear SPEAKER bit (! VMCR=0 !)
FFD0 38                          PULX                ; SP+=2 (remove PITCH, DURATION from stack)
FFD1 39        LBL_FFD1          RTS                 ; return to caller
Last edited by D.J.Peters on Sep 15, 2017 14:03, edited 1 time in total.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: TSR-80 micro computer MC-10 emulator.

Post by D.J.Peters »

All 221 MC6803 CPU instructions are implemented now. (see: mc10.bas)

Joshy
Image
Last edited by D.J.Peters on Oct 03, 2017 4:37, edited 1 time in total.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: TSR-80 micro computer MC-10 emulator.

Post by D.J.Peters »

MicroColorBasic wrote:

Code: Select all

| = or
[] = optional 
"" string
# number
$ string
V numeric variable
V$ string variable
E expression 
C char

Operators: - + * / = < > >= <= ^

Variable names: A-Z[0-9][$]

# command [: command ...]
A line number can be any integer between 0 and 63999.

COMMAND PARAMS                   | SHORTCUT

ABS(#|V)                         [CONTROL][B]
E AND E
ASC(""|V$)
CHR$(#|V)
COS(#|V)                         [CONTROL][M]
CONT                             [CONTROL][2]  
CLEAR [#|V,#|V]                  [CONTROL][7]
CLS [#|V]                        [CONTROL][8]
DATA #,C[,...]
DIM V[$](#[,#...])
END                              [CONTROL][:] 
EXEC(#|V)
EXP(#|V)
FOR V = #|V TO #|V [STEP #|V]    [CONTROL][U]
GOSUB L#                         [CONTROL][D]
GOTO L#                          [CONTROL][J]
IF E THEN XXX [ELSE XXX]         [CONTROL][G]
INKEY$                           [CONTROL][P]
INT(#|V)                         [CONTROL][C]
INPUT ["" ;,]V$                  [CONTROL][@]
LIST [#|-#|#-#]                  [CONTROL][6]
LEFT(""|V$ , #,V)
LEN(""|V$)
LET V=E
LOG(#|V)                         [CONTROL][.]
MEM
MID$(""|V$,#,#)
NEW                              [CONTROL][5]
NEXT V                           [CONTROL][I]
NOT E
ON # GOSUB #[,#...]
ON # GOTO  #[,#...]
E OR E
READ V|V$[,...]                  [CONTROL][T]
REM [comment]
RESET(x,y)
RESTORE [#]
RETURN
RIGHT(""|V$, #|V)
RND(#|V)                         [CONTROL][V]
RUN [#]                          [CONTROL][1]
PEEK(#|V)                        [CONTROL][L]
POINT(X,Y)
POKE #|V,#|V                     [CONTROL][;]
PRINT|? [TAB(#)|@#,]][""|#|V|E]  [CONTROL][9]
SET(X,Y,COLOR)                   [CONTROL][E]
SGN(#|V)                         [CONTROL][X]
SIN(#|V)                         [CONTROL][N]
SOUND #|V,#|V                    [CONTROL][K]
SQR(#|V)                         [CONTROL][/]
STEP #|V                         [CONTROL][O]
STOP                             [CONTROL][-]
STR$(#|V)
TAN(#|V)                         [CONTROL][,]
THEN                             [CONTROL][H]
TO #
VAL(""|V$)
VARPTR(V|V$)
EDITOR:
BACKSPACE                         [CONTROL][A]
DELETE LINE                      [CONTROL][Q]
ARROR UP (^)                     [CONTROL][W]

TAPE:
CLOAD ["filename"]               [CONTROL][4]
CSAVE "filename"                 [CONTROL][3]
SKIPF "filename"
CLOAD* array[,"filename"]        [CONTROL][4][*]
CSAVE* array[,"filename"]        [CONTROL][3][*]

PRINTER:
LLIST                         [L][CONTROL][6]
LPRINT                        [L][CONTROL][9]
Last edited by D.J.Peters on Dec 14, 2021 15:35, edited 2 times in total.
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: TSR-80 micro computer MC-10 emulator.

Post by VANYA »

Hi Joshy!

How to print the symbol: = ?

Added last

Ah, found in the source code, it is: SHIFT+ key -

:))))

Support assembly is\will be?
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: TSR-80 micro computer MC-10 emulator.

Post by D.J.Peters »

VANYA wrote:How to print the symbol: = ?
Multikey used the US keyboard layout I will implement a Keyboard config diaog.
Isn't easy here to get the "*" multiply char on a german keyboard for the MC-10.
VANYA wrote:Support assembly is\will be?
Yes will be, I must first emulate the cassete/tape stuff for CLOAD and CSAVE.

Joshy
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: TSR-80 micro computer MC-10 emulator.

Post by D.J.Peters »

Added SAVE and LOAD for BASIC program's.

[F2] = save
[F3] = load

Note: BASIC are saved and loaded as binary tokens.
(the real MC-10, CoCo and other TSR-80 computers casette/tape format)

Joshy

Code: Select all

BASIC:       Hex Token:
FOR           80
GOTO          81
GOSUB         82
REM           83
IF            84
DATA          85
PRINT         86
ON            87
INPUT         88
END           89
NEXT          8A
DIM           8B
READ          8C
LET           8D
RUN           8E
RESTORE       8F
RETURN        90
STOP          91
POKE          92
CONT          93
LIST          94
CLEAR         95
NEW           96
CLOAD         97
CSAVE         98
LLIST         99
LPRINT        9A
SET           9B
RESET         9C
CLS           9D
SOUND         9E
EXEC          9F
SKIPF         A0        
TAB(          A1
TO            A2
THEN          A3
NOT           A4
STEP          A5
OFF           A6
+             A7
-             A8
*             A9
/             AA
^             AB
AND           AC
OR            AD
>             AE
=             AF
<             B0
SGN           B1
INT           B2
ABS           B3
USR           B4
RND           B5
SQR           B6
LOG           B7
EXP           B8
SIN           B9
COS           BA
TAN           BB
PEEK          BC
LEN           BD
STR$          BE
VAL           BF
ASC           C0
CHR$          C1
LEFT$         C2
RIGHT$        C3
MID$          C4
POINT         C5
VARPTR        C6
INKEY$        C7
MEM           C8
For example a BASIC ASCII line:
10 FOR I = 0 TO 3\n (18 bytes)

As binary hex Tokens:
00 0A 80 49 AF 30 A2 33 00 (9 bytes)

&H000A 10
&H80 FOR
&H49 I
&HAF =
&H30 0
&HA2 TO
&H33 3
&H00 EOL
TESLACOIL
Posts: 1769
Joined: Jun 20, 2010 16:04
Location: UK
Contact:

Re: TSR-80 micro computer MC-10 emulator.

Post by TESLACOIL »

Affectionately known back in the day as the Trash 80
http://oldcomputers.net/trs80iii.html
eunderhill
Posts: 1
Joined: Nov 20, 2017 3:01

Re: TSR-80 micro computer MC-10 emulator.

Post by eunderhill »

I know this is an old post, however this is an interesting MC-10 emulator. It's similar to Chris Mennie's Linux MC-10 emulator written in C++. If you ever plan on continuing development of this emulator, please consider visiting the MC-10 Yahoo Group. https://groups.yahoo.com/neo/groups/TRS80MC10Club/info It's the most active forum for this old computer. You'll get some good help there. Also there are some stuff hosted there that you won't find anywhere else on the net.
Post Reply