First CVS upload.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@80
This commit is contained in:
parent
7d1ca9bdd4
commit
42e5d0b779
158 changed files with 42940 additions and 0 deletions
5
src/debug/Makefile.am
Normal file
5
src/debug/Makefile.am
Normal file
|
@ -0,0 +1,5 @@
|
|||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
|
||||
EXTRA_DIST = debug_win32.cpp
|
||||
noinst_LIBRARIES = libdebug.a
|
||||
libdebug_a_SOURCES = debug.cpp debug_gui.cpp debug_disasm.cpp debug_inc.h disasm_tables.h
|
257
src/debug/debug.cpp
Normal file
257
src/debug/debug.cpp
Normal file
|
@ -0,0 +1,257 @@
|
|||
/*
|
||||
* Copyright (C) 2002 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <list>
|
||||
|
||||
#include "dosbox.h"
|
||||
#ifdef C_DEBUG
|
||||
#include "debug.h"
|
||||
#include "cpu.h"
|
||||
#include "video.h"
|
||||
#include "pic.h"
|
||||
#include "keyboard.h"
|
||||
#include "cpu.h"
|
||||
#include "callback.h"
|
||||
#include "inout.h"
|
||||
#include "mixer.h"
|
||||
#include "debug_inc.h"
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
void WIN32_Console();
|
||||
#endif
|
||||
|
||||
static struct {
|
||||
Bit32u eax,ebx,ecx,edx,esi,edi,ebp,esp,eip;
|
||||
} oldregs;
|
||||
|
||||
|
||||
static Segment oldsegs[6];
|
||||
static Flag_Info oldflags;
|
||||
DBGBlock dbg;
|
||||
static char input_line[256];
|
||||
static Bitu input_count;
|
||||
Bitu cycle_count;
|
||||
static bool debugging;
|
||||
static void SetColor(bool test) {
|
||||
if (test) {
|
||||
if (has_colors()) { wattrset(dbg.win_reg,COLOR_PAIR(PAIR_BYELLOW_BLACK));}
|
||||
} else {
|
||||
if (has_colors()) { wattrset(dbg.win_reg,0);}
|
||||
}
|
||||
}
|
||||
|
||||
enum { BKPNT_REALMODE,BKPNT_PHYSICAL };
|
||||
|
||||
struct BreakPoint {
|
||||
PhysPt location;
|
||||
Bit8u olddata;
|
||||
Bit16u seg;
|
||||
Bit16u off_16;
|
||||
Bit32u off_32;
|
||||
Bit8u type;
|
||||
bool enabled;
|
||||
bool active;
|
||||
};
|
||||
|
||||
static std::list<struct BreakPoint> BPoints;
|
||||
|
||||
|
||||
static void DrawRegisters(void) {
|
||||
/* Main Registers */
|
||||
SetColor(reg_eax!=oldregs.eax);oldregs.eax=reg_eax;mvwprintw (dbg.win_reg,0,4,"%08X",reg_eax);
|
||||
SetColor(reg_ebx!=oldregs.ebx);oldregs.ebx=reg_ebx;mvwprintw (dbg.win_reg,1,4,"%08X",reg_ebx);
|
||||
SetColor(reg_ecx!=oldregs.ecx);oldregs.ecx=reg_ecx;mvwprintw (dbg.win_reg,2,4,"%08X",reg_ecx);
|
||||
SetColor(reg_edx!=oldregs.edx);oldregs.edx=reg_edx;mvwprintw (dbg.win_reg,3,4,"%08X",reg_edx);
|
||||
|
||||
SetColor(reg_esi!=oldregs.esi);oldregs.esi=reg_esi;mvwprintw (dbg.win_reg,0,18,"%08X",reg_esi);
|
||||
SetColor(reg_edi!=oldregs.edi);oldregs.edi=reg_edi;mvwprintw (dbg.win_reg,1,18,"%08X",reg_edi);
|
||||
SetColor(reg_ebp!=oldregs.ebp);oldregs.ebp=reg_ebp;mvwprintw (dbg.win_reg,2,18,"%08X",reg_ebp);
|
||||
SetColor(reg_esp!=oldregs.esp);oldregs.esp=reg_esp;mvwprintw (dbg.win_reg,3,18,"%08X",reg_esp);
|
||||
SetColor(reg_eip!=oldregs.eip);oldregs.eip=reg_eip;mvwprintw (dbg.win_reg,1,42,"%08X",reg_eip);
|
||||
|
||||
SetColor(Segs[ds].value!=oldsegs[ds].value);oldsegs[ds].value=Segs[ds].value;mvwprintw (dbg.win_reg,0,31,"%04X",Segs[ds].value);
|
||||
SetColor(Segs[es].value!=oldsegs[es].value);oldsegs[es].value=Segs[es].value;mvwprintw (dbg.win_reg,0,41,"%04X",Segs[es].value);
|
||||
SetColor(Segs[fs].value!=oldsegs[fs].value);oldsegs[fs].value=Segs[fs].value;mvwprintw (dbg.win_reg,0,51,"%04X",Segs[fs].value);
|
||||
SetColor(Segs[gs].value!=oldsegs[gs].value);oldsegs[gs].value=Segs[gs].value;mvwprintw (dbg.win_reg,0,61,"%04X",Segs[gs].value);
|
||||
SetColor(Segs[ss].value!=oldsegs[ss].value);oldsegs[ss].value=Segs[ss].value;mvwprintw (dbg.win_reg,0,71,"%04X",Segs[ss].value);
|
||||
SetColor(Segs[cs].value!=oldsegs[cs].value);oldsegs[cs].value=Segs[cs].value;mvwprintw (dbg.win_reg,1,31,"%04X",Segs[cs].value);
|
||||
|
||||
/*Individual flags*/
|
||||
|
||||
flags.cf=get_CF();SetColor(flags.cf!=oldflags.cf);oldflags.cf=flags.cf;mvwprintw (dbg.win_reg,1,53,"%01X",flags.cf);
|
||||
flags.zf=get_ZF();SetColor(flags.zf!=oldflags.zf);oldflags.zf=flags.zf;mvwprintw (dbg.win_reg,1,56,"%01X",flags.zf);
|
||||
flags.sf=get_SF();SetColor(flags.sf!=oldflags.sf);oldflags.sf=flags.sf;mvwprintw (dbg.win_reg,1,59,"%01X",flags.sf);
|
||||
flags.of=get_OF();SetColor(flags.of!=oldflags.of);oldflags.of=flags.of;mvwprintw (dbg.win_reg,1,62,"%01X",flags.of);
|
||||
flags.af=get_AF();SetColor(flags.af!=oldflags.af);oldflags.af=flags.af;mvwprintw (dbg.win_reg,1,65,"%01X",flags.af);
|
||||
flags.pf=get_PF();SetColor(flags.pf!=oldflags.pf);oldflags.pf=flags.pf;mvwprintw (dbg.win_reg,1,68,"%01X",flags.pf);
|
||||
|
||||
|
||||
SetColor(flags.df!=oldflags.df);oldflags.df=flags.df;mvwprintw (dbg.win_reg,1,71,"%01X",flags.df);
|
||||
SetColor(flags.intf!=oldflags.intf);oldflags.intf=flags.intf;mvwprintw (dbg.win_reg,1,74,"%01X",flags.intf);
|
||||
SetColor(flags.tf!=oldflags.tf);oldflags.tf=flags.tf;mvwprintw (dbg.win_reg,1,77,"%01X",flags.tf);
|
||||
|
||||
wattrset(dbg.win_reg,0);
|
||||
mvwprintw(dbg.win_reg,3,60,"%d ",cycle_count);
|
||||
wrefresh(dbg.win_reg);
|
||||
};
|
||||
|
||||
|
||||
static void DrawCode(void) {
|
||||
PhysPt start=Segs[cs].phys+reg_eip;
|
||||
char dline[200];Bitu size;Bitu c;
|
||||
for (Bit32u i=0;i<10;i++) {
|
||||
size=DasmI386(dline, start, reg_eip, false);
|
||||
mvwprintw(dbg.win_code,i,0,"%02X:%04X ",Segs[cs].value,(start-Segs[cs].phys));
|
||||
for (c=0;c<size;c++) wprintw(dbg.win_code,"%02X",mem_readb(start+c));
|
||||
for (c=20;c>=size*2;c--) waddch(dbg.win_code,' ');
|
||||
waddstr(dbg.win_code,dline);
|
||||
for (c=30-strlen(dline);c>0;c--) waddch(dbg.win_code,' ');
|
||||
start+=size;
|
||||
}
|
||||
wrefresh(dbg.win_code);
|
||||
}
|
||||
/* This clears all breakpoints by replacing their 0xcc by the original byte */
|
||||
static void ClearBreakPoints(void) {
|
||||
|
||||
// for (Bit32u i=0;i<MAX_BREAKPOINT;i++) {
|
||||
// if (bpoints[i].active && bpoints[i].enabled) {
|
||||
// mem_writeb(bpoints[i].location,bpoints[i].olddata);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
static void SetBreakPoints(void) {
|
||||
// for (Bit32u i=0;i<MAX_BREAKPOINT;i++) {
|
||||
// if (bpoints[i].active && bpoints[i].enabled) {
|
||||
// bpoints[i].olddata=mem_readb(bpoints[i].location);
|
||||
// mem_writeb(bpoints[i].location,0xcc);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void AddBreakPoint(PhysPt off) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool DEBUG_BreakPoint(void) {
|
||||
/* First get the phyiscal address and check for a set breakpoint */
|
||||
PhysPt where=real_phys(Segs[cs].value,reg_ip-1);
|
||||
bool found=false;
|
||||
std::list<BreakPoint>::iterator i;
|
||||
for(i=BPoints.begin(); i != BPoints.end(); ++i) {
|
||||
if ((*i).active && (*i).enabled) {
|
||||
if ((*i).location==where) {
|
||||
found=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) return false;
|
||||
ClearBreakPoints();
|
||||
DEBUG_Enable();
|
||||
|
||||
SetBreakPoints();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Bit32u DEBUG_CheckKeys(void) {
|
||||
int key=getch();
|
||||
Bit32u ret=0;
|
||||
if (key>0) {
|
||||
switch (key) {
|
||||
case '1':
|
||||
ret=(*cpudecoder)(100);
|
||||
break;
|
||||
case '2':
|
||||
ret=(*cpudecoder)(500);
|
||||
break;
|
||||
case '3':
|
||||
ret=(*cpudecoder)(1000);
|
||||
break;
|
||||
case '4':
|
||||
ret=(*cpudecoder)(5000);
|
||||
break;
|
||||
case '5':
|
||||
ret=(*cpudecoder)(10000);
|
||||
break;
|
||||
case 'q':
|
||||
ret=(*cpudecoder)(5);
|
||||
break;
|
||||
|
||||
default:
|
||||
ret=(*cpudecoder)(1);
|
||||
};
|
||||
DEBUG_DrawScreen();
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
||||
Bitu DEBUG_Loop(void) {
|
||||
//TODO Disable sound
|
||||
GFX_Events();
|
||||
PIC_runIRQs();
|
||||
return DEBUG_CheckKeys();
|
||||
}
|
||||
|
||||
void DEBUG_Enable(void) {
|
||||
DEBUG_DrawScreen();
|
||||
debugging=true;
|
||||
DOSBOX_SetLoop(&DEBUG_Loop);
|
||||
}
|
||||
|
||||
|
||||
void DEBUG_DrawScreen(void) {
|
||||
DrawRegisters();
|
||||
DrawCode();
|
||||
|
||||
}
|
||||
static void DEBUG_RaiseTimerIrq(void) {
|
||||
PIC_ActivateIRQ(0);
|
||||
}
|
||||
|
||||
void DEBUG_Init(void) {
|
||||
#ifdef WIN32
|
||||
WIN32_Console();
|
||||
#endif
|
||||
memset((void *)&dbg,0,sizeof(dbg));
|
||||
debugging=false;
|
||||
dbg.active_win=3;
|
||||
input_count=0;
|
||||
/* Start the Debug Gui */
|
||||
DBGUI_StartUp();
|
||||
DEBUG_DrawScreen();
|
||||
/* Add some keyhandlers */
|
||||
KEYBOARD_AddEvent(KBD_kpminus,0,DEBUG_Enable);
|
||||
KEYBOARD_AddEvent(KBD_kpplus,0,DEBUG_RaiseTimerIrq);
|
||||
/* Clear the breakpoint list */
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
1112
src/debug/debug_disasm.cpp
Normal file
1112
src/debug/debug_disasm.cpp
Normal file
File diff suppressed because it is too large
Load diff
130
src/debug/debug_gui.cpp
Normal file
130
src/debug/debug_gui.cpp
Normal file
|
@ -0,0 +1,130 @@
|
|||
/*
|
||||
* Copyright (C) 2002 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "dosbox.h"
|
||||
#ifdef C_DEBUG
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <curses.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "regs.h"
|
||||
#include "debug.h"
|
||||
#include "debug_inc.h"
|
||||
|
||||
void DEBUG_ShowMsg(char * msg) {
|
||||
char buf[1024];
|
||||
strcpy(buf,msg);
|
||||
strcat(buf,"\n");
|
||||
|
||||
waddstr(dbg.win_out,buf);
|
||||
wprintw(dbg.win_out," %d\n",cycle_count);
|
||||
wrefresh(dbg.win_out);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void Draw_RegisterLayout(void) {
|
||||
mvwaddstr(dbg.win_reg,0,0,"EAX=");
|
||||
mvwaddstr(dbg.win_reg,1,0,"EBX=");
|
||||
mvwaddstr(dbg.win_reg,2,0,"ECX=");
|
||||
mvwaddstr(dbg.win_reg,3,0,"EDX=");
|
||||
|
||||
mvwaddstr(dbg.win_reg,0,14,"ESI=");
|
||||
mvwaddstr(dbg.win_reg,1,14,"EDI=");
|
||||
mvwaddstr(dbg.win_reg,2,14,"EBP=");
|
||||
mvwaddstr(dbg.win_reg,3,14,"ESP=");
|
||||
|
||||
mvwaddstr(dbg.win_reg,0,28,"DS=");
|
||||
mvwaddstr(dbg.win_reg,0,38,"ES=");
|
||||
mvwaddstr(dbg.win_reg,0,48,"FS=");
|
||||
mvwaddstr(dbg.win_reg,0,58,"GS=");
|
||||
mvwaddstr(dbg.win_reg,0,68,"SS=");
|
||||
|
||||
mvwaddstr(dbg.win_reg,1,28,"CS=");
|
||||
mvwaddstr(dbg.win_reg,1,38,"EIP=");
|
||||
|
||||
|
||||
mvwaddstr(dbg.win_reg,1,52,"C Z S O A P D I T ");
|
||||
}
|
||||
|
||||
|
||||
static void DrawBars(void) {
|
||||
if (has_colors()) {
|
||||
attrset(COLOR_PAIR(PAIR_BLACK_BLUE));
|
||||
}
|
||||
/* Show the Register bar */
|
||||
mvaddstr(dbg.win_reg->_begy-1,0,"---[F1](Register Overview)---");
|
||||
/* Show the Data Overview bar perhaps with more special stuff in the end */
|
||||
mvaddstr(dbg.win_data->_begy-1,0,"---[F2](Data Overview)---");
|
||||
/* Show the Code Overview perhaps with special stuff in bar too */
|
||||
mvaddstr(dbg.win_code->_begy-1,0,"---[F3](Code Overview)---");
|
||||
/* Show the Output OverView */
|
||||
mvaddstr(dbg.win_out->_begy-1,0,"---[F4](OutPut/Input)---");
|
||||
attrset(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void MakeSubWindows(void) {
|
||||
/* The Std output win should go in bottem */
|
||||
/* Make all the subwindows */
|
||||
int outy=1;
|
||||
/* The Register window */
|
||||
dbg.win_reg=subwin(dbg.win_main,4,dbg.win_main->_maxx,outy,0);
|
||||
outy+=5;
|
||||
/* The Data Window */
|
||||
dbg.win_data=subwin(dbg.win_main,10,dbg.win_main->_maxx,outy,0);
|
||||
outy+=11;
|
||||
/* The Code Window */
|
||||
dbg.win_code=subwin(dbg.win_main,10,dbg.win_main->_maxx,outy,0);
|
||||
outy+=11;
|
||||
/* The output Window */
|
||||
dbg.win_out=subwin(dbg.win_main,dbg.win_main->_maxy-outy-1,dbg.win_main->_maxx,outy,0);
|
||||
dbg.input_y=dbg.win_main->_maxy-1;
|
||||
scrollok(dbg.win_out,TRUE);
|
||||
DrawBars();
|
||||
Draw_RegisterLayout();
|
||||
refresh();
|
||||
}
|
||||
|
||||
static void MakePairs(void) {
|
||||
init_pair(PAIR_BLACK_BLUE, COLOR_BLACK, COLOR_CYAN);
|
||||
init_pair(PAIR_BYELLOW_BLACK, COLOR_YELLOW /*| FOREGROUND_INTENSITY */, COLOR_BLACK);
|
||||
}
|
||||
|
||||
|
||||
void DBGUI_StartUp(void) {
|
||||
/* Start the main window */
|
||||
dbg.win_main=initscr();
|
||||
cbreak(); /* take input chars one at a time, no wait for \n */
|
||||
noecho(); /* don't echo input */
|
||||
nodelay(dbg.win_main,true);
|
||||
keypad(dbg.win_main,true);
|
||||
cycle_count=0;
|
||||
MakePairs();
|
||||
MakeSubWindows();
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
52
src/debug/debug_inc.h
Normal file
52
src/debug/debug_inc.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (C) 2002 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* Local Debug Function */
|
||||
#include <curses.h>
|
||||
#include "mem.h"
|
||||
|
||||
#define PAIR_BLACK_BLUE 1
|
||||
#define PAIR_BYELLOW_BLACK 2
|
||||
|
||||
|
||||
void DBGUI_StartUp(void);
|
||||
|
||||
struct DBGBlock {
|
||||
WINDOW * win_main; /* The Main Window */
|
||||
WINDOW * win_reg; /* Register Window */
|
||||
WINDOW * win_data; /* Data Output window */
|
||||
WINDOW * win_code; /* Disassembly/Debug point Window */
|
||||
WINDOW * win_out; /* Text Output Window */
|
||||
Bit32u active_win; /* Current active window */
|
||||
Bit32u input_y;
|
||||
};
|
||||
|
||||
|
||||
struct DASMLine {
|
||||
Bit32u pc;
|
||||
char dasm[80];
|
||||
PhysPt ea;
|
||||
Bit16u easeg;
|
||||
Bit32u eaoff;
|
||||
};
|
||||
|
||||
extern DBGBlock dbg;
|
||||
|
||||
|
||||
/* Local Debug Stuff */
|
||||
Bitu DasmI386(char* buffer, PhysPt pc, Bitu cur_ip, bool bit32);
|
74
src/debug/debug_win32.cpp
Normal file
74
src/debug/debug_win32.cpp
Normal file
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* Copyright (C) 2002 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
/*
|
||||
Have to remember where i ripped this code sometime ago.
|
||||
|
||||
*/
|
||||
static void ResizeConsole( HANDLE hConsole, SHORT xSize, SHORT ySize ) {
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi; // Hold Current Console Buffer Info
|
||||
BOOL bSuccess;
|
||||
SMALL_RECT srWindowRect; // Hold the New Console Size
|
||||
COORD coordScreen;
|
||||
|
||||
bSuccess = GetConsoleScreenBufferInfo( hConsole, &csbi );
|
||||
|
||||
// Get the Largest Size we can size the Console Window to
|
||||
coordScreen = GetLargestConsoleWindowSize( hConsole );
|
||||
|
||||
// Define the New Console Window Size and Scroll Position
|
||||
srWindowRect.Right = (SHORT)(min(xSize, coordScreen.X) - 1);
|
||||
srWindowRect.Bottom = (SHORT)(min(ySize, coordScreen.Y) - 1);
|
||||
srWindowRect.Left = srWindowRect.Top = (SHORT)0;
|
||||
|
||||
// Define the New Console Buffer Size
|
||||
coordScreen.X = xSize;
|
||||
coordScreen.Y = ySize;
|
||||
|
||||
// If the Current Buffer is Larger than what we want, Resize the
|
||||
// Console Window First, then the Buffer
|
||||
if( (DWORD)csbi.dwSize.X * csbi.dwSize.Y > (DWORD) xSize * ySize)
|
||||
{
|
||||
bSuccess = SetConsoleWindowInfo( hConsole, TRUE, &srWindowRect );
|
||||
bSuccess = SetConsoleScreenBufferSize( hConsole, coordScreen );
|
||||
}
|
||||
|
||||
// If the Current Buffer is Smaller than what we want, Resize the
|
||||
// Buffer First, then the Console Window
|
||||
if( (DWORD)csbi.dwSize.X * csbi.dwSize.Y < (DWORD) xSize * ySize )
|
||||
{
|
||||
bSuccess = SetConsoleScreenBufferSize( hConsole, coordScreen );
|
||||
bSuccess = SetConsoleWindowInfo( hConsole, TRUE, &srWindowRect );
|
||||
}
|
||||
|
||||
// If the Current Buffer *is* the Size we want, Don't do anything!
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void WIN32_Console() {
|
||||
ResizeConsole(GetStdHandle(STD_OUTPUT_HANDLE),80,50);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
191
src/debug/disasm_tables.h
Normal file
191
src/debug/disasm_tables.h
Normal file
|
@ -0,0 +1,191 @@
|
|||
/*
|
||||
* Copyright (C) 2002 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
char * RegTable_16[8]= {"ax","cx","dx","bx","sp","bp","si","di"};
|
||||
char * RegTable_8[8]= {"al","cl","dl","bl","ah","ch","dh","bh"};
|
||||
char * SegTable[8]= {"es","cs","ss","ds","fs","gs","iseg","iseg"};
|
||||
|
||||
|
||||
#define MAX_INFO 3
|
||||
|
||||
enum {
|
||||
Eb,Ev,Ew,Ep,
|
||||
Gb,Gv,
|
||||
Rb,Rw,Rv,
|
||||
Ob,Ov,
|
||||
Sw,
|
||||
Mp,
|
||||
Ib,Ibs,Iw,Iv,Ap,
|
||||
Jb,Jv,
|
||||
Bd,Bw,
|
||||
XBnd,Xlea,
|
||||
/* specials */
|
||||
b2,p_es,p_ss,p_cs,p_ds,p_fs,p_gs,p_size,p_addr,p_rep,
|
||||
s_ax,s_cx,s_dx,s_bx,s_sp,s_bp,s_si,s_di,
|
||||
s_al,s_cl,s_dl,s_bl,s_ah,s_ch,s_dh,s_bh,
|
||||
s_1,
|
||||
Cj,
|
||||
G1,G2,G3b,G3v,G4,G5,
|
||||
no=0xff
|
||||
};
|
||||
|
||||
enum {
|
||||
s_jo, s_jno, s_jc, s_jnc, s_je, s_jne, s_jbe, s_jnbe,
|
||||
s_js, s_jns, s_jp, s_jnp, s_jl, s_jnl, s_jle, s_jnle
|
||||
};
|
||||
|
||||
|
||||
struct Dentry {
|
||||
char * start;
|
||||
Bit8u info[MAX_INFO];
|
||||
};
|
||||
|
||||
static char * G1_Table[8]={"add ","or ","adc ","sbb ","and ","sub ","xor ","cmp "};
|
||||
static char * G2_Table[8]={"rol ","ror ","rcl ","rcr ","shl ","shr ","sal ","sar "};
|
||||
|
||||
static Dentry G3b_Table[8]={
|
||||
"test ",Eb,Ib,no,
|
||||
"test ",Eb,Ib,no,
|
||||
"not ",Eb,no,no,
|
||||
"neg ",Eb,no,no,
|
||||
"mul al,",Eb,no,no,
|
||||
"imul al,",Eb,no,no,
|
||||
"div ax,",Eb,no,no,
|
||||
"idiv ax,",Eb,no,no
|
||||
};
|
||||
|
||||
static Dentry G3v_Table[8]={
|
||||
"test ",Ev,Iv,no,
|
||||
"test ",Ev,Iv,no,
|
||||
"not ",Ev,no,no,
|
||||
"neg ",Ev,no,no,
|
||||
"mul ax,",Ev,no,no,
|
||||
"imul ax,",Ev,no,no,
|
||||
"div dx:ax,",Ev,no,no,
|
||||
"idiv dx:ax,",Ev,no,no
|
||||
};
|
||||
|
||||
static char * G4_Table[8]={
|
||||
"inc ",
|
||||
"dec ",
|
||||
"illegal",
|
||||
"illegal",
|
||||
"illegal",
|
||||
"illegal",
|
||||
"illegal",
|
||||
"illegal"
|
||||
};
|
||||
|
||||
static Dentry G5_Table[8]={
|
||||
"inc ",Ev,no,no,
|
||||
"dec ",Ev,no,no,
|
||||
"call ",Ev,no,no,
|
||||
"call ",Ep,no,no,
|
||||
"jmp ",Ev,no,no,
|
||||
"jmp ",Ep,no,no,
|
||||
"push ,",Ev,no,no,
|
||||
"illegal",no,no,no
|
||||
};
|
||||
|
||||
|
||||
|
||||
static Dentry DTable[256]={
|
||||
/* 0 */
|
||||
"add ",Eb,Gb,no, "add ",Ev,Gv,no, "add ",Gb,Eb,no, "add ",Gv,Ev,no,
|
||||
"add ",s_al,Ib,no, "add ",s_ax,Iv,no, "push es",no,no,no, "pop es",no,no,no,
|
||||
"or ",Eb,Gb,no, "or ",Ev,Gv,no, "or ",Gb,Eb,no, "or ",Gv,Ev,no,
|
||||
"or ",s_al,Ib,no, "or ",s_ax,Iv,no, "push cs",no,no,no, "",b2,no,no,
|
||||
/* 1 */
|
||||
"adc ",Eb,Gb,no, "adc ",Ev,Gv,no, "adc ",Gb,Eb,no, "adc ",Gv,Ev,no,
|
||||
"adc ",s_al,Ib,no, "adc ",s_ax,Iv,no, "push ss",no,no,no, "pop ss",no,no,no,
|
||||
"sbb ",Eb,Gb,no, "sbb ",Ev,Gv,no, "sbb ",Gb,Eb,no, "sbb ",Gv,Ev,no,
|
||||
"sbb ",s_al,Ib,no, "sbb ",s_ax,Iv,no, "push ds",no,no,no, "pop ds",no,no,no,
|
||||
/* 2 */
|
||||
"and ",Eb,Gb,no, "and ",Ev,Gv,no, "and ",Gb,Eb,no, "and ",Gv,Ev,no,
|
||||
"and ",s_al,Ib,no, "and ",s_ax,Iv,no, "",p_es,no,no, "daa",no,no,no,
|
||||
"sub ",Eb,Gb,no, "sub ",Ev,Gv,no, "sub ",Gb,Eb,no, "sub ",Gv,Ev,no,
|
||||
"sub ",s_al,Ib,no, "sub ",s_ax,Iv,no, "",p_ss,no,no, "das",no,no,no,
|
||||
/* 3 */
|
||||
"xor ",Eb,Gb,no, "xor ",Ev,Gv,no, "xor ",Gb,Eb,no, "xor ",Gv,Ev,no,
|
||||
"xor ",s_al,Ib,no, "xor ",s_ax,Iv,no, "",p_ss,no,no, "aaa",no,no,no,
|
||||
"cmp ",Eb,Gb,no, "cmp ",Ev,Gv,no, "cmp ",Gb,Eb,no, "cmp ",Gv,Ev,no,
|
||||
"cmp ",s_al,Ib,no, "cmp ",s_ax,Iv,no, "",p_ds,no,no, "aas",no,no,no,
|
||||
/* 4 */
|
||||
"inc ",s_ax,no,no, "inc ",s_cx,no,no, "inc ",s_dx,no,no, "inc ",s_bx,no,no,
|
||||
"inc ",s_sp,no,no, "inc ",s_bp,no,no, "inc ",s_si,no,no, "inc ",s_di,no,no,
|
||||
"dec ",s_ax,no,no, "dec ",s_cx,no,no, "dec ",s_dx,no,no, "dec ",s_bx,no,no,
|
||||
"dec ",s_sp,no,no, "dec ",s_bp,no,no, "dec ",s_si,no,no, "dec ",s_di,no,no,
|
||||
/* 5 */
|
||||
"push ",s_ax,no,no, "push ",s_cx,no,no, "push ",s_dx,no,no, "push ",s_bx,no,no,
|
||||
"push ",s_sp,no,no, "push ",s_bp,no,no, "push ",s_si,no,no, "push ",s_di,no,no,
|
||||
"pop ",s_ax,no,no, "pop ",s_cx,no,no, "pop ",s_dx,no,no, "pop ",s_bx,no,no,
|
||||
"pop ",s_sp,no,no, "pop ",s_bp,no,no, "pop ",s_si,no,no, "pop ",s_di,no,no,
|
||||
/* 6 */
|
||||
"pusha",Bd,no,no, "popa",Bd,no,no, "bound",XBnd,no,no, "arpl",Ew,Rw,no,
|
||||
"",p_fs,no,no, "",p_gs,no,no, "",p_size,no,no, "",p_addr,no,no,
|
||||
"push ",Iv,no,no, "imul ",Gv,Ev,Iv, "push ",Ibs,no,no, "imul ",Gv,Ev,Ib,
|
||||
"insb",no,no,no, "ins",Bw,no,no, "oustb",no,no,no, "outs",Bw,no,no,
|
||||
/* 7 */
|
||||
"jo ",Cj,s_jo,no, "jno ",Cj,s_jno,no, "jc ",Cj,s_jc,no, "jnc ",Cj,s_jnc,no,
|
||||
"je ",Cj,s_je,no, "jne ",Cj,s_jne,no, "jbe ",Cj,s_jbe,no, "jnbe ",Cj,s_jnbe,no,
|
||||
"js ",Cj,s_js,no, "jns ",Cj,s_jns,no, "jp ",Cj,s_jp,no, "jnp ",Cj,s_jnp,no,
|
||||
"jl ",Cj,s_jl,no, "jnl ",Cj,s_jnl,no, "jle ",Cj,s_jle,no, "jnle ",Cj,s_jnle,no,
|
||||
/* 8 */
|
||||
"",G1,Eb,Ib, "",G1,Ev,Iv, "",G1,Eb,Ib, "",G1,Ev,Ibs,
|
||||
"test ",Eb,Gb,no, "test ",Ev,Gv,no, "xchg ",Eb,Gb,no, "xchg ",Ev,Gv,no,
|
||||
"mov ",Eb,Gb,no, "mov ",Ev,Gv,no, "mov ",Gb,Eb,no, "mov ",Gv,Ev,no,
|
||||
"mov ",Ew,Sw,no, "lea ",Gv,Xlea,no, "mov ",Sw,Ew,no, "pop ",Ev,no,no,
|
||||
/* 9 */
|
||||
"nop",no,no,no, "xchg ",s_ax,s_cx,no,"xchg ",s_ax,s_dx,no,"xchg ",s_ax,s_bx,no,
|
||||
"xchg ",s_ax,s_sp,no,"xchg ",s_ax,s_bp,no,"xchg ",s_ax,s_si,no,"xchg ",s_ax,s_di,no,
|
||||
"cbw",no,no,no, "cwd",no,no,no, "call ",Ap,no,no, "fwait",no,no,no,
|
||||
"pushf",Bd,no,no, "popf",Bd,no,no, "sahf",no,no,no, "lahf",no,no,no,
|
||||
/* a */
|
||||
"mov ",s_al,Ob,no, "mov ",s_ax,Ov,no, "mov ",Ob,s_al,no, "mov ",Ov,s_ax,no,
|
||||
"movsb",no,no,no, "movs",Bw,no,no, "cmpsb",no,no,no, "cmps",Bw,no,no,
|
||||
"test ",s_al,Ib,no, "test ",s_ax,Iv,no, "stosb",no,no,no, "stos",Bw,no,no,
|
||||
"lodsb",no,no,no, "lods",Bw,no,no, "scasb",no,no,no, "scas",Bw,no,no,
|
||||
/* b */
|
||||
"mov ",s_al,Ib,no, "mov ",s_cl,Ib,no, "mov ",s_dl,Ib,no, "mov ",s_bl,Ib,no,
|
||||
"mov ",s_ah,Ib,no, "mov ",s_ch,Ib,no, "mov ",s_dh,Ib,no, "mov ",s_bh,Ib,no,
|
||||
"mov ",s_ax,Iv,no, "mov ",s_cx,Iv,no, "mov ",s_dx,Iv,no, "mov ",s_bx,Iv,no,
|
||||
"mov ",s_sp,Iv,no, "mov ",s_bp,Iv,no, "mov ",s_si,Iv,no, "mov ",s_di,Iv,no,
|
||||
/* c */
|
||||
"",G2,Eb,Ib, "",G2,Ev,Ib, "ret ",Iw,no,no, "ret",no,no,no,
|
||||
"les ",Gv,Mp,no, "lds ",Gv,Mp,no, "mov ",Eb,Ib,no, "mov ",Ev,Iv,no,
|
||||
"enter ",Iw,Ib,no, "leave",no,no,no, "retf ",Iw,no,no, "retf",no,no,no,
|
||||
"int 03",no,no,no, "int ",Ib,no,no, "into",no,no,no, "iret",Bd,no,no,
|
||||
/* d */
|
||||
"",G2,Eb,s_1, "",G2,Ev,s_1, "",G2,Eb,s_cl, "",G2,Ev,s_cl,
|
||||
"aam",no,no,no, "aad",no,no,no, "setalc",no,no,no, "xlat",no,no,no,
|
||||
"esc 0",Ib,no,no, "esc 1",Ib,no,no, "esc 2",Ib,no,no, "esc 3",Ib,no,no,
|
||||
"esc 4",Ib,no,no, "esc 5",Ib,no,no, "esc 6",Ib,no,no, "esc 7",Ib,no,no,
|
||||
/* e */
|
||||
"loopne ",Jb,no,no, "loope ",Jb,no,no, "loop ",Jb,no,no, "jcxz ",Jb,no,no,
|
||||
"in ",s_al,Ib,no, "in ",s_ax,Ib,no, "out ",Ib,s_al,no, "out ",Ib,s_ax,no,
|
||||
"call ",Jv,no,no, "jmp ",Jv,no,no, "jmp",Ap,no,no, "jmp ",Jb,no,no,
|
||||
"in ",s_al,s_dx,no, "in ",s_ax,s_dx,no, "out ",s_dx,s_al,no,"out ",s_dx,s_ax,no,
|
||||
/* f */
|
||||
"lock",no,no,no, "cb ",Iw,no,no, "repne ",p_rep,no,no,"repe ",p_rep,no,no,
|
||||
"hlt",no,no,no, "cmc",no,no,no, "",G3b,no,no, "",G3v,no,no,
|
||||
"clc",no,no,no, "stc",no,no,no, "cli",no,no,no, "sti",no,no,no,
|
||||
"cld",no,no,no, "std",no,no,no, "",G4,Eb,no, "",G5,no,no,
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue