8086 ALP TOOLS (CH 2) CHAPTER 2

Size: px
Start display at page:

Download "8086 ALP TOOLS (CH 2) CHAPTER 2"

Transcription

1 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 Edition, Douglas V Hall 2. Intel Microprocessors 6th Edition, Barry Brey 3. Peter Norton s DOS Guide 4. IBM PC Assembly language programming Peter Abel 5. Hardware and Software of Computers S. K. Bose How the System Works? Turn on the computer power (cold boot). Now, all memory locations are cleared, IP is cleared, CS is set to FFFF. Thus, the first instruction to be executed is at CS:IP or FFFF0h. From here, the control goes to BIOS routines present in Flash or EPROM. The BIOS (Basic I/O System routines) It s a firmware present in a non-volatile memory like ROM Checks and identifies various devices connected to the system Establishes ISR table that contains the vector addresses of the 256 interrupts. (IVT is located from 00000h to 003FFh) Establishes its own data area starting at 00400h Determines whether a disk containing DOS is present and if yes, it accesses the bootstrap loader from the disk. The Bootstrap Loader is a BIOS program in a ROM which is responsible for booting the computer. i.e., it loads the Operating System (OS) (along with necessary DOS files like IO.SYS, MSDOS.SYS, COMMAND.COM etc) from hard disk to the primary memory. Programming Models: Depending on the size of the memory the user program occupies, different types of assembly language models are defined. TINY SMALL MEDIUM All data and code in one segment one data segment and one code segment one data segment and two or more code segments COMPACT one code segment and two or more data segments LARGE any number of data and code segments To designate a model, we use.model directive. General Memory Structure in a Computer: The memory is divided into three parts: Lower 640 KB Transient Program Area (TPA), next 384 KB System area and Extended memory (XMS). But, 8086/8088 based PCs have only 1 MB real memory. So, they have only TPA and System area.

2 2 The TPA holds the OS and other programs to control the system operation. The System area holds Video RAM, Video ROM, BIOS ROM etc,. The DOS controls the way the disk memory is organized and controlled. The BIOS is a collection of programs stored in ROM or Flash memory, to access I/O devices and internal features of the system. IO.SYS is a program that loads into the TPA from the disk whenever MS DOS is started. Device drivers are programs that control installable I/O devices. Windows uses a file called System.ini to load the drivers. The Command.Com program controls the operation of the computer from the keyboard. That is, it processes the DOS commands as they are keyed in. The free TPA area holds application programs as they are executed. The TPA also holds TSR programs that remain in memory in an inactive state until activated thro a hot key or thro a command. Differences between.com programs and.exe programs: COM programs are smaller than EXE programs An EXE program may be of any size, whereas a COM file size is limited to 64KB (one segment), including Program segment prefix (PSP). For EXE file, stack should be explicitly specified; for COM, DOS creates the stack on its own. An entire COM program consists of one code segment (max 64K) including PSP, data and stack area. An EXE contains a 512 byte header preceding the program, whereas COM does not require a header For COM, no need to initialize DS register A COM program uses the directive ORG 100h to indicate that user program addressing begins at an offset 100h from the beginning of the PSP. A. Assembly Language Development Tools: 1. EDITOR: It s a system software (program) which allows users to create a file containing assembly instructions and statements. Ex: Wordstar, DOS Editor, Norton Editor Using the editor, you can also edit/delete/modify already existing files. While saving, you must give the file extension as.asm. Follow the AL syntax while typing the programs Editor stores the ASCII codes for the letters and numbers keyed in. Any statement beginning with semicolon is treated as comment. When you typed all your program, you have to save the file on the disk. This file is called source file, having a.asm extension. The next step is to convert this source file into a machine executable.obj file.

3 3 2. ASSEMBLER: An assembler is a system software (program) used to translate the assembly language mnemonics for instructions to the corresponding binary codes. An assembler makes two passes thro your source code. On the first pass, it determines the displacement of named data items, the offset of labels etc., and puts this information in a symbol table. On the second pass, the assembler produces the binary code for each instruction and inserts the offsets, etc., that is calculated during the first pass. The assembler checks for the correct syntax in the assembly instructions and provides appropriate warning and error messages. You have to open your file again using the editor to correct the errors and reassemble it using assembler. Unless all the errors are corrected, the program cannot be executed in the next step. The assembler generates two files from the source file; the first file, called the object file having an extension.obj which contains the binary codes for instructions and information about the addresses of the instructions. The second file is called list file with an extension.lst. This file contains the assembly language statements, the binary codes for each instruction, and the offset for each inst. It also indicates any syntax errors or typing errors in the source program. Note: The assembler generates only offsets (i.e., effective addresses), not absolute physical addresses. 3. LINKER: It s a program used to join several object files into one large object file. For large programs, usually several modules are written and each module is tested and debugged. When all the modules work, their object modules can be linked together to form a complete functioning program. The LINK program must be run on.obj file. The linker produces a link file which contains the binary codes for all the combined modules. The linker also produces a link map file which contains the address information about the linked files. The linker assigns only relative addresses starting from zero, so that this can be put anywhere in physical primary memory later (by another program called locator or loader ). Therefore, this file is called relocatable. The linker produces link files with.exe extension. Object modules of useful programs (like square root, factorial etc) can be kept in a library, and linked to other programs when needed. 4. LOADER (LOCATOR): It s a program used to assign absolute physical addresses to the segments in the.exe file, in the memory. IBM PC DOS environment comes with EXE2BIN loader program. The.exe file is converted into.bin file. The physical addresses are assigned at run time by the loader. So, assembler does not know about the segment starting addresses at the time program being assembled.

