Archival snapshot of the Virtual World Entertainment Tesla cockpit software, 1994-1996: MUNGA engine and L4 pod layer source (Borland C++ 5.0), BT/RP game code, and game content (models, audio, maps, gauges, Division renderer data). Includes third-party libraries: Division dVS/DPL graphics, HMI SOS audio, WATTCP networking. Files are preserved byte-for-byte (.gitattributes disables all line-ending conversion). README.md documents the layout, target hardware, and toolchain. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
134 lines
3.3 KiB
C++
134 lines
3.3 KiB
C++
#include <mungal4.hpp>
|
|
#pragma hdrstop
|
|
|
|
#if !defined(STYLE_HPP)
|
|
# include <style.hpp>
|
|
#endif
|
|
|
|
void*
|
|
Get_Caller(int level)
|
|
{
|
|
char *address = (char*)_EBP;
|
|
while (level--)
|
|
{
|
|
Check_Pointer(address);
|
|
address = *(char**)address;
|
|
}
|
|
Check_Pointer(address);
|
|
return *(char**)(address+4);
|
|
}
|
|
|
|
#if defined(USE_ACTIVE_PROFILE)
|
|
# undef inportb
|
|
# undef outportb
|
|
|
|
//
|
|
// table of data representing bits on the parallel port at 0x378 (usually LPT1)
|
|
// DO NOT ALTER THIS DATA - IT REQUIRES LOTS OF SCHEMATIC TRACING TO DUPLICATE
|
|
//
|
|
struct ParallelBit
|
|
{
|
|
unsigned int port;
|
|
Byte mask;
|
|
int sense;
|
|
};
|
|
|
|
ParallelBit
|
|
Bit_Table[12] =
|
|
{
|
|
{0x378, 0x80, 0x00},
|
|
{0x378, 0x40, 0x00},
|
|
{0x378, 0x20, 0x00},
|
|
{0x378, 0x10, 0x00},
|
|
{0x37a, 0x08, 0x01},
|
|
{0x37a, 0x04, 0x00},
|
|
{0x37a, 0x02, 0x01},
|
|
{0x37a, 0x01, 0x01},
|
|
{0x378, 0x08, 0x00},
|
|
{0x378, 0x04, 0x00},
|
|
{0x378, 0x02, 0x00},
|
|
{0x378, 0x01, 0x00}
|
|
};
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
void
|
|
BitTrace::SetLineImplementation(Byte line)
|
|
{
|
|
Verify(line < ELEMENTS(Bit_Table));
|
|
|
|
//
|
|
//------------------------------------------------------------------
|
|
// read the current value of the appropriate port
|
|
//------------------------------------------------------------------
|
|
//
|
|
Byte port_value = inportb(Bit_Table[line].port);
|
|
|
|
//
|
|
//------------------------------------------------------------------
|
|
// set the appropriate bit, taking into account the hardware sense
|
|
//------------------------------------------------------------------
|
|
//
|
|
if (!Bit_Table[line].sense)
|
|
{
|
|
port_value |= Bit_Table[line].mask;
|
|
}
|
|
else
|
|
{
|
|
port_value &= (Byte)(~Bit_Table[line].mask);
|
|
}
|
|
|
|
//
|
|
//------------------------------------------------------------------
|
|
// put the modified value into the appropriate port
|
|
//------------------------------------------------------------------
|
|
//
|
|
outportb(Bit_Table[line].port, port_value);
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
void
|
|
BitTrace::ClearLineImplementation(Byte line)
|
|
{
|
|
Verify(line < ELEMENTS(Bit_Table));
|
|
|
|
//
|
|
//------------------------------------------------------------------
|
|
// read the current value of the appropriate port
|
|
//------------------------------------------------------------------
|
|
//
|
|
Byte port_value = inportb(Bit_Table[line].port);
|
|
|
|
//
|
|
//------------------------------------------------------------------
|
|
// clear the appropriate bit, taking into account the hardware sense
|
|
//------------------------------------------------------------------
|
|
//
|
|
if (!Bit_Table[line].sense)
|
|
{
|
|
port_value &= (Byte)(~Bit_Table[line].mask);
|
|
}
|
|
else
|
|
{
|
|
port_value |= Bit_Table[line].mask;
|
|
}
|
|
|
|
//
|
|
//------------------------------------------------------------------
|
|
// put the modified value into the appropriate port
|
|
//------------------------------------------------------------------
|
|
//
|
|
outportb(Bit_Table[line].port, port_value);
|
|
}
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
Logical
|
|
BitTrace::IsLineValidImplementation(Byte line)
|
|
{
|
|
return line<ELEMENTS(Bit_Table);
|
|
}
|
|
|
|
#endif
|