🧑‍🏭

Assembly coding

TypeQuiz 3 Material

Translate ASSEMBLY LANGUAGE to MACHINE LANGUAGE

First Pass Assembly —>Generating the Symbol Table

Second Pass - generating the ML program

Assembly to Machine Example

Pseudo-instructions

HALT —> Call a system utility routine(TRAP). Trap takes one 8-bit unsigned number(0-255)

TRAP x25 —> Computer stops.

HALT is a pseudo instruction that contains TRAP x23

RET —> Jump(1100) to R7

Make instructions using ML

Substract

NOT R3, R3 ;flip the bits of R3

ADD R3, R3, #1 ;add 1 to R3 ;now R3 is -R3

ADD R1, R2, R3

OR(R1 = R2 | R3)

NOT R2, R2 ;R2 = ~R2

NOT R3, R3 ;R3 = ~R3

AND R1, R2, R3 ;R1 = ~R2 & ~R3

NOT R1, R1 ;R1 = ~(~R2 & ~R3)

Clear

AND R1, R1, #0 ;R1 = R1 & 0

;anything and zero is zero

R1 = R2

ADD R1, R2, #0 ;R1 = R2+0; R1 = R2

BR vs JMP

BR!!

WHILE

IF statement

FOR loop

Do while

Array Addressing

Indexing into an Array