4 4 5. DEBUGGER: If your program requires no external hardware, you can use a program called debugger to load and run the.exe file. A debugger is a program which allows you to load your object code program into system memory, execute the program and troubleshoot or debug it. The debugger also allows you to look at the contents of registers and memory locations after you run your program. The debugger allows you to change the contents of registers & memory locations and rerun the program. Also, if facilitates to set up breakpoints in your program, single step feature, and other easy-to-use features. If you are using a prototype SDK 86 board, the debugger is usually called monitor program. We would be using the development tool MASM 6.0 or higher version from Microsoft Inc. MASM stands for Microsoft Macro Assembler. Another assembler TASM (Turbo Assembler) from Borland International is also available. How to Write and Execute your ALP using MASM? 1. Type EDIT at the command prompt (C:\>\MASM\). A window will be opened with all the options like File, Edit etc., In the workspace, type your program according to the assembly language syntax and save the file with a.asm extension. (say addn.asm) 2. Exit the Editor using File menu or pressing ALT +F +X. 3. At the prompt, type MASM addn.asm if your file is named as addn.asm. Press Enter key 2 or 3 times. The assembler checks the syntax of your program and creates.obj file, if there are no errors. Otherwise, it indicates the error with line numbers. You have to correct the errors by opening your file with EDIT command and changing your instructions. Come back and again assemble your program using MASM command. This has to continue until MASM displays 0 Severe Errors. There may still be Warning Errors. Try to correct them also. 4. Once you get the.obj file from step 3, you have to create the.exe file. At the prompt, type LINK addn.obj and press Enter key. (Note that you have to give the extension now as.obj and not as.asm ). If there are no linker errors, linker will create a.exe file of your program. Now, your program is ready to run. 5. There are two ways to run your program. a) If your program accepts user inputs thro keyboard and displays the result on the screen, then you can type the name of the file at the prompt and press Enter key. Appropriate messages will be displayed. 6. If your program works with memory data and if you really want to know the contents of registers, flags, memory locations assigned, opcodes etc., then type CV addn (file name) at the prompt. Another window will be opened with your program, machine codes, register contents etc., Now, you also get a prompt > sign within CV window. Here you can use d command to display memory contents, E command to enter data into memory and g command to execute your program. Also, you can single step thro your program using the menu options. In many ways, CV (Code View) is like Turbo C environment.

5 5 B. Assembler Directives Assembler Directives, also called as pseudo operations are the commands issued to the assembler for many system related tasks such as: variable labeling, memory assignment, reserving memory storage, identifying beginning & end of the program etc,. These directives can be used with Intel macro assembler (ASM80), Borland Turbo Assembler (TASM) and IBM macro assembler (MASM). Depending on the type of functions performed, assembler directives are classified. 1. Segment Definition and Initialization Directives: a) SEGMENT and ENDS directives: These directives are used to define the beginning and end of a logical segment. That is, they are used to identify a group of data items or a group of instructions that you want to put together logically in a segment. When you set up a logical segment, you have to name it. A logical segment is not given a physical starting address when it is declared. (For the sake of clarity, directives are written in bold type) Syntax: Segment name SEGMENT Body of a logical segment (data or code) Segment name ENDS Ex: Ex: Variable name DATA_SEG SEGMENT NUM DB 2 DUP (0) NUM1 DW 12A2H DATA_SEG ENDS Data SEGMENT Data1 DB? Data2 DW? Data ENDS Directive b) ASSUME directive: Code SEGMENT START: MOV AX,BX Code ENDS It is used to inform the assembler the name of the logical segment it should use for a specified physical segment. That is, it tells about how to link the logical segments to the actual segment definition. An 8086 program may have several logical segments. 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, say CODE. DS is similarly initialized with the address of label, sat DATA, etc,. Ex: DATA_HERE SEGMENT

6 6 N1 DB 10, 0AH, 20 DATA_HERE ENDS CODE_HERE SEGMENT ASSUME CS: CODE_HERE, DS:DATA_HERE... MOV AX, 2222 Prog. instructions CODE_HERE ENDS Here, for example, the statement ASSUME CS: CODE_HERE, tells the assembler that the instructions for the program are available in a logical segment named CODE_HERE. Note that, the ASSUME directive does not load the segment starting address into the corresponding segment registers of the CPU. c) ORG directive: As the assembler assembles the program statements or data declarations, it uses a location counter to keep track of how many bytes it is from the start of a segment at any time. The location counter is automatically set to 0000h when the assembler starts reading a segment. The ORG directive allows the user to set the location counter to any value desired. For example, within the data segment, if you write ORG 100h, then the first data item declared there will be available at an offset of 100h from the starting of the data segment. Changes the starting offset address of the data in the data segment Ex: ORG 100H d) EXIT Used to Exit to DOS from MASM environment (can be used before END directive) e) END directive: It is put after the last statement of a program to tell the assembler that this is the end of program module. There should be only one END directive in your program. 2. Storage Allocation and Reservation directives: a) DB, DW, DD: (Define Byte, Define Word, Define Double Word) These directives are used to assign names to variables in your programs. DB directive is used to declare a byte-type variable and to set aside one or more storage locations of type byte in memory. DW directive is used to declare a variable of type word and to reserve one or more storage locations of type word in memory. DD directive is used to declare a variable of type Double word (32-bits or 4 bytes) and to reserve one or more storage locations of type double word in memory. Ex: NUM DB 23H ; name a memory locn NUM and initialize with data 23h LOC DB? ; Reserve a memory locn LOC, but value is not initialized. N1 DB 11, 22, 33 ; reserve 3 locations starting from N1 and put the values msg DB HELLO ; store ASCII values for the string in mem starting from msg SUM DW? ; reserve two memory locations from SUM and uninitialize Note: To reserve or assign large number of locations, use DUP operator.

