Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
MARIE Assembly Language Type of Instructions Arithmetic Data Transfer I/O Branch Mnemonic ADD X SUBT X ADDI X Hex Opcode 3 4 B CLEAR LOAD X STORE X INPUT OUTPUT JUMP X SKIPCOND C MAR 2 PC 4 7 5 6 16 0 C 7 15 12 11 10 Opcode 0 Address (or Condition) address 1 3 Add the contents of address X to AC Subtract the contents of address X to AC Add Indirect: Use the value at X as the actual address of the data operand to add to AC Put all zeros in the AC Load the contents of address X into AC Store the contents of AC at address X Input a value from the keyboard into AC Output the value in AC to the display Unconditional branch to X by loading the value of X into PC Skip the next instruction based on the condition, C: C = 00016: skip if AC is negative (b11b10 = 002) C = 40016: skip if the AC = 0 (b11b10 = 012) C = 80016: skip if the AC is positive (b11b10 = 102) Jump-and-Store: Store the PC at address X and jump to X+1 Use the value at X as the address to jump to Terminate the program A 1 2 5 6 9 8 Subroutine JNS X call and return JUMPI X HALT MARIE Instruction Format Description MBR Memory data/instr. ALU 16-bits AC IR InREG OutREG Address 0 1 2 3 2 Input Device Output Device 12 -1 MARIE Assembly Language Example 1: RESULT = X + Y - Z Address Assembly Language Machine Language 0 LOAD X 100516 1 ADD Y 300616 2 SUBT Z 400716 3 STORE RESULT 200816 4 HALT 700016 5 X, DEC 10 000A16 6 Y, DEC 20 001416 7 Z, DEC 5 000516 8 RESULT, DEC 0 000016 MARIE Assembly Language Example 2: Print null terminated string to output HLL: index = 0 while str[index] != 0 do output str[index] end while Address 0 1 2 3 4 5 6 7 8 9 A B C D E F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1 1F Label WHILE, DO, END_WHILE, ONE, INDEX, ADDR, STR_BASE, STR, NULL, Assembly Language CLEAR STORE INDEX LOAD STR_BASE ADD INDEX STORE ADDR CLEAR ADDI ADDR SKIPCOND 400 JUMP DO JUMP END_WHILE OUTPUT LOAD INDEX ADD ONE STORE INDEX JUMP WHILE HALT DEC 1 DEC 0 HEX 0 HEX 14 DEC 72 / H DEC 69 / E DEC 76 / L DEC 76 / L DEC 79 / O DEC 13 /carriage return DEC 87 / W DEC 79 / O DEC 82 / R DEC 76 / L DEC 68 / D DEC 0 / NULL CHAR Machine Language A00016 201116 101316 301116 201216 A00016 B01216 840016 900A16 900A16 600016 100D16 300B16 201116 900216 700016 000116 000016 000016 001416 004816 004516 004C16 004C16 004F16 000D16 005716 004F16 005216 004C16 004416 000016