1 / 9

Understanding Assembly Code

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

Download Presentation

Understanding Assembly Code

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Understanding Assembly Code

  2. Assembly Language • An instruction has the following format:   LABEL OPCODE OPERANDS COMMENTS

  3. 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

  4. 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

  5. SPOT THE OPCODES (the doctor) • ADD R1,R1,R3 ADD R1,R1,#3 LD R6,NUMBER  BRz LOOP

  6. 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

  7. Instruction Set • Data Transfer • Arithmetic Operations • Logical operations • Test and Branch Instructions

  8. Instruction set

More Related