Files
TeslaRel410/CODE/RP/MUNGA_L4/NETSHARE.ASM
T
CydandClaude Fable 5 fdd9ac9d97 Initial import: Tesla Release 4.10 (Tesla:BattleTech & Tesla:Red Planet)
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>
2026-07-02 13:21:58 -05:00

139 lines
3.5 KiB
NASM

;===========================================================================
; Data segment
;===========================================================================
.386p
.MODEL flat
_DATA SEGMENT DWORD USE32
Selector dw 0000 ;got from _mapRMBuff
; EXTRN C Shared_Memory_Buffer :DATAPTR
EXTRN C Function_Ptr :DATAPTR
EXTRN C Buffer_Length_Ptr :DATAPTR
EXTRN C Net_Common_Ptr :DATAPTR
EXTRN C baseadr:WORD ;real mode segment of structure
EXTRN C offs:WORD ;real mode offset of structure
; EXTRN C RMShared_Memory_Buffer_Off :WORD
EXTRN C RMBuffer_Length_Off :WORD
EXTRN C RMFunction_Off :WORD
_DATA ENDS
;===========================================================================
; Code segment
;===========================================================================
_TEXT SEGMENT DWORD USE32
;###########################################################################
_mapRMBuff PROC CPP NEAR USES EAX EBX ECX EDX es
PUBLIC _mapRMBuff
;--------------------------------------------------------------------------
; Map descriptor (i.e selector) to real mode memory
;--------------------------------------------------------------------------
mov ax, 0002h
mov bx, baseadr
INT 31h
mov Selector, ax
;--------------------------------------------------------------------------
; Examine everything
;--------------------------------------------------------------------------
;Check base address in cx:edx
; mov ax, 0006h
; mov bx, Selector
; INT 31h
;Check segment limit in ax
; lsl ax, Selector
;Examine Access Rights in ax
; lar ax, Selector
ret
ENDP _mapRMBuff
;###########################################################################
_getRMBuff PROC CPP NEAR USES EAX EBX ECX EDX edi esi es
PUBLIC _getRMBuff
;get counter for Block copy from real mode address
mov es, Selector
mov di, RMBuffer_Length_Off
xor ecx, ecx
mov cx, WORD PTR es:[di]
add cx, 6 ;include Function,Status,Buffer_Length to Block
;get Block address
mov di, RMFunction_Off ;real mode Block
mov esi, Function_Ptr ;protected mode Block
CopyBlock:
xor eax, eax
mov al, es:[di] ;BYTE PTR es:[edi]
mov BYTE PTR [esi], al ;copy to protected mode
inc di
inc esi
loopnz CopyBlock
ret
ENDP _getRMBuff
;###########################################################################
_setRMBuff PROC CPP NEAR USES EAX EBX ECX EDX edi esi es
PUBLIC _setRMBuff
;Copy from protected mode address
mov es, Selector
mov di, RMFunction_Off
mov esi, Function_Ptr
xor ecx, ecx
mov ebx, [Buffer_Length_Ptr];counter
mov cx, [ebx]
add cx, 6 ;include Function,Status,Buffer_Length to Block
CopyBlk:
xor eax, eax
mov al, [esi]
mov es:[di], eax ;copy to real mode
inc di
inc esi
loopnz CopyBlk
ret
ENDP _setRMBuff
;###########################################################################
_getRMNumbers PROC CPP NEAR USES EAX EBX ECX EDX edi esi es
PUBLIC _getRMNumbers
;Copy from protected mode address
mov es, Selector
;get counter for Block copy from real mode address
xor ecx, ecx
mov cx, 6 ;sizeof long Version_Number and short Interrupt_Number
;get Block address
mov di, offs ;real mode Block
mov esi, Net_Common_Ptr ;protected mode Block
CopyBl:
xor eax, eax
mov al, es:[di]
mov BYTE PTR [esi], al ;copy to protected mode
inc di
inc esi
loopnz CopyBl
ret
ENDP _getRMNumbers
_TEXT ENDS
END