1 / 17

First part System Utilities

Ştefan Stăncescu. First part System Utilities. Lecture 3 ASSEMBLER. ASSEMBLER. von Neumann architecture : Stored program computer (H/W): CPU(ALU+REG+PC+CPU_CTRL) + MEM + I/O Shared memory <= data + code (program) all in binary CPU(H/W) works only on a dedicated instruction set

marina
Download Presentation

First part System Utilities

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. Ştefan Stăncescu First partSystem Utilities Lecture 3 ASSEMBLER

  2. ASSEMBLER • von Neumann architecture : • Stored program computer (H/W): CPU(ALU+REG+PC+CPU_CTRL) + MEM + I/O • Shared memory <= data + code (program) all in binary • CPU(H/W) works only on a dedicated instruction set • Object program: • list of activities carried out by the CPU and rest of H/W • list of simple CPU instructions, all in binary • => flexibility by creative lists of fixed instructions • => complex activities => complex applications

  3. ASSEMBLER • Flexibility => changing the list of microinstruction - binary • (running different programs on same H / W) • Program object (S/W - in binary) • directly controls the machine (vN) • for a given (complex) application • Application on the vN machine • “code” processes "data" - in binary • in same memory space - in binary • takes data in => data out - in binary • ALL BINARY

  4. ASSEMBLER • The human programmer - creator of useful applications • Originally used binary model (1/0) of vN architecture • for the faithful exact copy of the H/W vN machine • => machine language. • difficult to understand even for simple programs. • For readability, another vN machine model, abstract (MV?) • w/human readable signs: • literal mnemonic for instructions op-codes • alphanumerical identificators (+-*/ operators, :; etc. ) • => assembly language • Between the two languages ​​- bi-univocal correspondence

  5. ASSEMBLER • Source program – solution representation of some problem • draft list of standardized CPU intelligible activities • organized as a list of H/W instructions of the vN machine • A program line format => instruction mnemonic + operands • strongly attached to the H/W structure of vN machine • Assembly language: • mechanism of solutions representation • with mnemonic instructions ("opcode") • with literal representation of H/W circuit activity • human understandable - the first level of abstraction

  6. ASSEMBLER • Assembling a source program to machine language • => automatic operation of passing from • literal representation of mnemonic instructions to • binary representation of instructions • Human intelligibility (literal A-Z a-z 1-9 + / * -., “ etc.). • to machine intelligibility (vN machine - binary - 1/0) • Assembler – S/W system utility that automate assembling • automatically translate - source files => object files • (+ additional means of development - list, sym, etc)

  7. ASSEMBLER • Format type of one line from assembly source file language : • tag: op-code operands ;comment • Essential operation of an assembler: • converting • source file (lines of characters) to • object file (their equivalent binary representation) • Adjacent lines in the source file => • => adjacent bytes in object file • Result of assembly = binary representation of the solution • = vN machine understandable (executable) = • = the "object" file (program in “image memory”) .

  8. ASSEMBLER • The “data” in assembly language • data structures varying in sizes and structure • ex. complex structures - strings, arrays, etc. • Assembler invents for them and for programmer help, • operations that not exist in H/W, called • “pseudo instructions” or “pseudo functions” • as abstract maneuvers, operations that not exist in H/W, • facilities of programming, addressing, etc. called • “directives”

  9. ASSEMBLER

  10. ASSEMBLER

  11. ASSEMBLER • Object files are intermediate products of assemblers • Object file formats are • data structures for machine code loaders • intended to be processed by the link-loaders as • system utilities dedicated for • loading in machine physical memory and for • starting the corresponding process as active • solution from the initial program source • Auxiliary formats and products: list file, symbol list, etc. • for interactive operations as development, debug, test, etc.

  12. ASSEMBLER Object format

  13. ASSEMBLER Data structures of one assembler • OPTABop-codestable • R/O table with symbolic names (mnemonics) of microinstructions fixed by the structure of H/W (uP). • SYMTABsymbolic names table, • R/W table, with attributes of the symbols and names invented by programmer or deducted from solution program, with content specific for each application • determined by the programmer imagination; • table fulfilled before binary conversion by • scanning the source file and • finding the names invented by programmer. • LOCCTR instruction location memory counter

  14. ASSEMBLER First pass

  15. ASSEMBLER Operations performed in the first assembler pass • setting addresses in the memory space of the CPU for all source program instructions using LOCCTR; • setting addresses LOCTTR labels and save them in SYMTAB; • calculation expressions that define symbols; • fulfillment of directives as RESB, RESW, DB, DW; • implementation of the amending directives of the current address in the program with LOCCTR; • grammatical control of the source file in accordance with assembly language grammar used in reporting errors.

  16. ASSEMBLER Second pass

  17. ASSEMBLER Operations performed in the second assembler pass • translate the mnemonic instructions into machine code using OPTAB; • operands calculation in expressions, replacing the symbols with attributes from SYMTAB; • generate data according to directives DB, DW; • execution of other directives; • format the obtained file object as a standard format suitable to linker and loader; • format the listing file with information required for documentation and debugging the program, including addresses, conversions, assembly error codes, etc.

More Related