7 7 Ex: DATA1 db 50d Dup (?) ; reserve 50 locations starting from DATA1 in memory LOCN dw 20d Dup (0) ; reserve 40 locations and all are initialized to value 0 Note: If you want to assign a specific data type to a variable, then PTR attribute operator is used. You can use either BYTE PTR (for byte operations) or WORD PTR (for word operations) operators. Ex: NUM1 dw 0A345h ; any value (number) must start with a digit (0 to 9) MOV AL, NUM1 ; illegal since NUM1 is of type DW. MOV AL, BYTE PTR NUM1 ; AL will be loaded with value 45h. b) DQ, DT (Define Quad word, Define Ten bytes) The operation is similar to DB, DD or DW. Used to declare and reserve memory locations and to initialize the values. c) EQU (Equate) This directive 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. Equates a numeric, ASCII or label to another label. Ex: Data SEGMENT Num1 EQU 50H Num2 EQU 66H Data ENDS Numeric value 50H and 66H are assigned to Num1 and Num2 3. Attribute Operators: a) OFFSET: It s an operator which tells the assembler to determine the offset or displacement of a named data item or variable from the start of the segment which contains it. This is used to load the offset of a variable into a register, so that the variable can be accessed using one of the indexed modes. Ex: if you declared a variable as Num db 20h in the data segment, then, in the code segment you can write mov bx, OFFSET Num ; bx = address of NUM. mov al, [bx] ; now al =20h Note: If you write, mov bx, Num ; bx = 0020h,i.e., the contents of Num will be loaded. But if you use OFFSET operator, you get the address on the variable. b) LENGTH: It s an operator which tells the assembler to determine the number of elements in some named data item such as string or array, That is, it returns the number of units assigned to a variable. Ex: Suppose you declare SUM db 50 Dup (?) in the data segment. Then, in the code segment, if you write the instruction, mov cx, LENGTH Sum ; then cx = 50d. Similarly, if you declare, Array dw 50 dup (?), then mov cx, LENGTH Array, will again return cx = 50d. That is, LENGTH simply tells the number of elements available irrespective of the data type.

8 8 c) SIZE: It s an operator which tells the assembler to determine the number of bytes available in the given string or array. Considering the above examples, SUM db 50 Dup (?) mov cx, SIZE Sum ; then cx = 50d. (This is same as LENGTH operator) But if, Array dw 50 dup (?) is declared, Then, mov cx, SIZE Array ; cx = 100d (since Array is of type DW, there are 100 bytes available) d) PTR (Pointer): It s used to assign a specific type to a variable or to a label. For example, if you write an instructions like MOV bx, 2000h ; point bx reg to address 2000 INC [bx] ; the assembler will not know whether to increment the byte at 2000 or word at 2000 & 2001h. In such cases, PTR operator is used, and you re write the instruction as: INC BYTE PTR [bx] or INC WORD PTR [bx]. The PTR operator can also be used to override the declared type of a variable. For example, if you declare Num dw 1223h, and if you write in your program the instruction: mov al, BYTE PTR Num ; then, only one 8-bit data (23h) will be accessed and loaded into al register. PTR operator is also useful for indirect Jump instructions. If you want a near jump, you can specify as Jmp WORD PTR [bx], provided bx has the target address. e) TYPE: The TYPE operator tells the assembler to determine the type of a specified variable. The assembler determines the number of bytes associated with that variable. For a byte-type variable, the assembler will give a value 1; for word-type variable, the value is 2. It can be used for auto increment mode of operation. Ex: if you write an instruction like, Add si, TYPE Array SI will be added with value 1 if Array is defined with DB directive, with a value 2 if if Array is defined with DW directive and so on. 4. Miscellaneous Directives: a) PROC and ENDP directives: The PROC directive is used to identify the start of a procedure. PROC is preceded by a procedure name given by the user. After the PROC directive, the label NEAR or FAR is used to identify the type of the procedure. If the procedure is written within the same code segment where the main program resides, it s called a NEAR procedure. If the procedure is written in a different code segment, then it s called FAR procedure. The ENDP directive is used to indicate the end of the procedure. The procedure is called from the main program using CALL instruction. PROC & ENDP: indicate the start and end of the procedure. They require a label to indicate the name of the procedure. NEAR: the procedure resides in the same code segment. (Local)

9 9 FAR: resides at any location in the memory. Ex: Fact PROC Near ; definition of a procedure... ; body of the procedure Fact ENDP Ex: Add PROC NEAR ADD AX,BX MOV CX,AX RET Add ENDP PROC directive stores the contents of the register in the stack. b) EVEN (Align on Even Memory address) As discussed, the assembler uses a location counter to keep track of the statements in the program. 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. That is, the addresses of all variables declared and all instructions in the program are aligned at even addresses only. This is done to increase the speed of accessing the memory. NOP instruction is inserted at the appropriate places to facilitate this. c) GROUP (Group the related segments) It is used to inform the assembler to form logical group of all segments mentioned after the word GROUP. That is, all such segments and labels can be addressed using one name and same group segment base address. Ex: Main GROUP Code, Data, Stack Now, it directs the linker to prepare an EXE file such that Code, Data and Stack segment must lie within 64 KB memory segment named Main. So, you can use the statements like: ASSUME cs:main, ds: Main, ss: Main d) LABEL During the assembly process, whenever the assembler comes across the LABEL directive, it assigns the declared label with the current contents of location counter. The LABEL directive must be followed by a term which specifies the type you want to associate with that name. If the label is used as the destination for a jump or call, then the label must be specified as type NEAR or FAR. If the label is referencing a data item, then the label must be specified as type byte, word or double word. e) SEG (Segment of a label) The SEG operator is used to determine the segment address of the label, variable or procedure. Ex: mov bx, SEG Array ; copy the segment address of label Array and mov ds, bx ; store it in DS register. f) EXTRN (External) The EXTRN directive is used to tell the assembler that the names or labels following this directive are in some other assembly module. For example, if you want to call a procedure assembled at a different time in another program module, you must in your

