sync to dosbox r3783

This commit is contained in:
dborth 2012-06-30 06:50:35 +00:00
parent cb45f613f8
commit 49f57250b5
6 changed files with 65 additions and 45 deletions

View File

@ -218,24 +218,25 @@ Bitu CALLBACK_SetupExtra(Bitu callback, Bitu type, PhysPt physAddress, bool use_
phys_writeb(physAddress+0x06,(Bit8u)0xcf); //An IRET Instruction phys_writeb(physAddress+0x06,(Bit8u)0xcf); //An IRET Instruction
return (use_cb?0x0b:0x07); return (use_cb?0x0b:0x07);
case CB_IRQ0: // timer int8 case CB_IRQ0: // timer int8
phys_writeb(physAddress+0x00,(Bit8u)0xFB); //STI
if (use_cb) { if (use_cb) {
phys_writeb(physAddress+0x00,(Bit8u)0xFE); //GRP 4 phys_writeb(physAddress+0x01,(Bit8u)0xFE); //GRP 4
phys_writeb(physAddress+0x01,(Bit8u)0x38); //Extra Callback instruction phys_writeb(physAddress+0x02,(Bit8u)0x38); //Extra Callback instruction
phys_writew(physAddress+0x02,(Bit16u)callback); //The immediate word phys_writew(physAddress+0x03,(Bit16u)callback); //The immediate word
physAddress+=4; physAddress+=4;
} }
phys_writeb(physAddress+0x00,(Bit8u)0x50); // push ax phys_writeb(physAddress+0x01,(Bit8u)0x1e); // push ds
phys_writeb(physAddress+0x01,(Bit8u)0x52); // push dx phys_writeb(physAddress+0x02,(Bit8u)0x50); // push ax
phys_writeb(physAddress+0x02,(Bit8u)0x1e); // push ds phys_writeb(physAddress+0x03,(Bit8u)0x52); // push dx
phys_writew(physAddress+0x03,(Bit16u)0x1ccd); // int 1c phys_writew(physAddress+0x04,(Bit16u)0x1ccd); // int 1c
phys_writeb(physAddress+0x05,(Bit8u)0xfa); // cli phys_writeb(physAddress+0x06,(Bit8u)0xfa); // cli
phys_writeb(physAddress+0x06,(Bit8u)0x1f); // pop ds phys_writew(physAddress+0x07,(Bit16u)0x20b0); // mov al, 0x20
phys_writeb(physAddress+0x07,(Bit8u)0x5a); // pop dx phys_writew(physAddress+0x09,(Bit16u)0x20e6); // out 0x20, al
phys_writew(physAddress+0x08,(Bit16u)0x20b0); // mov al, 0x20 phys_writeb(physAddress+0x0b,(Bit8u)0x5a); // pop dx
phys_writew(physAddress+0x0a,(Bit16u)0x20e6); // out 0x20, al
phys_writeb(physAddress+0x0c,(Bit8u)0x58); // pop ax phys_writeb(physAddress+0x0c,(Bit8u)0x58); // pop ax
phys_writeb(physAddress+0x0d,(Bit8u)0xcf); //An IRET Instruction phys_writeb(physAddress+0x0d,(Bit8u)0x1f); // pop ds
return (use_cb?0x12:0x0e); phys_writeb(physAddress+0x0e,(Bit8u)0xcf); //An IRET Instruction
return (use_cb?0x13:0x0f);
case CB_IRQ1: // keyboard int9 case CB_IRQ1: // keyboard int9
phys_writeb(physAddress+0x00,(Bit8u)0x50); // push ax phys_writeb(physAddress+0x00,(Bit8u)0x50); // push ax
phys_writew(physAddress+0x01,(Bit16u)0x60e4); // in al, 0x60 phys_writew(physAddress+0x01,(Bit16u)0x60e4); // in al, 0x60

View File

@ -233,6 +233,7 @@ extern bool CPU_CycleAutoAdjust;
//Globals for keyboard initialisation //Globals for keyboard initialisation
bool startup_state_numlock=false; bool startup_state_numlock=false;
bool startup_state_capslock=false; bool startup_state_capslock=false;
void GFX_SetTitle(Bit32s cycles,Bits frameskip,bool paused){ void GFX_SetTitle(Bit32s cycles,Bits frameskip,bool paused){
char title[200]={0}; char title[200]={0};
static Bit32s internal_cycles=0; static Bit32s internal_cycles=0;
@ -249,6 +250,24 @@ void GFX_SetTitle(Bit32s cycles,Bits frameskip,bool paused){
SDL_WM_SetCaption(title,VERSION); SDL_WM_SetCaption(title,VERSION);
} }
static unsigned char logo[32*32*4]= {
#include "dosbox_logo.h"
};
static void GFX_SetIcon() {
#if !defined(MACOSX)
/* Set Icon (must be done before any sdl_setvideomode call) */
/* But don't set it on OS X, as we use a nicer external icon there. */
/* Made into a separate call, so it can be called again when we restart the graphics output on win32 */
#if WORDS_BIGENDIAN
SDL_Surface* logos= SDL_CreateRGBSurfaceFrom((void*)logo,32,32,32,128,0xff000000,0x00ff0000,0x0000ff00,0);
#else
SDL_Surface* logos= SDL_CreateRGBSurfaceFrom((void*)logo,32,32,32,128,0x000000ff,0x0000ff00,0x00ff0000,0);
#endif
SDL_WM_SetIcon(logos,NULL);
#endif
}
static void KillSwitch(bool pressed) { static void KillSwitch(bool pressed) {
if (!pressed) if (!pressed)
return; return;
@ -502,7 +521,9 @@ dosurface:
sdl.using_windib=false; sdl.using_windib=false;
} }
SDL_InitSubSystem(SDL_INIT_VIDEO); SDL_InitSubSystem(SDL_INIT_VIDEO);
GFX_SetIcon(); //Set Icon again
sdl.surface = SDL_SetVideoMode(width,height,bpp,SDL_HWSURFACE); sdl.surface = SDL_SetVideoMode(width,height,bpp,SDL_HWSURFACE);
if(sdl.surface) GFX_SetTitle(-1,-1,false); //refresh title.
} }
#endif #endif
if (sdl.surface == NULL) if (sdl.surface == NULL)
@ -1080,9 +1101,6 @@ static void OutputString(Bitu x,Bitu y,const char * text,Bit32u color,Bit32u col
} }
} }
static unsigned char logo[32*32*4]= {
#include "dosbox_logo.h"
};
#include "dosbox_splash.h" #include "dosbox_splash.h"
//extern void UI_Run(bool); //extern void UI_Run(bool);
@ -1094,16 +1112,7 @@ static void GUI_StartUp(Section * sec) {
sdl.active=false; sdl.active=false;
sdl.updating=false; sdl.updating=false;
#if !defined(MACOSX) GFX_SetIcon();
/* Set Icon (must be done before any sdl_setvideomode call) */
/* But don't set it on OS X, as we use a nicer external icon there. */
#if WORDS_BIGENDIAN
SDL_Surface* logos= SDL_CreateRGBSurfaceFrom((void*)logo,32,32,32,128,0xff000000,0x00ff0000,0x0000ff00,0);
#else
SDL_Surface* logos= SDL_CreateRGBSurfaceFrom((void*)logo,32,32,32,128,0x000000ff,0x0000ff00,0x00ff0000,0);
#endif
SDL_WM_SetIcon(logos,NULL);
#endif
sdl.desktop.lazy_fullscreen=false; sdl.desktop.lazy_fullscreen=false;
sdl.desktop.lazy_fullscreen_req=false; sdl.desktop.lazy_fullscreen_req=false;

View File

@ -550,13 +550,13 @@ void TIMER_AddTick(void) {
} }
} }
/* Use full name to avoid name clash with compile option for position-independent code */
class PIC:public Module_base{ class PIC_8259A: public Module_base {
private: private:
IO_ReadHandleObject ReadHandler[4]; IO_ReadHandleObject ReadHandler[4];
IO_WriteHandleObject WriteHandler[4]; IO_WriteHandleObject WriteHandler[4];
public: public:
PIC(Section* configuration):Module_base(configuration){ PIC_8259A(Section* configuration):Module_base(configuration){
/* Setup pic0 and pic1 with initial values like DOS has normally */ /* Setup pic0 and pic1 with initial values like DOS has normally */
PIC_IRQCheck=0; PIC_IRQCheck=0;
PIC_IRQActive=PIC_NOIRQ; PIC_IRQActive=PIC_NOIRQ;
@ -606,17 +606,17 @@ public:
pic_queue.free_entry=&pic_queue.entries[0]; pic_queue.free_entry=&pic_queue.entries[0];
pic_queue.next_entry=0; pic_queue.next_entry=0;
} }
~PIC(){ ~PIC_8259A(){
} }
}; };
static PIC* test; static PIC_8259A* test;
void PIC_Destroy(Section* sec){ void PIC_Destroy(Section* sec){
delete test; delete test;
} }
void PIC_Init(Section* sec) { void PIC_Init(Section* sec) {
test = new PIC(sec); test = new PIC_8259A(sec);
sec->AddDestroyFunction(&PIC_Destroy); sec->AddDestroyFunction(&PIC_Destroy);
} }

