Instruction LOADM STORE SHL SHR ADD SUB NC AND OR XOR NOT 10 BEQ 11 BNE 12 JMP 1
ID: 3574631 • Letter: I
Question
Instruction LOADM STORE SHL SHR ADD SUB NC AND OR XOR NOT 10 BEQ 11 BNE 12 JMP 13 LOADD 14 CMP 15 Command Example Code Load Memory Address LOAD 8 into Accumulator Stores Accumulator to 8 STORE Memory Address Shifts Accumulator Left SHL 0 Shifts Accumulator Right SHRO Adds Accumulator wi ADD 12 memory Subtracts Accumulator SUB 14. by Memory Increments Accumulator INC 0 AND 8 OR 9 XOR 10 NOT 8 Jumps to label IF branch BEQ test1 S equal Jumps to label IF branch BNE test2 NOT equal Jumps to label JMP test Load Data into LOADD 20 Accumulator compares accumulator CMP 30 and memory contents Example Result Instruction Code: ACC MI8] 00000 M18] ACC 00001 ACC ACC 2 00010 ALU-A ACC ACC/2 00011 ALU-A ACC ACC M[12] 00100 ALU-A ACC ACC MC14 00101 ALU-A ACC ACC 1 00110 ALU-A ACC ACC MI81 ALU-L. 00111 ACC ACC v M19] 01000 ALU-L ACC ACC XOR M[10] 01001 ALU-L. ACC ACC 01010 PC test1 if z 1 01011 PC test if z 0 01100 PC test3 01101 ACC 01110 is ACC M130? y: z 1 n: Data: 128-255Explanation / Answer
Answer
result: db 0 ; 8bit result
start: loadd cl, 4 ; initialize bit count to four
loadd bl, [multiplicand] ; load multiplicand in bl
loadd dl, [multiplier] ; load multiplier in dl
checkbit: shr dl, 1 ; move right most bit in carry
cmp 0 ;compare acc with mem
jmp skip ; skip addition if bit is zero
add [result], bl ; accumulate result
skip: shl bl, 1 ; shift multiplicand left
load cl;
sub 1 ; decrement bit count
cmp 0
jmp checkbit ; repeat if bits left
loadd ax, 0x4c00 ; terminate program
int 0x21