100 likes | 221 Views
Understanding Assembly Code. Assembly Language. An instruction has the following format: LABEL OPCODE OPERANDS COMMENTS. OPCODES AND OPERANDS. Opcodes are reserved words that correspond to machine instructions
E N D
Assembly Language • An instruction has the following format: LABEL OPCODE OPERANDS COMMENTS
OPCODES AND OPERANDS • Opcodes are reserved words that correspond to machine instructions • They’ll be given to you in a table (in the exam) with an explanation as to what they do: eg. ADD, AND, NOT, LD, LDR, etc
OPERANDS –the patient! • Registers – specified by Rn, where n is the number of the register(0-7) • Numbers – indicated by # (decimal) or x(hexadeciamal) (or suffix h –hex) • Label – symbolic name of the memory location (think of it like a goto) • Operands are separated by commas • Number, type, and order correspond to the machine instruction
SPOT THE OPCODES (the doctor) • ADD R1,R1,R3 ADD R1,R1,#3 LD R6,NUMBER BRz LOOP
Labels and Comments • Labels are placed at the beginning of the line • Assigns a symbolic name to the memory location • Example: • LOOP ADD R1,R1,#-1 BRp LOOP
Instruction Set • Data Transfer • Arithmetic Operations • Logical operations • Test and Branch Instructions