diff --git a/acinclude.m4 b/acinclude.m4 index 9f299355..08653d83 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -370,29 +370,41 @@ typedef double Real64; #if SIZEOF_UNSIGNED_INT == 4 typedef unsigned int Bit32u; typedef signed int Bit32s; +#define sBit32t #elif SIZEOF_UNSIGNED_LONG == 4 typedef unsigned long Bit32u; typedef signed long Bit32s; +#define sBit32t "l" #else # error "can't find sizeof(type) of 4 bytes!" #endif +#define sBit32fs(a) sBit32t #a #if SIZEOF_UNSIGNED_LONG == 8 typedef unsigned long Bit64u; typedef signed long Bit64s; +#define sBit64t "l" #elif SIZEOF_UNSIGNED_LONG_LONG == 8 typedef unsigned long long Bit64u; typedef signed long long Bit64s; +#define sBit64t "ll" #else # error "can't find data type of 8 bytes" #endif +#define sBit64fs(a) sBit64t #a #if SIZEOF_INT_P == 4 - typedef Bit32u Bitu; - typedef Bit32s Bits; -#else - typedef Bit64u Bitu; - typedef Bit64s Bits; + +typedef Bit32u Bitu; +typedef Bit32s Bits; +#define sBitfs sBit32fs + +#else //SIZEOF_INT_P + +typedef Bit64u Bitu; +typedef Bit64s Bits; +#define sBitfs sBit64fs + #endif ]) diff --git a/src/cpu/callback.cpp b/src/cpu/callback.cpp index 5c04b776..88109183 100644 --- a/src/cpu/callback.cpp +++ b/src/cpu/callback.cpp @@ -527,7 +527,7 @@ Bitu CALLBACK_SetupExtra(Bitu callback, Bitu type, PhysPt physAddress, bool use_ phys_writeb(physAddress+0x1B,(Bit8u)0xC3); //A RETN Instruction return (use_cb?32:27); default: - E_Exit("CALLBACK:Setup:Illegal type %lu", type); + E_Exit("CALLBACK:Setup:Illegal type %" sBitfs(u),type); } return 0; } diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp index 3c09fc2b..9d46a99a 100644 --- a/src/cpu/cpu.cpp +++ b/src/cpu/cpu.cpp @@ -349,7 +349,7 @@ bool CPU_SwitchTask(Bitu new_tss_selector,TSwitchType tstype,Bitu old_eip) { FillFlags(); TaskStateSegment new_tss; if (!new_tss.SetSelector(new_tss_selector)) - E_Exit("Illegal TSS for switch, selector=%lx, switchtype=%x", new_tss_selector, tstype); + E_Exit("Illegal TSS for switch, selector=%" sBitfs(x) ", switchtype=%x",new_tss_selector,tstype); if (tstype==TSwitch_IRET) { if (!new_tss.desc.IsBusy()) E_Exit("TSS not busy for IRET"); @@ -503,7 +503,7 @@ doconforming: Segs.val[cs]=new_cs; break; default: - E_Exit("Task switch CS Type %lu", cs_desc.Type()); + E_Exit("Task switch CS Type %" sBitfs(u),cs_desc.Type()); } } CPU_SetSegGeneral(es,new_es); @@ -725,7 +725,7 @@ do_interrupt: } break; default: - E_Exit("INT:Gate Selector points to illegal descriptor with type %lx", cs_desc.Type()); + E_Exit("INT:Gate Selector points to illegal descriptor with type %" sBitfs(x),cs_desc.Type()); } Segs.val[cs]=(gate_sel&0xfffc) | cpu.cpl; @@ -755,7 +755,7 @@ do_interrupt: } return; default: - E_Exit("Illegal descriptor type %lX for int %lX", gate.Type(), num); + E_Exit("Illegal descriptor type %" sBitfs(X) " for int %" sBitfs(X),gate.Type(),num); } } assert(1); @@ -902,7 +902,7 @@ void CPU_IRET(bool use32,Bitu oldeip) { EXCEPTION_GP,n_cs_sel & 0xfffc) break; default: - E_Exit("IRET:Illegal descriptor type %lX", n_cs_desc.Type()); + E_Exit("IRET:Illegal descriptor type %" sBitfs(X), n_cs_desc.Type()); } CPU_CHECK_COND(!n_cs_desc.saved.seg.p, "IRET with nonpresent code segment", @@ -1059,7 +1059,7 @@ CODE_jmp: CPU_SwitchTask(selector,TSwitch_JMP,oldeip); break; default: - E_Exit("JMP Illegal descriptor type %lX", desc.Type()); + E_Exit("JMP Illegal descriptor type %" sBitfs(X),desc.Type()); } } assert(1); @@ -1295,7 +1295,7 @@ call_code: CPU_Exception(EXCEPTION_GP,selector & 0xfffc); return; default: - E_Exit("CALL:Descriptor type %lx unsupported", call.Type()); + E_Exit("CALL:Descriptor type %" sBitfs(x) " unsupported",call.Type()); } } assert(1); @@ -1353,7 +1353,7 @@ void CPU_RET(bool use32,Bitu bytes,Bitu oldeip) { EXCEPTION_GP,selector & 0xfffc) break; default: - E_Exit("RET from illegal descriptor type %lX", desc.Type()); + E_Exit("RET from illegal descriptor type %" sBitfs(X),desc.Type()); } RET_same_level: if (!desc.saved.seg.p) { @@ -1398,7 +1398,7 @@ RET_same_level: EXCEPTION_GP,selector & 0xfffc) break; default: - E_Exit("RET from illegal descriptor type %lX", desc.Type()); // or #GP(selector) + E_Exit("RET from illegal descriptor type %" sBitfs(X),desc.Type()); // or #GP(selector) } CPU_CHECK_COND(!desc.saved.seg.p, @@ -1509,8 +1509,7 @@ bool CPU_LTR(Bitu selector) { LOG(LOG_CPU,LOG_ERROR)("LTR failed, selector=%X (not present)",selector); return CPU_PrepareException(EXCEPTION_NP,selector); } - if (!cpu_tss.SetSelector(selector)) - E_Exit("LTR failed, selector=%lX", selector); + if (!cpu_tss.SetSelector(selector)) E_Exit("LTR failed, selector=%" sBitfs(X),selector); cpu_tss.desc.SetBusy(true); cpu_tss.SaveSelector(); } else { diff --git a/src/hardware/dma.cpp b/src/hardware/dma.cpp index a2bb0d7c..bf8ecbae 100644 --- a/src/hardware/dma.cpp +++ b/src/hardware/dma.cpp @@ -50,7 +50,7 @@ static void DMA_BlockRead(PhysPt spage,PhysPt offset,void * data,Bitu size,Bit8u Bit32u dma_wrap = ((0xffff<(dma_wrapping<> 12); @@ -71,7 +71,7 @@ static void DMA_BlockWrite(PhysPt spage,PhysPt offset,void * data,Bitu size,Bit8 Bit32u dma_wrap = ((0xffff<(dma_wrapping<> 12); @@ -109,7 +109,7 @@ bool SecondDMAControllerAvailable(void) { } static void DMA_Write_Port(Bitu port,Bitu val,Bitu /*iolen*/) { - //LOG(LOG_DMACONTROL,LOG_ERROR)("Write %X %X",port,val); + //LOG(LOG_DMACONTROL,LOG_ERROR)("Write %" sBitfs(X) " %" sBitfs(X),port,val); if (port<0x10) { /* write to the first DMA controller (channels 0-3) */ DmaControllers[0]->WriteControllerReg(port,val,1); @@ -132,7 +132,7 @@ static void DMA_Write_Port(Bitu port,Bitu val,Bitu /*iolen*/) { } static Bitu DMA_Read_Port(Bitu port,Bitu iolen) { - //LOG(LOG_DMACONTROL,LOG_ERROR)("Read %X",port); + //LOG(LOG_DMACONTROL,LOG_ERROR)("Read %" sBitfs(X),port); if (port<0x10) { /* read from the first DMA controller (channels 0-3) */ return DmaControllers[0]->ReadControllerReg(port,iolen); @@ -258,7 +258,7 @@ Bitu DmaController::ReadControllerReg(Bitu reg,Bitu /*len*/) { } return ret; default: - LOG(LOG_DMACONTROL,LOG_NORMAL)("Trying to read undefined DMA port %x",reg); + LOG(LOG_DMACONTROL,LOG_NORMAL)("Trying to read undefined DMA port %" sBitfs(x),reg); break; } return 0xffffffff; diff --git a/src/hardware/mixer.cpp b/src/hardware/mixer.cpp index 19c64fa7..32414776 100644 --- a/src/hardware/mixer.cpp +++ b/src/hardware/mixer.cpp @@ -687,19 +687,18 @@ public: if (cmd->FindString("MASTER",temp_line,false)) { MakeVolume((char *)temp_line.c_str(),mixer.mastervol[0],mixer.mastervol[1]); } - MixerChannel * chan=mixer.channels; + MixerChannel * chan = mixer.channels; while (chan) { if (cmd->FindString(chan->name,temp_line,false)) { MakeVolume((char *)temp_line.c_str(),chan->volmain[0],chan->volmain[1]); } chan->UpdateVolume(); - chan=chan->next; + chan = chan->next; } if (cmd->FindExist("/NOSHOW")) return; - chan=mixer.channels; WriteOut("Channel Main Main(dB)\n"); ShowVolume("MASTER",mixer.mastervol[0],mixer.mastervol[1]); - for (chan=mixer.channels;chan;chan=chan->next) + for (chan = mixer.channels;chan;chan = chan->next) ShowVolume(chan->name,chan->volmain[0],chan->volmain[1]); } private: diff --git a/src/hardware/sblaster.cpp b/src/hardware/sblaster.cpp index af73d063..056079d4 100644 --- a/src/hardware/sblaster.cpp +++ b/src/hardware/sblaster.cpp @@ -707,6 +707,8 @@ static void DSP_DoDMATransfer(DMA_MODES mode,Bitu freq,bool autoinit, bool stere autoinit ? "Auto-Init" : "Single-Cycle", freq, sb.dma.rate, sb.dma.left ); +#else + type = type; #endif } diff --git a/src/platform/visualc/config.h b/src/platform/visualc/config.h index c5d036ed..7593029b 100644 --- a/src/platform/visualc/config.h +++ b/src/platform/visualc/config.h @@ -73,21 +73,27 @@ #pragma warning(disable : 4996) #endif -typedef double Real64; +typedef double Real64; /* The internal types */ -typedef unsigned char Bit8u; -typedef signed char Bit8s; -typedef unsigned short Bit16u; -typedef signed short Bit16s; -typedef unsigned long Bit32u; -typedef signed long Bit32s; -typedef unsigned __int64 Bit64u; -typedef signed __int64 Bit64s; +typedef unsigned char Bit8u; +typedef signed char Bit8s; +typedef unsigned short Bit16u; +typedef signed short Bit16s; +typedef unsigned int Bit32u; +typedef signed int Bit32s; +typedef unsigned __int64 Bit64u; +typedef signed __int64 Bit64s; +#define sBit32t +#define sBit64t "I64" +#define sBit32fs(a) sBit32t #a +#define sBit64fs(a) sBit64t #a #ifdef _M_X64 -typedef unsigned __int64 Bitu; -typedef signed __int64 Bits; +typedef Bit64u Bitu; +typedef Bit64s Bits; +#define sBitfs sBit64fs #else // _M_IX86 -typedef unsigned int Bitu; -typedef signed int Bits; +typedef Bit32u Bitu; +typedef Bit32s Bits; +#define sBitfs sBit32fs #endif