Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
69 views
25 pages
SPCC Question Bank
hhh
Uploaded by
niteshvishe40
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save Spcc question bank For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
69 views
25 pages
SPCC Question Bank
hhh
Uploaded by
niteshvishe40
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save Spcc question bank For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save Spcc question bank For Later
You are on page 1
/ 25
Search
Fullscreen
Source, Prograny Analysis Phase Synthesis Target Phase Program SYMBOL ADDRESS N SYMBOL TABLE 2.6.1 : Two Phases of an Assembler used by the Vai .7 Two Pass Assembler Design —> DATA ACCESS Constructed during Analysis Phase ---» CONTROL TRANSFER and used during Synthesis phase Fig. us Passes MU - May 14, May 15, Dec. 15, May 16, Dec. 16, Dec. 17, Maj 19, Dec. 19 Q. What are advantages of assemblers with multiple passes ? How many passes should be there in a typical cor mpiler ? p (May 14, 5 Marks) State the reason for the assembler to be a multi pass program. (May 15, 5 Marks) 9 With reference to assembler explain the following tables (i) POT (i) MOT (iii) ST (vy LT suitable examples : (Dec. 15, May 16, May 19, 10 Marks) PP Tektassteaye360 / 370 processor. The advantages OF 0) a th example. ign. Explain wit ih sembier deel (ee, @. What are various databases used in wo or art and databases: (May @ 2 embler detail. 0 Q. Explain the design of two pass 455% and explain in (Dec. 19, 19), "y design ©. Draw flowchart ofa Pass! of wo assembler ee Many 850 0 Q. Expl with flowchart design of two pass 4 py assembler. Examples of the tw ass assemblers pass is used BY le pass assembler are as follows eh nf re than one F two pass 25: A two pass assembler means mor semble over 5 dd reference problem. ion of symbols. initi ass assembler to process the defi It is used to eliminate forwar’ Numbers of passes are created in multi P Multi pass assembler does the work in two Pass First Pass : © Scans the code. © Validate the tokens, © Create Symbol Table. Second Pass © Solves forward reference problem. © Converts the code to the machine code. jow mentioned is the detail of task accomplish {A two pass assembler does two passes over the source file. Bel yeaa ‘each pass. The forward reference problem is solved by making two passes over the assembly code, ass1 lt looks for label definition and introduces them into the symbol table. It defines the symbols and literal, {a) It keeps the track of location counter (LC) (b) Determines the length of machine instructions (MOT). (c)__ Itkeeps the track of the values of symbols until pass 2 is done (ST) (d) Process some pseudo-opcode e.g. EQU, DS DC (POT). {e) _Itstores the literals (LT). Pass 2 : After the symbol table is completed in PASS 1 it does the actual a: i i sssembly by translating th 1 on. The purpose of PASS 2 is to generate object code. " eine open (a) It looks up the values of symbols (ST). (b) It generates the instructions (MOT). (c)__ It generates the data (For DS, DC and Literals), (d) Process some pseudo-opcodes e.g. USING, DROP (POT). oot —[nssi} [meas] sve ‘Symbol table een Machine operation eration table Pseudo Op code table 2.7.1 A Simple two Pass Assembler FORMAT of DATABASES : In this we specify the fo ‘his we specify the format and content of each of the PASS: data bases used in the PASS? used int 7 Machine Opcode Table (MOT) MOT is a fixed length table ie. the conte Le. nts of these tabl les are notTable 2. ‘hino-Op Table (MOT) for pass 1 and pass 2 + 6-bytes per entry Mnemonic op-code | Binaryop-code | Instruction _| instruction _| Not used in (4-bytes) (a-byte) length(2-bits) | format(3-bits) | this design (characters) (hexadecimal) | (binary) (binary) (3-bits) “abbb” SA 10 01 “AHbb” an 10 001 “albb” Se 10 001 “ALRb” ae on 00 “ARbb” aA o1 00 “MVCb” D2 a1 100 brrepresents the character “blank” RR ~ Register to Register RX — Register and Indexed Storage Operation RS ~ Register and Storage Operation SI Storage and Immediate Operation SS— Operation using all implied operand and storage codes Instruction length Instruction format 01 = 1Half-Words = 2 bytes 000 = 10 2 Half-Word: bytes 001 = 11 = 3 Half-Words bytes 010 011 = 100 Pseudo Opcode Table (POT) POT is fixed length table i.e. the contents of these tables are not filled in or altered during the assembly process. Table 2.7.2 : Pseudo-Op Table (POT) for pass 1 (similar table for pass 2) << bytes per entry, ——____________» Pseudo-Opcode Address of routine (Sbytes) to process Pseudo-Opcode (character) (3-bytes = 24 bit address) “DROPb” P1DROP “ENDbb” PIEND “eQubb” P1equ “START” PISTART “USING” PLUSING tL These are presumably P1—PASS1. lables of routines in pass 1; the table will actually contains the physical addresses.1] System Pi ‘Symbol Table (ST) Tapio 2.7.3: Symbol <—_—_———— 1 (8-bytes) (characters) “JOHNDDDD” “FOURbbbb” “Fivepbbb” “TEMPbbbb” & Compilor Const (MU) (4-bytes) symbol Table includes for each entry (i) Name of the symbol (ii) Symbols assembly time value (iil) Length (in bytes) and (iv) Relative Location indicator (R/A) ‘Operand can be either immediate (typically one byte values c data located elsewhere (Relative/Absolute value) R- Relative value A- Absolute value Literal Table (LT) Literal is equivalent to d hash table, using literal name or value as the key. Literal Table includes for each entry (i) Name of the literal i) (iii) Length (in bytes) and (iv) Relative Location Indicator (R/A) Literal assembly time value (hexadecimal) Tavle (ST) for pass 1 and pase 2 yytes per entry —_—————, Length Relocation (a-bytes) (a-byte) (character) (hexadecimal) lefine a constant explicitly and assign an address label for it literal table is often ‘oded in the instruction itself/Jor the addresses of the organized asa (The format is same as that of symbol Table - with required changes) based on the definition of the Literal table. Name of Literal (1-byte) Value of Literal (4-byte) Length of Literal (1-byte) (1-byte) Relative Location Indicator l | 3ase Table (BT) It is used by the asser YY mbler to generate the proper base register reference in machine instructions and its correct fsets. Se Teananatelst[—~ | Data Constant ASSEMBLER] SET Fi mbler functions 234(A) Assembler Directives Tea (Dee. 19, § Marka) | Assembler directives are pseudo-instructions; th slated ; ; they provide instructions to th into machine operation codes. It helps us to do tothe following tasks et Naat an ae not ra Dx exelain ditferent assembler directives with examplo. _ Assemble code and data into specified sections = Reserve space in memory for uninitialized variables Control the appearance of listings © Initialize memory © Assemble conditional blocks © Define global variables © Specify libraries from which the assembler can obtain macros © Examine symbolic debugging information 2.4 Assembly Scheme The steps that should be followed by the programmer for designing of an assembler are mentioned as following : Specify the problem to identify the information necessary to perform a task. Design a suitable data structure to record and store the information. Determine the process necessary to obtain and maintain the information. Specify the algorithm. Determine the process necessary to perform the task. ‘At last the programmer should look for the modularity of the program (ie. program to be subdivided in independent programming units). It helps all the modules to be tested and deployed separately. Basic steps required in designing the modular system are as ~ Modules created should be opaque to the rest of the system and initialized through a well-known interface. ~ Modules should not directly reference with one another or the application that loaded them. ~ Modules should not communicate directly they should use loosely coupled techniques, such as shared services, ‘communicate with the application or with other modules. ~ Modules are not responsible for managing their dependencies. Modules should not rely on static methods that can inhibit testability. The mentioned basic steps are also used for the design of the loader, and complier.‘Inte i joduction, Macro definition and call, Features of Macro facility : Simple, parameteniz°“" Nested. Design of single pass macro processor, data structures used u 3.1 Introduction A macro processor helps us to define and use macros in an assembly level language. During macro definition a group of statements is provided that we want to associate with a macro name. The assembler replaces the macro name with the statements specified in the macro definition. Macros provide several advantages when writing assembly programs. — The frequent use of macros can reduce the programmer-induced errors. A macro allows us to define an instruction sequences that are used repetitively throughout the program. This reduces the likelihood of errors introduced in repetitive programming sequences. — The scope of symbols used in macro is limited, = Macros are well suited for creating simple code tables — Macros make an assembly program more readable, The assembly language programmer often finds necessary to repeat some blocks of code many times. The block may consist of series of operation like addition, subtraction etc. again and again. In this situation the programmer will find macro instruction facility very helpful and useful. Macro Definition and Call ‘a macro be used in a program ? (5 Marks) (2 Marks) Explain when will Q. Define macro. @. Explain macro and macro expansion. (May 19, 5 Marks) macto expansion. (Dec. 19, 5 Marks) pbc eee rere Explain with example conditional Macro (meaning “tarée” % block of code which has been V8 name is invoked it is replact’ compiler by the contents of fe meaning for group of, statements notational convenience fF instruction replaces a macro Wi, whenever they are called: This act! is called expansion of macro® c in complied languages ™ sion happens at ro-exPan allow the instruction’ program, i ° comple time, Thus MBO pasion OF OA by the programmer to write 2 SHOT, pe handle pnd leave the mecharical deta macro processor. either automate = The purpose of macros oa more powertl r frequently used sequences © abstraction. son of te xtensio! = Macro processors afe viewed as ane) basic assembler algorithm re not directly related with the which it is run. s, operating system = Macro processors @ architecture of the computer = this used with high level language ‘command languages: with the — Macro replaces each — instru corresponding group of statements. For €.6. — sic requires @ sequence of instructions to save the contents of all registers. This can be done by writing ‘one macro like save registers etc. 3.2.1 Functions of MACRO Instructions ‘The macro processor is used to (1) Identify the macro definition, (2) Save tte macro definition, (3) Identify the macro calls, (4) Expaté the macro calls.3.2.2 Example of Macro Instruction a [@. Explain macro caiis within macro giving example, nen nition within a MAC pa Q. Explain the concept of macro definition w Sea The re eer Te «i expansion of macros start of definition A macro instruction is an abbreviation for a sequence & instruction with a group of source language statements. This is calle MACRO) J macro named ~ Sequence of operation (Assembly Language) End of definition Pseudo-operation [>_meno as 1. Copy Cod xample Macro defined | macro Macro Name +—— | xyz Loon oF A 4 Dt J st 1, TEMP ‘Assembly Instructions Pseudo-op Fig. 3.2.5 : Copy code - example The statements of expansion are generated each time the macro is invoked. 2. Example for Parameter Substitution Source Expanded source MACRO XYZ &D1 t 1 &D1 L 2 aol L 3, BDL mn) t 1, REcoRD1 L 2, RECoRDL INCR RECORD1 L 3, RECORD INCR RECORD2 L 4, RECORD2 L 2, REcoro2 DATA =DS-_—F' 0 L 3, RECoRD2 DATA2 0C_— FSO DATA1 —S_F’40" DATA2 DC F’50" Fig, 3.2.6: MACRO XYZ has singlo argumont arfunction Calls a process at the execution time. es ees EE RES MANSON TIME SS ee Sek PFOBFaMs. Subroutines can take any amount of parameters. Subroutines are ‘expanded’ at runtime 3.7 Difference between Procedure Calls and Macro Calls . Explain difference between : Procedure calls and macro calls. (10 Marke) ‘Sr. No. Procedure Calls Macro Calis ~ A procedure call or subroutine (function, procedure, or subprogram) or a sequence of code which performs a specific task, as part of a larger program that is grouped as one or more statement blocks with the typical intention of doing one thing ws ea) A macro is a group of repetitive instructions in a program which are codified only once and can be used as many time as necessary. In procedure the passage of parameters is not possible. In macro the passage of parameters is possible. Procedure is an extension of a determined program. Macro is a module with specific functions which can be used by different programs. To call a procedure the use of a directive is required. The call of macros is done as if it were an assembler instruction.Macros & Macro Proge Macro Calls CALL Name Of the Procedure, Th i @ part Which Make a Procedure are 5 Declaration Of the Procedure Code of the Procedure Return directive Termination of the Procedure Example of Procedure ¢ Adding ProcNear ; //Declaration of the procedure Mov Bx, 0; //Content of the Procedure Mov B1, Ah Mov Ah, 00 Add Bx, Ax Ret ; //Return Add Endp; //End of procedure declaration irective Syntax of Macro : Declaration of the macro Code of the macro Macro termination directive The declaration of the macro is done the fo! lowing way: Name Macro MACRO [parameter 1, parameter Example of Macro Call ; Position MACRO // Macro name PUSH AX PUSH BX PUSH Dx MOV AH, 02H MEND // End of Marcosystem Prog. & Compllor Const, (Mu) Z Yacioy b Macro Procesen Let us call this macro with DEFINE SIGN ‘Anew macro call is created by SIGN ARG and the generated calling sequence by macro processor Als. BAL 3,%410 oc ‘A(ARG) L 20, = v (SIGN) BALR 19,20 3.4_ Implementation of Macro Processors {Explain the working of a macro processor with neat flow charts and databases. (May 14, 10 Marke) The four basic steps that any macro processor should perform are as : 1, Recognize Macro Definitions Proper match of all the nested and recursive macro calls should be done and macro processor should identify macro definitions given by op-codes MACRO and MEND. 2. Save the Definitions To expand the macro calls and substituting the expanding source code a macro processor should store the macro definitions. 3, Recognize Calls ‘The processor should recognize all the macro calls that appear as mnemonic op-codes. In this all the macro calls are identified from various mnemonic op-codes. 4, Expand Calls and Substitute Arguments. Macro definition arguments are replaced by the corresponding macro calls. In this macro processor has to take a different decision like : Able to identify dummy arguments in macro definition, Syntax and semantics of all the allowed arguments, 3.5 Design of Two Pa: _Processors MACRO The name two pass cro processor explains that the TO processor algorithin uses two systematic sans oF passes aver the Input source code. All macro definitions are processed during the first ass, It will save all the macro definitions in a Macro Definition Table (MOT) and prepares a Macro Name ble (MINT). All macro invocation statements are expanded during, the second pass. In this pass it will check all the mnemonic pseudo-opcodes and substitute each macro name with appropriate code from definitions. the macro Format of Databases. 1. Argument List Array (ALA) ALA is used in both pass 1 and 2. Dummy arguments are substituted with the positional Indicators in ALA during pass 1. Also the dummy arguments on the memory are represented by . Where if is used by the macros. For example consider the Fig. 3.5.1, The store macro defi Cy Loop1 &STRG BAL, BA2, BAR D348 Ex . 2, #2 D 4a MeND Fig. 3.5.1 : MACRO DEFINITION TABLE FOR PASS 1 — The index markers # are replaced with macro call arguments in PASS2. LOOP1 LAB DATA1,DATA2, DATA3 Generated ALA is Wy rater7 stem Prog. & Compiler Const. (MU) 4-5 9.1 Difference between Linker and Loader allocate space Eee Q. Explain difference between : Linker and Loaders. | (10 Marks)| | 2. Linking : It wastage of me! ooo ; ] 7 object progra' Linkers | Loaders | between obj | ae ; _ | information ni A Linker or link editor is a| Loader is a program that] nen ene m. computer program that) loads machine codes of al | takes one or more object| program into the system 3. Relocation : | files generated by | memory. it can be Ic compiler and combines) | the location them into a__ single address depe! executable file, library file, | le, Merery | 4. Loading : or another object file. | A q | instructions execution. Linker is a part of a library} Loader is a part of an} | files. | operating system. 4.4 Relocatic Linker performs the linking) Loader loads the progrem | for the execution. | Computer pr or modules all controlled or cot such cases these by means of sym kinds of symbols : (i) Public (2) Exterr (3) _ Local operations. It also links the user defined) Loading a program| the _ user| involves reading the’ contents of executable file} into memory G) 4% Functions of Loader Q. What are the different functions of loader explain in banen (Dec. 14, Dec. 19, 5 Marks) | 1 Publicly 4 functions to defined libraries.Const_ (MU) Difference between Linker and Loader Linker and Loaders, (10 Marks) Linkors Loaders Jia uinker oF link editor is a computer program that takes one or more object |flos generated by a | compiler and combines| “them into a single executable file, library fie, or another object file. Loader is a program that} loads machine codes of a| program into the system| memory. [tinker is @ part of a library | es. Loader is a part of an! operating system. | Linker performs the linking Loader loads the program| operations. for the execution. Lo | It also links the user defined] Loading a __program| [functions to the user] involves reading the vy | defined braries. contents of executable file | into memory @. Explain Functions of loader. Q, Explain relocation. (@) 4.3” Functions of Loader Y ' Q. What are the different functions of loader explain in brief 2 (Dec. 14, Dec. 19, 5 Marks) (May 15, 5 Marks) (2 Marks) ~The fundamental task of a loader is to (©. bringing an object progr © starting its execution ~ An object program contains data from the source program. ‘am into memory and translated instructions and It also. specifies addresses in memory where these items are to be loaded. To execute a program a loader performs the following four functions 1, Allocation : It is used to for the object _progra allocate space in memory ms._Translators cannot Loaders and Lint allocate space since overlap may occur or large wastage of memory takes place. 2. Unking : it combines two or more separate object programs and resolve symbolic references between object decks. It also supplies the information needed to allow to reference between them, Relocation : It modifies the object program so that it can be loaded at an address different from the location originally specified and adjusts all address dependent location. 4. Loading : Physically it places the machine instructions and data into the memory for the execution. 4.4 Relocation and Linking Concept Computer programs comprises of several fragments ‘or modules all these fragments are need not be controlled or contained within a single object file. In such cases these modules are referred to each other by means of symbols. Typically, an object file has three kinds of symbols : Publicly defined symbols Externally defined symbols Local symbols a (2) (3) Publicly defined symbols : These symbols are allowed to be called by other modules, also called as public definition. 2. Externally defined symbols : These are also known as undefined symbols or external references. They call the other modules where these symbols are defined. 3. Local symbols : It is used internally within the object file to facilitate relocation. = In addition to combining modules, a linker also replaces symbolic addresses with real addresses. Therefore, we may need to link a program even if it contains only one modulehelp of Linker and finally ste Systom Prog. & Compilor Const, (MU 4-3 (Paz Linking vs. Loading Bizis Manas Dabea Loaders, To a Program @. Loading and linking scheme. (5 Marks) Q. Define Loader. (Dec. 19, 2 Marks) Execution of program written in a language L performs the following steps 1. Program translation. 2. Linking of the program with other programs needed > for the execution. 3. Relocation of the program to execute from the / specific memory area allocated to it. 4. Loading of the program in the main memory for the Det Bow LL execution. a=+-% Control flow — For performing these steps we need different language processors. Step 1 is performed using Fig. 4.2.1 : General Lang Language Translators, step 2 and 3 is done with the Loader Q. Define Loader. A loader is a program which accepts the various object loading them into the main memory for execution. — PROG 1 PROG 2 PROG 3 program decks, and prepares t LOADERstem Prog. & Compiler Con: (wu) 47 In this program, the ASSUME statement is used to declare segment register CS and DS for memory addressing. reference to A is assembled as a displacement of 196 from the content of the CS register in statement 16, This avoids the use of an absolute address. Linking requirement Linking is required by all subprogram calls Programs written in PASCAL are typically nested inside the main program, hence procedure references do not require linking. Object module Object module is a sequence of object records, each object record describing specific aspects of the program. The object module contains the following basic information. (a) Binary image (2) External references (3) Public definitions (a) Debugging information (5) Miscellaneous information Fach object record contains variable length information. Different Types of Loaders @. Explain in brief various types of loader with their advantages and disadvantages. (10 Marks) Explain different types of loaders in detail (May 19, 10 Marks) a. The various type of loaders are as follows Compile and Go Assembler / Compile and Go Loader Absolute Loader Relocating Loader Direct Linking Loader Dynamic Loading Loader Dynamic Linking Loader These loaders primarily differ in the manner in which the four basic functions are accomplished. Loadors and Linkers 4.5.1. Compile and Go Loader ‘Acompile and go loader is one in which the assembler itself does the processes of compiling then place the assembled instruction in the designated memory locations. The assembly process Is first executed and then the assembler causes a transfer to the first instruction of the Program. Advantages Simple to implement. No extra procedures are involved. Disadvantages Wastage of memory. It retranslates the user’s program code every time it is executed. When the source code is in different program is in different languages it is hard to handle multiple LL, Program loaded into memory segments. ‘Assembler MEMORY ssemble and Go Loader Fig. 4.5. 4.5.1(A) General Loading Scheme Loader is a utility program that accepts the object code and load them into the main memory for the execution. Loader involves the storage management function of operating systems and is usually performed later than compilation. In loader scheme, the source program is converted to object program by some translator (assembler). The loader accepts these object modules and puts machine instruction and data in an executable form at their assigned memory. The loader occupies some portion of main memory. Load time refers to the period of loading the program in memory and preparing abject program for execution. SF atestlon} (PASS 3) z= (PASS 4) juage »mpiler ipiler that 3(AST) of a as a wide ivailability id instead ion some tresult of various passes, each pass will forward its output to the next Pass as it will act as the input for further processing for other passes. 5.5 Phases of Compiler a Lar are the different phases of Compiler? (Dec. 15, May 16, 5 Marks) Q. Explain different phases of compiler with suitable examples. (Dec. 17, 10 Marks) Q. Explain different phases of compiler in details. (10 Marks) — A Compiler operates in various phases, each of which transforms the source program from one representation to another. A phase is an independent task in the compilation process which transforms the source program from one representation to another. — The fundamental language processing model for compilation consists of two steps for processing of a source program. o Analysis of Source Program ° Synthesis of Source Program Phases of Compiler —_—____, Synthesis Phase It constructs an equivalent target program from the intermediate representation. Obtained from the synthesis phase consists ofACK ENO \OET OFPENDENT "dove O=TMZER [ae [REGISTER ALLOCATION NO PARSER MIDOLE € a BYNTAX Frarget ndopnnden ingsertiy Tae I. code opimzer aaa OP EOE [sewanc avav (CODE OPTIMIZER, ‘SYNTAX TREE | “IwTERMEDIATE INSTRUCTION ieee CODE SELECTION acombly GENERATOR él INTERMEDIATE REPRESENTATION rece k ASSEMBLER, cote) Trares LIM ott coae ‘Assembly Fig. 5.5.1 : Compiler Design Overview Compiler phases are divided into two parts : Front end includes all the analysis phases and the intermediate code generator. it evaluates the source program, Produces the intermediate code. Back end includes the code optimization phase and final code Beneration phase. Back end synthesizes the tar Program from the intermediate code and produces the executable code for execution, FI9. 6.5.2: Phases of the Compilerr Microsoft's cept in the 3 systems. nsion DLL, ntrols), or c linker is - operating | a process | result of When an ng system ker from it this other X and iOS Jed shared e filename the bundle Disadvantage (1) Considerable overhead and complexity incurved, due to the fact that we have postponed most of the binding process until execution time. Difference between Dynamic Loading ar and Dynamic Linking Q. What is the difference between Dynamic Loading and Dynamic Linking explain with an example? (May 16, 10 Marks) Sr. No Dynamic Loading Dynamic Linking It refers to mapping (or less often copying) an executable or library into a process's memory after is has started. Dynamic linking refers to resolving symbols - associating their names with addresses or offsets - after compile time. It is similar to plugins exe can execute that is an actually before the loading happens. dynamic The linker while creating the exe does minimal work. For the dynamic linker to work it actually has to load the libraries. eer SE _systom Prog. & Compilor Const. (MU) See Sr. Dynamic Loading No 3. | Dynamic loading is concerned with loading the Subroutines of a Program as and when required during run- time, instead of loading all the subroutines at once before the program execution starts, Dynamic Linking Dynamic linking — is concerned with linking library routines at run- time instead of combining them with the executable program code before the program execution starts i.e. static linking. To achieve this, a small code call ‘stub’ is inserted in the program code wherever library routine is required. The stub contains information about where to find the routine if it is not already in the main memory. 4. | Efficient use of memory. Efficient use of memory. 5. | It does not require special support from Operating system; it is the responsibility of the programmer to check whether the routine that is to be loaded does not exist Dynamic Linking requires special support from operating system, the — routine loaded through dynamic linking can be shared across various processes. in main memory. Review Questions at What is difference between loader and linker ? Give Q.2 What Is loado loader. Explain tho dif Diftorentiato loader starting particular loadi Explain tho rolc Describe the v Explain in detail What is Bootstré Explain Dynami of example. At what point j loading schemes a. BSS Loader ®. Direct Linkin, c. Absolute Loa Explain the Com give its advantage What is loader 2 & its components in Explain the design Write a short note linking. Explain the dj Explain they do not tks both with the time in 1 will be function on has a ared to Inctions but the n time subroutine does not. A function should not change the values of the actual arguments whereas a subroutine changes the values of the actual arguments. 3. Difference between Macro and Subroutine Pe Q. How is macro different from subroutine? (5 Marks) Macro - Macros can only be used in the program they are defined in and only after the definition. = Macros can take max 9 parameters. a Macros are expanded at compilation / generation. Subroutine — Subroutines (FORM) can be called from both the program they are defined in and other programs. — Subroutines can take any amount of parameters. — Subroutines are 'expanded' at runtime alls and Macro Calls id macro calls. (10 Marks) |, procedure, Macro Calls ¥ A macro is a group of repetitive instructions in a code which | program which are codified only once and can be@. Ewan ono pass assembler with flowchart and respective databasos, (Dec. 14, 10 Marks) a. Eqiain with suitable flow chat working of singlo pass assembler, (10 Marks) Explain tho working of single pass assomblos. Show the structure of its databasas used. (10 Marks) ttis also known as the Single Pass Assembler for the Intel 8086 oF x86 / 8088 processor used in IBM PC. in single pass assembler the assembler passes over the source exactly once and converts equivalent machine code of the whole program at one time. Due to this it requires less time but more memory space as it has a single chance to convert the program. 0 @ Problem faced by Single Pass Assembler Forward reference : It occurs when a symbol is used before itis declared. Difficulty in determining the length of the branch instruction : If there is a forward reference for a branch instruction like “JUMP NEXT” where “NEXT” could be within 128 bytes from the instruction or more. Thus the length of the instruction depends on the location of “NEXT”. e) (ll) Solution for the above problem (a) The forward reference problem can be solved by using the FORWARD REFERENCE TABLE. It requires that all areas must be defined before they are referenced, It is possible, although inconvenient, to do so for data items. Forward JUMP to instruction items cannot be easily eliminated. (o) () (a) ~ Insert (label, address-to-be modified) to SYMTAB ~ Usually address-to-be-modified is stored in a linked list Forward Reference Table in one-pass assembler : fi) (e) Removes the operand address if the symbol is not defined (il) Undefined symbol is entered into SYMTAB and marked as not defined. The address of the operand Is added to the forward references es associated — with SYMTAB entry. we (iv) As soon a8 the definition for the symbol is found, scans the reference list and Inserts the addresses, () At the end reports the error I there are still SYMTAB entries. indicating undefined symbols, (ill) Two types of One Pass Assombior There are mainly two types of single-pass assembler 1) _ First type produces object cade directly in memory for Immediate execution e.g. LOAD AND GO ASSEMLBER, In this type of assembler no object program Is written Out, no loader is needed. It is useful in a system with frequent program development and testing. In this rogram are re-assembled nearly every time they are executed in load and go assembler forward references became less difficult because the object program is produced in memory rather than being written out on secondary storage. 2) The second type produces the usual kind of object program for later execution E.g. X86, 8088 Assembler, MASM Assembler. (IV) Single Pass Assembler (Intel x86 Assembler) 1) Memory and Registers {a) The basic units of memory are as follows : Units of memory | Bytes | Length in bits Byte 1 8 Word 2 16 Double word 4 32 Quadra word 8 64 Tetra word 10 80 (b) The architecture supports a stack for storing subroutine address as, parameters and other data. (c) Two stack pointer registers called SP (Stack pointer) and BP (Base Pointer) are provided to address the stack, a {d) The index registers SI and DI are used to index the source and destination addresses. wieition to System Software : ram and system programming; 44 Concept of System Software computer instructions or data is anything that can ne sored electrically is software. The storage devices and goplay devices are hardware. ‘he distinction between software and hardware is conetimes confusing because they are so integrally linked. gaiem programs (e.g. compilers, loaders, macro processors and operating systems) were developed to pene computers better adapted to the needs of their users. computer system divides the system software's into three major categories: System Software Programming Software Application Software 4.1.1 System Software ) @._ Define system programming, MU=Dec. 14; Dec.17, (Dec. 14, 5 Marks) (Dec. 17, 2 Marks) tt consists of a variety of programs that supports the operation of 2 computer. System software or system program is 3 computer program that provides the infrastructure over which programs can operate, This software makes it possible for the users to focus on an application or other problems to be solved, without needing to know the details of how machine works interaly, System software 1s the combination of the following - Device Drivers — Operating Systems - Utilities = Windowing System. ~ Servers Concept of System Software, Introd sor, Loader. Linker, Compiler, Inte aa watous systom programs such as Assembler, |process0" "preter, Device Drivers, Operating system, Editors, Debuggers. Goals of system softwares, system Macro Interface A Intorface 8 Human s) LJ Systom boing Sottwara [#—*} Hardware vial Actual Machina mc Intertaco| Intortaco Fig. 1.1.1 : The Role of System Software 13a Programming Software It usually provides tools to assist a programmer in writing computer programs, and software using different programming languages. The programming software tool includes = Compilers — Debuggers - Interpreters = Linkers Text Editors ‘An Integrated Development Environment (IDE) is 2 single application that attempts to manage all these functions, 1.1.3 Application Software (Dec. 14, 5 Marks) pat is application software? ‘Application Software is any tool that functions and is operated by means of a computer and allow end users to accomplish one or more specific (not directly computer development related) tasks. Typically application software includes : Office Suites (e.g. : Microsoft = Industrial - Automation office) = Business = Computer Games Software's@) 5 Editor > Macroprocessor —+ Assembler — tinker pat Assemblers, te assemblers functions, ‘an assembler creates object code by translatin; ynbanicnames for memory locations and other entities. In other words we cai ~~ ssw wun geveroping program upto its execution are as : Compiler — Loader Developing—-—> Execution (5 Marks) ass i 18 assembly instructions mnemonics into op-codes, and by resolving n say that an assem! bier is a program that accepts input as assembly language program and iain its machine language equivalent code along with information for the loader. An assembler isa translator ofa simple fe. Fig. 1.4.1 shows the basic function of a ‘gu n assembler and a Fig, 1.4.2 shows program translation using assembler. Assombly Language Program ¥ }—4 Databasos ASSEMBLER Machine equivalent code and other information for loader Fig, 1.4.1 : Function of an assembler Source Code Target code TiCompute Sum = 1 +... 100 00[100010011 10010011100100101 | (The target code 101 | 000111001100100100011 100104 'n form of o1| sum=0 ‘machine instructions) Loop: 7 > 2] iti= 101 GOTO END TRANSLATO! 03] sum = sum +1 oafizie 05] GOTO Loop See END, 06] GOTO END 108] 1000111011001001000100101 Fig. 1.4.2: Program Translation using Assemblers 1.4.1(A) Different Types of Assemblers There are three types of assemblers 1, Single Pass Assembler : It requires a single pass to assemble the program into machine code. 2. Two Pass Assembler : It requires two passes to convert the assembly language program into machine equivalent code. 3. Multipass Assembler : It may require single or @ multiple passes as per the requirement of the assembly language. Example of ASSEMBLERS, SPARC ASSEMBLERS, MASM ASSEMBLERS, MIPS ASSEMBLERS etc. Loaders ‘examples. @. What is Loader ? Explain functions of loader with (Dec. 16, May 19, 10 Marks) Loading of the program in the memory for the purpose of execution is done by the loader. A loader is 2 program that accepts the object program and prepares these programs for execution by loading them into the memory. SF raealst2, fla — Relocating Loader ~ Direct Linking Loader — — Dynamic Linking loader. inkers 1.4 What are different functions of linkers? (5 Marks) Qa A linker or a link editor is a program et tates one jects generated by a compiler or assemblers and eee fe into a_ single executable program. Retention an linking ofall object modules is done by linker. tid] Fig. 1.4.5 : An illustration of the linking process (object files and static libraries are assembled into a new library or executable program) E.g. In IBM mainframe environments such as OS/360 this program is known as linkage editor, and MS-DOS LINKER for Intel 8088/8086 Processors, / When a program comprise of multiple object files, the linker combines these files into a unified executable Program.ry // This will expand to Volume = ((atb)* (atb)* (atb)); \KER MAS Compilers Q. What are different functions of compilers ? (5 Marks) Processors —_ (5 Marks) A compiler is a computer program that transforms source code written in a computer language (the source !. A macro is a language) into another language (target languages often ame. Whenever | having a binary form known as object code), The most interpreter or 7 common reasons for having tr: is he purpose of I ig transform source code is to rn id sequences or | Create an executable program. A compiler translates a program written in high level language to generate assembly code or relocatable macro name) machine code (object code) Fig. 1.4.8 shows the language Processing model using compilation. uage Source Program COMPILER Error Message :ro’s Target Assembly Program ‘e_ single-line OO re ASSEMBLER Relocatable Machine Code Meech “ Linker/Loader| Executable Machine Code Fig. 1.4.8 : Language processing model using compilation Source Target os is a simple Program pOMPILeT Program mbolic names o 1, ddefine Error Warnings ‘ Messages token list>) Fig. 1.4.9 : Compiler Input-Output WE TechKnowledgeTarget Code Generation Optimized Target Code Code Optimization Fig. 1.4.10 : Phases of compiler 1.46 Interpreters (5 Mark Q. What is function of an interpreter ? — An interpreters translates high level instructions into an intermediate form. An interpreter may be program t either. — Executes the source code directly. ient intermediate representation and executes them. — Translates source code into some effi - E.g. of Interpreter is LISP, BASIC etc. we Tech
You might also like
System Programming Notes
PDF
100% (3)
System Programming Notes
110 pages
Assembler
PDF
100% (1)
Assembler
49 pages
10.design of Two Pass Assembler
PDF
No ratings yet
10.design of Two Pass Assembler
21 pages
System Programming and Compiler Construction Techknowledge Book PDF
PDF
No ratings yet
System Programming and Compiler Construction Techknowledge Book PDF
247 pages
Assembler
PDF
100% (2)
Assembler
26 pages
Assembler Tables
PDF
0% (1)
Assembler Tables
28 pages
Chapter 2 Assembler
PDF
100% (2)
Chapter 2 Assembler
44 pages
Chapter2 2
PDF
No ratings yet
Chapter2 2
107 pages
Module-1-System Software and Machine Architecture
PDF
No ratings yet
Module-1-System Software and Machine Architecture
101 pages
Assembler 1
PDF
No ratings yet
Assembler 1
45 pages
Assemblers: Source Program Assembler Object Code Executable Code
PDF
No ratings yet
Assemblers: Source Program Assembler Object Code Executable Code
108 pages
2nd Chapter Assemblers
PDF
No ratings yet
2nd Chapter Assemblers
61 pages
Module 2 - Assemblers & Macro Processor
PDF
No ratings yet
Module 2 - Assemblers & Macro Processor
45 pages
18BCS47S U2
PDF
No ratings yet
18BCS47S U2
118 pages
Module2 Assembler
PDF
No ratings yet
Module2 Assembler
28 pages
MODULE2 - Features, Statements and Forwrd Reference Prob
PDF
No ratings yet
MODULE2 - Features, Statements and Forwrd Reference Prob
43 pages
SLIDES - ICT444!1!17 (Compatibility Mode)
PDF
No ratings yet
SLIDES - ICT444!1!17 (Compatibility Mode)
17 pages
ASSembler
PDF
No ratings yet
ASSembler
22 pages
Assembly
PDF
No ratings yet
Assembly
60 pages
Spos-Viva Questions With Sol
PDF
No ratings yet
Spos-Viva Questions With Sol
18 pages
Unit-1 PCD
PDF
No ratings yet
Unit-1 PCD
9 pages
Two Pass Assembler
PDF
No ratings yet
Two Pass Assembler
6 pages
A Simple Two-Pass Assembler
PDF
No ratings yet
A Simple Two-Pass Assembler
99 pages
Subject-System Programming Sub. Code-2150708 Unit-3 (Assemblers) by - Prof. Deepmala Sharma
PDF
No ratings yet
Subject-System Programming Sub. Code-2150708 Unit-3 (Assemblers) by - Prof. Deepmala Sharma
52 pages
Chapter Two - Assembler
PDF
No ratings yet
Chapter Two - Assembler
21 pages
Wa0030 PDF
PDF
No ratings yet
Wa0030 PDF
6 pages
SPCC - 2
PDF
No ratings yet
SPCC - 2
14 pages
System Prog - Assembler Notes
PDF
No ratings yet
System Prog - Assembler Notes
19 pages
Unit 3
PDF
No ratings yet
Unit 3
38 pages
Wa0000.
PDF
No ratings yet
Wa0000.
64 pages
Sleek ECE 445 Assignment
PDF
No ratings yet
Sleek ECE 445 Assignment
9 pages
SDQ ECE 445 Assignment
PDF
No ratings yet
SDQ ECE 445 Assignment
9 pages
1.4.4 Assembly Language
PDF
100% (1)
1.4.4 Assembly Language
6 pages
Unit 1 SystemProgramming
PDF
No ratings yet
Unit 1 SystemProgramming
43 pages
Final Te 2019 Sposl Lab Manual 2022-4-33
PDF
No ratings yet
Final Te 2019 Sposl Lab Manual 2022-4-33
30 pages
Assembler
PDF
No ratings yet
Assembler
40 pages
CNSL-Oral Questions
PDF
No ratings yet
CNSL-Oral Questions
9 pages
SPOS Practical - Assign No1
PDF
No ratings yet
SPOS Practical - Assign No1
8 pages
03 Assembler (UPDATED)
PDF
100% (1)
03 Assembler (UPDATED)
12 pages
A Level CS CH 6 9618
PDF
No ratings yet
A Level CS CH 6 9618
9 pages
Designanddevelopmentoftwopass Assembler
PDF
No ratings yet
Designanddevelopmentoftwopass Assembler
3 pages
EXP2SPCC
PDF
No ratings yet
EXP2SPCC
8 pages
SIC Assembler
PDF
No ratings yet
SIC Assembler
26 pages
Assembler: Jian-hua Yeh (葉建華) 真理大學資訊科學系助理教授
PDF
No ratings yet
Assembler: Jian-hua Yeh (葉建華) 真理大學資訊科學系助理教授
69 pages
Assignment 2 Ankur Sir
PDF
No ratings yet
Assignment 2 Ankur Sir
17 pages
Ss Mod1
PDF
No ratings yet
Ss Mod1
29 pages
Unit1 Notes Part2
PDF
No ratings yet
Unit1 Notes Part2
20 pages
System Software
PDF
No ratings yet
System Software
62 pages
Assembler 1
PDF
100% (1)
Assembler 1
38 pages
Assemblers, Table Processing, and Macro Processors: A Compre-Hensive Overview
PDF
No ratings yet
Assemblers, Table Processing, and Macro Processors: A Compre-Hensive Overview
5 pages
Q 1. Discuss Design Specification of A Assembler With Diagram? Ans
PDF
No ratings yet
Q 1. Discuss Design Specification of A Assembler With Diagram? Ans
9 pages
UNIT 3 Assembler
PDF
No ratings yet
UNIT 3 Assembler
21 pages
Cap318 (System Software) Home Work - Ii: Surendra
PDF
No ratings yet
Cap318 (System Software) Home Work - Ii: Surendra
16 pages
1.2 Assembler Notes
PDF
100% (1)
1.2 Assembler Notes
16 pages
Assembler 4 Presentation
PDF
No ratings yet
Assembler 4 Presentation
59 pages