Computer Architecture and System Software Lecture 04: Floating Points & Intro to Assembly

Size: px
Start display at page:

Download "Computer Architecture and System Software Lecture 04: Floating Points & Intro to Assembly"

Transcription

1 Computer Architecture and System Software Lecture 04: Floating Points & Intro to Assembly Instructor: Rob Bergen Applied Computer Science University of Winnipeg

2 Decimal Addition Review decimal addition in scientific notation: Step 1: Align decimal points Step 2: Add Step 3: Normalize result (if needed) Examples: Without normalization: ( )+( ) = ( ) x 10 3 = x 10 3 With normalization: ( ^3)+( ^2) = ( ) x 10 3 = x 10 3 = x 10 4

3 Floating Point Addition Before proceeding note: Shifting frac left by 1 bit decreases exp by 1 Shifting frac right by 1 bit increases exp by 1 The idea behind adding FP numbers is to make exp of the smaller number equal to exp of the larger Then, the steps are the same as decimal: Convert numbers to binary FP (if necessary) Align binary points Add Normalize result

4 Example: FP Addition

5 Floating Point Subtraction Like addition in terms of aligning radix points But, requires a few more rules: Signs If the signs are the same, then do subtraction If signs are different, then change the problem to addition Magnitudes Compare magnitudes, then subtract smaller from larger If the order is switched, then switch sign of result. Don t forget to normalize!

6 Examples: FP Subtraction Signs are the same, so perform subtraction 100 (-80) Signs are different so change to addition (i.e ) Magnitude of 80 is less than 100, so perform and change the sign bit of the result -100 (-80) Magnitude of 100 is larger than 80, so perform subtraction as is Note: same as except sign bit is 1 for both numbers Signs are different so change to addition ( )

7 Floating Point Multiplication Multiply significands and add exponents (add E not exp) Decimal (3 10^1) (5 10^2) = (1.5 10^4)

8 Floating Point Division Perform unsigned division on significands Subtract exponent (subtract E not exp) Decimal (5 10^2) / (2 10^1) = (2.5 10^1)

9 Final Thoughts on Ints, Floats When do we want to use ints vs floats, or vice versa? Ints require less space (bits) but have a much smaller range Can overflow Floats have larger range per bit, but require more space Convenient for very small or very large numbers Can represent fractions and infinite/nan May produce rounding/precision errors

10 Assembly Language Background

11 Assembly Language Programming We will be working with the Intel 32-bit architecture For work at home you will need an emulator, DOSBOX Other software packages available, but solutions given in class will only be guaranteed to compile using DOSBOX

12 High-Level Language High-level language (HLL) shield us from machinelevel complexity HLL programs are Easier to write Less error prone Readable Portable Efficient

13 High-Level Languages HLL relieves programmer from Writing in machine-level instructions Managing memory Rewriting programs to run on different machines

14 Compiler Main work is done by compiler Translate HLL program to assembly code (hardest part) Assemble assembly code to machine code (object code) Link object code with runtime library Yields an executable Assembly code: VERY close to machine code Human readable encoding of machine code Each instruction corresponds to a machine instruction Not readable by machine (needs to be assembled)

15 Motivation for Assembly Code Important: Understand how computers execute code Understand what optimizations the compiler performs Reverse engineer a piece of software Improve efficiency of a program Write programs that have direct control over system hardware Example: writing a device driver to a new scanner If you are developing system software, you will need to know assembly language

16 Instruction Set The set of instructions (and their encodings) that a processor can execute We will use the IA32 (aka i386/i486/pentium) instruction set Used by majority of computers Instruction set for Intel s most commercially successful microprocessors Easily accessible Large # of instructions and modes Gives a good view of how computers work

17 Program Encoding Recall the compilation process Editor hello.cpp Compiler hello.asm Assembler hello.obj Linker Source program (text) Assembly program (text) Relocatable object programs (binary) Executable Hello.exe program (binary) hello.asm: assembly (human readable, not executable) hello.obj: machine code (binary, executable) Assembly and machine code are different encodings of the same instructions

18 Machine-Level (ML) Code Both assembly and machine code are ML code How does ML differ from High Level (HL)? HL view: Objects of different types are declared and allocated memory Memory is accessed by accessing the objects Local variables used to store temporary values CPU state is hidden from programmer Object type defines what operations can be performed Single statement can perform a complex task e.g. if (a+b < c) somefunc(d);

19 Machine-Level (ML) Code ML view: CPU state is visible and accessible to the program All CPU state is stored in its register file, i.e. the memory on the CPU CPU has: Registers ALU Control Unit Execution Unit etc

