Fix AltairZ80 compilation with Visual Studio 2008 (#85)

* AltairZ80: SS1: Fix disable after reset.

The CompuPro System Support 1 could not be disabled after enabled and
used due to timers causing it to be busy.  Reset properly so that "set
ss1 disabled" works after reset.

* AltairZ80: wd179x: Properly reset 179x state.

* AltairZ80: M68K: Fix compile with VS2008.

* Musashi: Fix compilation with Visual Studio 2008.

* AltairZ80: M68K: Resolve warnings in softfloat.

* AltairZ80: Add headers to .vcproj
This commit is contained in:
Howard M. Harte 2022-10-24 14:15:51 -07:00 committed by GitHub
parent b52438a675
commit ef6667b05c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 103 additions and 27 deletions

View file

@ -43,6 +43,10 @@
#define OPT_ON 1 #define OPT_ON 1
#define OPT_SPECIFY_HANDLER 2 #define OPT_SPECIFY_HANDLER 2
#if defined(_MSC_VER)
/* Disable MSVC warning 4146: Unary minus. */
#pragma warning (disable: 4146)
#endif
/* ======================================================================== */ /* ======================================================================== */
/* ============================== MAME STUFF ============================== */ /* ============================== MAME STUFF ============================== */

View file

@ -1911,6 +1911,7 @@ extern jmp_buf m68ki_bus_error_jmp_buf;
/* Exception for bus error */ /* Exception for bus error */
static inline void m68ki_exception_bus_error(void) static inline void m68ki_exception_bus_error(void)
{ {
uint sr;
int i; int i;
/* If we were processing a bus error, address error, or reset, /* If we were processing a bus error, address error, or reset,
@ -1932,7 +1933,7 @@ static inline void m68ki_exception_bus_error(void)
REG_DA[i] = REG_DA_SAVE[i]; REG_DA[i] = REG_DA_SAVE[i];
} }
uint sr = m68ki_init_exception(); sr = m68ki_init_exception();
/* Note: This is implemented for 68010 only! */ /* Note: This is implemented for 68010 only! */
m68ki_stack_frame_1000(REG_PPC, sr, EXCEPTION_BUS_ERROR); m68ki_stack_frame_1000(REG_PPC, sr, EXCEPTION_BUS_ERROR);

View file

@ -91,7 +91,7 @@ static int32 roundAndPackInt32( flag zSign, bits64 absZ )
roundBits = absZ & 0x7F; roundBits = absZ & 0x7F;
absZ = ( absZ + roundIncrement )>>7; absZ = ( absZ + roundIncrement )>>7;
absZ &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven ); absZ &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven );
z = absZ; z = (int32)absZ;
if ( zSign ) z = - z; if ( zSign ) z = - z;
if ( ( absZ>>32 ) || ( z && ( ( z < 0 ) ^ zSign ) ) ) { if ( ( absZ>>32 ) || ( z && ( ( z < 0 ) ^ zSign ) ) ) {
float_raise( float_flag_invalid ); float_raise( float_flag_invalid );
@ -905,7 +905,7 @@ float32 int64_to_float32( int64 a )
absA = zSign ? - a : a; absA = zSign ? - a : a;
shiftCount = countLeadingZeros64( absA ) - 40; shiftCount = countLeadingZeros64( absA ) - 40;
if ( 0 <= shiftCount ) { if ( 0 <= shiftCount ) {
return packFloat32( zSign, 0x95 - shiftCount, absA<<shiftCount ); return packFloat32( zSign, 0x95 - shiftCount, (bits32)(absA<<shiftCount ));
} }
else { else {
shiftCount += 7; shiftCount += 7;
@ -915,7 +915,7 @@ float32 int64_to_float32( int64 a )
else { else {
absA <<= shiftCount; absA <<= shiftCount;
} }
return roundAndPackFloat32( zSign, 0x9C - shiftCount, absA ); return roundAndPackFloat32( zSign, 0x9C - shiftCount, (bits32)absA );
} }
} }
@ -1548,7 +1548,7 @@ float32 float32_mul( float32 a, float32 b )
aSig = ( aSig | 0x00800000 )<<7; aSig = ( aSig | 0x00800000 )<<7;
bSig = ( bSig | 0x00800000 )<<8; bSig = ( bSig | 0x00800000 )<<8;
shift64RightJamming( ( (bits64) aSig ) * bSig, 32, &zSig64 ); shift64RightJamming( ( (bits64) aSig ) * bSig, 32, &zSig64 );
zSig = zSig64; zSig = (bits32)zSig64;
if ( 0 <= (sbits32) ( zSig<<1 ) ) { if ( 0 <= (sbits32) ( zSig<<1 ) ) {
zSig <<= 1; zSig <<= 1;
--zExp; --zExp;
@ -1700,7 +1700,7 @@ float32 float32_rem( float32 a, float32 b )
expDiff += 64; expDiff += 64;
q64 = estimateDiv128To64( aSig64, 0, bSig64 ); q64 = estimateDiv128To64( aSig64, 0, bSig64 );
q64 = ( 2 < q64 ) ? q64 - 2 : 0; q64 = ( 2 < q64 ) ? q64 - 2 : 0;
q = q64>>( 64 - expDiff ); q = (bits32)(q64>>( 64 - expDiff ));
bSig <<= 6; bSig <<= 6;
aSig = ( ( aSig64>>33 )<<( expDiff - 1 ) ) - bSig * q; aSig = ( ( aSig64>>33 )<<( expDiff - 1 ) ) - bSig * q;
} }
@ -1971,7 +1971,7 @@ int32 float64_to_int32_round_to_zero( float64 a )
shiftCount = 0x433 - aExp; shiftCount = 0x433 - aExp;
savedASig = aSig; savedASig = aSig;
aSig >>= shiftCount; aSig >>= shiftCount;
z = aSig; z = (int32)aSig;
if ( aSign ) z = - z; if ( aSign ) z = - z;
if ( ( z < 0 ) ^ aSign ) { if ( ( z < 0 ) ^ aSign ) {
invalid: invalid:
@ -2101,7 +2101,7 @@ float32 float64_to_float32( float64 a )
return packFloat32( aSign, 0xFF, 0 ); return packFloat32( aSign, 0xFF, 0 );
} }
shift64RightJamming( aSig, 22, &aSig ); shift64RightJamming( aSig, 22, &aSig );
zSig = aSig; zSig = (bits32)aSig;
if ( aExp || zSig ) { if ( aExp || zSig ) {
zSig |= 0x40000000; zSig |= 0x40000000;
aExp -= 0x381; aExp -= 0x381;
@ -2673,7 +2673,7 @@ float64 float64_sqrt( float64 a )
} }
zExp = ( ( aExp - 0x3FF )>>1 ) + 0x3FE; zExp = ( ( aExp - 0x3FF )>>1 ) + 0x3FE;
aSig |= LIT64( 0x0010000000000000 ); aSig |= LIT64( 0x0010000000000000 );
zSig = estimateSqrt32( aExp, aSig>>21 ); zSig = estimateSqrt32( aExp, (bits32)(aSig>>21) );
aSig <<= 9 - ( aExp & 1 ); aSig <<= 9 - ( aExp & 1 );
zSig = estimateDiv128To64( aSig, 0, zSig<<32 ) + ( zSig<<30 ); zSig = estimateDiv128To64( aSig, 0, zSig<<32 ) + ( zSig<<30 );
if ( ( zSig & 0x1FF ) <= 5 ) { if ( ( zSig & 0x1FF ) <= 5 ) {
@ -2890,7 +2890,7 @@ int32 floatx80_to_int32_round_to_zero( floatx80 a )
shiftCount = 0x403E - aExp; shiftCount = 0x403E - aExp;
savedASig = aSig; savedASig = aSig;
aSig >>= shiftCount; aSig >>= shiftCount;
z = aSig; z = (int32)aSig;
if ( aSign ) z = - z; if ( aSign ) z = - z;
if ( ( z < 0 ) ^ aSign ) { if ( ( z < 0 ) ^ aSign ) {
invalid: invalid:
@ -3012,7 +3012,7 @@ float32 floatx80_to_float32( floatx80 a )
} }
shift64RightJamming( aSig, 33, &aSig ); shift64RightJamming( aSig, 33, &aSig );
if ( aExp || aSig ) aExp -= 0x3F81; if ( aExp || aSig ) aExp -= 0x3F81;
return roundAndPackFloat32( aSign, aExp, aSig ); return roundAndPackFloat32( aSign, aExp, (bits32)aSig );
} }
@ -3887,7 +3887,7 @@ int32 float128_to_int32_round_to_zero( float128 a )
shiftCount = 0x402F - aExp; shiftCount = 0x402F - aExp;
savedASig = aSig0; savedASig = aSig0;
aSig0 >>= shiftCount; aSig0 >>= shiftCount;
z = aSig0; z = (int32)aSig0;
if ( aSign ) z = - z; if ( aSign ) z = - z;
if ( ( z < 0 ) ^ aSign ) { if ( ( z < 0 ) ^ aSign ) {
invalid: invalid:
@ -4031,7 +4031,7 @@ float32 float128_to_float32( float128 a )
} }
aSig0 |= ( aSig1 != 0 ); aSig0 |= ( aSig1 != 0 );
shift64RightJamming( aSig0, 18, &aSig0 ); shift64RightJamming( aSig0, 18, &aSig0 );
zSig = aSig0; zSig = (bits32)aSig0;
if ( aExp || zSig ) { if ( aExp || zSig ) {
zSig |= 0x40000000; zSig |= 0x40000000;
aExp -= 0x3F81; aExp -= 0x3F81;
@ -4714,7 +4714,7 @@ float128 float128_sqrt( float128 a )
} }
zExp = ( ( aExp - 0x3FFF )>>1 ) + 0x3FFE; zExp = ( ( aExp - 0x3FFF )>>1 ) + 0x3FFE;
aSig0 |= LIT64( 0x0001000000000000 ); aSig0 |= LIT64( 0x0001000000000000 );
zSig0 = estimateSqrt32( aExp, aSig0>>17 ); zSig0 = estimateSqrt32( aExp, (bits32)(aSig0>>17 ));
shortShift128Left( aSig0, aSig1, 13 - ( aExp & 1 ), &aSig0, &aSig1 ); shortShift128Left( aSig0, aSig1, 13 - ( aExp & 1 ), &aSig0, &aSig1 );
zSig0 = estimateDiv128To64( aSig0, aSig1, zSig0<<32 ) + ( zSig0<<30 ); zSig0 = estimateDiv128To64( aSig0, aSig1, zSig0<<32 ) + ( zSig0<<30 );
doubleZSig0 = zSig0<<1; doubleZSig0 = zSig0<<1;

View file

@ -81,7 +81,7 @@ static void setClockSS1(void);
/* SS1 Interrupt Controller notes: /* SS1 Interrupt Controller notes:
* *
* Msster 8259: * Master 8259:
* IRQ0 = VI0 * IRQ0 = VI0
* IRQ1 = VI1 - DISK3 Interrupt * IRQ1 = VI1 - DISK3 Interrupt
* IRQ2 = VI2 - IF3 Rx Interrupt * IRQ2 = VI2 - IF3 Rx Interrupt
@ -178,10 +178,10 @@ typedef struct {
RTC_REGS ss1_rtc[1] = { { 0 } }; RTC_REGS ss1_rtc[1] = { { 0 } };
static UNIT ss1_unit[] = { static UNIT ss1_unit[] = {
{ UDATA (&ss1_svc, UNIT_FIX | UNIT_DISABLE | UNIT_ROABLE, 0) }, { UDATA (&ss1_svc, UNIT_FIX | UNIT_DISABLE | UNIT_DIS | UNIT_ROABLE, 0) },
{ UDATA (&ss1_svc, UNIT_FIX | UNIT_DISABLE | UNIT_ROABLE, 0) }, { UDATA (&ss1_svc, UNIT_FIX | UNIT_DISABLE | UNIT_DIS | UNIT_ROABLE, 0) },
{ UDATA (&ss1_svc, UNIT_FIX | UNIT_DISABLE | UNIT_ROABLE, 0) }, { UDATA (&ss1_svc, UNIT_FIX | UNIT_DISABLE | UNIT_DIS | UNIT_ROABLE, 0) },
{ UDATA (&ss1_svc, UNIT_FIX | UNIT_DISABLE | UNIT_ROABLE, 0) } { UDATA (&ss1_svc, UNIT_FIX | UNIT_DISABLE | UNIT_DIS | UNIT_ROABLE, 0) }
}; };
static REG ss1_reg[] = { static REG ss1_reg[] = {
@ -262,6 +262,11 @@ static t_stat ss1_reset(DEVICE *dptr)
{ {
PNP_INFO *pnp = (PNP_INFO *)dptr->ctxt; PNP_INFO *pnp = (PNP_INFO *)dptr->ctxt;
sim_cancel(&dptr->units[0]);
sim_cancel(&dptr->units[1]);
sim_cancel(&dptr->units[2]);
sim_cancel(&dptr->units[3]);
if(dptr->flags & DEV_DIS) { /* Disconnect I/O Ports */ if(dptr->flags & DEV_DIS) { /* Disconnect I/O Ports */
sim_map_resource(pnp->io_base, pnp->io_size, RESOURCE_TYPE_IO, &ss1dev, "ss1dev", TRUE); sim_map_resource(pnp->io_base, pnp->io_size, RESOURCE_TYPE_IO, &ss1dev, "ss1dev", TRUE);
} else { } else {

View file

@ -309,6 +309,8 @@ static t_stat wd179x_reset(DEVICE *dptr)
} }
} }
wd179x_info->cmdtype = 0;
return SCPE_OK; return SCPE_OK;
} }

