Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.

Slides:



Advertisements
Similar presentations
Registers of the 8086/ /2002 JNM.
Advertisements

How Instruction Affect the Flags
Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU
Princess Sumaya Univ. Computer Engineering Dept. د. بســام كحـالــه Dr. Bassam Kahhaleh.
ACOE2511 Assembly Language Arithmetic and Logic Instructions.
Princess Sumaya University
Irvine: Assembly Language for Intel-Based Computers (1999) Symbolic Constants Equal-sign Directive EQU Directive TEXTEQU Directive.
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
Assembly Language Advantages 1. It reveals the secret of your computer’s hardware and software. 2. Speed. 3. Some special applications and occasions. Disadvantages.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Introduction to Subroutines. All the combinations in which a subroutine can be written 1. The subroutine may be: a. Internal or b. External 2. The type.
Chapter 1: Basic Concepts
1/2002JNM1 Positional Notation (Hex Digits). 1/2002JNM2 Problem The 8086 has a 20-bit address bus. Therefore, it can access 1,048,576 bytes of memory.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Chapter 3 Examining Computer Memory and Executing Instructions.
Types of Registers (8086 Microprocessor Based)
LAB Flag Bits and Register
Lecture 4 ( Assembly Language).
1 Assembler A short Overview. 2 Content Language Levels High Level  micro code Machinecode language Assembler languages Structure Commands.
Debuggers A program needed when writing any type of code Displays the contents of memory Lets you view registers and variables and see how they change.
UHD:CS2401: A. Berrached1 The Intel x86 Hardware Organization.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#9) By Dr. Syed Noman.
L AB 2. P ROGRAM STRUCTURE The assembly language program consist of code, data and stack. Data segment: contains all the variable definition..Data Code.
3.4 Addressing modes Specify the operand to be used. To generate an address, a segment register is used also. Immediate addressing: the operand is a number.
6-4 CPU-Registers, effective address General registers vs Segment registers Computer Studies (AL)
DAT2343 Implementing Standard Logic Flows with 80x86 Assembler © Alan T. Pinck / Algonquin College; 2003.
Introduction to Microprocessors Chapter 3. Programming Model (8086)  Shows the various internal registers that are accessible to the programmer.
Introduction to Computer Organization and Assembly Language
The Assemble, Unassemble commands of the debugger: U Command for converting machine code language source Equivalent machine code instructions Equivalent.
2/20/2016CAP 2211 Flow Control Instructions. 2/20/2016CAP 2212 Transfer of Control Flow control instructions are used to control the flow of a program.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Internal Programming Architecture or Model
Preliminary to Assembly Language Programming CE 140 A1/A2 28 June 2003.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
ΜComputer Structure μProcessor Memory Bus System I/O Ports.
1 Chapter 1: Introduction Appendix A: Binary and Hexadecimal Tutorial Assembly Language for Intel-Based Computers, 3rd edition Kip R. Irvine.
Gunjeet Kaur Dronacharya Group of institutions
Assembly Language Programming Part 3
1. Introduction A microprocessor executes instructions given by the user Instructions should be in a language known to the microprocessor Microprocessor.
8086 Microprocessor.
Instruction Execution Cycle
ICS312 SET 7 Flags.
Microprocessor and Assembly Language
(The Stack and Procedures)
Arithmetic Instructions
Introduction to Assembly Language
Memory Organisation Source: under
Chapter 4: Instructions
Lecture 4 ( Assembly Language).
Flags Register & Jump Instruction
8086 Registers Module M14.2 Sections 9.2, 10.1.
CS-401 Computer Architecture & Assembly Language Programming
DEBUG.
Microprocessor Lab CSL1543 0:0:2
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Symbolic Instruction and Addressing
(The Stack and Procedures)
University of Gujrat Department of Computer Science
Symbolic Instruction and Addressing
Morgan Kaufmann Publishers Computer Organization and Assembly Language
CNET 315 Microprocessor & Assembly Language
Lecture 06 Programming language.
University of Gujrat Department of Computer Science
Computer Architecture CST 250
Microprocessor and Assembly Language
Chapter 6 –Symbolic Instruction and Addressing
(The Stack and Procedures)
Chapter 8: Instruction Set 8086 CPU Architecture
Part I Data Representation and 8086 Microprocessors
Part IV The FLAGS Register
Presentation transcript:

Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization & Assembly Language Lecture 15 Debug Program

 Introduction  A demo program  Using the debug program Debug Program2

 The DEBUG program provides an environment in which a program may be tested.  The user can step through a program, and display and change the registers and memory.  It is also possible to enter assembly code directly, which DEBUG converts to machine code and stores in memory. Debug Program3