20 x86 and IA-32 Instruction Set Architectures

21 Source (UofW electronic resource): Chapter 3 in S. Dandamudi, Introduction to Assembly Language Programming for Pentium and RISC Processors, Springer, History Intel first introduced microprocessors in 1969 Work on early processors led to the development of the Intel Architecture (IA) First processor in the IA family was the 8086 (1979) 20-bit address bus and 16-bit data bus First 32-bit IA processor was the (1985) 32-bit address bus and 32-bit data bus Pentium introduced in 1993 Not named because numbers can t be trademarked 32-bit address bus and 64-bit data bus

22 History Source (UofW electronic resource): Chapter 3 in S. Dandamudi, Introduction to Assembly Language Programming for Pentium and RISC Processors, Springer, 2005.

23 8086 / 8088 Architecture 8086/8088 is the first CPU in the X86-series (1979) 8088 is identical to 8086 except it has a 8-bit data bus instead of a 16-bit data bus (more economical) Later processors in this series have similar but extended architectures Need to start at the beginning to understand a processor like Pentium-IV

24 8086 / 8088 Architecture Two main units Bus interface unit (BIU) Execution unit (EU) 8086 Data bus size: 16 bit Instruction queue: 6 bytes 20 bit address bus

25 General Purpose Registers Used for arithmetic, logical, and other operations Can be configured as: Four 16-bit registers Eight 8-bit registers

26 Index and Pointer Registers BP, SI, DI, SP Can only be used as 16 bit registers SI, DI used for addressing, and string op. BP, SP are used for maintaining the stack

27 Segment Registers 16 bit registers labelled DS, CS, SS, ES Used to indicate the start of different segments in memory

28 Flag Register 16-bit register containing 9 1-bit flags Gives status of the last instruction and the processor

29 Flag Register Overflow flag: Set if a signed overflow occurs Direction flag: Used to indicate direction of processing for string manipulations (0 = forward, 1 = backward) Interrupt enable flag: Setting this enables interrupts Trace (trap) flag: Used for debugging. When set processor executes only 1 instruction, then interrupts to call debugger Sign flag: Set to the MSB of the result of an operation Zero flag: Set if the result is zero Auxiliary carry flag: Set if there was a carry from or borrow to bits 0-3 in the AL register Parity flag: Set if the number of1 s in result is even Carry flag: Set if there was a carry from or borrow to the MSB during last calculation Image source:

30 Programming Tools

31 DOSBox Required for those of you that have 64-bit machines and want to work on assignments at home Available at:

32 8086 Emulator for Mac DosBox Works on a mac Other options: Again, assignments that you hand in MUST COMPILE in DOSBOX. Solutions posted in the future will only compile for DOSBOX

33 Using DOSBOX Run DOSBOX Choose your working folder by mounting your virtual C:\ Example: mount c C:\Program Files\Assembly Directory in quotations is where you will be storing your source code Once the C:\ is mounted, type C: to switch to your directory in DOSBOX

34 DOS commands You will need to know simple DOS commands to navigate your folders in the command line dir /p display contents of current directory (folders and files), one page at a time cd FolderName change directory to the folder called FolderName in your current directory Or type full directory path in place of folder name (C:\Windows\etc...)

35 DOS commands cd.. Go up a level in the folder hierarchy Prog.exe run program Prog.exe (must be in your current directory) help displays a list of usable commands

36 Shortcuts Up arrow previous command Tab Scrolls through available files/directories that begin with whatever you have started typing Use to avoid wasting time typing long directory pathways

37 Creating an Assembly file Create a text file Paste any program template you have into the file Change file name extension to.asm You may have to turn on the option to show file extensions on your computer Google how to do this if necessary

38 Programming Tools Course website has link to websites and tools you will need (these will also be ed) After you have created an.asm file, you ll need to compile and link your program before you can run it This is done within DOSBOX from your mounted C:\

39 Programming Tools Compile, link, and run program masm programname Include the file extension above Hit enter 4 times link programname DO NOT include the file extension above Hit enter 4 times Execute program To be demonstrated in class

40 Debugging Debug programname.exe Type? for command listing Commands that may be useful dump go Dumps a section of memory Jumps to a line of code in the program Is like running until a break point in a program Can be used to skip over interrupt routines

41 Debugging trace Allows you to step through the code one line at a time, allowing you to see the CPU state at any point unassemble Displays the disassembly starting from the next instruction to be executed Here is a guide that has examples which I found more useful than the help tool:

