Assembly Language and Assemblers

 

This particular assembly language describes a virtual machine (VM) with the following characteristics:

 

BINARY OP CODE
INSTRUCTION
MEANING
CON() = "contents of"
0000
LOAD X
CON(X) -> CON(R)
0001
STORE X
CON(R) -> CON(X)
0010
CLEAR X
0 -> CON(X)
0011
ADD X
CON(R) + CON(X) -> CON(R)
0100
INCREMENT X
CON(X) + 1 -> CON(X)
0101
SUBTRACT X

CON(R) - CON(X) -> CON(R)

0110
DECREMENT X
CON(X) - 1 -> CON(X)
0111
COMPARE X

IF CON(X) > CON(R)
THEN CON(GT) <-1
ELSE CON(GT) <- 0
...
SAME FOR EQ & LT

1000
JUMP X
X -> CON(PC)
1001
JUMPGT X

IF CON(GT) = 1
THEN X -> CON(PC)

1010
JUMPEQ X

IF CON(EQ) = 1
THEN X -> CON(PC)

1011
JUMPLT X

IF CON(LT) = 1
THEN X -> CON(PC)

1100
JUMPNEQ X
IF CON(EQ) = 0
THEN X -> CON(PC)
1101
IN X
CON(IN) -> CON(X)
1110
OUT X
CON(X) -> CON(OUT)
1111
HALT
STOP

 

 

Distinguish between an ASSEMBLER and a COMPILER or INTERPRETER

 

[Prev] [Next]


CS1104 Main Page
Last Updated 2001/10/15
© L.Heath, 2000, extensively updated by J.A.N. Lee, 2001.