10 10 program, tell the assembler that the procedure you are using is external. The assembler will then put information in the object code file so that the linker can connect the two modules together. For a reference to a label, you must specify whether the label is Near or Far. Ex: In your program, if you write EXTRN Division Far, it tells the assembler Division is a label of type far in another assembly module. Ex: If you want to call a Factorial procedure of Module1 from Module2 it must be declared as PUBLIC in Module1. Note: Names or labels referred to as external in one module must be declared public with the PUBLIC directive, in the module in which they are actually defined. g) PUBLIC Large programs are generally written as several separate modules. Each module is individually assembled, tested and debugged. When all the modules are working correctly, their object code files are linked together to form the complete program. In order for the modules to link together correctly, any variable name or label referred to in other modules must be declared public in the module in which it is defined. The PUBLIC directive is used to tell the assembler that a specified name or label will be accessed from some other modules. For example, if you write PUBLIC Divisor, Dividend - then these two variables are available to other assembly modules. Note: The PUBLIC and EXTRN directives are used within SEGMENT ENDS brackets. Ex: Mod1 SEGMENT Mod2 SEGMENT PUBLIC Fact Far EXTRN Fact Far Mod1 ENDS Mod2 ENDS Note: The linker will verify that every identifier appearing in an EXTRN statement is matched by a PUBLIC statement. Assembly Language Program Example: 1. Example program using.model directive ; Example to illustrate the usage of Model directive.model SMALL ; Module has one data segment and one code segment.data ; Default name for the data segment ; Define all the variables here NUM DB 20, 20H NUM DB 8 DUP (?) ; End of data segment.code Start: ; This is optional MOV DATA ; load DS reg with MOV DS, AX ; Data seg address MOV AX, NUM ; copy dat from memory into AX MOV BX, NUM ; copy data into reg BX MUL BX ; Multiply (AX)&(BX). Store result in DX & AX reg (32-bit)

11 11 MOV NUM1, AX ; Store low word of result into memory MOV AH, 4CH INT 21H END Start ; END of program /// The program may be written in a different form as below..code.startup ; indicates start of code segment. Also, ; loads DS reg with base address of data segment MOV AX, NUM MOV BX, AX MUL BX MOV NUM1, AX MOV AX, 4C00h INT 21H.EXIT END 2. Program without using.model directive ; Program to illustrate the use of SEGMENT, ENDS and ASSUME directives ; Define all the variables here DATA_HERE SEGMENT NUM DB 20, 20H Body of the logical segment Variable NUM1 DB DUP (?) to define all the variables name DATA_ HERE ENDS CODE_HERE SEGMENT Directive ; Write the Program code here Main : MOV AX, DATA_SEG ; Segment register can t be MOV DS, AX ; loaded with an immediate operand ; use any General purpose register MOV AX, NUM MOV BX, AX MUL BX ; (DX) (AX) (AX) * (BX) MOV NUM1, DX ; Move upper word of product into memory MOV AH, 4CH ; DOS INT 21H INT 21H function to return to DOS CODE_HERE ENDS END Main ; Main label is optional Different ways of initializing Segment base address to DS register: (1) MOV DATA (2) MOV AX, SEG_DATA MOV DS, AX MOV DS,AX (3) MOV BX, _DATA (4) MOV CX, SEG NUM MOV DS, BX MOV DS, CX

12 12 Summary: Assembler is a program that accepts an assembly language program as input and converts it into an object module and prepares for loading the program into memory for execution. Loader (linker) further converts the object module prepared by the assembler into executable form, by linking it with other object modules and library modules. The final executable map of the assembly language program is prepared by the loader at the time of loading into the primary memory for actual execution. The assembler prepares the relocation and linkages information (subroutine, ISR) for loader. The operating system that actually has the control of the memory, passes the memory address at which the program is to be loaded for execution and the map of the available memory to the loader. Based on this information and the information generated by the assembler, the loader generates an executable map of the program and further physically loads it into the memory and transfers control to for execution. Thus the basic task of an assembler is to generate the object module and prepare the loading and linking information. Operation of an Assembler: Assembling a program proceeds statement by statement sequentially. The first phase of assembling is to analyze the program to be converted. This phase is called Pass1 defines and records the symbols, pseudo operands and directives. It also analyses the segments used by the program types and labels and their memory requirements. The second phase l (Pass2) looks for the addresses and data assigned to the labels. It also finds out codes of the instructions from the instruction machine, code database and the program data. It processes the pseudo operands and directives. It is the task of the assembler designer to select the suitable strings for using them as directives, pseudo operands or reserved words and decides syntax.

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

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

Q. State and Explain steps involved in program development. [w-08, w-10, s-12, w-11]

Q. State and Explain steps involved in program development. [w-08, w-10, s-12, w-11] Q. State and Explain steps involved in program development. [w-08, w-10, s-12, w-11] Answer: 1. Defining Problem 2. Algorithm 3. Flowchart 4. Initialization of checklist 5. Choosing instructions 6. Converting

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

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

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

Constants and Expressions. Lecture 7: Assembly Language Programs. Constants and Expressions (cont.) Statements. Names. Assembly Directives

Constants and Expressions. Lecture 7: Assembly Language Programs. Constants and Expressions (cont.) Statements. Names. Assembly Directives Lecture 7: Assembly Language Programs Basic elements of assembly language Assembler directives Data allocation directives Data movement instructions Assembling, linking, and debugging Using TASM Constants

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

EEM336 Microprocessors I. Data Movement Instructions

EEM336 Microprocessors I. Data Movement Instructions EEM336 Microprocessors I Data Movement Instructions Introduction This chapter concentrates on common data movement instructions. 2 Chapter Objectives Upon completion of this chapter, you will be able to:

More information

16-Bit Intel Processor Architecture

16-Bit Intel Processor Architecture IBM-PC Organization 16-Bit Intel Processor Architecture A-16 bit microprocessor can operate on 16 bits of data at a time. 8086/8088 have the simplest structure 8086/8088 have the same instruction set,

More information

Experiment 3 3 Basic Input Output

Experiment 3 3 Basic Input Output Experiment 3 3 Basic Input Output Introduction The aim of this experiment is to introduce the use of input/output through the DOS interrupt. Objectives: INT Instruction Keyboard access using DOS function

More information

Chapter 3: Addressing Modes

Chapter 3: Addressing Modes Chapter 3: Addressing Modes Chapter 3 Addressing Modes Note: Adapted from (Author Slides) Instructor: Prof. Dr. Khalid A. Darabkh 2 Introduction Efficient software development for the microprocessor requires

More information

PESIT Bangalore South Campus

PESIT Bangalore South Campus INTERNAL ASSESSMENT TEST 2 Date : 02/04/2018 Max Marks: 40 Subject & Code : Microprocessor (15CS44) Section : IV A and B Name of faculty: Deepti.C Time : 8:30 am-10:00 am Note: Note: Answer any five complete

More information