View File

@ -1019,14 +1019,14 @@ public:
CALLBACK_Setup(call_irq0,INT8_Handler,CB_IRQ0,Real2Phys(BIOS_DEFAULT_IRQ0_LOCATION),"IRQ 0 Clock"); CALLBACK_Setup(call_irq0,INT8_Handler,CB_IRQ0,Real2Phys(BIOS_DEFAULT_IRQ0_LOCATION),"IRQ 0 Clock");
RealSetVec(0x08,BIOS_DEFAULT_IRQ0_LOCATION); RealSetVec(0x08,BIOS_DEFAULT_IRQ0_LOCATION);
// pseudocode for CB_IRQ0: // pseudocode for CB_IRQ0:
// sti
// callback INT8_Handler // callback INT8_Handler
// push ax,dx,ds // push ds,ax,dx
// int 0x1c // int 0x1c
// cli // cli
// pop ds,dx
// mov al, 0x20 // mov al, 0x20
// out 0x20, al // out 0x20, al
// pop ax // pop dx,ax,ds
// iret // iret
mem_writed(BIOS_TIMER,0); //Calculate the correct time mem_writed(BIOS_TIMER,0); //Calculate the correct time

View File

@ -454,8 +454,12 @@ void Mouse_CursorMoved(float xrel,float yrel,float x,float y,bool emulate) {
if((fabs(yrel) > 1.0) || (mouse.senv_y < 1.0)) dy *= mouse.senv_y; if((fabs(yrel) > 1.0) || (mouse.senv_y < 1.0)) dy *= mouse.senv_y;
if (useps2callback) dy *= 2; if (useps2callback) dy *= 2;
mouse.mickey_x += dx; mouse.mickey_x += (dx * mouse.mickeysPerPixel_x);
mouse.mickey_y += dy; mouse.mickey_y += (dy * mouse.mickeysPerPixel_y);
if (mouse.mickey_x >= 32768.0) mouse.mickey_x -= 65536.0;
else if (mouse.mickey_x <= -32769.0) mouse.mickey_x += 65536.0;
if (mouse.mickey_y >= 32768.0) mouse.mickey_y -= 65536.0;
else if (mouse.mickey_y <= -32769.0) mouse.mickey_y += 65536.0;
if (emulate) { if (emulate) {
mouse.x += dx; mouse.x += dx;
mouse.y += dy; mouse.y += dy;
@ -484,6 +488,11 @@ void Mouse_CursorMoved(float xrel,float yrel,float x,float y,bool emulate) {
if (mouse.x < mouse.min_x) mouse.x = mouse.min_x; if (mouse.x < mouse.min_x) mouse.x = mouse.min_x;
if (mouse.y > mouse.max_y) mouse.y = mouse.max_y; if (mouse.y > mouse.max_y) mouse.y = mouse.max_y;
if (mouse.y < mouse.min_y) mouse.y = mouse.min_y; if (mouse.y < mouse.min_y) mouse.y = mouse.min_y;
} else {
if (mouse.x >= 32768.0) mouse.x -= 65536.0;
else if (mouse.x <= -32769.0) mouse.x += 65536.0;
if (mouse.y >= 32768.0) mouse.y -= 65536.0;
else if (mouse.y <= -32769.0) mouse.y += 65536.0;
} }
Mouse_AddEvent(MOUSE_HAS_MOVED); Mouse_AddEvent(MOUSE_HAS_MOVED);
DrawCursor(); DrawCursor();
@ -797,8 +806,8 @@ static Bitu INT33_Handler(void) {
mouse.textXorMask = reg_dx; mouse.textXorMask = reg_dx;
break; break;
case 0x0b: /* Read Motion Data */ case 0x0b: /* Read Motion Data */
reg_cx=(Bit16s)(mouse.mickey_x*mouse.mickeysPerPixel_x); reg_cx=static_cast<Bit16s>(mouse.mickey_x);
reg_dx=(Bit16s)(mouse.mickey_y*mouse.mickeysPerPixel_y); reg_dx=static_cast<Bit16s>(mouse.mickey_y);
mouse.mickey_x=0; mouse.mickey_x=0;
mouse.mickey_y=0; mouse.mickey_y=0;
break; break;
@ -1001,8 +1010,8 @@ static Bitu INT74_Handler(void) {
reg_bx=mouse.event_queue[mouse.events].buttons; reg_bx=mouse.event_queue[mouse.events].buttons;
reg_cx=POS_X; reg_cx=POS_X;
reg_dx=POS_Y; reg_dx=POS_Y;
reg_si=(Bit16s)(mouse.mickey_x*mouse.mickeysPerPixel_x); reg_si=static_cast<Bit16s>(mouse.mickey_x);
reg_di=(Bit16s)(mouse.mickey_y*mouse.mickeysPerPixel_y); reg_di=static_cast<Bit16s>(mouse.mickey_y);
CPU_Push16(RealSeg(CALLBACK_RealPointer(int74_ret_callback))); CPU_Push16(RealSeg(CALLBACK_RealPointer(int74_ret_callback)));
CPU_Push16(RealOff(CALLBACK_RealPointer(int74_ret_callback))); CPU_Push16(RealOff(CALLBACK_RealPointer(int74_ret_callback)));
SegSet16(cs, mouse.sub_seg); SegSet16(cs, mouse.sub_seg);

View File

@ -414,7 +414,7 @@ public:
if (access(buffer,F_OK)) goto nomount; if (access(buffer,F_OK)) goto nomount;
autoexec[12].Install(std::string("MOUNT C \"") + buffer + "\""); autoexec[12].Install(std::string("MOUNT C \"") + buffer + "\"");
autoexec[13].Install("C:"); autoexec[13].Install("C:");
/* Save the non modified filename (so boot and imgmount can use it (long filenames, case sensivitive)*/ /* Save the non-modified filename (so boot and imgmount can use it (long filenames, case sensivitive)) */
strcpy(orig,name); strcpy(orig,name);
upcase(name); upcase(name);
if(strstr(name,".BAT") != 0) { if(strstr(name,".BAT") != 0) {
@ -427,10 +427,11 @@ public:
/* Boot image files */ /* Boot image files */
autoexec[15].Install(std::string("BOOT ") + orig); autoexec[15].Install(std::string("BOOT ") + orig);
} else if((strstr(name,".ISO") != 0) || (strstr(name,".CUE") !=0 )) { } else if((strstr(name,".ISO") != 0) || (strstr(name,".CUE") !=0 )) {
if(secure) autoexec[14].Install("z:\\config.com -securemode");
/* imgmount CD image files */ /* imgmount CD image files */
autoexec[15].Install(std::string("IMGMOUNT D \"") + orig + std::string("\" -t iso")); /* securemode gets a different number from the previous branches! */
autoexec[14].Install(std::string("IMGMOUNT D \"") + orig + std::string("\" -t iso"));
//autoexec[16].Install("D:"); //autoexec[16].Install("D:");
if(secure) autoexec[15].Install("z:\\config.com -securemode");
/* Makes no sense to exit here */ /* Makes no sense to exit here */
} else { } else {
if(secure) autoexec[14].Install("z:\\config.com -securemode"); if(secure) autoexec[14].Install("z:\\config.com -securemode");