what is the correct dos coding to format a hard drive



    I hope you lot relish the Assembly coding examples used on this page. If yous have any questions virtually them, use this online form to e-mail me. ( Opens in a new window. )

A Guide to DEBUG
(Page Two)

A DEBUG Tutorial

Copyright©2005,2009 past Daniel B. Sedory

This page may be freely copied for PERSONAL utilize ONLY !
( Information technology may NOT be used for Whatsoever other purpose unless you have
commencement contacted and received permission from the author! )


  • Each Control -- Listed Alphabetically
    • Quick Links to Command Assistance
  • How to Use the COMMANDS
    • Meaning of Command Parameters
    • Detailed Help on each Command (begins here)
      • An Example Plan for you to Enter, Run and Edit under DEBUG.
      • A Annotation near Win 9x's 'IHC' cord in Diskette Boot Sectors
  • Appendixes
    • The 8086 CPU Registers
    • The FLAGS Register
    • The Segment:Offset Addressing method used by DEBUG

Help on DEBUG Commands

For a reminder of all the commands (and about of the parameters) that are available while inside of DEBUG, but enter a question mark ( ? ) at the DEBUG prompt; when using DOS 5.0 or later. ( Notation: Expanded Memory commands are rarely if ever used and will non be discussed here.)

Quick Alphabetical Links
Click on a command here for all its details:

                          -?                                      gather    A [address]              compare     C range address              dump        D [range]              enter       East address [list]              make full        F range listing              go          G [=accost] [addresses]              hex         H value1 value2              (Learn 2'due south Complement!)              input       I port              load        L [address] [bulldoze] [firstsector] [number]              movement        Yard range address              name        North [pathname] [arglist]              output      O port byte              proceed     P [=address] [number]              quit        Q              . . . . . . . . . (Larn this first!)              register    R [register]              search      S range list              trace/step  T [=address] [number]              unassemble  U [range]                            write       West [accost] [drive] [firstsector] [number]                                

H o w   t o   u south east   t h east
C O G Grand A N D S


P a r a m e t e r s


      NOTE:   Parameters listed in brackets ( [   ] ) are optional.   Optional parameters usually betoken there are a number of different ways a command could be used. I've listed the meanings of all the parameters hither for yous:

accost - Memory location specified in hexadecimal. You can use either a simple Offset all past itself (in which case, the present CS 'Code Segment' will be assumed), or you tin enter the total Segment:Offset location using either all hex numbers or substituting the name of a segment register for a number. Leading zeros are not required; thus 1F all by itself would be the location 'CS:001F' ( CS meaning whatever the CS happened to be at the time you entered this ). Examples:

                              100    DS:12    SS:0    198A:1234              
For a detailed word, run into: Segment:Commencement notation.     range - 2 hexadecimal addresses separated by a single space. They may exist listed as either full Segment:Outset pairs or merely an Commencement lone ( in which case, the Segment is causeless to exist that of the nowadays CS or "Code Segment" ). NOTE: Some commands, such as Compare (C), may require the second address exist given only as an outset.         list - A string of Hexadecimal bytes separated by a space, or ASCII data enclosed inside single or double quote marks. You can listing any number of bytes from a single ane up whatsoever number fits on the line before having to press the Enter key. A unmarried byte, such equally 00 is most ofttimes used with the Make full (f) command whereas an ENTER (e) command will most likely take a string of many hex bytes or ASCII characters per line; for example:
                              east 100 31 C0 B4 09 BA 50 02 CD 21 B8 4C 00 CD 21      due east 250 'This is an ASCII data string.$'                        

number - Think all numbers and values used in whatsoever DEBUG command are understood as being Hexadecimal only! That includes the number of sectors in the LOAD or WRITE commands and even the number of instructions you lot desire DEBUG to stride through in the TRACE or Proceed commands. It'south all HEX all the time when using DEBUG!


A Simple DEBUG Tutorial

Details of each Command



Notation: In the Examples below, commands which are entered by a user are shown in bold type; information displayed in response by DEBUG is in normal type. DEBUG (from MS-DOS 5.0 or later (which is true for the DEBUG version used by Windows™ XP) will display the following usage message, if you enter debug /? at a DOS prompt:

C:\WINDOWS>debug /?        Runs Debug, a program testing and editing tool.  DEBUG [[drive:][path]filename [testfile-parameters]]    [drive:][path]filename  Specifies the file you want to test.   testfile-parameters     Specifies command-line data required by                           the file you want to test.

                                            Quit:            Q              

    Immediately quits (exits) the Debug program! No questions e'er asked... should exist the first control you remember along with the " ? " command.

Dorsum to TOC          
Hex: H value1 value2
    A very simple (add and subtract only) Hex estimator. Never forget that all numbers inside of DEBUG are always Hexadecimal. Enter 2 Hex values (no more than 4 digits each) and DEBUG shows beginning the SUM, and then the DIFFERENCE of those values. Examples:
                  -h aaa 531          -h fff 3          -h dbf ace          0FDB  0579    1002  0FFC    188D  02F1    -             -             -      

Differences are e'er the second value subtracted from the first; AAA - 531 = 579 . There are no carries past four digits.

Two's Complement arithmetic is e'er used in this computer, and so call up of it equally being limited to a maximum of plus 7FFFh (+ 32,767) or a minimum of minus 8000h (- 32,768). Positive values are represented by exactly the same digits as their numbers for 0000h through 7FFFh. A minus 7FFFh, yet, is represented by the Hex digits 8001 , and a minus 1h (-1) is represented by the Hex digits FFFF . Thus, the output of DEBUG after entering " h iv fffc " would be a nil and an eight, because FFFC represents a minus 4h (-4) and 4 - ( -4 ) = 8 .  Examples:

                  -h 4 fffc          -h 100 123          -h 7fff 8000          0000 0008    0223  FFDD    FFFF FFFF    -            -             -      
Note the difference betwixt 100h and 123h; what does FFDD represent? To find the numerical value of a Two's Complement number, first invert as (or detect its logical inverse); that would be 0022 , then add ane. So, this represents a negative 23h. Both the sum and the divergence of 7FFFh and 8000h are a negative 1 (or FFFF ); which can be arrived at using: 7FFFh + (- 8000h) = -1. However, information technology's much easier to think of the sums every bit having cipher to exercise with Ii's Complement notation; thus, 7FFFh + 8000h = FFFFh (32,767 + 32,768 = 65,535). This will even agree true for the differences if the second value is less than the first. Only any departure which produces a negative number, must be represented in Two'southward Complement.
        Back to TOC        
Dump: D [range] D [accost] [length]

    Displays the contents of a block of memory. The Memory locations well-nigh the showtime of Segment C000 (fifty-fifty nether Windows 2000/XP) should brandish data about the kind of video card installed on your PC. The starting time example beneath shows what a Matrox video menu on our organization displayed.

Examples:

-d c000:0010        C000:0010 24 12 FF FF 00 00 00 00-60 00 00 00 00 twenty 49 42  $.......`....        IB        C000:0020 4D 20 43 4F 4D 50 41 54-49 42 4C 45 20 4D 41 54        Thou Uniform MAT        C000:0030 52 4F 58 2F 4D 47 41 2nd-47 31 30 30 20 56 47 41        ROX/MGA-G100 VGA        C000:0040 2F 56 42 45 20 42 49 4F-53 20 28 56 31 2E 32 20        /VBE BIOS (V1.ii        C000:0050 29 00 87 DB 87 DB 87 DB-87 DB 87 DB 87 DB 87 DB        )............... C000:0060 50 43 49 52 2B 10 01 10-00 00 18 00 00 00 00 03  PCIR+........... C000:0070 40 00 12 10 00 fourscore 00 00-38 37 34 2D 32 00 FF FF  @.......874-2... C000:0080 E8 26 56 8B D8 E8 C6 56-74 22 8C C8 3D 00 C0 74  .&V....Vt"..=..t -
-d 100 130        xxxx:0100 EB 24 0D 0A 54 68 69 73-20 69 73 20 6D 79 twenty 66  .$..This is my f xxxx:0110 69 72 73 74 20 44 45 42-55 47 20 70 72 6F 67 72  irst DEBUG progr xxxx:0120 61 6D 21 0D 0A 24 B4 09-BA 02 01 CD 21 B4 00 CD  am!..$......!... xxxx:0130 21                                               ! -
The last case above, is what you'd see afterward entering the code under the Assemble control. We could only every bit easily have used the length pick with the command ' d 100 l31 ' (that's an 'Fifty' in front of the "31") to produce the same results higher up. The post-obit example shows only the '$'-terminated brandish string, which has a length of 24h bytes (recall numbers in DEBUG are always hexadecimal); so that's 36 in decimal:
-d 102 l24        xxxx:0100       0D 0A 54 68 69 73-20 69 73 20 6D 79 20 66    ..This is my f xxxx:0110 69 72 73 74 20 44 45 42-55 47 20 70 72 6F 67 72  irst DEBUG progr xxxx:0120 61 6D 21 0D 0A 24                                am!..$ -          Back to TOC          
Search: South range listing

    Searches within a range of addresses for a pattern of one or more byte values given in a list. The listing can exist comprised of numbers or character strings enclosed by matching unmarried or double quote marks. [ NOTE: In the examples beneath, if you lot practice find the same data on your calculator, the locations could easily vary from ours! ]

Examples:

-s fe00:0 ffff "BIOS"        FE00:0021        FE00:006F        -d fe00:0        FE00:0000 41 77 61 72 64 20 53 6F-66 74 77 61 72 65 49 42  Award SoftwareIB FE00:0010 4D 20 43 4F 4D l 41 54-49 42 4C 45 20 34 38 36  M COMPATIBLE 486 FE00:0020 xx 42 49 4F 53 xx 43 4F-fifty 59 52 49 47 48 54 20        BIOS        COPYRIGHT FE00:0030 41 77 61 72 64 20 53 6F-66 74 77 61 72 65 20 49  Award Software I FE00:0040 6E 63 2E 6F 66 74 77 61-72 65 xx 49 6E 63 2E xx  nc.oftware Inc. FE00:0050 41 77 03 0C 04 01 01 6F-66 74 77 E9 12 xiv 20 43  Aw.....oftw... C FE00:0060 1B 41 77 61 72 64 twenty 4D-6F 64 75 6C 61 72 20 42  .Award Modular        B        FE00:0070 49 4F 53 20 76 34 2E 35-31 50 47 00 DB 32 EC 33        IOS        v4.51PG..2.3  -south 0:0 dff 'A20'        0000:0C42        -d 0:c40        0000:0C40 0D 0A 41 32 30 20 68 61-72 64 77 61 72 65 20 65  ..A20        hardware e 0000:0C50 72 72 6F 72 2E 20 20 43-6F 6E 74 61 63 74 20 74  rror.  Contact t 0000:0C60 65 63 68 6E 69 63 61 6C-20 73 75 lxx lxx 6F 72 74  echnical support 0000:0C70 20 74 6F twenty 69 64 65 6E-74 69 66 79 20 74 68 65   to identify the 0000:0C80 20 70 72 6F 62 6C 65 6D-2E 0D 0A 24 1A 00 BA F6   problem...$....  -s 0:0 dff          43 4f 4d                0000:0774 0000:07C2 0000:07D4 0000:07E6  -d 0:770        0000:0770 7A 02 A6 02        43 4F 4D        31-20 20 20 20 8E 00 lxx 00  z...COM1    ..p. 0000:0780 C0 A0 7A 02 91 02 4C 50-54 31 20 20 20 20 A0 00  ..z...LPT1    .. 0000:0790 70 00 C0 A0 7A 02 98 02-4C 50 54 32 20 20 20 20  p...z...LPT2 0000:07A0 second 01 seventy 00 C0 A0 7A 02-9F 02 4C 50 54 33 xx 20  -.p...z...LPT3 0000:07B0 20 20 xi EA 27 27 3F FD-CA 00 70 00 00 fourscore 7A 02    ..''?...p...z. 0000:07C0 AC 02        43 4F 4D        32 20 20-20 20 DC 00 lxx 00 00 eighty  ..COM2    ..p... 0000:07D0 7A 02 B2 02        43 4F 4D        33-20 twenty twenty 20 00 00 6B 03  z...COM3    ..k. 0000:07E0 00 eighty 7A 02 B8 02        43 4F-4D        34 xx 20 20 20 E8 D2  ..z...COMiv    ..        Dorsum to TOC          
Compare: C range address
    Compares two blocks of retentiveness. If there are no differences, then DEBUG simply displays some other prompt (-). Here'south an example of what happens when in that location are differences:
        -c 140 148 340        127D:0143  30  6D  127D:0343      127D:0146  10  63  127D:0346      127D:0148  49  thirty  127D:0348
The bytes at locations 140 through 148 are being compared to those at 340 ( through 348, implied ); the bytes are displayed side past side for those which are dissimilar (with their exact locations, including the segment, on either side of them).
                  Back to TOC          
Fill up: F range list
    This command can also be used to articulate a whole segment of Memory as well as filling smaller areas with a continuously repeating phrase or single byte. Examples:
-f 100 12f 'BUFFER'        -d 100 12f        xxxx:0100  42 55 46 46 45 52 42 55-46 46 45 52 42 55 46 46 BUFFERBUFFERBUFF xxxx:0110  45 52 42 55 46 46 45 52-42 55 46 46 45 52 42 55 ERBUFFERBUFFERBU xxxx:0120  46 46 45 52 42 55 46 46-45 52 42 55 46 46 45 52 FFERBUFFERBUFFER     -f 100 ffff 0      

This last example fills almost all of the assigned Segment with zero bytes (which tin as well exist idea of every bit clearing the Segment). You should use this control whenever you desire to be sure the bytes you'll be looking at in DEBUG's Segment are those yous entered or loaded, or bytes DEBUG has changed; not soem previously used bytes from memory! If you want to examine a file from a deejay in a 'clean' Segment, you'll first have to start DEBUG without whatever filename, articulate the Segment using: f 100 ffff 0 and then finally load the file using the Name (n) and Load (L) commands in that society.

NOTE: Filling (immigration) any bytes in the area from 00 h through FF h of our Segment can sometimes lead to bug; especially when file I/O is involved. DEBUG stores data for its own use in those locations, so nosotros recommend you never overwrite bytes in that expanse; unless y'all take a reason for doing then!

Example: A student in an Associates grade was told to enter a string of commands nether DEBUG, the last i existence: JMP 0 which he was supposed to Trace (T) to the next command and and so execute it. He was told it would be an INT 20 instruction. Well in most cases this is truthful, because DEBUG always sets the commencement two bytes of its working segment to "CD xx" for but this purpose. Allow's test this out. First, open a new instance of DEBUG, then enter the post-obit commands:

-f 100 ffff 0                  [Zero-out 100 through FFFF]                -east 100 e9 fd atomic number 26                  [Enters a 'JMP 0' at 100]                -u 100 102                  [Check for right entry]                xxxx:0100 E9FDFE        JMP     0000        -r        
AX=0000 BX=0000 CX=0000 DX=0000 SP=FFEE BP=0000 SI=0000 DI=0000
DS=xxxx ES=xxxx SS=xxxx CS=xxxx IP=0100 NV Upwardly EI PL NZ NA PO NC
xxxx:0100 E9FDFE JMP 0000 -u 0 1 xxxx:0000 CD20 INT 20

I f yous don't see "INT 20" afterwards entering "u 0 1", so restart DEBUG and attempt again.

-t        [The "T"(Trace) command]        AX=0000  BX=0000  CX=0000  DX=0000  SP=FFEE  BP=0000  SI=0000  DI=0000 DS=xxxx  ES=xxxx  SS=xxxx  CS=xxxx  IP=0000   NV Upward EI PL NZ NA PO NC xxxx:0000 CD20          INT     twenty -p                  [Ever make sure you use a "P"(Proceed) command for          Interrupts!]                Programme terminated normally -q                  [Quit]              

Well, this never worked for those students. Why? Because the teacher had mistakenly told them to Fsick the whole segment with zero bytes ( f 0 ffff 0 ), in essence telling them to delete the very instruction he'd wanted them to execute!

                  Back to TOC          
Enter: East accost [list]
    Used to enter data or instructions (as machine code) directly into Memory locations.
Case. First we'll change a single byte at location CS:FFCB from whatever it was before to D2
:
          -e ffcb d2        
This next example shows that either single(') or double(") quote marks are acceptable for inbound ASCII data. Past assuasive both forms, entry strings can exist created to include either type of quote mark equally data:
          -e 200 'An "ASCII-Z cord" is always followed by '          -east 22a "a zero-byte ('00h')." 0        
But in order to enter more than a single line of ASCII data, the A (Assemble) command is more practical since it will calculate the next offset for you! (See that command for a Memory dump of these bytes.)   Now we'll examine a string of 11 hex bytes you tin enter into Retentivity at locations CS:0100 and following:
          -e 100 B4 09 BA 0B 01 CD 21 B4 00 CD 21        
This is actually car lawmaking for a plan that will display whatever ASCII characters it finds at locations CS:010B and following, until it encounters a byte value of 24h (a $ sign). If y'all want to run this program, we'd recommend entering 24h at offset location 7EAh of the Segment then the program will cease there:
                  -e 7ea 24          -thousand =100              
And you'll soon see: "Programme terminated normally" on the display screen. Why did nosotros pick 7EAh? Because many DOS screens are gear up to display only 25 lines of 80 (50h) characters, and this value allows you to view the maximum number of characters possible on a single screen betwixt the "Go," termination and prompt ("-") lines.

Hither'due south something a bit more interesting for you to effort out: Information technology'due south essentially the same program, but the data includes all of the byte values from 00h through FFh; except for 24h which we placed at the terminate of the last line. The DEBUG prompt symbol, - , has been purposely excluded from the lines below, then yous can copy and paste the whole block into a DEBUG DOS-box (Help on using DOS-Window controls is here if needed):

        e 100 B4 09 BA 0B 01 CD 21 B4 00 CD 21          0D 0A 0D 0A          00 01 02 e 112 03 04 05 06 07 08 09          twenty          0B 0C          20          0E 0F 10 xi 12 13 xiv e 124 xv xvi 17 18 19 1A 1B 1C 1D 1E 1F twenty 21 22 23          20          25 26 e 136 27 28 29 2A 2B 2C 2nd 2E 2F 30 31 32 33 34 35 36 37 38 e 148 39 3A 3B 3C 3D 3E 3F          0D 0A 0D 0A          forty 41 42 43 44 45 46 e 15a 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 e 16c 59 5A 5B 5C 5D 5E 5F threescore 61 62 63 64 65 66 67 68 69 6A e 17e 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C e 190 7D 7E 7F          0D 0A 0D 0A          fourscore 81 82 83 84 85 86 87 88 89 8A e 1a2 8B 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C eastward 1b4 9D 9E 9F a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aA aB air-conditioning aD aE e 1c6 aF b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 bA bB bC bD bE bF          0D          e 1d8          0A 0D 0A          c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 cA cB cC cD cE due east 1ea cF d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 dA dB dC dD dE dF e0 east 1fc e1 e2 e3 e4 e5 e6 e7 e8 e9 eA eB eC eD eE eF f0 f1 f2 e 20e f3 f4 f5 f6 f7 f8 f9 fA fB fC fD fE fF          0D 0A 0D 0A          24              

The bytes 0Dh and 0Ah produce a Carriage Render and Linefeed on the display, and then we replaced them in the listing in a higher place by xxh; a SPACE byte. The 24h byte was moved to the terminate of the program with another 20h taking its place. The bytes shown above in blue (0D 0A 0D 0A) course blank lines at the beginning of the output and later every 64 bytes for a squeamish formatted display.

Therefore, when the plan is run, nosotros should see 4 separate lines of 64 characters each (a few of those being bare spaces equally mentioned above), right? Well, let's observe out: Start DEBUG in a DOS-Window, copy and paste the lines above into DEBUG at its prompt symbol, then enter the following command:

                  g =100                ( 'g' followed by a Space, so '=100')      

This volition immediately run (run into Go command) the program, displaying the output lines followed past: "Plan terminated unremarkably" [ Do not exit DEBUG, just go out the window open up. We're going to show you how to 'patch' this code and save the results as a dainty little console program ].

Were you lot surprised to find more than than four spaces on the kickoff line; starting with the very offset byte? What about the fact we appear to accept missing characters at the end of that line? We'll briefly explain why the characters appeared this fashion on your screen, simply in order to create programs of your ain, y'all'll need to report about control characters, Interrupts and what issue different BIOS and DOS video functions take on the way ASCII characters are displayed. OK, here's what happened:

First, the Goose egg byte as well displays as a blank space here. The 07 byte may make a beep or ding audio (but does not display anything), 08 performs a BACKSPACE (erasing the 06 byte character) and 09 is a TAB -- which may jump up to viii columns to the right before reaching the adjacent 'Tab Stop.' But since information technology only happens to begin in cavalcade seven, information technology but moves 1 cavalcade to the right where our program places the space we substituted for 0Ah. Lastly, for some reason, when using Function 09 of INT 21h ("Display a string of characters until a '$' sign is encountered"), the ESC character (1Bh; 27 decimal) doesn't display or practice anything. And so, after reaching the end of the beginning line, it just appeared as if many of the characters we expected to run into were never displayed. In reality, the last iii characters are there. It'south considering of the bytes 07h (displayed nothing), 08h (only backspaced over 06h), 09h (displayed zero, but moved cursor forward 1 byte) and 1Bh (displayed nothing) that we saw what we did.

Enter the following two lines into DEBUG (which contain more bare-space substitutions), run the plan once more, and you'll see all the displayable characters output on the first line in their right positions:

        e 10F 00 01 02 03 04 05 06          20 twenty 20 20          0B 0C          xx          e 11D 0E 0F ten 11 12 xiii 14 xv xvi 17 18 19 1A          20              
All four rows will brandish evenly in size, including the terminal one. But the last grapheme, FFh (255 decimal), merely like the first, also displays as a blank space here! You can prove this by inserting another byte such as 2Eh (a period '.') after FFh. We've created the following patch which effectively moves upwards the remainder of the programme later the FFh by i: e 21b 2e 0d 0a 0d 0a 24

After patching and running it once more, the program output should look similar this:


If you want to, yous can relieve this code every bit an executable program by get-go giving it a path and filename (such as, C:\TEMP\ASCIIDSP.COM; see Name command) and writing the bytes (see Write control) to a file like this:
                  -n c:\temp\asciidsp.com          -rcx          CX0000    :121          [ Plan Length = 220h - 100h + 1 = 121h ]          -w              

If you bank check the file properties of ASCIIDSP.COM, its size should be 289 bytes.

Dorsum to TOC


                                            Go:            G  [=accost]  [addresses]                        

    Go is used to run a program and set breakpoints in the programme's lawmaking.

Equally we saw in an Case for the ENTER command, the '=address' option is used to tell DEBUG where to start executing code. If you use 'g' all by itself, execution volition brainstorm at whatever location is pointed to by the

CS:IP registers. Breakpoints are used to HALT the execution of a program we're testing at some point of involvement before its termination. Up to 10, optional breakpoint addresses may be set past but listing them on the '-yard' command line; separated by spaces. DEBUG will halt execution just earlier any of breakpoint addresses is well-nigh to be executed, and all of them volition be 'cleared' at this time besides. (If you should somehow attempt to set more than 10 breakpoints, DEBUG will respond with:bp Error.

Note: Breakpoints can only be set at an address containing the first byte of a valid 8088/8086 opcode. So don't exist surprised if picking some arbitrary address never halts the program; especially if you lot're trying to DEBUG a programme containing opcodes DEBUG can't understand (that's any instruction which requires a CPU above an 8088/8086)!

Using "Get" later on setting breakpoints at instructions you're sure DEBUG understands is 1 way you can get more use out of this program; for example, when debugging the "real" code of a Principal Boot Record written for an 80386 or in a higher place processor. DEBUG won't be able to disassemble, nor stride through, such code, but it can pass the code for those type of instructions to the CPU for immediate execution, and still stop at the breakpoint(due south) you lot've set up for any educational activity that it does sympathise!

CAUTION: DEBUG replaces the original instructions of any listed breakpoint addresses with CCh (an INT three). The instructions at these locations are restored to their original bytes Only if 1 of the breakpoints is encountered. If DEBUG does non halt on any of the prepare breakpoint(due south), they will remain enabled! So, don't e'er save the code unless you're certain all breakpoints have been cleared! (Saving your work to a fill-in copy before always using a breakpoint is the best manner to avoid corrupting the code.)

Technical Notes: The "User" stack pointer must be valid and have half dozen bytes available for this command to function correctly. An iret instruction is used to bound to the first breakpoint encountered. DEBUG sets the User Stack Pointer and pushes the user Flags, the Code Segment register and the Instruction Pointer onto the User Stack. So if the User Stack is not valid or is as well small, the operation might crash.

                  Back to TOC          
Assemble: A [address]

Creates machine executable code in memory beginning at CS:0100 (or the specified accost) from the 8086/8088 (and 8087) Assembly Language instructions which are entered. Although no Macro instructions nor labels are recognized, you can use the pseudo-instructions 'DB' and 'DW' (and so y'all can utilise the DB opcode to enter ASCII data like this:  DB   'This is a string',0D,0A ); spaces afterwards the commas would arrive clearer simply aren't necessary.

The 'A' control remembers the last location where any data was assembled, so successive 'A' commands (when no address is specified) will ever begin at the side by side accost in the concatenation of assembled instructions. This aspect of the command is like to the Dump control which remembers the location of its terminal dump (if no new address is specified).

The associates process volition stop after you ENTER an empty line.

Instances:

Using the character string from our E (Enter) command above:

        -a 200        xxxx:0200        db 'An "ASCII-Z string" is always followed by '        xxxx:022A        db "a zip-byte ('00h').", 0        xxxx:023F       -d 200 23e        xxxx:0200  41 6E xx 22 41 53 43 49-49 second 5A twenty 73 74 72 69   An "ASCII-Z stri       xxxx:0210  6E 67 22 xx 69 73 20 61-6C 77 61 79 73 20 66 6F   ng" is e'er fo       xxxx:0220  6C 6C 6F 77 65 64 twenty 62-79 20 61 20 7A 65 72 6F   llowed by a naught       xxxx:0230  second 62 79 74 65 20 28 27-30 30 68 27 29 2E 00      -byte ('00h')..

ENTER the characters in bold bluish type; yous practice not demand to enter the comments after the semi-colon ( ; ) symbols:

        -a 100        xxxx:0100        jmp 126        ; Jump over information that follows:       xxxx:0102        db 0d,0a,"This is my first DEBUG program!"        xxxx:0123        db 0d,0a,"$"        xxxx:0126        mov ah,ix        ; Function 09 of Int 21h:       xxxx:0128        mov dx,102        ; DS:DX                  ->                $-terminated string.       xxxx:012B        int 21        ; Write Cord to STD Output.       xxxx:012D        mov ah,0     ;        Function 00 of Int 21h:       xxxx:012F        int 21        ; Terminate Program.       xxxx:0131       -grand =100        This is my get-go DEBUG program!        Plan terminated normally       -      

Notation: Yous can pipe unproblematic 8086/8088 Assembly Linguistic communication "scripts" into DEBUG (You lot tin can even include a semi-colon ';' followed past comments on most of its lines. For some odd reason though, these comments do not appear to exist allowed on DB/DW lines!). For instance, you lot tin can re-create and paste the following into DEBUG (later on entering an initial "a" command) and obtain the same results equally to a higher place:

        jmp 126      ; Leap over data that follows: db  0d,0a,"This is my get-go DEBUG programme!" db  0d,0a,"$" ; Finish of cord marker in a higher place: "$"=24h mov ah,9     ; Function 09 of Int 21h: mov dx,102   ; DS:DX -> $-terminated string. int 21       ; Write String to STD Output. mov ah,0     ; Office 00 of Int 21h: int 21       ; Terminate Programme.      
  • DEBUG uses the convention of enclosing operands which refer to Memory locations in square brackets '[ ]' (every bit opposed to an immediate value as an operand).
  • DEBUG may require you to explicitly tell it whether or not an operand refers to a word or byte in Memory! In such cases, the data type must exist stated using the prefixes 'Word PTR' or 'BYTE PTR'
  • For all 8087 Math Coprocessor opcodes, the WAIT or FWAIT prefix must be explicitly specified.
        Back to TOC          
Unassemble: U [range]
Disassembles automobile instructions into 8086 Associates lawmaking. Without the optional [range], information technology uses Offset 100 equally its starting signal, disassembles nearly 32 bytes and so remembers the side by side byte it should get-go with if the command is used over again. ( The word 'near' was used in a higher place, because it may be necessary to stop with an odd-number of bytes greater than 32, depending upon the terminal type of instruction DEBUG has to disassemble. )

Annotation: The user must decide whether the bytes that DEBUG disassembles are all 8086 instructions, simply data or any newer x86 instructions (those for the 80286, 80386 on upward to the lastest CPU from Intel; which are all across the ability of DEBUG to understand)!

                              Example:          -u 126 12F          xxxx:0126 B409          MOV     AH,09    xxxx:0128 BA0201        MOV     DX,0102    xxxx:012B CD21          INT     21    xxxx:012D B400          MOV     AH,00    xxxx:012F CD21          INT     21    -                  Back to TOC          
Input: I port

The apply of I/O commands while running Windows™9x/Me is just plain unreliable! This is especially true when trying to direct access hard disks! Under Win NT/2000/XP, the I/O commands are only an emulation ; so don't trust them. Though the example below however works under Win2000/XP, it's nigh probable using some WinAPI lawmaking to show what'southward in the Windows clock area; not straight from an RTC chip.

Long ago (when DOS was the only OS for PCs), in that location were dozens of Basic programs that used I/O commands for handling tasks through parallel and serial ports (e.grand., to alter the font used by a printer or values in a modem's control registers). Under existent DOS, they can still be used for direct communications with keyboards or a floppy drive's control chips along with many other hardware devices.
Here's an example of how to read the hours and minutes from a computer'due south "real time clock" (RTC):

                  -o 70 04          <--          Check the            hours.          -i 71          xviii  <-----          18 hours (or 6 p.thousand.)          -o 70 02          <--          Check the            minutes.          -i 71          52  <-----          52 minutes              
The offset infinite isn't necessary under almost versions of DEBUG; so yous can try to become abroad with just "o70" and "i71" instead. Here's a page of more complex examples dealing with hard drives and the ATA commands for reading info directly from a disk controller!
        Back to TOC          
Output: O port byte

    See comments nether the Input command.

        Back to TOC          
Load: Fifty [address] [drive] [firstsector] [number]
or program! (See the N control for more on this)

    This command will LOAD the selected number of sectors from any disk'southward Logical Drive under the control of MS-DOS or Windows into Memory. The address is the location in Memory the data will be copied to (use just 4 hex digits to go on it inside the retentivity allocated to DEBUG), the bulldoze number is mapped as: 0=A:, i=B:, two=C:, etc., firstsector counts from ZERO to the largest sector in the book and finally number specifies in hexadecimal the full number of sectors that will be copied into Retentivity (so a floppy disk with 0 through 2,879 sectors would exist: 0 through B3F in Hex).

    The terms 'Volume' or 'Logical Drive' used in the definition above mean yous tin not apply the '50' command to load or examine the MBR, or any other sectors outside the Master Volumes or Logical Drive Letters assigned past DOS or Windows! For example (under Windows™ 9x/ME), if you enter the control: L 100 2 0 1 in DEBUG, instead of seeing the very first sector on that hd (the MBR), you lot'll see the starting time sector of the Kick Record for the Logical drive C: instead (the beginning partition that tin can accessed by a compatible MS-DOS or Windows OS). This and the post-obit comments about diskettes, testify that DEBUG has always been quite limited compared to a skillful disk editor or the UNIX 'dd' program.

Load can still be useful in examining Floppy Disks even under Windows™ 2000/XP, but (unfortunately), only if the deejay can be read past MS-DOS or Windows. Once more, this shows how express DEBUG is compared to any utility that can view the raw data on either a hard drive or diskette. (For those of you who wish to examine the bodily contents of a hd under Windows™ XP, in that location are free disk editors, such equally HxD, which allow yous to do then.)

Different difficult disks, the very showtime sector on a floppy disk is an Bone Boot sector. Hither's what yous might encounter from a Logical disk sector and some d umps from a couple floppy disks.

Examples:

-l 100 ii 0 1        [ the        C:        drive. ] -d 100 10f        xxxx:0100  EB 58 90 4D 53 57 49 4E-34 2E 31 00 02 08 twenty 00  .Ten.MSWIN4.1... . -d 280 2ff        xxxx:0280  01 27 0D 0A 49 6E 76 61-6C 69 64 20 73 79 73 74  .'..Invalid syst xxxx:0290  65 6D 20 64 69 73 6B FF-0D 0A 44 69 73 6B 20 49  em disk...Disk I xxxx:02A0  2F 4F 20 65 72 72 6F 72-FF 0D 0A 52 65 seventy 6C 61  /O error...Repla xxxx:02B0  63 65 20 74 68 65 xx 64-69 73 6B 2C 20 61 6E 64  ce the disk, and xxxx:02C0  20 74 68 65 6E twenty 70 72-65 73 73 twenty 61 6E 79 twenty  then press any xxxx:02D0  6B 65 79 0D 0A 00 00 00-49 4F 20 20 xx xx twenty 20  cardinal.....IO xxxx:02E0  53 59 53 4D 53 44 4F 53-xx 20 20 53 59 53 7E 01  SYSMSDOS   SYS~. xxxx:02F0  00 57 49 4E 42 4F 4F 54-20 53 59 53 00 00 55 AA  .WINBOOT SYS..U. - -l 100 0 0 1        [ a floppy in the        A:        bulldoze. ] -d 100 13d        xxxx:0100  EB 3C 90 29 47 38 71 33-49 48 43 00 02 01 01 00  .<.)G8q3IHC..... xxxx:0110  02 E0 00 40 0B F0 09 00-12 00 02 00 00 00 00 00  ...@............ xxxx:0120  00 00 00 00 00 00 29 40-16 D8 13 4E 4F twenty 4E 41  ......)@...NO NA xxxx:0130  4D 45 xx 20 20 20 46 41-54 31 32 20 xx twenty        ME    FAT12    - -l 100 0 0 i        [ a different floppy in the        A:        bulldoze. ] -d 100 13d        xxxx:0100  EB 3C 90 53 59 53 4C 49-4E 55 58 00 02 01 01 00  .<.SYSLINUX..... xxxx:0110  02 E0 00 40 0B F0 09 00-12 00 02 00 00 00 00 00  ...@............ xxxx:0120  00 00 00 00 00 00 29 7E-CF 55 3C 20 xx 20 20 20  ......)~.U< xxxx:0130  xx 20 20 twenty 20 20 46 41-54 31 32 20 20 xx              FAT12    - -d 2d0 2ff        xxxx:02D0  42 3B 16 1A 7C 72 03 40-31 D2 29 F1 EB A7 42 6F  B;..|r.@one.)...Bo xxxx:02E0  6F 74 twenty 66 61 69 6C 65-64 0D 0A 00 00 00 00 4C  ot failed......L xxxx:02F0  44 4C 49 4E 55 58 20 53-59 53 F4 3C 82 3A 55 AA  DLINUX SYS.<.:U.      

The Linux Kick disk to a higher place (note the word: SYSLINUX) is the kind formatted as an MS-DOS diskette and non with a true Linux file organization (such as ext2 or ext3). If it had been formatted with some other kind of file system, or had a faulty kicking sector, then MS-DEBUG would non exist able to read it! Instead you'd see that onetime "General failure reading drive A / Abort, Retry, Fail?" error message! And when y'all had finally cleared away that error message, you lot'd be greeted past DEBUG'due south "Disk mistake reading drive A" error message. This makes DEBUG almost worthless as far as trying to gear up an error in a floppy disk's kicking sector! However, if you go on a binary copy of a good floppy deejay Boot Sector somewhere, you could use DEBUG to overwrite any's on a faulty floppy disk's starting time sector (see Write command). But if you really need to see what's in such a Kicking sector (i.e., what is keeping DEBUG from recognizing it equally valid), you'll demand to use a disk editor such every bit Symantec's Norton DiskEdit (in Concrete deejay Mode only).

Annotation: Only because a floppy deejay can't be read by DOS or opened in DEBUG does NOT necessarily mean information technology's defective. Information technology might just take been formatted with a file system it cannot recognize (such as Linux's ext2) and could hands boot-up on its ain; a very skilful reason for labeling your disks! (Circumspection: Never try booting your system with a disk you're non 100% sure of; unless you disconnect all hard disks and don't have whatsoever flash BIOS, since it might incorporate a nasty boot virus! )
[ Many floppy disks take the messages IHC in their OEM ID field. What kind of OEM Name is that? None. Someone at Microsoft decided that this was where they'd identify a new pseudo-random type of identification to make sure that any information cached by 'Windows 9x' from one disk wouldn't exist mixed upwards with info from a different ane if you swapped disks. The whole string begins with five pseudo-random hex bytes, and always ends with the characters IHC . All floppy diskettes that are not write-protected will have any original OEM ID overwritten. Once Windows has written this string, it will remain the aforementioned for whatsoever futurity disk reads or writes. However, performing even a quick format under Windows, volition change the five hex bytes every fourth dimension.
Some have concluded the characters ' IHC ' are the commencement 3 messages of the give-and-take "Chicago" in reverse lodge, since Chicago was the 'code name' for Windows 95 before it was ever released (it would have appeared every bit ' OGACIHC' on the hypothetical disk). Although certainly a possibility, I have no proof of that. Due to our interest in some very sometime Greek Manuscripts, we still can't help only see the 3 characters 'IHC' as an Iota, Eta and old fashion Sigma since this combination of letters was oft used equally an abridgement for the Greek give-and-take "IHSUS" (Jesus). Only another of many coincidences in our lives.
REMEMBER: If you actually want to preserve all of the contents of an important diskette, y'all can't even perform a simple Directory read nether a Windows OS, UNLESS it is 'write-protected' and you know the bulldoze'south write-protect system is operation correctly!
]

        Back to TOC          
Move: M range address
    This command could be called COPY (not Move), since it only copies all the bytes from within the specified range to a new address.

    Examples:

                  ane)          -yard 7c00 7dff 600              
Copies all 512 (200h) of the bytes between Offsets 7C00 and 7DFF (inclusive) to Offset 0600 and following.
                  ii)          -thousand 100 2ff 200              

This 2d example shows it'south very easy to overwrite much of the same source area you're copying from when using the Movement control. However, DEBUG must store all the source bytes in Memory earlier writing them; otherwise, this case would cause a problem when overwriting an area it hadn't copied data from however, if it were copying only one byte at a fourth dimension from that source surface area! The example to a higher place copies all 512 bytes of offsets 100h through 2FFh (inclusive) to Offsets 0200h and following; overwriting the last 256 (2FF-200+1 hex) bytes of the source in the process. This is also true under real 16-scrap DOS.

Annotation: If your Motion command produces a situation where start FFFFh has already been written to yet there'southward even so more information to write, you lot may experience unexpected results! Remember, DEBUG is technically assigned to merely one 64 KiB Segment. So, the data will wrap around to the get-go of the Segment, maybe overwriting some of the source bytes you told it to copy from! But other symptoms may occur as well, since the kickoff area to be overwritten after wrapping around (00h through FFh) is sometimes used past DEBUG to go on track of itself. So do the math whenever copying bytes to a higher location in Memory, to be sure you lot don't run out of room at the end of the Segment.

Copying bytes to a lower location in the Segment is quite simple though; DEBUG could really re-create just one byte at a time in that direction and never overwrite a source byte before it was already copied.

        Back to TOC          
Name: N [pathname] [arglist]

    This control can be used to load files into DEBUG'south Memory later on y'all have started the plan, but information technology's main function is to create a new file nether control of the Operating Organisation which DEBUG tin WRITE data to.
Ordinarily, when y'all desire to 'debug' a file, you'd kickoff DEBUG with a command like this: C:\WINDOWS>debug examination.com .   But it's also possible to load a file into DEBUG's Retentiveness from inside DEBUG itself by using the 'N' command and then the 'L' command (with no parameters) like this:
    -n c:\temp\test.com
-l

which will load the file test.com into DEBUG'southward Retentiveness starting at location CS:0100 (you cannot specify whatsoever other location when using the L command like this!).

    The 'N' command makes it quite easy to save information or an Assembly plan created in DEBUG to a file on your hard drive! For case, the post-obit commands (shown in bold blue blazon) will create a 68-byte file called DOSWINOK.COM in the C:\TEMP folder; even when running DEBUG in a DOS-window. The file names, still, are still limited to DOS's eight characters plus three for the extension (oftentimes called an 8.3 filename):

        -northward c:\temp\doswinok.com        -a 100        cs:0100        jmp 138        cs:0102        db 0d,0a,"It's OK to run this "        cs:0118        db "plan nether DOS or Windows!"        cs:0135        db 0d,0a,24        cs:0138        mov dx,102        cs:013B        mov ah,ix        cs:013D        int 21        cs:013F        mov ax,4c01        cs:0142        int 21        cs:0144   [Press ENTER primal.]   -rcx        CX 0000   :44        -due west        Writing 00044 bytes        [ 68 bytes in decimal ]        -q      

How did we make it at the value of "44" to put into the CX annals for writing that many bytes to our new file? Well, if you assemble a program in DEBUG using the Assemble command just every bit we did higher up, you lot can subtract the location that we started our programming on from the location DEBUG displays on the line you stopped the assembly past pressing the ENTER key. This will salve you lot a bit of thought by not having to retrieve when you subtract the kickoff byte location (of the first instruction) from the last byte location (of the concluding instruction), both bytes existence inclusive, that y'all must then add together a 1 to the issue to obtain the total number of bytes in your programme. Or, putting this in terms of the digits involved:   (144h - 100h ) = (143h - 100h + ane) = 44 hex = 68 decimal.

NOTE: Unlike other programs listed on this page, this last one used the Function 4Ch instead of Function 00 of Interrupt 21h to cease its execution. This is the preferred termination function for nigh DOS programs, because it tin ship a "Return Code" (an ERRORLEVEL value; of whatever is in the AL annals), and will also shut all open files and gratuitous all memory belonging to the procedure. However, when y'all use this function to terminate a program y'all run under DEBUG, it has a tendency to terminate DEBUG itself; thus the reason we rarely use it here!

Homework: Follow the steps above to Assemble and save this program under DEBUG, and then apply DEBUG to debug it! Use the P(roceed) command to step through most of the instructions, since this will keep y'all from accidentally stepping into an INT(errupt) instruction! If yous ever do utilise the T(race) command on an INT, you'll end upwardly within nests of BIOS routines which often crashes DEBUG!

          Back to TOC          
Annals: R [register]
    Inbound ' r ' all by itself will display all of the 8086 register's contents and the adjacent instruction which the IP register points to in both machine code and an unassembled (Associates Language) form. For example, if you lot start DEBUG in a Windows 95B DOS-box with the command line:
>debug c:\windows\command\selection.com
and so enter an ' r ' at the first DEBUG prompt, DEBUG will display someting similar to this:
AX=0000  BX=0000  CX=1437  DX=0000  SP=FFFE  BP=0000  SI=0000  DI=0000 DS=0ED8  ES=0ED8  SS=0ED8  CS=0ED8  IP=0100   NV UP EI PL NZ NA PO NC 0ED8:0100 E90E01        JMP     0211        
For an explanation of the names of the registers (AX, BX, CX, etc. and the Flag symbols: NV UP EI PL NZ NA PO NC), see the Appendix (The 8086 CPU Registers). The last line shows the next CPU teaching (actually the first in this case) to be executed, begins at memory location 100 hex (the offset) in Segment ED8 hex (0ED8:0100) and the Hex bytes E90E01 represent the actual binary auto code of the CPU educational activity (JMP 0211 in Assembly language) that would be executed by DEBUG if you entered a Trace (t) or Keep (p) control.

If you lot enter the ' r ' followed by the abbreviation for an 8086 annals, such as: ' rcx ', then DEBUG will display only the contents of that register followed by a line with a colon symbol (:) on which y'all can enter a hex number to alter the contents of that register. If you just printing the ENTER central, the contents remain the same. For example:

    -rcx
    CX 0100
    :273
-

means the Register control was used to change the contents of the CX register from 0100 to 0273. The command rcx could also be used again to verify the change had indeed taken place.

Notation: The register command only functions with 16-flake registers; including the Flags register, so entering an 8-fleck or an invalid register name results in:

br Error.

Typing the letter f (for Flags) after the r:

rf , causes DEBUG to display all the FLAG annals bits and its 'prompt' on the same line. This prompt allows you lot to modify all, or none, of the individual flag $.25. For case, here's how you lot would brandish the flags and modify only the Zero and Bear flag bits from being cleared (a 0 bit) to being set (a i bit) and check them without making any farther changes:   -rf
   NV Up EI PL NZ NA PO NC  -zr cy
   -rf
   NV Upwardly EI PL ZR NA PO CY -
   -

As you tin see above the Zero and Carry flags were changed from NZ and NC (both cleared) to ZR and CY (both set up). See our Appendix: The FLAGS Register for an caption of all the Flag abbreviations.

Any order, with or without spaces, is acceptable after the 'prompt' (such as:

-zrupcy ).
  • Attempting to enter an incorrect abridgement for a flag value (even with i or more correct names) results in a: bf Error and no flags are changed.
  • Attempting to enter abbreviations for both clearing and setting the aforementioned flag, at the aforementioned prompt, will cause DEBUG to brandish the:df Fault.
        Dorsum to TOC          
Trace: T [=accost] [number]
    The T command is used to trace (stride through) CPU instructions one at a time. If you enter the T command past itself, information technology volition normally step through only 1 instruction beginning at the location specified past your CS:IP registers, halt programme execution and so brandish all the CPU registers plus an unassembled version of the adjacent instruction to be executed; this is the 'default' mode of the TRACE command. Say, withal, you wanted DEBUG to trace and execute seven instructions beginning at accost CS:0205; to exercise so, you would enter: -t =205 seven

Recall that the value for the number of instructions to execute must be given in hexadecimal just equally all other values used in DEUBG. (Since the T command uses the "hardware trace mode" of the CPU, it's possible to step through instructions in a ROM - Read Only Memory - chip; or stride into BIOS code which has been shadowed in read-only portions of Memory for decades at present.) Notation: If y'all detect yourself stuck inside a long LOOP or REPeat string didactics, enter a P (Proceed) control and it will complete the operation and move to the next instruction.

                  Back to TOC          
Go along: P [=accost] [number]
Proceed acts exactly the same equally Debug'south T (Trace) command for most teaching types; with these notable exceptions:  Proceed volition immediately execute all instructions (rather than stepping through each one) inside any subroutine Call, LOOP, REPconsume string education or whatever software INTerrupt. You lot tin can still step into an INT or execute all the code independent in a subroutine if you need to, only with the Go along (P) command you are not required to do so.
This ways Proceed will probably be the command of choice for most of debugging tasks, with Trace only being used to stride through an unfamiliar subroutine or check the logic of the first few iterations of long REP string instructions or LOOPs. And it's a must utilize command when it comes to Interrupts!
        Back to TOC          
Write: West [accost] [drive] [firstsector] [number]
W A R N I N G
Do NOT experiment with the W - write control in DEBUG. It can be used effectively to create new files on your difficult drive, merely but if you lot use information technology properly. Trying to write directly to a sector on a difficult deejay would very RARELY be considered proper use of this command!
    Trying to write straight to a hard disk using sector numbers will most probable result in loss of data or even a non-booting system! (Although Windows XP and later prevent straight Sector writes to a hard deejay, they are even so allowed to floppy drive media, i.e., drive messages A: or B:)
The WRITE (Due west) command is often used to save a program to your hard disk from within DEBUG. But the just safe fashion to do so, especially nether Windows, is by assuasive the Os to decide where to physically create that file on the deejay. This is washed by get-go using the Proper noun (North) command to set an optional path and filename for the new file (or to overwrite i that already exists). DEBUG volition automatically begin saving program or information bytes from Offset 0100 of the 64 KiB Segment the Bone allocated for it. The only other requirement is to set up the size of the file you wish to write by placing the full number of bytes in the combined BX and CX registers* before executing the WRITE command. The Register control is used to alter the value in the CX register in the following instance from our MyMBR Batch/Debug Script Program.

Instance:
After creating and running a modest program inside of DEBUG which copies the Principal Boot Record (MBR) to Offset 0000h through 01FFh, these DEBUG commands save the MBR to a file on the hard deejay:

                      -northward mymbr.bin            -rcx            CX 0001    :200            -w 0            Writing 00200 bytes            [ 512 bytes in decimal ]            -                  

The BX register had already been set up to zero by a previous education, so the CX register was simply set to 200 and the WRITE command executed with an accost of 0 (if no accost is used, the Write command starts saving bytes at First 100).

The WRITE command can, however, be used in a relatively safe manner with Floppy disks. For case, you lot could use the Load (L) command:

l 7c00 0 0 1
to load the commencement sector of an MS-DOS or Windows floppy disk into DEBUG'due south retentiveness at location 7C00, change some of the code and/or messages (if you know how to do so) and and so use the 'W' command:
w 7c00 0 0 1
to write the changes back to the floppy disk'due south first sector.

___________________
* Although the BX and CX registers are ofttimes referenced in books on Assembly every bit BX:CX when they discuss this write command, notation that these registers are not being used similar Segment:Get-go pairs in this case! They are a true combination of higher and lower bytes which form a 'double word' for a theoretical total of about iv GB (FFFF FFFFh = 4,294,967,295 bytes) that could be written to a file! Whether or non this is true of all versions of DEBUG, under DOS seven.ane, we've been able to load image files of several hundred KiB and write the whole file to a new location!
For example, if you load a 360 KiB prototype file into DEBUG at a DOS prompt, then check the registers, BX will equal 0005 and CX volition contain A000 . The major problem here though is the fact DEBUG uses CONVENTIONAL Retentiveness, then trying to load a file greater than about 400 KiB is jump to elicit an "Insufficient Memory" error!
[
click hither to go back to text above ]

Back to TOC


Updated: September 28, 2007. (28.09.2007)
Previous Update: August 23, 2010. (23.08.2010)

Terminal Update: September 19, 2010. (xix.09.2010)


A Guide to DEBUG (Page One)

The Starman'southward Realm Assembly Folio

collazotheyes72.blogspot.com

Source: https://thestarman.pcministry.com/asm/debug/debug2.htm

0 Response to "what is the correct dos coding to format a hard drive"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel