1.Program to find factorial of a given number

Size: px
Start display at page:

Download "1.Program to find factorial of a given number"

Transcription

1 1.Program to find factorial of a given number DATA SEGMENT X DW 06H FACT DW? DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX MOV AX,01H ;Set the value of AX as 01H. MOV CX,X ;Move the i/p number to CX. UP: MUL CX ;Perform the Loop multiplication operation. LOOP UP MOV FACT,AX ;Store the FACT value. MOV AH,4CH INT 21H CODE ENDS END START Input: 06 Output: 2D0H 2.If given data is odd or even DATA SEGMENT NUM DB 10,13,'ENTER THE NUMBER:$' MSG1 DB 10,13,'NUMBER IS EVEN$' MSG2 DB 10,13,'NUMBER IS ODD$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX LEA DX,NUM MOV AH,09H INT 21H MOV AH,01H ;Read a number. INT 21H MOV AH,00H MOV BL,2 DIV BL CMP AH,0H JNZ EXIT LEA DX,MSG1 ;Declare it is Even number. MOV AH,09H INT 21H JMP LAST EXIT: LEA DX,MSG2 ;Declare it is Odd number. MOV AH,09H INT 21H

2 LAST: MOV AH,4CH INT 21H CODE ENDS END START Input: ENTER THE NUMBER: 4 output: NUMBER IS ODD 3.PROGRAM TO FIND LARGEST NUMBER AMONG THE SERIES DATA SEGMENT ;start of data segment X DW 0010H,52H,30H,40H,50H LAR DW? DATA ENDS ;end of data segment CODE SEGMENT ;start of code segment ASSUME CS:CODE,DS:DATA ;initialize data segment START: MOV AX,DATA MOV DS,AX MOV CX,05H ;load CX register with number of datawords in X LEA SI,X ;initialize SI to point to the first number MOV AX,[SI] ;make a copy of the number pointed by SI in AX ADD SI,2 ;point to the next number DEC CX ;decrement CX to check if all numbers are compared UP: CMP AX,[SI] JA CONTINUE MOV AX,[SI] CONTINUE: ADD SI,2 DEC CX JNZ UP MOV LAR,AX MOV AH,4CH INT 21H CODE ENDS END START ;compare two adjacent numbers(one is in AX and the other is pointed by SI) ;if contents of AX is greater than the next Number in array retain the contents of AX ;if not make a copy of the larger number in AX ;point to the next number ;decrement CX to check if all numbers are compared ;if no continue to compare ;if yes make a copy of AX(largest number) in user defined memory location LAR

3 Chapter 2 Assemblers Source Program Assembler Object Code Linker Executable Code Loader 1

4 Outline 2.1 Basic Assembler Functions A simple SIC assembler Assembler tables and logic 2.2 Machine-Dependent Assembler Features Instruction formats and addressing modes Program relocation 2.3 Machine-Independent Assembler Features 2.4 Assembler Design Options Two-pass One-pass Multi-pass 2

5 2.1 Basic Assembler Functions Figure 2.1 shows an assembler language program for SIC. The line numbers are for reference only. Indexing addressing is indicated by adding the modifier,x Lines beginning with. contain comments only. Reads records from input device (code F1) Copies them to output device (code 05) At the end of the file, writes EOF on the output device, then RSUB to the operating system 3

6 4

7 5

8 6

9 2.1 Basic Assembler Functions Assembler directives (pseudo-instructions) START, END, BYTE, WORD, RESB, RESW. These statements are not translated into machine instructions. Instead, they provide instructions to the assembler itself. 7

10 2.1 Basic Assembler Functions Data transfer (RD, WD) A buffer is used to store record Buffering is necessary for different I/O rates The end of each record is marked with a null character (00 16 ) Buffer length is 4096 Bytes The end of the file is indicated by a zero-length record When the end of file is detected, the program writes EOF on the output device and terminates by RSUB. Subroutines (JSUB, RSUB) RDREC, WRREC Save link (L) register first before nested jump 8

11 2.1.1 A simple SIC Assembler Figure 2.2 shows the generated object code for each statement. Loc gives the machine address in Hex. Assume the program starting at address Translation functions Translate STL to 14. Translate RETADR to Build the machine instructions in the proper format (,X). Translate EOF to 454F46. Write the object program and assembly listing. 9

12 10

13 11

14 12

15 2.1.1 A simple SIC Assembler A forward reference FIRST STL RETADR A reference to a label (RETADR) that is defined later in the program Most assemblers make two passes over the source program Most assemblers make two passes over source program. Pass 1 scans the source for label definitions and assigns address (Loc). Pass 2 performs most of the actual translation. 13

16 2.1.1 A simple SIC Assembler Example of Instruction Assemble Forward reference STCH BUFFER, X opcode x address m (54) 16 1 (001) 2 (039) 16 14

17 2.1.1 A simple SIC Assembler Forward reference Reference to a label that is defined later in the program. Loc Label OP Code Operand 1000 FIRST STL RETADR 1003 CLOOP JSUB RDREC 1012 J CLOOP 1033 RETADR RESW 1 15

18 2.1.1 A simple SIC Assembler The object program (OP) will be loaded into memory for execution. Three types of records Header: program name, starting address, length. Text: starting address, length, object code. End: address of first executable instruction. 16

19 2.1.1 A simple SIC Assembler 17

20 2.1.1 A simple SIC Assembler The symbol ^ is used to separate fields. Figure 2.3 1E(H)=30(D)=16(D)+14(D) 18

21 2.1.1 A simple SIC Assembler Assembler s Functions Convert mnemonic operation codes to their machine language equivalents STL to 14 Convert symbolic operands (referred label) to their equivalent machine addresses RETADR to 1033 Build the machine instructions in the proper format Convert the data constants to internal machine representations Write the object program and the assembly listing 19

22 2.1.1 A simple SIC Assembler The functions of the two passes assembler. Pass 1 (define symbol) Assign addresses to all statements (generate LOC). Check the correctness of Instruction (check with OP table). Save the values (address) assigned to all labels into SYMBOL table for Pass 2. Perform some processing of assembler directives. Pass 2 Assemble instructions (op code from OP table, address from SYMBOL table). Generate data values defined by BYTE, WORD. Perform processing of assembler directives not done during Pass Write the OP (Fig. 2.3) and the assembly listing (Fig. 2.2).

23 2.1.2 Assembler Tables and Logic Our simple assembler uses two internal tables: The OPTAB and SYMTAB. OPTAB is used to look up mnemonic operation codes and translate them to their machine language equivalents. LDA 00, STL 14, SYMTAB is used to store values (addresses) assigned to labels. COPY 1000, FIRST 1000 Location Counter LOCCTR LOCCTR is a variable for assignment addresses. LOCCTR is initialized to address specified in START. When reach a label, the current value of LOCCTR gives the address to be associated with that label. 21

24 2.1.2 Assembler Tables and Logic The Operation Code Table (OPTAB) Contain the mnemonic operation & its machine language equivalents (at least). Contain instruction format & length. Pass 1, OPTAB is used to look up and validate operation codes. Pass 2, OPTAB is used to translate the operation codes to machine language. In SIC/XE, assembler search OPTAB in Pass 1 to find the instruction length for incrementing LOCCTR. Organize as a hash table (static table). 22

25 2.1.2 Assembler Tables and Logic The Symbol Table (SYMTAB) Include the name and value (address) for each label. Include flags to indicate error conditions Contain type, length. Pass 1, labels are entered into SYMTAB, along with assigned addresses (from LOCCTR). Pass 2, symbols used as operands are look up in SYMTAB to obtain the addresses. Organize as a hash table (static table). The entries are rarely deleted from table. COPY 1000 FIRST 1000 CLOOP 1003 ENDFIL 1015 EOF 1024 THREE 102D ZERO 1030 RETADR 1033 LENGTH 1036 BUFFER 1039 RDREC

26 2.1.2 Assembler Tables and Logic Pass 1 usually writes an intermediate file. Contain source statement together with its assigned address, error indicators. This file is used as input to Pass 2. Figure 2.4 shows the two passes of assembler. Format with fields LABEL, OPCODE, and OPERAND. Denote numeric value with the prefix #. #[OPERAND] 24

27 Pass 1 25

28 26

29 Pass 2 27

30 else if (found symbol==rsub found symbol== found symbol== ) store 0 as operand address else store 0 as operand address set error flag assemble the object code inst. 28

31 2.2 Machine-Dependent Assembler Features Indirect addressing Adding the to operand (line 70). Immediate operands Adding the prefix # to operand (lines 12, 25, 55, 133). Base relative addressing Assembler directive BASE (lines 12 and 13). Extended format Adding the prefix + to OP code (lines 15, 35, 65). The use of register-register instructions. Faster and don t require another memory reference. 29

32 Figure 2.5: First 30

33 Figure 2.5: RDREC 31

34 Figure 2.5: WRREC 32

35 2.2 Machine-Dependent Assembler Features SIC/XE PC-relative/Base-relative addressing op m Indirect addressing Immediate addressing op #c Extended format +op m Index addressing op m, X register-to-register instructions COMPR larger memory multi-programming (program allocation) 33

36 2.2 Machine-Dependent Assembler Features Register translation register name (A, X, L, B, S, T, F, PC, SW) and their values (0, 1, 2, 3, 4, 5, 6, 8, 9) preloaded in SYMTAB Address translation Most register-memory instructions use program counter relative or base relative addressing Format 3: 12-bit disp (address) field PC-relative: -2048~2047 Base-relative: 0~4095 Format 4: 20-bit address field (absolute addressing) 34