42 Notepad++ Recommend notepad++ as assembly editor for this course Highlights keywords Good organization/formatting Does not require an installer Available at:

43 Addressing Modes

44 x86 Addressing Modes Specify the method for finding the memory address of an operand e.g. using information held in registers and/or constants contained within a machine instruction Specifies operands in an assembly language program and is completely architecture dependent

45 Example MOV AH, 08h h stands for hexadecimal MOV copies operand 2 into operand 1 Source (data value 08h) is copied into destination (register AH) Data 08h is provided in the instruction Called Immediate addressing mode

46 x86 Addressing Modes There are three basic types of operands: Immediate Constant integer (8, 16, or 32 bits) Constant value is stored within the instruction Register Name of a register is specified Register number is encoded within the instruction Memory Reference to a location in memory Memory address is encoded within the instruction, or Register holds the address of a memory location

47 x86 Addressing Modes The Intel 8086 has about 9 data addressing modes: Immediate, register, direct, register indirect, based, indexed, based indexed, string, and port addressing Definition names vary across books Register and immediate modes do not need to access the external bus (faster) The syntax of the operand field determines the addressing mode

48 Immediate Addressing Mode MOV CX, 10 Immediate data is coded directly in the instruction s machine code Note: CX contains 0xA because there is no h after 10 The data is put in the operand field The constant in the operand field may be of byte or word length Some assemblers need a # before the constant

49 Immediate Addressing Mode Cont. The constant may be in hex., dec., binary, or text Default format is decimal Examples MOV CX, 65 MOV CX, 41h MOV CX, b MOV CX, A Advantage: No memory reference Disadvantage: Size of number is restricted to size of address field

50 Direct Addressing Mode MOV DS:[1234h], AL Copies AL using offset 1234h The operand is stored in a MEMORY location DS specifies data segment register An offset address is coded directly in the instruction The offset combined with DS forms the address where the operand is located

51 Direct Addressing Mode Cont. Ordinarily, DS: is assumed unless explicitly overridden using a colon (e.g. ES:[001h]) Advantage: Single memory reference to access data Disadvantage: Limited address space

52 Direct Addressing Mode Cont. Examples: Assume DS=10000h, ES=20000h, FRED=4567h MOV AX, [20h]; load the contents at address 10020h and 10021h into AL and AH respectively MOV DS:[1234h], AL; copy AL to address 11234h MOV ES:[1234h], AL; copy AL to address 21234h MOV FRED, AL; copy AL to address 14567h

53 Register Addressing Mode Instruction gets its source data from a register Data can be either 8/16/32 bits in length Data resulting from the operation is stored in another register Advantages: Only a small address field is needed in instruction No memory references are required Disadvantage: address space is very limited

54 Register Addressing Mode Cont. Examples: MOV AX, BX; copy the 16 bit content of BX to AX MOV AL, BL; copy the 8-bit content of BL to AL MOV SI, DI; copy DI into SI MOV DS, AX; copy AX into DS The following register to register transfers are not permitted. MOV BL, BX; mixed sizes MOV CS, AX; CS cannot be the destination MOV ES, DS; Segment register to segment register forbidden

55 Register Indirect Addressing Mode MOV CX, [BX] Copies a word from memory with location specified by BX Uses a register instead of a constant to specify the 16-bit offset address of the operand Offset address can be in any of the following registers: BP, BX, DI, SI. The [ ] is needed to denote register indirect addressing mode The DS register is the default segment address register (except BP, which uses SS as the default register)

56 Register Indirect Addressing Mode In cases of ambiguity: assemblers need the presence of BYTE PTR or WORD PTR directives to indicate the size of the data addressed by the memory pointer e.g. MOV [DI], 10h is ambiguous since assembler does not know whether to save 10h to memory as a byte or a word Instead, use the following: MOV BYTE PTR [DI], 10h; save 10h to memory MOV WORD PTR [DI], 10h; save 0010h to memory

57 Register Indirect Addressing Mode Register indirect addressing is commonly used to access a table of data in memory Examples: Assume BX=0222h, DS=10000h, SS=20000h, BP=0111h MOV CX, [BX]; Copy a byte from address 10222h and 10223h to CX MOV [BP], DL; Copy a byte from register DL to address 20111h Remember: Indirect addressing using BP defaults to SS

58 Based Addressing Mode Operand is located at the address given by adding 8 or 16 bit displacement to either BX or BP and combing the result with a segment register Displacement must be specified in the operand field Interpreted as signed 2 s complement value Examples Assume DS=1000h, SS=2000h, BP=0222h, BX=0111h MOV AX, [BP-2]; Copy the content of 20220h and 20221h to AX MOV [BX+777h], AX; Copy AL to 10888h and AH to 10889h

