ELEC 242 Time Delay Procedure
|
|
- Evangeline Nicholson
- 6 years ago
- Views:
Transcription
1 There are many occasions where we wish to time events. If we are using a personal computer, we have a number of ways to do this. The 8088/8086 computer had a Programmable Interval Timer like the 8253/54 installed. One of the three count down timer could be initialized to a count and then would count down to zero. The system clock was applied to the clock input terminal, and this clock controlled the rate at which the PIT counts down to zero. When the count reached zero, it would generate an interrupt to the processor. There is an easier way to create time delays since all computer beginning with the have a real time clock, and MS-DOS has at least two functions that will read the date and time from the clock. One is Function 2CH INT 21h, and the other is function 02H INT 1AH. Since the output of both functions is the same, it really doesn t matter which one we use. Therefore, we will use Function 2CH INT 21H. Arithmetic Instructions for Multiply and Divide MUL In order to perform the time delay routine, we need to have knowledge of these instructions and their requirements. The multiply instruction multiplies an 8-bit, 16-bit, or 32-bit operand in AL, AX, or EAX by a register or memory multiplier. The operand cannot be immediate. The instruction syntax is: mul register mul memory The following shows the source and destination registers for various multiply instructions. Multiplicand Multiplier Result AL 8-bit AX AX 16-bit DX:AX EAX 32-bit EDX:EAX Example: Multiply 20 by 4 using a register operand: mov al,20 mov bl,4 mul bl ; The product is located in AX and is 0050H Example: Multiply 2000 by 1000 using a memory operand:.data num1 dw 2000 num2 dw 1000 mov ax,num1 mul num2 ; The product is located in DX:AX ; DX = 001EH and AX = 8480H Note: To multiply two memory operands, one must be placed in a register. Example: Multiply by using a memory operand:.data num1 dw num2 dw mov eax,num1 mul num2 ; The product is located in EDX:EAX ; EDX = BH and EAX = A7DE F300H Page 1
2 DIV The divide instruction divides an 8-bit, 16-bit, or 32-bit operand in, AX, or EAX by a register or memory dividend. The operand cannot be immediate. The instruction format is: div register div memory The following shows the source and destination registers for various divide instructions. Dividend Divider Quotient Remainder AX 8-bit AL AH DX:AX 16-bit AX DX EDX:EAX 32-bit EAX EDX E Example: Divide 21 by 4 using a register operand: mov ax,21 mov bl,4 div bl ; The quotient is located in AL and is 0005H ; The remainder is located in AH and is 0001H Example: Divide 2000 by 1000 using a memory operand:.data num1 dw 2000 num2 dw 1000 mov dx,0 mov ax,num1 div num2 ; The remainder:quotient is located in DX:AX ; DX = 0000H and AX = 0002H Note: To multiply two memory operands, one must be placed in a register. Example: Divide by using a memory operand:.data num1 dw num2 dw mov edx,0 mov eax,num2 div num1 ; The remainder:quotient is located in EDX:EAX ; EDX = H and EAX = H REQUIREMENTS FOR FUNCTION 2CH INT 21H READ SYSTEM CLOCK We will be using BIOS to read the system clock. This function returns the current contents of the system clock into the CX and DX registers. Therefore, if these registers contain data that will be needed after the time delay, we should PUSH CX and DX onto the Stack before the INT 21H, and POP them after the return. The contents of the clock is the number of hours, minutes, seconds, and 1 /100 ths of seconds since midnight. The Read System Clock function works as follows: On Entry: AH <= 02Ch ;reads the system clock on execution of INT 21h Page 2
3 On Exit: CH has hour ; in UTC format from 00 to 23 CL minutes ; as a value from 00 to 59 DH has the seconds ; as a value from 00 to 59 DL 1/100 s ; as a value from 00 to 99 As you can see, we can use this function to assemble the time in a format like 18: Since we wish to write a program that generates a time delay, we could read the current time and keep reading the clock until the desired time has been reached. For instance, if we want a 5 second time delay, read the clock and add five seconds to the current time. Now enter a loop that reads the current time, and compares it to the exit time. We say in the loop until the current time is >= the initial time plus five seconds. In our case, we would ignore the hundredths of seconds. However, we would still have to compare the hours, minutes and seconds to create a more flexible time delay, one that is easily modified for timing intervals of hours. However, we will do the time delay as follows: 1. Read the RTC (Real Time Clock) 2. Convert the hours to seconds (from the beginning of the day) Note the result can be as large as a doubleword (23 hours times 3600 seconds) 3. Convert the minutes to seconds 4. Add the hours in seconds to the minutes in seconds and the seconds 5. Add the time interval in seconds 6. Store it in a memory buffer 7. Enter a loop that repeats steps 1 through 4 8. Compare the current time to the start time (in the storage buffer) 9. Jump to step 7 while the value in seconds for the current time is less than the end time. NOTE: Since we are dealing with double word size data, we need to use an or higher processor with the 386 mode enabled. If we use AX for the calculations and compares, the register would be accessed as follows: mov eax, hour mov [EndTime],eax cmp eax,[endtime] 80x86 Time Delay Reading the system clock This procedure uses 32-bit instructions. Therefore, we need to instruct the assembler to use instructions. To do this, add the.386 directive after the model directive as follows:.model small.386 We will be using BIOS to read the system clock. It works as follows: On Entry: AH <= 02Ch ;reads the system clock on INT 21h On Exit: CH has hour CL minutes DH has the seconds DL 1/100 s Page 3
4 Since we will need access to these registers in a loop while we still need the data, we will require storage to hold the time data. Therefore we need to setup storage in the.data area. Since we will not use the 1/100 s data in this program, we do not create storage or save this data. The names we use for storage can be anything we wish, but it is a good idea to make them selfexplanatory..data Hours DB? Minutes DB? Seconds DB? On return from INT 21H, we would store the data as follows: ; [Hours] <= CH ; [Minutes] <= CL ; [Seconds] <= DH Also, we will need storage to hold the current time and the time we wish to end. Since this may be 32-bit data, storage will be on a double word boundary. Once again, the names we use do not matter. You may use your own as long as you make sure to use the same names in your procedure. Here is one way to do this. In the.data area, enter the following: T_wait DD? T_now DD? We will see the specifics of how these data are used shortly. Page 4
5 80x86 TIME DELAY Since a time delay is a common function, we will write it as a procedure. This allows us the ability to copy and paste to other programs. We could also make it a public procedure, assemble and create an object file, and link to it. This is something we will discuss in later programs. While we could write this as a single procedure, I chose to write it as two procedures. Since Time_Delay will read the system clock multiple times, I felt it was more effective to use nested procedures as opposed to nested loops. The two procedures are named Time_Delay and Read_Time. I think that you can figure out what these two procedures accomplish based on their names. We will discuss both in detail. DISCUSSION THE READ_TIME PROCEDURE Read_Time reads the system clock and returns hours, minutes, seconds, and 1/100 s of seconds. We will discard the hundredths of a second value. We previously described which registers return the data, and how to save the data in storage. How can we process this data easily? I mentioned that we would consider comparing hours, minutes, and seconds from the start time to the current time using multiple IF THEN ELSE statements implemented in assembler. What we will do instead is to convert the time to the number of seconds since the beginning of the day. One problem, which we will not consider in our program, is day rollover (time delays that occur over midnight). This could be implemented without too much trouble. However, we are writing a 5 second time delay, so it is doubtful that this would cause a problem. There is additional processing that we could perform to eliminate this problem. We do not have to worry about an AM PM rollover since the computer clock is implemented in a 24-hour clock format (00 = midnight and 12 = noon). To simplify the program, we will convert the hour/minute/second data returned by the BIOS routine to seconds in Read_Time. So how is this accomplished? 1. Take the hours data and multiply it by 3600 (there are 3600 seconds in 1 hour) 2. Take the minutes data and multiply by 60 (60 seconds per hour) 3. Add the hours and minutes data with the seconds data and we have the number of seconds since midnight. What size storage do we need? The hours data will tell us what size data storage to declare. Since there are 24* or seconds per day, we must use double-word size data. I would place this data at the beginning of the data segment to avoid potential memory data boundary glitches. Place and word or byte sized data after. Earlier, we discussed how to move data as double word size using registers named EAX, EBX, ECX, and EDX. Also, we will be using the AH, CX, and DX registers, so remember to save them on the Stack. Read_Time Procedure requirements On Entry: The AH register is loaded with the BIOS function 2Ch and INT 21H is executed Page 5
6 On Exit: CH has the Hour data CL has the Minute data DH has the Second data DL has the 1/100s second data (which is not used in this procedure) The contents of CL is copied into the Minutes storage buffer in the Data Segment The contents of DH is copied into the Seconds storage buffer in the Data Segment The number of seconds since midnight has been copied into the storage buffer T_now and is also in EAX Note, although we have reserved storage for the Hours data, we did not preserve it since we used it immediately. However, we could save this data if we wished to modify the procedure to handle a time delay that rolled over midnight. The procedure requires four storage buffers in the data segment. These are declared as follows: T_now DD? Hours DB? Minutes DB? Seconds DB? The basic (first draft) algorithm for Read_Time is: 1. Read the system clock using function 2Ch and INT 21h 2. Convert the current time to seconds since the beginning of the day on a double-word boundary. Assume this routine will not incur a day rollover. 3. Place the current time converted to seconds in T_now storage buffer in the data segment (a DD size storage element) 4. RETurn to the calling module or procedure Step 2 in the algorithm contains three separate parts, which were mentioned earlier. Further refinement yields the complete algorithm follows: Read_Time proc 1. Read the system clock using function 2Ch and INT 21h 2. Convert the current time to seconds since the beginning of the day on a doubleword boundary as follows: 3. Clear EAX ;There are many ways to do this, but the easiest is to XOR EAX with itself 4. Copy Hours data from register CH into AL 5. Save the minutes data from CL to storage (Minutes) and the seconds data from DH to storage (Seconds) 6. Place 3600 in EBX ;there are 3600s/hr 7. Multiply the number of hours data in EAX with EBX, the number of seconds per hour Note: MUL EBX will place the low doubleword of the result in EAX, and the high doubleword of the result in EDX. However, EDX will always be zero for this subroutine since the maximum value for hours is 23. Therefore we may ignore EDX 8. Copy the hours data from EAX to T_now 9. Clear EAX Page 6
7 10. Copy the data from the Minutes storage into AL 11. Place the value 60 into EBX ;60s/minute 12. Multiply EAX, the minutes data with EBX, the number of seconds per minute 13. Add the data buffer T_now to EAX; we are adding the hours as seconds to minutes as seconds 14. Copy the hours + minutes data from EAX to T_now 15. Clear EAX 16. Copy the data from the Seconds storage into AL 17. Add the data buffer T_now to EAX; now EAX contains the number of seconds in the day since midnight 18. Copy the current time in seconds from EAX into T_now 19. RETurn to the calling module or procedure Read_Now endp This is how we read the system clock, and convert the current time into the number of seconds since midnight. The complete algorithm is contained in the 18 steps above. Remember, the current time is passed out in the data storage area using the name T_now, and is stored as a Double Word size data. This means that whenever we use this data, it must be placed in an extended register (32-bits), and we must use the 386 assembler directive. THE TIME DELAY PROCEDURE This procedure will enter a loop that waits for about 5 seconds or any time based on the data stored in the data segment buffer named T_wait, and returns to the calling module or procedure. This method requires T_wait to be initialized. If we wish, we could use standard input to accept the time delay from the user. In the latter case, there are no specific data requirements that must be initialized for entry. Only T_wait, a double word sized data buffer, is required as storage in the data segment. However, this procedure will call another procedure that has additional storage requirements. However, these parameters are not passed between the Time_Delay procedure and the calling procedure or module. The parameter T_now is passed between Time_Delay and Read_Time. Time_Delay Procedure requirements On Entry: Wait_time is byte-sized data (max delay is 255 s) initialized to the number of seconds required for the time delay and passed into the procedure. T_Wait must be created as a storage buffer in the data segment, and this is passed between Time_Delay and Read_Time On Exit: A delay has been executed. No data are passed to the calling module or procedure. The procedure requires six storage buffers in the data segment. Of these four are declared for Read_Time and two more are required for Time_Delay. All six buffers might be declared as follows: T_wait DD? T_now DD? Hours DB? Minutes DB? Page 7
8 Seconds DB? Wait_time DB? Time Delay ALGORITHM Time_Delay proc 1. PUSH AX, CX, and DX on the stack 2. Call the subroutine Read_Time to get the current time in seconds since midnight On return, EAX contains the Current Time 3. Clear ECX 4. Add Wait_Time into CL 5. Add EAX and ECX 6. Copy EAX into T_wait 7. Enter a loop 8. Call Read_Time to get the current time in seconds since midnight 9. Compare EAX to T_wait 10. Loop to step 7 while current time (EAX) is less than end time (T_wait) 11. POP DX, CX, and AX from the stack 12. On loop exit, return to calling module or procedure Time_Delay endp Page 8
Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB
Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB Lab # 9 Integer Arithmetic and Bit Manipulation April, 2014 1 Assembly Language LAB Bitwise
More informationWe will first study the basic instructions for doing multiplications and divisions
MULTIPLICATION, DIVISION AND NUMERICAL CONVERSIONS We will first study the basic instructions for doing multiplications and divisions We then use these instructions to 1. Convert a string of ASCII digits
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 informationLecture 9. INC and DEC. INC/DEC Examples ADD. Arithmetic Operations Overflow Multiply and Divide
Lecture 9 INC and DEC Arithmetic Operations Overflow Multiply and Divide INC adds one to a single operand DEC decrements one from a single operand INC destination DEC destination where destination can
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 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 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 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 informationDefining and Using Simple Data Types
85 CHAPTER 4 Defining and Using Simple Data Types This chapter covers the concepts essential for working with simple data types in assembly-language programs The first section shows how to declare integer
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 informationInteger Arithmetic Part2
Islamic University Of Gaza Assembly Language Faculty of Engineering Discussion Computer Department Chapter 7 Eng. Ahmed M. Ayash Date: 21/04/2013 Chapter 7 Integer Arithmetic Part2 7.4: Multiplication
More informationEECE.3170: Microprocessor Systems Design I Summer 2017 Homework 4 Solution
1. (40 points) Write the following subroutine in x86 assembly: Recall that: int f(int v1, int v2, int v3) { int x = v1 + v2; urn (x + v3) * (x v3); Subroutine arguments are passed on the stack, and can
More informationSOEN228, Winter Revision 1.2 Date: October 25,
SOEN228, Winter 2003 Revision 1.2 Date: October 25, 2003 1 Contents Flags Mnemonics Basic I/O Exercises Overview of sample programs 2 Flag Register The flag register stores the condition flags that retain
More 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 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 informationFaculty of Engineering Computer Engineering Department Islamic University of Gaza Assembly Language Lab # 2 Assembly Language Fundamentals
Faculty of Engineering Computer Engineering Department Islamic University of Gaza 2011 Assembly Language Lab # 2 Assembly Language Fundamentals Assembly Language Lab # 2 Assembly Language Fundamentals
More informationModule 3 Instruction Set Architecture (ISA)
Module 3 Instruction Set Architecture (ISA) I S A L E V E L E L E M E N T S O F I N S T R U C T I O N S I N S T R U C T I O N S T Y P E S N U M B E R O F A D D R E S S E S R E G I S T E R S T Y P E S O
More 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 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 informationInstructions moving data
do not affect flags. Instructions moving data mov register/mem, register/mem/number (move data) The difference between the value and the address of a variable mov al,sum; value 56h al mov ebx,offset Sum;
More informationcomplement) Multiply Unsigned: MUL (all operands are nonnegative) AX = BH * AL IMUL BH IMUL CX (DX,AX) = CX * AX Arithmetic MUL DWORD PTR [0x10]
The following pages contain references for use during the exam: tables containing the x86 instruction set (covered so far) and condition codes. You do not need to submit these pages when you finish your
More informationComputer Architecture and Assembly Language. Practical Session 3
Computer Architecture and Assembly Language Practical Session 3 Advanced Instructions division DIV r/m - unsigned integer division IDIV r/m - signed integer division Dividend Divisor Quotient Remainder
More informationBasic Pentium Instructions. October 18
Basic Pentium Instructions October 18 CSC201 Section 002 Fall, 2000 The EFLAGS Register Bit 11 = Overflow Flag Bit 7 = Sign Flag Bit 6 = Zero Flag Bit 0 = Carry Flag "Sets the flags" means sets OF, ZF,
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 informationComputer Architecture and System Programming Laboratory. TA Session 3
Computer Architecture and System Programming Laboratory TA Session 3 Stack - LIFO word-size data structure STACK is temporary storage memory area register points on top of stack (by default, it is highest
More informationIntroduction to 8086 Assembly
Introduction to 8086 Assembly Lecture 7 Multiplication and Division Multiplication commands: mul and imul mul source (source: register/memory) Unsigned Integer Multiplication (mul) mul src (src: register/memory)
More information22 Assembly Language for Intel-Based Computers, 4th Edition. 3. Each edge is a transition from one state to another, caused by some input.
22 Assembly Language for Intel-Based Computers, 4th Edition 6.6 Application: Finite-State Machines 1. A directed graph (also known as a diagraph). 2. Each node is a state. 3. Each edge is a transition
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 informationLAB 5 Arithmetic Operations Simple Calculator
LAB 5 Arithmetic Operations Simple Calculator Objective: Practice arithmetic operation for the 80x86, such as add, subtract, multiple, divide, and mod. When dealing with the multiply, divide, and mod instructions
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 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 informationExperiment 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 informationPESIT 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 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 informationRegisters. Ray Seyfarth. September 8, Bit Intel Assembly Language c 2011 Ray Seyfarth
Registers Ray Seyfarth September 8, 2011 Outline 1 Register basics 2 Moving a constant into a register 3 Moving a value from memory into a register 4 Moving values from a register into memory 5 Moving
More informationCome and join us at WebLyceum
Come and join us at WebLyceum For Past Papers, Quiz, Assignments, GDBs, Video Lectures etc Go to http://www.weblyceum.com and click Register In Case of any Problem Contact Administrators Rana Muhammad
More informationSigned number Arithmetic. Negative number is represented as
Signed number Arithmetic Signed and Unsigned Numbers An 8 bit number system can be used to create 256 combinations (from 0 to 255), and the first 128 combinations (0 to 127) represent positive numbers
More informationQ1: Multiple choice / 20 Q2: Memory addressing / 40 Q3: Assembly language / 40 TOTAL SCORE / 100
16.317: Microprocessor-Based Systems I Summer 2012 Exam 1 July 20, 2012 Name: ID #: For this exam, you may use a calculator and one 8.5 x 11 double-sided page of notes. All other electronic devices (e.g.,
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 informationInline Assembler. Willi-Hans Steeb and Yorick Hardy. International School for Scientific Computing
Inline Assembler Willi-Hans Steeb and Yorick Hardy International School for Scientific Computing e-mail: steebwilli@gmail.com Abstract We provide a collection of inline assembler programs. 1 Using the
More informationQ1: Multiple choice / 20 Q2: Data transfers and memory addressing
16.317: Microprocessor Systems Design I Fall 2014 Exam 1 October 1, 2014 Name: ID #: For this exam, you may use a calculator and one 8.5 x 11 double-sided page of notes. All other electronic devices (e.g.,
More informationInterfacing Compiler and Hardware. Computer Systems Architecture. Processor Types And Instruction Sets. What Instructions Should A Processor Offer?
Interfacing Compiler and Hardware Computer Systems Architecture FORTRAN 90 program C++ program Processor Types And Sets FORTRAN 90 Compiler C++ Compiler set level Hardware 1 2 What s Should A Processor
More informationInteger Arithmetic. Shift and rotate. Overview. Shift and Rotate Instructions
Overview Integer Arithmetic Shift and rotate instructions and their applications Multiplication and division instructions Extended addition and subtraction Computer Organization and Assembly Languages
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 informationQ1: Multiple choice / 20 Q2: Protected mode memory accesses
16.317: Microprocessor-Based Systems I Summer 2012 Exam 2 August 1, 2012 Name: ID #: For this exam, you may use a calculator and one 8.5 x 11 double-sided page of notes. All other electronic devices (e.g.,
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 informationChapter 7 Integer Arithmetic
Chapter 7 Integer Arithmetic 7.1 Introduction 193 7.2 Shift and Rotate Instructions 194 7.2.1 Logical Shifts and Arithmetic Shifts 194 7.2.2 SHL Instruction 195 7.2.3 SHR Instruction 196 7.2.4 SAL and
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 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 informationAddressing Modes on the x86
Addressing Modes on the x86 register addressing mode mov ax, ax, mov ax, bx mov ax, cx mov ax, dx constant addressing mode mov ax, 25 mov bx, 195 mov cx, 2056 mov dx, 1000 accessing data in memory There
More informationBy: Dalbir Singh, Computer Science Dep't
Assembly language is essentially the native language of your computer. Technically the processor of your machine understands machine code (consisting of ones and zeroes). But in order to write such a machine
More informationHardware 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 information8086 Programming. Multiplication Instructions. Multiplication can be performed on signed and unsigned numbers.
Multiplication Instructions 8086 Programming Multiplication can be performed on signed and unsigned numbers. MUL IMUL source source x AL source x AX source AX DX AX The source operand can be a memory location
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 informationComputer Processors. Part 2. Components of a Processor. Execution Unit The ALU. Execution Unit. The Brains of the Box. Processors. Execution Unit (EU)
Part 2 Computer Processors Processors The Brains of the Box Computer Processors Components of a Processor The Central Processing Unit (CPU) is the most complex part of a computer In fact, it is the computer
More informationInteger Arithmetic. Pu-Jen Cheng. Adapted from the slides prepared by Kip Irvine for the book, Assembly Language for Intel-Based Computers, 5th Ed.
Computer Organization & Assembly Languages Integer Arithmetic Pu-Jen Cheng Adapted from the slides prepared by Kip Irvine for the book, Assembly Language for Intel-Based Computers, 5th Ed. Chapter Overview
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 informationEXPERIMENT WRITE UP. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM
EXPERIMENT WRITE UP AIM: Assembly language program for 16 bit BCD addition LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM TOOLS/SOFTWARE
More informationPractical Malware Analysis
Practical Malware Analysis Ch 4: A Crash Course in x86 Disassembly Revised 1-16-7 Basic Techniques Basic static analysis Looks at malware from the outside Basic dynamic analysis Only shows you how the
More informationArithmetic Instructions
Segment 3C Arithmetic Instructions This topic covers the following instructions: Addition (ADD, INC, ADC) Subtraction (SUB, DEC, SBB,CMP) Multiplication (MUL, IMUL) Division (DIV, IDIV) BCD Arithmetic
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 informationCSC 2400: Computer Systems. Towards the Hardware: Machine-Level Representation of Programs
CSC 2400: Computer Systems Towards the Hardware: Machine-Level Representation of Programs Towards the Hardware High-level language (Java) High-level language (C) assembly language machine language (IA-32)
More informationCOMPUTER ENGINEERING DEPARTMENT
Page 1 of 14 COMPUTER ENGINEERING DEPARTMENT Jan. 7, 2010 COE 205 COMPUTER ORGANIZATION & ASSEMBLY PROGRAMMING Major Exam II First Semester (091) Time: 3:30 PM-6:00 PM Student Name : KEY Student ID. :
More information16.317: Microprocessor Systems Design I Spring 2014
16.317: Microprocessor Systems Design I Spring 2014 Exam 1 Solution 1. (20 points, 5 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by
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 informationScott M. Lewandowski CS295-2: Advanced Topics in Debugging September 21, 1998
Scott M. Lewandowski CS295-2: Advanced Topics in Debugging September 21, 1998 Assembler Syntax Everything looks like this: label: instruction dest,src instruction label Comments: comment $ This is a comment
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 informationIBM 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 informationMicroprocessors & Assembly Language Lab 1 (Introduction to 8086 Programming)
Microprocessors & Assembly Language Lab 1 (Introduction to 8086 Programming) Learning any imperative programming language involves mastering a number of common concepts: Variables: declaration/definition
More 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 informationMarking 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 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 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 informationASSEMBLY - QUICK GUIDE ASSEMBLY - INTRODUCTION
ASSEMBLY - QUICK GUIDE http://www.tutorialspoint.com/assembly_programming/assembly_quick_guide.htm Copyright tutorialspoint.com What is Assembly Language? ASSEMBLY - INTRODUCTION Each personal computer
More informationLesson 1. Fundamentals of assembly language
Lesson 1. Fundamentals of assembly language Computer Structure and Organization Graduate in Computer Sciences Graduate in Computer Engineering Graduate in Computer Sciences Graduate in Computer Engineering
More informationCSC 8400: Computer Systems. Machine-Level Representation of Programs
CSC 8400: Computer Systems Machine-Level Representation of Programs Towards the Hardware High-level language (Java) High-level language (C) assembly language machine language (IA-32) 1 Compilation Stages
More informationX86-NASM STANDARD COMMANDS. Comment your code with a semicolon (;)! The assembler won t read anything after it.
X86-NASM STANDARD COMMANDS Comment your code with a semicolon (;)! The assembler won t read anything after it. Move mov ax,bx ; ax = bx Use this command when you want to move a value around. You can also
More informationmith College Computer Science CSC231 Assembly Week #5 Fall 2017 Dominique Thiébaut
mith College Computer Science CSC231 Assembly Week #5 Fall 2017 Dominique Thiébaut dthiebaut@smith.edu 0000 0 0 0001 1 1 0010 2 2 0011 3 3 0100 4 4 0101 5 5 0110 6 6 0111 7 7 1000 8 8 1001 9 9 1010 A 10
More informationreply 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 informationAbout the Tutorial. Audience. Prerequisites. Copyright & Disclaimer
About the Tutorial Assembly language is a low-level programming language for a computer or other programmable device specific to a particular computer architecture in contrast to most high-level programming
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 informationCS241 Computer Organization Spring 2015 IA
CS241 Computer Organization Spring 2015 IA-32 2-10 2015 Outline! Review HW#3 and Quiz#1! More on Assembly (IA32) move instruction (mov) memory address computation arithmetic & logic instructions (add,
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 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 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 informationLab 2: Introduction to Assembly Language Programming
COE 205 Lab Manual Lab 2: Introduction to Assembly Language Programming - page 16 Lab 2: Introduction to Assembly Language Programming Contents 2.1. Intel IA-32 Processor Architecture 2.2. Basic Program
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 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 informationUsing MMX Instructions to Perform Simple Vector Operations
Using MMX Instructions to Perform Simple Vector Operations Information for Developers and ISVs From Intel Developer Services www.intel.com/ids Information in this document is provided in connection with
More informationComputer Science Final Examination Wednesday December 13 th 2006
Computer Science 03-60-266 Final Examination Wednesday December 13 th 2006 Dr. Alioune Ngom Last Name: First Name: Student Number: INSTRUCTIONS EXAM DURATION IS 3 hours. OPEN NOTES EXAM: lecture notes,
More informationInteger Arithmetic. Computer Organization and Assembly Languages Yung-Yu Chuang 2005/11/17. with slides by Kip Irvine
Integer Arithmetic Computer Organization and Assembly Languages Yung-Yu Chuang 2005/11/17 with slides by Kip Irvine Announcements Assignment #2 is due next week. Assignment #3 box filter is online now,
More informationAssignment 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 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 information1-Operand instruction types 1 INC/ DEC/ NOT/NEG R/M. 2 PUSH/ POP R16/M16/SR/F 2 x ( ) = 74 opcodes 3 MUL/ IMUL/ DIV/ DIV R/M
Increment R16 1-Operand instruction types 1 INC/ DEC/ NOT/NEG R/M 4 x (16+48) = 256 opcodes 2 PUSH/ POP R16/M16/SR/F 2 x (8+24+4+1) = 74 opcodes 3 MUL/ IMUL/ DIV/ DIV R/M 4 x (16+48) = 256 opcodes INC
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 informationEECE.3170: Microprocessor Systems Design I Spring 2016
EECE.3170: Microprocessor Systems Design I Spring 2016 Exam 1 Solution 1. (20 points, 5 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response
More informationMnem. Meaning Format Operation Flags affected ADD Addition ADD D,S (D) (S)+(D) (CF) Carry ADC Add with ADC D,C (D) (S)+(D)+(CF) O,S,Z,A,P,C
ARITHMETIC AND LOGICAL GROUPS 6-1 Arithmetic and logical groups: The arithmetic group includes instructions for the addition, subtraction, multiplication, and division operations. The state that results
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 information