37 2.2.1 Instruction Formats & Addressing Modes The START statement Specifies a beginning address of 0. Register-register instructions CLEAR & TIXR, COMPR Register-memory instructions are using Program-counter (PC) relative addressing The program counter is advanced after each instruction is fetched and before it is executed. PC will contain the address of the next instruction FIRST STL RETADR 17202D TA - (PC) = disp = 30H 3H= 2D 35

38 36

39 37

40 38

41 +OP, e=1 Extended n=1, i=1, OPcode+3, n=1, i=0, OPcode+2, Indirect #C, n=0, i=1, OPcode+1, Immediate xbpe 2: PC-relative 4: base-relative 8: index (m,x) 1: extended 39

42 2.2.1 Instruction Formats & Addressing Modes J CLOOP 3F2FEC A = disp = -14 Base (B), LDB #LENGTH, BASE LENGTH E STCH BUFFER, X 57C003 TA-(B) = (B) = disp = = 0003 Extended instruction CLOOP +JSUB RDREC 4B Immediate instruction LDA # C +LDT # PC relative + indirect addressing (line 70) 40

43 2.2.2 Program Relocation Absolute program, relocatable program 41

44 2.2.2 Program Relocation 42

45 2.2.2 Program Relocation Modification record (direct addressing) 1 M 2-7 Starting location of the address field to be modified, relative to the beginning of the program. 8-9 Length of the address field to be modified, in half bytes. M^000007^05 43

46 2.3 Machine-Independent Assembler Features Write the value of a constant operand as a part of the instruction that uses it (Fig. 2.9). A literal is identified with the prefix = A ENDFIL LDA =C EOF Specifies a 3-byte operand whose value is the character string EOF WLOOP TD =X 05 E32011 Specifies a 1-byte literal with the hexadecimal value 05 44

47 45

48 RDREC 46

49 WRREC 47

50 2.3.1 Literals The difference between literal operands and immediate operands =, # Immediate addressing, the operand value is assembled as part of the machine instruction, no memory reference. With a literal, the assembler generates the specified value as a constant at some other memory location. The address of this generated constant is used as the TA for the machine instruction, using PC-relative or base-relative addressing with memory reference. Literal pools At the end of the program (Fig. 2.10). Assembler directive LTORG, it creates a literal pool that contains all of the literal operands used since the previous 48

51 49

52 RDREC 50

53 WRREC 51

54 2.3.1 Literals When to use LTORG (page 69, 4th paragraph) The literal operand would be placed too far away from the instruction referencing. Cannot use PC-relative addressing or Base-relative addressing to generate Object Program. Most assemblers recognize duplicate literals. By comparison of the character strings defining them. =C EOF and =X 454F46 52

55 2.3.1 Literals Allow literals that refer to the current value of the location counter. Such literals are sometimes useful for loading base registers. LDB =* ; register B=beginning address of statement=current LOC BASE * ; for base relative addressing If a literal =* appeared on line 13 or 55 Specify an operand with value 0003 (Loc) or 0020 (Loc). 53

56 2.3.1 Literals Literal table (LITTAB) Contains the literal name (=C EOF ), the operand value (454F46) and length (3), and the address (002D). Organized as a hash table. Pass 1, the assembler creates or searches LITTAB for the specified literal name. Pass 1 encounters a LTORG statement or the end of the program, the assembler makes a scan of the literal table. Pass 2, the operand address for use in generating OC is obtained by searching LITTAB. 54

57 2.3.2 Symbol-Defining Statements Allow the programmer to define symbols and specify their values. Assembler directive EQU. Improved readability in place of numeric values. +LDT #4096 MAXLEN EQU BUFEND-BUFFER (4096) +LDT #MAXLEN Use EQU in defining mnemonic names for registers. Registers A, X, L can be used by numbers 0, 1, 2. RMO 0, 1 RMO A, X 55

58 2.3.2 Symbol-Defining Statements The standard names reflect the usage of the registers. BASE EQU R1 COUNT EQU R2 INDEX EQU R3 Assembler directive ORG Use to indirectly assign values to symbols. ORG value The assembler resets its LOCCTR to the specified value. ORG can be useful in label definition. 56

59 2.3.2 Symbol-Defining Statements The location counter is used to control assignment of storage in the object program In most cases, altering its value would result in an incorrect assembly. ORG is used SYMBOL is 6-byte, VALUE is 3-byte, and FLAGS is 2-byte. 57

60 2.3.2 Symbol-Defining Statements STAB SYMBOL VALUE FLAGS (100 entries) LOC 1000 STAB RESB SYMBOL EQU STAB VALUE EQU STAB FLAGS EQU STAB +9 Use LDA VALUE, X to fetch the VALUE field form the table entry indicated by the contents of register X. 58

61 2.3.2 Symbol-Defining Statements STAB SYMBOL VALUE FLAGS (100 entries) STAB RESB 1100 ORG STAB 1000 SYMBOL RESB VALUE RESW FLAGS RESB 2 ORG STAB

62 2.3.2 Symbol-Defining Statements All terms used to specify the value of the new symbol --- must have been defined previously in the program.... BETA EQU ALPHA ALPHA RESW 1... Need 2 passes 60

63 2.3.2 Symbol-Defining Statements All symbols used to specify new location counter value must have been previously defined. ORG ALPHA BYTE1 RESB 1 BYTE2 RESB 1 BYTE3 RESB 1 ORG ALPHA RESW 1 Forward reference ALPHA EQU BETA BETA EQU DELTA DELTA RESW 1 Need 3 passes 61

64 2.3.3 Expressions Allow arithmetic expressions formed Using the operators +, -,, /. Division is usually defined to produce an integer result. Expression may be constants, user-defined symbols, or special terms BUFEND EQU * Gives BUFEND a value that is the address of the next byte after the buffer area. Absolute expressions or relative expressions A relative term or expression represents some value (S+r), S: starting address, r: the relative value. 62

65 2.3.3 Expressions MAXLEN EQU BUFEND-BUFFER Both BUFEND and BUFFER are relative terms. The expression represents absolute value: the difference between the two addresses. Loc =1000 (Hex) The value that is associated with the symbol that appears in the source statement. BUFEND+BUFFER, 100-BUFFER, 3*BUFFER represent neither absolute values nor locations. Symbol tables entries 63

66 2.3.4 Program Blocks The source program logically contained main, subroutines, data areas. In a single block of object code. More flexible (Different blocks) Generate machine instructions (codes) and data in a different order from the corresponding source statements. Program blocks Refer to segments of code that are rearranged within a single object program unit. Control sections Refer to segments of code that are translated into independent object program units. 64

67 2.3.4 Program Blocks Three blocks, Figure 2.11 Default (USE), CDATA (USE CDATA), CBLKS (USE CBLKS). Assembler directive USE Indicates which portions of the source program blocks. At the beginning of the program, statements are assumed to be part of the default block. Lines 92, 103, 123, 183, 208, 252. Each program block may contain several separate segments. The assembler will rearrange these segments to gather together the pieces of each block. 65

68 Main 66

69 RDREC 67

70 WRREC 68

71 2.3.4 Program Blocks Pass 1, Figure 2.12 The block number is started form 0. A separate location counter for each program block. The location counter for a block is initialized to 0 when the block is first begun. Assign each block a starting address in the object program (location 0). Labels, block name or block number, relative addr. Working table is generated Block name Block number Address End Length default (0~0065) CDATA B (0~000A) CBLKS (0~0FFF) 69

72 70

73 71

74 72

75 2.3.4 Program Blocks Pass 2, Figure 2.12 The assembler needs the address for each symbol relative to the start of the object program. Loc shows the relative address and block number. Notice that the value of the symbol MAXLEN (line 70) is shown without a block number LDA LENGTH (CDATA) =0069 =TA using program-counter relative addressing TA - (PC) = =0060 =disp 73

76 2.3.4 Program Blocks Separation of the program into blocks. Because the large buffer (CBLKS) is moved to the end of the object program. No longer need extended format, base register, simply a LTORG statement. No need Modification records. Improve program readability. Figure 2.13 Reflect the starting address of the block as well as the relative location of the code within the block. Figure 2.14 Loader simply loads the object code from each record at the dictated. CDATA(1) & CBLKS(1) are not actually present in OP. 74

77 2.3.4 Program Blocks Default 1 Default 2 CDATA 2 Default 3 CDATA 3 75

78 76

79 2.3.5 Control Sections & Program Linking Control section Handling of programs that consist of multiple control sections. Each control section is a part of the program. Can be assembled, loaded and relocated independently. Different control sections are most often used for subroutines or other logical subdivisions of a program. The programmer can assemble, load, and manipulate each of these control sections separately. More Flexibility then the previous. Linking control sections together. 77

80 2.3.5 Control Sections & Program Linking External references (external symbol references) Instructions in one control section might need to refer to instructions or data located in another section. Figure 2.15, multiple control sections. Three sections, main COPY, RDREC, WRREC. Assembler directive CSECT. Assembler directives EXTDEF and EXTREF for external symbols. The order of symbols is not significant. COPY START 0 EXTDEF EXTREF BUFFER, BUFEND, LENGTH RDREC, WRREC (symbol name) 78

81 79

82 80

83 81

84 2.3.5 Control Sections & Program Linking Figure 2.16, the generated object code CLOOP +JSUB RDREC 4B STCH BUFFER,X The LOC of all control section is started form 0 RDREC is an external reference. The assembler has no idea where the control section containing RDREC will be loaded, so it cannot assemble the address. The proper address to be inserted at load time. Must use extended format instruction for external reference (M records are needed) MAXLEN WORD BUFEND-BUFFER An expression involving two external references. 82

85 83

86 84

87 85

