home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sd386v50.zip / sd386src.zip / SHOWA.C < prev    next >
C/C++ Source or Header  |  1996-05-17  |  79KB  |  1,240 lines

  1. /*****************************************************************************/
  2. /* File:                                             IBM INTERNAL USE ONLY   */
  3. /*   showa.c                                                                 */
  4. /*                                                                           */
  5. /* Description:                                                              */
  6. /*                                                                           */
  7. /*  Machine display routines.                                                */
  8. /*                                                                           */
  9. /* History:                                                                  */
  10. /*                                                                           */
  11. /*   02/08/91 Creation of 32-bit SD86, from 16-bit version.                  */
  12. /*                                                                           */
  13. /*...16->32 port.                                                            */
  14. /*...                                                                        */
  15. /*... 02/08/91  100   Philip    port to 32 bit.                              */
  16. /*... 02/08/91  101   Joe       port to 32 bit.                              */
  17. /*... 02/08/91  102   Pratima   port to 32 bit.                              */
  18. /*... 02/08/91  103   Dave      port to 32 bit.                              */
  19. /*... 02/08/91  104                                                          */
  20. /*... 02/08/91  105   Christina port to 32 bit.                              */
  21. /*... 02/08/91  106   Srinivas  port to 32 bit.                              */
  22. /*... 02/08/91  107   Dave      port to 32 bit.                              */
  23. /*... 02/08/91  108   Dave      port to 32 bit.                              */
  24. /*... 02/08/91  109                                                          */
  25. /*... 02/08/91  110   Srinivas  port to 32 bit.                              */
  26. /*... 02/08/91  111   Christina port to 32 bit.                              */
  27. /*... 02/08/91  112   Joe       port to 32 bit.                              */
  28. /*... 02/08/91  113                                                          */
  29. /*... 02/08/91  114                                                          */
  30. /*... 02/08/91  115   Srinivas  port to 32 bit.                              */
  31. /*... 02/08/91  116   Joe       port to 32 bit.                              */
  32. /*                                                                           */
  33. /*...Release 1.00 (Pre-release 1)                                            */
  34. /*...                                                                        */
  35. /*... 07/09/91  201   srinivas  single line disassembly when stepping into   */
  36. /*                              a system dll.                                */
  37. /*... 08/06/91  221   srinivas  Users app being started in back ground       */
  38. /*... 08/19/91  229   srinivas  ESC key should take back to action bar from  */
  39. /*                              showthds and editregs.                       */
  40. /*... 08/30/91  235   Joe       Cleanup/rewrite ascroll() to fix several bugs*/
  41. /*                                                                           */
  42. /*...Release 1.00 (Pre-release 105 10/10/91)                                 */
  43. /*...                                                                        */
  44. /*... 10/16/91  301   Srinivas  Alt_F3 (change mnemonics) not when you come  */
  45. /*                              into a c-runtime asm code.                   */
  46. /*... 10/22/91  305   Srinivas  Trap on sizing the data window.              */
  47. /*...                                                                        */
  48. /*... 10/31/91  308   Srinivas  Menu for exceptions.                         */
  49. /*...                                                                        */
  50. /*...Release 1.00 (Pre-release 107 11/13/91)                                 */
  51. /*...                                                                        */
  52. /*... 11/13/91  400   Srinivas  Vertical Register Display.                   */
  53. /*...                                                                        */
  54. /*... 11/18/91  401   Srinivas  Floating point Register Display.             */
  55. /*...                                                                        */
  56. /*... 11/21/91  402   Joe       Fix source/disassembly synchronization.      */
  57. /*...                                                                        */
  58. /*...Release 1.00 (Pre-release 108 12/05/91)                                 */
  59. /*...                                                                        */
  60. /*... 01/28/92  508   Srinivas  Added Set Execution Line function.           */
  61. /*... 02/05/92  511   Srinivas  Allow turning off screen swapping while      */
  62. /*...                           executing.                                   */
  63. /*... 02/11/92  518   Srinivas  Remove limitation on max no of screen rows.  */
  64. /*... 02/12/92  521   Srinivas  Port to C-Set/2.                             */
  65. /*... 02/17/92  531   Srinivas  Trap when we switch back to source in thunks */
  66. /*...                           case.                                        */
  67. /*...                                                                        */
  68. /*...Release 1.00 (03/03/92)                                                 */
  69. /*...                                                                        */
  70. /*... 03/10/92  602   Srinivas  Hooking up watch points.                     */
  71. /*...                                                                        */
  72. /*...Release 1.01 (04/03/92)                                                 */
  73. /*...                                                                        */
  74. /*... 05/08/92  701   Srinivas  Cua Interface.                               */
  75. /*... 10/05/92  701   Michelle  Help window.                                 */
  76. /*... 01/12/93  808   Selwyn    Profile fixes/improvements.                  */
  77. /*... 03/22/93  817   Selwyn    S_F3 from a mixed view with comment lines    */
  78. /*...                           only hangs.                                  */
  79. /*****************************************************************************/
  80. /**Includes*******************************************************************/
  81.                                         /*                                   */
  82. #include "all.h"                        /* SD86 include files                */
  83. static int iview=0;
  84.                                         /*                                   */
  85. /**Defines *******************************************************************/
  86.                                         /*                                   */
  87. #define N1KEYS 29                       /*                                   */
  88.                                         /*                                   */
  89. /**External declararions******************************************************/
  90.                                         /*                                   */
  91. extern AFILE      *allfps;              /*                                   */
  92. extern AFILE      *fp_focus;            /*                                   */
  93. extern uint        TopLine;             /*                                   */
  94. extern uint        SaveTopLine;         /* saved top line for data window.   */
  95. extern uint        HideDataWin;         /* data window hidden flag.          */
  96. extern uint        LinesPer;            /* current # lines/screen for code   */
  97. extern uint        MinPer;              /* minimum # of lines for code.      */
  98. extern uint        MaxPer;              /* max # of lines for code.          */
  99. extern uint        VideoCols;           /*                                   */
  100. extern uint        VideoRows;           /* # of rows per screen           518*/
  101. extern uint        SyncAddr;            /*                                   */
  102. extern uchar      *ActFaddrs[];         /*                                   */
  103. extern uchar      *ActCSIPs[];          /*                                   */
  104. extern uint        TidTab[];            /*                                   */
  105. extern KEY2FUNC    defk2f[];            /*                                   */
  106. extern int         RegTop=0;            /*                                   */
  107. extern uint        MneChange=0;         /* flag to tell DBDisa about a       */
  108.                                         /* mnemonics change.                 */
  109. extern uchar       Reg_Display;         /* Register display flag          400*/
  110. extern uchar      *BoundPtr;            /* -> to screen bounds            518*/
  111. extern uint        VioStartOffSet;      /* flag to tell were to start scr 701*/
  112. extern CmdParms    cmd;
  113. extern PROCESS_NODE *pnode;                                             /*827*/
  114. extern UINT        MaxData;             /* max # of lines of Data            */
  115.                                         /*                                   */
  116.  
  117.        uint    RowsUsed;                /* was static                     235*/
  118.        int     AsmTop;                  /* was static                     235*/
  119.        int     AsmRows=0;               /* was static                     235*/
  120. extern uint   *AddrCache;                                               /*518*/
  121. extern uint   *SourceLineCache;                                         /*518*/
  122. extern int        BlowBy;               /* blow by GetFuncsFromEvents flag701*/
  123.                                         /*                                   */
  124.  
  125. UINT   AL86orMASM=1;                    /* 1 if user wants MASM disassembly  */
  126.  
  127.  
  128.  
  129.  
  130. /**Begin Code*****************************************************************/
  131.                                         /*                                   */
  132. /*****************************************************************************/
  133. /* showA()                                                                   */
  134. /*                                                                           */
  135. /* Description:                                                              */
  136. /*                                                                           */
  137. /*   Disassembly window handling.                                            */
  138. /*                                                                           */
  139. /* Parameters:                                                               */
  140. /*                                                                           */
  141. /*   fp        input - the afile for this dfile node.                        */
  142. /*   msg       ????? - ????????????????????????????????????????????????????? */
  143. /*                                                                           */
  144. /* Return:                                                                   */
  145. /*                                                                           */
  146. /*             a GO cmd of sorts, like GOSTEP, GOSTEPC, etc.                 */
  147. /*                                                                           */
  148. /* Assumptions:                                                              */
  149. /*                                                                           */
  150. /*   none.                                                                   */
  151. /*                                                                           */
  152. /*****************************************************************************/
  153.     uint
  154. showA(AFILE *fp, uchar *msg )
  155. {
  156.  AFILE     *Newfp;
  157.  uint      CsrRow;
  158.  uint      CsrInstAddr;
  159.  uint      key;                         /* key returned from GetKey()        */
  160.  int       func;                        /* function associated with a key    */
  161.  
  162.  
  163.  Recalibrate(fp, 0);
  164.  fmtasm( fp );
  165.  
  166.  if( fp->flags & AF_ZOOM )                                              /*235*/
  167.  {                                                                      /*235*/
  168.   if( !IsOnAsmCRT( fp->hotaddr) )                                       /*235*/
  169.   {                                                                     /*235*/
  170.    fp->topoff = fp->hotaddr;                                            /*235*/
  171.   }                                                                     /*235*/
  172.   ascroll(fp, 0) ;                                                      /*235*/
  173.   if( fp->flags & ASM_VIEW_NEW )                                        /*301*/
  174.     SetBitOff(fp->flags, ASM_VIEW_NEW);                                 /*301*/
  175.  }                                                                      /*235*/
  176.                                                                         /*235*/
  177.  else if( fp->flags & ASM_VIEW_NEW )                                    /*235*/
  178.  {                                                                      /*235*/
  179.   ascroll(fp, 0) ;                                                      /*235*/
  180.   SetBitOff(fp->flags, ASM_VIEW_NEW);                                   /*235*/
  181.  }                                                                      /*235*/
  182.                                                                         /*235*/
  183.  else if( fp->flags & ASM_VIEW_TOGGLE )                                 /*235*/
  184.  {                                                                      /*235*/
  185.   ascroll(fp, 0) ;                                                      /*235*/
  186.   SetBitOff(fp->flags, ASM_VIEW_TOGGLE );                               /*235*/
  187.  }                                                                      /*235*/
  188.                                                                         /*235*/
  189.  else if( fp->flags & ASM_VIEW_CHANGE )                                 /*235*/
  190.  {                                                                      /*235*/
  191.   ascroll(fp, 0) ;                                                      /*235*/
  192.   SetBitOff(fp->flags, ASM_VIEW_CHANGE );                               /*235*/
  193.  }                                                                      /*235*/
  194.                                                                         /*235*/
  195.  else if( fp->flags & ASM_VIEW_NEXT   )                                 /*235*/
  196.  {                                                                      /*235*/
  197.   ascroll(fp, 0) ;                                                      /*235*/
  198.   SetBitOff(fp->flags, ASM_VIEW_NEXT   );                               /*235*/
  199.  }                                                                      /*235*/
  200.                                                                         /*235*/
  201.  /************************************************************************235*/
  202.  /* set the initial cursor position.                                      235*/
  203.  /************************************************************************235*/
  204.  if( fp->flags & AF_ZOOM  )                                             /*235*/
  205.  {
  206.   for( CsrRow=0; AddrCache[CsrRow] != fp->hotaddr; CsrRow++){;}         /*235*/
  207.   SetBitOff(fp->flags, AF_ZOOM   );                                     /*235*/
  208.  }
  209.  else                                                                   /*235*/
  210.  {                                                                      /*235*/
  211.   CsrRow = fp->csr.row - TopLine;                                       /*235*/
  212.   if( (int)CsrRow < 0 )
  213.    CsrRow = 0;
  214.   if( CsrRow >= RowsUsed )                                              /*235*/
  215.    CsrRow = RowsUsed - 1;                                               /*235*/
  216.  }                                                                      /*235*/
  217.                                                                         /*235*/
  218.  /************************************************************************235*/
  219.  /* clear the flags and display any messages.                             235*/
  220.  /************************************************************************235*/
  221.  fmterr( msg );                                                         /*235*/
  222.                                                                         /*235*/
  223.  /****************************************************************************/
  224.  /* now, handle the keystrokes.                                           235*/
  225.  /****************************************************************************/
  226.  for( ;; )
  227.  {
  228.    fp->csr.row = CsrRow + TopLine;                                      /*701*/
  229.    if( fp->csr.row > VideoRows )                                        /*701*/
  230.      fp->csr.row = TopLine;
  231.    PutCsr( ( CSR *)&fp->csr );                                          /*701*/
  232.    SetMenuMask( ASSEMBLYVIEW );                                         /*701*/
  233.    if( (fp == GetExecfp()) || (GetExecfp() == NULL) )                   /*701*/
  234.     DisableDropFile();
  235.    else
  236.     EnableDropFile();
  237.  
  238.   /***************************************************************************/
  239.   /* Get an event from the kbd/mouse.                                     701*/
  240.   /***************************************************************************/
  241.   if( (SerialParallel() == SERIAL) && (QueryConnectSema4() == SEMA4_RESET) )
  242.   {
  243.    fmterr("Disconnected...double click on window to reconnect.");
  244.    _beginthread(WaitForInterrupt, NULL, 0x8000, NULL );
  245. block:
  246.    SerialConnect( JUST_WAIT, DbgGetProcessID(), _DBG, SendMsgToDbgQue );
  247.    fmterr("Reconnected.");
  248.    DosSelectSession(0);
  249.   }
  250. #if 0
  251.   if(iview) {
  252.       func=BROWSEMSH;
  253.   }
  254.   else
  255. #endif
  256.   {
  257.      func = (BlowBy)?TOGGLESTORAGE:GetFuncsFromEvents(0 , (void *)fp );                           /*701*/
  258.   }
  259.  
  260.   if( (SerialParallel() == SERIAL) && (QueryConnectSema4() == SEMA4_RESET) )
  261.   {
  262.    ConnectThisPid( INFORM_ESP );
  263.    goto block;
  264.   }
  265.  
  266.   /***************************************************************************/
  267.   /* GetFuncsFromEvents will not always be able to return an executable   701*/
  268.   /* function code, so we get back a raw LEFTMOUSECLICK or RIGHTMOUSECLICK701*/
  269.   /* So, what we do is:                                                   701*/
  270.   /*                                                                      701*/
  271.   /*  -LEFTMOUSECLICK                                                     701*/
  272.   /*    - if the click is in the source window, then set the cursor       701*/
  273.   /*      position.                                                       701*/
  274.   /*    - if the click is in the data window, then switch to the data     701*/
  275.   /*      window.                                                         701*/
  276.   /*                                                                      701*/
  277.   /*  -RIGHTMOUSECLICK                                                    701*/
  278.   /*    - bring up the object pulldown for the source window.             701*/
  279.   /*                                                                      701*/
  280.   /***************************************************************************/
  281.  
  282.    if( func == LEFTMOUSECLICK )                                         /*701*/
  283.    {                                                                    /*701*/
  284.      if( GetEventView() == DATAVIEW )                                   /*701*/
  285.      {                                                                  /*701*/
  286.        SetDataViewCsr();                                                /*701*/
  287.        func = TOGGLESTORAGE;                                            /*701*/
  288.      }                                                                  /*701*/
  289.      else                                                               /*701*/
  290.        func = SETCURSORPOS;                                             /*701*/
  291.    }                                                                    /*701*/
  292.  
  293. ReCirculate:                                                            /*701*/
  294.   /***************************************************************************/
  295.   /* Process the function.                                                701*/
  296.   /***************************************************************************/
  297.   switch( func )                        /* switch on function selection      */
  298.   {                                                                     /*701*/
  299. /*****************************************************************************/
  300. /* move the cursor up one line.                                              */
  301. /*****************************************************************************/
  302.    case UPCURSOR:                       /*                                   */
  303.     if( CsrRow == 0 )                   /* move the cursor up one line.      */
  304.      ascroll(fp, -1);                   /* scroll down one line if trying    */
  305.     else                                /* to go above the screen.           */
  306.      CsrRow--;                          /*                                   */
  307.     break;                              /*                                   */
  308. /*****************************************************************************/
  309. /* move the curdor down one line.                                            */
  310. /*****************************************************************************/
  311.     case DOWNCURSOR:                    /*                                   */
  312.      if( ++CsrRow >= RowsUsed )         /* move the cursor down one line.    */
  313.      {                                  /* scroll up  one line if trying     */
  314.       CsrRow = RowsUsed-1;              /* to go below the screen.           */
  315.       if( RowsUsed == (uint)AsmRows )   /*                                   */
  316.       {                                 /*                                   */
  317.        ascroll(fp, 1);                  /*                                   */
  318.       }                                 /*                                   */
  319.      }                                  /*                                   */
  320.      break;                             /*                                   */
  321. /*****************************************************************************/
  322. /* scroll the window up one line. Anchor cursor to its current line.         */
  323. /***x*************************************************************************/
  324.     case LEFTCURSOR:                    /*                                   */
  325.      ascroll(fp,-1);                    /*                                   */
  326.      if( CsrRow < RowsUsed - 1 )        /*                                   */
  327.       CsrRow++;                         /*                                   */
  328.       break;                            /*                                   */
  329. /*****************************************************************************/
  330. /* scroll the window one line down. Anchor curor to its current line.        */
  331. /*****************************************************************************/
  332.     case RIGHTCURSOR:                   /*                                   */
  333.      ascroll(fp,1);                     /*                                   */
  334.      if( CsrRow > 0 )                   /*                                   */
  335.       CsrRow--;                         /*                                   */
  336.       break;                            /*                                   */
  337. /*****************************************************************************/
  338. /* the infamous page up.                                                     */
  339. /*****************************************************************************/
  340.     case PREVWINDOW:                    /*                                   */
  341.      ascroll(fp, 1 - AsmRows);          /*                                   */
  342.      break;                             /*                                   */
  343. /*****************************************************************************/
  344. /* page down.                                                                */
  345. /*****************************************************************************/
  346.     case NEXTWINDOW:                    /*                                   */
  347.      if( RowsUsed == (uint)AsmRows )    /*                                   */
  348.       ascroll(fp, AsmRows - 1);         /*                                   */
  349.      break;                             /*                                   */
  350. /*****************************************************************************/
  351. /*                                                                           */
  352. /*****************************************************************************/
  353. /*        case FIRSTWINDOW:               ???
  354.             fp->topoff = dp->loIP;        ???
  355. ???         ascroll(fp, 0);          */
  356. /*****************************************************************************/
  357. /* move the cursor to the top of the window.                                 */
  358. /*****************************************************************************/
  359.     case TOPOFWINDOW:                   /*                                   */
  360.      CsrRow = 0;                        /*                                   */
  361.      break;                             /*                                   */
  362.                                         /*                                   */
  363. /*****************************************************************************/
  364. /*                                                                           */
  365. /*****************************************************************************/
  366. /* ???    case LASTWINDOW:
  367.    ???      fp->topoff = dp->hiIP;
  368.    ???      ascroll(fp, 1 - AsmRows); */
  369. /*****************************************************************************/
  370. /* move the cursor to the bottom of the window.                              */
  371. /*****************************************************************************/
  372.     case BOTOFWINDOW:                   /*                                   */
  373.      CsrRow = RowsUsed-1;               /*                                   */
  374.      break;                             /*                                   */
  375. /*****************************************************************************/
  376. /* expand and shrink storage window.                                         */
  377. /*****************************************************************************/
  378.    case SHRINKSTORAGE:                  /* shrink the storage display area   */
  379.    case EXPANDSTORAGE:                  /* Expand the storage display area   */
  380.     if( HideDataWin == TRUE  )          /* if data window is hidden,         */
  381.     {                                   /* turn it on.                       */
  382.      Recalibrate(fp,-(int)SaveTopLine); /* resize the src/asm window.     521*/
  383.      CsrRow -= TopLine;                 /* adjust the cursor.                */
  384.      HideDataWin = FALSE;               /* TopLine gets reestablished in     */
  385.      break;                             /*                                   */
  386.     }                                   /* the recalibrate....puke!          */
  387.    switch( func )                       /*                                   */
  388.    {                                    /*                                   */
  389.     case SHRINKSTORAGE:                 /*                                   */
  390.      if( ShrinkStorage(fp,0) )          /*                                   */
  391.       beep();                           /* beep if not shrinkable            */
  392.      else                               /*                                   */
  393.       if( RowsUsed == (uint)AsmRows )   /*                                305*/
  394.        if(CsrRow < RowsUsed) CsrRow++;  /*                                   */
  395.      break;                             /*                                   */
  396.                                         /*                                   */
  397.     case EXPANDSTORAGE:                 /*                                   */
  398.      if( ExpandStorage(fp,0) )          /*                                   */
  399.       beep();                           /* beep if not expandable            */
  400.      else                               /*                                   */
  401.       if( RowsUsed == (uint)AsmRows )   /*                                305*/
  402.          if(CsrRow > 0) CsrRow--;       /*                                   */
  403.      break;                             /*                                   */
  404.    }                                    /*                                   */
  405.    break;                               /*                                   */
  406. /*****************************************************************************/
  407. /* single step. step over calls.                                             */
  408. /*****************************************************************************/
  409.     case SSTEP:
  410.     case SSTEPNOSWAP:
  411.  
  412.      if ( GetThreadState( GetExecTid() ) == TRC_C_ENDED )
  413.      {
  414.       beep();
  415.       fmterr( "No threads or thread not found. Can't step anything.");
  416.       break;
  417.      }
  418.  
  419.      if ( GetThreadState( GetExecTid() ) == TRC_C_BLOCKED )
  420.      {
  421.       beep();
  422.       fmterr( "Can't single step a blocked thread");
  423.       break;
  424.      }
  425.      if ( GetThdDbgState( GetExecTid() ) == TS_FROZEN )
  426.      {
  427.       beep();
  428.       fmterr( "Can't single step a frozen thread");
  429.       break;
  430.      }
  431.      if( fp == GetExecfp() )
  432.      {
  433.        if( func == SSTEP )
  434.          return( ASMSSTEP );
  435.        else
  436.          return( ASMSSTEPNOSWAP );
  437.      }
  438.      goto caseNOGO;
  439. /*****************************************************************************/
  440. /* single step. DO NOT step over calls.                                      */
  441. /*****************************************************************************/
  442.     case SSTEPINTOFUNC:
  443.     case SSTEPINTOFUNCNOSWAP:
  444.  
  445.      if ( GetThreadState( GetExecTid() ) == TRC_C_ENDED )
  446.      {
  447.       beep();
  448.       fmterr( "No threads or thread not found. Can't step anything.");
  449.       break;
  450.      }
  451.  
  452.      if ( GetThreadState( GetExecTid() ) == TRC_C_BLOCKED )
  453.      {
  454.       beep();
  455.       fmterr( "Can't single step a blocked thread");
  456.       break;
  457.      }
  458.      if ( GetThdDbgState( GetExecTid() ) == TS_FROZEN )
  459.      {
  460.       beep();
  461.       fmterr( "Can't single step a frozen thread");
  462.       break;
  463.      }
  464.      if( fp == GetExecfp() )
  465.      {
  466.        if( func == SSTEPINTOFUNC )
  467.          return( ASMSSTEPINTOFUNC );
  468.        else
  469.          return( ASMSSTEPINTOFUNCNOSWAP );
  470.      }
  471.      return( ASMSSTEPINTOFUNC );
  472. /*****************************************************************************/
  473. /* Let 'er rip.                                                              */
  474. /*****************************************************************************/
  475.     case RUNNOSWAP:                     /* turn off screen swapping & go  511*/
  476.     case RUN:                           /*                                   */
  477.     caseRUN:                            /*                                   */
  478.      if( GetExecfp() )                  /*                                   */
  479.       return( func );                   /*                                   */
  480.     caseNOGO:                           /*                                   */
  481.      if( !GetExecfp() )                 /* if the afile is not valid, then   */
  482.       fmt2err( "Can't continue:", msg );/* we cannot continue.               */
  483.      goto complain;                     /* go cry about it.                  */
  484.                                         /*                                   */
  485. /*****************************************************************************/
  486. /* Let 'er rip to the current cursor location.                               */
  487. /*                                                                           */
  488. /* If there is a breakpoint on the current cursor instruction address,       */
  489. /* CsrInstAddr, then just run to it. Otherwise, try to set a breakpoint      */
  490. /* on this address and run to it. Complain if a break cannot be set.         */
  491. /*                                                                           */
  492. /*****************************************************************************/
  493.     case RUNTOCURSOR:                             /*                         */
  494.     case RUNTOCURSORNOSWAP:                       /*                      827*/
  495.      CsrInstAddr = AddrCache[CsrRow];             /*                      235*/
  496.      if( IfBrkOnAddr(CsrInstAddr) )               /*                         */
  497.       goto caseRUN;                               /*                         */
  498.      if( CsrInstAddr == NULL )
  499.       goto complain;
  500.      SetAddrBRK(fp, CsrInstAddr, BRK_ONCE);
  501.      goto caseRUN;
  502.  
  503. /*****************************************************************************/
  504. /*                                                                           */
  505. /*****************************************************************************/
  506.      case GENHELP:                        /* General help                      */
  507.      {
  508.       uchar *HelpMsg;
  509.  
  510.       HelpMsg = GetHelpMsg( HELP_WIN_ASM, NULL,0);
  511.       CuaShowHelpBox( HelpMsg );
  512.       break;
  513.      }
  514.  
  515.      case FUNCKEYSHELP:                                                 /*808*/
  516.        HelpScreen( );              /* enter our help function ( ESC key */
  517.                                    /*   to return here )                */
  518.         break;                     /* for now, no context sensitive help*/
  519. /*****************************************************************************/
  520. /* Show the DLL names for EXE file.                                          */
  521. /*****************************************************************************/
  522.     case SHOWDLLS:                      /* show DLL names                    */
  523.      ShowDlls();                        /*                                   */
  524.      break;                             /*                                   */
  525. /*****************************************************************************/
  526. /* Find the executing addr and bring it onto the display.  What this guy does*/
  527. /* is locate the executing line in the current afile if the cursor is not on */
  528. /* the executing line.  If the cursor is on the executing line, then we start*/
  529. /* back around the ring of stack frames showing the executing line in each   */
  530. /* afile.                                                                    */
  531. /*                                                                           */
  532. /*****************************************************************************/
  533.     case FINDEXECLINE:                  /*                                   */
  534.      if( GetExecfp() )                  /*                                   */
  535.      {                                  /*                                   */
  536.       CsrInstAddr = AddrCache[CsrRow];  /*                                235*/
  537.       fp_focus = FindExecAddr(fp, (uint)CsrInstAddr);/*                      */
  538.       if( fp_focus )                    /*                                   */
  539.       {
  540.        fp_focus->flags  = AF_ZOOM;      /*                                235*/
  541.        return(-1);                      /*                                   */
  542.       }
  543.      }                                  /*                                   */
  544.      goto complain;                     /*                                   */
  545. /*****************************************************************************/
  546. /* bring up the thread menu.                                                 */
  547. /*****************************************************************************/
  548.     case SHOWTHREADS:                   /* show process threads              */
  549.     {                                   /*                                   */
  550.      uint  tid;                         /*                                   */
  551.      tid  = GetExecTid();               /*                                   */
  552.      showthds(&key);                    /*                                229*/
  553.      if ( tid  != GetExecTid()  )       /*                                   */
  554.       return( GOTID );                  /*                                   */
  555.      break;                             /*                                   */
  556.     }                                   /*                                   */
  557.  
  558. /*****************************************************************************/
  559. /* bring up the process menu.                                                */
  560. /*****************************************************************************/
  561.    case SHOWPROCESSES:
  562.     Cua_showproc();
  563.     break;
  564.  
  565. /*****************************************************************************/
  566. /* Hide the data window, but save the state for later return.                */
  567. /*                                                                           */
  568. /*****************************************************************************/
  569.    case SHOWHIDESTORAGE:                /*                                   */
  570.     if( HideDataWin == TRUE  )          /* if data window is hidden,         */
  571.     {                                   /* turn it on.                       */
  572.      Recalibrate(fp,-(int)SaveTopLine); /* resize the src/asm window.     521*/
  573.      CsrRow -= (TopLine - VioStartOffSet);
  574.                                         /* adjust the cursor.                */
  575.      HideDataWin = FALSE;               /* TopLine gets reestablished in     */
  576.     }                                   /* the recalibrate....puke!          */
  577.     else                                /* else if the window is not         */
  578.     {                                   /* hidden, then turn it off.         */
  579.      SaveTopLine = TopLine - VioStartOffSet;
  580.                                         /* hold top line for restore.        */
  581.      CsrRow += (TopLine - VioStartOffSet);
  582.                                         /* adjust the cursor.                */
  583.      Recalibrate(fp,TopLine - VioStartOffSet);
  584.                                         /* resize and refresh the window.    */
  585. /*
  586.      SaveTopLine = TopLine;
  587.      CsrRow += TopLine;
  588.      Recalibrate(fp,TopLine);
  589. */
  590.                                         /* will set TopLine = 0              */
  591.      HideDataWin = TRUE;                /* set hidden mode flag.             */
  592.     }                                   /*                                   */
  593.     break;                              /*                                   */
  594. /*****************************************************************************/
  595. /* Toggle to and from the storage window.                                    */
  596. /*****************************************************************************/
  597.     case TOGGLEHIDESTORAGE:
  598.     case TOGGLESTORAGE:
  599.      Newfp = NULL;
  600.      func = typoS((SIZEFUNC)Recalibrate, fp, &Newfp);
  601.      if( Newfp )
  602.      {
  603.       fp_focus = Newfp;
  604.       return(-1);
  605.      }
  606.      if( func != 0 )                                                    /*701*/
  607.       goto ReCirculate;                                                 /*701*/
  608.      goto Refresh_Screen;                                               /*701*/
  609.  
  610. /*************************************************************************235*/
  611. /* toggle between source view and disassembly view.                       235*/
  612. /*                                                                        235*/
  613. /*************************************************************************235*/
  614.     case TOGGLEASM:                                                     /*235*/
  615.                                                                         /*235*/
  616.      if( fp->source == NULL )                                           /*235*/
  617.      {                                                                  /*235*/
  618.       beep();                                                           /*235*/
  619.       break;                                                            /*235*/
  620.      }                                                                  /*235*/
  621.                                                                         /*235*/
  622.      /********************************************************************235*/
  623.      /* - come here if there is source for this file.                     235*/
  624.      /* - SyncAddr allows the source view to be synchronized with the asm.235*/
  625.      /********************************************************************235*/
  626.      switch( fp->sview )                                                /*235*/
  627.      {                                                                  /*235*/
  628.       case MIXEDN:                                                      /*402*/
  629.                                                                         /*402*/
  630.        if( (AddrCache[CsrRow] != 0)                                     /*531*/
  631.             && (CsrRow != 0) )                                          /*531*/
  632.         for(; (int)CsrRow >= 0 && AddrCache[CsrRow] != 0 ; CsrRow--){;} /*531*/
  633.                                                                         /*402*/
  634.        fp->topline  = SourceLineCache[CsrRow] - CsrRow - fp->Nbias;     /*402*/
  635.        fp->csrline  = SourceLineCache[CsrRow] - fp->Nbias;              /*402*/
  636.        if( (int)fp->topline < 1 )                                       /*402*/
  637.         fp->topline = 1;                                                /*402*/
  638.        break;                                                           /*402*/
  639.                                                                         /*402*/
  640.       case NOSRC:                                                       /*402*/
  641.                                                                         /*235*/
  642.        fp->flags |= AF_SYNC;
  643.        SyncAddr = AddrCache[CsrRow];                                    /*235*/
  644.        break;                                                           /*235*/
  645.      }                                                                  /*235*/
  646.  
  647.      (fp_focus = fp)->shower = showC;                                   /*235*/
  648.      return(-1);                                                        /*235*/
  649.  
  650.     /*************************************************************************/
  651.     /* If Displaying the register window                                  400*/
  652.     /*  - Set the REPAINT bit.                                            400*/
  653.     /* Toggle the REGS386BIT bit.                                         400*/
  654.     /* If the coprocessor register window is already on                   400*/
  655.     /*  - reset the screen bounds                                         400*/
  656.     /*  - refresh the data window.                                        400*/
  657.     /*  - reset the REGS387BIT bit.                                       400*/
  658.     /* If the user is turning off the register display                    400*/
  659.     /*  - reset the screen bounds                                         400*/
  660.     /*  - refresh the data window.                                        400*/
  661.     /* Format the screen                                                  400*/
  662.     /*************************************************************************/
  663.     case REGISTERDISPLAY:                                               /*400*/
  664.      if (!TestBit(Reg_Display,REGS386BIT))                              /*400*/
  665.         SetBit(Reg_Display,REPAINT);                                    /*400*/
  666.      if (TestBit(Reg_Display,REGS387BIT) && !iview)                     /*401*/
  667.      {                                                                  /*401*/
  668.         memset(BoundPtr,VideoCols,VideoRows);                           /*518*/
  669.         ResetBit(Reg_Display,REGS387BIT);                               /*401*/
  670.         ShowData(TopLine);                                              /*400*/
  671.      }                                                                  /*401*/
  672.      Reg_Display ^= 0x2;                                                /*400*/
  673.      if (!TestBit(Reg_Display,REGS386BIT))                              /*400*/
  674.      {                                                                  /*400*/
  675.         memset(BoundPtr,VideoCols,VideoRows);                           /*518*/
  676.         ShowData(TopLine);                                              /*400*/
  677. #if 0
  678.         RemoveCollisionArea();                                          /*701*/
  679. #endif
  680.      }                                                                  /*400*/
  681.      goto Refresh_Screen;                                               /*400*/
  682.  
  683.     /*************************************************************************/
  684.     /* If Displaying the co processor registers                           401*/
  685.     /*  - Set the REPAINT bit.                                            401*/
  686.     /* Toggle the REGS387BIT bit.                                         401*/
  687.     /* If the register window is already on                               401*/
  688.     /*  - reset the screen bounds                                         401*/
  689.     /*  - reset the REGS386BIT bit.                                       401*/
  690.     /* If the user is turning off the coproessor register display         401*/
  691.     /*  - reset the screen bounds                                         401*/
  692.     /*  - refresh the data window.                                        401*/
  693.     /* Format the screen                                                  401*/
  694.     /*************************************************************************/
  695.     case COREGISTERDISPLAY:                                             /*401*/
  696.      if (!TestBit(Reg_Display,REGS387BIT))                              /*401*/
  697.         SetBit(Reg_Display,REPAINT);                                    /*401*/
  698.      if (TestBit(Reg_Display,REGS386BIT) && !iview)                     /*401*/
  699.      {                                                                  /*401*/
  700.         ResetBit(Reg_Display,REGS386BIT);                               /*401*/
  701.         memset(BoundPtr,VideoCols,VideoRows);                           /*518*/
  702.      }                                                                  /*401*/
  703.      Reg_Display ^= 0x4;                                                /*401*/
  704.      if (!TestBit(Reg_Display,REGS387BIT))                              /*401*/
  705.      {                                                                  /*401*/
  706.         memset(BoundPtr,VideoCols,VideoRows);                           /*518*/
  707.         ShowData(TopLine);                                              /*401*/
  708. #if 0
  709.         RemoveCollisionArea();                                          /*701*/
  710. #endif
  711.      }                                                                  /*401*/
  712.      goto Refresh_Screen;                                               /*401*/
  713.  
  714.     /*************************************************************************/
  715.     /* Edit the 30386 registers.                                             */
  716.     /* If the coprocessor register window is already on                      */
  717.     /*  - reset the screen bounds                                            */
  718.     /*  - reset the REGS387BIT bit.                                          */
  719.     /*  - refresh the data window.                                           */
  720.     /* If Register window is not present bring it up.                        */
  721.     /* Process the editing of registers.                                     */
  722.     /* If the register window was not up when we came here turn it off.      */
  723.     /* Format the screen                                                     */
  724.     /*************************************************************************/
  725.     case EDITREGISTERS:
  726.       if (TestBit(Reg_Display,REGS387BIT))
  727.       {
  728.         GetScrAccess();
  729.         ResetBit(Reg_Display,REGS387BIT);
  730.         ShowData(TopLine);
  731.       }
  732.       if (!TestBit(Reg_Display,REGS386BIT))
  733.       {
  734.         SetBit(Reg_Display,REPAINT);
  735.         ShowvRegs();
  736.       }
  737.       Newfp = KeyvRegs(&key);
  738.       if (!TestBit(Reg_Display,REGS386BIT))
  739.       {
  740.         memset(BoundPtr+VioStartOffSet,VideoCols,VideoRows-VioStartOffSet);
  741.         ShowData(TopLine);
  742.         fp->flags |= ASM_VIEW_REFRESH;
  743.         ascroll( fp, 0 );
  744.       }
  745. #if 0
  746.       RemoveCollisionArea();                                            /*701*/
  747. #endif
  748.       if (Newfp)
  749.       {
  750.         fp_focus = Newfp;
  751.         return(-1);
  752.       }
  753.       break;
  754.  
  755.    /**************************************************************************/
  756.    /* Set Execution Line Function.                                        508*/
  757.    /*                                                                     508*/
  758.    /*  - Check if the Line is executable, if not put error message.       508*/
  759.    /*  - If the current address is a valid address, call function to      508*/
  760.    /*    change the CS:IP and then refresh the screen.                    508*/
  761.    /*                                                                     508*/
  762.    /**************************************************************************/
  763.    case SETEXECLINE:                                                    /*508*/
  764.    {                                                                    /*508*/
  765.     CsrInstAddr = AddrCache[CsrRow];                                    /*508*/
  766.     if( CsrInstAddr != NULL )                                           /*508*/
  767.     {                                                                   /*508*/
  768.       if (SetExecLine(CsrInstAddr) == TRUE)                             /*508*/
  769.          goto Refresh_Screen;                                           /*508*/
  770.     }                                                                   /*508*/
  771.     beep();                                                             /*508*/
  772.     fmterr( "Can't set ip at this line" );                              /*508*/
  773.    }                                                                    /*508*/
  774.    break;                                                               /*508*/
  775.  
  776. /*****************************************************************************/
  777. /* set global flag for MASM-AL86 mnemonics.                                  */
  778. /*****************************************************************************/
  779.     case TOGGLEDIS:                     /* user wants to toggle disassembly? */
  780.      AL86orMASM ^= 1;                   /* toggle the AL/86 or MASM flag     */
  781.      MneChange = 1;                     /* toggle the AL/86 or MASM flag     */
  782.      fp->flags |= ASM_VIEW_MNE;         /* change mnemonic view.          235*/
  783.      ascroll( fp, 0 );                  /* show the new disassembly mode     */
  784.      SetBitOff(fp->flags, ASM_VIEW_MNE);                                /*235*/
  785.      break;                             /* end user wants to toggle disasm   */
  786. /*****************************************************************************/
  787. /* show the users call stack and execute options.                            */
  788. /*****************************************************************************/
  789.     case SHOWCALLSTACK:                 /*                                   */
  790.      switch( ActiveProcsMenu(&fp_focus))/*                                   */
  791.       { case A_ENTER:                   /* run to the return csip of the     */
  792.         case C_ENTER:                   /* selected function.                */
  793.           func = RUN;                   /*                                701*/
  794.           goto caseRUN;                 /*                                   */
  795.         case ENTER:                     /* switch to context of the selected */
  796.           return(-1);                   /* function.                         */
  797.       }                                 /*                                   */
  798.       break;                            /*                                   */
  799. /*****************************************************************************/
  800. /* show the user's application.                                              */
  801. /*****************************************************************************/
  802.    case TIMEDSHOWAPPWINDOW:
  803.     if( IsEspRemote() )
  804.      xSelectSession();
  805.     else
  806.      DosSelectSession(DbgGetSessionID());
  807.     DosSleep(5000L);
  808.     DosSelectSession( 0 );
  809.     break;
  810. /*****************************************************************************/
  811. /* set/reset conditional breakpoint. not available at asm level yet.( Never?)*/
  812. /*****************************************************************************/
  813.     case SETCLEARCONDBKPT:
  814.       beep();
  815.       fmterr( "Function not available" );
  816.       break;
  817. /*****************************************************************************/
  818. /*                                                                           */
  819. /*****************************************************************************/
  820.     case SETCLEARBKPT:                  /* set/reset breakpoint              */
  821.     {
  822.      CsrInstAddr = AddrCache[CsrRow];
  823.      if( CsrInstAddr == NULL )
  824.       goto complain;
  825.      SetAddrBRK(fp, CsrInstAddr, BRK_SIMP);
  826.      fp->flags |= ASM_VIEW_REFRESH;
  827.      ascroll(fp,0);
  828.      SetBitOff(fp->flags, ASM_VIEW_REFRESH );
  829.      break;
  830.     }
  831.  
  832.    case SAVEBKPTS:
  833.        SaveBreakpoints();
  834.        break;
  835.  
  836.    case RESTOREBKPTS:
  837.        ResetBreakpointFileTime();
  838.        RestoreBreakpoints();
  839.        break;
  840.  
  841.    case EDITBKPTS:
  842.        EditBreakpoints();
  843.        break;
  844.                                                                         /*701*/
  845. /*****************************************************************************/
  846. /* process  menu options.                                                    */
  847. /*****************************************************************************/
  848. #if 0
  849.     case ACTIONBAR:                     /*                                   */
  850.                                         /*  if changing context, then return */
  851.      if( fp_focus = AsmActionBar(fp, func) )                            /*235*/
  852.      {                                                                  /*235*/
  853.       if( fp_focus->shower == showA && fp_focus->flags == 0 )           /*235*/
  854.       {                                                                 /*235*/
  855.        fp_focus->flags = ASM_VIEW_CHANGE;                               /*235*/
  856.        fp_focus->csr.row = fp_focus->csrline - 1;                       /*235*/
  857.        if(fp_focus->sview == NOSRC )                                    /*235*/
  858.         fp_focus->csr.row = 0;                                          /*235*/
  859.       }                                                                 /*235*/
  860.       return(-1);                                                       /*235*/
  861.      }                                                                  /*235*/
  862.      goto Refresh_Screen;
  863.      {
  864.       if( fp_focus->flags == 0 )        /*                                235*/
  865.        fp_focus->flags  = AF_SYNC;      /*                                235*/
  866.       return(-1);                       /*  to Run() with the new fp.        */
  867.      }
  868.     fmtasm( fp );                       /*                                235*/
  869.     fmterr( msg );                      /*                                235*/
  870.     fp->flags |= ASM_VIEW_REFRESH;      /*                                235*/
  871.     ascroll(fp,0);                      /*                                235*/
  872.     SetBitOff(fp->flags, ASM_VIEW_REFRESH );  /*                          235*/
  873.     break;                              /*                                235*/
  874. #endif
  875.                                         /*                                   */
  876. /*****************************************************************************/
  877. /* browse any file.                                                          */
  878. /*****************************************************************************/
  879.    case BROWSE:                         /* browse any file.                  */
  880.     BrowseFile();                                                       /*701*/
  881.     goto Refresh_Screen;
  882.                                                                         /*701*/
  883.  
  884. /*****************************************************************************/
  885. /* browse any MSH LOG FILE                                                   */
  886. /*****************************************************************************/
  887. #ifdef MSH
  888.    case BROWSEMSH:
  889.     {
  890.     WINDOWEVENT *we;
  891.     iview=1;
  892.     we=BrowseMshFile(fp);
  893.     iview=0;
  894.     if(we->func) {
  895.         iview=we->iview;
  896.         func=we->func;
  897. //      SrcCol = fp->skipcols + fp->csr.col;  /* set  column position              */
  898. //      SrcLine = fp->csrline + fp->Nbias;    /* removed a +1.                  234*/
  899. //      lp = fp->source +                     /* ->to top of source buffer +       */
  900. //           fp->offtab[ fp->csrline ];       /* offset of cursorline              */
  901.         CsrRow=fp->csr.row-we->Window->row;
  902.         goto ReCirculate;
  903.     }
  904.     goto Refresh_Screen;
  905.     }
  906. #endif
  907. /*****************************************************************************/
  908. /* go to next file in the afile ring.                                        */
  909. /*****************************************************************************/
  910.    case NEXTFILE:                       /* switch to th next file in ring    */
  911.     if( !(fp_focus = fp->next) )        /* is there a next one in the ring   */
  912.      if( (fp_focus = allfps) == fp )    /* is there only one file?           */
  913.      {                                  /*                                   */
  914.       beep();                           /* yes only one file                 */
  915.       break;                            /*                                   */
  916.      }                                  /*                                   */
  917.     if(fp_focus->shower == showA )                                      /*235*/
  918.      fp_focus->flags = ASM_VIEW_NEXT;                                   /*235*/
  919.     return(-1);                         /* return to run with recalled afi   */
  920. #if 0
  921. /*****************************************************************************/
  922. /* toggle disasm line views.                                                 */
  923. /*****************************************************************************/
  924.    case TOGGLEASMLINE:                  /*                                   */
  925.    {                                    /*                                   */
  926.                                         /*                                   */
  927.     fp->lview=(uchar)                   /* change to next asm line view.     */
  928.               ( (fp->lview==ASMLINEVIEWS) /* change to next asm line view.   */
  929.                ?1:++fp->lview  );       /*                                   */
  930.     fmtasm( fp );                       /* reformat the screen.              */
  931.     fmterr( msg );                      /* add error message if necessary.   */
  932.     ascroll( fp, 0 );                   /* refresh the screen.               */
  933.     break;                              /*                                   */
  934.    }                                    /*                                   */
  935. #endif
  936. /*************************************************************************235*/
  937. /* toggle source/asm views.                                               235*/
  938. /*************************************************************************235*/
  939.    case TOGGLEASMVIEW:                                                  /*235*/
  940.    {                                                                    /*235*/
  941.     if( fp->topoff == 0 )                                               /*817*/
  942.       fp->topoff = GetExecAddr();                                       /*817*/
  943.     if( fp->source == NULL )                                            /*235*/
  944.      beep();                                                            /*235*/
  945.     else                                                                /*235*/
  946.     {                                                                   /*235*/
  947.      fp->flags |= ASM_VIEW_TOGGLE;                                      /*235*/
  948.      if( fp->sview == NOSRC )                                           /*235*/
  949.      {                                                                  /*235*/
  950.       {
  951.        LNOTAB *pLnoTabEntry;
  952.  
  953.        DBMapInstAddr(AddrCache[CsrRow], &pLnoTabEntry, fp->pdf);
  954.        if( pLnoTabEntry )
  955.         fp->csrline = pLnoTabEntry->lno;
  956.       }
  957.       fp->topline = fp->csrline - CsrRow;                               /*235*/
  958.       if( (int)fp->topline < 0 )                                        /*235*/
  959.        fp->topline = 0;                                                 /*235*/
  960.       fp->sview = MIXEDN;                                               /*235*/
  961.      }                                                                  /*235*/
  962.      else /* (fp->sview == MIXEDN ) */                                  /*235*/
  963.       fp->sview = NOSRC;                                                /*235*/
  964.                                                                         /*235*/
  965.      return(-1);                                                        /*235*/
  966.     }                                                                   /*235*/
  967.                                                                         /*235*/
  968.                                                                         /*235*/
  969.                                                                         /*235*/
  970. #if 0
  971.     fmtasm( fp );                       /* reformat the screen.              */
  972.     fmterr( msg );                      /* add error.                        */
  973.  
  974.     fp->flags |= AF_SYNC;               /*                                235*/
  975.     ascroll(fp,0);                      /*                                235*/
  976.     SetBitOff(fp->flags, AF_SYNC );     /*                                235*/
  977.     if( CsrRow >= RowsUsed )            /*                                235*/
  978.      CsrRow = RowsUsed - 1;             /*                                235*/
  979. #endif
  980.     break;                              /*                                   */
  981.    }                                    /*                                   */
  982.  
  983. /*****************************************************************************/
  984. /* clear all break points                                                    */
  985. /*                                                                           */
  986. /*****************************************************************************/
  987.    case CLEARALLBKPTS:                  /* Clear all program breaks.      106*/
  988.    {
  989.     FreeAllBrks();                      /*                                106*/
  990.     fp->flags |= ASM_VIEW_REFRESH;      /*                                235*/
  991.     ascroll(fp,0);                      /*                                235*/
  992.     SetBitOff(fp->flags, ASM_VIEW_REFRESH );  /*                          235*/
  993.     break;                              /*                                235*/
  994.    }
  995.  
  996.    /**************************************************************************/
  997.    /* Set user colors.                                                       */
  998.    /**************************************************************************/
  999.    case SETCOLORS:                      /* set user colors.                  */
  1000.    {                                    /*                                   */
  1001.     SetColors();                        /*                                   */
  1002.     DisplayMenu();                      /* Redisplay the menu bar.           */
  1003.     if((TestBit(Reg_Display,REGS386BIT))/* If either 386 registers or 387 400*/
  1004.     ||(TestBit(Reg_Display,REGS387BIT)))/* registers window is on         401*/
  1005.         SetBit(Reg_Display,REPAINT);    /* set the reg win paint bit.     400*/
  1006.     goto Refresh_Screen;                /* update color changes              */
  1007.    }                                    /*                                   */
  1008.  
  1009.    /**************************************************************************/
  1010.    /* Set user exceptions notifications                                   308*/
  1011.    /**************************************************************************/
  1012.    case SETEXCEPTIONS:
  1013.      SetExceptions();
  1014.      break;
  1015.  
  1016.    /**************************************************************************/
  1017.    /* Set watch points                                                    602*/
  1018.    /**************************************************************************/
  1019.    case SETWATCHPOINTS:
  1020.      SetWps(fp);
  1021.      break;
  1022.  
  1023.    case SETCURSORPOS:                                                   /*701*/
  1024.  
  1025.      SetAsmViewCsr( fp, &CsrRow );                                      /*701*/
  1026.      break;                                                             /*701*/
  1027.  
  1028.    case DROPFILE:                                                       /*701*/
  1029.     {                                                                   /*701*/
  1030.      AFILE *fpnext;                                                     /*701*/
  1031.                                                                         /*701*/
  1032.      fpnext = fp->next;                                                 /*701*/
  1033.      if ( fpnext == NULL )                                              /*701*/
  1034.      fpnext = allfps;                                                   /*701*/
  1035.      freefp( fp );                                                      /*701*/
  1036.      fp = fpnext;                                                       /*701*/
  1037.      if( fp->shower == showA && fp->flags == 0 )                        /*701*/
  1038.      {                                                                  /*701*/
  1039.       fp->flags = ASM_VIEW_CHANGE;                                      /*701*/
  1040.       fp->csr.row = fp->csrline - 1;                                    /*701*/
  1041.       if(fp->sview == NOSRC )                                           /*701*/
  1042.        fp->csr.row = 0;                                                 /*701*/
  1043.      }                                                                  /*701*/
  1044.      fp_focus = fp;
  1045.      return(-1);                                                        /*701*/
  1046.     }                                                                   /*701*/
  1047.                                                                         /*701*/
  1048.    case RESTART:
  1049.      Restart();
  1050.      break;
  1051.  
  1052.    case QUIT:
  1053.      NormalQuit(TRUE);
  1054.      break;
  1055.  
  1056.    case SETFUNCTIONBKPT:
  1057.    case SETADDRESSBKPT:
  1058.    case SETDEFERREDBKPT:
  1059.    case SETADDRLOADBKPT:
  1060.    case SETDLLLOADBKPT:
  1061.     SetNameOrAddrBkpt( fp,func);                                        /*701*/
  1062.     goto Refresh_Screen;                                                /*701*/
  1063.  
  1064.    case GETFUNCTION:                                                    /*701*/
  1065.    case GETFILE:                                                        /*701*/
  1066.    case GETADDRESS:                                                     /*701*/
  1067.     {
  1068.      char  InitString[81];                                              /*701*/
  1069.      if( func == GETFUNCTION || func == GETADDRESS )                    /*701*/
  1070.      {                                                                  /*701*/
  1071.       /*******************************************************************701*/
  1072.       /* Cursor sensitive prompting is not turned on in the assembler     701*/
  1073.       /* view. If it's GETADDRESS, then help the use out by throwing in a 701*/
  1074.       /* 0x for him.                                                      701*/
  1075.       /*******************************************************************701*/
  1076.       InitString[0] = '\0';                                             /*701*/
  1077.       if( func == GETADDRESS )                                          /*701*/
  1078.        strcpy( InitString,"0x");                                        /*701*/
  1079.       fp_focus = GetFunction( InitString, func );                       /*701*/
  1080.      }                                                                  /*701*/
  1081.      else                                                               /*701*/
  1082.       fp_focus = GetF( );                                               /*701*/
  1083.                                                                         /*701*/
  1084.      if( fp_focus )                                                     /*701*/
  1085.      {                                                                  /*701*/
  1086.       if( fp_focus->shower == showA && fp_focus->flags == 0 )           /*701*/
  1087.       {                                                                 /*701*/
  1088.        fp_focus->flags = ASM_VIEW_CHANGE;                               /*701*/
  1089.        fp_focus->csr.row = fp_focus->csrline - 1;                       /*701*/
  1090.        if(fp_focus->sview == NOSRC )                                    /*701*/
  1091.         fp_focus->csr.row = 0;                                          /*701*/
  1092.       }                                                                 /*701*/
  1093.       return(-1);                                                       /*701*/
  1094.      }                                                                  /*701*/
  1095.     }
  1096.     goto Refresh_Screen;                                                /*701*/
  1097.  
  1098.    case ESCAPE:                                                         /*701*/
  1099.      goto Refresh_Screen;                                               /*701*/
  1100.  
  1101.    case DONOTHING:
  1102.      continue;
  1103.  
  1104.    default:
  1105.    complain:
  1106.     beep();
  1107.   }
  1108.   continue;
  1109.  
  1110.     Refresh_Screen:
  1111.         fp->flags |= ASM_VIEW_REFRESH;
  1112.         fmtasm( fp );
  1113.         fmterr( msg );
  1114.         /*********************************************************************/
  1115.         /* This will fake showa into thinking that there has been a change   */
  1116.         /* in mnemonics so that the disassembly will be unconditionally      */
  1117.         /* updated. We do this because code may have been patched and we     */
  1118.         /* want to force a refresh of the disassembly.                       */
  1119.         /*********************************************************************/
  1120.         MneChange = 1;                  /* force unconditional refresh       */
  1121.         ascroll( fp, 0 );               /* of the assembler window           */
  1122.         SetBitOff(fp->flags, ASM_VIEW_REFRESH );
  1123.  }
  1124. }
  1125.  
  1126. /*****************************************************************************/
  1127. /* Recalibrate()                                                             */
  1128. /*                                                                           */
  1129. /* Description:                                                              */
  1130. /*   Dereference a pointer.                                                  */
  1131. /*                                                                           */
  1132. /* Parameters:                                                               */
  1133. /*                                                                           */
  1134. /*   fp        input - afile for this asm window.                            */
  1135. /*   adjust    input - how much to adjust this window.                       */
  1136. /*                                                                           */
  1137. /* Return:                                                                   */
  1138. /*                                                                           */
  1139. /* Assumptions:                                                              */
  1140. /*                                                                           */
  1141. /*   none.                                                                   */
  1142. /*                                                                           */
  1143. /*****************************************************************************/
  1144. extern uint         MaxPer;             /* max # of lines for source code    */
  1145. int
  1146. Recalibrate(AFILE *fp, int  adjust )
  1147. {
  1148.  int n = adjust;                        /* was register.                  112*/
  1149.  int delta;                             /*                                235*/
  1150.  
  1151.  if( TopLine == VioStartOffSet &&       /* if the TopLine is maxed out and701*/
  1152.      adjust > 0                         /* caller wants it bigger, then      */
  1153.    )                                    /*                                   */
  1154.   return(0);                            /* don't do it.                      */
  1155. /*****************************************************************************/
  1156. /* We want to adjust the size of the asm window by n lines. It must remain   */
  1157. /* within its boundaries, else we don't adjust it. We also adjust the top    */
  1158. /* line of the source display.                                               */
  1159. /*****************************************************************************/
  1160. #if 0
  1161.  LinesPer += n;                         /* make adjustment and               */
  1162. #endif
  1163.  TopLine -= n;                          /* adjust the top line of the display*/
  1164.  if( TopLine > MaxData )                /* Limit to max data window size.    */
  1165.   TopLine = MaxData;                    /*                                   */
  1166.                                         /*                                   */
  1167.  LinesPer = MaxPer - TopLine;
  1168.  if( (int)(LinesPer) < (int)MinPer ||   /* check for in bounds.              */
  1169.      (int)LinesPer > (int)MaxPer )      /*                                   */
  1170.  {                                      /*                                   */
  1171.   LinesPer -= n;                        /* if not in bounds, then back out   */
  1172.   return(1);                            /* the adjustment and return error.  */
  1173.  }                                      /*                                   */
  1174. /*****************************************************************************/
  1175. /* now, size the lines available for disasm display lines and the register   */
  1176. /* variables.                                                                */
  1177. /*                                                                           */
  1178. /*****************************************************************************/
  1179.  AsmRows = LinesPer;                    /* rows available for assembly lines.*/
  1180.  AsmTop = TopLine;                      /* the top of the asm display.       */
  1181.  if( adjust )                           /*                                   */
  1182.  {                                      /*                                   */
  1183.   delta = -adjust;
  1184.   /***************************************************************************/
  1185.   /* We don't want to page down if there are no lines below the current      */
  1186.   /* display.                                                                */
  1187.   /***************************************************************************/
  1188.   if( delta > 0 && RowsUsed < AsmRows )
  1189.   {
  1190.    fp->flags |= ASM_VIEW_NEXT;                                          /*305*/
  1191.    ascroll( fp, 0 );                    /*                                235*/
  1192.    fmtasm( fp );                        /* display the window.               */
  1193.   }
  1194.   else
  1195.   /***************************************************************************/
  1196.   /* else, make the adjustment up or down as required.                       */
  1197.   /***************************************************************************/
  1198.   {
  1199.    ascroll( fp, delta   );
  1200.    fmtasm( fp );                        /* display the window.               */
  1201.   }
  1202.  }
  1203.  return(0);                             /* keep the compiler happy.          */
  1204. }
  1205.  
  1206. /*****************************************************************************/
  1207. /* SetAsmViewCsr()                                                        701*/
  1208. /*                                                                        701*/
  1209. /* Description:                                                           701*/
  1210. /*   Set the cursor position in the source window when a mouse event      701*/
  1211. /*   occurs.                                                              701*/
  1212. /*                                                                        701*/
  1213. /* Parameters:                                                            701*/
  1214. /*                                                                        701*/
  1215. /*   fp           -> to the afile structure that will be updated.         701*/
  1216. /*                -> CsrRow variable that keeps the current row in        701*/
  1217. /*                   the assembler view.                                  701*/
  1218. /*                                                                        701*/
  1219. /* Return:                                                                701*/
  1220. /*                                                                        701*/
  1221. /* Assumptions                                                            701*/
  1222. /*                                                                        701*/
  1223. /*  none                                                                  701*/
  1224. /*                                                                        701*/
  1225. /*****************************************************************************/
  1226. extern uint           FnameRow;                                         /*701*/
  1227. void  SetAsmViewCsr( AFILE *fp, uint *pCsrRow )                         /*701*/
  1228. {                                                                       /*701*/
  1229.  PEVENT  Event;                                                         /*701*/
  1230.                                                                         /*701*/
  1231.  Event = GetCurrentEvent();                                             /*701*/
  1232.                                                                         /*701*/
  1233.  if( Event->Row >= TopLine && Event->Row <  FnameRow )                  /*701*/
  1234.  {                                                                      /*701*/
  1235.   fp->csr.row = Event->Row;                                             /*701*/
  1236.   fp->csr.col = Event->Col;                                             /*701*/
  1237.   *pCsrRow = Event->Row - TopLine;                                      /*701*/
  1238.  }                                                                      /*701*/
  1239. }                                                                       /*701*/
  1240.