Assembly Language: g Part III. First Semester 2013 Department of Computer Science Faculty of Science Chiang Mai University

Assembly Language: g Part III. First Semester 2013 Department of Computer Science Faculty of Science Chiang Mai University System Programming with Assembly Language: g Part III First Semester 2013 Department of Computer Science Faculty of Science Chiang Mai University Outline A Few Basic Instructions Translation of high Level

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

Assembling, Linking and Executing 1) Assembling: .obj obj .obj.lst .crf Assembler Types: a) One pass assembler:

Assembling, Linking and Executing 1) Assembling: .obj obj .obj.lst .crf Assembler Types: a) One pass assembler: Assembling, Linking and Executing 1) Assembling: - Assembling converts source program into object program if syntactically correct and generates an intermediate.obj file or module. - It calculates the

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

Microprocessor and Assembly Language Week-5. System Programming, BCS 6th, IBMS (2017)

Microprocessor and Assembly Language Week-5. System Programming, BCS 6th, IBMS (2017) Microprocessor and Assembly Language Week-5 System Programming, BCS 6th, IBMS (2017) High Speed Memory Registers CPU store data temporarily in these location CPU process, store and transfer data from one

More information

Constants and. Lecture 7: Assembly Language Programs. Expressions (cont.) Constants and. Statements. Expressions

Constants and. Lecture 7: Assembly Language Programs. Expressions (cont.) Constants and. Statements. Expressions Lecture 7: Assembly Language Programs Basic elements of assembly language Assembler directives Data allocation directives Data movement instructions Assembling, linking, and debugging Using TASM Constants

More information

Experiment 3. TITLE Optional: Write here the Title of your program.model SMALL This directive defines the memory model used in the program.

Experiment 3. TITLE Optional: Write here the Title of your program.model SMALL This directive defines the memory model used in the program. Experiment 3 Introduction: In this experiment the students are exposed to the structure of an assembly language program and the definition of data variables and constants. Objectives: Assembly language

More information

CPU. IBM PC and compatible Memory Structure

CPU. IBM PC and compatible Memory Structure CPU The CPU is usually organised in three parts: The Arithmetic and Logic Unit or ALU (which performs computations and comparisons) and the Control Unit which fetches information from and stores information

More information

EC-333 Microprocessor and Interfacing Techniques

EC-333 Microprocessor and Interfacing Techniques EC-333 Microprocessor and Interfacing Techniques Lecture 4 Addressing Modes Dr Hashim Ali Spring - 2018 Department of Computer Science and Engineering HITEC University Taxila Slides taken from Computer

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

CSE 505 Lecture 8: Introduction to Assembly Language

CSE 505 Lecture 8: Introduction to Assembly Language Page1 Advantages of Assembly Language Low-level access to the computer Higher speed Total control over CPU (Must know what you are doing in order to make these advantages work) Disadvantages of assembly

More information

Experiment #5. Using BIOS Services and DOS functions Part 1: Text-based Graphics

Experiment #5. Using BIOS Services and DOS functions Part 1: Text-based Graphics Experiment #5 Using BIOS Services and DOS functions Part 1: Text-based Graphics 5.0 Objectives: The objective of this experiment is to introduce BIOS and DOS interrupt service routines to be utilized in

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

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

Interrupt Services. Which Way is Best? Characteristics. Direct in, out. BIOS Average Average DOS Most Least

Interrupt Services. Which Way is Best? Characteristics. Direct in, out. BIOS Average Average DOS Most Least Interrupt Services Application Programs/OS Shell (command.com) int 10h, and others int 21h, and others (IO.SYS) DOS Services (msdos.sys) BIOS (EEPROM) Hardware (x86, Chipset and Peripherals) BIOS - Basic

More information

Experiment N o 3 Segmentation and Addressing Modes

Experiment N o 3 Segmentation and Addressing Modes Introduction: Experiment N o 3 Segmentation and Addressing Modes In this experiment you will be introduced to physical segmentation of the memory, and the logical segmentation of programs. You will also

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

Computer Architecture and System Software Lecture 06: Assembly Language Programming

Computer Architecture and System Software Lecture 06: Assembly Language Programming Computer Architecture and System Software Lecture 06: Assembly Language Programming Instructor: Rob Bergen Applied Computer Science University of Winnipeg Announcements Assignment 3 due thursday Midterm

More information

Assembly Language. Dr. Esam Al_Qaralleh CE Department Princess Sumaya University for Technology. Overview of Assembly Language

Assembly Language. Dr. Esam Al_Qaralleh CE Department Princess Sumaya University for Technology. Overview of Assembly Language 4345 Assembly Language Assembly Language Dr. Esam Al_Qaralleh CE Department Princess Sumaya University for Technology Assembly Language 3-1 Overview of Assembly Language Advantages: Faster as compared

More information

Experiment N o 3. Segmentation and Addressing Modes

Experiment N o 3. Segmentation and Addressing Modes Introduction: Experiment N o 3 Segmentation and Addressing Modes In this experiment you will be introduced to physical segmentation of the memory, and the logical segmentation of programs. You will also

More information

CC411: Introduction To Microprocessors

CC411: Introduction To Microprocessors CC411: Introduction To Microprocessors OBJECTIVES this chapter enables the student to: Describe the Intel family of microprocessors from 8085 to Pentium. In terms of bus size, physical memory & special

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

CG2007 Microprocessor systems.

CG2007 Microprocessor systems. CG2007 Microprocessor systems Tutorial 1 Semester 2 AY 2011-12 Ganesh Iyer ganesh.vigneswara@gmail.com http://ganeshniyer.com About Me I have 3 years of Industry work experience in Bangalore, India. I

More information

Chapter 3. Assembly Language Programming with 8086

Chapter 3. Assembly Language Programming with 8086 Chapter 3 Assembly Language Programming with 8086 UNIT - III Assembly Language Programming with 8086- Machine level programs, Machine coding the programs, Programming with an assembler, Assembly Language

More information

EE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1. Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University

EE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1. Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University EE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1 Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University What is Assembly Language? Assembly language is a programming language

More information

Microprocessors (A) DOS Services