88 2.3.5 Control Sections & Program Linking The loader will add to this data area with the address of BUFEND and subtract from it the address of BUFFER. (COPY and RDREC for MAXLEN) Line 190 and 107, in 107, the symbols BUFEND and BUFFER are defined in the same section. The assembler must remember in which control section a symbol is defined. The assembler allows the same symbol to be used in different control sections, lines 107 and 190. Figure 2.17, two new records. Defined record for EXTDEF, relative address. Refer record for EXTREF. 86

89 87

90 2.3.5 Control Sections & Program Linking Modification record M Starting address of the field to be modified, relative to the beginning of the control section (Hex). Length of the field to be modified, in half-bytes. Modification flag (+ or -). External symbol. M^000004^05+RDREC M^000028^06+BUFEND M^000028^06-BUFFER Use Figure 2.8 for program relocation. 88

91 89

92 90

93 2.4 Assembler Design Options Two-Pass Assembler Most assemblers Processing the source program into two passes. The internal tables and subroutines that are used only during Pass 1. The SYMTAB, LITTAB, and OPTAB are used by both passes. The main problems to assemble a program in one pass involves forward references. 91

94 2.4.2 One-Pass Assemblers Eliminate forward references Data items are defined before they are referenced. But, forward references to labels on instructions cannot be eliminated as easily. Prohibit forward references to labels. Two types of one-pass assembler. (Fig. 2.18) One type produces object code directly in memory for immediate execution. The other type produces the usual kind of object program for later execution. 92

95 93

96 94

97 95

98 2.4.2 One-Pass Assemblers Load-and-go one-pass assembler The assembler avoids the overhead of writing the object program out and reading it back in. The object program is produced in memory, the handling of forward references becomes less difficult. Figure 2.19(a), shows the SYMTAB after scanning line 40 of the program in Figure Since RDREC was not yet defined, the instruction was assembled with no value assigned as the operand address (denote by ). 96

99 97

100 98

101 2.4.2 One-Pass Assemblers Load-and-go one-pass assembler RDREC was then entered into SYMTAB as an undefined symbol, the address of the operand field of the instruction (2013) was inserted. Figure 2.19(b), when the symbol ENDFIL was defined (line 45), the assembler placed its value in the SYMTAB entry; it then inserted this value into the instruction operand field (201C). At the end of the program, all symbols must be defined without any * in SYMTAB. For a load-and-go assembler, the actual address must be known at assembly time. 99

102 2.4.2 One-Pass Assemblers Another one-pass assembler by generating OP Generate another Text record with correct operand address. When the program is loaded, this address will be inserted into the instruction by the action of the loader. Figure 2.20, the operand addresses for the instructions on lines 15, 30, and 35 have been generated as When the definition of ENDFIL is encountered on line 45, the third Text record is generated, the value 2024 is to be loaded at location 201C. The loader completes forward references. 100

103 ENDFIL RDREC EXIT WRREC 101

104 2.4.2 One-Pass Assemblers In this section, simple one-pass assemblers handled absolute programs (SIC example). 102

105 2.4.3 Multi-Pass Assemblers Use EQU, any symbol used on the RHS be defined previously in the source. LOC Pass LDA # ALPHA EQU BETA???????? BETA EQU DELTA???? DELTA RESW Need 3 passes! Figure 2.21, multi-pass assembler 103

106 2.4.3 Multi-Pass Assemblers 104

107 2.4.3 Multi-Pass Assemblers 105

108 2.4.3 Multi-Pass Assemblers 106

109 2.4.3 Multi-Pass Assemblers 107

110 2.4.3 Multi-Pass Assemblers 108

111 Chapter 3 Loaders and Linkers -- Basic Loader Functions

112 Three processes to run an object program Loading Brings object program into memory Relocation Modifies the object program so that it can be loaded at an address different from the location originally specified Linking Combines two or more separate object programs and supplies information needed to allow cross-references. Loader and linker may be a single system program Loader: loading and relocation Linker: linking

113 Absolute loader No linking and relocation needed Records in object program perform Header record Check the Header record for program name, starting address, and length (available memory) Text record Bring the object program contained in the Text record to the indicated address End record Transfer control to the address specified in the End record

114 Loading an absolute program Figure 3.1, pp. 125 (a) Object program ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^

115 Loading an absolute program Figure 3.1, pp E F DC2079 XXXXXXXX XXXXXXXX XX C XXXX XXXXXXXX XXXXXXXX 3FD8205D 38203F10 E C00 XXXXXXXX XXXXXXXX 205D C205E C XXXXXXXX XXXXXXXX D0C XXXXXXXX XXXXXXXX C F XXXXXXXX XXXXXXXX A C XXXXXXXX XXXXXXXX C XX 0FF XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX Contents Memory address

116 Algorithm for an absolute loader Figure 3.2, pp. 126 begin read Header record verify program name and length read first Text record while record type!= E do begin {if object code is in character form, convert into internal representation} move object code to specified location in memory read next object program record end jump to address specified in End record end Algorithm for an absolute loader Most machines store object codes in binary form Less space and loading time Not good for reading

117 Object Code Representation Character form (e.g. Figure 3.1 (a)) Each byte of assembled code is given using its hexadecimal representation in character form Easy to read by human beings Binary form Each byte of object code is stored as a single byte Most machine store object programs in a binary form

118 A simple bootstrap loader Bootstrap Loader (usually in ROM) When a computer is first tuned on or restarted, a special type of absolute loader, the bootstrap loader loads the first program (usually O.S.) to be run into memory SIC bootstrap loader The bootstrap itself begins at address 0 It loads the OS starting address 0x80 No header record or control information, the object code is consecutive bytes of memory After load the OS, the control is transferred to the instruction at address 80. Bootstrap Loader O.S. F1 device O.S.

119 Algorithm for SIC/XE bootstrap loader X 0x80 (the address of the next memory location to be loaded) Loop until end of input A GETC (and convert from ASCII character code to the hexadecimal digit) save the value in the high-order 4 bits of S A GETC combine the value to form one byte A (A+S) (X) (A) (store one char.) X X + 1 End of loop GETC A read one character from device F1 if (A = 0x04) then jump to 0x80 if A<48 then goto GETC A A-48 (0x30) if A<10 then return A A-7 return ASCII value of 0~9 : 0x30~39 A~F : 0x41~46

120 Bootstrap loader for SIC/XE -- Figure 3.3, pp. 128 BOOT LOOP START CLEAR LDX JSUB RMO SHIFTL JSUB ADDR STCH TIXR J #0.. THIS BOOTSTRAP READS OBJECT CODE FROM DEVICE F1 AND ENTERS IT. INTO MEMORY STARTING AT ADDRESS 80 (HEXADECIMAL). AFTER ALL OF. THE CODE FROM DEVF1 HAS BEEN SEEN ENTERED INTO MEMORY, THE. BOOTSTRAP EXECUTES A JUMP TO ADDRESS 80 TO BEGIN EXECUTION OF. THE PROGRAM JUST LOADED. REGISTER X CONTAINS THE NEXT ADDRESS. TO BE LOADED.. #A #128 #GETC #A,S #S,4 #GETC #S,A #0,X #X,X #LOOP BOOTSTRAP LOADER FOR SIC/XE CLEAR REGISTER A TO ZERO INITIALIZE REGISTER X TO HEX 80 READ HEX DIGIT FROM PROGRAM BEING LOADED SAVE IN REGISTER S MOVE TO HIGH-ORDER 4 BITS OF BYTE GET NEXT HEX DIGIT COMBINE DIGITS TO FORM ONE BYTE STORE AT ADDRESS IN REGISTER X ADD 1 TO MEMORY ADDRESS BEING LOADED LOOP UNTIL END OF INPUT IS REACHED

121 Bootstrap loader for SIC/XE -- Figure 3.3, pp SUBROUTINE TO READ ONE CHARACTER FROM INPUT DEVICE AND. CONVERT IT FROM ASCII CODE TO HEXADECIMAL DIGIT VALUE. THE. CONVERTED DIGIT VALUE IS RETURNED IN REGISTER A. WHEN AN. END-OF-FILE IS READ, CONTROL IS TRANSFERRED TO THE STARTING. ADDRESS (HEX 80).. GETC RETURN INPUT TD JEQ RD COMP JEQ COMP JLT SUB COMP JLT SUB RSUB BYTE END #INPUT #GETC #INPUT #4 #80 #48 #GETC #48 #10 #RETURN #7 #X F1 #LOOP TEST INPUT DEVICE LOOP UNTIL READY READ CHARACTER IF CHARACTER IS HEX 04 (END OF FILE), JUMP TO START OF PROGRAM JUST LOADED COMPARE TO HEX 30 (CHARACTER 0 ) SKIP HCARACTERS LESS THAN 0 SUBTRACT HEX 30 FROM ASCII CODE IF RESULT IS LESS THAN 10, CONVERSION IS COMPLETE. OTHERWISE, SUBTRACT 7 MORE (FOR HEX DIGITS A THROUGH F ) RETURN TO CALLER CODE FOR INPUT DEVICE

122 Chapter 3 Loaders and Linkers -- Loader Design Options

123 Loaders Linkage editor Linking before loading Dynamic linking Linking at the execution time Bootstrap loader

124 Linkage editors Difference between a linkage editor and a linking loader: Linking loader Performs all linking and relocation operations, including automatic library search, and loads the linked program into memory for execution. Linkage editor Produces a linked version of the program, which is normally written to a file or library for later execution. A simple relocating loader (one pass) can be used to load the program into memory for execution. The linkage editor performs relocation of all control sections relative to the start of the linked program. The only object code modification necessary is the addition of an actual load address to relative values within the program

125 Compare between linking loader and linkage editor Linking loader Suitable when a program is reassembled for nearly every execution In a program development and testing environment When a program is used so infrequently that it is not worthwhile to store the assembled and linked version. Linkage editor Suitable when a program is to be executed many times without being reassembled because resolution of external references and library searching are only performed once.