59 Indexed Addressing Mode Similar to based addressing except the index registers (SI or DI) must be used instead Operand is located at the address given by adding 8 or 16 bit displacement to either SI or DI and combing the result with a segment register Examples Assume DS=10000h, SI=222h, DI=111h MOV [DI-1], BL; store the content of BL to 10110h MOV BX, [SI+1000h]; Load BL with the contents of 11222h and BH with the contents of 11223h

60 Indexed Addressing Mode Cont. Based and indexed addressing are aka REGISTER RELATIVE addressing Other syntax may be permitted to indicate the displacement e.g. the following examples are all equivalent And they all result in the same assembled binary code Examples Assume FRED is a constant defined in the assembly code MOV [DI+FRED], BL MOV [DI]+FRED, BL MOV FRED[DI], BL

61 Based-Index-Relative Addressing The base and index registers are added to give the segment offset of where the operand is located The base register (either BX or BP) is added to an index register(di or SI) as positive integers only Each register lies in the range 0 to By default, the segment address is derived from DS except the BP register, which is derived from SS A signed displacement may also be included to calculate the offset

62 Based-Index-Relative Addressing Examples Assume SS=10000h, SI=3333h, BP=2222h MOV AX, [SI+BP]; Load the content of 15555h and 15556h to AL and AH respectively MOV AX, [SI+BP+1111h]; Load the contents of 16666h and 16667h to AL and AH respectively

63 String Addressing Mode A string is a series of bytes or words in sequential memory locations String instructions do not use any of the previous address modes Strings may be up to 64KB in length String addressing modes uses SI, DI, DS, and ES registers String instructions assume SI points to first byte of string to be processed, and DI points to first byte of destination string The use of a register my be implicit in the instruction

64 String Addressing Mode Example Assume DS=10000h, ES=20000h, SI=10h, DI=20h MOVSB; Move string byte from 10010h to 20020h

65 Port Addressing Mode 8086 has separate input/output space Up to I/O ports are available The I/O ports may be addressed by a byte sized constant Limited to I/O ports in the range 0 to 255 IN AL, 40h; Put the content of I/O port 40h into AL OUT 80h, AL; Send the contents of AL to I/O port 80h The I/O ports may be addressed using a register Full range of ports are accessible IN AL, DX; Load AL with the byte from port address given by DX OUT DX, AX; Send the word in AX to port address given by DX

66 Summary of Addressing Modes Operand needed for an instruction may be located: Immediately in the operand field, e.g. MOV AX, 1234h In a register (register addressing), e.g. MOV DS, AX In memory at a an offset specified by one of the following (disp is a constant): The segment address is in DS (by default, except when BP is used) In memory locations given implicitly by string instructions At input/output ports specified by a register or a constant

67 Instruction Set

68 Assembly Language Statements Three types of statements Directives or Pseudo-ops Instructions Macros

69 Assembly Language Statements Three types of statements Directives or Pseudo-ops Direct the assembler during the assembly process Used for variable declaration and storage allocation Non-executable and do not generate any machine language e.g. segment, db, dw Instructions Macros

70 Assembly Language Statements Three types of statements Directives of Pseudo-ops Instructions Instruct the processor to perform a task Contains operation code (opcode) Cause the assembler to generate machine language e.g. mov, add Macros

71 Assembly Language Statements Three types of statements Directives of Pseudo-ops Instructions Macros Permit the assembly language programmer to name a group of statements and refer to the group by the macro name During the assembly process, each macro is replaced by the group of statements that it represents and assembled in place

72 Directives: Data Allocation [var-name] define-directive initial-value,[initial-value] The define directive takes one of the five basic forms: DB Define Byte ;allocates 1 byte DW Define Word ;allocates 2 bytes DD Define Doubleword ;allocates 4 bytes DQ Define Quadword ;allocates 8 bytes DT Define Ten Bytes ;allocates 10 bytes Examples: var1 DB y var2 DB 79h var3 DB B

73 Directives: Data Allocation Another example: total DD This would allocated four contiguous bytes of memory and initialize it to (205A864Fh): Address: x x+1 x+2 x+3 Contents: 4F 86 5A 20

74 Directives: Data Allocation Or: total DB 20h,5Ah,86h,4Fh This would allocated four contiguous bytes of memory and initialize it to 205A864Fh: Address: x x+1 x+2 x+3 Contents: 20 5A 86 4F

