r

r reg=word

The r command displays the contents of one or more central processing unit (CPU) registers and allows the contents to be changed to new values. If you specify the reg parameter with the r command, the 16-bit value of that register is displayed in hexadecimal format followed by a colon (:) prompt on the next line. You can then enter a new word value for the specified register or press ENTER if you do not want to change the register value.

If you specify f for reg, the debugger displays the flags in a row at the beginning of a new line and displays a hyphen (-) after the last flag.

You can type new flag values in any order as alphabetic pairs. You do not have to leave spaces between these values. To terminate the r command, press ENTER. Any flags for which you did not specify new values remain unchanged.

If you type more than one value for a flag or enter an invalid flag name, the flags up to the error in the list are changed and those flags at and after the error are not changed. In addition, 80386 Debugger returns the following error message:

Bad Flag

Parameters

reg

Specifies the register to be displayed. If you omit reg, the debugger displays the contents of all registers and flags along with the next executable instruction.

word

Specifies the new value for the register. For the Flags register, set or clear a flag by using one of the following names:

Flag code Meaning

OV Overflow set
NV Overflow clear
DN Direction decrement
UP Direction increment
EI Interrupt enabled
DI Interrupt disabled
NG Sign negative
PL Sign positive
ZR Zero set
NZ Zero clear
AC Auxiliary carry set
NA Auxiliary carry clear
PE Parity even
PO Parity odd
CY Carry set
NC Carry clear
NT Nested task switch (on and off)

For the machine status word (MSW) register, use the following names to set a flag:

Flag name Action

TS Sets the task switch bit.
EM Sets the emulation processor extension bit.
MP Sets the monitor processor extension bit.
PM Sets the protected-mode bit.

Comments

Setting the protected-mode bit from within the debugger does not set the target system to run in protected mode. The debugger simulates the setting. To configure the target system to run in protected mode, you would have to set the PM bit in the MSW register and reset the target system to restart in protected mode.

Example

The r command without parameters produces a display similar to the following:

AX=0698  BX=2008  CX=2C18  DX=18AB  SP=1B7A  BP=00FF  SI=0020  DI=10CD
IP=0450  CS=18B0  DS=1BE8  ES=0DA8  SS=0048  NV UP DI PL NZ NA PONC
GDTR=01BE80 3687  IDTR=01F508 03FF  TR=0010  LDTR=0028 IOPL=3 MSW=PM
18B0:0450 C3             RET

The following example displays each flag with a two-letter code. To change any flag, type the two-letter code that inverts the setting. The flags are either set or cleared.

rf

The example produces a display similar to the following:

NV UP DI NG NZ AC PE NC - _

To change the value of a flag's setting, type the two-letter code that inverts the setting for that flag. The following example changes the sign flag to positive, enables interrupts, and sets the carry flag:

NV UP DI NG NZ AC PE NC - PLEICY

The following command modifies the MSW bits:

rmsw

Then 80386 Debugger displays the status of the MSW register and prints a colon on the next line.