126 Linking loader v.s. linkage editor Linking loader Linkage editor

127 Additional Functions of Linkage Editors Replacement of subroutines in the linked program For example: INCLUDE PLANNER(PROGLIB) DELETE PROJECT {DELETE from existing PLANNER} INCLUDE PROJECT(NEWLIB) {INCLUDE new version} REPLACE PLANNER(PROGLIB) Construction of a package for subroutines generally used together There are a large number of cross-references between these subroutines due to their closely related functions. For example (P.155) : INCLUDE READR(FTNLIB) INCLUDE WRITER(FTNLIB) : SAVE FTNIO(SUBLIB)

128 Additional Functions of Linkage Editors (Cond.) Specification of external references not to be resolved by automatic library search Can avoid multiple storage of common libraries in programs. Need a linking loader to combine the common libraries at execution time.

129 Dynamic Linking Comparison Linkage editors perform linking operations before the program is loaded for execution Linking loaders perform linking operations at load time Dynamic linking (dynamic loading, load on call) perform linking at execution time Delayed Binding Avoid the necessity of loading the entire library for each execution, i.e. load the routines only when they are needed Allow several executing programs to share one copy of a subroutine or library (Dynamic Link Library, DLL)

130 Dynamic Linking O.S. services request of dynamic linking Dynamic loader is one part of the OS Instead of executing a JSUB instruction that refers to an external symbol, the program makes a load-and-call service request to the OS Example (Figure 3.14) When call a routine, pass routine name as parameter to O.S. (a) If routine is not loaded, O.S. loads it from library and pass the control to the routine (b and c) When the called routine completes it processing, it returns to the caller (O.S.) (d) When call a routine and the routine is still in memory, O.S. simply passes the control to the routine (e)

131 Example of Dynamic Linking -- Figure 3.14, pp.157

132 Example of Dynamic Linking -- Figure 3.14, pp.157

133 Bootstrap Loaders How is the loader itself loaded into memory? An absolute loader program is permanently resident in a read-only memory ROM Copy absolute loader in ROM into RAM for execution (optional) Read a fixed-length record from some device into memory at a fixed location. After the read operation, control is automatically transferred to the address in memory

134 Chapter 3 Loaders and Linkers Source Program Assembler Object Code Linker Executable Code Loader 1

135 3.1 Basic Loader Functions In Chapter 2, we discussions Loading: brings the OP into memory for execution Relocating: modifies the OP so that it can be loaded at an address different form the location originally specified. Linking: combines two or more separate OPs (set 2.3.5) In Chapter 3, we will discussion A loader brings an object program into memory and starting its execution. A linker performs the linking operations and a separate loader to handle relocation and loading. 2

136 3.1 Basic Loader Functions Design of an Absolute Loader Absolute loader (for SIC), in Figures 3.1 and 3.2. Does not perform linking and program relocation. The contents of memory locations for which there is no Text record are shown as xxxx. Each byte of assembled code is given using its Hex representation in character form. 3

137 3.1.1 Design of an Absolute Loader Absolute loader, in Figure 3.1 and 3.2. STL instruction, pair of characters 14, when these are read by loader, they will occupy two bytes of memory. 14 (Hex 31 34) ----> (one byte) For execution, the operation code must be store in a single byte with hexadecimal value 14. Each pair of bytes must be packed together into one byte. Each printed character represents one half-byte. 4

138 5

139 6

140 3.1.2 A Simple Bootstrap Loader A bootstrap loader, Figure 3.3. Loads the first program to be run by the computer--- usually an operating system. The bootstrap itself begins at address 0 in the memory. It loads the OS or some other program starting at address 80. 7

141 3.1.2 A Simple Bootstrap Loader A bootstrap loader, Figure 3.3. Each byte of object code to be loaded is represented on device F1 as two Hex digits (by GETC subroutines). The ASCII code for the character 0 (Hex 30) is converted to the numeric value 0. The object code from device F1 is always loaded into consecutive bytes of memory, starting at address 80. 8

142 9

143 10

144 3.2 Machine-Dependent Loader Features Absolute loader has several potential disadvantages. The actual address at which it will be loaded into memory. Cannot run several independent programs together, sharing memory between them. It difficult to use subroutine libraries efficiently. More complex loader. Relocation Linking Linking loader 11

145 3.2.1 Relocation Relocating loaders, two methods: Modification record (for SIC/XE) Relocation bit (for SIC) 12

146 13

147 14

148 15

149 3.2.1 Relocation Modification record, Figure 3.4 and 3.5. To described each part of the object code that must be changed when the program is relocated. The extended format instructions on lines 15, 35, and 65 are affected by relocation. (absolute addressing) In this example, all modifications add the value of the symbol COPY, which represents the starting address. Not well suited for standard version of SIC, all the instructions except RSUB must be modified when the program is relocated. (absolute addressing) 16

150 17

151 3.2.1 Relocation Figure 3.6 needs 31 Modification records. Relocation bit, Figure 3.6 and 3.7. A relocation bit associated with each word of object code. The relocation bits are gathered together into a bit mask following the length indicator in each Text record. If bit=1, the corresponding word of object code is relocated. 18

152

153

154

155 3.2.1 Relocation Relocation bit, Figure 3.6 and 3.7. In Figure 3.7, T000000^1E^FFC^ ( ) specifics that all 10 words of object code are to be modified. On line 210 begins a new Text record even though there is room for it in the preceding record. Any value that is to be modified during relocation must coincide with one of these 3-byte segments so that it corresponding to a relocation bit. Because of the 1-byte data value generated form line 185, this instruction must begin a new Text record in object program. 22

156

157 3.2.2 Program Linking In Section showed a program made up of three controls sections. Assembled together or assembled independently. 24

158 3.2.2 Program Linking Consider the three programs in Fig. 3.8 and 3.9. Each of which consists of a single control section. A list of items, LISTA---ENDA, LISTB---ENDB, LISTC---ENDC. Note that each program contains exactly the same set of references to these external symbols. Instruction operands (REF1, REF2, REF3). The values of data words (REF4 through REF8). Not involved in the relocation and linking are omitted. 25

159 26

160 REF2 REF4 REF5 REF6 REF7 REF8 27

161 28

162 REF1 REF3 REF4 REF5 REF6 REF7 REF8 29

163 30

164 REF1 REF2 REF3 REF4 REF6 REF7 REF8 31

165 3.2.2 Program Linking REF1, LDA LISTA 03201D In the PROGA, REF1 is simply a reference to a label. In the PROGB and PROGC, REF1 is a reference to an external symbols. Need use extended format, Modification record. REF2 and REF3. LDT LISTB LDX #ENDA-LISTA

166 3.2.2 Program Linking REF4 through REF8, WORD ENDA-LISTA+LISTC Figure 3.10(a) and 3.10(b) Shows these three programs as they might appear in memory after loading and linking. PROGA , PROGB , PROGC 0040E2. REF4 through REF8 in the same value. For the references that are instruction operands, the calculated values after loading do not always appear to be equal. Target address, REF

167 34

168 = F= 35

169 Ref No. Symbol Address 1 PROGA LISTB 40C3 3 ENDB 40D3 4 LISTC ENDC 4124 Ref No. Symbol Address 1 PROGB LISTA ENDA LISTC ENDC 4124 Ref No. Symbol Address 1 PROGC LISTA ENDA LISTB 40C3 5 ENDB 40D3 36

170 37

171 3.2.3 Algorithm and Data Structure for a Linking Loader A linking loader usually makes two passes Pass 1 assigns addresses to all external symbols by creating ESTAB. Pass 2 performs the actual loading, relocation, and linking by using ESTAB. The main data structure is ESTAB (hashing table). 38

172 3.2.3 Algorithm and Data Structure for a Linking Loader A linking loader usually makes two passes ESTAB is used to store the name and address of each external symbol in the set of control sections being loaded. Two variables PROGADDR and CSADDR. PROGADDR is the beginning address in memory where the linked program is to be loaded. CSADDR contains the starting address assigned to the control section currently being scanned by the loader. 39

173 3.2.3 Algorithm and Data Structure for a Linking Loader The linking loader algorithm, Fig 3.11(a) & (b). In Pass 1, concerned only Header and Defined records. CSADDR+CSLTH = the next CSADDR. A load map is generated. In Pass 2, as each Text record is read, the object code is moved to the specified address (plus the current value of CSADDR). When a Modification record is encountered, the symbol whose value is to be used for modification is looked up in ESTAB. This value is then added to or subtracted from the indicated location in memory. 40

174 41

175 42

176 3.2.3 Algorithm and Data Structure for a Linking Loader The algorithm can be made more efficient. A reference number, is used in Modification records. The number 01 to the control section name. Figure 3.12, the main advantage of this referencenumber mechanism is that it avoids multiple searches of ESTAB for the same symbol during the loading of a control section. 43

177 44

178 45

179 46

180 3.3 Machine-Independent Loader Features Automatic Library Search Many linking loaders Can automatically incorporate routines form a subprogram library into the program being loaded. A standard system library The subroutines called by the program begin loaded are automatically fetched from the library, linked with the main program, and loaded. 47

181 3.3.1 Automatic Library Search Automatic library call At the end of Pass 1, the symbols in ESTAB that remain undefined represent unresolved external references. The loader searches the library 48

182 3.3.2 Loader Options Many loaders allow the user to specify options that modify the standard processing. Special command Separate file INCLUDE DELETE CHANGE INCLUDE INCLUDE DELETE CHANGE CHANGE LIBRARY NOCALL program-name(library-name) csect-name name1, name2 READ(UTLIB) WRITE(UTLIB) RDREC, WRREC RDREC, READ WRREC, WRITE MYLIB STDEV, PLOT, CORREL 49