75 Directives: Data Allocation Range of numeric operands DB: -2 7 to DW: to DD: to or a short floating-point number (32 bits) DQ: to or a long floating-point number Ranges depend on context (signed or unsigned)

76 Directives: Data Allocation Uninitialized Data and multiple initializations Use DUP command Number after DB indicates the number of bytes, and DUP(X) will fill the number of bytes with X Examples: text DB 10 DUP ( W ) ;initializes 10 bytes to W test DB 1 DUP(?) ;Reserve 1 uninitialized byte test2 DB 20 DUP(?) ;Reserve 20 uninitialized bytes

77 Directives: Data Allocation Multiple definitions: sort DB y ; ASCII of y = 79h value DW ; = 6247h total DD ; = 205A864Fh Memory allocation Address: x x+1 x+2 x+3 x+4 x+5 x+6 Contents: F 86 5A 20 More examples: message DB BYE,0Dh,0Ah OR message DB B DB Y DB E DB 0Dh DB 0Ah

78 Directives: Defining Constants name EQU expression Assigns the result of the expression to name. Example: NUM_OF_STUDENTS EQU 90 MOV AX, NUM_OF_STUDENTS

79 8086 Instructions Instructions can be of various types Data moving instructions Arithmetic add, subtract, increment, decrement, etc. Control transfer conditional, unconditional, call subroutine Logic AND, OR, XOR, shift/rotate and test String manipulation load, store, move, compare Input/Output instructions Other setting/clearing flag bits, stack operations, etc.

80 MOV mov destination, source mov register, register mov register, immediate mov memory, immediate mov register, memory mov memory, register Memory to memory forbidden. Examples mov [response], bh mov dx, [table1] mov [name1+4], k

81 Data transfer instructions lea register, memory_address Examples lea DX, mystring

82 Data Transfer Instructions XCHG exchanges 8, or 16-bit source and destination operands Examples xchg ax, dx xchg [response], cl xchg [total], dx As in the mov instruction, both operands cannot be located in memory. Note that this restriction is applicable to most instructions

83 Data Transfer Instructions XLATB instruction can be used to perform character translation To use this instruction, the BX register must be loaded with the starting address of the translation table and AL must contain an index value into the table The xlatb instruction adds contents of AL to BX and reads the byte at the resulting address. This byte replaces the index value in the AL register. Since the 8-bit AL register provides the index into the translation table, the number of entries in the table is limited to 256.

84 Arithmetic Instructions INC and DEC used to either increment or decrement the operands by one inc destination dec destination Examples inc bx ; increment bx register by one dec dl ; decrement 8-bit register

85 Arithmetic Instructions ADD used to add two 8 or 16-bit operands As with the mov instruction, add can also take the five basic forms depending on how the two operands are specified. The semantics of the add instruction are add destination, source => destination = destination + source Examples:

86 Arithmetic Instructions Examples:

87 Arithmetic Instructions Examples:

88 Arithmetic Instructions Examples:

89 Arithmetic Instructions Examples:

90 Arithmetic Instructions Examples:

91 Arithmetic Instructions SUB used to subtract two 8, 16-bit operands sub destination, source => destination = destination - source Examples:

92 Arithmetic Instructions CMP used to compare two 8, 16, or 32-bit numbers cmp operand1, operand2 => operand1-operand2 The cmp instruction performs the same operation as the sub instruction except that the result of subtraction is not saved Thus, cmp does not disturb the source and destination operands After the subtraction operation, flags are set accordingly

93 Arithmetic Instructions MUL used to perform unsigned multiplication of a number with AL register mul source The source operand can be in a general-purpose register or in memory. Immediate operand specification is not allowed Example: mov al, 10 mov dl, 25 mul dl

94 Arithmetic Instructions MUL is used to perform unsigned multiplication of a number with AL register Example: mov al, 2 mov bl, 80h ; 128 mul bl ;Ax = 0100h (256)

95 Arithmetic Instructions IMUL used to perform signed multiplication of a number with AL register imul source The behaviour of the imul instruction is similar to that of mul The only difference to note is that the carry and overflow flags are set if the upper half of the result is not the sign extension of the lower half mov al, 2 mov bl, f6h ; -10 imul bl ;ax = FFECh (-20) Note, here the carry and overflow flags are cleared, because AH contains the sign extension of the AL value