View file

@ -41,7 +41,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="../AltairZ80/;./;../;../slirp;../slirp_glue;../slirp_glue/qemu;../slirp_glue/qemu/win32/include;../../windows-build/include;;../../windows-build/include/SDL2" AdditionalIncludeDirectories="../AltairZ80/;./;../;../slirp;../slirp_glue;../slirp_glue/qemu;../slirp_glue/qemu/win32/include;../../windows-build/include;;../../windows-build/include/SDL2"
PreprocessorDefinitions="NO_INLINE;SIM_BUILD_TOOL=simh-Visual-Studio-Project;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;SIM_NEED_GIT_COMMIT_ID;HAVE_PCRE_H;PCRE_STATIC" PreprocessorDefinitions="inline=__inline;SIM_BUILD_TOOL=simh-Visual-Studio-Project;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;SIM_NEED_GIT_COMMIT_ID;HAVE_PCRE_H;PCRE_STATIC"
KeepComments="false" KeepComments="false"
BasicRuntimeChecks="0" BasicRuntimeChecks="0"
RuntimeLibrary="1" RuntimeLibrary="1"
@ -125,7 +125,7 @@
OmitFramePointers="true" OmitFramePointers="true"
WholeProgramOptimization="true" WholeProgramOptimization="true"
AdditionalIncludeDirectories="../AltairZ80/;./;../;../slirp;../slirp_glue;../slirp_glue/qemu;../slirp_glue/qemu/win32/include;../../windows-build/include;;../../windows-build/include/SDL2" AdditionalIncludeDirectories="../AltairZ80/;./;../;../slirp;../slirp_glue;../slirp_glue/qemu;../slirp_glue/qemu/win32/include;../../windows-build/include;;../../windows-build/include/SDL2"
PreprocessorDefinitions="NO_INLINE;SIM_BUILD_TOOL=simh-Visual-Studio-Project;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;SIM_NEED_GIT_COMMIT_ID;HAVE_PCRE_H;PCRE_STATIC" PreprocessorDefinitions="inline=__inline;SIM_BUILD_TOOL=simh-Visual-Studio-Project;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;SIM_NEED_GIT_COMMIT_ID;HAVE_PCRE_H;PCRE_STATIC"
StringPooling="true" StringPooling="true"
RuntimeLibrary="0" RuntimeLibrary="0"
EnableFunctionLevelLinking="true" EnableFunctionLevelLinking="true"
@ -279,10 +279,6 @@
RelativePath="..\AltairZ80\m68k\m68kops.c" RelativePath="..\AltairZ80\m68k\m68kops.c"
> >
</File> </File>
<File
RelativePath="..\AltairZ80\m68k\softfloat\softfloat.c"
>
</File>
<File <File
RelativePath="..\AltairZ80\m68ksim.c" RelativePath="..\AltairZ80\m68ksim.c"
> >
@ -336,11 +332,11 @@
> >
</File> </File>
<File <File
RelativePath="..\AltairZ80\s100_if3.c" RelativePath="..\AltairZ80\s100_icom.c"
> >
</File> </File>
<File <File
RelativePath="..\AltairZ80\s100_icom.c" RelativePath="..\AltairZ80\s100_if3.c"
> >
</File> </File>
<File <File
@ -427,6 +423,10 @@
RelativePath="..\sim_video.c" RelativePath="..\sim_video.c"
> >
</File> </File>
<File
RelativePath="..\AltairZ80\m68k\softfloat\softfloat.c"
>
</File>
<File <File
RelativePath="..\AltairZ80\vfdhd.c" RelativePath="..\AltairZ80\vfdhd.c"
> >
@ -444,6 +444,58 @@
RelativePath="..\AltairZ80\altairz80_defs.h" RelativePath="..\AltairZ80\altairz80_defs.h"
> >
</File> </File>
<File
RelativePath="..\AltairZ80\i8272.h"
>
</File>
<File
RelativePath="..\AltairZ80\i86.h"
>
</File>
<File
RelativePath="..\AltairZ80\insns.h"
>
</File>
<File
RelativePath="..\AltairZ80\m68k\m68k.h"
>
</File>
<File
RelativePath="..\AltairZ80\m68k\m68kconf.h"
>
</File>
<File
RelativePath="..\AltairZ80\m68k\m68kcpu.h"
>
</File>
<File
RelativePath="..\AltairZ80\m68k\m68kmmu.h"
>
</File>
<File
RelativePath="..\AltairZ80\m68k\m68kops.h"
>
</File>
<File
RelativePath="..\AltairZ80\m68ksim.h"
>
</File>
<File
RelativePath="..\AltairZ80\m68k\softfloat\mamesf.h"
>
</File>
<File
RelativePath="..\AltairZ80\mfdc.h"
>
</File>
<File
RelativePath="..\AltairZ80\m68k\softfloat\milieu.h"
>
</File>
<File
RelativePath="..\AltairZ80\nasm.h"
>
</File>
<File <File
RelativePath="..\scp.h" RelativePath="..\scp.h"
> >
@ -500,6 +552,18 @@
RelativePath="..\sim_video.h" RelativePath="..\sim_video.h"
> >
</File> </File>
<File
RelativePath="..\AltairZ80\m68k\softfloat\softfloat.h"
>
</File>
<File
RelativePath="..\AltairZ80\vfdhd.h"
>
</File>
<File
RelativePath="..\AltairZ80\wd179x.h"
>
</File>
</Filter> </Filter>
<Filter <Filter
Name="Resource Files" Name="Resource Files"