Files
RP412/MUNGA_L4/L4TRACE.cpp
T
CydandClaude Opus 4.8 4abbf8879f Initial import of Red Planet v4.10 Win32 source
Imports the current Win32 source for the pod-racing game 'Red Planet',
built on the MUNGA engine and its L4 (Win32/DirectX) platform layer:

- MUNGA / MUNGA_L4: cross-platform engine core and Win32 backend
- RP / RP_L4: Red Planet game logic and Win32 application
- DivLoader, Setup1: asset loader and installer project
- lib, MUNGA_L4/openal, MUNGA_L4/sos: third-party audio dependencies

Removed stale Subversion metadata and added .gitignore/.gitattributes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 07:59:51 -05:00

128 lines
3.1 KiB
C++

#include "mungal4.h"
#pragma hdrstop
#include "..\munga\style.h"
void* Get_Caller(int level)
{
char *address;
__asm MOV address, 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