96 Arithmetic Instructions DIV, IDIV used to perform division of AX register div source (unsigned) idiv source (signed) Division generates two result components: a quotient and a remainder In multiplication, by using double-length registers, overflow never occurs. In division, divide overflow is a real possibility. The processor generates a special software interrupt when a divide overflow occurs

97 Arithmetic Instructions Example mov ax, 251 mov cl, 12 div cl Leaves 20 (14h) in the al register and 11 (0bh) in the ah register Therefore, ax contains 0b14h after division

98 Arithmetic Instructions Extension to larger operands: Both the multiplication and division instructions can be performed using 32-bit and 16-bit operands Or, 64-bit and 32-bit operands on 32-bit system Example:

99 Arithmetic Instructions Need for sign extension Example: Perform signed division 8000h/400h Here the divisor is larger than a byte, so dividend must be stored in DX AX However, 8000h fits entirely within AX So, AX needs to be sign extended to DX in order to maintain sign for division To aid sign extension instructions such as idiv, several instructions are provided: cbw cwd cdq ; Convert byte to word ; Convert word to doubleword ; Convert doubleword to quadword

100 Lab 04 Practice integer addition/subtraction/multiplication/division Know how to do this in signed (two s complement) form as well as unsigned Practice converting back and forth between fractional decimal and fractional binary numbers

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

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

INSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI

INSTRUCTOR: 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 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

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

Introduction to Microprocessor

Introduction to Microprocessor Introduction to Microprocessor The microprocessor is a general purpose programmable logic device. It is the brain of the computer and it performs all the computational tasks, calculations data processing

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

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

Defining and Using Simple Data Types

Defining 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 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

Arithmetic Instructions

Arithmetic 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 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

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

Intel 8086 MICROPROCESSOR ARCHITECTURE

Intel 8086 MICROPROCESSOR ARCHITECTURE Intel 8086 MICROPROCESSOR ARCHITECTURE 1 Features It is a 16-bit μp. 8086 has a 20 bit address bus can access up to 2 20 memory locations (1 MB). It can support up to 64K I/O ports. It provides 14, 16

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

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

Intel 8086 MICROPROCESSOR. By Y V S Murthy

Intel 8086 MICROPROCESSOR. By Y V S Murthy Intel 8086 MICROPROCESSOR By Y V S Murthy 1 Features It is a 16-bit μp. 8086 has a 20 bit address bus can access up to 2 20 memory locations (1 MB). It can support up to 64K I/O ports. It provides 14,

More information

Lecture 9. INC and DEC. INC/DEC Examples ADD. Arithmetic Operations Overflow Multiply and Divide

Lecture 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 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

Signed number Arithmetic. Negative number is represented as

Signed 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 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

8088/8086 Programming Integer Instructions and Computations

8088/8086 Programming Integer Instructions and Computations Unit3 reference 2 8088/8086 Programming Integer Instructions and Computations Introduction Up to this point we have studied the software architecture of the 8088 and 8086 microprocessors, their instruction

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

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

Basic characteristics & features of 8086 Microprocessor Dr. M. Hebaishy

Basic characteristics & features of 8086 Microprocessor Dr. M. Hebaishy Basic characteristics & features of 8086 Microprocessor Dr. M. Hebaishy Digital Logic Design Ch1-1 8086 Microprocessor Features: The 8086 microprocessor is a 16 bit microprocessor. The term 16 bit means

More information

8086 INTERNAL ARCHITECTURE

8086 INTERNAL ARCHITECTURE 8086 INTERNAL ARCHITECTURE Segment 2 Intel 8086 Microprocessor The 8086 CPU is divided into two independent functional parts: a) The Bus interface unit (BIU) b) Execution Unit (EU) Dividing the work between

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

Lecture 5:8086 Outline: 1. introduction 2. execution unit 3. bus interface unit

Lecture 5:8086 Outline: 1. introduction 2. execution unit 3. bus interface unit Lecture 5:8086 Outline: 1. introduction 2. execution unit 3. bus interface unit 1 1. introduction The internal function of 8086 processor are partitioned logically into processing units,bus Interface Unit(BIU)

More information

17. Instruction Sets: Characteristics and Functions

17. Instruction Sets: Characteristics and Functions 17. Instruction Sets: Characteristics and Functions Chapter 12 Spring 2016 CS430 - Computer Architecture 1 Introduction Section 12.1, 12.2, and 12.3 pp. 406-418 Computer Designer: Machine instruction set

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

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

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

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

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

More information

Program controlled semiconductor device (IC) which fetches (from memory), decodes and executes instructions.