183 3.4 Loader Design Options Linkage Editors Fig 3.13 shows the difference between linking loader and linkage editor. The source program is first assembled or compiled, producing an OP. Linking loader A linking loader performs all linking and relocation operations, including automatic library search if specified, and loads the linked program directly into memory for execution. 50

184 The essential difference between a linkage editor and a linking loader 51

185 3.4.1 Linkage Editors Linkage editor A linkage editor produces a linked version of the program (load module or executable image), which is written to a file or library for later execution. When the user is ready to run the linked program, a simple relocating loader can be used to load the program into memory. The only object code modification necessary is the addition of an actual load address to relative values within the program. The LE performs relocation of all control sections relative to the start of the linked program. 52

186 3.4.1 Linkage Editors All items that need to be modified at load time have values that are relative to the start of the linked program. If a program is to be executed many times without being reassembled, the use of a LE substantially reduces the overhead required. LE can perform many useful functions besides simply preparing an OP for execution. 53

187 54

188 3.4.2 Dynamic Linking Linking loaders perform these same (linking) operations at load time. Linkage editors perform linking operations before the program is load for execution. Dynamic Linking postpones the linking function until execution time. 55

189 3.4.2 Dynamic Linking Dynamic linking (dynamic loading, load on call) Postpones the linking function until execution time. A subroutine is loaded and linked to the rest the program when is first loaded. Dynamic linking is often used to allow several executing program to share one copy of a subroutine or library. Run-time library (C language), dynamic link library A single copy of the routines in this library could be loaded into the memory of the computer. 56

190 3.4.2 Dynamic Linking Dynamic linking provides the ability to load the routines only when (and if) they are needed. For example, that a program contains subroutines that correct or clearly diagnose error in the input data during execution. If such error are rare, the correction and diagnostic routines may not be used at all during most execution of the program. However, if the program were completely linked before execution, these subroutines need to be loaded and linked every time. 57

191 3.4.2 Dynamic Linking Dynamic linking avoids the necessity of loading the entire library for each execution. Fig illustrates a method in which routines that are to be dynamically loaded must be called via an operating system (OS) service request. 58

192 59

193 60

194 3.4.2 Dynamic Linking The program makes a load-and-call service request to OS. The parameter argument (ERRHANDL) of this request is the symbolic name of the routine to be loaded. OS examines its internal tables to determine whether or not the routine is already loaded. If necessary, the routine is loaded form the specified user or system libraries. Control id then passed form OS to the routine being called. When the called subroutine completes its processing, OS then returns control to the program that issued the request. If a subroutine is still in memory, a second call to it may not require another load operation. 61

195 3.4.3 Bootstrap Loaders An absolute loader program is permanently resident in a read-only memory (ROM) Hardware signal occurs The program is executed directly in the ROM The program is copied from ROM to main memory and executed there. 62

196 3.4.3 Bootstrap Loaders Bootstrap and bootstrap loader Reads a fixed-length record form some device into memory at a fixed location. After the read operation is complete, control is automatically transferred to the address in memory. If the loading process requires more instructions than can be read in a single record, this first record causes the reading of others, and these in turn can cause the reading of more records. 63

UNIT II ASSEMBLERS www.noyesengine.com www.technoscriptz.com 1 1. BASIC ASSEMBLER FUNCTIONS 2. A SIMPLE SIC ASSEMBLER 3. ASSEMBLER ALGORITHM AND DATA STRUCTURES 4. MACHINE DEPENDENT ASSEMBLER FEATURES

More information

Chapter 2. Assembler Design

Chapter 2. Assembler Design Chapter 2 Assembler Design Assembler is system software which is used to convert an assembly language program to its equivalent object code. The input to the assembler is a source code written in assembly

More information

Assemblers. System Software by Leland L. Beck. Chapter 2

Assemblers. System Software by Leland L. Beck. Chapter 2 Assemblers System Software by Leland L. Beck Chapter 2 1 Role of Assembler Source Program Assembler Object Code Linker Executable Code Loader 2 Chapter 2 -- Outline Basic Assembler Functions Machine-dependent

More information

UNIT III - LOADERS AND LINKERS

UNIT III - LOADERS AND LINKERS 3.1 Introduction to Loaders UNIT III - LOADERS AND LINKERS A loader is the part of an operating system that is responsible for loading programs into memory and prepares them for execution. Loading a program

More information

Chapter 3 Loaders and Linkers

Chapter 3 Loaders and Linkers Chapter 3 Loaders and Linkers Outline 3.1 Basic Loader Functions 3.2 Machine-Dependent Loader Features 3.3 Machine-Independent Loader Features 3.4 Loader Design Options 3.5 Implementation Examples Introduction

More information

Chapter 3 Loaders and Linkers

Chapter 3 Loaders and Linkers Chapter 3 Loaders and Linkers Outline 3.1 Basic Loader Functions 3.2 Machine-Dependent Loader Features 3.3 Machine-Independent Loader Features 3.4 Loader Design Options 3.5 Implementation Examples Introduction

More information

Unit 2 -- Outline. Basic Assembler Functions Machine-dependent Assembler Features Machine-independent Assembler Features Assembler Design Options

Unit 2 -- Outline. Basic Assembler Functions Machine-dependent Assembler Features Machine-independent Assembler Features Assembler Design Options Unit 2 -- Outline Basic Assembler Functions Machine-dependent Assembler Features Machine-independent Assembler Features Assembler Design Options Introduction to Assemblers Fundamental functions translating

More information

Chapter 3 Loaders and Linkers

Chapter 3 Loaders and Linkers Chapter 3 Loaders and Linkers Three fundamental processes: Loading brings the object program into memory for execution. Relocation modifies the object program so that it can be loaded at an address different

More information

UNIT III LOADERS AND LINKERS

UNIT III LOADERS AND LINKERS UNIT III LOADERS AND LINKERS INTRODUCTION Loader is a system program that performs the loading function. Many loaders also support relocation and linking. Some systems have a linker (linkage editor) to

More information

UNIT II ASSEMBLERS. Figure Assembler

UNIT II ASSEMBLERS. Figure Assembler 2.1 Basic assembler functions UNIT II ASSEMBLERS Assembler Assembler which converts assembly language programs into object files. Object files contain a combination of machine instructions, data, and information

More information

Chapter 3 Loaders and Linkers -- Machine-Dependent Loader Feature

Chapter 3 Loaders and Linkers -- Machine-Dependent Loader Feature Chapter 3 Loaders and Linkers -- Machine-Dependent Loader Feature Motivation Shortcoming of an absolute loader Programmer needs to specify the actual address at which it will be loaded into memory. It

More information

Introduction SIC, RISC & CISC 0. Introduction to Systems Programming This course aims at: Understanding what is going on behind the scenes The design and implementation of system software, such as Assemblers

More information

Chapter 2 Assemblers Machine-Dependent Assembler Features

Chapter 2 Assemblers Machine-Dependent Assembler Features Chapter 2 Assemblers -- 2.2 Machine-Dependent Assembler Features Outline Instruction format and addressing mode Program relocation Instruction format and addressing mode PC-relative or Base-relative addressing

More information

Gechstudentszone.wordpress.com

Gechstudentszone.wordpress.com CHAPTER -2 2.1 Basic Assembler Functions: The basic assembler functions are: ASSEMBLERS-1 Translating mnemonic language code to its equivalent object code. Assigning machine addresses to symbolic labels.

More information

CS2422 Assembly Language & System Programming

CS2422 Assembly Language & System Programming CS2422 Assembly Language & System Programming November 30, 2006 Today s Topic Assembler: Basic Functions Section 2.1 of Beck s System Software book. Reading Assignment: pages 43-52. Role of Assembler Source

More information

INTERNAL TEST (SCHEME AND SOLUTION)

INTERNAL TEST (SCHEME AND SOLUTION) PES Institute of Technology, Bangalore South Campus (Formerly PES School of Engineering) (Hosur Road, 1KM before Electronic City, Bangalore-560 100) Dept of MCA INTERNAL TEST (SCHEME AND SOLUTION) 1 Subject

More information

UNIT 1: MACHINE ARCHITECTURE

UNIT 1: MACHINE ARCHITECTURE VTU QUESTION PAPER SOLUTION UNIT 1: MACHINE ARCHITECTURE 1. a) Give the target address generated for the following machine instruction: (i) 032600h (ii) 03C300h (iii) 0310C303h if (B)=006000, (PC)=003000,

More information

CS2422 Assembly Language & System Programming

CS2422 Assembly Language & System Programming CS2422 Assembly Language & System Programming December 7, 2006 Today s Topic Assembler: Machine Dependent Features SIC/XE Program Relocation Modification Records in an Object File. Study Guide Sections

More information

This contains the following three processes, and they are,

This contains the following three processes, and they are, Chapter 3 Loaders and Linkers This Chapter gives you Basic Loader Functions Machine-Dependent Loader Features Machine-Independent Loader Features Loader Design Options Implementation Examples 30 Introduction

More information

Chapter 3: Loaders and Linkers

Chapter 3: Loaders and Linkers Department of Electr rical Eng ineering, Chapter 3: Loaders and Linkers 王振傑 (Chen-Chieh Wang) ccwang@mail.ee.ncku.edu.tw ncku edu 3.1 Basic Loader Functions 3.1.1 Design of an Absolute Loader 3.1.2 A Simple

More information

2.1. Basic Assembler Functions:

2.1. Basic Assembler Functions: 2.1. Basic Assembler Functions: The basic assembler functions are: Translating mnemonic language code to its equivalent object code. Assigning machine addresses to symbolic labels. SOURCE PROGRAM ASSEMBLER

More information

3.3 Machine-Independent Loader Features

