diff --git a/include/callback.h b/include/callback.h index 72da8222..1bfc3526 100644 --- a/include/callback.h +++ b/include/callback.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: callback.h,v 1.20 2007-06-03 16:46:33 c2woody Exp $ */ +/* $Id: callback.h,v 1.21 2007-06-12 20:22:07 c2woody Exp $ */ #ifndef DOSBOX_CALLBACK_H #define DOSBOX_CALLBACK_H @@ -43,10 +43,10 @@ enum { extern Bit8u lastint; INLINE RealPt CALLBACK_RealPointer(Bitu callback) { - return RealMake(CB_SEG,callback*CB_SIZE); + return RealMake(CB_SEG,(Bit16u)(callback*CB_SIZE)); } INLINE PhysPt CALLBACK_PhysPointer(Bitu callback) { - return PhysMake(CB_SEG,callback*CB_SIZE); + return PhysMake(CB_SEG,(Bit16u)(callback*CB_SIZE)); } INLINE PhysPt CALLBACK_GetBase(void) { diff --git a/include/dos_inc.h b/include/dos_inc.h index 14a594b3..3333e3a3 100644 --- a/include/dos_inc.h +++ b/include/dos_inc.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_inc.h,v 1.66 2007-06-06 15:44:40 c2woody Exp $ */ +/* $Id: dos_inc.h,v 1.67 2007-06-12 20:22:07 c2woody Exp $ */ #ifndef DOSBOX_DOS_INC_H #define DOSBOX_DOS_INC_H @@ -260,9 +260,9 @@ public: } INLINE void SaveIt(Bitu size,PhysPt addr,Bitu val) { switch (size) { - case 1:mem_writeb(pt+addr,val);break; - case 2:mem_writew(pt+addr,val);break; - case 4:mem_writed(pt+addr,val);break; + case 1:mem_writeb(pt+addr,(Bit8u)val);break; + case 2:mem_writew(pt+addr,(Bit16u)val);break; + case 4:mem_writed(pt+addr,(Bit32u)val);break; } } INLINE void SetPt(Bit16u seg) { pt=PhysMake(seg,0);} @@ -283,14 +283,14 @@ public: void SaveVectors (void); void RestoreVectors (void); void SetSize (Bit16u size) { sSave(sPSP,next_seg,size); }; - Bit16u GetSize (void) { return sGet(sPSP,next_seg); }; + Bit16u GetSize (void) { return (Bit16u)sGet(sPSP,next_seg); }; void SetEnvironment (Bit16u envseg) { sSave(sPSP,environment,envseg); }; - Bit16u GetEnvironment (void) { return sGet(sPSP,environment); }; + Bit16u GetEnvironment (void) { return (Bit16u)sGet(sPSP,environment); }; Bit16u GetSegment (void) { return seg; }; void SetFileHandle (Bit16u index, Bit8u handle); Bit8u GetFileHandle (Bit16u index); void SetParent (Bit16u parent) { sSave(sPSP,psp_parent,parent); }; - Bit16u GetParent (void) { return sGet(sPSP,psp_parent); }; + Bit16u GetParent (void) { return (Bit16u)sGet(sPSP,psp_parent); }; void SetStack (RealPt stackpt) { sSave(sPSP,stack,stackpt); }; RealPt GetStack (void) { return sGet(sPSP,stack); }; void SetInt22 (RealPt int22pt) { sSave(sPSP,int_22,int22pt); }; @@ -458,8 +458,8 @@ public: void SetDirID(Bit16u entry) { sSave(sDTA,dirID,entry); }; void SetDirIDCluster(Bit16u entry) { sSave(sDTA,dirCluster,entry); }; - Bit16u GetDirID(void) { return sGet(sDTA,dirID); }; - Bit16u GetDirIDCluster(void) { return sGet(sDTA,dirCluster); }; + Bit16u GetDirID(void) { return (Bit16u)sGet(sDTA,dirID); }; + Bit16u GetDirIDCluster(void) { return (Bit16u)sGet(sDTA,dirCluster); }; private: #ifdef _MSC_VER #pragma pack(1) @@ -540,9 +540,9 @@ public: void SetType(Bit8u _type) { sSave(sMCB,type,_type);} void SetSize(Bit16u _size) { sSave(sMCB,size,_size);} void SetPSPSeg(Bit16u _pspseg) { sSave(sMCB,psp_segment,_pspseg);} - Bit8u GetType(void) { return sGet(sMCB,type);} - Bit16u GetSize(void) { return sGet(sMCB,size);} - Bit16u GetPSPSeg(void) { return sGet(sMCB,psp_segment);} + Bit8u GetType(void) { return (Bit8u)sGet(sMCB,type);} + Bit16u GetSize(void) { return (Bit16u)sGet(sMCB,size);} + Bit16u GetPSPSeg(void) { return (Bit16u)sGet(sMCB,psp_segment);} private: #ifdef _MSC_VER #pragma pack (1) @@ -566,9 +566,9 @@ public: void SetDrive(Bit8u _drive) { sSave(sSDA,current_drive, _drive); } void SetDTA(Bit32u _dta) { sSave(sSDA,current_dta, _dta); } void SetPSP(Bit16u _psp) { sSave(sSDA,current_psp, _psp); } - Bit8u GetDrive(void) { return sGet(sSDA,current_drive); } - Bit16u GetPSP(void) { return sGet(sSDA,current_psp); } - Bit32u GetDTA(void) { return sGet(sSDA,current_dta); } + Bit8u GetDrive(void) { return (Bit8u)sGet(sSDA,current_drive); } + Bit16u GetPSP(void) { return (Bit16u)sGet(sSDA,current_psp); } + Bit32u GetDTA(void) { return (Bit32u)sGet(sSDA,current_dta); } private: diff --git a/include/fpu.h b/include/fpu.h index 50511eaf..2c071801 100644 --- a/include/fpu.h +++ b/include/fpu.h @@ -114,8 +114,8 @@ INLINE void FPU_SetTag(Bit16u tag){ } INLINE void FPU_SetCW(Bitu word){ - fpu.cw = word; - fpu.cw_mask_all = word | 0x3f; + fpu.cw = (Bit16u)word; + fpu.cw_mask_all = (Bit16u)(word | 0x3f); fpu.round = (FPU_Round)((word >> 10) & 3); } diff --git a/include/inout.h b/include/inout.h index db48d783..06987c51 100644 --- a/include/inout.h +++ b/include/inout.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: inout.h,v 1.10 2007-01-08 19:45:37 qbix79 Exp $ */ +/* $Id: inout.h,v 1.11 2007-06-12 20:22:07 c2woody Exp $ */ #ifndef DOSBOX_INOUT_H #define DOSBOX_INOUT_H @@ -72,7 +72,7 @@ INLINE void IO_Write(Bitu port,Bit8u val) { IO_WriteB(port,val); } INLINE Bit8u IO_Read(Bitu port){ - return IO_ReadB(port); + return (Bit8u)IO_ReadB(port); } #endif diff --git a/include/paging.h b/include/paging.h index 82ad4832..e0b53d69 100644 --- a/include/paging.h +++ b/include/paging.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: paging.h,v 1.24 2007-01-08 19:45:37 qbix79 Exp $ */ +/* $Id: paging.h,v 1.25 2007-06-12 20:22:07 c2woody Exp $ */ #ifndef DOSBOX_PAGING_H #define DOSBOX_PAGING_H @@ -179,7 +179,7 @@ bool mem_unalignedwrited_checked_x86(PhysPt address,Bit32u val); INLINE Bit8u mem_readb_inline(PhysPt address) { Bitu index=(address>>12); if (paging.tlb.read[index]) return host_readb(paging.tlb.read[index]+address); - else return paging.tlb.handler[index]->readb(address); + else return (Bit8u)paging.tlb.handler[index]->readb(address); } INLINE Bit16u mem_readw_inline(PhysPt address) { @@ -187,7 +187,7 @@ INLINE Bit16u mem_readw_inline(PhysPt address) { Bitu index=(address>>12); if (paging.tlb.read[index]) return host_readw(paging.tlb.read[index]+address); - else return paging.tlb.handler[index]->readw(address); + else return (Bit16u) paging.tlb.handler[index]->readw(address); } else return mem_unalignedreadw(address); } @@ -231,7 +231,7 @@ INLINE Bit16u mem_readw_dyncorex86(PhysPt address) { Bitu index=(address>>12); if (paging.tlb.read[index]) return host_readw(paging.tlb.read[index]+address); - else return paging.tlb.handler[index]->readw(address); + else return (Bit16u)paging.tlb.handler[index]->readw(address); } else return mem_unalignedreadw(address); } diff --git a/include/regs.h b/include/regs.h index 636b676c..0f5a0c41 100644 --- a/include/regs.h +++ b/include/regs.h @@ -98,7 +98,7 @@ INLINE PhysPt SegPhys(SegNames index) { } INLINE Bit16u SegValue(SegNames index) { - return Segs.val[index]; + return (Bit16u)Segs.val[index]; } INLINE RealPt RealMakeSeg(SegNames index,Bit16u off) { diff --git a/src/cpu/core_dyn_x86/decoder.h b/src/cpu/core_dyn_x86/decoder.h index 61f04308..c7418d32 100644 --- a/src/cpu/core_dyn_x86/decoder.h +++ b/src/cpu/core_dyn_x86/decoder.h @@ -145,7 +145,7 @@ static Bit32u decode_fetchd(void) { #define START_WMMEM 64 -static void INLINE decode_increase_wmapmask(Bitu size) { +static INLINE void decode_increase_wmapmask(Bitu size) { Bitu mapidx; CacheBlock* activecb=decode.active_block; if (GCC_UNLIKELY(!activecb->cache.wmapmask)) { @@ -927,7 +927,7 @@ static void dyn_pop(DynReg * dynreg,bool checked=true) { } } -static void INLINE dyn_get_modrm(void) { +static INLINE void dyn_get_modrm(void) { decode.modrm.val=decode_fetchb(); decode.modrm.mod=(decode.modrm.val >> 6) & 3; decode.modrm.reg=(decode.modrm.val >> 3) & 7; @@ -1187,7 +1187,7 @@ static void dyn_mov_ebgb(void) { DynReg * rm_reg=&DynRegs[decode.modrm.reg&3];Bitu rm_regi=decode.modrm.reg&4; if (decode.modrm.mod<3) { dyn_fill_ea(); - dyn_write_byte_release(DREG(EA),rm_reg,rm_regi); + dyn_write_byte_release(DREG(EA),rm_reg,rm_regi==4); } else { gen_dop_byte(DOP_MOV,&DynRegs[decode.modrm.rm&3],decode.modrm.rm&4,rm_reg,rm_regi); } @@ -2594,7 +2594,6 @@ illegalopcode: dyn_closeblock(); goto finish_block; #if (C_DEBUG) -illegalopcodefull: dyn_set_eip_last(); dyn_reduce_cycles(); dyn_save_critical_regs(); diff --git a/src/cpu/core_dyn_x86/dyn_fpu_dh.h b/src/cpu/core_dyn_x86/dyn_fpu_dh.h index 267dbcd5..17af7d1f 100644 --- a/src/cpu/core_dyn_x86/dyn_fpu_dh.h +++ b/src/cpu/core_dyn_x86/dyn_fpu_dh.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dyn_fpu_dh.h,v 1.2 2006-11-11 14:42:38 c2woody Exp $ */ +/* $Id: dyn_fpu_dh.h,v 1.3 2007-06-12 20:22:07 c2woody Exp $ */ #include "dosbox.h" #if C_FPU @@ -65,7 +65,7 @@ static void FPU_FLDCW_DH(PhysPt addr){ } static void FPU_FNSTCW_DH(PhysPt addr){ - mem_writew(addr,dyn_dh_fpu.cw); + mem_writew(addr,(Bit16u)(dyn_dh_fpu.cw&0xffff)); } static void FPU_FNINIT_DH(void){ diff --git a/src/cpu/core_dyn_x86/risc_x86.h b/src/cpu/core_dyn_x86/risc_x86.h index d5f15bf7..94b79c70 100644 --- a/src/cpu/core_dyn_x86/risc_x86.h +++ b/src/cpu/core_dyn_x86/risc_x86.h @@ -163,7 +163,7 @@ static GenReg * FindDynReg(DynReg * dynreg,bool stale=false) { genreg->Load(dynreg,stale); return genreg; } - if (genreg->last_usedlast_used<(Bitu)first_used) { first_used=genreg->last_used; first_index=i; } @@ -176,7 +176,7 @@ static GenReg * FindDynReg(DynReg * dynreg,bool stale=false) { genreg->Load(dynreg,stale); return genreg; } - if (genreg->last_usedlast_used<(Bitu)first_used) { first_used=genreg->last_used; first_index=i; } diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp index ad9a8b11..fd4e6d61 100644 --- a/src/cpu/cpu.cpp +++ b/src/cpu/cpu.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: cpu.cpp,v 1.101 2007-06-02 11:47:05 c2woody Exp $ */ +/* $Id: cpu.cpp,v 1.102 2007-06-12 20:22:07 c2woody Exp $ */ #include #include @@ -94,7 +94,7 @@ void CPU_Core_Dynrec_Cache_Close(void); #if defined(CPU_CHECK_IGNORE) #define CPU_CHECK_COND(cond,msg,exc,sel) { \ - cond; \ + if (cond) do {} while (0); \ } #elif defined(CPU_CHECK_EXCEPT) #define CPU_CHECK_COND(cond,msg,exc,sel) { \ diff --git a/src/debug/debug.cpp b/src/debug/debug.cpp index 8a24e221..4bfec5db 100644 --- a/src/debug/debug.cpp +++ b/src/debug/debug.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: debug.cpp,v 1.87 2007-06-01 16:40:40 c2woody Exp $ */ +/* $Id: debug.cpp,v 1.88 2007-06-12 20:22:07 c2woody Exp $ */ #include "dosbox.h" #if C_DEBUG @@ -2209,12 +2209,12 @@ void DEBUG_HeavyLogInstruction(void) { inst.s_fs = SegValue(fs); inst.s_gs = SegValue(gs); inst.s_ss = SegValue(ss); - inst.c = get_CF(); - inst.z = get_ZF(); - inst.s = get_SF(); - inst.o = get_OF(); - inst.a = get_AF(); - inst.p = get_PF(); + inst.c = get_CF()>0; + inst.z = get_ZF()>0; + inst.s = get_SF()>0; + inst.o = get_OF()>0; + inst.a = get_AF()>0; + inst.p = get_PF()>0; inst.i = GETFLAGBOOL(IF); if (++logCount >= LOGCPUMAX) logCount = 0; diff --git a/src/dos/cdrom_aspi_win32.cpp b/src/dos/cdrom_aspi_win32.cpp index 64c97f40..1da3ba23 100644 --- a/src/dos/cdrom_aspi_win32.cpp +++ b/src/dos/cdrom_aspi_win32.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: cdrom_aspi_win32.cpp,v 1.17 2007-01-08 19:45:39 qbix79 Exp $ */ +/* $Id: cdrom_aspi_win32.cpp,v 1.18 2007-06-12 20:22:07 c2woody Exp $ */ #if defined (WIN32) @@ -148,7 +148,6 @@ bool CDROM_Interface_Aspi::ScanRegistryFindKey(HKEY& hKeyBase) ULONG result,newKeyResult; char subKey[256]; char buffer[256]; - ULONG bufferSize = 256; ULONG subKeySize = 256; HKEY hNewKey; @@ -596,7 +595,6 @@ bool CDROM_Interface_Aspi::GetUPC(unsigned char& attr, char* upcdata) // attr = (upc.ADR<<4) | upc.Control; attr = 0; - int pos = 0; // Convert to mscdex format for (int i=0; i<7; i++) upcdata[i] = upc.MediaCatalog[i]; for (int i=0; i<7; i++) upcdata[i] = (upc.MediaCatalog[i*2] << 4) | (upc.MediaCatalog[i*2+1] & 0x0F); diff --git a/src/dos/cdrom_image.cpp b/src/dos/cdrom_image.cpp index 7f6a6713..5cf0b764 100644 --- a/src/dos/cdrom_image.cpp +++ b/src/dos/cdrom_image.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: cdrom_image.cpp,v 1.15 2007-02-22 08:36:25 qbix79 Exp $ */ +/* $Id: cdrom_image.cpp,v 1.16 2007-06-12 20:22:08 c2woody Exp $ */ #include #include @@ -190,7 +190,7 @@ bool CDROM_Interface_Image::GetAudioTracks(int& stTrack, int& end, TMSF& leadOut bool CDROM_Interface_Image::GetAudioTrackInfo(int track, TMSF& start, unsigned char& attr) { - if (track < 1 || track > tracks.size()) return false; + if (track < 1 || track > (int)tracks.size()) return false; FRAMES_TO_MSF(tracks[track - 1].start + 150, &start.min, &start.sec, &start.fr); attr = tracks[track - 1].attr; return true; @@ -254,7 +254,7 @@ bool CDROM_Interface_Image::ReadSectors(PhysPt buffer, bool raw, unsigned long s Bit8u* buf = new Bit8u[buflen]; bool success = true; //Gobliiins reads 0 sectors - for(int i = 0; i < num; i++) { + for(unsigned long i = 0; i < num; i++) { success = ReadSector(&buf[i * sectorSize], raw, sector + i); if (!success) break; } @@ -308,7 +308,7 @@ void CDROM_Interface_Image::CDAudioCallBack(Bitu len) } SDL_mutexP(player.mutex); - while (player.bufLen < len) { + while (player.bufLen < (Bits)len) { bool success; if (player.targetFrame > player.currFrame) success = player.cd->ReadSector(&player.buffer[player.bufLen], true, player.currFrame); @@ -607,7 +607,7 @@ bool CDROM_Interface_Image::GetRealFileName(string &filename, string &pathname) bool CDROM_Interface_Image::GetCueKeyword(string &keyword, istream &in) { in >> keyword; - for(int i = 0; i < keyword.size(); i++) keyword[i] = toupper(keyword[i]); + for(Bitu i = 0; i < keyword.size(); i++) keyword[i] = toupper(keyword[i]); return true; } diff --git a/src/dos/dos.cpp b/src/dos/dos.cpp index 5cc538ce..fbc8d81a 100644 --- a/src/dos/dos.cpp +++ b/src/dos/dos.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos.cpp,v 1.100 2007-04-16 12:23:23 c2woody Exp $ */ +/* $Id: dos.cpp,v 1.101 2007-06-12 20:22:08 c2woody Exp $ */ #include #include @@ -45,11 +45,11 @@ void DOS_SetError(Bit16u code) { #define DATA_TRANSFERS_TAKE_CYCLES 1 #ifdef DATA_TRANSFERS_TAKE_CYCLES #include "cpu.h" -static inline void modify_cycles(Bitu value) { +static inline void modify_cycles(Bits value) { if((4*value+5) < CPU_Cycles) CPU_Cycles -= 4*value; else CPU_Cycles = 5; } #else -static inline void modify_cycles(Bitu /* value */) { +static inline void modify_cycles(Bits /* value */) { return; } #endif diff --git a/src/dos/dos_classes.cpp b/src/dos/dos_classes.cpp index 1a35be3b..804998ee 100644 --- a/src/dos/dos_classes.cpp +++ b/src/dos/dos_classes.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_classes.cpp,v 1.50 2007-05-29 13:36:45 qbix79 Exp $ */ +/* $Id: dos_classes.cpp,v 1.51 2007-06-12 20:22:08 c2woody Exp $ */ #include #include @@ -179,7 +179,7 @@ Bit16u DOS_PSP::rootpsp = 0; void DOS_PSP::MakeNew(Bit16u mem_size) { /* get previous */ - DOS_PSP prevpsp(dos.psp()); +// DOS_PSP prevpsp(dos.psp()); /* Clear it first */ Bitu i; for (i=0;i #include @@ -124,7 +124,7 @@ bool DOS_MakeName(char * name,char * fullname,Bit8u * drive) { Bit32s iDown, cDots; bool dots = true; - Bit32u templen =strlen(tempdir); + Bit32s templen=(Bit32s)strlen(tempdir); for(iDown=0;(iDown < templen) && dots;iDown++) if(tempdir[iDown] != '.') dots = false; @@ -133,7 +133,7 @@ bool DOS_MakeName(char * name,char * fullname,Bit8u * drive) { cDots = templen - 1; if(dots && (cDots > 0)) { - for(iDown=strlen(fullname)-1;iDown>=0;iDown--) + for(iDown=(Bit32s)strlen(fullname)-1;iDown>=0;iDown--) { if(fullname[iDown]=='\\' || iDown==0) { @@ -935,7 +935,8 @@ Bit8u DOS_FCBRandomRead(Bit16u seg,Bit16u offset,Bit16u numRec,bool restore) { */ DOS_FCB fcb(seg,offset); - Bit32u random;Bit16u old_block;Bit8u old_rec;Bit8u error; + Bit32u random;Bit16u old_block;Bit8u old_rec; + Bit8u error=0; /* Set the correct record from the random data */ fcb.GetRandom(random); @@ -957,7 +958,8 @@ Bit8u DOS_FCBRandomRead(Bit16u seg,Bit16u offset,Bit16u numRec,bool restore) { Bit8u DOS_FCBRandomWrite(Bit16u seg,Bit16u offset,Bit16u numRec,bool restore) { /* see FCB_RandomRead */ DOS_FCB fcb(seg,offset); - Bit32u random;Bit16u old_block;Bit8u old_rec;Bit8u error; + Bit32u random;Bit16u old_block;Bit8u old_rec; + Bit8u error=0; /* Set the correct record from the random data */ fcb.GetRandom(random); diff --git a/src/dos/dos_mscdex.cpp b/src/dos/dos_mscdex.cpp index cab04d47..e1cf3784 100644 --- a/src/dos/dos_mscdex.cpp +++ b/src/dos/dos_mscdex.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_mscdex.cpp,v 1.46 2007-04-15 11:39:33 c2woody Exp $ */ +/* $Id: dos_mscdex.cpp,v 1.47 2007-06-12 20:22:08 c2woody Exp $ */ #include #include @@ -321,11 +321,11 @@ int CMscdex::AddDrive(Bit16u _drive, char* physicalPath, Bit8u& subUnit) //Link it in the device chain Bit32u start = dos_infoblock.GetDeviceChain(); - Bit16u segm = start>>16; - Bit16u offm = start&0xFFFF; + Bit16u segm = (Bit16u)(start>>16); + Bit16u offm = (Bit16u)(start&0xFFFF); while(start != 0xFFFFFFFF) { - segm = start>>16; - offm = start&0xFFFF; + segm = (Bit16u)(start>>16); + offm = (Bit16u)(start&0xFFFF); start = real_readd(segm,offm); } real_writed(segm,offm,seg<<16); diff --git a/src/dos/dos_programs.cpp b/src/dos/dos_programs.cpp index a1176c0e..61504b47 100644 --- a/src/dos/dos_programs.cpp +++ b/src/dos/dos_programs.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_programs.cpp,v 1.73 2007-06-04 18:09:27 qbix79 Exp $ */ +/* $Id: dos_programs.cpp,v 1.74 2007-06-12 20:22:08 c2woody Exp $ */ #include "dosbox.h" #include @@ -1105,7 +1105,9 @@ public: MSCDEX_SetCDInterface(CDROM_USE_SDL, -1); // create new drives for all images std::vector isoDisks; - for (int i = 0; i < paths.size(); i++) { + std::vector::size_type i; + std::vector::size_type ct; + for (i = 0; i < paths.size(); i++) { int error = -1; DOS_Drive* newDrive = new isoDrive(drive, paths[i].c_str(), mediaid, error); isoDisks.push_back(newDrive); @@ -1121,15 +1123,15 @@ public: } // error: clean up and leave if (error) { - for(int i = 0; i < isoDisks.size(); i++) { - delete isoDisks[i]; + for(ct = 0; ct < isoDisks.size(); ct++) { + delete isoDisks[ct]; } return; } } // Update DriveManager - for(int i = 0; i < isoDisks.size(); i++) { - DriveManager::AppendDisk(drive - 'A', isoDisks[i]); + for(ct = 0; ct < isoDisks.size(); ct++) { + DriveManager::AppendDisk(drive - 'A', isoDisks[ct]); } DriveManager::InitializeDrive(drive - 'A'); @@ -1139,7 +1141,7 @@ public: // Print status message (success) WriteOut(MSG_Get("MSCDEX_SUCCESS")); std::string tmp(paths[0]); - for (int i = 1; i < paths.size(); i++) { + for (i = 1; i < paths.size(); i++) { tmp += "; " + paths[i]; } WriteOut(MSG_Get("PROGRAM_MOUNT_STATUS_2"), drive, tmp.c_str()); diff --git a/src/dos/dos_tables.cpp b/src/dos/dos_tables.cpp index e8a4b26e..3f2546ac 100644 --- a/src/dos/dos_tables.cpp +++ b/src/dos/dos_tables.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_tables.cpp,v 1.27 2007-06-06 15:44:40 c2woody Exp $ */ +/* $Id: dos_tables.cpp,v 1.28 2007-06-12 20:22:08 c2woody Exp $ */ #include "dosbox.h" #include "mem.h" @@ -73,7 +73,7 @@ static Bit8u country_info[0x22] = { }; void DOS_SetupTables(void) { - Bit16u seg,seg2;Bitu i; + Bit16u seg;Bitu i; dos.tables.mediaid=RealMake(DOS_GetMemory(4),0); dos.tables.tempdta=RealMake(DOS_GetMemory(4),0); dos.tables.tempdta_fcbdelete=RealMake(DOS_GetMemory(4),0); diff --git a/src/dos/drive_cache.cpp b/src/dos/drive_cache.cpp index c0f22057..be28b824 100644 --- a/src/dos/drive_cache.cpp +++ b/src/dos/drive_cache.cpp @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: drive_cache.cpp,v 1.49 2007-01-08 19:45:39 qbix79 Exp $ */ +/* $Id: drive_cache.cpp,v 1.50 2007-06-12 20:22:08 c2woody Exp $ */ #include "drives.h" #include "dos_inc.h" @@ -242,7 +242,7 @@ void DOS_Drive_Cache::AddEntry(const char* path, bool checkExists) Bit32u i; // Check if there are any open search dir that are affected by this... if (dir) for (i=0; inextEntry)) + if ((dirSearch[i]==dir) && ((Bit32u)index<=dirSearch[i]->nextEntry)) dirSearch[i]->nextEntry++; } }; @@ -378,7 +378,7 @@ Bit16u DOS_Drive_Cache::CreateShortNameID(CFileInfo* curDir, const char* name) do { foundNr = curDir->longNameList[mid]->shortNr; mid++; - } while(midlongNameList.size() && (CompareShortname(name,curDir->longNameList[mid]->shortname)==0)); + } while((Bitu)midlongNameList.size() && (CompareShortname(name,curDir->longNameList[mid]->shortname)==0)); break; }; } diff --git a/src/dos/drive_fat.cpp b/src/dos/drive_fat.cpp index 4b532584..e21e7847 100644 --- a/src/dos/drive_fat.cpp +++ b/src/dos/drive_fat.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: drive_fat.cpp,v 1.20 2007-01-08 19:45:39 qbix79 Exp $ */ +/* $Id: drive_fat.cpp,v 1.21 2007-06-12 20:22:08 c2woody Exp $ */ #include #include @@ -408,6 +408,7 @@ bool fatDrive::getFileDirEntry(char * filename, direntry * useEntry, Bit32u * di char * findDir; char * findFile; strcpy(dirtoken,filename); + findFile=dirtoken; /* Skip if testing in root directory */ if ((len>0) && (filename[len-1]!='\\')) { diff --git a/src/dos/drive_iso.cpp b/src/dos/drive_iso.cpp index dd5ec85b..dc1eec41 100644 --- a/src/dos/drive_iso.cpp +++ b/src/dos/drive_iso.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: drive_iso.cpp,v 1.17 2007-01-21 16:21:22 c2woody Exp $ */ +/* $Id: drive_iso.cpp,v 1.18 2007-06-12 20:22:08 c2woody Exp $ */ #include #include @@ -65,11 +65,11 @@ isoFile::isoFile(isoDrive *drive, const char *name, FileStat_Block *stat, Bit32u bool isoFile::Read(Bit8u *data, Bit16u *size) { if (filePos + *size > fileEnd) - *size = fileEnd - filePos; + *size = (Bit16u)(fileEnd - filePos); Bit16u nowSize = 0; int sector = filePos / ISO_FRAMESIZE; - Bit16u sectorPos = filePos % ISO_FRAMESIZE; + Bit16u sectorPos = (Bit16u)(filePos % ISO_FRAMESIZE); if (sector != cachedSector) { if (drive->readSector(buffer, sector)) cachedSector = sector; @@ -272,7 +272,7 @@ bool isoDrive::FindFirst(char *dir, DOS_DTA &dta, bool fcb_findfirst) } // get a directory iterator and save its id in the dta - dta.SetDirID(GetDirIterator(&de)); + dta.SetDirID((Bit16u)GetDirIterator(&de)); Bit8u attr; char pattern[ISO_MAXPATHNAME]; @@ -532,7 +532,7 @@ bool isoDrive :: loadImage() isoPVD pvd; readSector((Bit8u*)(&pvd), ISO_FIRST_VD); if (pvd.type != 1 || strncmp((char*)pvd.standardIdent, "CD001", 5) || pvd.version != 1) return false; - return (readDirEntry(&this->rootEntry, pvd.rootEntry)); + return (readDirEntry(&this->rootEntry, pvd.rootEntry)>0); } bool isoDrive :: lookup(isoDirEntry *de, const char *path) diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp index f25f3805..d86ab4e3 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: sdlmain.cpp,v 1.130 2007-06-03 10:59:46 c2woody Exp $ */ +/* $Id: sdlmain.cpp,v 1.131 2007-06-12 20:22:08 c2woody Exp $ */ #ifndef _GNU_SOURCE #define _GNU_SOURCE @@ -281,6 +281,7 @@ check_surface: else if (flags & GFX_LOVE_15) testbpp=15; else if (flags & GFX_LOVE_16) testbpp=16; else if (flags & GFX_LOVE_32) testbpp=32; + else testbpp=0; check_gotbpp: if (sdl.desktop.fullscreen) gotbpp=SDL_VideoModeOK(640,480,testbpp,SDL_FULLSCREEN|SDL_HWSURFACE|SDL_HWPALETTE); else gotbpp=sdl.desktop.bpp; @@ -398,7 +399,7 @@ Bitu GFX_SetSize(Bitu width,Bitu height,Bitu flags,double scalex,double scaley,G sdl.draw.scalex=scalex; sdl.draw.scaley=scaley; - Bitu bpp; + Bitu bpp=0; Bitu retFlags = 0; if (sdl.blit.surface) { @@ -1146,7 +1147,11 @@ void Mouse_AutoLock(bool enable) { static void HandleMouseMotion(SDL_MouseMotionEvent * motion) { if (sdl.mouse.locked || !sdl.mouse.autoenable) - Mouse_CursorMoved((float)motion->xrel*sdl.mouse.sensitivity/100,(float)motion->yrel*sdl.mouse.sensitivity/100,(float)(motion->x-sdl.clip.x)/(sdl.clip.w-1)*sdl.mouse.sensitivity/100,(float)(motion->y-sdl.clip.y)/(sdl.clip.h-1)*sdl.mouse.sensitivity/100.0,sdl.mouse.locked); + Mouse_CursorMoved((float)motion->xrel*sdl.mouse.sensitivity/100.0f, + (float)motion->yrel*sdl.mouse.sensitivity/100.0f, + (float)(motion->x-sdl.clip.x)/(sdl.clip.w-1)*sdl.mouse.sensitivity/100.0f, + (float)(motion->y-sdl.clip.y)/(sdl.clip.h-1)*sdl.mouse.sensitivity/100.0f, + sdl.mouse.locked); } static void HandleMouseButton(SDL_MouseButtonEvent * button) { @@ -1196,7 +1201,7 @@ void GFX_Events() { SDL_Event event; #if defined (REDUCE_JOYSTICK_POLLING) static int poll_delay=0; - int time=SDL_GetTicks(); + int time=GetTicks(); if (time-poll_delay>20) { poll_delay=time; if (sdl.num_joysticks>0) SDL_JoystickUpdate(); diff --git a/src/hardware/fmopl.c b/src/hardware/fmopl.c index 94274475..9e1500a6 100644 --- a/src/hardware/fmopl.c +++ b/src/hardware/fmopl.c @@ -329,51 +329,51 @@ static const int slot_array[32]= /* key scale level */ /* table is 3dB/octave , DV converts this into 6dB/octave */ /* 0.1875 is bit 0 weight of the envelope counter (volume) expressed in the 'decibel' scale */ -#define DV (0.1875/2.0) +#define SC(x) ((UINT32)((x)/(0.1875/2.0))) static const UINT32 ksl_tab[8*16]= { /* OCT 0 */ - 0.000/DV, 0.000/DV, 0.000/DV, 0.000/DV, - 0.000/DV, 0.000/DV, 0.000/DV, 0.000/DV, - 0.000/DV, 0.000/DV, 0.000/DV, 0.000/DV, - 0.000/DV, 0.000/DV, 0.000/DV, 0.000/DV, + SC(0.000), SC(0.000), SC(0.000), SC(0.000), + SC(0.000), SC(0.000), SC(0.000), SC(0.000), + SC(0.000), SC(0.000), SC(0.000), SC(0.000), + SC(0.000), SC(0.000), SC(0.000), SC(0.000), /* OCT 1 */ - 0.000/DV, 0.000/DV, 0.000/DV, 0.000/DV, - 0.000/DV, 0.000/DV, 0.000/DV, 0.000/DV, - 0.000/DV, 0.750/DV, 1.125/DV, 1.500/DV, - 1.875/DV, 2.250/DV, 2.625/DV, 3.000/DV, + SC(0.000), SC(0.000), SC(0.000), SC(0.000), + SC(0.000), SC(0.000), SC(0.000), SC(0.000), + SC(0.000), SC(0.750), SC(1.125), SC(1.500), + SC(1.875), SC(2.250), SC(2.625), SC(3.000), /* OCT 2 */ - 0.000/DV, 0.000/DV, 0.000/DV, 0.000/DV, - 0.000/DV, 1.125/DV, 1.875/DV, 2.625/DV, - 3.000/DV, 3.750/DV, 4.125/DV, 4.500/DV, - 4.875/DV, 5.250/DV, 5.625/DV, 6.000/DV, + SC(0.000), SC(0.000), SC(0.000), SC(0.000), + SC(0.000), SC(1.125), SC(1.875), SC(2.625), + SC(3.000), SC(3.750), SC(4.125), SC(4.500), + SC(4.875), SC(5.250), SC(5.625), SC(6.000), /* OCT 3 */ - 0.000/DV, 0.000/DV, 0.000/DV, 1.875/DV, - 3.000/DV, 4.125/DV, 4.875/DV, 5.625/DV, - 6.000/DV, 6.750/DV, 7.125/DV, 7.500/DV, - 7.875/DV, 8.250/DV, 8.625/DV, 9.000/DV, + SC(0.000), SC(0.000), SC(0.000), SC(1.875), + SC(3.000), SC(4.125), SC(4.875), SC(5.625), + SC(6.000), SC(6.750), SC(7.125), SC(7.500), + SC(7.875), SC(8.250), SC(8.625), SC(9.000), /* OCT 4 */ - 0.000/DV, 0.000/DV, 3.000/DV, 4.875/DV, - 6.000/DV, 7.125/DV, 7.875/DV, 8.625/DV, - 9.000/DV, 9.750/DV,10.125/DV,10.500/DV, - 10.875/DV,11.250/DV,11.625/DV,12.000/DV, + SC(0.000), SC(0.000), SC(3.000), SC(4.875), + SC(6.000), SC(7.125), SC(7.875), SC(8.625), + SC(9.000), SC(9.750),SC(10.125),SC(10.500), + SC(10.875),SC(11.250),SC(11.625),SC(12.000), /* OCT 5 */ - 0.000/DV, 3.000/DV, 6.000/DV, 7.875/DV, - 9.000/DV,10.125/DV,10.875/DV,11.625/DV, - 12.000/DV,12.750/DV,13.125/DV,13.500/DV, - 13.875/DV,14.250/DV,14.625/DV,15.000/DV, + SC(0.000), SC(3.000), SC(6.000), SC(7.875), + SC(9.000),SC(10.125),SC(10.875),SC(11.625), + SC(12.000),SC(12.750),SC(13.125),SC(13.500), + SC(13.875),SC(14.250),SC(14.625),SC(15.000), /* OCT 6 */ - 0.000/DV, 6.000/DV, 9.000/DV,10.875/DV, - 12.000/DV,13.125/DV,13.875/DV,14.625/DV, - 15.000/DV,15.750/DV,16.125/DV,16.500/DV, - 16.875/DV,17.250/DV,17.625/DV,18.000/DV, + SC(0.000), SC(6.000), SC(9.000),SC(10.875), + SC(12.000),SC(13.125),SC(13.875),SC(14.625), + SC(15.000),SC(15.750),SC(16.125),SC(16.500), + SC(16.875),SC(17.250),SC(17.625),SC(18.000), /* OCT 7 */ - 0.000/DV, 9.000/DV,12.000/DV,13.875/DV, - 15.000/DV,16.125/DV,16.875/DV,17.625/DV, - 18.000/DV,18.750/DV,19.125/DV,19.500/DV, - 19.875/DV,20.250/DV,20.625/DV,21.000/DV + SC(0.000), SC(9.000),SC(12.000),SC(13.875), + SC(15.000),SC(16.125),SC(16.875),SC(17.625), + SC(18.000),SC(18.750),SC(19.125),SC(19.500), + SC(19.875),SC(20.250),SC(20.625),SC(21.000) }; -#undef DV +#undef SC /* sustain level table (3dB per step) */ /* 0 - 15: 0, 3, 6, 9,12,15,18,21,24,27,30,33,36,39,42,93 (dB)*/ @@ -493,13 +493,13 @@ O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0), /* multiple table */ -#define ML 2 +#define SC(x) ((UINT32)((x)*2)) static const UINT8 mul_tab[16]= { /* 1/2, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,10,12,12,15,15 */ - 0.50*ML, 1.00*ML, 2.00*ML, 3.00*ML, 4.00*ML, 5.00*ML, 6.00*ML, 7.00*ML, - 8.00*ML, 9.00*ML,10.00*ML,10.00*ML,12.00*ML,12.00*ML,15.00*ML,15.00*ML + SC(0.50), SC(1.00), SC(2.00), SC(3.00), SC(4.00), SC(5.00), SC(6.00), SC(7.00), + SC(8.00), SC(9.00),SC(10.00),SC(10.00),SC(12.00),SC(12.00),SC(15.00),SC(15.00) }; -#undef ML +#undef SC /* TL_TAB_LEN is calculated as: * 12 - sinus amplitude bits (Y axis) @@ -1301,17 +1301,17 @@ static void OPL_initalize(FM_OPL *OPL) /* Amplitude modulation: 27 output levels (triangle waveform); 1 level takes one of: 192, 256 or 448 samples */ /* One entry from LFO_AM_TABLE lasts for 64 samples */ - OPL->lfo_am_inc = (1.0 / 64.0 ) * (1<freqbase; + OPL->lfo_am_inc = (UINT32)((1.0 / 64.0 ) * (1<freqbase); /* Vibrato: 8 output levels (triangle waveform); 1 level takes 1024 samples */ - OPL->lfo_pm_inc = (1.0 / 1024.0) * (1<freqbase; + OPL->lfo_pm_inc = (UINT32)((1.0 / 1024.0) * (1<freqbase); /*logerror ("OPL->lfo_am_inc = %8x ; OPL->lfo_pm_inc = %8x\n", OPL->lfo_am_inc, OPL->lfo_pm_inc);*/ /* Noise generator: a step takes 1 sample */ - OPL->noise_f = (1.0 / 1.0) * (1<freqbase; + OPL->noise_f = (UINT32)((1.0 / 1.0) * (1<freqbase); - OPL->eg_timer_add = (1<freqbase; + OPL->eg_timer_add = (UINT32)((1<freqbase); OPL->eg_timer_overflow = ( 1 ) * (1<eg_timer_add, OPL->eg_timer_overflow);*/ diff --git a/src/hardware/iohandler.cpp b/src/hardware/iohandler.cpp index adcff0b7..4de2561a 100644 --- a/src/hardware/iohandler.cpp +++ b/src/hardware/iohandler.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: iohandler.cpp,v 1.27 2007-06-01 16:40:40 c2woody Exp $ */ +/* $Id: iohandler.cpp,v 1.28 2007-06-12 20:22:08 c2woody Exp $ */ #include #include "dosbox.h" @@ -174,7 +174,7 @@ static Bits IOFaultCore(void) { inline void IO_USEC_read_delay_old() { if(CPU_CycleMax > static_cast((IODELAY_READ_MICROS*1000.0))) { // this could be calculated whenever CPU_CycleMax changes - Bitu delaycyc = static_cast((CPU_CycleMax/1000)*IODELAY_READ_MICROS); + Bits delaycyc = static_cast((CPU_CycleMax/1000)*IODELAY_READ_MICROS); if(CPU_Cycles > delaycyc) CPU_Cycles -= delaycyc; else CPU_Cycles = 0; } @@ -183,7 +183,7 @@ inline void IO_USEC_read_delay_old() { inline void IO_USEC_write_delay_old() { if(CPU_CycleMax > static_cast((IODELAY_WRITE_MICROS*1000.0))) { // this could be calculated whenever CPU_CycleMax changes - Bitu delaycyc = static_cast((CPU_CycleMax/1000)*IODELAY_WRITE_MICROS); + Bits delaycyc = static_cast((CPU_CycleMax/1000)*IODELAY_WRITE_MICROS); if(CPU_Cycles > delaycyc) CPU_Cycles -= delaycyc; else CPU_Cycles = 0; } @@ -194,14 +194,14 @@ inline void IO_USEC_write_delay_old() { #define IODELAY_WRITE_MICROSk (Bit32u)(1024/0.75) inline void IO_USEC_read_delay() { - Bitu delaycyc = CPU_CycleMax/IODELAY_READ_MICROSk; + Bits delaycyc = CPU_CycleMax/IODELAY_READ_MICROSk; if(GCC_UNLIKELY(CPU_Cycles < 3*delaycyc)) delaycyc = 0; //Else port acces will set cycles to 0. which might trigger problem with games which read 16 bit values CPU_Cycles -= delaycyc; CPU_IODelayRemoved += delaycyc; } inline void IO_USEC_write_delay() { - Bitu delaycyc = CPU_CycleMax/IODELAY_WRITE_MICROSk; + Bits delaycyc = CPU_CycleMax/IODELAY_WRITE_MICROSk; if(GCC_UNLIKELY(CPU_Cycles < 3*delaycyc)) delaycyc=0; CPU_Cycles -= delaycyc; CPU_IODelayRemoved += delaycyc; diff --git a/src/hardware/keyboard.cpp b/src/hardware/keyboard.cpp index ab23ade3..bc4ef238 100644 --- a/src/hardware/keyboard.cpp +++ b/src/hardware/keyboard.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: keyboard.cpp,v 1.38 2007-06-08 08:21:45 qbix79 Exp $ */ +/* $Id: keyboard.cpp,v 1.39 2007-06-12 20:22:08 c2woody Exp $ */ #include "dosbox.h" #include "keyboard.h" @@ -66,7 +66,6 @@ static void KEYBOARD_TransferBuffer(Bitu val) { LOG(LOG_KEYBOARD,LOG_NORMAL)("Transfer started with empty buffer"); return; } - Bit8u data=keyb.buffer[keyb.pos]; KEYBOARD_SetPort60(keyb.buffer[keyb.pos]); if (++keyb.pos>=KEYBUFSIZE) keyb.pos-=KEYBUFSIZE; keyb.used--; diff --git a/src/hardware/mixer.cpp b/src/hardware/mixer.cpp index f89a6fba..4be4072d 100644 --- a/src/hardware/mixer.cpp +++ b/src/hardware/mixer.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: mixer.cpp,v 1.45 2007-05-01 18:57:19 c2woody Exp $ */ +/* $Id: mixer.cpp,v 1.46 2007-06-12 20:22:08 c2woody Exp $ */ /* Remove the sdl code from here and have it handeld in the sdlmain. @@ -595,7 +595,7 @@ void MIXER_Init(Section* sec) { spec.channels=2; spec.callback=MIXER_CallBack; spec.userdata=NULL; - spec.samples=mixer.blocksize; + spec.samples=(Uint16)mixer.blocksize; mixer.tick_remain=0; if (mixer.nosound) { diff --git a/src/hardware/pic.cpp b/src/hardware/pic.cpp index f7c11ca5..f44037b1 100644 --- a/src/hardware/pic.cpp +++ b/src/hardware/pic.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: pic.cpp,v 1.40 2007-04-16 13:25:06 c2woody Exp $ */ +/* $Id: pic.cpp,v 1.41 2007-06-12 20:22:08 c2woody Exp $ */ #include @@ -83,7 +83,7 @@ static void write_command(Bitu port,Bitu val,Bitu iolen) { if (val&0x04) E_Exit("PIC: 4 byte interval not handled"); if (val&0x08) E_Exit("PIC: level triggered mode not handled"); if (val&0xe0) E_Exit("PIC: 8080/8085 mode not handled"); - pic->single=val&0x02; + pic->single=(val&0x02)==0x02; pic->icw_index=1; // next is ICW2 pic->icw_words=2 + (val&0x01); // =3 if ICW4 needed } else if (GCC_UNLIKELY(val&0x08)) { // OCW3 issued @@ -118,7 +118,7 @@ static void write_command(Bitu port,Bitu val,Bitu iolen) { } } } - if (val&0x80); // perform rotation +// if (val&0x80); // perform rotation } else { // nonspecific EOI if (PIC_IRQActive<(irq_base+8)) { irqs[PIC_IRQActive].inservice=false; @@ -130,7 +130,7 @@ static void write_command(Bitu port,Bitu val,Bitu iolen) { } } } - if (val&0x80); // perform rotation +// if (val&0x80); // perform rotation } } else { if ((val&0x40)==0) { // rotate in auto EOI mode @@ -232,7 +232,6 @@ static Bitu read_command(Bitu port,Bitu iolen) { } static Bitu read_data(Bitu port,Bitu iolen) { - PIC_Controller * pic=&pics[port==0x21 ? 0 : 1]; Bitu irq_base=(port==0x21) ? 0 : 8; Bitu i;Bit8u ret=0;Bit8u b=1; for (i=irq_base;i<=irq_base+7;i++) { @@ -387,7 +386,7 @@ void PIC_AddEvent(PIC_EventHandler handler,float delay,Bitu val) { return; } PICEntry * entry=pic.free_entry; - entry->index=delay+PIC_TickIndex();; + entry->index=delay+PIC_TickIndex(); entry->event=handler; entry->value=val; pic.free_entry=pic.free_entry->next; diff --git a/src/hardware/serialport/misc_util.cpp b/src/hardware/serialport/misc_util.cpp index 97379094..9968cd9b 100644 --- a/src/hardware/serialport/misc_util.cpp +++ b/src/hardware/serialport/misc_util.cpp @@ -233,7 +233,7 @@ bool TCPClientSocket::SendArrayBuffered(Bit8u* data, Bitu bufsize) { while( // first case, buffer already full - /*if(sendbufferindex==(sendbuffersize-1)) { + if(sendbufferindex==(sendbuffersize-1)) { // buffer is full, get rid of it sendbuffer[sendbufferindex]=data; sendbufferindex=0; @@ -242,9 +242,9 @@ bool TCPClientSocket::SendArrayBuffered(Bit8u* data, Bitu bufsize) { isopen=false; return false; } - }*/ -//} - + } +} +*/ void TCPClientSocket::FlushBuffer() { if(sendbufferindex) { if(SDLNet_TCP_Send(mysock, sendbuffer, diff --git a/src/hardware/timer.cpp b/src/hardware/timer.cpp index 8075980a..0341bd4e 100644 --- a/src/hardware/timer.cpp +++ b/src/hardware/timer.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: timer.cpp,v 1.43 2007-06-08 08:21:45 qbix79 Exp $ */ +/* $Id: timer.cpp,v 1.44 2007-06-12 20:22:08 c2woody Exp $ */ #include #include "dosbox.h" @@ -69,7 +69,7 @@ static void PIT0_Event(Bitu /*val*/) { if (pit[0].mode != 0) { pit[0].start += pit[0].delay; double error = pit[0].start - PIC_FullIndex(); - PIC_AddEvent(PIT0_Event,pit[0].delay + error); + PIC_AddEvent(PIT0_Event,(float)(pit[0].delay + error)); } } diff --git a/src/hardware/vga.cpp b/src/hardware/vga.cpp index b6d0f661..f8e4d953 100644 --- a/src/hardware/vga.cpp +++ b/src/hardware/vga.cpp @@ -84,7 +84,8 @@ void VGA_SetClock(Bitu which,Bitu target) { Bits err; } best; best.err=target; - Bitu n,m,r; + Bitu n,r; + Bits m; for (r = 0; r <= 3; r++) { Bitu f_vco = target * (1 << r); diff --git a/src/hardware/vga_dac.cpp b/src/hardware/vga_dac.cpp index 9aee8848..955a6cb6 100644 --- a/src/hardware/vga_dac.cpp +++ b/src/hardware/vga_dac.cpp @@ -139,6 +139,7 @@ static void write_p3c9(Bitu port,Bitu val,Bitu iolen) { break; default: LOG(LOG_VGAGFX,LOG_NORMAL)("VGA:DAC:Illegal Pel Index"); //If this can actually happen that will be the day + break; }; } @@ -161,6 +162,8 @@ static Bitu read_p3c9(Bitu port,Bitu iolen) { break; default: LOG(LOG_VGAMISC,LOG_NORMAL)("VGA:DAC:Illegal Pel Index"); //If this can actually happen that will be the day + ret=0; + break; } return ret; } diff --git a/src/hardware/vga_draw.cpp b/src/hardware/vga_draw.cpp index 6a79b16d..64f0baad 100644 --- a/src/hardware/vga_draw.cpp +++ b/src/hardware/vga_draw.cpp @@ -380,7 +380,7 @@ static Bit8u * VGA_Draw_LIN32_Line_HWMouse(Bitu vidstart, Bitu line) { static Bit32u FontMask[2]={0xffffffff,0x0}; static Bit8u * VGA_TEXT_Draw_Line(Bitu vidstart, Bitu line) { - Bitu font_addr; + Bits font_addr; Bit32u * draw=(Bit32u *)TempLine; const Bit8u *vidmem = &vga.tandy.draw_base[vidstart]; for (Bitu cx=0;cx> 1; - if (font_addr>=0 && font_addr=0 && font_addr<(Bits)vga.draw.blocks) { if (linevga.draw.cursor.eline) goto skip_cursor; draw=(Bit32u *)&TempLine[font_addr*8]; @@ -579,8 +579,8 @@ static void VGA_VerticalTimer(Bitu val) { break; } //VGA_DrawPart( vga.draw.parts_lines ); - PIC_AddEvent(VGA_DrawPart,vga.draw.delay.parts,vga.draw.parts_lines); -// PIC_AddEvent(VGA_DrawPart,vga.draw.delay.parts/2,vga.draw.parts_lines); //Else tearline in Tyrian and second reality + PIC_AddEvent(VGA_DrawPart,(float)vga.draw.delay.parts,vga.draw.parts_lines); +// PIC_AddEvent(VGA_DrawPart,(float)(vga.draw.delay.parts/2),vga.draw.parts_lines); //Else tearline in Tyrian and second reality } void VGA_CheckScanLength(void) { @@ -983,7 +983,7 @@ void VGA_SetupDrawing(Bitu val) { #endif RENDER_SetSize(width,height,bpp,fps,aspect_ratio,doublewidth,doubleheight); vga.draw.delay.framestart = PIC_FullIndex(); - PIC_AddEvent( VGA_VerticalTimer , vga.draw.delay.vtotal ); + PIC_AddEvent( VGA_VerticalTimer , (float)vga.draw.delay.vtotal ); } }; diff --git a/src/hardware/vga_memory.cpp b/src/hardware/vga_memory.cpp index 2588264e..19a573f3 100644 --- a/src/hardware/vga_memory.cpp +++ b/src/hardware/vga_memory.cpp @@ -96,6 +96,8 @@ INLINE static Bit32u ModeOperation(Bit8u val) { break; default: LOG(LOG_VGAMISC,LOG_NORMAL)("VGA:Unsupported write mode %d",vga.config.write_mode); + full=0; + break; } return full; } diff --git a/src/hardware/vga_misc.cpp b/src/hardware/vga_misc.cpp index 6ef43451..58ae7cd8 100644 --- a/src/hardware/vga_misc.cpp +++ b/src/hardware/vga_misc.cpp @@ -22,7 +22,6 @@ #include "vga.h" #include -static Bit8u flip=0; void vga_write_p3d4(Bitu port,Bitu val,Bitu iolen); Bitu vga_read_p3d4(Bitu port,Bitu iolen); diff --git a/src/hardware/ymf262.c b/src/hardware/ymf262.c index e9bd41f2..6e044fc6 100644 --- a/src/hardware/ymf262.c +++ b/src/hardware/ymf262.c @@ -280,51 +280,51 @@ static const int slot_array[32]= /* key scale level */ /* table is 3dB/octave , DV converts this into 6dB/octave */ /* 0.1875 is bit 0 weight of the envelope counter (volume) expressed in the 'decibel' scale */ -#define DV (0.1875/2.0) +#define SC(x) ((UINT32)((x)/(0.1875/2.0))) static const UINT32 ksl_tab[8*16]= { /* OCT 0 */ - 0.000/DV, 0.000/DV, 0.000/DV, 0.000/DV, - 0.000/DV, 0.000/DV, 0.000/DV, 0.000/DV, - 0.000/DV, 0.000/DV, 0.000/DV, 0.000/DV, - 0.000/DV, 0.000/DV, 0.000/DV, 0.000/DV, + SC(0.000), SC(0.000), SC(0.000), SC(0.000), + SC(0.000), SC(0.000), SC(0.000), SC(0.000), + SC(0.000), SC(0.000), SC(0.000), SC(0.000), + SC(0.000), SC(0.000), SC(0.000), SC(0.000), /* OCT 1 */ - 0.000/DV, 0.000/DV, 0.000/DV, 0.000/DV, - 0.000/DV, 0.000/DV, 0.000/DV, 0.000/DV, - 0.000/DV, 0.750/DV, 1.125/DV, 1.500/DV, - 1.875/DV, 2.250/DV, 2.625/DV, 3.000/DV, + SC(0.000), SC(0.000), SC(0.000), SC(0.000), + SC(0.000), SC(0.000), SC(0.000), SC(0.000), + SC(0.000), SC(0.750), SC(1.125), SC(1.500), + SC(1.875), SC(2.250), SC(2.625), SC(3.000), /* OCT 2 */ - 0.000/DV, 0.000/DV, 0.000/DV, 0.000/DV, - 0.000/DV, 1.125/DV, 1.875/DV, 2.625/DV, - 3.000/DV, 3.750/DV, 4.125/DV, 4.500/DV, - 4.875/DV, 5.250/DV, 5.625/DV, 6.000/DV, + SC(0.000), SC(0.000), SC(0.000), SC(0.000), + SC(0.000), SC(1.125), SC(1.875), SC(2.625), + SC(3.000), SC(3.750), SC(4.125), SC(4.500), + SC(4.875), SC(5.250), SC(5.625), SC(6.000), /* OCT 3 */ - 0.000/DV, 0.000/DV, 0.000/DV, 1.875/DV, - 3.000/DV, 4.125/DV, 4.875/DV, 5.625/DV, - 6.000/DV, 6.750/DV, 7.125/DV, 7.500/DV, - 7.875/DV, 8.250/DV, 8.625/DV, 9.000/DV, + SC(0.000), SC(0.000), SC(0.000), SC(1.875), + SC(3.000), SC(4.125), SC(4.875), SC(5.625), + SC(6.000), SC(6.750), SC(7.125), SC(7.500), + SC(7.875), SC(8.250), SC(8.625), SC(9.000), /* OCT 4 */ - 0.000/DV, 0.000/DV, 3.000/DV, 4.875/DV, - 6.000/DV, 7.125/DV, 7.875/DV, 8.625/DV, - 9.000/DV, 9.750/DV,10.125/DV,10.500/DV, - 10.875/DV,11.250/DV,11.625/DV,12.000/DV, + SC(0.000), SC(0.000), SC(3.000), SC(4.875), + SC(6.000), SC(7.125), SC(7.875), SC(8.625), + SC(9.000), SC(9.750),SC(10.125),SC(10.500), + SC(10.875),SC(11.250),SC(11.625),SC(12.000), /* OCT 5 */ - 0.000/DV, 3.000/DV, 6.000/DV, 7.875/DV, - 9.000/DV,10.125/DV,10.875/DV,11.625/DV, - 12.000/DV,12.750/DV,13.125/DV,13.500/DV, - 13.875/DV,14.250/DV,14.625/DV,15.000/DV, + SC(0.000), SC(3.000), SC(6.000), SC(7.875), + SC(9.000),SC(10.125),SC(10.875),SC(11.625), + SC(12.000),SC(12.750),SC(13.125),SC(13.500), + SC(13.875),SC(14.250),SC(14.625),SC(15.000), /* OCT 6 */ - 0.000/DV, 6.000/DV, 9.000/DV,10.875/DV, - 12.000/DV,13.125/DV,13.875/DV,14.625/DV, - 15.000/DV,15.750/DV,16.125/DV,16.500/DV, - 16.875/DV,17.250/DV,17.625/DV,18.000/DV, + SC(0.000), SC(6.000), SC(9.000),SC(10.875), + SC(12.000),SC(13.125),SC(13.875),SC(14.625), + SC(15.000),SC(15.750),SC(16.125),SC(16.500), + SC(16.875),SC(17.250),SC(17.625),SC(18.000), /* OCT 7 */ - 0.000/DV, 9.000/DV,12.000/DV,13.875/DV, - 15.000/DV,16.125/DV,16.875/DV,17.625/DV, - 18.000/DV,18.750/DV,19.125/DV,19.500/DV, - 19.875/DV,20.250/DV,20.625/DV,21.000/DV + SC(0.000), SC(9.000),SC(12.000),SC(13.875), + SC(15.000),SC(16.125),SC(16.875),SC(17.625), + SC(18.000),SC(18.750),SC(19.125),SC(19.500), + SC(19.875),SC(20.250),SC(20.625),SC(21.000) }; -#undef DV +#undef SC /* sustain level table (3dB per step) */ /* 0 - 15: 0, 3, 6, 9,12,15,18,21,24,27,30,33,36,39,42,93 (dB)*/ @@ -444,13 +444,13 @@ O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0),O( 0), /* multiple table */ -#define ML 2 +#define SC(x) ((UINT32)((x)*2)) static const UINT8 mul_tab[16]= { /* 1/2, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,10,12,12,15,15 */ - 0.50*ML, 1.00*ML, 2.00*ML, 3.00*ML, 4.00*ML, 5.00*ML, 6.00*ML, 7.00*ML, - 8.00*ML, 9.00*ML,10.00*ML,10.00*ML,12.00*ML,12.00*ML,15.00*ML,15.00*ML + SC(0.50), SC(1.00), SC(2.00), SC(3.00), SC(4.00), SC(5.00), SC(6.00), SC(7.00), + SC(8.00), SC(9.00),SC(10.00),SC(10.00),SC(12.00),SC(12.00),SC(15.00),SC(15.00) }; -#undef ML +#undef SC /* TL_TAB_LEN is calculated as: @@ -1344,17 +1344,17 @@ static void OPL3_initalize(OPL3 *chip) /* Amplitude modulation: 27 output levels (triangle waveform); 1 level takes one of: 192, 256 or 448 samples */ /* One entry from LFO_AM_TABLE lasts for 64 samples */ - chip->lfo_am_inc = (1.0 / 64.0 ) * (1<freqbase; + chip->lfo_am_inc = (UINT32)((1.0 / 64.0 ) * (1<freqbase); /* Vibrato: 8 output levels (triangle waveform); 1 level takes 1024 samples */ - chip->lfo_pm_inc = (1.0 / 1024.0) * (1<freqbase; + chip->lfo_pm_inc = (UINT32)((1.0 / 1024.0) * (1<freqbase); /*logerror ("chip->lfo_am_inc = %8x ; chip->lfo_pm_inc = %8x\n", chip->lfo_am_inc, chip->lfo_pm_inc);*/ /* Noise generator: a step takes 1 sample */ - chip->noise_f = (1.0 / 1.0) * (1<freqbase; + chip->noise_f = (UINT32)((1.0 / 1.0) * (1<freqbase); - chip->eg_timer_add = (1<freqbase; + chip->eg_timer_add = (UINT32)((1<freqbase); chip->eg_timer_overflow = ( 1 ) * (1<eg_timer_add, chip->eg_timer_overflow);*/ diff --git a/src/ints/bios.cpp b/src/ints/bios.cpp index 6428f5a3..7aa3bf92 100644 --- a/src/ints/bios.cpp +++ b/src/ints/bios.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: bios.cpp,v 1.67 2007-03-07 10:47:12 qbix79 Exp $ */ +/* $Id: bios.cpp,v 1.68 2007-06-12 20:22:08 c2woody Exp $ */ #include "dosbox.h" #include "mem.h" @@ -981,7 +981,7 @@ void BIOS_SetComPorts(Bit16u baseaddr[]) { equipmentword &= (~0x0E00); equipmentword |= (portcount << 9); mem_writew(BIOS_CONFIGURATION,equipmentword); - CMOS_SetRegister(0x14,equipmentword); //Should be updated on changes + CMOS_SetRegister(0x14,(Bit8u)(equipmentword&0xff)); //Should be updated on changes } diff --git a/src/ints/bios_disk.cpp b/src/ints/bios_disk.cpp index 6b868666..b97a5b1f 100644 --- a/src/ints/bios_disk.cpp +++ b/src/ints/bios_disk.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: bios_disk.cpp,v 1.34 2007-05-02 18:56:15 c2woody Exp $ */ +/* $Id: bios_disk.cpp,v 1.35 2007-06-12 20:22:08 c2woody Exp $ */ #include "dosbox.h" #include "callback.h" @@ -40,7 +40,7 @@ diskGeo DiskGeometryList[] = { {1200, 15, 2, 80, 2}, {1440, 18, 2, 80, 4}, {2880, 36, 2, 80, 6}, - {0, 0, 0 , 0}, + {0, 0, 0, 0, 0} }; Bitu call_int13; @@ -65,8 +65,8 @@ void updateDPT(void) { if(imageDiskList[2] != NULL) { PhysPt dp0physaddr=CALLBACK_PhysPointer(diskparm0); imageDiskList[2]->Get_Geometry(&tmpheads, &tmpcyl, &tmpsect, &tmpsize); - phys_writew(dp0physaddr,tmpcyl); - phys_writeb(dp0physaddr+0x2,tmpheads); + phys_writew(dp0physaddr,(Bit16u)tmpcyl); + phys_writeb(dp0physaddr+0x2,(Bit8u)tmpheads); phys_writew(dp0physaddr+0x3,0); phys_writew(dp0physaddr+0x5,(Bit16u)-1); phys_writeb(dp0physaddr+0x7,0); @@ -74,15 +74,15 @@ void updateDPT(void) { phys_writeb(dp0physaddr+0x9,0); phys_writeb(dp0physaddr+0xa,0); phys_writeb(dp0physaddr+0xb,0); - phys_writew(dp0physaddr+0xc,tmpcyl); - phys_writeb(dp0physaddr+0xe,tmpsect); + phys_writew(dp0physaddr+0xc,(Bit16u)tmpcyl); + phys_writeb(dp0physaddr+0xe,(Bit8u)tmpsect); } if(imageDiskList[3] != NULL) { PhysPt dp1physaddr=CALLBACK_PhysPointer(diskparm1); imageDiskList[3]->Get_Geometry(&tmpheads, &tmpcyl, &tmpsect, &tmpsize); - phys_writew(dp1physaddr,tmpcyl); - phys_writeb(dp1physaddr+0x2,tmpheads); - phys_writeb(dp1physaddr+0xe,tmpsect); + phys_writew(dp1physaddr,(Bit16u)tmpcyl); + phys_writeb(dp1physaddr+0x2,(Bit8u)tmpheads); + phys_writeb(dp1physaddr+0xe,(Bit8u)tmpsect); } } @@ -222,7 +222,7 @@ imageDisk::imageDisk(FILE *imgFile, Bit8u *imgName, Bit32u imgSizeK, bool isHard equipment|=(numofdisks<<6); } else equipment|=1; mem_writew(BIOS_CONFIGURATION,equipment); - CMOS_SetRegister(0x14, equipment); + CMOS_SetRegister(0x14, (Bit8u)(equipment&0xff)); } } } @@ -244,7 +244,7 @@ void imageDisk::Get_Geometry(Bit32u * getHeads, Bit32u *getCyl, Bit32u *getSect, Bit8u imageDisk::GetBiosType(void) { if(!hardDrive) { - return DiskGeometryList[floppytype].biosval; + return (Bit8u)DiskGeometryList[floppytype].biosval; } else return 0; } @@ -298,11 +298,11 @@ static Bitu INT13_DiskHandler(void) { Bit16u segat, bufptr; Bit8u sectbuf[512]; Bitu drivenum; - int i,t; + Bitu i,t; last_drive = reg_dl; drivenum = GetDosDriveNumber(reg_dl); bool any_images = false; - for(Bitu i = 0;i < MAX_DISK_IMAGES;i++) { + for(i = 0;i < MAX_DISK_IMAGES;i++) { if(imageDiskList[i]) any_images=true; } @@ -447,9 +447,9 @@ static Bitu INT13_DiskHandler(void) { else tmpcyl--; // cylinder count -> max cylinder if (tmpheads==0) LOG(LOG_BIOS,LOG_ERROR)("INT13 DrivParm: head count zero!"); else tmpheads--; // head count -> max head - reg_ch = tmpcyl & 0xff; - reg_cl = (((tmpcyl >> 2) & 0xc0) | (tmpsect & 0x3f)); - reg_dh = tmpheads; + reg_ch = (Bit8u)(tmpcyl & 0xff); + reg_cl = (Bit8u)(((tmpcyl >> 2) & 0xc0) | (tmpsect & 0x3f)); + reg_dh = (Bit8u)tmpheads; last_status = 0x00; if (reg_dl&0x80) { // harddisks reg_dl = 0; diff --git a/src/ints/int10_char.cpp b/src/ints/int10_char.cpp index 4d21f028..4130958e 100644 --- a/src/ints/int10_char.cpp +++ b/src/ints/int10_char.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: int10_char.cpp,v 1.49 2007-01-08 19:45:41 qbix79 Exp $ */ +/* $Id: int10_char.cpp,v 1.50 2007-06-12 20:22:08 c2woody Exp $ */ /* Character displaying moving functions */ @@ -534,7 +534,7 @@ void INT10_WriteChar(Bit8u chr,Bit8u attr,Bit8u page,Bit16u count,bool showattr) Bit8u cur_row=CURSOR_POS_ROW(page); Bit8u cur_col=CURSOR_POS_COL(page); - BIOS_NCOLS;BIOS_NROWS; + BIOS_NCOLS; while (count>0) { WriteChar(cur_col,cur_row,page,chr,attr,showattr); count--; @@ -600,7 +600,6 @@ void INT10_TeletypeOutput(Bit8u chr,Bit8u attr) { } void INT10_WriteString(Bit8u row,Bit8u col,Bit8u flag,Bit8u attr,PhysPt string,Bit16u count,Bit8u page) { - BIOS_NCOLS;BIOS_NROWS; Bit8u cur_row=CURSOR_POS_ROW(page); Bit8u cur_col=CURSOR_POS_COL(page); diff --git a/src/ints/int10_misc.cpp b/src/ints/int10_misc.cpp index 0c56c2d6..7b31e24b 100644 --- a/src/ints/int10_misc.cpp +++ b/src/ints/int10_misc.cpp @@ -218,7 +218,7 @@ void INT10_EGA_RIL_ReadRegisterRange(Bit8u & bl, Bit8u ch, Bit8u cl, Bit16u dx, LOG(LOG_INT10,LOG_ERROR)("EGA RIL range read with port %x called",port); } else { if(chregs) cl=regs-ch; + if ((Bitu)ch+cl>regs) cl=(Bit8u)(regs-ch); for (Bitu i=0; iregs) cl=regs-ch; + if ((Bitu)ch+cl>regs) cl=(Bit8u)(regs-ch); if(port == 0x3c0) { IO_Read(real_readw(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS) + 6); for (Bitu i=0; ivdispend+1) << 8); //Maximum scanline Bit8u scanline,crtpage; + scanline=8; switch(CurMode->type) { case M_TEXT: if (machine==MCH_HERC) scanline=14; diff --git a/src/ints/int10_pal.cpp b/src/ints/int10_pal.cpp index 9544f86f..810343cb 100644 --- a/src/ints/int10_pal.cpp +++ b/src/ints/int10_pal.cpp @@ -210,7 +210,7 @@ void INT10_GetPelMask(Bit8u & mask) { } void INT10_SetBackgroundBorder(Bit8u val) { - Bitu temp=real_readb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAL); + Bit8u temp=real_readb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAL); temp=(temp & 0xe0) | (val & 0x1f); real_writeb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAL,temp); if (machine == MCH_CGA || IS_TANDY_ARCH) @@ -233,7 +233,7 @@ void INT10_SetBackgroundBorder(Bit8u val) { } void INT10_SetColorSelect(Bit8u val) { - Bitu temp=real_readb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAL); + Bit8u temp=real_readb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAL); temp=(temp & 0xdf) | ((val & 1) ? 0x20 : 0x0); real_writeb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAL,temp); if (machine == MCH_CGA || IS_TANDY_ARCH) diff --git a/src/ints/int10_put_pixel.cpp b/src/ints/int10_put_pixel.cpp index c76adf4c..b6445ead 100644 --- a/src/ints/int10_put_pixel.cpp +++ b/src/ints/int10_put_pixel.cpp @@ -21,8 +21,8 @@ #include "inout.h" #include "int10.h" -static Bit8u cga_masks[4]={~192U,~48U,~12U,~3U}; -static Bit8u cga_masks2[8]={~128U,~64U,~32U,~16U,~8U,~4U,~2U,~1U}; +static Bit8u cga_masks[4]={0x3f,0xcf,0xf3,0xfc}; +static Bit8u cga_masks2[8]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe}; void INT10_PutPixel(Bit16u x,Bit16u y,Bit8u page,Bit8u color) { switch (CurMode->type) { diff --git a/src/ints/int10_vesa.cpp b/src/ints/int10_vesa.cpp index 04f7bd60..b2bde54a 100644 --- a/src/ints/int10_vesa.cpp +++ b/src/ints/int10_vesa.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: int10_vesa.cpp,v 1.26 2007-01-24 16:29:53 harekiet Exp $ */ +/* $Id: int10_vesa.cpp,v 1.27 2007-06-12 20:22:09 c2woody Exp $ */ #include #include @@ -228,7 +228,7 @@ Bit8u VESA_SetSVGAMode(Bit16u mode) { }; Bit8u VESA_GetSVGAMode(Bit16u & mode) { - mode=CurMode->mode; + mode=(Bit16u)(CurMode->mode); return 0x00; } diff --git a/src/ints/mouse.cpp b/src/ints/mouse.cpp index a0c8711b..4056fe86 100644 --- a/src/ints/mouse.cpp +++ b/src/ints/mouse.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: mouse.cpp,v 1.68 2007-06-06 15:44:40 c2woody Exp $ */ +/* $Id: mouse.cpp,v 1.69 2007-06-12 20:22:09 c2woody Exp $ */ #include #include @@ -236,12 +236,12 @@ void DrawCursorText() Bit16u result; ReadCharAttr(mouse.backposx,mouse.backposy,0,&result); - mouse.backData[0] = result & 0xFF; - mouse.backData[1] = result>>8; + mouse.backData[0] = (Bit8u)(result & 0xFF); + mouse.backData[1] = (Bit8u)(result>>8); mouse.background = true; // Write Cursor result = (result & mouse.textAndMask) ^ mouse.textXorMask; - WriteChar(mouse.backposx,mouse.backposy,0,result&0xFF,result>>8,true); + WriteChar(mouse.backposx,mouse.backposy,0,(Bit8u)(result&0xFF),(Bit8u)(result>>8),true); }; // *************************************************************************** @@ -508,8 +508,8 @@ static void SetSensitivity(Bit16s px, Bit16s py){ if ((px!=0) && (py!=0)) { px--; //Inspired by cutemouse py--; //Although their cursor update routine is far more complex then ours - mouse.senv_x=(static_cast(px)*px)/3600.0 +1.0/3.0; - mouse.senv_y=(static_cast(py)*py)/3600.0 +1.0/3.0; + mouse.senv_x=(static_cast(px)*px)/3600.0f +1.0f/3.0f; + mouse.senv_y=(static_cast(py)*py)/3600.0f +1.0f/3.0f; } }; diff --git a/src/ints/xms.cpp b/src/ints/xms.cpp index f5d1aa42..539f5d54 100644 --- a/src/ints/xms.cpp +++ b/src/ints/xms.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: xms.cpp,v 1.46 2007-01-08 21:40:15 qbix79 Exp $ */ +/* $Id: xms.cpp,v 1.47 2007-06-12 20:22:09 c2woody Exp $ */ #include #include @@ -229,7 +229,7 @@ Bitu XMS_GetHandleInformation(Bitu handle, Bit8u& lockCount, Bit8u& numFree, Bit for (Bitu i=1;i #include @@ -54,11 +54,12 @@ static std::vector internal_progs; void PROGRAMS_MakeFile(char const * const name,PROGRAMS_Main * main) { Bit8u * comdata=(Bit8u *)malloc(32); //MEM LEAK memcpy(comdata,&exe_block,sizeof(exe_block)); - comdata[CB_POS]=call_program&0xff; - comdata[CB_POS+1]=(call_program>>8)&0xff; + comdata[CB_POS]=(Bit8u)(call_program&0xff); + comdata[CB_POS+1]=(Bit8u)((call_program>>8)&0xff); /* Copy save the pointer in the vector and save it's index */ - Bit8u index = internal_progs.size(); + if (internal_progs.size()>255) E_Exit("PROGRAMS_MakeFile program size too large (%d)",internal_progs.size()); + Bit8u index = (Bit8u)internal_progs.size(); internal_progs.push_back(main); memcpy(&comdata[sizeof(exe_block)],&index,sizeof(index)); @@ -329,7 +330,7 @@ static void CONFIG_ProgramStart(Program * * make) { } -void PROGRAMS_Init(Section* sec) { +void PROGRAMS_Init(Section* /*sec*/) { /* Setup a special callback to start virtual programs */ call_program=CALLBACK_Allocate(); CALLBACK_Setup(call_program,&PROGRAMS_Handler,CB_RETF,"internal program"); diff --git a/src/misc/support.cpp b/src/misc/support.cpp index 7d7473f7..cdb3ee27 100644 --- a/src/misc/support.cpp +++ b/src/misc/support.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: support.cpp,v 1.31 2007-01-08 19:45:41 qbix79 Exp $ */ +/* $Id: support.cpp,v 1.32 2007-06-12 20:22:09 c2woody Exp $ */ #include #include @@ -91,7 +91,6 @@ char * ScanCMDRemain(char * cmd) { } char * StripWord(char *&line) { - bool quoted=false; char * scan=line; scan=ltrim(scan); if (*scan=='"') { diff --git a/src/shell/shell_cmds.cpp b/src/shell/shell_cmds.cpp index a7bee72a..afd882ea 100644 --- a/src/shell/shell_cmds.cpp +++ b/src/shell/shell_cmds.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: shell_cmds.cpp,v 1.74 2007-05-15 18:55:23 qbix79 Exp $ */ +/* $Id: shell_cmds.cpp,v 1.75 2007-06-12 20:22:09 c2woody Exp $ */ #include #include @@ -405,11 +405,11 @@ void DOS_Shell::CMD_DIR(char * args) { if (!ext) ext = ""; else *ext++ = '\0'; } - Bit8u day = date & 0x001f; - Bit8u month = (date >> 5) & 0x000f; - Bit16u year = (date >> 9) + 1980; - Bit8u hour = (time >> 5 ) >> 6; - Bit8u minute = (time >> 5) & 0x003f; + Bit8u day = (Bit8u)(date & 0x001f); + Bit8u month = (Bit8u)((date >> 5) & 0x000f); + Bit16u year = (Bit16u)((date >> 9) + 1980); + Bit8u hour = (Bit8u)((time >> 5 ) >> 6); + Bit8u minute = (Bit8u)((time >> 5) & 0x003f); /* output the file */ if (attr & DOS_ATTR_DIRECTORY) { @@ -867,7 +867,7 @@ void DOS_Shell::CMD_LOADHIGH(char *args){ HELP("LOADHIGH"); Bit16u umb_start=dos_infoblock.GetStartOfUMBChain(); Bit8u umb_flag=dos_infoblock.GetUMBChainState(); - Bit8u old_memstrat=DOS_GetMemAllocStrategy()&0xff; + Bit8u old_memstrat=(Bit8u)(DOS_GetMemAllocStrategy()&0xff); if (umb_start==0x9fff) { if ((umb_flag&1)==0) DOS_LinkUMBsToMemChain(1); DOS_SetMemAllocStrategy(0x80); // search in UMBs first @@ -962,7 +962,7 @@ void DOS_Shell::CMD_VER(char *args) { char* word = StripWord(args); if(strcasecmp(word,"set")) return; word = StripWord(args); - dos.version.major = atoi(word); - dos.version.minor = atoi(args); + dos.version.major = (Bit8u)(atoi(word)); + dos.version.minor = (Bit8u)(atoi(args)); } else WriteOut(MSG_Get("SHELL_CMD_VER_VER"),VERSION,dos.version.major,dos.version.minor); }