15.3.7 Displaying Memory

Choosing the Memory command from the View menu opens a Memory window. Two Memory windows can be open at one time.

By default, memory is displayed as hexadecimal byte values, with 16 bytes per line. At the end of each line is a second display of the same memory in ASCII form. Values that correspond to printable ASCII characters (decimal 32 to 127) are displayed in that form. Values outside this range are shown as dots (.).

Summary: You can display memory values in any form.

Byte values are not always the most convenient way to view memory. If the area of memory you're examining contains character strings or floating-point values, you might prefer to view them in a directly readable form. Choosing the Memory Window command from the Options menu displays a dialog box with a variety of display options:

ASCII characters

Byte, word, or doubleword binary values

Signed or unsigned integer decimal values

Short (32-bit), long (64-bit), or ten-byte (80-bit) floating-point values

Figures 15.3 and 15.4 show two of these different displays.

Another way to choose a display format is to cycle through the formats by repeatedly pressing SHIFT+F3.

Not every four-byte or eight-byte sequence represents a valid floating-point number. If a section of memory cannot be displayed in the floating-point format you select, the number displayed includes the characters NAN—“not a number.”

You can change the contents of the memory by simply overtyping new values in the Memory window. See Section 15.3.9 for more information on modifying values.

Displaying Variables with a Live Expression

Section 15.3.4 explained how to display a specific array element by adding the appropriate expression to the Watch window. You can also watch a particular array element or structure element in the Memory window. This CodeView display feature is called a “live expression.” The term “live” means that CodeView dynamically displays memory starting at the current value of the address expression you specify.

To create a live expression, choose the Memory Window command from the Options menu; then select the Live Expression check box. Type the element you want to view in the Address Expression field. For example, if array is a variable whose current value is being indexed by the value in the BI register and you wish to view it, type array [bi]. Then choose the OK button or press ENTER.

If no memory windows are open, a new Memory window opens. The first memory location in the window is the first memory location of the live expression. The section of memory displayed changes to the section the live expression currently references.

You can use the Memory Window command from the Options menu to display the memory in a directly readable form. This is especially convenient when the live expression represents strings or floating-point values, which are difficult to interpret in hexadecimal form.

It is usually more convenient to view an item in the Watch window than as a live expression. However, some items are more easily viewed as live expressions. For example, you can examine what is currently on top of the stack by entering SS:SP as the live expression. In fact, any legal combination of register values (such as ES:DI or DS:SI) can be entered in segment:offset form.