3.3 Machine-Independent Loader Features 3.3 Machine-Independent Loader Features Loading and linking are often thought of as operating system service functions. Machine independent loader features: 3.3.1 Automatic Library Search 3.3.2 Loader

More information

Chapter 3 Loaders and Linkers -- Loader Design Options

Chapter 3 Loaders and Linkers -- Loader Design Options Chapter 3 Loaders and Linkers -- Loader Design Options Loaders Linkage editor Linking before loading Dynamic linking Linking at the execution time Bootstrap loader Linkage editors Difference between a

More information

DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY SIRUVACHUR, PERAMBALUR DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY SIRUVACHUR, PERAMBALUR DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY SIRUVACHUR, PERAMBALUR 621113. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CS2304- SYSTEM SOFTWARE PART-B QUESTIONS 1. EXPLAIN THE ARCHITECTURE

More information

Loaders. Systems Programming. Outline. Basic Loader Functions

Loaders. Systems Programming. Outline. Basic Loader Functions Loaders Systems Programming Chapter 3 Linkers and Loaders A loader is a system program that performs the loading function. many also support relocation & linking others have a separate linker and loader

More information

Prepared By : Ms. Sanchari Saha ( Asst. Professor) Department : Computer Science & Engineering

Prepared By : Ms. Sanchari Saha ( Asst. Professor) Department : Computer Science & Engineering Subject Name: System Software Subject Code: 10CS52 Prepared By : Ms. Sanchari Saha ( Asst. Professor) Department : Computer Science & Engineering Date : 20-10-2014 UNIT-4 LOADERS & LINKERS Engineered for

More information

Chapter 1. Introduction

Chapter 1. Introduction Chapter 1 Introduction This Chapter gives you System Software & Machine Architecture The Simplified Instructional Computer SIC and SIC/XE Traditional (CISC) Machines - Complex Instruction Set Computers

More information

LOADERS AND LINKERS 1. BASIC LOADER FUNCTIONS 2. DESIGN OF AN ABSOLUTE LOADER 3. A SIMPLE BOOTSTRAP LOADER 4. MACHINE DEPENDENT LOADER FEATURES

LOADERS AND LINKERS 1. BASIC LOADER FUNCTIONS 2. DESIGN OF AN ABSOLUTE LOADER 3. A SIMPLE BOOTSTRAP LOADER 4. MACHINE DEPENDENT LOADER FEATURES UIT III LOADERS AD LIKERS 1. BASIC LOADER FUCTIOS 2. DESIG OF A ABSOLUTE LOADER 3. A SIMPLE BOOTSTRAP LOADER 4. MACHIE DEPEDET LOADER FEATURES 5. RELOCATIO 6. PROGRAM LIKIG 7. ALGORITHM AD DATA STRUCTURES

More information

UNIT I - INTRODUCTION

UNIT I - INTRODUCTION UNIT I - INTRODUCTION 1. Define system software. It consists of variety of programs that supports the operation of the computer. This software makes it possible for the user to focus on the other problems

More information

CS2304-SYSTEM SOFTWARE 2 MARK QUESTION & ANSWERS. UNIT I INTRODUCTION

CS2304-SYSTEM SOFTWARE 2 MARK QUESTION & ANSWERS. UNIT I INTRODUCTION CS2304-SYSTEM SOFTWARE 2 MARK QUESTION & ANSWERS. UNIT I INTRODUCTION 1. Define System Software. System software consists of a variety of programs that supports the operations of a computer. Eg. Compiler,

More information

Gechstudentszone.wordpress.com

Gechstudentszone.wordpress.com UNIT - 1 MACHINE ARCHITECTURE 11 Introduction: The Software is set of instructions or programs written to carry out certain task on digital computers It is classified into system software and application

More information

UNIT 1: MACHINE ARCHITECTURE

UNIT 1: MACHINE ARCHITECTURE VTU QUESTION PAPER SOLUTION UNIT 1: MACHINE ARCHITECTURE 1. Give the target address generated for the following machine instruction: (i) 032600h (ii) 03C300h (iii) 0310C303h if (B)=006000, (PC)=003000,

More information

Machine dependent Assembler Features

Machine dependent Assembler Features Machine dependent Assembler Features Assembler Features Machine Dependent Assembler Features Instruction formats and addressing modes (SIC/XE) Program relocation Machine Independent Assembler Features

More information

Chapter 1: Background

Chapter 1: Background Chapter 1: Background Hsung-Pin Chang Department of Computer Science National Chung Hsing University Outline 1.1 Introduction 1.2 System Software and Machine Architecture 1.3 The Simplified Instructional

More information

UNIT III LOADERS AND LINKERS PART A

UNIT III LOADERS AND LINKERS PART A PART A UNIT III LOADERS AND LINKERS 1. Define Absolute Loader and Bootstrap Loader. The loader, which is used only for loading but not for relocation or linking is known as absolute loader. e.g. Bootstrap

More information

PESIT SOUTHCAMPUS 10CS52: SYSTEM SOFTWARE QUESTION BANK

PESIT SOUTHCAMPUS 10CS52: SYSTEM SOFTWARE QUESTION BANK CS52: SYSTEM SOFTWARE QUESTION BANK Chapter1: MACHINE ARCHITECTURE OBJECTIVE: Main Objective is to Know about the system software and architecture of Various Machines Like SIC, SIC/XE and Programming examples

More information

Systems Programming Assemblers Part 4 Control Sections

Systems Programming Assemblers Part 4 Control Sections Systems Programming Assemblers Part 4 Control Sections Prof. Dr. Hani Mahdi Department of Computer Science Al-Isra University, Amman, Jordan 1 1 Control Sections A Control Section is a part of the program

More information

Chapter 2 Assemblers Assembler Design Options

Chapter 2 Assemblers Assembler Design Options Chapter 2 Assemblers -- 2.4 Assembler Design Options Outline One-pass assemblers Multi-pass assemblers Two-pass assembler with overlay structure Load-and-Go Assembler Load-and-go assembler generates their

More information

CSI 402 Lecture 5 (Assemblers Continued) 5 1 / 18

CSI 402 Lecture 5 (Assemblers Continued) 5 1 / 18 CSI 402 Lecture 5 (Assemblers Continued) 5 1 / 18 Program Relocation Example 1: Consider the SIC instruction LDA THREE Assume the following: The START directive specifies the value 100 (decimal) The LC

More information

AS-2883 B.Sc.(Hon s)(fifth Semester) Examination,2013 Computer Science (PCSC-503) (System Software) [Time Allowed: Three Hours] [Maximum Marks : 30]

AS-2883 B.Sc.(Hon s)(fifth Semester) Examination,2013 Computer Science (PCSC-503) (System Software) [Time Allowed: Three Hours] [Maximum Marks : 30] AS-2883 B.Sc.(Hon s)(fifth Semester) Examination,2013 Computer Science (PCSC-503) (System Software) [Time Allowed: Three Hours] [Maximum Marks : 30] Note: Question Number 1 is compulsory. Marks : 10X1

More information

Chapter 1 Background. Professor Gwan-Hwan Hwang Dept. Computer Science and Information Engineering National Taiwan Normal University

Chapter 1 Background. Professor Gwan-Hwan Hwang Dept. Computer Science and Information Engineering National Taiwan Normal University Chapter 1 Background Professor Gwan-Hwan Hwang Dept. Computer Science and Information Engineering National Taiwan Normal University 9/17/2009 1 Outlines 1.1 Introduction 1.2 System Software and Machine

More information

國立嘉義大學資訊工程學系系統程式期中考考卷

國立嘉義大學資訊工程學系系統程式期中考考卷 國立嘉義大學資訊工程學系系統程式期中考考卷 學號 : 姓名 : 1. Please write the content in the lines. (25%) PROGB START EXTDEF B1, B2 EXTREF A1 LDA B1 +LDA A1 STA B1 +STA A1 B1 WORD 7 BUF RESB 1 B2 RESW 1 MAX EQU 1 END H^PROGA^^

More information

TRB-COMPUTER INSTRUCTOR COMPUTER SCIENCE UNIT IV. SYSTEM SOFTWARE 10% DISCOUNT FOR ALL PGTRB MATERIALS WITH QUESTION BANK.

TRB-COMPUTER INSTRUCTOR COMPUTER SCIENCE UNIT IV.  SYSTEM SOFTWARE 10% DISCOUNT FOR ALL PGTRB MATERIALS WITH QUESTION BANK. N COACHING CENTRE-TRICHY- TRB- COMPUTER INSTRUCTOR-COMPUTER SCIENCE STUDY MATERIAL-CONTACT: 822006 2017 N TRB-COMPUTER INSTRUCTOR COMPUTER SCIENCE UNIT IV SYSTEM SOFTWARE 10% DISCOUNT FOR ALL PGTRB MATERIALS

More information

ORG ; TWO. Assembly Language Programming

ORG ; TWO. Assembly Language Programming Dec 2 Hex 2 Bin 00000010 ORG ; TWO Assembly Language Programming OBJECTIVES this chapter enables the student to: Explain the difference between Assembly language instructions and pseudo-instructions. Identify

More information

CS1203-SYSTEM SOFTWARE UNIT I-INTRODUCTION

CS1203-SYSTEM SOFTWARE UNIT I-INTRODUCTION CS1203-SYSTEM SOFTWARE UNIT I-INTRODUCTION 1. Define system software. It consists of variety of programs that supports the operation of the computer. This software makes it possible for the user to focus

More information

Assembler Design Options

Assembler Design Options Assembler Design Options One and Multi-Pass Assembler So far, we have presented the design and implementation of a two-pass assembler. Here, we will present the design and implementation of One-pass assembler

More information

Compiler, Assembler, and Linker

