DEBUG.

Slides:



Advertisements
Similar presentations
Intel 8086.
Advertisements

Registers of the 8086/ /2002 JNM.
Chapter 2 (cont.) An Introduction to the 80x86 Microprocessor Family Objectives: The different addressing modes and instruction types available The usefulness.
Princess Sumaya Univ. Computer Engineering Dept. د. بســام كحـالــه Dr. Bassam Kahhaleh.
Lab6 – Debug Assembly Language Lab
Princess Sumaya University
CHAPTER 5 INTRODUCTION TO ASSEMBLY LANGUAGE
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.
8051 ASSEMBLY LANGUAGE PROGRAMMING
An Introduction to 8086 Microprocessor.
Chapter 3 Examining Computer Memory and Executing Instructions.
Types of Registers (8086 Microprocessor Based)
1 Assembler A short Overview. 2 Content Language Levels High Level  micro code Machinecode language Assembler languages Structure Commands.
CET 3510 Microcomputer Systems Tech. Lecture 2 Professor: Dr. José M. Reyes Álamo.
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.
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.
Microprocessor Dr. Rabie A. Ramadan Al-Azhar University Lecture 8.
Khaled A. Al-Utaibi  I/O Ports  I/O Space VS Memory Space  80x86 I/O Instructions − Direct I/O Instructions − Indirect I/O Instructions.
University of Tehran 1 Microprocessor System Design Omid Fatemi Machine Language Programming
1 เครื่องมือในการพัฒนาภาษา แอสเซมบลี้. 2 Tools Assembly language vs. machine code Edit and debugging tools Debug, program you can use to test and debug.
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)
Introduction to Microprocessors Chapter 3. Programming Model (8086)  Shows the various internal registers that are accessible to the programmer.
8086/8088 Instruction Set, Machine Codes and Addressing Modes.
The Assemble, Unassemble commands of the debugger: U Command for converting machine code language source Equivalent machine code instructions Equivalent.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
MODULE 5 INTEL TODAY WE ARE GOING TO DISCUSS ABOUT, FEATURES OF 8086 LOGICAL PIN DIAGRAM INTERNAL ARCHITECTURE REGISTERS AND FLAGS OPERATING MODES.
Internal Programming Architecture or Model
Preliminary to Assembly Language Programming CE 140 A1/A2 28 June 2003.
Intel 8086 MICROPROCESSOR ARCHITECTURE
BITS Pilani Pilani Campus Pawan Sharma Lecture / ES C263 INSTR/CS/EEE F241 Microprocessor Programming and Interfacing.
Μ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.
Assembly Language (continue)
Gunjeet Kaur Dronacharya Group of institutions
History – 2 Intel 8086.
Assembly Language Programming Part 3
8086 Microprocessor.
Computer Organization & Assembly Language Chapter 3
Instruction Execution Cycle
ICS312 SET 7 Flags.
ADDRESSING MODES.
Microprocessor and Assembly Language
Assembly IA-32.
ADDRESSING MODES.
Intel 8088 (8086) Microprocessor Structure
CS 301 Fall 2001 – Chapter 3 Slides by Prof. Hartman, following “IBM PC Assembly Language Programming” by Peter Abel 9/17/2018.
Defining Types of data expression Dn [name] expression Dn [name]
Symbolic Instruction and Addressing
Introduction to Assembly Language
Lecture 4 ( Assembly Language).
Intel 8088 (8086) Microprocessor Structure
8086 Registers Module M14.2 Sections 9.2, 10.1.
CS-401 Computer Architecture & Assembly Language Programming
اصول اساسی برنامه نویسی به زبان اسمبلی
Interrupt Mechanism Interrupt Compared With Procedures Call MyProc
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Symbolic Instruction and Addressing
CS 301 Fall 2002 Computer Organization
University of Gujrat Department of Computer Science
Symbolic Instruction and Addressing
Lecture 06 Programming language.
Microprocessor and Assembly Language
8051 ASSEMBLY LANGUAGE PROGRAMMING
Chapter 6 –Symbolic Instruction and Addressing
Intel 8086.
CS-401 Computer Architecture and Assembly Language Programming
Part I Data Representation and 8086 Microprocessors
Presentation transcript:

