1 / 10

Computer Science 101

Computer Science 101. How the Assembler Works. Assembly Language Programming. Translation and Loading. Assembler Translates a symbolic assembly language program into machine language Tasks performed Convert symbolic op codes to binary Convert symbolic addresses to binary

malaya
Download Presentation

Computer Science 101

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. Computer Science 101 How the Assembler Works

  2. Assembly Language Programming

  3. Translation and Loading • Assembler • Translates a symbolic assembly language program into machine language • Tasks performed • Convert symbolic op codes to binary • Convert symbolic addresses to binary • Perform the assembler services requested by the pseudo-ops • Put the translated instructions into a file for future use

  4. Translation and Loading (continued) • Op code table • Alphabetized list of all legal assembly language op codes and their binary equivalents • In assembly language: • A symbol is defined when it appears in the label field of an instruction or data pseudo-op • Pass • Process of examining and processing every assembly language instruction in the program, one instruction at a time

  5. Structure of the Opcode Table

  6. Translation and Loading (continued) • First passover source code • Assembler looks at every instruction • Binding • Process of associating a symbolic name with a physical memory address • Primary purposes of the first pass of an assembler • To bind all symbolic names to address values • To enter those bindings into a symbol table

  7. Generating a Symbol Table

  8. Generating a symbol table .begin in x load zero compare x jumpgt endif subtract x store x endif: output x halt x: .data 0 zero: .data 0 .end

  9. Translation and Loading (continued) • Location counter • Variable used to determine the address of a given instruction • Second pass • Assembler translates source program into machine language • After completion of pass 1 and pass 2 • Object file contains the translated machine language object program

  10. Generating machine code Opcode table load 0000 store 0001 clear 0010 add 0011 increment 0100 subtract 0101 decrement 0110 compare 0111 jump 1000 jumpgt 1001 jumpeq 1010 jumplt 1011 jumpneq 1100 in 1101 out 1110 halt 1111 Source program .begin in x load zero compare x jumpgt endif subtract x store x endif: out x halt x: .data 0 zero: .data 0 .end

More Related