home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / bc45 / tddoc.pak / TD_ASM.TXT next >
Text File  |  1997-07-23  |  31KB  |  816 lines

  1. /*************************************************************************/
  2.                              TURBO DEBUGGER
  3.                         Assembler-level debugging
  4.  
  5. This file contains information about Assembler-level debugging. The
  6. contents of the file are as follows:
  7.  
  8. 1. When source debugging isn't enough
  9. 2. The assembler
  10. 3. Assembler-specific bugs
  11. 4. Inline assembler tips
  12. 5. Inline assembler keywords
  13. 6. The Numeric Processor window
  14.  
  15. The material in this file is for programmers who are familiar with
  16. programming the 80x86 processor family in assembler. You don't need
  17. to use the information in this chapter to debug your programs, but
  18. there are certain problems that might be easier to find using
  19. the techniques discussed here.
  20.  
  21.  
  22. ===================================================================
  23. 1. When source debugging isn't enough
  24. ===================================================================
  25.  
  26. Sometimes, however, you can gain insight into a problem by looking
  27. at the exact instructions that the compiler generated, the contents
  28. of the CPU registers, and the contents of the stack. To do this,
  29. you need to be familiar with both the 80x86 family of processors
  30. and with how the compiler turns your source code into machine
  31. instructions. Because many excellent books are available about the
  32. internal workings of the CPU, we won't go into that in detail here.
  33. You can quickly learn how the compiler turns your source code into
  34. machine instructions by looking at the instructions generated for
  35. each line of source code within the CPU window.
  36.  
  37. Turbo Debugger can detect an 8087, 80287, 80387, or 80486 numeric
  38. coprocessor and disassemble those instructions if a floating-point
  39. chip or emulator is present.
  40.  
  41. The instruction mnemonic RETF indicates that this is a far return
  42. instruction. The normal RET mnemonic indicates a near return.
  43.  
  44. Where possible, the target of JMP and CALL instructions is
  45. displayed symbolically. If CS:IP is a JMP or conditional jump
  46. instruction, an up-arrow or down-arrow that shows jump direction
  47. will be displayed only if the executing instruction will cause the
  48. jump to occur. Also, memory addresses used by MOV, ADD, and other
  49. instructions display symbolic addresses.
  50.  
  51.  
  52. ===================================================================
  53. 2. The assembler
  54. ===================================================================
  55.  
  56. If you use the Assemble command in the Code pane local menu, Turbo
  57. Debugger lets you assemble instructions for the 8086, 80186, 80286,
  58. 80386, and 80486 processors, and also for the 8087, 80287, and 80387
  59. numeric coprocessors.
  60.  
  61. When you use Turbo Debugger's built-in assembler to modify your program,
  62. the changes you make are not permanent. If you reload your program Run|
  63. Program Reset, or if you load another program using File|Open,
  64. you'll lose any changes you've made.
  65.  
  66. Normally you use the assembler to test an idea for fixing your program.
  67. Once you've verified that the change works, you must change your source
  68. code and recompile and link your program.
  69.  
  70. The following sections describe the differences between the built-
  71. in assembler and the syntax accepted by Borland C++'s inline
  72. assembler.
  73.  
  74.  
  75. Operand address size overrides
  76. ==============================
  77.  
  78. For the call (CALL), jump (JMP), and conditional jump (JNE, JL, and
  79. so forth) instructions, the assembler automatically generates the
  80. smallest instruction that can reach the destination address. You
  81. can use the NEAR and FAR overrides before the destination address
  82. to assemble the instruction with a specific size. For example,
  83.  
  84.   CALL FAR XYZ
  85.   JMP  NEAR A1
  86.  
  87.  
  88. Memory and immediate operands
  89. -----------------------------
  90.  
  91. When you use a symbol from your program as an instruction operand,
  92. you must tell the built-in assembler whether you mean the contents
  93. of the symbol or the address of the symbol. If you use just the
  94. symbol name, the assembler treats it as an address, exactly as if
  95. you had used the assembler OFFSET operator before it. If you put
  96. the symbol inside brackets ([ ]), it becomes a memory reference.
  97. For example, if your program contains the data definition
  98.  
  99.   A    DW 4
  100.  
  101. then "A" references the area of memory where A is stored.
  102.  
  103. When you assemble an instruction or evaluate an assembler
  104. expression to refer to the contents of a variable, use the name of
  105. the variable alone or between brackets:
  106.  
  107.   mov dx,a
  108.   mov ax,[a]
  109.  
  110. To refer to the address of the variable, use the OFFSET operator:
  111.  
  112.   mov ax,offset a
  113.  
  114.  
  115. Operand data size overrides
  116. ===========================
  117.  
  118. For some instructions, you must specify the operand size using one
  119. of the following expressions before the operand:
  120.  
  121.   BYTE PTR
  122.   WORD PTR
  123.  
  124. Here are examples of instructions using these overrides:
  125.  
  126.   add BYTE PTR[si],10
  127.   mov WORD PTR[bp+10],99
  128.  
  129. In addition to these size overrides, you can use the following
  130. overrides to assemble 8087/80287/80387/80486 numeric processor
  131. instructions:
  132.  
  133.   DWORD PTR
  134.   QWORD PTR
  135.   TBYTE PTR
  136.  
  137. Here are some examples using these overrides:
  138.  
  139.   fild QWORD PTR[bx]
  140.   stp  TBYTE PTR[bp+4]
  141.  
  142.  
  143. String instructions
  144. ===================
  145.  
  146. When you assemble a string instruction, you must include the size
  147. (byte or word) as part of the instruction mnemonic. The assembler
  148. does not accept the form of the string instructions that uses a
  149. sizeless mnemonic with an operand that specifies the size. For
  150. example, use STOSW rather than STOS WORD PTR[di].
  151.  
  152.  
  153. =========================================
  154. 3. Assembler-specific bugs
  155. =========================================
  156.  
  157. This section, which covers some of the common pitfalls of assembly
  158. language programming, is intended for people who have Turbo Assembler
  159. or use inline assembler in C++ programs. You should refer to the
  160. Turbo Assembler User's Guide for a fuller explanation on these
  161. often encountered errors--and tips on how to avoid them.
  162.  
  163. Forgetting to return to DOS
  164. ===========================
  165.  
  166. In C++, a program ends automatically when there is no more code to
  167. execute, even if no explicit termination command was written into the
  168. program. Not so in assembly language, where only those actions that
  169. you explicitly request are performed. When you run a program that has
  170. no command to return to DOS, execution simply continues right past the
  171. end of the program's code and into whatever code happens to be in the
  172. adjacent memory.
  173.  
  174.  
  175. Forgetting a RET instruction
  176. ============================
  177.  
  178. The proper invocation of a subroutine consists of a call to the subroutine
  179. from another section of code, execution of the subroutine, and a return
  180. from the subroutine to the calling code. Remember to insert a RET
  181. instruction in each subroutine, so that the RETurn to the calling code
  182. occurs. When you're typing a program, it's easy to skip a RET and end
  183. up with an error.
  184.  
  185.  
  186. Generating the wrong type of return
  187. ===================================
  188.  
  189. The PROC directive has two effects. First, it defines a name by which a
  190. procedure can be called. Second, it controls whether the procedure is a near
  191. or far procedure.
  192.  
  193. The RET instructions in a procedure should match the type of the procedure,
  194. shouldn't they?
  195.  
  196. Yes and no. The problem is that it's possible and often desirable to group
  197. several subroutines in the same procedure. Since these subroutines lack an
  198. associated PROC directive, their RET instructions take on the type of the
  199. overall procedure, which is not necessarily the correct type for the
  200. individual subroutines.
  201.  
  202.  
  203. Reversing operands
  204. ==================
  205.  
  206. To many people, the order of instruction operands in 8086 assembly language
  207. seems backward (and there is certainly some justification for this
  208. viewpoint). If the line
  209.  
  210.   mov  ax,bx
  211.  
  212. meant "move AX to BX," the line would scan smoothly from left to right, and
  213. this is exactly the way in which many microprocessor manufacturers have
  214. designed their assembly languages.
  215.  
  216. However, Intel took a different approach with 8086 assembly language; for
  217. us, the line means "move BX to AX," and that can sometimes cause confusion.
  218.  
  219.  
  220. Forgetting the stack or reserving a too-small stack
  221. ===================================================
  222.  
  223. In most cases, you're treading on thin ice if you don't explicitly allocate
  224. space for a stack. Programs without an allocated stack sometimes run, but
  225. there is no assurance that these programs will run under all circumstances.
  226. DOS programs can have a .STACK directive to reserve space for the stack.
  227. For each program, you should reserve more than enough space for the
  228. deepest stack the program can use.
  229.  
  230.  
  231. Calling a subroutine that wipes out registers
  232. =============================================
  233.  
  234. When you're writing assembler code, it's easy to think of the registers
  235. as local variables, dedicated to the use of the procedure you're working
  236. on at the moment. In particular, there's a tendency to assume that
  237. registers are unchanged by calls to other procedures. It just isn't
  238. so--the registers are global variables, and each procedure can preserve or
  239. destroy any or all registers.
  240.  
  241.  
  242. Using the wrong sense for a conditional jump
  243. ============================================
  244.  
  245. The profusion of conditional jumps in assembly language (JE, JNE, JC,
  246. JNC, JA, JB, JG, and so on) allows tremendous flexibility in writing
  247. code--and also makes it easy to select the wrong jump for a given purpose.
  248. Moreover, since condition-handling in assembly language requires at least
  249. two separate lines, one for the comparison and one for the conditional
  250. jump (it requires many more lines for complex conditions), assembly
  251. language condition-handling is less intuitive and more prone to errors than
  252. condition-handling in C++.
  253.  
  254.  
  255. Forgetting about REP string overrun
  256. ===================================
  257.  
  258. String instructions have a curious property: After they're executed, the
  259. pointers they use wind up pointing to an address 1 byte away (or 2 bytes
  260. for a word instruction) from the last address processed. This can cause
  261. some confusion with repeated string instructions, especially REP SCAS and
  262. REP CMPS.
  263.  
  264.  
  265. Relying on a zero CX to cover a whole segment
  266. =============================================
  267.  
  268. Any repeated string instruction executed with CX equal to zero does nothing.
  269. This can be convenient in that there's no need to check for the zero
  270. case before executing a repeated string instruction; on the other hand,
  271. there's no way to access every byte in a segment with a byte-sized string
  272. instruction.
  273.  
  274.  
  275. Using incorrect direction flag settings
  276. =======================================
  277.  
  278. When a string instruction is executed, its associated pointer or pointers--
  279. SI or DI or both--increment or decrement. It all depends on the state of the
  280. direction flag.
  281.  
  282. The direction flag can be cleared with CLD to cause string instructions to
  283. increment (count up) and can be set with STD to cause string instructions to
  284. decrement (count down). Once cleared or set, the direction flag stays in the
  285. same state until either another CLD or STD is executed, or until the flags
  286. are popped from the stack with POPF or IRET. While it's handy to be able to
  287. program the direction flag once and then execute a series of string
  288. instructions that all operate in the same direction, the direction flag can
  289. also be responsible for intermittent and hard-to-find bugs by causing the
  290. behavior of string instructions to depend on code that executed much earlier.
  291.  
  292.  
  293. Using the wrong sense for a repeated string comparison
  294. ======================================================
  295.  
  296. The CMPS instruction compares two areas of memory; the SCAS instruction
  297. compares the accumulator to an area of memory. Prefixed by REPE, either
  298. of these instructions can perform a comparison until either CX becomes
  299. zero or a not-equal comparison occurs. Unfortunately, it's easy to become
  300. confused about which of the REP prefixes does what.
  301.  
  302.  
  303. Forgetting about string segment defaults
  304. ========================================
  305.  
  306. Each of the string instructions defaults to using a source segment (if any)
  307. of DS, and a destination segment (if any) of ES. It's easy to forget this
  308. and try to perform, say, a STOSB to the data segment, since that's where
  309. all the data you're processing with non-string instructions normally resides.
  310.  
  311.  
  312. Converting incorrectly from byte to word operations
  313. ===================================================
  314.  
  315. In general, it's desirable to use the largest possible data size (usually
  316. word, but dword on an 80386) for a string instruction, since string
  317. instructions with larger data sizes often run faster.
  318.  
  319. There are a couple of potential pitfalls here. First, the conversion from a
  320. byte count to a word count by a simple
  321.  
  322.   shr cx,1
  323.  
  324. loses a byte if CX is odd, since the least-significant bit is shifted out.
  325.  
  326. Second, make sure you remember SHR divides the byte count by two. Using,
  327. say, STOSW with a byte rather than a word count can wipe out other data
  328. and cause problems of all sorts.
  329.  
  330.  
  331. Using multiple prefixes
  332. =======================
  333.  
  334. String instructions with multiple prefixes are error-prone and should
  335. generally be avoided.
  336.  
  337.  
  338. Relying on the operand(s) to a string instruction
  339. =================================================
  340.  
  341. The optional operand or operands to a string instruction are used for data
  342. sizing and segment overrides only, and do not guarantee that the memory
  343. location referenced is accessed.
  344.  
  345.  
  346. Wiping out a register with multiplication
  347. =========================================
  348.  
  349. Multiplication--whether 8 bit by 8 bit, 16 bit by 16 bit, or 32 bit by 32
  350. bit--always destroys the contents of at least one register other than the
  351. portion of the accumulator used as a source operand.
  352.  
  353.  
  354. Forgetting that string instructions alter several registers
  355. ===========================================================
  356.  
  357. The string instructions, MOVS, STOS, LODS, CMPS, and SCAS, can affect several
  358. of the flags and as many as three registers during execution of a single
  359. instruction. When you use string instructions, remember that SI, DI, or
  360. both either increment or decrement (depending on the state of the direction
  361. flag) on each execution of a string instruction. CX is also decremented at
  362. least once, and possibly as far as zero, each time a string instruction with
  363. a REP prefix is used.
  364.  
  365.  
  366. Expecting certain instructions to alter the carry flag
  367. ======================================================
  368.  
  369. While some instructions affect registers or flags unexpectedly, other
  370. instructions don't even affect all the flags you might expect them to.
  371.  
  372.  
  373. Waiting too long to use flags
  374. =============================
  375.  
  376. Flags last only until the next instruction that alters them, which is
  377. usually not very long. It's a good practice to act on flags as soon as
  378. possible after they're set, thereby avoiding all sorts of potential bugs.
  379.  
  380.  
  381. Confusing memory and immediate operands
  382. =======================================
  383.  
  384. An assembler program may refer either to the offset of a memory variable or
  385. to the value stored in that memory variable. Unfortunately, assembly language
  386. is neither strict nor intuitive about the ways in which these two types of
  387. references can be made, and as a result, offset and value references to a
  388. memory variable are often confused.
  389.  
  390.  
  391. Failing to preserve everything in an interrupt handler
  392. ======================================================
  393.  
  394. Every interrupt handler should explicitly preserve the contents of all
  395. registers. While it is valid to preserve explicitly only those registers
  396. that the handler modifies, it's good insurance just to push all registers
  397. on entry to an interrupt handler and pop all registers on exit.
  398.  
  399.  
  400. Forgetting group overrides in operands and data tables
  401. ======================================================
  402.  
  403. Segment groups let you partition data logically into a number of areas
  404. without having to load a segment register every time you want to switch
  405. from one of those logical data areas to another.
  406.  
  407.  
  408.  
  409. =========================================
  410. 4. Inline assembler tips
  411. =========================================
  412.  
  413.  
  414. Looking at raw hex data
  415. =======================
  416.  
  417. You can use the Data|Add Watch and Data| Evaluate/Modify commands with
  418. a format modifier to look at raw data dumps. For example, if your
  419. language is Assembler,
  420.  
  421.   [ES:DI],20m
  422.  
  423. specifies that you want to look at a raw hex memory dump of the 20 bytes
  424. pointed to by the ES:DI register pair.
  425.  
  426.  
  427. Source-level debugging
  428. ======================
  429.  
  430. You can step through your assembler code using a Module window just as
  431. with any of the high-level languages. If you want to see the register
  432. values, you can put a Registers window to the right of the Module window.
  433.  
  434. Sometimes, you may want to use a CPU window and see your source code as
  435. well. To do this, open a CPU window and choose the Code pane's Mixed
  436. command until it reads Both. That way you can see both your source code
  437. and machine code bytes. Remember to zoom the CPU window (by pressing F5)
  438. if you want to see the machine code bytes.
  439.  
  440.  
  441. Examining and changing registers
  442. ================================
  443.  
  444. The obvious way to change registers is to highlight a register in either
  445. a CPU window or Registers window. A quick way to change a register is to
  446. choose Data|Evaluate/Modify. You can enter an assignment expression that
  447. directly modifies a register's contents. For example,
  448.  
  449.    SI = 99
  450.  
  451. loads the SI register with 99.
  452.  
  453. Likewise, you can examine registers using the same technique. For example,
  454.  
  455.    Alt-D E AX
  456.  
  457. shows you the value of the AX register.
  458.  
  459.  
  460. =========================================
  461. 5. Inline assembler keywords
  462. =========================================
  463.  
  464. This section lists the instruction mnemonics and other special symbols that
  465. you use when entering instructions with the inline assembler. The keywords
  466. presented here are the same as those used by Turbo Assembler.
  467.  
  468.  
  469. 8086/80186/80286 instructional mnemonics
  470. _________________________________________
  471.   AAA        INC        LIDT**     REPNZ
  472.   AAD        INSB*      LLDT**     REPZ
  473.   AAM        INSW*      LMSW**     RET
  474.   AAS        INT        LOCK       REFT
  475.   ADC        INTO       LODSB      ROL
  476.   ADD        IRET       LODSW      ROR
  477.   AND        JB         LOOP       SAHF
  478.   ARPL**     JBE        LOOPNZ     SAR
  479.   BOUND*     JCXZ       LOOPZ      SBB
  480.   CALL       JE         LSL**      SCASB
  481.   CLC        JL         LTR**      SCASW
  482.   CLD        JLE        MOV        SGDT**
  483.   CLI        JMP        MOVSB      SHL
  484.   CLTS**     JNB        MOVSW      SHR
  485.   CMC        JNBE       MUL        SLDT**
  486.   CMP        JNE        NEG        SMSW**
  487.   CMPSB      JNLE       NOP        STC
  488.   CMPSW      JNO        NOT        STD
  489.   CWD        JNP        OR         STI
  490.   DAA        JO         OUT        STOSB
  491.   DAS        JP         OUTSB      STOSW
  492.   DEC        JS         OUTSW      STR**
  493.   DIV        LAHF       POP        SUB
  494.   ENTER*     LAR**      POPA*      TEST
  495.   ESC        LDS        POPF       WAIT
  496.   HLT        LEA        PUSH       VERR**
  497.   IDIV       LEAVE      PUSHA*     VERW**
  498.   IMUL       LES        PUSHF      XCHG
  499.   IN         LGDT**     RCL        XLAT
  500.                                    XOR
  501. ___________________________________________
  502.  
  503. * Available only when running on the 186 and 286 processor
  504. ** Available only when running on the 286 processor
  505.  
  506.  
  507. Turbo Debugger supports all 80386 and 80387 instruction
  508. mnemonics and registers:
  509.  
  510. 80386 instruction mnemonics
  511. _________________________________________
  512.  
  513.   BSF        LSS         SETG        SETS
  514.   BSR        MOVSX       SETL        SHLD
  515.   BT         MOVZX       SETLE       SHRD
  516.   BTC        POPAD       SETNB       CMPSD
  517.   BTR        POPFD       SETNE       STOSD
  518.   BTS        PUSHAD      SETNL       LODSD
  519.   CDQ        PUSHFD      SETNO       MOVSD
  520.   CWDE       SETA        SETNP       SCASD
  521.   IRETD      SETB        SETNS       INSD
  522.   LFS        SETBE       SETO        OUTSD
  523.   LGS        SETE        SETP        JECXZ
  524. __________________________________________
  525.  
  526. 80486 instruction mnemonics
  527. _________________________________________
  528.  
  529.        BSWAP               INVLPG
  530.        CMPXCHG             WBINVD
  531.        INVD                XADD
  532. _________________________________________
  533.  
  534. 80386 registers
  535. _________________________________________
  536.  
  537.        EAX                 EDI
  538.        EBX                 EBP
  539.        ECX                 ESP
  540.        EDX                 FS
  541.        ESI                 GS
  542. _________________________________________
  543.  
  544. CPU registers
  545. __________________________________________________________________
  546.  
  547. Byte registers            AH, AL, BH, BL, CH, CL, DH, DL
  548.  
  549. Word registers            AX, BX, CX, DX, SI, DI, SP, BP, FLAGS
  550.  
  551. Segment registers         CS, DS, ES, SS
  552.  
  553. Floating registers        ST, ST(0), ST(1), ST(2), ST(3), ST(4),
  554.                           ST(5), ST(6), ST(7)
  555. ___________________________________________________________________
  556.  
  557. Special keywords
  558. _________________________________________
  559.  
  560.        WORD PTR            TBYTE PTR
  561.        BYTE PTR            NEAR
  562.        DWORD PTR           FAR
  563.        QWORD PTR           SHORT
  564. _________________________________________
  565.  
  566. 8087/80287 numeric coprocessor instruction mnemonics
  567. ____________________________________________________
  568.   FABS       FIADD      FLDL2E     FST
  569.   FADD       FIACOM     FLDL2T     FSTCW
  570.   FADDP      FIACOMP    FLDPI      FSTENV
  571.   FBLD       FIDIV      FLDZ       FSTP
  572.   FBSTP      FIDIVR     FLD1       FSTSW**
  573.   FCHS       FILD       FMUL       FSUB
  574.   FCLEX      FIMUL      FMULP      FSUBP
  575.   FCOM       FINCSTP    FNOP       FSUBR
  576.   FCOMP      FINIT      FNSTS**    FSUBRP
  577.   FCOMPP     FIST       FPATAN     FTST
  578.   FDECSTP    FISTP      FPREM      FWAIT
  579.   FDISI      FISUB      FPTAN      FXAM
  580.   FDIV       FISUBR     FRNDINT    FXCH
  581.   FDIVP      FLD        FRSTOR     FXTRACT
  582.   FDIVR      FLDCWR     FSAVENT    FYL2X
  583.   FDIVRP     FLDENV     FSCALE     FYL2XPI
  584.   FENI       FLDLG2     FSETPM*    F2XM1
  585.   FFREE      FLDLN2     FSQRT
  586. _____________________________________________________
  587.  
  588. * Available only when running on the 287 numeric coprocessor.
  589. ** On the 80287, the fstsw instruction can use the AX register as an
  590.    operand, as well as the normal memory operand.
  591.  
  592.  
  593. 80387 instruction mnemonics
  594. _________________________________________
  595.  
  596.        FCOS                FUCOM
  597.        FSIN                FUCOMP
  598.        FPREM1              FUCOMPP
  599.        FSINCOS
  600. _________________________________________
  601.  
  602.  
  603. The 80x87 coprocessor chip and emulator
  604. =======================================
  605.  
  606. This section is for programmers who are familiar with the operation
  607. if the 80x87 math coprocessor. If your program uses floating-point
  608. numbers, Turbo Debugger lets you examine and change the state of the numeric
  609. coprocessor or, if the coprocessor is emulated, examine the state of the
  610. software emulator. (Windows permits you only to examine the state of the
  611. emulator, not to change it.)  You don't need to use the capabilities
  612. described in this chapter to debug programs that use floating-point numbers,
  613. although some very subtle bugs may be easier to find.
  614.  
  615. In this section, we discuss the differences between the 80x87 chip and
  616. the software emulator. We also describe the Numeric Processor window and
  617. show you how to examine and modify the floating-point registers, the status
  618. bits, and the control bits.
  619.  
  620.  
  621. The 80x87 chip vs. the emulator
  622. ===============================
  623.  
  624. TDW automatically detects whether your program is using the math chip or the
  625. emulator and adjusts its behavior accordingly.
  626.  
  627. Note that most programs use either the emulator or the math chip, not both
  628. within the same program. If you have written special assembler code that
  629. uses both, TDW won't be able to show you the status of the math chip; it
  630. reports on the emulator only.
  631.  
  632.  
  633. =========================================
  634. 6. The Numeric Processor window
  635. =========================================
  636.  
  637. You create a Numeric Processor window by choosing the View|Numeric Processor
  638. command from the menu bar. The line at the top of the window shows the
  639. current instruction pointer, opcode, and data pointer. The instruction
  640. pointer is both shown as a 20-bit physical address. The data pointer is
  641. either a 16-bit or a 20-bit address, depending on the memory model. You
  642. can convert 20-bit addresses to segment and offset form by using the first
  643. four digits as the segment value and the last digit as the offset value.
  644.  
  645. For example, if the top line shows IPTR=5A669, you can treat this as the
  646. address 5a66:9 if you want to examine the current data and instruction in
  647. a CPU window. This window has three panes: The left pane (Register pane)
  648. shows the contents of the floating-point registers, the middle pane
  649. (Control pane) shows the control flags, and the right pane (Status pane)
  650. shows the status flags.
  651.  
  652. The top line shows you the following information about the last floating-
  653. point operation that was executed:
  654.  
  655. o Emulator indicates that the numeric processor is being emulated. If there
  656.   were a numeric processor, 8087, 80287, 80387, or 80486 would appear instead.
  657.  
  658. o The IPTR shows the 20-bit physical address from which the last floating-
  659.   point instruction was fetched.
  660.  
  661. o The OPCODE shows the instruction type that was fetched.
  662.  
  663. o The OPTR shows the 16-bit or 20-bit physical address of the memory address
  664.   that the instruction referenced, if any.
  665.  
  666.  
  667. The Register pane
  668. -----------------
  669.  
  670.     The 80-bit floating-point registers
  671.     -----------------------------------
  672.  
  673.     The Register pane shows each of the floating-point registers, ST(0) to
  674.     ST(7), along with its status (valid/zero/special/empty). The contents
  675.     are shown as an 80-bit floating-point number.
  676.  
  677.     If you've zoomed the Numeric Processor window (by pressing F5) or made
  678.     it wider by using Window|Size/Move, you'll also see the floating-point
  679.     registers displayed as raw hex bytes.
  680.  
  681.  
  682.     The Register pane's local menu
  683.     ------------------------------
  684.     ___________
  685.    | Zero      |
  686.    | Empty     |
  687.    | Change...  |
  688.    |___________|
  689.  
  690.     To bring up the Register pane local menu, press Alt-F10, or use the Ctrl
  691.     key with the first letter of the desired command to directly access the
  692.     command.
  693.  
  694.     Zero
  695.     ----
  696.  
  697.     Sets the value of the currently highlighted register to zero.
  698.  
  699.     Empty
  700.     -----
  701.  
  702.     Sets the value of the currently highlighted register to empty. This is a
  703.     special status that indicates that the register no longer contains valid
  704.     data.
  705.  
  706.     Change
  707.     ------
  708.  
  709.     Loads a new value into the currently highlighted register. You are
  710.     prompted for the value to load. You can enter an integer or floating-
  711.     point value, using the current language's expression parser. The value
  712.     you enter is automatically converted to the 80-bit temporary real format
  713.     used by the numeric coprocessor.
  714.  
  715.     You can also invoke this command by simply starting to type the new value
  716.     for the floating-point register. A dialog box appears, exactly as if you
  717.     had specified the Change command.
  718.  
  719.  
  720. The Control pane
  721. ----------------
  722.  
  723.     The control bits
  724.     ----------------
  725.  
  726.     The following table lists the different control flags and how they
  727.     appear in the Control pane:
  728. _________________________________________
  729.  
  730.    Name in pane         Flag description__
  731.  
  732.       im                Invalid operation mask
  733.       dm                Denormalized operand mask
  734.       zm                Zero divide mask
  735.       om                Overflow mask
  736.       um                Underflow mask
  737.       pm                Precision mask
  738.       iem               Interrupt enable mask (8087 only)
  739.       pc                Precision control
  740.       rc                Rounding control
  741.       ic                Infinity control__
  742.  
  743.  
  744.     The Control pane's local menu
  745.     -----------------------------
  746.        ________
  747.       | Toggle |
  748.       |________|
  749.  
  750.     Press Tab to go to the Control pane, then press Alt-F10 to pop up the
  751.     local menu. (Alternatively, you can use the Ctrl key with the first letter
  752.     of the desired command to access it.)
  753.  
  754.     Toggle
  755.     ------
  756.  
  757.     Cycles through the values that the currently highlighted control flag
  758.     can be set to. Most flags can only be set or cleared (0 or 1), so this
  759.     command just toggles the flag to the other value. Some other flags have
  760.     more than two values; for those flags, this command increments the flag
  761.     value until the maximum value is reached, and then sets it back to zero.
  762.  
  763.     You can also toggle the control flag values by highlighting them and
  764.     pressing Enter.
  765.  
  766.  
  767. The Status pane
  768. ---------------
  769.  
  770.     The status bits
  771.     ---------------
  772.  
  773.     The following table lists the different status flags and how they appear
  774.     in the Status pane:
  775. ____________________________________
  776.  
  777.    Name in pane         Flag description__
  778.  
  779.       ie                Invalid operation
  780.       de                Denormalized operand
  781.       ze                Zero divide
  782.       oe                Overflow
  783.       ue                Underflow
  784.       pe                Precision
  785.       ir                Interrupt request
  786.       cc                Condition code
  787.       st                Stack top pointer_
  788.  
  789.  
  790.     The Status pane's local menu
  791.     ----------------------------
  792.        ________
  793.       | Toggle |
  794.       |________|
  795.  
  796.     Press Tab to move to the Statuspane, then press Alt-F10 to pop up the
  797.     local menu. (You can also use the Ctrl key with the first letter of the
  798.     desired command to access the command directly.)
  799.  
  800.  
  801.     Toggle
  802.     ------
  803.  
  804.     Cycles through the values that the currently highlighted status flag
  805.     can be set to. Most flags can only be set or cleared (0 or 1), so this
  806.     command just toggles the flag to the other value. Some other flags have
  807.     more than two values; for those flags, this command increments the
  808.     flag value until the maximum value is reached, and then sets it back to
  809.     zero.
  810.  
  811.     You can also toggle the status flag values by highlighting them and
  812.     pressing Enter.
  813.  
  814. /***************************** END OF FILE *******************************/
  815.  
  816.