Skip to content

Commit

Permalink
fixes for running linux binaries in an emulator on Windows. fix build…
Browse files Browse the repository at this point in the history
… warning on arm64.
  • Loading branch information
davidly committed Dec 18, 2024
1 parent 06eeaf4 commit 74344a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions i8086.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ struct i8086
bool is_parity_even8( uint8_t x ) // unused by apps and expensive to compute.
{
#ifdef _M_AMD64
return ( ! ( __popcnt16( x ) & 1 ) ); // less portable, but faster. Not on Q9650 CPU
#elif defined( __APPLE__ )
return ( ! ( __popcnt16( x ) & 1 ) ); // less portable, but faster. Not on Q9650 CPU and other older Intel CPUs. use code below instead if needed.
#elif defined( __aarch64__ )
return ( ! ( std::bitset<8>( x ).count() & 1 ) );
#else
return ( ( ~ ( x ^= ( x ^= ( x ^= x >> 4 ) >> 2 ) >> 1 ) ) & 1 );
Expand Down
7 changes: 4 additions & 3 deletions ntvdm.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1860,12 +1860,13 @@ void traceDisplayBufferAsHex()

// hacks for a bug in Windows Terminal. Map 7 through 15 to smiley faces.
// Also, 27/0x1b/ESC/left-arrow is treated as ESC so it's mapped to the other left arrow in this table.
// Also, 16/17 right/left arrows are mapped to big ugly block because Windows.
// see this: https://github.com/dotnet/runtime/issues/80644

static const wchar_t CP437_to_Unicode_Windows_Hack[ 32 ] =
{
0x0020, 0x263a, 0x263b, 0x2665, 0x2666, 0x2663, 0x2660, 0x263a, 0x263b, 0x263a, 0x263b, 0x263a, 0x263b, 0x263a, 0x263b, 0x263a,
0x25ba, 0x25c4, 0x2195, 0x203c, 0x00b6, 0x00a7, 0x25ac, 0x21a8, 0x2191, 0x2193, 0x2192, 0x25c4, 0x221f, 0x2194, 0x25b2, 0x25bc, // 16
0x2588, 0x2588, 0x2195, 0x203c, 0x00b6, 0x00a7, 0x25ac, 0x21a8, 0x2191, 0x2193, 0x2192, 0x25c4, 0x221f, 0x2194, 0x25b2, 0x25bc, // 16
};

// Map 0000 to ' ' for display purposes. It only happens if a DOS app has a bug and tries to display character 0. Like brief.exe.
Expand Down Expand Up @@ -1992,7 +1993,7 @@ void UpdateDisplayRow( uint32_t y )
awc[ x ] = CP437_to_Unicode[ pbuf[ offset ] ];
attribs[ x ] = pbuf[ 1 + offset ];

#if defined( __riscv ) || defined( _WIN32 ) || defined( __aarch64 )
#if defined( __riscv ) || defined( _WIN32 ) || defined( __aarch64__ )
// When NTVDM built for RISC-V runs in RVOS/ARMOS emulation on Windows, CP 437
// characters 7 through 13 are interpreted by Windows Terminal as control
// characters, not actual chacters. This is after they are converted to
Expand All @@ -2005,7 +2006,7 @@ void UpdateDisplayRow( uint32_t y )
#if defined( __riscv )
if ( g_InRVOS )
#endif
#if defined( __aarch64 )
#if defined( __aarch64__ )
if ( g_InARMOS )
#endif
{
Expand Down

0 comments on commit 74344a0

Please sign in to comment.