0% found this document useful (0 votes)
39 views6 pages

Mic Unit-2 Msbte Que

Uploaded by

Gaurang Rane
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
0% found this document useful (0 votes)
39 views6 pages

Mic Unit-2 Msbte Que

Uploaded by

Gaurang Rane
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
You are on page 1/ 6
¢_| List assembly language programming tools. |__ 2m ‘Ans 1. Editors Each 4M 2. Assembler 3. Linker 4. Debugger. e_ | Draw flowchart for multiplication of two 16 bit numbers, {2m ‘Ans Correct start flowchart: Sse 2M(consider any relevant oar flowchart a also) Dx. KE OHH oe iProguct 1e Ax regal SOx ¢_| State the role Debugger in assembly language programming. | 2M ‘Ans | Debugger: Debugger is the program that allows the extension oF program in | Explanation: single step mode under the control of the user. 2M ‘The process of locating & correcting errors using a debugger is known as Debugger. Some examples of debugger are DOS debug command Borland turbo debugger TD. Microsoft debugger known as code view ev. etc... ¢_| Explain assembly language program development steps. | aM ‘Ans | 1. Defining the problem: The first step in writing program is to think very | Correct steps carefully about the problem that the program must solve, 4M 2. Algorithm: The formula or sequence of operations to be performed by the program can be specified as a step in general English is called algorithm, 3. Flowchart: The flowchart is a graphically representation of the program operation or task. 4. Initialization checklist: Initialization task is to make the checklist of entire variables, constants, all the registers, flags and programmable ports 5. Choosing instructions: Choose those instructions that make program smaller in size and more importantly efficient in execution, 6. Converting algorithms to assembly language program: Every step in the algorithm is converted into program statement using correct and efficient instructions or group of instructions. Write an ALP to add two 16-bit numbers. am. DATA SEGMENT NUMBER1 DW 67531, NUMBER? DW 5856H SUM DW 0 DATA ENDS CODE SEGMENT ASSUME CS: CODE, DS: DATA START: MOV AX, DATA Data segment initialization 1M, Code segment 3M MOV DS, AX MOV AX, NUMBERI MOV BX, NUMBER2 ADD AX, BX MOV SUM, AX MOV AH, 4CH INT 21H CODE ENDS END START Explain the use of assembler directives. 1) DW 2) EQU 3) ASSUME 4) OFFSET 5) SEGMENT 6) EVEN 2M. ‘Ans DW (DEFINE WORD) ‘The DW directive is used to tell the assembler to define a variable of type word or to reserve storage locations of type word in memory. The statement MULTIPLIER DW 437AH, for example, declares a variable of type word named MULTIPLIER, and initialized with the value 437AH when the program is loaded into memory to be run. EQU (EQUATE) EQU is used to give a name to some value or symbol. Each time the assembler finds the given name in the program, it replaces the name with the value or symbol you equated with that name. Each Directive Use: IM each Example Data SEGMENT Numl EQU 50H Num2 EQU 66H Data ENDS ‘Numeric value 50H and 66H are assigned to Num| and Num2. ASSUME ASSUME tells the assembler what names have been chosen for Code, Data Extra and Stack segments. Informs the assembler that the register CS is to be initialized with the address allotted by the loader to the label CODE and DS is similarly initialized with the address of label DATA. OFFSET OFFSET is an operator, which tells the assembler to determine the offset or displacement of a named data item (variable), a procedure from the start of the segment, which contains it Example MOV BX; OFFSET PRICES; Itwill determine the offset of the variable PRICES from the start of the segment in which PRICES is defined and will load this value into BX, SEGMENT The SEGMENT directive is used to indicate the start of a logical segment. Preceding the SEGMENT directive is the name you want to give the segment. For example, the statement CODE SEGMENT indicates to the assembler the start of a logical segment called CODE. The SEGMENT and ENDS directive are used to “bracket” a logical segment containing code of data EVEN (ALIGN ON EVEN MEMORY ADDRESS) As an assembler assembles a section of data declaration or instruction statements, it uses a location counter to keep track of how many bytes it is from the start of a segment at any time, The EVEN directive tells the assembler to increment the location counter to the next even address, if it is not already at an even address. A NOP instruction will be inserted in the location incremented over. ¢_ | Explain any two assembler directives of 8086. 4M ‘Ans | 1. DB - The DB directive is used to declare a BYTE -2-BYTE variable — A | Explanation BYTE is made up of 8 bits. for each for Declaration examples: any (wo assembler Bytel DB 10h directives: 2 M Byte? DB 255; OFFh, the max. possible for a BYTE CRLF DB ODh, OAh, 24h ;Carriage Return, terminator BYTE 2. DW — The DW directive is used to declare a WORD type variable — A WORD occupies 16 bits or (2 BYTE). Declaration examples: Word DW 1234h Word? DW 65535; OFFFFh, (the max. possible for a WORD) 3. DD — The DD directive is used to declare a DWORD ~ A DWORD double word is made up of 32 bits =2 Word's or 4 BYTE. Declaration examples’ Dword] DW 12345678h Dword2 DW 4294967295 ;0FFFFFFFFh. 4, EQU - The EQU directive is used to give name to some value or symbol. Each time the assembler finds the given names in the program, it will replace the name with the value or a symbol. The value can be in the range 0 through 65535 and it can be another Equate declared anywhere above or below. The following operators can also be used to declare an Equate: THIS BYTE THIS WORD THIS DWORD ‘A variable ~ declared with a DB, DW, or DD directive ~ has an address and has space reserved at that address for it in the COM file, But an Equate does not have an address or space reserved for it in the COM file. Example: A—Byte EQU THIS BYTE DB 10 A_ word EQU THIS WORD DW 1000 A_dword EQU THIS DWORD DD 4294967295 Buffer Size EQU 1024 Buffer DB 1024 DUP (0) Buffed_ ptr EQU § ; actually points to the next byte after the; 1024th byte in butter. 5. SEGMENT: Itis used to indicate the start of a logical segment. It is the name given to the segment, Example: the code segment is used (0 indicate to the assembler the start of logical segment. 6. PROC: (PROCEDURE) It is used to identify the start of a procedure. It follows a name we give the procedure. After the procedure the term NEAR and FAR is used to specify the procedure Example: SMART-DIVIDE PROC FAR identifies the start of procedure named SMART-DIVIDE and tells the assembler that the procedure is far. b [Demonstrate in detail the program development steps in assembly] 6M language programming. ‘Ans | Program Development steps Each step: 1. Defining the problem a The first step in writing program is to think very carefully about the | (Flowchart problem that you want the program to solve. symbols are 2. Algorithm optional) The formula or sequence of operations or task need to perform by your program can be specified as a step in general English is called algorithm, 3. Flowchart ‘The flowchart is a graphically representation of the program operation or task. Favela Sjubos ES / 7 / Inpwoupat / oo on (encase) CY \ )} Conmtor A b) Vans) m checklist Initialization task is to make the checklist of entire variables, constants, all the registers, flags and programmable ports. 5. Choosing instructions We should choose those instructions that make program smaller in size and more importantly efficient in execution. 6. Converting algorithms to assembly language program Every step in the algorithm is converted into program statement using correct and efficient instructions or group of instructions State the function of following assembly language programing tools: oM Assembler (i) Linker (i) Debugger (Assembler 2M each a) Assembler is a program that translates assembly language program to the correct binary code for each instruction ie. machine code and generate the file called as object file with extension .obj. b) It also displays syntax errors in the program, if any. ©) It can also be used to produce list (Ist) which contains assembly language statements, binary codes, and offset address For each instruction. Example; TASM, MASM. iLinker a) Itisa programming tool used to convert Object code into executable program. ») Itcombines if requested .more than one separated assembled modules into one executable ‘Module such as two or more assembly programs. ¢) It generates EXE module Example; TLINK. (ii)Debugger a) Debugger is a program that allows the execution of program in single step mode ‘under the control ofthe user. ») The errors in program can be located and corrected using a debugger. Example; TD.

You might also like