Program controlled semiconductor device (IC) which fetches (from memory), decodes and executes instructions. 8086 Microprocessor Microprocessor Program controlled semiconductor device (IC) which fetches (from memory), decodes and executes instructions. It is used as CPU (Central Processing Unit) in computers.

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

UNIT 2 PROCESSORS ORGANIZATION CONT.

UNIT 2 PROCESSORS ORGANIZATION CONT. UNIT 2 PROCESSORS ORGANIZATION CONT. Types of Operand Addresses Numbers Integer/floating point Characters ASCII etc. Logical Data Bits or flags x86 Data Types Operands in 8 bit -Byte 16 bit- word 32 bit-

More information

EEM336 Microprocessors I. The Microprocessor and Its Architecture

EEM336 Microprocessors I. The Microprocessor and Its Architecture EEM336 Microprocessors I The Microprocessor and Its Architecture Introduction This chapter presents the microprocessor as a programmable device by first looking at its internal programming model and then

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

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 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 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

9/25/ Software & Hardware Architecture

9/25/ Software & Hardware Architecture 8086 Software & Hardware Architecture 1 INTRODUCTION It is a multipurpose programmable clock drive register based integrated electronic device, that reads binary instructions from a storage device called

More information

SPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY

SPRING 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 information

Instructions moving data

Instructions 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 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

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

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

Lecture 5: Computer Organization Instruction Execution. Computer Organization Block Diagram. Components. General Purpose Registers.

Lecture 5: Computer Organization Instruction Execution. Computer Organization Block Diagram. Components. General Purpose Registers. Lecture 5: Computer Organization Instruction Execution Computer Organization Addressing Buses Fetch-Execute Cycle Computer Organization CPU Control Unit U Input Output Memory Components Control Unit fetches

More information

Addressing Modes on the x86

Addressing 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 information

We can study computer architectures by starting with the basic building blocks. Adders, decoders, multiplexors, flip-flops, registers,...

We can study computer architectures by starting with the basic building blocks. Adders, decoders, multiplexors, flip-flops, registers,... COMPUTER ARCHITECTURE II: MICROPROCESSOR PROGRAMMING We can study computer architectures by starting with the basic building blocks Transistors and logic gates To build more complex circuits Adders, decoders,

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

Internal architecture of 8086

