4 * Ullrich von Bassewitz, 08.08.1998
20 /*****************************************************************************/
21 /* Function forwards */
22 /*****************************************************************************/
26 /* Forwards for handler functions */
27 static char AsmHandler (void);
28 static char RegHandler (void);
29 static char StackHandler (void);
30 static char CStackHandler (void);
31 static char DumpHandler (void);
32 static char HelpHandler (void);
34 /* Forwards for other functions */
35 static void DisplayPrompt (char* s);
36 static void SingleStep (char StepInto);
37 static void RedrawStatic (char Frame);
38 static void Redraw (char Frame);
39 static char GetKeyUpdate (void);
43 /*****************************************************************************/
45 /*****************************************************************************/
49 /* Color definitions */
50 #if defined(__PLUS4__) || defined(__C16__)
51 # define COLOR_BORDER (BCOLOR_DARKBLUE | CATTR_LUMA6)
52 # define COLOR_BACKGROUND COLOR_WHITE
53 # define COLOR_TEXTHIGH COLOR_BLACK
54 # define COLOR_TEXTLOW COLOR_GRAY1
55 # define COLOR_FRAMEHIGH COLOR_BLACK
56 # define COLOR_FRAMELOW COLOR_GRAY2
58 # if defined(COLOR_GRAY3)
59 # define COLOR_BORDER COLOR_BLACK
60 # define COLOR_BACKGROUND COLOR_BLACK
61 # define COLOR_TEXTHIGH COLOR_WHITE
62 # define COLOR_TEXTLOW COLOR_GRAY3
63 # define COLOR_FRAMEHIGH COLOR_WHITE
64 # define COLOR_FRAMELOW COLOR_GRAY3
66 # if defined(__APPLE2__) || defined(__APPLE2ENH__)
67 # define COLOR_BORDER COLOR_BLACK
68 # define COLOR_BACKGROUND COLOR_BLACK
69 # define COLOR_TEXTHIGH COLOR_BLACK
70 # define COLOR_TEXTLOW COLOR_BLACK
71 # define COLOR_FRAMEHIGH COLOR_BLACK
72 # define COLOR_FRAMELOW COLOR_BLACK
74 # define COLOR_BORDER COLOR_BLACK
75 # define COLOR_BACKGROUND COLOR_BLACK
76 # define COLOR_TEXTHIGH COLOR_WHITE
77 # define COLOR_TEXTLOW COLOR_WHITE
78 # define COLOR_FRAMEHIGH COLOR_WHITE
79 # define COLOR_FRAMELOW COLOR_WHITE
84 # define COLOR_BLACK 0
87 # define COLOR_WHITE 1
90 /* Screen definitions */
91 #if defined(__CBM610__)
95 # define DUMP_BYTES 16
96 #elif defined(__APPLE2__) || defined(__APPLE2ENH__) || defined(__ATARI__)
103 # define DUMP_BYTES 8
106 /* Replacement key definitions */
107 #if defined(__APPLE2__) || defined(__LYNX__) || defined(__SUPERVISION__)
108 # define CH_DEL ('H' - 'A' + 1) /* Ctrl+H */
111 /* Replacement char definitions */
113 # define CH_ULCORNER '+'
116 # define CH_URCORNER '+'
119 # define CH_LLCORNER '+'
122 # define CH_LRCORNER '+'
137 # define CH_CROSS '+'
140 /* Defines for opcodes */
149 #define OPC_JMPIND 0x6C
158 /* Register values that are used also in the assembler stuff */
159 extern unsigned char DbgSP; /* Stack pointer */
160 extern unsigned DbgCS; /* C stack pointer */
161 extern unsigned DbgHI; /* High 16 bit of primary reg */
165 /* Descriptor for one text line */
172 /* Window descriptor */
174 unsigned char fd_tl; /* Top left char */
175 unsigned char fd_tr; /* Top right char */
176 unsigned char fd_bl; /* Bottom left char */
177 unsigned char fd_br; /* Bottom right char */
178 unsigned char fd_x1, fd_y1; /* Upper left corner */
179 unsigned char fd_x2, fd_y2; /* Lower right corner */
180 unsigned char fd_width, fd_height; /* Redundant but faster */
181 unsigned char fd_visible; /* Is the window currently visible? */
182 char (*fd_func) (void); /* Handler function */
183 unsigned char fd_textcount; /* Number of text lines to print */
184 TextDesc* fd_text; /* Static text in the window */
189 /* Texts for the windows */
190 static TextDesc RegText [] = {
200 static TextDesc HelpText [] = {
201 { 1, 0, "F1, ? Help" },
202 { 1, 1, "F2, t Toggle breakpoint" },
203 { 1, 2, "F3, u Run until subroutine returns" },
204 { 1, 3, "F4, h Run to cursor" },
205 { 1, 4, "F7, space Step into" },
206 { 1, 5, "F8, enter Step over" },
207 { 1, 6, "1-5 Select active window" },
208 { 1, 7, "+ Page down" },
209 { 1, 8, "- Page up" },
210 { 1, 9, "Cursor Move up/down" },
211 { 1, 10, "a/z Move up/down" },
212 { 1, 11, "c Continue" },
213 { 1, 12, "f Follow instruction" },
214 { 1, 13, "o Goto origin" },
215 { 1, 14, "p Use as new PC value" },
217 { 1, 16, "r Redraw screen" },
218 { 1, 17, "s Skip next instruction" },
223 static FrameDesc AsmFrame = {
224 CH_ULCORNER, CH_TTEE, CH_LTEE, CH_CROSS,
225 0, 0, MAX_X - 10, 15,
231 static FrameDesc RegFrame = {
232 CH_TTEE, CH_URCORNER, CH_LTEE, CH_RTEE,
233 MAX_X - 10, 0, MAX_X - 1, 9,
237 sizeof (RegText) / sizeof (RegText [0]), RegText
239 static FrameDesc StackFrame = {
240 CH_LTEE, CH_RTEE, CH_CROSS, CH_RTEE,
241 MAX_X - 10, 9, MAX_X - 1, 15,
247 static FrameDesc CStackFrame = {
248 CH_CROSS, CH_RTEE, CH_BTEE, CH_LRCORNER,
249 MAX_X - 10, 15, MAX_X - 1, MAX_Y - 1,
255 static FrameDesc DumpFrame = {
256 CH_LTEE, CH_CROSS, CH_LLCORNER, CH_BTEE,
257 0, 15, MAX_X - 10, MAX_Y-1,
258 MAX_X - 11, MAX_Y - 17,
263 static FrameDesc HelpFrame = {
264 CH_ULCORNER, CH_URCORNER, CH_LLCORNER, CH_LRCORNER,
265 0, 0, MAX_X - 1, MAX_Y-1,
266 MAX_X - 2, MAX_Y - 2,
269 sizeof (HelpText) / sizeof (HelpText [0]), HelpText
271 static FrameDesc* Frames [] = {
280 /* Number of active frame, -1 = none */
281 static int ActiveFrame = -1;
291 /* Other window data */
292 static unsigned AsmAddr; /* Start address of output */
293 static unsigned DumpAddr; /* Start address of output */
294 static unsigned CStackAddr; /* Start address of output */
295 static unsigned char StackAddr; /* Start address of output */
299 /* Prompt line data */
300 static char* ActivePrompt = 0; /* Last prompt line displayed */
301 static char PromptColor; /* Color behind prompt */
302 static char PromptLength; /* Length of current prompt string */
306 /* Values for the bk_use field of struct BreakPoint */
307 #define BRK_EMPTY 0x00
308 #define BRK_USER 0x01
311 /* Structure describing a breakpoint */
313 unsigned bk_addr; /* Address, 0 if unused */
314 unsigned char bk_opc; /* Opcode */
315 unsigned char bk_use; /* 1 if in use, 0 otherwise */
320 /* Temporary breakpoints - also accessed from the assembler source */
321 #define MAX_USERBREAKS 10
322 unsigned char DbgBreakCount = 0;
323 BreakPoint DbgBreaks [MAX_USERBREAKS+2];
327 /*****************************************************************************/
328 /* Forwards for functions in the assembler source */
329 /*****************************************************************************/
333 BreakPoint* DbgGetBreakSlot (void);
334 /* Search for a free breakpoint slot. Return a pointer to the slot or 0 */
336 BreakPoint* DbgIsBreak (unsigned Addr);
337 /* Check if there is a user breakpoint at the given address, if so, return
338 * a pointer to the slot, else return 0.
343 /*****************************************************************************/
344 /* Frame/window drawing code */
345 /*****************************************************************************/
349 static void DrawFrame (register FrameDesc* F, char Active)
350 /* Draw one window frame */
354 unsigned char tl, tr, bl, br;
355 unsigned char x1, y1, width;
356 unsigned char OldColor;
358 /* Determine the characters for the corners, set frame color */
360 OldColor = textcolor (COLOR_FRAMEHIGH);
366 OldColor = textcolor (COLOR_FRAMELOW);
373 /* Get the coordinates into locals for faster access */
379 cputcxy (x1, y1, tl);
384 cvlinexy (x1, ++y1, F->fd_height);
392 cvlinexy (F->fd_x2, y1, F->fd_height);
394 /* If the window has static text associated, print the text */
395 (void) textcolor (COLOR_TEXTLOW);
396 Count = F->fd_textcount;
399 cputsxy (x1 + T->x, y1 + T->y, T->text);
403 /* Set the old color */
404 (void) textcolor (OldColor);
409 static void DrawFrames (void)
410 /* Draw all frames */
415 /* Build the frame layout of the screen */
416 for (I = 0; I < sizeof (Frames) / sizeof (Frames [0]); ++I) {
426 static void ActivateFrame (int Num, unsigned char Clear)
427 /* Activate a new frame, deactivate the old one */
430 register FrameDesc* F;
432 if (ActiveFrame != Num) {
434 /* Deactivate the old one */
435 if (ActiveFrame >= 0) {
436 DrawFrame (Frames [ActiveFrame], 0);
439 /* Activate the new one */
440 if ((ActiveFrame = Num) >= 0) {
441 F = Frames [ActiveFrame];
442 /* Clear the frame if requested */
444 for (y = F->fd_y1+1; y < F->fd_y2; ++y) {
445 cclearxy (F->fd_x1+1, y, F->fd_width);
451 /* Redraw the current prompt line */
452 DisplayPrompt (ActivePrompt);
459 /*****************************************************************************/
461 /*****************************************************************************/
465 static void DisplayPrompt (char* s)
466 /* Display a prompt */
468 unsigned char OldColor;
470 /* Remember the current color */
471 OldColor = textcolor (COLOR_TEXTHIGH);
473 /* Clear the old prompt if there is one */
475 (void) textcolor (PromptColor);
476 chlinexy ((MAX_X - PromptLength) / 2, MAX_Y-1, PromptLength);
479 /* Get the new prompt data */
481 PromptColor = OldColor;
482 PromptLength = strlen (ActivePrompt);
484 /* Display the new prompt */
485 (void) textcolor (COLOR_TEXTHIGH);
486 cputsxy ((MAX_X - PromptLength) / 2, MAX_Y-1, ActivePrompt);
488 /* Restore the old color */
489 (void) textcolor (PromptColor);
494 static void HelpPrompt (void)
495 /* Display a prompt line mentioning the help key */
497 DisplayPrompt ("Press F1 for help");
502 static void AnyKeyPrompt (void)
504 DisplayPrompt ("Press any key to continue");
509 static char IsAbortKey (char C)
510 /* Return true if C is an abort key */
527 static char Input (char* Prompt, char* Buf, unsigned char Count)
528 /* Read input from the user, return 1 on success, 0 if aborted */
531 unsigned char OldColor;
532 unsigned char OldCursor;
538 /* Clear the current prompt line */
539 cclearxy (0, MAX_Y-1, MAX_X);
541 /* Display the new prompt */
542 OldColor = textcolor (COLOR_TEXTHIGH);
543 cputsxy (0, MAX_Y-1, Prompt);
544 (void) textcolor (COLOR_TEXTLOW);
546 /* Remember where we are, enable the cursor */
548 OldCursor = cursor (1);
550 /* Get input and handle it */
554 if (isalnum (c) && i < Count) {
556 cputcxy (x1 + i, MAX_Y-1, c);
558 } else if (i > 0 && c == CH_DEL) {
560 cputcxy (x1 + i, MAX_Y-1, ' ');
561 gotoxy (x1 + i, MAX_Y-1);
562 } else if (c == '\n') {
565 } else if (IsAbortKey (c)) {
571 /* Reset settings, display old prompt line */
573 (void) textcolor (OldColor);
577 ActivateFrame (Frame, 0);
584 static char InputHex (char* Prompt, unsigned* Val)
585 /* Prompt for a hexadecimal value. Return 0 on failure. */
592 /* Read input from the user (4 digits max), check input */
593 if (Input (Prompt, Buf, sizeof (Buf)-1) && isxdigit (Buf [0])) {
595 /* Check the characters and convert to hex */
598 while ((C = *P) && isxdigit (C)) {
603 C = toupper (C) - ('A' - 10);
609 /* Assign the value */
625 static void ErrorPrompt (char* Msg)
626 /* Display an error message and wait for a key */
628 /* Save the current prompt */
629 char* OldPrompt = ActivePrompt;
631 /* Display the new one */
634 /* Wait for a key and discard it */
637 /* Restore the old prompt */
638 DisplayPrompt (OldPrompt);
643 static char InputGoto (unsigned* Addr)
644 /* Prompt "Goto" and read an address. Print an error and return 0 on failure. */
647 Ok = InputHex ("Goto: ", Addr);
649 ErrorPrompt ("Invalid input - press a key");
656 static void BreakInRomError (void)
657 /* Print an error message if we cannot set a breakpoint */
659 ErrorPrompt ("Cannot set breakpoint - press a key");
664 /*****************************************************************************/
665 /* Breakpoint handling */
666 /*****************************************************************************/
670 static void DbgSetTmpBreak (unsigned Addr)
671 /* Set a breakpoint */
673 BreakPoint* B = DbgGetBreakSlot ();
680 static void DbgToggleUserBreak (unsigned Addr)
681 /* Set a breakpoint */
683 register BreakPoint* B = DbgIsBreak (Addr);
686 /* We have a breakpoint, remove it */
687 B->bk_use = BRK_EMPTY;
690 /* We don't have a breakpoint, set one */
691 if (DbgBreakCount >= MAX_USERBREAKS) {
692 ErrorPrompt ("Too many breakpoints - press a key");
694 /* Test if we can set a breakpoint at that address */
695 if (!DbgIsRAM (Addr)) {
698 /* Set the breakpoint */
699 B = DbgGetBreakSlot ();
701 B->bk_use = BRK_USER;
710 static void DbgResetTmpBreaks (void)
711 /* Reset all temporary breakpoints */
714 BreakPoint* B = DbgBreaks;
716 for (i = 0; i < MAX_USERBREAKS; ++i) {
717 if (B->bk_use == BRK_TMP) {
718 B->bk_use = BRK_EMPTY;
726 static unsigned char DbgTmpBreaksOk (void)
727 /* Check if the temporary breakpoints can be set, if so, return 1, if not,
728 * reset them all and return 0.
732 BreakPoint* B = DbgBreaks;
733 for (i = 0; i < MAX_USERBREAKS; ++i) {
734 if (B->bk_use == BRK_TMP && !DbgIsRAM (B->bk_addr)) {
736 DbgResetTmpBreaks ();
746 /*****************************************************************************/
747 /* Assembler window stuff */
748 /*****************************************************************************/
752 static unsigned AsmBack (unsigned mem, unsigned char lines)
753 /* Go back in the assembler window the given number of lines (calculate
754 * new start address).
764 cur = mem - (lines * 3) - offs;
766 cur += DbgDisAsmLen (cur);
768 in = (in + 1) & 0x1F;
770 if (cur == mem || offs == 12) {
772 return adr [(in - lines - 1) & 0x1F];
774 /* The requested address is inside an instruction, go back
775 * one more byte and try again.
787 static unsigned UpdateAsm (void)
788 /* Update the assembler window starting at the given address */
793 unsigned char width = AsmFrame.fd_width;
794 unsigned char x = AsmFrame.fd_x1 + 1;
795 unsigned m = AsmBack (AsmAddr, 2);
797 for (y = AsmFrame.fd_y1+1; y < AsmFrame.fd_y2; ++y) {
798 len = DbgDisAsm (m, buf, width);
803 if (DbgIsBreak (m)) {
820 static unsigned AsmArg16 (void)
821 /* Return a 16 bit argument */
823 return *(unsigned*)(AsmAddr+1);
828 static void AsmFollow (void)
829 /* Follow the current instruction */
831 switch (*(unsigned char*) AsmAddr) {
835 AsmAddr = AsmArg16 ();
839 AsmAddr = *(unsigned*)AsmArg16 ();
850 AsmAddr = AsmAddr + 2 + *(signed char*)(AsmAddr+1);
854 AsmAddr = (*(unsigned*) (DbgSP + 0x101) + 1);
858 AsmAddr = *(unsigned*) (DbgSP + 0x102);
866 static void AsmHome (void)
867 /* Set the cursor to home position */
874 static void InitAsm (void)
875 /* Initialize the asm window */
883 static char AsmHandler (void)
884 /* Get characters and handle them */
891 /* Update the window contents */
894 /* Read and handle input */
895 switch (c = GetKeyUpdate ()) {
902 AsmAddr = AsmBack (AsmAddr, AsmFrame.fd_height);
909 DbgToggleUserBreak (AsmAddr);
917 InputGoto (&AsmAddr);
932 AsmAddr = AsmBack (AsmAddr, 1);
939 AsmAddr += DbgDisAsmLen (AsmAddr);
951 /*****************************************************************************/
952 /* Register window stuff */
953 /*****************************************************************************/
957 static unsigned UpdateReg (void)
958 /* Update the register window */
960 unsigned char x1 = RegFrame.fd_x1 + 5;
961 unsigned char x2 = x1 + 2;
962 unsigned char y = RegFrame.fd_y1;
964 /* Print the register contents */
965 gotoxy (x1, ++y); cputhex16 (brk_pc);
966 gotoxy (x2, ++y); cputhex8 (brk_sr);
967 gotoxy (x2, ++y); cputhex8 (brk_a);
968 gotoxy (x2, ++y); cputhex8 (brk_x);
969 gotoxy (x2, ++y); cputhex8 (brk_y);
970 gotoxy (x2, ++y); cputhex8 (DbgSP);
971 gotoxy (x1, ++y); cputhex16 (DbgCS);
972 gotoxy (x1, ++y); cputhex16 (DbgHI);
980 static void InitReg (void)
981 /* Initialize the register window */
988 static char RegHandler (void)
989 /* Get characters and handle them */
991 return GetKeyUpdate ();
996 /*****************************************************************************/
997 /* Stack window stuff */
998 /*****************************************************************************/
1002 static unsigned UpdateStack (void)
1003 /* Update the stack window */
1005 unsigned char mem = StackAddr;
1006 unsigned char x1 = StackFrame.fd_x1 + 1;
1007 unsigned char x2 = x1 + 6;
1010 for (y = StackFrame.fd_y2-1; y > StackFrame.fd_y1; --y) {
1014 cputhex8 (* (unsigned char*) (mem + 0x100));
1022 static void StackHome (void)
1023 /* Set the cursor to home position */
1025 StackAddr = DbgSP + 1;
1030 static void InitStack (void)
1031 /* Initialize the stack window */
1039 static char StackHandler (void)
1040 /* Get characters and handle them */
1043 unsigned char BytesPerPage = StackFrame.fd_height;
1047 /* Read and handle input */
1048 switch (c = GetKeyUpdate ()) {
1051 StackAddr += BytesPerPage;
1055 StackAddr -= BytesPerPage;
1081 /* Update the window contents */
1088 /*****************************************************************************/
1089 /* C Stack window stuff */
1090 /*****************************************************************************/
1094 static unsigned UpdateCStack (void)
1095 /* Update the C stack window */
1097 unsigned mem = CStackAddr;
1098 unsigned char x = CStackFrame.fd_x1 + 5;
1101 for (y = CStackFrame.fd_y2-1; y > CStackFrame.fd_y1; --y) {
1103 cputhex16 (* (unsigned*)mem);
1106 cputsxy (CStackFrame.fd_x1+1, CStackFrame.fd_y2-1, "->");
1112 static void CStackHome (void)
1113 /* Set the cursor to home position */
1120 static void InitCStack (void)
1121 /* Initialize the C stack window */
1129 static char CStackHandler (void)
1130 /* Get characters and handle them */
1133 unsigned char BytesPerPage = CStackFrame.fd_height * 2;
1137 /* Read and handle input */
1138 switch (c = GetKeyUpdate ()) {
1141 CStackAddr += BytesPerPage;
1145 CStackAddr -= BytesPerPage;
1171 /* Update the window contents */
1178 /*****************************************************************************/
1179 /* Dump window stuff */
1180 /*****************************************************************************/
1184 static unsigned UpdateDump (void)
1185 /* Update the dump window */
1189 unsigned mem = DumpAddr;
1190 unsigned char x = DumpFrame.fd_x1 + 1;
1191 unsigned char* p = (unsigned char*) mem;
1193 for (y = DumpFrame.fd_y1+1; y < DumpFrame.fd_y2; ++y) {
1194 cputsxy (x, y, DbgMemDump (mem, Buf, DUMP_BYTES));
1202 static void DumpHome (void)
1203 /* Set the cursor to home position */
1210 static char DumpHandler (void)
1211 /* Get characters and handle them */
1214 unsigned BytesPerPage = DumpFrame.fd_height * 8;
1218 /* Read and handle input */
1219 switch (c = GetKeyUpdate ()) {
1222 DumpAddr += BytesPerPage;
1226 DumpAddr -= BytesPerPage;
1230 InputGoto (&DumpAddr);
1256 /* Update the window contents */
1263 /*****************************************************************************/
1264 /* Help window stuff */
1265 /*****************************************************************************/
1269 static char HelpHandler (void)
1270 /* Get characters and handle them */
1272 /* Activate the frame */
1273 int OldActive = ActiveFrame;
1274 ActivateFrame (WIN_HELP, 1);
1276 /* Say that we're waiting for a key */
1279 /* Get a character and discard it */
1282 /* Redraw the old stuff */
1285 /* Done, return no char */
1291 /*****************************************************************************/
1293 /*****************************************************************************/
1297 static unsigned GetArg16 (void)
1298 /* Read an argument */
1300 return *(unsigned*)(brk_pc+1);
1305 static unsigned GetStack16 (unsigned char Offs)
1306 /* Fetch a 16 bit value from stack top */
1308 return *(unsigned*)(DbgSP+Offs+0x101);
1313 static void SetRTSBreak (void)
1314 /* Set a breakpoint at the return target */
1316 DbgSetTmpBreak (GetStack16 (0) + 1);
1321 static void SingleStep (char StepInto)
1325 switch (*(unsigned char*) brk_pc) {
1328 /* Set breakpoint at target */
1329 DbgSetTmpBreak (GetArg16 ());
1333 /* Indirect jump, ignore CPU error when crossing page */
1334 DbgSetTmpBreak (*(unsigned*)GetArg16 ());
1345 /* Be sure not to set the breakpoint twice if this is a jump to
1346 * the following instruction.
1348 Offs = ((signed char*)brk_pc)[1];
1350 DbgSetTmpBreak (brk_pc + Offs + 2);
1355 /* Set a breakpoint at the return target */
1360 /* Set a breakpoint at the return target */
1361 DbgSetTmpBreak (GetStack16 (1));
1366 /* Set breakpoint at target */
1367 DbgSetTmpBreak (GetArg16 ());
1373 /* Place a breakpoint behind the instruction */
1374 DbgSetTmpBreak (brk_pc + DbgDisAsmLen (brk_pc));
1379 /*****************************************************************************/
1380 /* High level window handling */
1381 /*****************************************************************************/
1385 static void RedrawStatic (char Frame)
1386 /* Redraw static display stuff */
1388 /* Reset the active frame */
1391 /* Clear the screen hide the cursor */
1392 (void) bordercolor (COLOR_BORDER);
1393 (void) bgcolor (COLOR_BACKGROUND);
1397 /* Build the frame layout of the screen */
1398 (void) textcolor (COLOR_FRAMELOW);
1401 /* Draw the prompt line */
1404 /* Activate the active frame */
1405 ActivateFrame (Frame, 0);
1410 static void Redraw (char Frame)
1411 /* Redraw the display in case it's garbled */
1413 /* Redraw the static stuff */
1414 RedrawStatic (Frame);
1416 /* Init the window contents */
1426 static char GetKeyUpdate (void)
1427 /* Wait for a key updating the windows in the background */
1429 static unsigned char Win;
1431 /* While there are no keys... */
1453 Win = (Win + 1) & 0x03;
1457 /* We have a key - return it */
1463 /*****************************************************************************/
1464 /* Externally visible functions */
1465 /*****************************************************************************/
1469 void DbgEntry (void)
1470 /* Start up the debugger */
1472 static unsigned char FirstTime = 1;
1476 /* If this is the first call, setup the display */
1480 /* Draw the window, default active frame is ASM frame */
1481 RedrawStatic (WIN_ASM);
1489 /* Only initialize variables here, don't do a display update. The actual
1490 * display update will be done while waiting for user input.
1493 UpdateReg (); /* Must update this (static later) */
1497 /* Wait for user input */
1500 c = Frames [ActiveFrame]->fd_func ();
1508 ActivateFrame (c - '1', 0);
1522 /* Go until return */
1531 /* Go to cursor, only possible if cursor not at current PC */
1532 if (AsmAddr != brk_pc) {
1533 DbgSetTmpBreak (AsmAddr);
1543 if (DbgTmpBreaksOk ()) {
1544 /* Could set breakpoints */
1554 if (DbgTmpBreaksOk ()) {
1555 /* Could set breakpoints */
1566 /* Skip instruction */
1567 brk_pc += DbgDisAsmLen (brk_pc);
1573 Redraw (ActiveFrame);