Compiler, Assembler, and Linker Compiler, Assembler, and Linker Minsoo Ryu Department of Computer Science and Engineering Hanyang University msryu@hanyang.ac.kr What is a Compilation? Preprocessor Compiler Assembler Linker Loader Contents

More information

COMPILERS BASIC COMPILER FUNCTIONS

COMPILERS BASIC COMPILER FUNCTIONS COMPILERS BASIC COMPILER FUNCTIONS A compiler accepts a program written in a high level language as input and produces its machine language equivalent as output. For the purpose of compiler construction,

More information

Systems Programming Assemblers Part 3-3 Program Blocks

Systems Programming Assemblers Part 3-3 Program Blocks Systems Programming Assemblers Part 3-3 Program Blocks Prof. Dr. Hani Mahdi Department of Computer Science Al-Isra University, Amman, Jordan Assembler Design 2. Basic Assembler Functions 2.2 Machine Dependent

More information

Practical Malware Analysis

Practical Malware Analysis Practical Malware Analysis Ch 4: A Crash Course in x86 Disassembly Revised 1-16-7 Basic Techniques Basic static analysis Looks at malware from the outside Basic dynamic analysis Only shows you how the

More information

PESIT Bangalore South Campus Department of MCA Course Information for. System Programming (13MCA24)

PESIT Bangalore South Campus Department of MCA Course Information for. System Programming (13MCA24) PESIT Bangalore South Campus Department of MCA Course Information for System Programming (13MCA24) 1.GENERAL INFORMATION Academic Year: 2015 Semester(s): 2 nd Title Code Duration (hrs) Lectures 48 Hrs

More information

VARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad

VARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad Introduction to MS-DOS Debugger DEBUG In this laboratory, we will use DEBUG program and learn how to: 1. Examine and modify the contents of the 8086 s internal registers, and dedicated parts of the memory

More information

8086 ALP TOOLS (CH 2) CHAPTER 2

8086 ALP TOOLS (CH 2) CHAPTER 2 1 CHAPTER 2 In this chapter, we shall discuss the Assembly Language Program development tools, PC memory structure and Assembler directives. Books to be Referred: 1. Microprocessors and Interfacing 2nd

More information

Lecture-30 Assemblers To assemble a program automatically the assembler needs information in the form of assembler direct that controls the assembly.

Lecture-30 Assemblers To assemble a program automatically the assembler needs information in the form of assembler direct that controls the assembly. Lecture-30 Assemblers To assemble a program automatically the assembler needs information in the form of assembler direct that controls the assembly. E.g. the assembler must be told at what address to

More information

reply db y prompt db Enter your favourite colour:, 0 colour db 80 dup(?) i db 20 k db? num dw 4000 large dd 50000

reply db y prompt db Enter your favourite colour:, 0 colour db 80 dup(?) i db 20 k db? num dw 4000 large dd 50000 Declaring Variables in Assembly Language As in Java, variables must be declared before they can be used Unlike Java, we do not specify a variable type in the declaration in assembly language Instead we

More information

Chapter 2 Assemblers. PDF created with FinePrint pdffactory Pro trial version

Chapter 2 Assemblers. PDF created with FinePrint pdffactory Pro trial version Chapter 2 Assemblers 1 PDF created with FinePrint pdffactry Pr trial versin www.pdffactry.cm Outline 2.1 Basic Assembler Functins 2.2 Machine-Dependent Assembler Features 2.3 Machine-Independent Assembler

More information

UNIT I. Pune Vidyarthi Griha s COLLEGE OF ENGINEERING, NASHIK-4. 1

UNIT I. Pune Vidyarthi Griha s COLLEGE OF ENGINEERING, NASHIK-4. 1 Pune Vidyarthi Griha s COLLEGE OF ENGINEERING, NASHIK-4. 1 UNIT I Introduction: Components of System Software: Text editors, Loaders, Assemblers, Macro processors, Compilers, Debuggers. Machine Structure,

More information

ASSEMBLERS. Prof. S.J. Soni, SPCE, Visnagar

ASSEMBLERS. Prof. S.J. Soni, SPCE, Visnagar ASSEMBLERS Prof. S.J. Soni, SPCE, Visnagar Design Specifications Identify the information necessary to perform a task Design a suitable data structure to record the information Determine the processing

More information

UNIT 4. Modular Programming

UNIT 4. Modular Programming 1 UNIT 4. Modular Programming Program is composed from several smaller modules. Modules could be developed by separate teams concurrently. The modules are only assembled producing.obj modules (Object modules).

More information

UNIT-IV: MACRO PROCESSOR

UNIT-IV: MACRO PROCESSOR UNIT-IV: MACRO PROCESSOR A Macro represents a commonly used group of statements in the source programming language. A macro instruction (macro) is a notational convenience for the programmer o It allows

More information

Assembly Language programming (1)

Assembly Language programming (1) EEE3410 Microcontroller Applications LABORATORY Experiment 1 Assembly Language programming (1) Name Class Date Class No. Marks Familiarisation and use of 8051 Simulation software Objectives To learn how

More information

Microprocessor. By Mrs. R.P.Chaudhari Mrs.P.S.Patil

Microprocessor. By Mrs. R.P.Chaudhari Mrs.P.S.Patil Microprocessor By Mrs. R.P.Chaudhari Mrs.P.S.Patil Chapter 1 Basics of Microprocessor CO-Draw Architecture Of 8085 Salient Features of 8085 It is a 8 bit microprocessor. It is manufactured with N-MOS technology.

More information

CPU. Fall 2003 CSE 207 Digital Design Project #4 R0 R1 R2 R3 R4 R5 R6 R7 PC STATUS IR. Control Logic RAM MAR MDR. Internal Processor Bus

CPU. Fall 2003 CSE 207 Digital Design Project #4 R0 R1 R2 R3 R4 R5 R6 R7 PC STATUS IR. Control Logic RAM MAR MDR. Internal Processor Bus http://www.engr.uconn.edu/~barry/cse207/fa03/project4.pdf Page 1 of 16 Fall 2003 CSE 207 Digital Design Project #4 Background Microprocessors are increasingly common in every day devices. Desktop computers

More information

Basic Assembly SYSC-3006

Basic Assembly SYSC-3006 Basic Assembly Program Development Problem: convert ideas into executing program (binary image in memory) Program Development Process: tools to provide people-friendly way to do it. Tool chain: 1. Programming

More information

Machine Language Instructions Introduction. Instructions Words of a language understood by machine. Instruction set Vocabulary of the machine

Machine Language Instructions Introduction. Instructions Words of a language understood by machine. Instruction set Vocabulary of the machine Machine Language Instructions Introduction Instructions Words of a language understood by machine Instruction set Vocabulary of the machine Current goal: to relate a high level language to instruction

More information

Principles of Compiler Design

Principles of Compiler Design Principles of Compiler Design Code Generation Compiler Lexical Analysis Syntax Analysis Semantic Analysis Source Program Token stream Abstract Syntax tree Intermediate Code Code Generation Target Program

More information

System Programming. System Software: An Introduction to Systems Programming. Leland L. Beck 3rd Edition Addison-Wesley, 1997

System Programming. System Software: An Introduction to Systems Programming. Leland L. Beck 3rd Edition Addison-Wesley, 1997 System Programming System Software: An Introduction to Systems Programming Leland L. Beck 3rd Edition Addison-Wesley, 1997 1 http://web.thu.edu.tw/ctyang/ 2 http://hpc.csie.thu.edu.tw/ 3 Score List Participation:

More information

CNIT 127: Exploit Development. Ch 1: Before you begin. Updated

CNIT 127: Exploit Development. Ch 1: Before you begin. Updated CNIT 127: Exploit Development Ch 1: Before you begin Updated 1-14-16 Basic Concepts Vulnerability A flaw in a system that allows an attacker to do something the designer did not intend, such as Denial

More information

Intel 8086: Instruction Set

Intel 8086: Instruction Set IUST-EE (Chapter 6) Intel 8086: Instruction Set 1 Outline Instruction Set Data Transfer Instructions Arithmetic Instructions Bit Manipulation Instructions String Instructions Unconditional Transfer Instruction

More information

ADVANCE MICROPROCESSOR & INTERFACING

ADVANCE MICROPROCESSOR & INTERFACING VENUS INTERNATIONAL COLLEGE OF TECHNOLOGY Gandhinagar Department of Computer Enggineering ADVANCE MICROPROCESSOR & INTERFACING Name : Enroll no. : Class Year : 2014-15 : 5 th SEM C.E. VENUS INTERNATIONAL

More information

SPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY

SPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY BACKGROUND Segment The "SEGMENT" and "ENDS" directives indicate to the assembler the beginning and ending of a segment and have the following format label SEGMENT [options] ;place the statements belonging

More information

PESIT Bangalore South Campus

PESIT Bangalore South Campus INTERNAL ASSESSMENT TEST 2 Date : 28/03/2016 Max Marks: 50 Subject & Code : Microprocessor (10CS45) Section: IV A and B Name of faculty: Deepti.C Time: 8:30-10:00 am Note: Answer any complete five questions

More information

CHAPTER SEVEN PROGRAMMING THE BASIC COMPUTER

CHAPTER SEVEN PROGRAMMING THE BASIC COMPUTER CHAPTER SEVEN 71 Introduction PROGRAMMING THE BASIC COMPUTER A computer system as it was mentioned before in chapter 1, it is subdivided into two functional parts: 1 Hardware, which consists of all physical

More information

Week /8086 Microprocessor Programming II

Week /8086 Microprocessor Programming II Week 5 8088/8086 Microprocessor Programming II Quick Review Shift & Rotate C Target register or memory SHL/SAL 0 C SHR 0 SAR C Sign Bit 2 Examples Examples Ex. Ex. Ex. SHL dest, 1; SHL dest,cl; SHL dest,