Internal architecture of 8086 Case Study: Intel Processors Internal architecture of 8086 Slide 1 Case Study: Intel Processors FEATURES OF 8086 It is a 16-bit μp. 8086 has a 20 bit address bus can access up to 220 memory locations (1

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

Module 3 Instruction Set Architecture (ISA)

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

More information

EXPERIMENT WRITE UP. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM

EXPERIMENT 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 information

Basic Execution Environment

Basic Execution Environment Basic Execution Environment 3 CHAPTER 3 BASIC EXECUTION ENVIRONMENT This chapter describes the basic execution environment of an Intel Architecture processor as seen by assembly-language programmers.

More information

ECOM 2325 Computer Organization and Assembly Language. Instructor: Ruba A.Salamah INTRODUCTION

ECOM 2325 Computer Organization and Assembly Language. Instructor: Ruba A.Salamah INTRODUCTION ECOM 2325 Computer Organization and Assembly Language Instructor: Ruba A.Salamah INTRODUCTION Overview Welcome to ECOM 2325 Assembly-, Machine-, and High-Level Languages Assembly Language Programming Tools

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

EEM336 Microprocessors I. Arithmetic and Logic Instructions

EEM336 Microprocessors I. Arithmetic and Logic Instructions EEM336 Microprocessors I Arithmetic and Logic Instructions Introduction We examine the arithmetic and logic instructions. The arithmetic instructions include addition, subtraction, multiplication, division,

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

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

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

MICROPROCESSOR PROGRAMMING AND SYSTEM DESIGN

MICROPROCESSOR PROGRAMMING AND SYSTEM DESIGN MICROPROCESSOR PROGRAMMING AND SYSTEM DESIGN ROAD MAP SDK-86 Intel 8086 Features 8086 Block Diagram 8086 Architecture Bus Interface Unit Execution Unit 8086 Architecture 8086 Programmer s Model Flag Register

More information

1-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

1-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 information

Advanced Microprocessors

Advanced Microprocessors Advanced Microprocessors Notes #2 Software Architecture & Instruction Set Architecture Part 1 EE 467/567 Winter 2012 by Avinash Kodi SWA.1 Background Materials Textbook: 2.1, 2.2, 3.1 Other: IA-32 Intel

More information

INTRODUCTION TO MICROPROCESSORS

INTRODUCTION TO MICROPROCESSORS INTRODUCTION TO MICROPROCESSORS Richa Upadhyay Prabhu NMIMS s MPSTME richa.upadhyay@nmims.edu January 7, 2016 Richa Upadhyay Prabhu (MPSTME) INTRODUCTION January 7, 2016 1 / 63 Course Design Prerequisite:

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

Q1: Multiple choice / 20 Q2: Memory addressing / 40 Q3: Assembly language / 40 TOTAL SCORE / 100

Q1: 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 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

Inline 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 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 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

icroprocessor istory of Microprocessor ntel 8086:

icroprocessor istory of Microprocessor ntel 8086: Microprocessor A microprocessor is an electronic device which computes on the given input similar to CPU of a computer. It is made by fabricating millions (or billions) of transistors on a single chip.

More information

The x86 Microprocessors. Introduction. The 80x86 Microprocessors. 1.1 Assembly Language

The x86 Microprocessors. Introduction. The 80x86 Microprocessors. 1.1 Assembly Language The x86 Microprocessors Introduction 1.1 Assembly Language Numbering and Coding Systems Human beings use the decimal system (base 10) Decimal digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Computer systems use the

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

Lecture 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. 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 information

Tutorial Letter 103/3/2012 Computer Organization COS2621 Semesters 1 & 2

Tutorial Letter 103/3/2012 Computer Organization COS2621 Semesters 1 & 2 COS2621/103/3/2012 Tutorial Letter 103/3/2012 Computer Organization COS2621 Semesters 1 & 2 School of Computing Solutions to self tests Bar code 2 Self-test A Question 1 Alternative 1 Which one of the

More information

Scott M. Lewandowski CS295-2: Advanced Topics in Debugging September 21, 1998

Scott 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 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

Mnem. 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

Mnem. 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 information

Computer Organization and Assembly Language CSC-210

Computer 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 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 - 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

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

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

More information

Week /8086 Microprocessor Programming I

Week /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 information

Assembly Language Each statement in an assembly language program consists of four parts or fields.

Assembly 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 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

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

Arithmetic and Logic Instructions And Programs

Arithmetic 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 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

We will first study the basic instructions for doing multiplications and divisions

We 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 information

The x86 Architecture

The 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 information

Lecture (02) The Microprocessor and Its Architecture By: Dr. Ahmed ElShafee

Lecture (02) The Microprocessor and Its Architecture By: Dr. Ahmed ElShafee Lecture (02) The Microprocessor and Its Architecture By: Dr. Ahmed ElShafee ١ INTERNAL MICROPROCESSOR ARCHITECTURE Before a program is written or instruction investigated, internal configuration of the

More information

Q1: Multiple choice / 20 Q2: Protected mode memory accesses

Q1: 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 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

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

An 8-Bit Scientific Calculator Based Intel 8086 Virtual Machine Emulator

An 8-Bit Scientific Calculator Based Intel 8086 Virtual Machine Emulator Available online at www.sciencedirect.com ScienceDirect Procedia Computer Science 21 (2013 ) 506 511 The 4th International Conference on Emerging Ubiquitous Systems and Pervasive Networks (EUSPN-2013)

More information

A Presentation created By Ramesh.K Press Ctrl+l for full screen view

A Presentation created By Ramesh.K Press Ctrl+l for full screen view Press Ctrl+l for full screen view A Presentation created By Ramesh.K rameshpkd@gmail.com Press Ctrl+l for full screen view A Microprocessor sor is a multipurpose, programmable logic device that reads binary

More information

complement) Multiply Unsigned: MUL (all operands are nonnegative) AX = BH * AL IMUL BH IMUL CX (DX,AX) = CX * AX Arithmetic MUL DWORD PTR [0x10]

complement) 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 information

Introduction to IA-32. Jo, Heeseung

Introduction to IA-32. Jo, Heeseung Introduction to IA-32 Jo, Heeseung IA-32 Processors Evolutionary design Starting in 1978 with 8086 Added more features as time goes on Still support old features, although obsolete Totally dominate computer

More information

Computer Architecture and System Software Lecture 12: Review. Instructor: Rob Bergen Applied Computer Science University of Winnipeg

Computer Architecture and System Software Lecture 12: Review. Instructor: Rob Bergen Applied Computer Science University of Winnipeg Computer Architecture and System Software Lecture 12: Review Instructor: Rob Bergen Applied Computer Science University of Winnipeg Announcements Assignment 5 due today Assignment 5 grades will be e-mailed

More information

Lecture (07) x86 programming 6

Lecture (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 information