TITLE demo: CHECK FLAGS ; used in DEBUG to check flag settings.MODEL SMALL.STACK 100H.CODE MAIN PROC MOV AX,4000H; AX = 4000h ADD AX, AX; AX = 8000h SUB AX, 0FFFFH; AX = 8001h NEG AX; AX = 7FFFh INC AX; AX = 8000h MOV AH, 4CH; DOS exit function INT 21H; exit to DOS MAIN ENDP END MAIN Debug Program4

 To enter DEBUG, (after assembling and linking the code) type: c:\asm> DEBUG demo.exe  DEBUG responds by its prompt, “-”, and waits for a command to be entered.  Basic DEBUG commands:  R: to view the registers.  T: to trace the program.  G: to complete execution of the program.  Q: to exit the DEBUG program Debug Program5

6 - R AX=0000 BX=0000 CX=000F DX=0000 SP=0100 BP=0000 SI=0000 DI=0000 DS=19FA ES=19FA SS=1A0B CS=1A0A IP=0000 NV UP EI PL NZ NA PO NC 1A0A:0000 B80040 MOV AX, 4000 Address of the next instruction to be executed Machine code of the next instruction to be executed Current flag settings To view the registers, type R:

Debug Program7 Status FlagSet (1) SymbolClear (0) Symbol CFCY (carry)NC (no carry) PFPE (even parity)PO (odd parity) AFAC (auxiliary carry)NA (no auxiliary carry) ZFZR (zero)NZ (nonzero) SFNG (negative)PL (plus) OFOV (overflow)NV (no overflow) Control Flag DFDN (down)UP (up) IFEI (enable interrupts)DI (disable interrupts)

Debug Program8 -T AX=4000 BX=0000 CX=000F DX=0000 SP=0100 BP=0000 SI=0000 DI=0000 DS=19FA ES=19FA SS=1A0B CS=1A0A IP=0003 NV UP EI PL NZ NA PO NC 1A0A: C0 ADD AX, AX Unchanged, since a MOV doesn’t affect the flags To step through the program, type T : The first instruction is MOV AX, 4000h

Debug Program9 -T AX=8000 BX=0000 CX=000F DX=0000 SP=0100 BP=0000 SI=0000 DI=0000 DS=19FA ES=19FA SS=1A0B CS=1A0A IP=0005 OV UP EI NG NZ NA PE NC 1A0A: E8FF SUB AX, -01 To step through the program, type T: Next, ADD AX, AX

Debug Program10 -T AX=8001 BX=0000 CX=000F DX=0000 SP=0100 BP=0000 SI=0000 DI=0000 DS=19FA ES=19FA SS=1A0B CS=1A0A IP=0008 NV UP EI NG NZ AC PO CY 1A0A:0008 F7D8 NEG AX To step through the program, type T: Next, SUB AX, 0FFFFh

Debug Program11 -T AX=7FFF BX=0000 CX=000F DX=0000 SP=0100 BP=0000 SI=0000 DI=0000 DS=19FA ES=19FA SS=1A0B CS=1A0A IP=000A NV UP EI PL NZ AC PE CY 1A0A:000A 40 INC AX To step through the program, type T: Next, NEG AX

Debug Program12 -T AX=8000 BX=0000 CX=000F DX=0000 SP=0100 BP=0000 SI=0000 DI=0000 DS=19FA ES=19FA SS=1A0B CS=1A0A IP=000B OV UP EI NG NZ AC PE CY 1A0A:000B B44C MOV AH, 4C To step through the program, type T: Finally, INC AX

Debug Program13 Program terminated normally To complete execution of the program, type G: -Q c:\asm> To exit the DEBUG program, type Q:

 There are many other DEBUG commands, among them are:  R{register}: to change the contents of a register.  E: to change the contents of a memory location.  D: to display memory contents byte by byte.  U: to display the corresponding machine code.  Appendix E contains a detailed description of all DEBUG commands !!! Debug Program14