Science of Cambridge MK14 simulator

This is an attempt to make a Science of Cambridge MK14 simulator using JavaScipt + SVG that runs in a browser. It is a port of Paul Robson's DOS version. It uses SVG for the LED display. A timer is used to run 100 instructions, every timer tick. It does not work on tablets yet!

References: Paul Robson's page www.robsons.org.uk/archive/members.aol.com/mk14emu/ | Karen Orton's Page techlib.com/area_50/Readers/Karen/micro.htm | MK_14 Rom listing | My notes | Scmp_Code


Use the mouse to press the buttons below:-

GO MEM ABORT A
7 8 9 B
4 5 6 C
1 2 3 D
TERM 0 F E
RESET
example1: XOR and store
press
abort 0 F 2 1 Mem
C 4 Mem
A A Mem
E 4 Mem
5 5 Mem
C 8 Mem
0 2 Mem
3 F
;now to execute
abort 0 F 2 2 GO
;you should read:
0F29 FF

 

Simulate Speed: instructions every 75 ms ms used.

Cheat:- Inject code @ 0xF20:




example 1: XOR and store

Some very simple hex to type in to the MK 14. It works out 0xAA xor 0x55 which equals 0xFF. It stores the result in memory just after the return to the monitor.
abort 0F22 Term

or
abort 0F21 Mem
C4 Mem
AA Mem
E4 Mem
55 Mem
C8 Mem
02 Mem
3F
;now go and execute
abort 0F22
G
;
you should read:
0F29 FF

The code assembled using rcasm or asm:
   32 0f22:
   33 0f22:             	; load accumulator with 0xAA eor with 0x55 and store
   34 0f22: c4 aa       	ldi	0aah
   35 0f24: e4 55       	xri	055h
   36 0f26:
   37 0f26: c8 02       	st	2 (0)
   38 0f28:             	; return to the monitor
   39 0f28: 3f          	xppc	3
   40 0f29:
   41 0f29:
   42 0f29:             	; next code is overwritten by result.

example 2: write to display

execute from 0F20. Jmp to routine. set up P1 to point to the display. load 0xAA and write to display.
   31 0f20: 90 00       	jmp	main0
   32 0f22:
   33 0f22:             main0:
   34 0f22:             	; reload display pointer.
   35 0f22: c4 00       	LDI	Disp.0
   36 0f24: 31          	XPAL	1
   37 0f25: c4 0d       	LDI	Disp.1
   38 0f27: 35          	XPAH	1
   39 0f28:
   40 0f28: c4 aa       	ldi	0aah
   41 0f2a: cd 00       	st	@0(1)
   42 0f2c:
   43 0f2c: 90 f4       	jmp	main0
   44 0f2e:
   45 0f2e:

Requirements

The MK14 had ram, rom, a Nationa SC/MP cpu, display, keyboard, glue logic, and power supply This simulation has an array called Memory[], and the cpu is simulated. The display and keyboard have to be emulated, so that the code the SC/MP cpu runs works.

The Display


The display is at 0x0900+x where x is the digit

Write the segments into the address, and latch.

The MK14 keeps displaying until the next write to the display. (* This simulation does not do this yet! *)

Update display() when CPU writes to the display memory

The MK14 had a 4 bit binary decoder and a latch using 74LS154 mux.  The display lit one digit at a time.

This program uses SVG graphics and innerHTML to render the 7-segment display. It reads Memory[ 0x900 ] to Memory[ 0x909 ] at the moment.

The keyboard


In a web page you can either track key up and down. Difficult:- Could use the mouse. Buttons have different events to other tags.

The keyboard is a 4x8 matrix sharing the display logic.

When the cpu reads from the Keyboard addresses, the display decoder pulls a column low.
If a key is pressed, the accumulator has a low in the apropriate bit if the key is pressed.

The JavaScipt uses onmousedown() and onmouseUp() to set and reset a bit in an array called KeyPressesdA[] indexed by the button.

This is consulted when the sc/mp reads the keyboard address.

This is dualport Ram

Buttons:-

reset

GO	MEM	Abort	A
7	8	9	B
4	5	6	C
1	2	3	D
term 0	F	E

Layout:-
-----------------------------------
bit	|	7	6	5	4	3	2	1	0
-----------------------------------
ra3	|	7	6	5	4	3	2	1	0
ra2	|							9	8
ra1	|	Te			Ab 	Me	Go
ra0	|	F	E			D	C	B	A

http://www.javascript-coder.com/button/javascript-button-p1.phtml

The CPU


This ports Paul Robson's C code.

It needs the registers:
	ACC
	E
	status
	p0,p1,p2,p3

Functions:
	reset
	instructionInterpreter -  See Paul Robinson - I used his code.
	helper functions

The Memory map

Only the first 12 bits of the program counter are decoded

000-1FF  512 byte SCIOS ROM  Decoded by 0xxx
200-3FF  ROM Shadow / Expansion RAM
400-5FF  ROM Shadow / Expansion RAM
600-7FF  ROM Shadow / Expansion RAM
800-87F  128 bytes I/O chip RAM  Decoded by 1xx0
880-8FF  I/O Ports  Decoded by 1xx0
900-9FF  Keyboard & Display  Decoded by 1x01
A00-AFF  I/O Port & RAM Shadow
B00-BFF  256 bytes RAM (Extended) / VDU RAM  Decoded by 1011
C00-CFF  I/O Port & RAM Shadow
D00-DFF  Keyboard & Display Shadow
E00-EFF  I/O Port & RAM Shadow
F00-FFF  256 bytes RAM (Standard) / VDU RAM  Decoded by 1111

The ROM

Memory[] is populated with values from the ROM. MK_14 Rom listing | Karen Orton's Page techlib.com/area_50/Readers/Karen/micro.htm |