More information

Programming Model 2 A. Introduction

Programming Model 2 A. Introduction Programming Model 2 A. Introduction Objectives At the end of this lab you should be able to: Use direct and indirect addressing modes of accessing data in memory Create an iterative loop of instructions

More information

ELEG3924 Microprocessor

ELEG3924 Microprocessor Department of Electrical Engineering University of Arkansas ELEG3924 Microprocessor Ch.2 Assembly Language Programming Dr. Jing Yang jingyang@uark.edu 1 OUTLINE Inside 8051 Introduction to assembly programming

More information

ELEG3923 Microprocessor Ch.2 Assembly Language Programming

ELEG3923 Microprocessor Ch.2 Assembly Language Programming Department of Electrical Engineering University of Arkansas ELEG3923 Microprocessor Ch.2 Assembly Language Programming Dr. Jingxian Wu wuj@uark.edu OUTLINE 2 Inside 8051 Introduction to assembly programming

More information

CSCI341. Lecture 22, MIPS Programming: Directives, Linkers, Loaders, Memory

CSCI341. Lecture 22, MIPS Programming: Directives, Linkers, Loaders, Memory CSCI341 Lecture 22, MIPS Programming: Directives, Linkers, Loaders, Memory REVIEW Assemblers understand special commands called directives Assemblers understand macro commands Assembly programs become

More information

Assembly Language Programming of 8085

Assembly Language Programming of 8085 Assembly Language Programming of 8085 1. Introduction A microprocessor executes instructions given by the user Instructions should be in a language known to the microprocessor Microprocessor understands

More information

SRI VENKATESWARA COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF ECE EC6504 MICROPROCESSOR AND MICROCONTROLLER (REGULATION 2013)

SRI VENKATESWARA COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF ECE EC6504 MICROPROCESSOR AND MICROCONTROLLER (REGULATION 2013) SRI VENKATESWARA COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF ECE EC6504 MICROPROCESSOR AND MICROCONTROLLER (REGULATION 2013) UNIT I THE 8086 MICROPROCESSOR PART A (2 MARKS) 1. What are the functional

More information

ASSIST Assembler Replacement User s Guide

ASSIST Assembler Replacement User s Guide ASSIST Assembler Replacement User s Guide Program&Documentation: John R. Mashey Pro ject Supervision : Graham Campbell PSU Computer Science Department Preface This manual is the key reference source for

More information

Assembly Language Programming of 8085

Assembly Language Programming of 8085 Assembly Language Programming of 8085 Topics 1. Introduction 2. Programming model of 8085 3. Instruction set of 8085 4. Example Programs 5. Addressing modes of 8085 6. Instruction & Data Formats of 8085

More information

Model Answer of System Software B. Tech. (4 th Semester Examination) Paper Code: AR Branch: Information Technology

Model Answer of System Software B. Tech. (4 th Semester Examination) Paper Code: AR Branch: Information Technology Model Answer of System Software B. Tech. (4 th Semester Examination) Paper Code: AR-9083 Branch: Information Technology Time Allowed: 3hours Maximum Marks: 100 Part-A (All questions are compulsory) Objective

More information

Objectives. ICT106 Fundamentals of Computer Systems Topic 8. Procedures, Calling and Exit conventions, Run-time Stack Ref: Irvine, Ch 5 & 8

Objectives. ICT106 Fundamentals of Computer Systems Topic 8. Procedures, Calling and Exit conventions, Run-time Stack Ref: Irvine, Ch 5 & 8 Objectives ICT106 Fundamentals of Computer Systems Topic 8 Procedures, Calling and Exit conventions, Run-time Stack Ref: Irvine, Ch 5 & 8 To understand how HLL procedures/functions are actually implemented

More information

CS401 Assembly Language Solved MCQS From Midterm Papers

CS401 Assembly Language Solved MCQS From Midterm Papers CS401 Assembly Language Solved MCQS From Midterm Papers May 14,2011 MC100401285 Moaaz.pk@gmail.com MC100401285@gmail.com PSMD01(IEMS) Question No:1 ( Marks: 1 ) - Please choose one The first instruction

More information

Microprocessors & Assembly Language Lab 1 (Introduction to 8086 Programming)

Microprocessors & Assembly Language Lab 1 (Introduction to 8086 Programming) Microprocessors & Assembly Language Lab 1 (Introduction to 8086 Programming) Learning any imperative programming language involves mastering a number of common concepts: Variables: declaration/definition

More information

Lecture 16: Passing Parameters on the Stack. Push Examples. Pop Examples. CALL and RET

Lecture 16: Passing Parameters on the Stack. Push Examples. Pop Examples. CALL and RET Lecture 1: Passing Parameters on the Stack Push Examples Quick Stack Review Passing Parameters on the Stack Binary/ASCII conversion ;assume SP = 0202 mov ax, 124h push ax push 0af8h push 0eeeh EE 0E F8

More information

IBM PC Hardware CPU 8088, Pentium... ALU (Arithmetic and Logic Unit) Registers. CU (Control Unit) IP.

IBM PC Hardware CPU 8088, Pentium... ALU (Arithmetic and Logic Unit) Registers. CU (Control Unit) IP. IBM PC Hardware CPU 8088, 8086 80286 80386 80486 Pentium... ALU (Arithmetic and Logic Unit) Registers CU (Control Unit) IP Memory ROM BIOS I/O RAM OS Programs Video memory BIOS data Interrupt Vectors Memory

More information

Memory Organization. 27 December 2016 Pramod Ghimire. Slide 1 of 21

Memory Organization. 27 December 2016 Pramod Ghimire. Slide 1 of 21 Memory Organization Slide 1 of 21 The assembler uses two basic formats for developing software. One method uses memory models and the other uses fullsegment definitions. MASM uses memory models. The TASM

More information

MIPS (SPIM) Assembler Syntax

MIPS (SPIM) Assembler Syntax MIPS (SPIM) Assembler Syntax Comments begin with # Everything from # to the end of the line is ignored Identifiers are a sequence of alphanumeric characters, underbars (_), and dots () that do not begin

More information

UNIT-II. Part-2: CENTRAL PROCESSING UNIT

UNIT-II. Part-2: CENTRAL PROCESSING UNIT Page1 UNIT-II Part-2: CENTRAL PROCESSING UNIT Stack Organization Instruction Formats Addressing Modes Data Transfer And Manipulation Program Control Reduced Instruction Set Computer (RISC) Introduction:

More information

An Assembler Written in SAS Ed Heaton, Westat, Rockville, MD

An Assembler Written in SAS Ed Heaton, Westat, Rockville, MD Paper 607 An Assembler Written in SAS Ed Heaton, Westat, Rockville, MD ABSTRACT Is SAS a programming language, i.e. can it handle problems typically in the domain of a real language like C? To prove the

More information

CS401 - Computer Architecture and Assembly Language Programming Glossary By

CS401 - Computer Architecture and Assembly Language Programming Glossary By CS401 - Computer Architecture and Assembly Language Programming Glossary By absolute address : A virtual (not physical) address within the process address space that is computed as an absolute number.

More information

SOEN228, Winter Revision 1.2 Date: October 25,

SOEN228, Winter Revision 1.2 Date: October 25, SOEN228, Winter 2003 Revision 1.2 Date: October 25, 2003 1 Contents Flags Mnemonics Basic I/O Exercises Overview of sample programs 2 Flag Register The flag register stores the condition flags that retain

More information

Question Bank Part-A UNIT I- THE 8086 MICROPROCESSOR 1. What is microprocessor? A microprocessor is a multipurpose, programmable, clock-driven, register-based electronic device that reads binary information

More information

EC 333 Microprocessor and Interfacing Techniques (3+1)

EC 333 Microprocessor and Interfacing Techniques (3+1) EC 333 Microprocessor and Interfacing Techniques (3+1) Lecture 6 8086/88 Microprocessor Programming (Arithmetic Instructions) Dr Hashim Ali Fall 2018 Department of Computer Science and Engineering HITEC

More information

Lecture #2 January 30, 2004 The 6502 Architecture

Lecture #2 January 30, 2004 The 6502 Architecture Lecture #2 January 30, 2004 The 6502 Architecture In order to understand the more modern computer architectures, it is helpful to examine an older but quite successful processor architecture, the MOS-6502.

More information

Computer Organization & Assembly Language Programming. CSE 2312 Lecture 15 Addressing and Subroutine

Computer Organization & Assembly Language Programming. CSE 2312 Lecture 15 Addressing and Subroutine Computer Organization & Assembly Language Programming CSE 2312 Lecture 15 Addressing and Subroutine 1 Sections in 8088 Code TEXT section, for the processor instructions. DATA section for the initialization

More information

Module 3 Instruction Set Architecture (ISA)

Module 3 Instruction Set Architecture (ISA) Module 3 Instruction Set Architecture (ISA) I S A L E V E L E L E M E N T S O F I N S T R U C T I O N S I N S T R U C T I O N S T Y P E S N U M B E R O F A D D R E S S E S R E G I S T E R S T Y P E S O

More information

Ex: Write a piece of code that transfers a block of 256 bytes stored at locations starting at 34000H to locations starting at 36000H. Ans.

Ex: Write a piece of code that transfers a block of 256 bytes stored at locations starting at 34000H to locations starting at 36000H. Ans. INSTRUCTOR: ABDULMUTTALIB A H ALDOURI Conditional Jump Cond Unsigned Signed = JE : Jump Equal JE : Jump Equal ZF = 1 JZ : Jump Zero JZ : Jump Zero ZF = 1 JNZ : Jump Not Zero JNZ : Jump Not Zero ZF = 0

More information