Hex    the H function

Prior to Windows, DOS was booted from a floppy disk and the entire screen was the display. The DOS interpreter called COMMAND.COM was automatically run and instructions were taken from the keyboard. DEBUG.EXE was one of the programs that could be run under the DOS ( Disk Operating System ).

Once Windows is called, the DOS functions are different than before Windows is run. These differences will be mentioned occasionally and need to be taken into consideration. This example is run under Windows emulated DOS.

This is a Debug program example. We will open Debug from the Command Interpreter rather than calling it directoy from Windows. We can do this in several ways.
Double clicking on the resident COMMAND.EXE icon or its shortcut is one way.
Entering COMMAND in the START-RUN edit box and clicking on OK is another.
Windows emulated DOS will open in the DOS PROMPT console window.
In either case, the Debug program can be run by entering Debug after the DOS prompt and pressing ENTER.
The Debug display will result giving us the minus sign prompt as a prompt.

On the minus sign prompt, enter the character h, space, the first number, the second number and press ENTER. Two values will be returned to the display. The first will be the sum of the two numbers and the second will be the difference. All the numbers in Debug are in hexidecimal.

One of the most useful uses for this function is to provide the difference between two memory locations. The length of a data block might be important as well. There will be a need for this function in later examples.

Here are a few examples of some of the results as seen on the Debug console display.

In the Windows Debug console, the entire text fore-ground and back-ground colors are selectable.
In the example; however, the prompt is the minus sign..... the command is red..... the return is green....remarks are in black.



-h 7 2        Enter 7 and 2 and ENTER.
0009  0005    the sum is 9 and the difference is 5.
-

-h 2 7
0009  FFFB    The sum is still 9 but the difference is minus 5.. or FFFB
-

-h FFFF  1    The sum is 0000, but the carry goes into the bit bucked.
0000  FFFE   
The difference is FFFE or minus 1 in 16 bit two's compliment.
-

This function is entirely passive, in as much as it does not alter the contents of memory or the data on the disk. Nothing will be harmed by experimenting with this command. It is a calculator function who's input is normally the keyboard and the output is normally the display. Experimenting with the H function is quite safe. There are other functions that can alter the state of the computer and of the disk contents. Those functions should be used with care.


Summary
It is suggested that you become familiar with calling, exercising and termination Debug. As described above, Debug may be entered from the Window's desktop useing the RUN edit box or clicking on the Debug,exe icon or its shortcut. It can be exited with the Q function and program control will return to Windows.

It can also be opened from the DOS PROMPT by opening COMMAND.COM and typing in Debug on the DOS prompt.  When Debug is exited with the Q function, program execution returns to Command.Com rather than to the Windows desktop. Command.Com is then terminated the same way other windows are closed. Keep in mind that the Debug program was intended to be run from the Command Interpreter ( Command.Com ) rather than from the Windows program directly. This difference will become important in later examples.