Lecture (06) x86 programming 5
|
|
- Moses Wright
- 5 years ago
- Views:
Transcription
1 Lecture (06) x86 programming 5 By: Dr. Ahmed ElShafee 1 TOC Format of DOS programs Format of the.com programs Addressing Modes 1> Immediate Addressing Mode 2> Register Addressing Mode 3> Direct Addressing Mode 4> Register Indirect Addressing Mode 2
2 Format of DOS programs All programs must have a code and a stack. Code is the part of the program that contains the instructions of the program. Stack is an area in the RAM used by the system to store return addresses, and by the programmer to store temporarily data. It is a Last In First Out (LIFO) buffer. Programs can also have a data area, where all data (variables) is stored. There are two basic types of programs: Commands (.COM). The data and the stack of the program are part of the Code segment. The stack is always located at the end of the segment. The first 256 bytes of the segment are reserved. 3 Executable (.EXE). The code and stack and data of the program are located in different segments. Format of the.com programs.model SMALL CSEG SEGMENT PARA 'CODE ;Start a Code segment ASSUME CS:CSEG, DS:CSEG, SS:CSEG ORG 100H ;Reserve first 256 locations START: JMP MAIN ;Skip data area {Place the data of the program here} MAIN PROC NEAR ;Beginning of main procedure {Place the code of the program here} RET ;Get return DOS address MAIN ENDP ;End of main procedure CSEG ENDS ;End of the segment END START ;End of the program 4
3 Format of the.com programs.model SMALL.CODE ORG 100H ;Reserve first 256 locations START: JMP MAIN ;Skip data area {Place the data of the program here} MAIN PROC NEAR ;Beginning of main procedure {Place the code of the program here} RET ;Get return DOS address MAIN ENDP ;End of main procedure END START ;End of the program 5 Example 01.01; hello world; masm CSEG SEGMENT PARA CODE ;Start a Code segment ASSUME CS:CSEG, DS:CSEG, SS:CSEG ORG 100H ;Reserve first 256 locations START: JMP MAIN ;Skip data area MSG DB "Hello World 01",'$ MAIN PROC NEAR ;Beginning of main procedure LEA DX,MSG MOV AH,9 INT 21H INT 20H RET MAIN ENDP ;End of main procedure CSEG ENDS ;End of the segment END START ;End of the program 6
4 Example 01; hello world; masm.model SMALL.CODE ORG 100H ;Reserve first 256 locations START: JMP MAIN ;Skip data area MSG DB "Hello World 01",'$ MAIN PROC NEAR ;Beginning of main procedure LEA DX,MSG MOV AH,9 INT 21H INT 20H RET MAIN ENDP ;End of main procedure END START ;End of the program 7 8
5 Compiling and linking Masm 01.asm ML AT 01.obj 01.com 9 10
6 Addressing Modes Addressing mode refers to the way the data needed by an instruction is specified. 11 1> Immediate Addressing Mode The data needed is specified as a number in the machine code of a program. The data is specified by the programmer: as a numeric operand in the instruction, e.g. MOV AL,87H ;AL 87H MOV CX,34A6H ;CX 34A6H MOV BL,8C2H ;Invalid (Data Mismatch) or as a label. The actual value is determined by the assembler. e.g. MOV BX,OFFSET VAL3 ;BX Address of VAL3 MOV AH,CON1 ;AH CON1 12
7 Example 02 org 100h jmp start VAL1 EQU 39H VAL2 DB 37 start: nop MOV BX,OFFSET VAL2 MOV AH,VAL1 END start 13 14
8 Example 03 ORG 100H STRT: JMP MAIN CON1 EQU 6CH CON2 EQU 245AH DAT1 DB 2FH,48H DAT2 DB 4 DUP (0) DAT3 DW 37AH MAIN PROC NEAR MOV SI,2310H MOV BX,OFFSET DAT1 MOV AL,CON1 MOV CX,CON2 MOV AX,283CH MOV AX,OFFSET DAT3 ENDP MAIN 15 END start ORG 100H Label Address Data STRT: JMP MAIN CON1 EQU 6CH CON2 EQU 245AH DAT1 DB 2FH,48H DAT2 DB 4 DUP (0) DAT3 DW 37AH MAIN PROC NEAR MOV SI,2310H MOV BX,OFFSET DAT1 MOV AL,CON1 MOV CX,CON2 MOV AX,283CH MOV AX,OFFSET DAT3 ENDP MAIN 16 END start AX BX CX AH AL BH BL CH CL SI
9 ORG 100H Label Address Data STRT: JMP MAIN start CODE CON1 EQU 6CH DAT F48 CON2 EQU 245AH DAT DAT1 DB 2FH,48H DAT A03 DAT2 DB 4 DUP (0) DAT3 DW 37AH AX BX CX MAIN PROC NEAR AH AL BH BL CH CL SI MOV SI,2310H NC NC NC NC NC NC 2310 MOV BX,OFFSET DAT1 NC NC NC NC NC MOV AL,CON1 6C MOV CX,CON2 24 5A MOV AX,283CH 28 3C MOV AX,OFFSET DAT ENDP MAIN 17 END start 18
10 2> Register Addressing Mode Both of the operands are the contents of registers. e.g. MOV AL,BH ;AL BH MOV BX,CX ;BX CX MOV AX,DL ;Invalid (Data Mismatch) 19 Example 04 ORG 100H STRT: JMP MAIN DATA1 DW 3620H DATA2 DW 0EEA5H DATA3 DW 9089H DATA4 DW 73F6H DATA5 DW 2006H MAIN PROC NEAR MOV AX,DATA1 MOV BX,DATA2 MOV CX,DATA3 MOV DX,DATA4 MOV SI,DATA5 MOV BX,CX MOV AL,DH MOV CX,AX MOV AH,AL MOV SI,DX ENDP MAIN END start 20
11 AX BX CX DX AH AL BH BL CH CL DH DL SI MAIN PROC NEAR EE A F MOV BX,CX MOV AL,DH MOV CX,AX MOV AH,AL MOV SI,DX 21 DATA1 DW 3620H DATA2 DW 0EEA5H DATA3 DW 9089H DATA4 DW 73F6H DATA5 DW 2006H AX BX CX DX AH AL BH BL CH CL DH DL SI MAIN PROC NEAR EE A F MOV BX,CX MOV AL,DH MOV CX,AX MOV AH,AL 73 MOV SI,DX 73F6 22
12 23 3> Direct Addressing Mode One of the operands is the contents of the memory location that is specified directly in the instruction. e.g. MOV AL,[1008H] ;AL [1008H] MOV BX,VALUE ;BX [VALUE] 24
13 Example 05 ORG 100H STRT: JMP MAIN DB? FRST DB 0C1H VAL1 DW 8756H ARR1 DB 9FH,0A6H,75H,8CH MAIN PROC NEAR MOV AL,[0104H] MOV BX,[0108H] MOV CH,FRST MOV DX,VAL1 MOV AH,ARR1 MOV CL,ARR1+3 ENDP MAIN END start 25 ORG 100H Label Address Data STRT: JMP MAIN FRST 0103 DB? VAL FRST DB 0C1H 0105 VAL1 DW 8756H ARR ARR1 DB 9FH,0A6H,75H,8CH
14 ORG 100H Label Address Data STRT: JMP MAIN FRST 0103 C1 DB? VAL FRST DB 0C1H VAL1 DW 8756H ARR F ARR1 DB 9FH,0A6H,75H,8CH 0107 A C 27 Label Address Data FRST 0103 C1 VAL ARR F 0107 A C AX BX CX DX MAIN PROC NEAR AH AL BH BL CH CL CH CL MOV AL,[0104H] MOV BX,[0108H] MOV CH,FRST MOV DX,VAL1 MOV AH,ARR1 MOV CL,ARR SI
15 Label Address Data FRST 0103 C1 VAL ARR F 0107 A C AX BX CX DX MAIN PROC NEAR AH AL BH BL CH CL CH CL MOV AL,[0104H] 56 MOV BX,[0108H] 8C 75 MOV CH,FRST C1 MOV DX,VAL MOV AH,ARR1 9F MOV CL,ARR1+3 8C 29 SI 30
16 4> Register Indirect Addressing Mode One of the operands is the contents of the memory location that is specified by a register, or a combination of registers and an offset, in the instruction. Index: Use of SI or DI to specify a memory location. e.g. MOV AL,[SI] ;AL [SI] - Base: Use of BX or BP to specify a memory location. e.g. MOV AH,[BP] ;AL [BP] - Base Relative: Use of BX or BP in combination with an offset to specify a memory location. e.g. MOV AL,[BX+ 2] ;AL [BX + 2] - Base Relative plus Index: Use of BX or BP in combination with an index register (SI or DI) and an offset to specify a memory location. e.g. MOV AL,[BX+SI+8] ;AL [BX+SI+8] MOV BX,ARR[BX+DI] ;BX ARR[BX+DI] 31 Example 06 ORG 100H STRT: JMP MAIN DAT1 DB 2FH,48H DAT2 DB 12H,10H,18H DAT3 DW 7A5H DAT4 DW 37H DAT5 DB 10H MAIN PROC NEAR MOV AX,7745H MOV BX,0104H MOV DI,0001 MOV SI,0002 MOV AL,[BX] MOV AH,DAT2[SI] MOV AL,DAT1[DI] MOV AL,[BX+SI] MOV AH,[BX+DI+3] ENDP MAIN END start 32
17 ORG 100H Label Address Data STRT: JMP MAIN 0100 DAT1 DB 2FH,48H 0101 DAT2 DB 12H,10H,18H 0102 DAT3 DW 7A5H 0103 DAT4 DW 37H 0104 DAT5 DB 10H A 010B 33 ORG 100H Label Address Data STRT: JMP MAIN START 0100 DAT1 DB 2FH,48H 0101 DAT2 DB 12H,10H,18H DAT FH DAT3 DW 7A5H H DAT4 DW 37H DAT H DAT5 DB 10H H H DAT A5H H DAT H 010A 00H DAT5 010B 10H 34
18 Address Data DAT FH H DAT H H H DAT A5H H DAT H 010A 00H DAT5 010B 10H AX BX CX DX MAIN PROC NEAR AH AL BH BL CH CL DH DL MOV AX,7745H MOV BX,0104H MOV DI,0001 MOV SI,0002 MOV AL,[BX] MOV AH,DAT2[SI] MOV AL,DAT1[DI] MOV AL,[BX+SI] 35 MOV AH,[BX+DI+3] SI di Address Data DAT FH H DAT H H H DAT A5H H DAT H 010A 00H DAT5 010B 10H AX BX CX DX MAIN PROC NEAR AH AL BH BL CH CL DH DL SI di MOV AX,7745H MOV BX,0104H MOV DI, MOV SI, MOV AL,[BX] 12 MOV AH,DAT2[SI] 18 MOV AL,DAT1[DI] 48 MOV AL,[BX+SI] MOV AH,[BX+DI+3] 07H
19 37 Example 07 ORG 100H STRT: JMP MAIN blank db 3 DUP (?) Data1 db 4FH Data2 db 8CH,5AH,0ACH,93H Data3 dw 4F59H,7EA3H Data4 db 0F4H,09H,8AH,5CH,6AH MAIN PROC NEAR MOV AX,2F8AH MOV BX,OFFSET Data4 MOV SI,3 MOV AL,Data1 MOV AH,BL MOV AL,Data2+3 MOV AX,Data3 MOV AL,Data2[SI] MOV AL,[BX+1] MOV AL,[SI+102H] MOV AL,[BX+SI 1] MOV AL,Data4[SI+2] MOV AL,Data2[SI+5] MOV AX,Data3+1 ENDP MAIN END start 38
20 ORG 100H Label Address Data STRT: JMP MAIN 0100 blank db 3 DUP (?) 0101 Data1 db 4FH 0102 Data2 db 8CH,5AH,0ACH,93H 0103 Data3 dw 4F59H,7EA3H 0104 Data4 db 0F4H,09H,8AH,5CH,6AH A 010B 010C 010D 010E 010F ORG 100H Label Address Data STRT: JMP MAIN blank 0100 blank db 3 DUP (?) 0101 Data1 db 4FH 0102 Data2 db 8CH,5AH,0ACH,93H 0103 Data3 dw 4F59H,7EA3H 0104 Data4 db 0F4H,09H,8AH,5CH,6AH Data F Data C A 0108 AC Data3 010A B 4F 010C A3 010D 7E Data4 010E F4 010F A C A
21 AX BX MAIN PROC NEAR AH AL BH BL MOV AX,2F8AH MOV BX,OFFSET Data4 MOV SI,3 MOV AL,Data1 MOV AH,BL MOV AL,Data2+3 MOV AX,Data3 MOV AL,Data2[SI] MOV AL,[BX+1] MOV AL,[SI+102H] MOV AL,[BX+SI 1] MOV AL,Data4[SI+2] MOV AL,Data2[SI+5] MOV AX,Data SI Addr ess Mode Label Addres Dat s a blank Data F Data C A 0108 AC Data3 010A B 4F 010C A3 010D 7E Data4 010E F4 010F A C A AX BX SI MAIN PROC NEAR AH AL BH BL MOV AX,2F8AH 2F 8A immediate MOV BX,OFFSET Data4 01 0E immediate MOV SI, immediate MOV AL,Data1 4F Direct MOV AH,BL 0E Reg. MOV AL,Data Direct MOV AX,Data3 4F 59 Direct MOV AL,Data2[SI] 93 Reg. Ind. MOV AL,[BX+1] 09 Reg. Ind. MOV AL,[SI+102H] 4F Reg. Ind. MOV AL,[BX+SI 1] 8A Reg. Ind. MOV AL,Data4[SI+2] B8 Reg. Ind. MOV AL,Data2[SI+5] F4 Reg. Ind. MOV AX,Data3+1 A3 4F Direct 42 Address Mode Label Addres Dat s a blank Data F Data C A 0108 AC Data3 010A B 4F 010C A3 010D 7E Data4 010E F4 010F A C A
22 43 Thanks,.. 44
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 informationLecture (07) x86 programming 6
Lecture (07) x86 programming 6 By: Dr. Ahmed ElShafee 1 The Flag Register 31 21 20 19 18 17 16 14 13 12 11 10 9 8 7 6 4 2 0 ID VIP VIF AC VM RF NT IOP 1 IOP 0 O D I T S Z A P C 8088/8086 80286 80386 80486
More informationAssembling, 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 informationExperiment #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 informationChapter 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 informationA4 Sample Solution Ch3
A4 Sample Solution Ch3 2. AL, AH, BL, BH,CL,CH,DLl, DH 3. AX, BX, CX, DX, SP, BP, SI, DI, CS, DS, ES, SS, FS, GS 4. EAX, EBX, ECX, EDX, ESP, EBP, EDI, ESI 5. RAX, RBX, RCX, RDX, RSP, RBP, RSI, RDI and
More informationPrograms for Assembly Language Programming
;Program to print lower case alphabets.stack 100 mov dl, 'a' mov cl, 26 print: mov ah, 02h inc dl loop print mov ah, 4ch Programs for Assembly Language Programming ;Program to printf upper case alphabets.stack
More informationExperiment 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 informationEEM336 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 informationAssembly Language Each statement in an assembly language program consists of four parts or fields.
Chapter 3: Addressing Modes Assembly Language Each statement in an assembly language program consists of four parts or fields. The leftmost field is called the label. - used to identify the name of a memory
More informationVideo processing The INT instruction enables program to interrupt its own processing. Use INT instruction to handle inputs and outputs
Video processing The INT instruction enables program to interrupt its own processing. Use INT instruction to handle inputs and outputs INT 10H: screen handling INT 21H: for displaying screen output and
More informationSPRING 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 informationExperiment 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 informationEC-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 informationWeek /8086 Microprocessor Programming
Week 5 8088/8086 Microprocessor Programming Multiplication and Division Multiplication Multiplicant Operand Result (MUL or IMUL) (Multiplier) Byte * Byte AL Register or memory Word * Word AX Register or
More informationWeek /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 informationSHEET-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 informationLecture 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 informationLecture (08) x86 programming 7
Lecture (08) x86 programming 7 By: Dr. Ahmed ElShafee 1 Conditional jump: Conditional jumps are executed only if the specified conditions are true. Usually the condition specified by a conditional jump
More informationAssembly 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.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 informationdb "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 informationExperiment #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 informationExperiment 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 informationELEC VIDEO BIOS ROUTINES
It is less confusing to the user if we remove unnecessary messages from the display before giving information or instructions. At the command prompt, we do this with the DOS command CLS. However, this
More informationSummer 2003 Lecture 15 07/03/03
Summer 2003 Lecture 15 07/03/03 Initialization of Variables In the C (or C++) programming language any variable definition can have an optional initializer for the variable. How and when the initialization
More informationWeek /8086 Microprocessor Programming I
Week 4 8088/8086 Microprocessor Programming I Example. The PC Typewriter Write an 80x86 program to input keystrokes from the PC s keyboard and display the characters on the system monitor. Pressing any
More informationEC 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 informationCS499. 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 informationTHE UNIVERSITY OF TRINIDAD & TOBAGO
THE UNIVERSITY OF TRINIDAD & TOBAGO FINAL ASSESSMENT/EXAMINATIONS DECEMBER 2012 Course Code and Title: Microprocessor Architecture & Interfacing Programme: Computer Engineering Technician Date and Time:
More informationmith College Computer Science CSC231 - Assembly Week #4 Dominique Thiébaut
mith College Computer Science CSC231 - Assembly Week #4 Dominique Thiébaut dthiebaut@smith.edu Homework Solutions Outline Review Hexdump Pentium Data Registers 32-bit, 16-bit and 8-bit quantities (registers
More information8086 Assembly Language Programming
of 28 7/6/2018 1:10 PM Tuesday, June 9, 2015 About Me 8086 Assembly Language Programming Assembly Language Programming is a low level programming language which is processor specific. It means it will
More information6/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 informationBAHAR 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 informationIntel 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 informationCS/ECE/EEE/INSTR F241 MICROPROCESSOR PROGRAMMING & INTERFACING MODULE 4: 80X86 INSTRUCTION SET QUESTIONS ANUPAMA KR BITS, PILANI KK BIRLA GOA CAMPUS
CS/ECE/EEE/INSTR F241 MICROPROCESSOR PROGRAMMING & INTERFACING MODULE 4: 80X86 INSTRUCTION SET QUESTIONS ANUPAMA KR BITS, PILANI KK BIRLA GOA CAMPUS Q1. IWrite an ALP that will examine a set of 20 memory
More informationEEM336 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 informationAssembly Language Lab #5
Islamic University of Gaza Computer Engineering Department 2009 Assembly Language Lab #5 Eng. Tahani Z. Fourah Islamic University of Gaza Lab 5 Addressing Modes The addressing modes are different ways
More informationComputer 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 informationELEC 242 Using Library Procedures
ELEC 242 Using Library Procedures There are a number of existing procedures that are already written for you that you will use in your programs. In order to use the library procedures that come with the
More informationLecture (09) x86 programming 8
Lecture (09) x86 programming 8 By: Dr. Ahmed ElShafee 1 Basic Input Output System BIOS BIOS refers to a set of procedures or functions that enable the programmer have access to the hardware of the computer.
More informationTopics 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 informationAssembly 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 informationDEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING. Year & Sem : II & III. Name of the Subject: MC-9238 Microprocessor Lab Branch : MCA
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING Year & Sem : II & III Name of the Subject: MC-9238 Microprocessor Lab Branch : MCA HOW TO WORK IN 8086: Press asm twice. Type sg 0000 Press enter Type
More informationADDRESSING MODES. Operands specify the data to be used by an instruction
ADDRESSING MODES Operands specify the data to be used by an instruction An addressing mode refers to the way in which the data is specified by an operand 1. An operand is said to be direct when it specifies
More informationCSE 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 informationORG ; 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 informationData Movement Instructions
Segment 3B Data Movement Instructions PUSH/POP Contents Load-Effective address (LEA, LDS, LES) String Data Transfer (LODS, STOS, MOVS) XCHG, XLAT IN and OUT Course Instructor Mohammed Abdul kader Lecturer,
More informationComputer 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 informationEx: 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 informationQ1: Define a character string named CO_NAME containing "Internet Services" as a constant?
CS 321 Lab Model Answers ١ First Lab : Q1: Define a character string named CO_NAME containing "Internet Services" as a constant? ANS: CO_NAME EQU ' Internet Services' Q2: Define the following numeric values
More information8086 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 informationHomework 8. Robert Wortman CpE 185 Mon / Wed Dennis Dahlquist. November 14, 2011
Homework 8 Robert Wortman CpE 185 Mon / Wed Dennis Dahlquist November 14, 2011 1 Question 1 1.1 (a) PROG51.ASM(14) : warning A4012: line number information for segment without class CODE : cseg Instructions
More informationINSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI
8 Unsigned and Signed Integer Numbers 1. Unsigned integer numbers: each type of integer can be either byte-wide or word-wide. This data type can be used to represent decimal numbers in the range 0 through
More informationAssignment 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 informationChapter 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 informationPRACTICE 4: Machine and assembly languages
Practice 4: Page: 2 / 10 PRACTICE 4: Objectives: When finishing this practice, students are able to relate machine and assembly languages, changing from one to another and knowing addressing modes and
More informationCSCI516: Program 1 - October 11, 2010 The Program is due: October 25, 2010 in the beginning of the class
CSCI516: Program 1 - October 11, 2010 The Program is due: October 25, 2010 in the beginning of the class For Late Submissions 10 out of 100 points will be taken off. For your first program, you are to
More informationEx : Write an ALP to evaluate x(y + z) where x = 10H, y = 20H and z = 30H and store the result in a memory location 54000H.
Ex : Write an ALP to evaluate x(y + z) where x = 10H, y = 20H and z = 30H and store the result in a memory location 54000H. MOV AX, 5000H MOV DS, AX MOV AL, 20H MOV CL, 30H ADD AL, CL MOV CL, 10H MUL CL
More informationMicroprocessor 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 informationUNIT 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 informationMicroprocessor. 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 informationUMBC. A register, an immediate or a memory address holding the values on. Stores a symbolic name for the memory location that it represents.
Intel Assembly Format of an assembly instruction: LABEL OPCODE OPERANDS COMMENT DATA1 db 00001000b ;Define DATA1 as decimal 8 START: mov eax, ebx ;Copy ebx to eax LABEL: Stores a symbolic name for the
More informationPESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Electronics and Communication
USN 1 P E PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Electronics and Communication INTERNAL ASSESSMENT TEST 1 Date : 26/02/2018 Marks: 40 Subject
More informationComputer Organization and Assembly Language CSC-210
Computer Organization and Assembly Language CSC-2 Lab # Lab() Lab(2) Lab(3) Lab(4) Lab(5) Lab(6) Lab(7) Lab(8) Lab(9) Lab() Lab() Lab(2) Lab(3) Title Computer Anatomy Memory and ports Motherboard and cards
More informationMODE (mod) FIELD CODES. mod MEMORY MODE: 8-BIT DISPLACEMENT MEMORY MODE: 16- OR 32- BIT DISPLACEMENT REGISTER MODE
EXERCISE 9. Determine the mod bits from Figure 7-24 and write them in Table 7-7. MODE (mod) FIELD CODES mod 00 01 10 DESCRIPTION MEMORY MODE: NO DISPLACEMENT FOLLOWS MEMORY MODE: 8-BIT DISPLACEMENT MEMORY
More informationProgramming in Assembler. Laboratory manual. Exercise 3
Zakład Mikroinformatyki i Teorii Automatów Cyfrowych Programming in Assembler Laboratory manual Exercise 3 Simple MS-DOS program assembling and debugging 2008,2011 Krzysztof Tokarz, Piotr Czekalski (edt.)
More informationThe 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 informationBLDEA S V.P. DR. P.G. HALAKATTI COLLEGE OF ENGINEERING & TECHNOLOGY, VIJAYAPURA
EXPERIMENT NO.:- 1. BINARY SEARCH Work Space: Register Used Memory Address Data DI 10000H 11H 10001H 11H 10002H 22H 10003H 22H BX 10004H 33H 10005H 33H 10006H 44H 10007H 44H CX 10008H 55H 10009H 55H 24
More informationCode 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 informationMr. 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 informationQ1: Define a character string named CO_NAME containing "Internet Services" as a constant?
CS 321 Lab Model Answers ١ First Lab : Q1: Define a character string named CO_NAME containing "Internet Services" as a constant? ANS: CO_NAME EQU ' Internet Services' Q2: Define the following numeric values
More informationMicrocomputer 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 informationCOMPUTER ENGINEERING DEPARTMENT
Page 1 of 11 COMPUTER ENGINEERING DEPARTMENT December 31, 2007 COE 205 COMPUTER ORGANIZATION & ASSEMBLY PROGRAMMING Major Exam II First Semester (071) Time: 7:00 PM-9:30 PM Student Name : KEY Student ID.
More informationCONTENTS. 1. Display a Message Display a one Digit Number Accept a Character from keyboard and display the character 4
University of Kashmir, North Campus Course Code Course Name Course Instructor MCA-104-DCE Assembly Language Programming Bilal Ahmad Dar CONTENTS 1. Display a Message 2 2. Display a one Digit Number 3 3.
More informationAssembler 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 informationComputer Department Chapter 7. Created By: Eng. Ahmed M. Ayash Modified and Presented by: Eng. Eihab S. El-Radie. Chapter 7
Islamic University Of Gaza Assembly Language Faculty of Engineering Discussion Computer Department Chapter 7 Created By: Eng. Ahmed M. Ayash Modified and Presented by: Eng. Eihab S. El-Radie Chapter 7
More informationMOV CX,80 MOV CX,100. For example, MOV DI, OFFSET TEXT_STRING ;DI points to the TEXT_STRING in the extra segment ; Byte to be scanned in AL
Q1. Explain briefly the following instructions with examples. (a) IDIV (b)imul (c) SAR (d) SAL (a) IDIV: This instruction is used to divide a signed word by assigned byte, or to divide signed doubleword
More informationSPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY
BACKGROUND 8086 CPU has 8 general purpose registers listed below: AX - the accumulator register (divided into AH / AL): 1. Generates shortest machine code 2. Arithmetic, logic and data transfer 3. One
More informationBabu Madhav Institute of Information Technology, UTU
5 Years Integrated M.Sc.(IT) Semester 4 060010309 : DSE3 Microprocessor Programming and Interfacing Question Bank 1. Write an assembly language program to check whether the given number is odd or even.
More informationSRI 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 informationQ. 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 informationCS-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 informationADVANCE 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 informationMICROPROCESSOR TECHNOLOGY
MICROPROCESSOR TECHNOLOGY Assis. Prof. Hossam El-Din Moustafa Lecture 6 Ch.3 Addressing Modes 1 Chapter Objectives Explain the operation of each data-addressing mode. Use data-addressing modes to form
More informationComputer 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 informationECOM Computer Organization and Assembly Language. Computer Engineering Department CHAPTER 7. Integer Arithmetic
ECOM 2325 Computer Organization and Assembly Language Computer Engineering Department CHAPTER 7 Integer Arithmetic Presentation Outline Shift and Rotate Instructions Shift and Rotate Applications Multiplication
More informationBasic 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 informationKingdom of Saudi Arabia Ministry of Higher Education. Taif University. Faculty of Computers & Information Systems
Kingdom of Saudi Arabia Ministry of Higher Education Taif University Faculty of Computers & Information Systems المملكة العربية السعودية وزارة التعليم العالي جامعة الطاي ف آلية الحاسبات ونظم المعلومات
More informationPractical Workbook Microprocessor Based System Design
Practical Workbook Microprocessor Based System Design Name Year Batch Roll No : : : : Department: Seventh edition: 2015 Department of Computer & Information Systems Engineering NED University of Engineering
More informationArithmetic and Logic Instructions And Programs
Dec Hex Bin 3 3 00000011 ORG ; FOUR Arithmetic and Logic Instructions And Programs OBJECTIVES this chapter enables the student to: Demonstrate how 8-bit and 16-bit unsigned numbers are added in the x86.
More informationLogic Instructions. Basic Logic Instructions (AND, OR, XOR, TEST, NOT, NEG) Shift and Rotate instructions (SHL, SAL, SHR, SAR) Segment 4A
Segment 4A Logic Instructions Basic Logic Instructions (AND, OR, XOR, TEST, NOT, NEG) Shift and Rotate instructions (SHL, SAL, SHR, SAR) Course Instructor Mohammed Abdul kader Lecturer, EEE, IIUC Basic
More informationPHY4635/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 informationLecture 15 Intel Manual, Vol. 1, Chapter 3. Fri, Mar 6, Hampden-Sydney College. The x86 Architecture. Robb T. Koether. Overview of the x86
Lecture 15 Intel Manual, Vol. 1, Chapter 3 Hampden-Sydney College Fri, Mar 6, 2009 Outline 1 2 Overview See the reference IA-32 Intel Software Developer s Manual Volume 1: Basic, Chapter 3. Instructions
More informationLABORATORY WORK NO. 8 WORKING WITH MACROS AND LIBRARIES
LABORATORY WORK NO. 8 WORKING WITH MACROS AND LIBRARIES 1. Object of laboratory Getting used to defining and using macros, procedure defining and using LIB library librarian. 2. Theoretical considerations
More informationMarking Scheme. Examination Paper. Module: Microprocessors (630313)
Philadelphia University Faculty of Engineering Marking Scheme Examination Paper Department of CE Module: Microprocessors (630313) Final Exam Second Semester Date: 12/06/2017 Section 1 Weighting 40% of
More informationAssembler Programming. Lecture 2
Assembler Programming Lecture 2 Lecture 2 8086 family architecture. From 8086 to Pentium4. Registers, flags, memory organization. Logical, physical, effective address. Addressing modes. Processor Processor
More informationProgramming 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 informationThe x86 Architecture
The x86 Architecture Lecture 24 Intel Manual, Vol. 1, Chapter 3 Robb T. Koether Hampden-Sydney College Fri, Mar 20, 2015 Robb T. Koether (Hampden-Sydney College) The x86 Architecture Fri, Mar 20, 2015
More informationX86 Addressing Modes Chapter 3" Review: Instructions to Recognize"
X86 Addressing Modes Chapter 3" Review: Instructions to Recognize" 1 Arithmetic Instructions (1)! Two Operand Instructions" ADD Dest, Src Dest = Dest + Src SUB Dest, Src Dest = Dest - Src MUL Dest, Src
More information