; Excepts from Explorer-3D
; John Lockwood
; 1998
...
Vector3 STRUCT ; Use Structure to grouping several variables
X Real4 ? ; into one entity. They are the basis for classes in C++
Y Real4 ?
Z Real4 ?
Vector3 ENDS
...
Position Vector3<12.5,25.0,100.0> ; Initial position Vector
Velocity Vector3<10.0,20.0,30.0> ; Initial velocity
OldX Real4 ?
OldXR8 Real8 ?
XMove Real4 ?
ZMove Real4 1000.0
DeltaT Real10 0.125 ; 1/8th of a second
MoveAngle Real10 3.0
WallHeight DW 5 ; Height of Maze walls (Integer distance in meter)
FloorHeight DW 20 ; Height of Maze walls (Integer distance in meter)
...
FINIT ; Initialize the FPU
; Always do this once when program begins!
FLD Position.X ; Access element of the Vector3 Structure
FST OldX ; Save Position.X
FST OldXR8 ; Also save as Double-precision
FLD Velocity.X
FLD DeltaT
FMUL
FST XMove
FADD
FSTP Position.X
LEA SI , Position ; Load effective address of Position
FLD (Vector3 PTR [SI]).Y ; Cast [SI] as a pointer to a Vector3
FILD FloorHeight ; Load an Integer into FPU
FILD WallHeight
FSUB
FADD
FST (Vector3 PTR [SI]).Y
FSTP (Vector3 PTR [SI+4]).Y ; The '+4' is important..
XOR BYTE PTR [Velocity.X+3] , 80h ; FCHS w/o a FPU!
MOV AX,DS ; Set ES=DS
MOV ES,AX
LEA SI , Velocity.Y ; All variables can be moved in Memory
LEA DI , Velocity.Z
MOVSD
FLD ZMove
FLDPI
FLD MoveAngle
FDIV
FCOS ; FPU Calculates on Radians
FMUL
FSTP ZMove
|