diff --git a/src/cpu/callback.cpp b/src/cpu/callback.cpp index 53cc403..2c78b69 100644 --- a/src/cpu/callback.cpp +++ b/src/cpu/callback.cpp @@ -218,24 +218,25 @@ Bitu CALLBACK_SetupExtra(Bitu callback, Bitu type, PhysPt physAddress, bool use_ phys_writeb(physAddress+0x06,(Bit8u)0xcf); //An IRET Instruction return (use_cb?0x0b:0x07); case CB_IRQ0: // timer int8 + phys_writeb(physAddress+0x00,(Bit8u)0xFB); //STI if (use_cb) { - phys_writeb(physAddress+0x00,(Bit8u)0xFE); //GRP 4 - phys_writeb(physAddress+0x01,(Bit8u)0x38); //Extra Callback instruction - phys_writew(physAddress+0x02,(Bit16u)callback); //The immediate word + phys_writeb(physAddress+0x01,(Bit8u)0xFE); //GRP 4 + phys_writeb(physAddress+0x02,(Bit8u)0x38); //Extra Callback instruction + phys_writew(physAddress+0x03,(Bit16u)callback); //The immediate word physAddress+=4; } - phys_writeb(physAddress+0x00,(Bit8u)0x50); // push ax - phys_writeb(physAddress+0x01,(Bit8u)0x52); // push dx - phys_writeb(physAddress+0x02,(Bit8u)0x1e); // push ds - phys_writew(physAddress+0x03,(Bit16u)0x1ccd); // int 1c - phys_writeb(physAddress+0x05,(Bit8u)0xfa); // cli - phys_writeb(physAddress+0x06,(Bit8u)0x1f); // pop ds - phys_writeb(physAddress+0x07,(Bit8u)0x5a); // pop dx - phys_writew(physAddress+0x08,(Bit16u)0x20b0); // mov al, 0x20 - phys_writew(physAddress+0x0a,(Bit16u)0x20e6); // out 0x20, al + phys_writeb(physAddress+0x01,(Bit8u)0x1e); // push ds + phys_writeb(physAddress+0x02,(Bit8u)0x50); // push ax + phys_writeb(physAddress+0x03,(Bit8u)0x52); // push dx + phys_writew(physAddress+0x04,(Bit16u)0x1ccd); // int 1c + phys_writeb(physAddress+0x06,(Bit8u)0xfa); // cli + phys_writew(physAddress+0x07,(Bit16u)0x20b0); // mov al, 0x20 + phys_writew(physAddress+0x09,(Bit16u)0x20e6); // out 0x20, al + phys_writeb(physAddress+0x0b,(Bit8u)0x5a); // pop dx phys_writeb(physAddress+0x0c,(Bit8u)0x58); // pop ax - phys_writeb(physAddress+0x0d,(Bit8u)0xcf); //An IRET Instruction - return (use_cb?0x12:0x0e); + phys_writeb(physAddress+0x0d,(Bit8u)0x1f); // pop ds + phys_writeb(physAddress+0x0e,(Bit8u)0xcf); //An IRET Instruction + return (use_cb?0x13:0x0f); case CB_IRQ1: // keyboard int9 phys_writeb(physAddress+0x00,(Bit8u)0x50); // push ax phys_writew(physAddress+0x01,(Bit16u)0x60e4); // in al, 0x60 diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp index baa463e..82b8ed5 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp @@ -233,6 +233,7 @@ extern bool CPU_CycleAutoAdjust; //Globals for keyboard initialisation bool startup_state_numlock=false; bool startup_state_capslock=false; + void GFX_SetTitle(Bit32s cycles,Bits frameskip,bool paused){ char title[200]={0}; static Bit32s internal_cycles=0; @@ -249,6 +250,24 @@ void GFX_SetTitle(Bit32s cycles,Bits frameskip,bool paused){ 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) { if (!pressed) return; @@ -502,7 +521,9 @@ dosurface: sdl.using_windib=false; } SDL_InitSubSystem(SDL_INIT_VIDEO); + GFX_SetIcon(); //Set Icon again sdl.surface = SDL_SetVideoMode(width,height,bpp,SDL_HWSURFACE); + if(sdl.surface) GFX_SetTitle(-1,-1,false); //refresh title. } #endif 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" //extern void UI_Run(bool); @@ -1094,16 +1112,7 @@ static void GUI_StartUp(Section * sec) { sdl.active=false; sdl.updating=false; -#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. */ -#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 + GFX_SetIcon(); sdl.desktop.lazy_fullscreen=false; sdl.desktop.lazy_fullscreen_req=false; diff --git a/src/hardware/pic.cpp b/src/hardware/pic.cpp index cc2beaf..46c3109 100644 --- a/src/hardware/pic.cpp +++ b/src/hardware/pic.cpp @@ -550,13 +550,13 @@ void TIMER_AddTick(void) { } } - -class PIC:public Module_base{ +/* Use full name to avoid name clash with compile option for position-independent code */ +class PIC_8259A: public Module_base { private: IO_ReadHandleObject ReadHandler[4]; IO_WriteHandleObject WriteHandler[4]; 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 */ PIC_IRQCheck=0; PIC_IRQActive=PIC_NOIRQ; @@ -606,17 +606,17 @@ public: pic_queue.free_entry=&pic_queue.entries[0]; pic_queue.next_entry=0; } - ~PIC(){ + ~PIC_8259A(){ } }; -static PIC* test; +static PIC_8259A* test; void PIC_Destroy(Section* sec){ delete test; } void PIC_Init(Section* sec) { - test = new PIC(sec); + test = new PIC_8259A(sec); sec->AddDestroyFunction(&PIC_Destroy); } diff --git a/src/ints/bios.cpp b/src/ints/bios.cpp index 804c07a..b8f9940 100644 --- a/src/ints/bios.cpp +++ b/src/ints/bios.cpp @@ -1019,14 +1019,14 @@ public: CALLBACK_Setup(call_irq0,INT8_Handler,CB_IRQ0,Real2Phys(BIOS_DEFAULT_IRQ0_LOCATION),"IRQ 0 Clock"); RealSetVec(0x08,BIOS_DEFAULT_IRQ0_LOCATION); // pseudocode for CB_IRQ0: + // sti // callback INT8_Handler - // push ax,dx,ds + // push ds,ax,dx // int 0x1c // cli - // pop ds,dx // mov al, 0x20 // out 0x20, al - // pop ax + // pop dx,ax,ds // iret mem_writed(BIOS_TIMER,0); //Calculate the correct time diff --git a/src/ints/mouse.cpp b/src/ints/mouse.cpp index 357c777..6c98bfd 100644 --- a/src/ints/mouse.cpp +++ b/src/ints/mouse.cpp @@ -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 (useps2callback) dy *= 2; - mouse.mickey_x += dx; - mouse.mickey_y += dy; + mouse.mickey_x += (dx * mouse.mickeysPerPixel_x); + 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) { mouse.x += dx; 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.y > mouse.max_y) mouse.y = mouse.max_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); DrawCursor(); @@ -797,8 +806,8 @@ static Bitu INT33_Handler(void) { mouse.textXorMask = reg_dx; break; case 0x0b: /* Read Motion Data */ - reg_cx=(Bit16s)(mouse.mickey_x*mouse.mickeysPerPixel_x); - reg_dx=(Bit16s)(mouse.mickey_y*mouse.mickeysPerPixel_y); + reg_cx=static_cast(mouse.mickey_x); + reg_dx=static_cast(mouse.mickey_y); mouse.mickey_x=0; mouse.mickey_y=0; break; @@ -1001,8 +1010,8 @@ static Bitu INT74_Handler(void) { reg_bx=mouse.event_queue[mouse.events].buttons; reg_cx=POS_X; reg_dx=POS_Y; - reg_si=(Bit16s)(mouse.mickey_x*mouse.mickeysPerPixel_x); - reg_di=(Bit16s)(mouse.mickey_y*mouse.mickeysPerPixel_y); + reg_si=static_cast(mouse.mickey_x); + reg_di=static_cast(mouse.mickey_y); CPU_Push16(RealSeg(CALLBACK_RealPointer(int74_ret_callback))); CPU_Push16(RealOff(CALLBACK_RealPointer(int74_ret_callback))); SegSet16(cs, mouse.sub_seg); diff --git a/src/shell/shell.cpp b/src/shell/shell.cpp index 3dd09a5..1023979 100644 --- a/src/shell/shell.cpp +++ b/src/shell/shell.cpp @@ -414,7 +414,7 @@ public: if (access(buffer,F_OK)) goto nomount; autoexec[12].Install(std::string("MOUNT C \"") + buffer + "\""); 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); upcase(name); if(strstr(name,".BAT") != 0) { @@ -427,10 +427,11 @@ public: /* Boot image files */ autoexec[15].Install(std::string("BOOT ") + orig); } else if((strstr(name,".ISO") != 0) || (strstr(name,".CUE") !=0 )) { - if(secure) autoexec[14].Install("z:\\config.com -securemode"); /* 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:"); + if(secure) autoexec[15].Install("z:\\config.com -securemode"); /* Makes no sense to exit here */ } else { if(secure) autoexec[14].Install("z:\\config.com -securemode");