Microprocessors (A) DOS Services 1 Services 2 System Calls Operating System services: Disk and file system management Screen display and printing Keyboard entry Other I/O management Date and time Program run and terminate Command arguments

More information

EE2007 Microprocessor systems.

EE2007 Microprocessor systems. EE2007 Microprocessor systems Tutorial 1 Semester 1 AY 2010-11 Ganesh Iyer ganesh.vigneswara@gmail.com (facebook, gtalk) http://ganeshniyer.com About Me I have 3 years of Industry work experience in Bangalore,

More information

Computer Architecture and System Software Lecture 07: Assembly Language Programming

Computer Architecture and System Software Lecture 07: Assembly Language Programming Computer Architecture and System Software Lecture 07: Assembly Language Programming Instructor: Rob Bergen Applied Computer Science University of Winnipeg Announcements New assembly examples uploaded to

More information

Topics Introduction to Microprocessors. Chapter 5 Macros and modules. What is macro? How to use macro? (I) How to use macro?

Topics Introduction to Microprocessors. Chapter 5 Macros and modules. What is macro? How to use macro? (I) How to use macro? Topics 2102440 Introduction to Microprocessors Macros Subroutines Modules Chapter 5 Macros and modules Suree Pumrin,, Ph.D. 1 2102440 Introduction to Microprocessors 2 What is macro? It is used to automate

More information

CP/M-86 Compatibility Guide For CP/M-80 Users

CP/M-86 Compatibility Guide For CP/M-80 Users CCGFCU.WS4 ---------- CP/M-86 Compatibility Guide For CP/M-80 Users (= CCGFCU...) Copyright (c) 1980 Digital Research Pacific Grove, California (Revision of 10/21/80) (= 21 October 1980) (Retyped by Emmanuel

More information

Experiment 8 8 Subroutine Handling Instructions and Macros

Experiment 8 8 Subroutine Handling Instructions and Macros Introduction Experiment 8 8 Subroutine Handling Instructions and Macros In this experiment you will be introduced to subroutines and how to call them. You will verify the exchange of data between a main

More information

EC-333 Microprocessor and Interfacing Techniques

EC-333 Microprocessor and Interfacing Techniques EC-333 Microprocessor and Interfacing Techniques Lecture 3 The Microprocessor and its Architecture Dr Hashim Ali Fall - 2018 Department of Computer Science and Engineering HITEC University Taxila Slides

More information

US06CCSC04: Introduction to Microprocessors and Assembly Language UNIT 1: Assembly Language Terms & Directives

US06CCSC04: Introduction to Microprocessors and Assembly Language UNIT 1: Assembly Language Terms & Directives Introduction: US06CCSC04: Introduction to Microprocessors and A microprocessor is the chip containing some control and logic circuits that is capable of a making arithmetic and logical decision based on

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

Mr. Sapan Naik 1. Babu Madhav Institute of Information Technology, UTU

Mr. Sapan Naik 1. Babu Madhav Institute of Information Technology, UTU 5 Years Integrated M.Sc.(IT) Semester 4 060010402 System Programming Question Bank Unit 1: Introduction 1. Write the decimal equivalent for each integral power of 2 from 2! to 2!". 2. Convert the following

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

Machine and Assembly Language Principles

Machine and Assembly Language Principles Machine and Assembly Language Principles Assembly language instruction is synonymous with a machine instruction. Therefore, need to understand machine instructions and on what they operate - the architecture.

More information

BAHAR DÖNEMİ MİKROİŞLEMCİLER LAB3 FÖYÜ

BAHAR DÖNEMİ MİKROİŞLEMCİLER LAB3 FÖYÜ INTRODUCTION OF SEGMENT A typical program on 8086 consists of at least three segments Code segment: Contains instructions that accomplish certain tasks Data segment: Stores information to be processed

More information

CS499. Intel Architecture

CS499. Intel Architecture CS499 Intel Architecture Intel Architecture References IA-32 Intel Architecture Software Developer s Manual, Volume 1: Basic Architecture Volume 2: Instruction Set Reference www.intel.com/design/pentiumii/manuals/

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

Experiment N o 1. 1 Introduction to Assembly Language Programming

Experiment N o 1. 1 Introduction to Assembly Language Programming Experiment N o 1 1 Introduction to Assembly Language Programming Introduction: This experiment introduces the student to assembly language programming. In order to illustrate the basic concepts of assembly

More information

CS-202 Microprocessor and Assembly Language

CS-202 Microprocessor and Assembly Language CS-202 Microprocessor and Assembly Language Lecture 2 Introduction to 8086 Assembly Language Dr Hashim Ali Spring - 2019 Department of Computer Science and Engineering HITEC University Taxila!1 Lecture

More information

Microcomputer Architecture..Second Year (Sem.2).Lecture(2) مدرس المادة : م. سندس العزاوي... قسم / الحاسبات

Microcomputer Architecture..Second Year (Sem.2).Lecture(2) مدرس المادة : م. سندس العزاوي... قسم / الحاسبات 1) Input/output In computing, input/output or I/O, is the communication between an information processing system (such as a computer) and the outside world, possibly a human or another information processing

More information

Summer 2003 Lecture 1 06/09/03

Summer 2003 Lecture 1 06/09/03 Summer 2003 Lecture 1 06/09/03 General Overview of Class: This class is an introduction to the low level operation of microprocessor-based computer systems. We will cover the operation of the Central Processor

More information

Transfer of Control. Lecture 10 JMP. JMP Formats. Jump Loop Homework 3 Outputting prompts Reading single characters

Transfer of Control. Lecture 10 JMP. JMP Formats. Jump Loop Homework 3 Outputting prompts Reading single characters Lecture 10 Jump Loop Homework 3 Outputting prompts Reading single characters Transfer of Control The CPU loads and executes programs sequentially. You d like to be able to implement if statements, gotos,

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

Code segment Stack segment

Code segment Stack segment Registers Most of the registers contain data/instruction offsets within 64 KB memory segment. There are four different 64 KB segments for instructions, stack, data and extra data. To specify where in 1

More information

SHEET-2 ANSWERS. [1] Rewrite Program 2-3 to transfer one word at a time instead of one byte.

SHEET-2 ANSWERS. [1] Rewrite Program 2-3 to transfer one word at a time instead of one byte. SHEET-2 ANSWERS [1] Rewrite Program 2-3 to transfer one word at a time instead of one byte. TITLE PROG2-3 PURPOSE: TRANSFER 6 WORDS OF DATA PAGE 60,132.MODEL SMALL.STACK 64.DATA ORG 10H DATA_IN DW 234DH,

More information

PHY4635/5635 Spring Lecture 8: Program Control Instructions

PHY4635/5635 Spring Lecture 8: Program Control Instructions PHY4635/5635 Spring 2009 Lecture 8: Program Control Instructions Short, Near and Far Jumps Short jump: jump is within +127 to -128 bytes from the address following the jump. Relative jumps : moves with

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

1. Introduction to Assembly Language

1. Introduction to Assembly Language www.vchowk.com 1. Introduction to Assembly Language Solved EXERCISE 1 Note: Dear fellows I tried my best to solve this exercise questions if there s any mistake or doubt in any question correct it and

More information

INT 21H and INT 10H Programming and Macros

INT 21H and INT 10H Programming and Macros Dec Hex Bin 4 4 00000100 ORG ; FOUR INT 21H and INT 10H Programming and Macros OBJECTIVES this chapter enables the student to: Use INT 10H function calls to: Clear the screen. Set the cursor position.

More information

Hardware and Software Architecture. Chapter 2

Hardware and Software Architecture. Chapter 2 Hardware and Software Architecture Chapter 2 1 Basic Components The x86 processor communicates with main memory and I/O devices via buses Data bus for transferring data Address bus for the address of a

More information

Computer Architecture 1 ح 303

Computer Architecture 1 ح 303 Lecture 4 A. Addressing MODES 1. Introduction to assembly language programming: Program is a sequence of commands used to tell a microcomputer what to do. Each command in a program is an instruction Programs

More information

Midterm Exam #2 Answer Key

Midterm Exam #2 Answer Key Midterm Exam #2 Answer Key Name: Student ID #: I have read and understand Washington State University s policy on academic dishonesty and cheating YOU Signed: Problem 1) Consider the following fragment

More information

6/20/2011. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to:

6/20/2011. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to: Introduction Efficient software development for the microprocessor requires a complete familiarity with the addressing modes employed by each instruction. This chapter explains the operation of the stack

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

Assignment 3. Problem Definition:

Assignment 3. Problem Definition: Att (2) Perm(5) Oral(3) Total(10) Sign with Date Assignment 3 Problem Definition: Write x86 ALP to convert 4-digit Hex number into its equivalent BCD number and 4-digit BCD number into its equivalent HEX

More information

Assembly Language. Lecture 3 Assembly Fundamentals

Assembly Language. Lecture 3 Assembly Fundamentals Assembly Language Lecture 3 Assembly Fundamentals Ahmed Sallam Slides based on original lecture slides by Dr. Mahmoud Elgayyar General Concepts CPU Design, Instruction execution cycle IA-32 Processor Architecture

More information

.code. lea dx,msg2. Page 1/8. Problem 1: Programming in Assembly [25 Points]

.code. lea dx,msg2. Page 1/8. Problem 1: Programming in Assembly [25 Points] Problem : Programming in Assembly [ Points] The following assembly program is supposed to: receive three integer numbers from the console, call a function, name sort, function sort arranges the three input

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

Lecture (05) x86 programming 4

Lecture (05) x86 programming 4 Lecture (05) x86 programming 4 By: Dr. Ahmed ElShafee ١ TOC IA32 cont,.. Segmentation Assembler Directives Format of console programs Practical deliverable 01 ٢ Simple Memory Addressing Modes Normal (R)

More information

Mating Assembly with C

Mating Assembly with C 16 Do to others what you want them to do to you. Mating Assembly with C Nothing can beat the efficiency of Assembly language. A good optimizing C compiler will convert C file to a better assembly code.

More information

db "Please enter up to 256 characters (press Enter Key to finish): ",0dh,0ah,'$'

db Please enter up to 256 characters (press Enter Key to finish): ,0dh,0ah,'$' PA4 Sample Solution.model large.stack 100h.data msg1 db "This programs scans a string of up to 256 bytes and counts the repetitions of the number 4206 and sums them.",0dh,0ah,'$' msg2 db "Please enter

More information

Assembler Programming. Lecture 10

Assembler Programming. Lecture 10 Assembler Programming Lecture 10 Lecture 10 Mixed language programming. C and Basic to MASM Interface. Mixed language programming Combine Basic, C, Pascal with assembler. Call MASM routines from HLL program.

More information

Program Control Instructions

Program Control Instructions Program Control Instructions Introduction This chapter explains the program control instructions, including the jumps, calls, returns, interrupts, and machine control instructions. This chapter also presents

More information

LAB WORK NO. 3 TURBO DEBUGGER ENVIRONMENT

LAB WORK NO. 3 TURBO DEBUGGER ENVIRONMENT LAB WORK NO. 3 TURBO DEBUGGER ENVIRONMENT 1. Objective of the lab work The purpose of this lab is to be able to debug programs written in assembly language and general executables, using a debugging tool.

More information

Intel x86 instruction set architecture

Intel x86 instruction set architecture Intel x86 instruction set architecture Graded assignment: hand-written resolution of exercise II 2) The exercises on this tutorial are targeted for the as86 assembler. This program is available in the

More information

Experiment #2. Addressing Modes and Data Transfer using TASM

Experiment #2. Addressing Modes and Data Transfer using TASM 2.0 Objective Experiment #2 Addressing Modes and Data Transfer using TASM The objective of this experiment is to learn various addressing modes and to verify the actions of data transfer. 2.1 Introduction

More information

1.Explain with the diagram IVT of 80X86. Ans-

1.Explain with the diagram IVT of 80X86. Ans- 1.Explain with the diagram IVT of 80X86 In 8086 1 kb from 00000 to 003ff are reserved for interrupt routine as shown in figure known as interrupt vector. It supports 256 interrupt procedures containing

