data out - in binary ALL BINARY 3"> data out - in binary ALL BINARY 3">

Presentation is loading. Please wait.

Presentation is loading. Please wait.

First part System Utilities Lecture 3 ASSEMBLER Ştefan Stăncescu 1.

Similar presentations


Presentation on theme: "First part System Utilities Lecture 3 ASSEMBLER Ştefan Stăncescu 1."— Presentation transcript:

1 First part System Utilities Lecture 3 ASSEMBLER Ştefan Stăncescu 1

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 2

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 3

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 4

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 5

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

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”). 7

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” 8

9 ASSEMBLER PSEUDOFUNCTIONTHE EFFECT ON OBJECT PROGRAM ASSEMBLED DBDefines the contents of memory byte DWDefines the contents of memory word RESBAssign a save space of memory, in bytes RESWAssign a save space of memory, in words EQUDefines a symbolic name for a constant STARTSets the module name and first address, as the initial reference ENDSets the end program and start address ORGSets a new address as new reference address SECTSets current section 9

10 ASSEMBLER NAME OF DIRECTIVETHE EFFECT ON OBJECT PROGRAM ASSEMBLED BITSets the word length in 8/16/32/64 bits MODELSets the dimensions for the sections address spaces PUBLICSets variables defined for external modules EXTERNSets variables defined in external modules INCLUDEInclude another source program in current program INCLBInclude another binary file in currently object file IF/ENDIFDefining a group of lines conditionally assembled 10

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

12 ASSEMBLER Object format 12 NameNo. crt. byteMeaning field Start (S) 1Field code character “S" 2-9Program Name 10-13Address in memory for first stripe load 14-15Length in bytes for all program code Content (C) 16Field code character "C" 17-18Beginning address of the current paragraph 19-20Current paragraph length 21-148A stripe of object code, H/W executable (128 bytes as example) 149-???Repeating area 17-148 End (E) ???+1Field code character "E" ???+2 – ???+3Address of the first instruction to be executed, start address ???+4EOF, (end of file)

13 ASSEMBLER Data structures of one assembler OPTAB op-codes table R/O table with symbolic names (mnemonics) of microinstructions fixed by the structure of H/W (uP). SYMTAB symbolic names table, R/W table, with attributes of the symbols and names invented by programmer or deducted from solution program, with contentspecific 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 13

14 ASSEMBLER First pass 14

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

16 ASSEMBLER Second pass 16

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


Download ppt "First part System Utilities Lecture 3 ASSEMBLER Ştefan Stăncescu 1."

Similar presentations


Ads by Google