Hints on Sim68 Assembly
Encoding
Following are some useful Sim68 assembly statements with their
detailed meanings:
-
org $1000, meaning that the actual program starts at
memory location $001000 (24 bit)
-
x dc 30, meaning at memory address
location x, we define a 16 bit constant 30 ($001E).
-
y dc 30, 20, -1, 100, meaning
starting at memory address location y, we define four
16 bit constants, 30, 20, -1, 100, which will occupy 8 bytes in total (next
PC = PC+8).
-
z ds 2, meaning
starting at memory address location z, we define a
16 bit variable (NO value is stored & next PC = PC+4).
-
bloc ds 4, meaning
starting at memory address location bloc, we define 4
16 bit variables, which will occupy 8 bytes in total (next PC = PC+8).
-
trap #0, meaning stop program. The code is: $4E40
=%0100111001000000
-
move x(a0),d0, meaning move memory data located at address
(a0+x) to data reg. d0. x is the memory address displacement
that can be a variable defined as a constant (dc) or a storage (ds). To
get the value of x, one has to compute its actual address in the
program which starts at org.
-
beq target, meaning branch by equal to memory location target,
e.g. $002038, which is the label at the beginning of some
instruction,
e.g. label add d0,d1. The displacement
needed in the code = target-(PC+2), e.g.
$002038-$002004-2=$32
(assuming the branch instruction is located at $002004). The code of
the branch instruction is hence: $6732 = %0110011100110010.