Specifications for the TB Inc. machine:

Memory: 1K

Registers: A, X, PC, MAR, MDR, IR, CC. CC = 0 when equal, 1 when <, and 2 when >.

Hardware Stack: must accommodate up to 10 entries

Instruction Set:

Mneumonic

Opcode

Effect

ADD m

40

A <- (A) + mword

STA m

0C

mword <- (A)

STCH m

54

m <- rightmost byte (A)

STX m

10

mword <- (X)

J m

3C

PC <- mword

JSUB m

48

Push(PC, thestack); PC <- mword

RSUB

4C

Pop(PC, thestack)

LDA m

00

A <- mword

LDCH m

50

A (rightmost byte) <- m

HALT

FF

halt the CPU

LDX m

04

X <- mword

COMP m

28

Set CC by (A):(mword)

TIX m

2C

X <- (X + 1); CC set by (X):mword

Addressing modes indicated by bits 8, 9, and 10:

000

direct

010

indexed

001

indirect

011

indexed indirect

1

immediate

Opcode form:

bits 0 - 7

opcode

bit 8

immediate mode indicator

bit 9

indexed addressing bit if bit 8 = 0

bit 10

indirect addressing bit if bit 8 = 0

bits 9 - 23

operand value (if immediate)

 

all values right adjusted; zero fill

 

or truncate as needed

I/O

Input to your emulator will be records containing pairs of characters which simulate pairs of hexadecimal digits. Each pair of hex digits comprises a byte. An input record can have multiple contiguous bytes. Your emulator should recognize incorrect opcodes and addresses beyond the bounds of available memory, in which case the emulator should terminate with an appropriate message.

Initialization

Initialize all memory locations and CPU registers to hex zeroes. A given program should be loaded into consecutive bytes of memory, starting at memory location 0.After loading is complete, the emulator should print the contents of SIC memory, first in hex format and then in ASCII character format. Mark this memory dump with hex addresses. Begin execution of the simulated program at SIC memory location zero. After each machine instruction is executed, print the contents of all registers in hex format. At the end of execution, the emulator should print the contents of SIC memory, once again in hex and ASCII format.

Project Grade

5%

progress reports

25%

peer evaluation

35%

correct

execution of opcodes 20%

errors detected with appropriate messages 10%

required output 5%

20%

programmer's guide

  general description 5%

  chart(s) and diagram(s) 5%

  module descriptions 5%

  data structure descriptions 5%

15%

user's guide

  general description (how to use) 5%

  machine description 5%

  explanation of output and error messages 5%


Return to:
CS402 page | Dr. Krone's Home page