More information

Programming in Module. Near Call

Programming in Module. Near Call Programming in Module Main: sub1: call sub1 sub ax,ax sub1 sub1 proc near sub ax,ax endp sub1 sub1 proc Far sub ax,ax endp Near Call sub1 sub1 Main: call sub1 sub1: sub ax,ax proc near sub ax,ax endp SP

More information

Chapter Three Addressing Mode MOV AX, BX

Chapter Three Addressing Mode MOV AX, BX Chapter Three The 8086 The 8086 When the 8086 executes an instruction, it performs the specified function on data. The data are called its operands and may be part of the instruction reside in one of the

More information

CHAPTER ASSEMBLY LANGUAGE PROGRAMMING

CHAPTER ASSEMBLY LANGUAGE PROGRAMMING CHAPTER 2 8051 ASSEMBLY LANGUAGE PROGRAMMING Registers Register are used to store information temporarily: A byte of data to be processed An address pointing to the data to be fetched The vast majority

More information

EEM336 Microprocessors I. Addressing Modes

EEM336 Microprocessors I. Addressing Modes EEM336 Microprocessors I Addressing Modes Introduction Efficient software development for the microprocessor requires a complete familiarity with the addressing modes employed by each instruction. This

More information

Marking Scheme. Examination Paper Department of CE. Module: Microprocessors (630313)

Marking Scheme. Examination Paper Department of CE. Module: Microprocessors (630313) Philadelphia University Faculty of Engineering Marking Scheme Examination Paper Department of CE Module: Microprocessors (630313) Final Exam Second Semester Date: 02/06/2018 Section 1 Weighting 40% of

More information

Dr. Ramesh K. Karne Department of Computer and Information Sciences, Towson University, Towson, MD /12/2014 Slide 1

Dr. Ramesh K. Karne Department of Computer and Information Sciences, Towson University, Towson, MD /12/2014 Slide 1 Dr. Ramesh K. Karne Department of Computer and Information Sciences, Towson University, Towson, MD 21252 rkarne@towson.edu 11/12/2014 Slide 1 Intel x86 Aseembly Language Assembly Language Assembly Language

More information

b) List the 16 Bit register pairs of 8085?(Any 2 pair, 1 Mark each) 2M Ans: The valid 16 bit register pair of 8085 are

b) List the 16 Bit register pairs of 8085?(Any 2 pair, 1 Mark each) 2M Ans: The valid 16 bit register pair of 8085 are Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate

More information

By: Bhargavi Goswami Assistant Professor Sunshine Group of Institutions Rajkot, Gujarat, India. Mob:

By: Bhargavi Goswami Assistant Professor Sunshine Group of Institutions Rajkot, Gujarat, India.   Mob: Linkers By: Bhargavi Goswami Assistant Professor Sunshine Group of Institutions Rajkot, Gujarat, India. Email: bhargavigoswami@gmail.com Mob: +918140099018 Steps for Execution: Performed By: Translator

More information

ALT-Assembly Language Tutorial

ALT-Assembly Language Tutorial ALT-Assembly Language Tutorial ASSEMBLY LANGUAGE TUTORIAL Let s Learn in New Look SHAIK BILAL AHMED i A B O U T T H E T U TO R I A L Assembly Programming Tutorial Assembly language is a low-level programming

More information

CS401 Assembly Language Solved Subjective MAY 03,2012 From Midterm Papers. MC

CS401 Assembly Language Solved Subjective MAY 03,2012 From Midterm Papers. MC CS401 Assembly Language Solved Subjective MAY 03,2012 From Midterm Papers MC100401285 Moaaz.pk@gmail.com Mc100401285@gmail.com PSMD01 MIDTERM FALL 2011 CS401 Assembly Language Q: Affected flag of AND operation

More information

Assignment no:4 on chapter no :3 : Instruction set of 8086

Assignment no:4 on chapter no :3 : Instruction set of 8086 Assignment no:4 on chapter no :3 : Instruction set of 8086 1) Describe any two string operation instruction of 8086 with syntax & one example of each. 1] REP: REP is a prefix which is written before one

More information

Summer 2003 Lecture 4 06/14/03

Summer 2003 Lecture 4 06/14/03 Summer 2003 Lecture 4 06/14/03 LDS/LES/LSS General forms: lds reg,mem lseg reg,mem Load far pointer ~~ outside of current segment {E.g., load reg w/value @ mem, & seg w/mem+2 XCHG Exchange values General

More information

Assembly Language Programming

Assembly Language Programming Assembly Language Programming Integer Constants Optional leading + or sign Binary, decimal, hexadecimal, or octal digits Common radix characters: h hexadecimal d decimal b binary r encoded real q/o - octal

More information

The Stack. Lecture 15: The Stack. The Stack. Adding Elements. What is it? What is it used for?

The Stack. Lecture 15: The Stack. The Stack. Adding Elements. What is it? What is it used for? Lecture 15: The Stack The Stack What is it? What is it used for? A special memory buffer (outside the CPU) used as a temporary holding area for addresses and data The stack is in the stack segment. The

More information

if 2 16bit operands multiplied the result will be

if 2 16bit operands multiplied the result will be how many operands in ADC? ans:3 how 32 bit word is defined? ans define double if 2 16bit operands multiplied the result will be ans 32bit if div by ero occurs then?? ans div by zero int for software int

More information

The statement above assumes that the PCMAC.INC file is in the current directory. The full path of the file can also be given:

The statement above assumes that the PCMAC.INC file is in the current directory. The full path of the file can also be given: MACROS for I/O As you have probably noticed, writing DOS calls can become tedious. Much of the code is repetitive, and each call has its own function code and register usage. You are probably used to dealing

More information

Chapter 3: Assembly Language Fundamentals. Cristina G. Rivera

Chapter 3: Assembly Language Fundamentals. Cristina G. Rivera Chapter 3: Assembly Language Fundamentals Cristina G. Rivera Basic Elements of Assembly Language Example: Adding and Subtracting Integers Assembling, Linking, and Running Programs Defining Data Symbolic

More information