DEBUG

Functions and Features * Program name = DEBUG.COM * Target: IBM PC * Extremely useful, when used correctly. Almost a must for Assembler Language programmers * can provide an insight into the operation of the machine at the bit level. can display and change any of the registers in the IBMPC can start and stop program execution at any time, can change the program can look at diskettes, sector by sector. works at the machine code level can disassemble machine code, can assemble instructions directly into machine code.

? -? assemble A [address] compare C range address dump D [range] enter E address [list] fill F range list go G [=address] [addresses] hex H value1 value2 input I port load L [address] [drive] [firstsector] [number] move M range address name N [pathname] [arglist] output O port byte proceed P [=address] [number] quit Q register R [register] search S range list trace T [=address] [value] unassemble U [range] write W [address] [drive] [firstsector] [number] allocate expanded memory XA [#pages] deallocate expanded memory XD [handle] map expanded memory pages XM [Lpage] [Ppage] [handle] display expanded memory status XS

R (Register) -R AX=0000 BX=0000 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000 DS=0AE6 ES=0AE6 SS=0AE6 CS=0AE6 IP=0100 NV UP EI PL NZ NA PO NC 0AE6:0100 74D0 JZ 00D2 -R AX AX 0000 :1234 -R BX BX 0000 :567U ^ Error -R F NV UP EI PL NZ NA PO NC -PE AX=1234 BX=0000 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000 DS=0AE6 ES=0AE6 SS=0AE6 CS=0AE6 IP=0100 NV UP EI PL NZ NA PE NC -Q

Flag Flag “1” “0” Overflow Direction Interrupt Sign Zero Auxiliary Carry Parity Carry OV DN EI NG ZR AC PE CY NV UP DI PL NZ NA PO NC

D (Dump) -D -D 100 -D DS:100 -D 0AE6:100 ASCII 0AE6:0100 74 D0 F6 06 22 99 80 74-39 F6 06 22 99 20 75 0A t..."..t9..". u. 0AE6:0110 80 3E DF 99 00 75 BB 49-74 B8 BA 18 34 00 D5 0A .>...u.It...4... 0AE6:0120 D2 87 D1 B8 01 42 CD 21-A3 EC 99 89 16 EE 99 80 .....B.!........ 0AE6:0130 3E D2 96 00 74 9C B4 40-CD 21 72 5F C6 06 F0 99 >...t..@.!r_.... 0AE6:0140 1A C3 E8 FF 0F FE 06 DF-96 80 3E DE 96 00 74 48 ..........>...tH 0AE6:0150 8B 1E 20 99 83 FB 00 7E-33 8B 0E EE 99 8B 16 EC .. ....~3....... 0AE6:0160 99 8B C1 0B C2 74 21 B8-00 42 CD 21 33 C9 B4 40 .....t!..B.!3..@ 0AE6:0170 CD 21 80 3E F0 99 00 74-08 41 BA F0 99 B4 40 CD .!.>...t.A....@. ASCII 128 bytes “.”: Unprintable ASCII character

D, D, … -D 0AE6:0100 74 D0 F6 06 22 99 80 74-39 F6 06 22 99 20 75 0A t..."..t9..". u. 0AE6:0110 80 3E DF 99 00 75 BB 49-74 B8 BA 18 34 00 D5 0A .>...u.It...4... 0AE6:0120 D2 87 D1 B8 01 42 CD 21-A3 EC 99 89 16 EE 99 80 .....B.!........ 0AE6:0130 3E D2 96 00 74 9C B4 40-CD 21 72 5F C6 06 F0 99 >...t..@.!r_.... 0AE6:0140 1A C3 E8 FF 0F FE 06 DF-96 80 3E DE 96 00 74 48 ..........>...tH 0AE6:0150 8B 1E 20 99 83 FB 00 7E-33 8B 0E EE 99 8B 16 EC .. ....~3....... 0AE6:0160 99 8B C1 0B C2 74 21 B8-00 42 CD 21 33 C9 B4 40 .....t!..B.!3..@ 0AE6:0170 CD 21 80 3E F0 99 00 74-08 41 BA F0 99 B4 40 CD .!.>...t.A....@. 0AE6:0180 21 B4 3E CD 21 E9 6A FA-B4 3E CD 21 BA C9 98 B4 !.>.!.j..>.!.... 0AE6:0190 41 CD 21 C6 06 DE 96 00-E9 57 FA E9 AE FE 24 0C A.!......W....$. 0AE6:01A0 7A 10 50 24 08 A2 E1 99-58 24 04 A2 E5 99 08 06 z.P$....X$...... 0AE6:01B0 DF 99 A0 E5 99 0A C0 C3-80 3E C4 98 FF 75 0C BF .........>...u.. 0AE6:01C0 EE 94 BD C4 98 E8 11 01-E8 6B E4 32 C0 86 06 23 .........k.2...# 0AE6:01D0 99 0A C0 75 03 E9 8C 00-8B 36 C6 98 BF 83 97 B8 ...u.....6...... 0AE6:01E0 00 29 CD 21 80 3C 00 74-06 BA 9B 8A E9 53 FF A1 .).!.<.t.....S.. 0AE6:01F0 C9 98 80 FC 3A 74 02 B0-40 8A 0E E5 99 0C 20 2C ....:t..@..... , 0AE6:0200 60 A2 83 97 A0 C8 98 8A-26 2B 99 25 02 02 0A C0 `.......&+.%.... 0AE6:0210 74 13 3A C4 75 0F 80 3E-E6 99 00 74 08 FE 06 24 t.:.u..>...t...$ 0AE6:0220 99 32 C0 EB 06 34 02 22-C4 D0 E8 0A 06 E6 99 A2 .2...4."........ 0AE6:0230 D4 96 D0 E0 D0 E0 A2 DF-99 80 3E E1 99 00 75 24 ..........>...u$ 0AE6:0240 A2 E5 99 0A C9 75 1D 0A-C0 74 19 8B 0E E2 96 E3 .....u...t...... 0AE6:0250 13 B0 1A 06 33 FF 8E 06-C1 96 F2 AE 07 75 05 4F ....3........u.O 0AE6:0260 89 3E E2 96 BB C7 97 80-3E D4 96 00 74 03 BB 0D .>......>...t... 0AE6:0270 98 BE 84 97 8B 3E C6 98-B9 08 00 E8 12 00 80 3C .....>.........<

D addr1 addr2 -D 215 225 0AE6:0210 0F 80 3E-E6 99 00 74 08 FE 06 24 ..>...t...$ 0AE6:0220 99 32 C0 EB 06 34 .2...4

E (Enter) -D 100 0AE6:0100 74 D0 F6 06 22 99 80 74-39 F6 06 22 99 20 75 0A t..."..t9..". u. 0AE6:0110 80 3E DF 99 00 75 BB 49-74 B8 BA 18 34 00 D5 0A .>...u.It...4... 0AE6:0120 D2 87 D1 B8 01 42 CD 21-A3 EC 99 89 16 EE 99 80 .....B.!........ 0AE6:0130 3E D2 96 00 74 9C B4 40-CD 21 72 5F C6 06 F0 99 >...t..@.!r_.... 0AE6:0140 1A C3 E8 FF 0F FE 06 DF-96 80 3E DE 96 00 74 48 ..........>...tH 0AE6:0150 8B 1E 20 99 83 FB 00 7E-33 8B 0E EE 99 8B 16 EC .. ....~3....... 0AE6:0160 99 8B C1 0B C2 74 21 B8-00 42 CD 21 33 C9 B4 40 .....t!..B.!3..@ 0AE6:0170 CD 21 80 3E F0 99 00 74-08 41 BA F0 99 B4 40 CD .!.>...t.A....@. -E 100 12 34 56 78 0AE6:0100 12 34 56 78 22 99 80 74-39 F6 06 22 99 20 75 0A t..."..t9..". u.

“-” & space “-” : backward Space: forward E DS:100

F (Fill) Format: -F startAddr endAddr list Example:

M (Move) Format: -M startAddr endAddr destAddr Example: -M 100 110 120

C (Compare) Format: -C startAddr endAddr destAddr Example:

S (Search) Format: -S startAddr endAddr list Example: -S 100 110 12 34

I (Input) Format: -I addr Example: -I 1234 “addr” is the I/O port address ranging from 0000H to FFFFH. Totally there are 64K byte-wide ports. Example: -I 1234

O (Output) Format: -O addr byte Example: -O 1234 0

H (Hex add/sub) Format: -H num1 num2 Example: -H 1234 1111 2345 0123 “num1” and “num2” are no longer than 2 bytes. Example: -H 1234 1111 2345 0123 -H 0 1234 1234 EDCC Negative of 1234H

U (Unassemble) Format: -U [startAddr [endAddr]] Example: -E 100 88 C3

Diskette Format One double-sided double-density diskette = 10001(?) sectors * 512 byte/sector

W (Write); L (Load) Format: -W [startAddr [drive startSector noOfSectors]] -L [startAddr [drive startSector noOfSectors]] Example: -W DS:100 a: ?

N (Name) Format: -N fileName Example: -N a:test1.txt Application: -N fileName (指定檔案名稱) (BX CX)  number of bytes -W [startAddr] (指定要存到檔案的資料之起始位置, 並將資料寫入檔案) Application: N fileName L [startAddr] (將檔案內的資料讀到記憶體。) Write down the DEBUG commands to write 10H bytes of data from ds:222H into disk directory d:\aa\bb with filename dddd.txt Example: -N a:test1.txt Example: -N c:\users\jzTsai\dbg\test2.txt

A (Assemble) Format: -A startAddr

T (Trace) Format: -T [=startAddr] [numberOfInstructions] Example: -T =CS:100 5

G (Go) Format: -G [=startAddr [breakpointAddrList] Example: -G =CS:100 128 -G =CS:100 -G

Example -a 100 0AE6:0100 add dx,1234 0AE6:0104 -d 100 103 0AE6:0100 81 C2 34 12 ..4. -u 100 103 0AE6:0100 81C23412 ADD DX,1234

Example: programming with debug -A CS:100 0AE6:0100 MOV AX,12 0AE6:0103 MOV BX,34 0AE6:0106 ADD AX,BX 0AE6:0108 -d 100 107 0AE6:0100 B8 12 00 BB 34 00 01 D8 ....4... -u 100 107 0AE6:0100 B81200 MOV AX,0012 0AE6:0103 BB3400 MOV BX,0034 0AE6:0106 01D8 ADD AX,BX -N A:TEST2.MCD -R CX CX 0000 :8 -R BX BX 0000 :0 -W CS:100 Writing 00008 bytes

Further reading: Tutorials on the Internet You can find some tutorials of the DEBUG program on the Internet, such as from the following websites: http://netcity2.web.hinet.net/UserData/suchya/ http://www.xploiter.com/programming/asm/debug.shtml http://www.datainstitute.com/debug1.htm http://www.plumb.org/tekmage/Inspire/debug-manual.html http://mirror.href.com/thestarman/asm/debug/debug.htm http://www.geocities.com/thestarman3/asm/debug/debug2.htm  

To debug a program >debug calcul.exe