summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSteven Fuller <relnev@icculus.org>2001-08-07 03:16:27 +0000
committerPatryk Obara <dreamer.tan@gmail.com>2019-08-20 02:22:36 +0200
commit78cdb29e7aa6860640b9ab77994b17b22840cf11 (patch)
treee814bcff1ea12e5123f81156bb671f76f3b2ea85 /src
parent455f56573ef8378ad1297970829e227c80525959 (diff)
Removed several unused files.
Diffstat (limited to 'src')
-rw-r--r--src/avp/macro.h14
-rw-r--r--src/avp/mp_launch.c115
-rw-r--r--src/avp/win95/d3d_hud.cpp2
-rw-r--r--src/avp/win95/dbdefs.h118
-rw-r--r--src/avp/win95/mousecentreing.cpp57
-rw-r--r--src/win95/d3dmacs.h147
-rw-r--r--src/win95/pentime.h64
-rw-r--r--src/win95/scandraw.asm2096
-rw-r--r--src/win95/vramtime.c33
-rw-r--r--src/win95/vramtime.h25
-rw-r--r--src/win95/zmouse.h164
11 files changed, 0 insertions, 2835 deletions
diff --git a/src/avp/macro.h b/src/avp/macro.h
deleted file mode 100644
index ed69646..0000000
--- a/src/avp/macro.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
-
- Project specific inline macro support,
- currently platform specific by
- default
-
-*/
-
-
-#define GNU_ABS(x) (((x) < 0) ? -(x) : (x))
-
-#define GNU_SIGN(x) (((x) < 0) ? -1 : +1)
-
-
diff --git a/src/avp/mp_launch.c b/src/avp/mp_launch.c
deleted file mode 100644
index 4ac44a5..0000000
--- a/src/avp/mp_launch.c
+++ /dev/null
@@ -1,115 +0,0 @@
-// Launches mplayer.com into a specific URL with LaunchMplayer()
-// By Rich Rice --rich@mpath.com
-// Modified by Edmond Meinfelder (edmond@mpath.com) for use with AvP
-
-#include <windows.h>
-#include <stdio.h>
-#include <sys/stat.h>
-
-#ifdef _MSC_VER
- #define stat _stat
-#endif
-
-// Execute executes whatever the text in cmdline is.
-// If an executable is successfully launched as a
-// result, TRUE is returned. False is returned if
-// nothing happens.
-
-static int
-Execute(char *cmdline)
-{
- STARTUPINFO StartupInfo;
- PROCESS_INFORMATION ProcessInfo;
-
- memset (&StartupInfo, 0, sizeof StartupInfo);
- StartupInfo.cb = sizeof (StartupInfo);
- StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
- StartupInfo.wShowWindow = SW_SHOWNORMAL;
-
- if (CreateProcess(NULL, cmdline, NULL, NULL, FALSE,
- CREATE_DEFAULT_ERROR_MODE, NULL, NULL,
- &StartupInfo, &ProcessInfo) == 0)
- return FALSE;
-
- return TRUE;
-}
-
-// Mplayer stores it installed location in the Windows Registry
-// under HKEY_LOCAL_MACHINE\Software\Mplayer\Main\Root Directory
-// This function returns the location stored in that string value.
-// Upon failure, FALSE is returned and, upon success, TRUE is
-// returned.
-// The location of the Mplayer's install path is returned in
-// the parameter mplayer_directory.
-
-static int
-GetMplayerDirectory(char *mplayer_directory)
-{
- HKEY hkey;
- HKEY key = HKEY_LOCAL_MACHINE;
- char subkey[]="software\\mpath\\mplayer\\main";
- char valuename[]="root directory";
- char buffer[MAX_PATH];
- DWORD dwType, dwSize;
-
-
- if (RegOpenKeyEx(key, subkey, 0, KEY_READ, &hkey) == ERROR_SUCCESS)
- {
- dwSize = MAX_PATH;
- if (RegQueryValueEx(hkey, valuename, 0, &dwType, (LPBYTE) buffer,
- &dwSize) == ERROR_SUCCESS)
- {
- sprintf(mplayer_directory, "%s", buffer);
- return TRUE;
- }
- RegCloseKey(hkey);
- }
-
- return FALSE;
-}
-
-// If the named file exists, this function
-// returns TRUE, otherwise FALSE is returned.
-
-static int
-FileExists(char *file)
-{
- struct stat buf;
- int result;
-
- // Get data associated with 'file'
- result = stat( file, &buf );
-
- // Check if we have a file
- if( result == 0 )
- {
- return TRUE;
- }
- return FALSE;
-}
-
-////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////
-// This is the only public function, it launches Mplayer's user interface.
-// This function returns FALSE upon failure and TRUE on success.
-
-int
-LaunchMplayer()
-{
- char mplayer_url[]="http://www.mplayer.com/mic/avp.html";
- char cmdline[MAX_PATH], mplaunch_exe[MAX_PATH], mplayer_directory[MAX_PATH];
-
- if (GetMplayerDirectory(mplayer_directory))
- {
- sprintf(mplaunch_exe, "%s\\programs\\mplaunch.exe", mplayer_directory);
- if (FileExists(mplaunch_exe))
- {
- sprintf(cmdline, "%s AvP.mpi", mplaunch_exe);
- return Execute(cmdline);
- }
- }
-
- sprintf(cmdline, "rundll32.exe url.dll,FileProtocolHandler %s", mplayer_url);
- return Execute(cmdline);
-}
diff --git a/src/avp/win95/d3d_hud.cpp b/src/avp/win95/d3d_hud.cpp
index 0987812..85baf15 100644
--- a/src/avp/win95/d3d_hud.cpp
+++ b/src/avp/win95/d3d_hud.cpp
@@ -17,8 +17,6 @@ extern "C" {
#include "stratdef.h"
#include "gamedef.h"
#include "bh_types.h"
-#include "d3dmacs.h"
-//#include "string.h"
#include "hudgfx.h"
#include "huddefs.h"
diff --git a/src/avp/win95/dbdefs.h b/src/avp/win95/dbdefs.h
deleted file mode 100644
index bf01ffb..0000000
--- a/src/avp/win95/dbdefs.h
+++ /dev/null
@@ -1,118 +0,0 @@
-// enums for the number of information screens we have
-// data description
-
-typedef enum maps{
- I_No_Map,
- I_Map_Gen1, I_Map_Gen2, I_Map_Gen3, I_Map_Gen4,
- I_Map_Cmc1, I_Map_Cmc2, I_Map_Cmc3, I_Map_Cmc4, I_Map_Cmc5, I_Map_Cmc6,
- I_Map_Rnd1, I_Map_Rnd2, I_Map_Rnd3, I_Map_Rnd4,
- I_Map_Mps1, I_Map_Mps2, I_Map_Mps3, I_Map_Mps4,
- I_Map_Sp1, I_Map_Sp2, I_Map_Sp3,
- I_Map_Surface, I_Map_Medlab,
- I_Num_Maps
-}DATABASE_MAP;
-
-typedef enum
-{
- I_Floor_0 = 0,
- I_Floor_1,
- I_Floor_2,
- I_Floor_3,
- I_Floor_4,
- I_Floor_5,
- I_Max_Num_Floors,
-
-}FLOOR_NUM;
-
-typedef enum
-{
- I_No_Weapon,
- I_Weapon_Pulse,
- I_Num_Weapons
-
-}DATABASE_WEAPON;
-
-
-typedef enum
-{
- I_No_Message,
- I_Message_1,
- I_Num_Messages,
-
-}DATABASE_MESSAGE;
-
-typedef struct dbasedesc
-{
- int floor;
- DATABASE_MAP map_enum;
- DATABASE_WEAPON weap_enum;
- DATABASE_MESSAGE message_enum;
- short pixel_x;
- short pixel_y;
-
-}DBASEDESC;
-
-// enums to control flow of the database screens
-// data base states - each one is associated with a
-// enum to describes the option from the satae
-
-typedef enum
-{
- DB_STATE_SELECT,
- DB_STATE_MAP,
- DB_STATE_MESSAGE,
- DB_STATE_WEAPON,
- DB_STATE_LOAD,
- DB_STATE_SAVE,
- DB_STATE_END,
- NUM_DB_STATES,
-
-}DB_MENU_STATE;
-
-
-
-typedef enum database_options
-{
- DB_MAP_OPTION,
- DB_MESSAGE_OPTION,
- DB_WEAPON_OPTION,
- DB_LOAD_OPTION,
- DB_SAVE_OPTION,
- DB_LOGOFF_OPTION,
- DB_QUIT_OPTION,
- DB_NUM_OPTIONS
-
-}DB_MENU_OPTIONS;
-
-
-typedef enum map_screen_options
-{
- DB_MAP_EXIT_OPTION,
- DB_MAP_LOGOFF_OPTION,
- DB_NUM_MAP_OPTIONS,
-
-}DB_MAP_OPTIONS;
-
-typedef enum
-{
- DB_WEAPON_EXIT_OPTION,
- DB_WEAPON_LOGOFF_OPTION,
- DB_NUM_WEAPON_OPTIONS,
-
-}DB_WEAPON_OPTIONS;
-
-typedef enum
-{
- DB_MESSAGE_PLAY_OPTION,
- DB_MESSAGE_STOP_OPTION,
- DB_MESSAGE_EXIT_OPTION,
- DB_MESSAGE_LOGOFF_OPTION,
- DB_NUM_MESSAGE_OPTIONS,
-
-}DB_MESSAGE_OPTIONS;
-
-
-extern void DatabaseMenus(DATABASE_BLOCK*);
-
-extern void PlatformSpecificEnteringDatabase();
-extern void PlatformSpecificExitingDatabase();
diff --git a/src/avp/win95/mousecentreing.cpp b/src/avp/win95/mousecentreing.cpp
deleted file mode 100644
index 3fc7c3e..0000000
--- a/src/avp/win95/mousecentreing.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-#include <windows.h>
-#include <process.h>
-
-#include <math.h>
-
-
-extern "C"
-{
- extern BOOL bActive;
- extern int WinLeftX, WinRightX, WinTopY, WinBotY;
-
-}
-
-static volatile int EndMouseThread=0;
-
-
-
-
-//thread continually moves the mouse cursor to the centre of the window
-//so you don't accidently click outside it.
-void MouseThread(void* )
-{
- while(!EndMouseThread)
- {
- Sleep(10);
-
- if(!bActive) continue;
-
- SetCursorPos((WinLeftX+WinRightX)>>1,(WinTopY+WinBotY)>>1);
-
-
- }
- EndMouseThread=0;
-}
-
-
-
-extern "C"
-{
-
-
-void InitCentreMouseThread()
-{
- _beginthread(MouseThread,10000,0);
-}
-
-
-void FinishCentreMouseThread()
-{
- EndMouseThread=1;
-}
-
-
-
-};
-
-
diff --git a/src/win95/d3dmacs.h b/src/win95/d3dmacs.h
deleted file mode 100644
index ce26f43..0000000
--- a/src/win95/d3dmacs.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (C) 1995, 1996 Microsoft Corporation. All Rights Reserved.
- *
- * File: d3dmacs.h
- *
- * Useful macros for generating execute buffers. Consult the D3D sample
- * code for examples of their usage.
- *
- * Use OP_NOP to QWORD align triangle and line instructions.
- */
-
-#ifndef __D3DMACS_H__
-#define __D3DMACS_H__
-
-#undef RELEASE
-
-#ifndef __cplusplus
-#define MAKE_MATRIX(lpDev, handle, data) \
- if (lpDev->lpVtbl->CreateMatrix(lpDev, &handle) != D3D_OK) \
- return FALSE; \
- if (lpDev->lpVtbl->SetMatrix(lpDev, handle, &data) != D3D_OK) \
- return FALSE
-#define RELEASE(x) if (x != NULL) {x->lpVtbl->Release(x); x = NULL;}
-#endif
-
-#ifdef __cplusplus
-#define MAKE_MATRIX(lpDev, handle, data) \
- if (lpDev->CreateMatrix(&handle) != D3D_OK) \
- return FALSE; \
- if (lpDev->SetMatrix(handle, &data) != D3D_OK) \
- return FALSE
-#define RELEASE(x) if (x != NULL) {x->Release(); x = NULL;}
-#endif
-
-#define PUTD3DINSTRUCTION(op, sz, cnt, ptr) \
- ((LPD3DINSTRUCTION) ptr)->bOpcode = op; \
- ((LPD3DINSTRUCTION) ptr)->bSize = sz; \
- ((LPD3DINSTRUCTION) ptr)->wCount = cnt; \
- ptr = (void *)(((LPD3DINSTRUCTION) ptr) + 1)
-
-#define VERTEX_DATA(loc, cnt, ptr) \
- if ((ptr) != (loc)) memcpy((ptr), (loc), sizeof(D3DVERTEX) * (cnt)); \
- ptr = (void *)(((LPD3DVERTEX) (ptr)) + (cnt))
-
-// OP_MATRIX_MULTIPLY size: 4 (sizeof D3DINSTRUCTION)
-#define OP_MATRIX_MULTIPLY(cnt, ptr) \
- PUTD3DINSTRUCTION(D3DOP_MATRIXMULTIPLY, sizeof(D3DMATRIXMULTIPLY), cnt, ptr)
-
-// MATRIX_MULTIPLY_DATA size: 12 (sizeof MATRIXMULTIPLY)
-#define MATRIX_MULTIPLY_DATA(src1, src2, dest, ptr) \
- ((LPD3DMATRIXMULTIPLY) ptr)->hSrcMatrix1 = src1; \
- ((LPD3DMATRIXMULTIPLY) ptr)->hSrcMatrix2 = src2; \
- ((LPD3DMATRIXMULTIPLY) ptr)->hDestMatrix = dest; \
- ptr = (void *)(((LPD3DMATRIXMULTIPLY) ptr) + 1)
-
-// OP_STATE_LIGHT size: 4 (sizeof D3DINSTRUCTION)
-#define OP_STATE_LIGHT(cnt, ptr) \
- PUTD3DINSTRUCTION(D3DOP_STATELIGHT, sizeof(D3DSTATE), cnt, ptr)
-
-// OP_STATE_TRANSFORM size: 4 (sizeof D3DINSTRUCTION)
-#define OP_STATE_TRANSFORM(cnt, ptr) \
- PUTD3DINSTRUCTION(D3DOP_STATETRANSFORM, sizeof(D3DSTATE), cnt, ptr)
-
-// OP_STATE_RENDER size: 4 (sizeof D3DINSTRUCTION)
-#define OP_STATE_RENDER(cnt, ptr) \
- PUTD3DINSTRUCTION(D3DOP_STATERENDER, sizeof(D3DSTATE), cnt, ptr)
-
-// STATE_DATA size: 8 (sizeof D3DSTATE)
-#define STATE_DATA(type, arg, ptr) \
- ((LPD3DSTATE) ptr)->drstRenderStateType = (D3DRENDERSTATETYPE)type; \
- ((LPD3DSTATE) ptr)->dwArg[0] = arg; \
- ptr = (void *)(((LPD3DSTATE) ptr) + 1)
-
-// OP_PROCESS_VERTICES size: 4 (sizeof D3DINSTRUCTION)
-#define OP_PROCESS_VERTICES(cnt, ptr) \
- PUTD3DINSTRUCTION(D3DOP_PROCESSVERTICES, sizeof(D3DPROCESSVERTICES), cnt, ptr)
-
-// PROCESSVERTICES_DATA size: 16 (sizeof D3DPROCESSVERTICES)
-#define PROCESSVERTICES_DATA(flgs, strt, cnt, ptr) \
- ((LPD3DPROCESSVERTICES) ptr)->dwFlags = flgs; \
- ((LPD3DPROCESSVERTICES) ptr)->wStart = strt; \
- ((LPD3DPROCESSVERTICES) ptr)->wDest = strt; \
- ((LPD3DPROCESSVERTICES) ptr)->dwCount = cnt; \
- ((LPD3DPROCESSVERTICES) ptr)->dwReserved = 0; \
- ptr = (void *)(((LPD3DPROCESSVERTICES) ptr) + 1)
-
-// OP_TRIANGLE_LIST size: 4 (sizeof D3DINSTRUCTION)
-#define OP_TRIANGLE_LIST(cnt, ptr) \
- PUTD3DINSTRUCTION(D3DOP_TRIANGLE, sizeof(D3DTRIANGLE), cnt, ptr)
-
-#define TRIANGLE_LIST_DATA(loc, count, ptr) \
- if ((ptr) != (loc)) memcpy((ptr), (loc), sizeof(D3DTRIANGLE) * (count)); \
- ptr = (void *)(((LPD3DTRIANGLE) (ptr)) + (count))
-
-// OP_LINE_LIST size: 4 (sizeof D3DINSTRUCTION)
-#define OP_LINE_LIST(cnt, ptr) \
- PUTD3DINSTRUCTION(D3DOP_LINE, sizeof(D3DLINE), cnt, ptr)
-
-#define LINE_LIST_DATA(loc, count, ptr) \
- if ((ptr) != (loc)) memcpy((ptr), (loc), sizeof(D3DLINE) * (count)); \
- ptr = (void *)(((LPD3DLINE) (ptr)) + (count))
-
-// OP_POINT_LIST size: 8 (sizeof D3DINSTRUCTION + sizeof D3DPOINT)
-#define OP_POINT_LIST(first, cnt, ptr) \
- PUTD3DINSTRUCTION(D3DOP_POINT, sizeof(D3DPOINT), 1, ptr); \
- ((LPD3DPOINT)(ptr))->wCount = cnt; \
- ((LPD3DPOINT)(ptr))->wFirst = first; \
- ptr = (void*)(((LPD3DPOINT)(ptr)) + 1)
-
-// OP_SPAN_LIST size: 8 (sizeof D3DINSTRUCTION + sizeof D3DSPAN)
-#define OP_SPAN_LIST(first, cnt, ptr) \
- PUTD3DINSTRUCTION(D3DOP_SPAN, sizeof(D3DSPAN), 1, ptr); \
- ((LPD3DSPAN)(ptr))->wCount = cnt; \
- ((LPD3DSPAN)(ptr))->wFirst = first; \
- ptr = (void*)(((LPD3DSPAN)(ptr)) + 1)
-
-// OP_BRANCH_FORWARD size: 18 (sizeof D3DINSTRUCTION + sizeof D3DBRANCH)
-#define OP_BRANCH_FORWARD(tmask, tvalue, tnegate, toffset, ptr) \
- PUTD3DINSTRUCTION(D3DOP_BRANCHFORWARD, sizeof(D3DBRANCH), 1, ptr); \
- ((LPD3DBRANCH) ptr)->dwMask = tmask; \
- ((LPD3DBRANCH) ptr)->dwValue = tvalue; \
- ((LPD3DBRANCH) ptr)->bNegate = tnegate; \
- ((LPD3DBRANCH) ptr)->dwOffset = toffset; \
- ptr = (void *)(((LPD3DBRANCH) (ptr)) + 1)
-
-// OP_SET_STATUS size: 20 (sizeof D3DINSTRUCTION + sizeof D3DSTATUS)
-#define OP_SET_STATUS(flags, status, _x1, _y1, _x2, _y2, ptr) \
- PUTD3DINSTRUCTION(D3DOP_SETSTATUS, sizeof(D3DSTATUS), 1, ptr); \
- ((LPD3DSTATUS)(ptr))->dwFlags = flags; \
- ((LPD3DSTATUS)(ptr))->dwStatus = status; \
- ((LPD3DSTATUS)(ptr))->drExtent.x1 = _x1; \
- ((LPD3DSTATUS)(ptr))->drExtent.y1 = _y1; \
- ((LPD3DSTATUS)(ptr))->drExtent.x2 = _x2; \
- ((LPD3DSTATUS)(ptr))->drExtent.y2 = _y2; \
- ptr = (void *)(((LPD3DSTATUS) (ptr)) + 1)
-
-// OP_NOP size: 4
-#define OP_NOP(ptr) \
- PUTD3DINSTRUCTION(D3DOP_TRIANGLE, sizeof(D3DTRIANGLE), 0, ptr)
-
-#define OP_EXIT(ptr) \
- PUTD3DINSTRUCTION(D3DOP_EXIT, 0, 0, ptr)
-
-#define QWORD_ALIGNED(ptr) \
- !(0x00000007L & (ULONG)(ptr))
-
-#endif // __D3DMACS_H__
diff --git a/src/win95/pentime.h b/src/win95/pentime.h
deleted file mode 100644
index 8c66961..0000000
--- a/src/win95/pentime.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* pentime.h */
-extern unsigned long int rdtsc_lo(void);
-extern unsigned long int rdtsc_hi(void);
-extern unsigned long int rdtsc_mid(void);
-
-#define ProfileStart() \
-{ \
- int time = rdtsc_lo();
-#define ProfileStop(x) \
- textprint("%s %d\n",x,rdtsc_lo()-time); \
-}
-
-#pragma aux rdtsc_lo = \
- "db 0fh, 31h" \
- value [eax] \
- modify [edx];
-
-#pragma aux rdtsc_hi = \
- "db 0fh, 31h" \
- value [edx] \
- modify [eax];
-
-#pragma aux rdtsc_mid = \
- "db 0fh, 31h" \
- "shr eax, 10h" \
- "shl edx, 10h" \
- "add eax, edx" \
- value [eax] \
- modify [edx];
-
-/* Test to see if we have a Pentium or not. Note that this test is reliable
- * enough for a tools project (where we can put in an overide switch) but not
- * for a released product.
- */
-extern unsigned char Pentium(void);
-#pragma aux Pentium = \
- "pushfd" \
- "pop eax" \
- "or eax, 00200000h" \
- "push eax" \
- "popfd" \
- "pushfd" \
- "pop eax" \
- "mov ecx, eax" \
- "and eax, 00200000h" \
- "cmp eax, 0" \
- "je not_Pentium" \
- "mov eax, ecx" \
- "and eax, 0ffdfffffh" \
- "push eax" \
- "popfd" \
- "pushfd" \
- "pop eax" \
- "and eax, 00200000h" \
- "cmp eax, 0" \
- "jne not_Pentium" \
- "is_Pentium: mov al, 1" \
- "jmp finish" \
- "not_Pentium: mov al, 0" \
- "finish: nop" \
- value [al] \
- modify [eax ecx]
-
-
diff --git a/src/win95/scandraw.asm b/src/win95/scandraw.asm
deleted file mode 100644
index aca3c4b..0000000
--- a/src/win95/scandraw.asm
+++ /dev/null
@@ -1,2096 +0,0 @@
-;.586
-;.8087
-;
-; Assembly scandraws - designed for Pentiums/Pentium Pros but should work ok
-; on 486s and strange hybrid processors.
-;
-; (C) Kevin Lea 12:03:17 96/12/05
-;
-; Please excuse the mess, I haven't tidied up yet. Only the inner loops are
-; well coded, since these take far more runtime than initialisation routines.
-;
-
-
-SOURCE_SBITSV EQU 16
-SOURCE_SBITSU EQU 7
-
-_DATA SEGMENT DWORD PUBLIC 'DATA'
-
- EXTRN _SCASM_Lighting:DWORD
- EXTRN _SCASM_Destination:DWORD
- EXTRN _SCASM_Bitmap:DWORD
- EXTRN _SCASM_StartU:DWORD
- EXTRN _SCASM_StartV:DWORD
- EXTRN _SCASM_StartI:DWORD
- EXTRN _SCASM_DeltaU:DWORD
- EXTRN _SCASM_DeltaV:DWORD
- EXTRN _SCASM_DeltaI:DWORD
- EXTRN _SCASM_ScanLength:DWORD
- EXTRN _SCASM_ShadingTableSize:DWORD
- EXTRN _SCASM_TextureDeltaScan:DWORD
-; EXTRN _TLT:BYTE PTR
-
-if 0
- EXTRN _sine:DWORD ;
- EXTRN _cosine:DWORD ; these 2 in 3D engine already
- EXTRN _MTRB_Bitmap:DWORD
- EXTRN _MTRB_Destination:DWORD
- EXTRN _MTRB_ScanOffset:DWORD
- EXTRN _MTRB_Angle:DWORD;
- EXTRN _MTRB_InvScale:DWORD;
- EXTRN _MTRB_ScreenHeight:DWORD; equ 48
- EXTRN _MTRB_ScreenWidth:DWORD; equ (49*2+1)
- EXTRN _MTRB_ScreenCentreX:DWORD; equ (MTRB_ScreenWidth/2+1)
- EXTRN _MTRB_ScreenCentreY:DWORD; equ MTRB_ScreenHeight
- EXTRN _MTRB_CentreU:DWORD
- EXTRN _MTRB_CentreV:DWORD
-endif
-
- align
-
-
- FixedScale dd 65536.0
- FixedScale8 dd 8192.0 ; 2^16 / 8
- One dd 1.0
- FloatTemp dd ?
- FPUCW word ?
- OldFPUCW word ?
-
- DeltaUFrac dd ?
- DeltaVFrac dd ?
- DeltaIFrac dd ?
- Wholesections dd ?
- PixelsRemaining dd ?
- UVintVfracStepVCarry dd ?
- UVintVfracStepVNoCarry dd ?
- UVintVfracStep equ UVintVfracStepVNoCarry
- IintWithCarry dd ?
- IintNoCarry dd ?
- IintStep equ IintNoCarry
-
- StackStore dd ?
-
- ShadeTable equ _TextureLightingTable
-
-
-
- aspectAdjust dd (6 SHL 16) / 5
- startingU dd 0
- startingV dd 0
- dUCol dd 0
- dVCol dd 0
- dURow dd 0
- dVRow dd 0
- rowCount dd 0
-
-
-
-
-
-_DATA ENDS
-
-_TEXT SEGMENT BYTE PUBLIC 'CODE'
- ASSUME cs:_TEXT, ds:_DATA
-
-.586
-
-if 0
-align
-PUBLIC _ScanDraw_GouraudScan
-PUBLIC ScanDraw_GouraudScan_
-ScanDraw_GouraudScan_:
-_ScanDraw_GouraudScan:
-
-; calculate horizontal deltas
- pushad
- ; mov [StackStore],esp
-
- mov eax,_SCASM_ScanLength
- mov ebp,eax
-
- and eax,7
- shr ebp,3
-
- mov [PixelsRemaining],eax
- mov [Wholesections],ebp ; store widths
-
-
- ; setup initial coordinates
- mov ebx,_SCASM_DeltaI ; get i 16.16 step
- mov eax,ebx ; copy it
- sar eax,16 ; get i int step
- shl ebx,16 ; get i frac step
- imul eax,_SCASM_ShadingTableSize
- mov IintNoCarry,eax ; save whole step in non-i-carry slot
- add eax,_SCASM_ShadingTableSize ; calculate whole step + i carry
- mov IintWithCarry,eax ; save in i-carry slot
-
- mov esi,_SCASM_StartI
- mov edx,esi
- sar esi,16
- shl edx,16
- imul esi,_SCASM_ShadingTableSize
- add esi,_SCASM_Lighting
-
- xor eax,eax
- mov edi,_SCASM_Destination
-
- test ebp,ebp
-
- jz GS_EndPixels
-if 1
-GS_ScanLoop:
- ; 8 pixel span code
- ; edi = dest dib bits at current pixel
- ; esi = lighting pointer
- ; edx = i fraction 0.32
- ; ebp = carry scratch
-
-
-; mov al,[esi]
-; add edx,DeltaIFrac
-; sbb ebp,ebp
-; add esi,[4*ebp + IintStep]
-; mov [edi],al
-
- mov al,[esi] ;get colour to draw
-
- add edx,ebx ;increase intensity
- sbb ebp,ebp ;check for overflow
-
- add esi,[4*ebp + IintStep] ;add to esi required change
- add edx,ebx ;increase intensity
-
- sbb ebp,ebp ;check for overflow
- mov [edi+0],al ;draw out pixel
-
- mov al,[esi]
-
- add esi,[4*ebp + IintStep]
- add edx,ebx
-
- sbb ebp,ebp
- mov [edi+1],al
-
- mov al,[esi]
-
- add esi,[4*ebp + IintStep]
- add edx,ebx
-
- sbb ebp,ebp
- mov [edi+2],al
-
- mov al,[esi]
-
- add esi,[4*ebp + IintStep]
- add edx,ebx
-
- sbb ebp,ebp
- mov [edi+3],al
-
- mov al,[esi]
-
- add esi,[4*ebp + IintStep]
- add edx,ebx
-
- sbb ebp,ebp
- mov [edi+4],al
-
- mov al,[esi]
-
- add esi,[4*ebp + IintStep]
- add edx,ebx
-
- sbb ebp,ebp
- mov [edi+5],al
-
- mov al,[esi]
-
- add esi,[4*ebp + IintStep]
- add edx,ebx
-
- sbb ebp,ebp
- mov [edi+6],al
-
- mov al,[esi]
-
- add esi,[4*ebp + IintStep]
- mov [edi+7],al
-
-
- lea edi,[edi+8]
- dec Wholesections ; decrement span count
-
- jnz GS_ScanLoop ; loop back
-endif
-
- mov eax,[PixelsRemaining]
- test eax,eax
- jz GS_finish
-GS_EndPixels:
-
- mov al,[esi] ; get texture pixel
-
- lea edi,[edi+1]
-
- add edx,ebx
- sbb ebp,ebp
- mov [edi-1],al
-
- add esi,[4*ebp + IintStep]
- dec [PixelsRemaining]
-
- jnz GS_EndPixels
-GS_finish:
-; mov esp, [StackStore]
- popad
- ret
-endif
-
-if 1
-align
-PUBLIC _ScanDraw_GouraudScan
-PUBLIC ScanDraw_GouraudScan_
-ScanDraw_GouraudScan_:
-_ScanDraw_GouraudScan:
-
-; calculate horizontal deltas
- pushad
- mov [StackStore],esp
-
- mov eax,_SCASM_ScanLength
- mov ecx,eax
-
- ; and ecx,7
- shr eax,3
-
- mov [PixelsRemaining],ecx
- mov [Wholesections],eax ; store widths
-
-
- ; setup initial coordinates
- mov esp,_SCASM_DeltaI ; get i 16.16 step
-; sar esp,8 ; get i frac step
-
- mov ebx,_SCASM_StartI
-; sar ebx,8
- mov edx,ebx
- sar edx,8
- and edx,0xff00h
-
- mov esi,_SCASM_Lighting
-
- mov edi,_SCASM_Destination
- add edi,ecx
- ; test eax,eax
- neg ecx
- sub eax,eax
- jz GS_EndPixels
-if 1
- mov ecx,eax
-GS_ScanLoop:
-
-
- mov al,[esi+edx]
- mov edx,ebx
-
- add ebx,esp
- and edx,0xff00h
-
- mov [edi+0],al
- nop
-
- lea edi,[edi+8]
- dec ecx ; decrement span count
-
- jnz GS_ScanLoop ; loop back
-endif
-
- mov ecx,[PixelsRemaining]
- test ecx,ecx
- jz GS_finish
-GS_EndPixels:
-
-
-
- mov al,[esi+edx]
- mov edx,ebx
-
- sar edx,8
- add ebx,esp
-
- and edx,0xff00h
- mov [edi+ecx],al
-
- inc ecx
- jnz GS_EndPixels
-GS_finish:
- mov esp, [StackStore]
- popad
- ret
-endif
-
-align
-; Drawing a 2D polygon which has DeltaV=0 and is transparent
-PUBLIC _ScanDraw2D_VAlignedTransparent
-PUBLIC ScanDraw2D_VAlignedTransparent_
-_ScanDraw2D_VAlignedTransparent:
-ScanDraw2D_VAlignedTransparent_:
-
- pushad
- mov [StackStore],esp
- mov edx,_SCASM_ScanLength
-
- mov esi,_SCASM_StartU ; get u 16.16 fixedpoint coordinate
- mov esp,esi ; copy it
- sar esi,16 ; get integer part
- shl esp,16 ; get fractional part
-
- mov eax,_SCASM_StartV ; get v 16.16 fixedpoint coordinate
- sar eax,16 ; get integer part
- imul eax,_SCASM_TextureDeltaScan ; calc texture scanline address
- add esi,eax ; calc texture offset
- add esi,_SCASM_Bitmap ; calc address
-
- mov edi,_SCASM_Destination
- mov ebx,_SCASM_DeltaU ; get u 16.16 step
- mov ecx,ebx ; copy it
- sar ebx,16 ; get u int step
- shl ecx,16 ; get u frac step
-
- ; ebx u int delta
- ; ecx u frac delta
- ; esp u frac total
- ; edi dest
- ; esi source
- ; edx pixels to draw
-VAT_ScanLoop:
- mov al,[esi] ; get texture pixel 0
- add esp,ecx
-
- adc esi,ebx
- inc edi
-
- test al,al
- jz VAT_SkipPixel
-
- mov [edi-1],al
- VAT_SkipPixel:
-
- dec edx ; decrement span count
- jnz VAT_ScanLoop ; loop back
-
- mov esp, [StackStore]
- popad
- ret
-
-; Drawing a 2D polygon which has DeltaV=0 and is opaque
-align
-PUBLIC ScanDraw2D_VAlignedOpaque_
-PUBLIC _ScanDraw2D_VAlignedOpaque
-ScanDraw2D_VAlignedOpaque_:
-_ScanDraw2D_VAlignedOpaque:
-
- pushad
- mov [StackStore],esp
- mov edx,_SCASM_ScanLength
-
- mov esi,_SCASM_StartU ; get u 16.16 fixedpoint coordinate
- mov esp,esi ; copy it
- sar esi,16 ; get integer part
- shl esp,16 ; get fractional part
-
- mov eax,_SCASM_StartV ; get v 16.16 fixedpoint coordinate
- sar eax,16 ; get integer part
- imul eax,_SCASM_TextureDeltaScan ; calc texture scanline address
- add esi,eax ; calc texture offset
- add esi,_SCASM_Bitmap ; calc address
-
- mov edi,_SCASM_Destination
-
- mov ebx,_SCASM_DeltaU ; get u 16.16 step
- mov ecx,ebx ; copy it
- sar ebx,16 ; get u int step
- shl ecx,16 ; get u frac step
-
- ; ebx u int delta
- ; ecx u frac delta
- ; esp u frac total
- ; edi dest
- ; esi source
- ; edx pixels to draw
-VAO_ScanLoop:
- mov al,[esi] ; get texture pixel 0
- add esp,ecx
-
- adc esi,ebx
- dec edx ; decrement span count
-
- mov [edi],al
- lea edi,[edi+1]
-
- jnz VAO_ScanLoop ; loop back
-
- mov esp, [StackStore]
- popad
- ret
-
-
-;
-; 2d case with shading
-;
-; mov eax,_SCASM_DeltaU
- ; mov bl,ah
-; mov eax,_SCASM_DeltaV
- ; mov cl,ah
-
-if 0
-align
-PUBLIC ScanDraw2D_Gouraud_
-PUBLIC _ScanDraw2D_Gouraud
-ScanDraw2D_Gouraud_:
-_ScanDraw2D_Gouraud:
-
-; calculate horizontal deltas
- pushad
-
- mov [StackStore],esp
- mov eax,_SCASM_ScanLength
-
- mov ebp,eax
- ; and eax,7
-
- shr ebp,3
- mov [PixelsRemaining],eax
-
- mov [Wholesections],ebp ; store widths
- mov eax,_SCASM_DeltaV ; C1 1 ; get v 16.16 step
-
- mov edx,_SCASM_DeltaU ; C2 1 ; get u 16.16 step
- mov ebx,eax ; C1 2 ; copy v 16.16 step
-
- sar eax,16 ; C1 3 ; get v int step
- mov ecx,edx ; C2 2 ; copy u 16.16 step
-
- shl ebx,16 ; C1 4 ; get v frac step
- mov esi,_SCASM_DeltaI ; C3 1 ; get i 16.16 step
-
- sar edx,16 ; C2 3 ; get u int step
- mov esp,esi ; C3 2 ; copy i 16.16 step
-
- shl ecx,16 ; C2 4 ; get u frac step
- mov DeltaVFrac,ebx ; C1 5 ; store it
-
- imul eax,_SCASM_TextureDeltaScan ; C1 6 ; calculate texture step for v int step
-
- sar esp,16-8 ; C3 3 ; get i int step
- mov DeltaUFrac,ecx ; C2 5 ; store it
-
- sar esi,8 ; C3 4 ; get i frac step
- add eax,edx ; C1+C2 1 ; calculate uint + vint step
-
- mov DeltaIFrac,esi ; C3 5 ; store it
- mov UVintVfracStepVNoCarry,eax ; C1+C2 2 ; save whole step in non-v-carry slot
-
- and esp,0xffffff00h ; C3 6
- add eax,_SCASM_TextureDeltaScan ; C1+C2 3 ; calculate whole step + v carry
-
- mov IintNoCarry,esp ; C3 7 ; save whole step in non-i-carry slot
- mov edi,_SCASM_Destination
-
- mov UVintVfracStepVCarry,eax ; C1+C2 4 ; save in v-carry slot
- add esp,256 ; C3 8 ; calculate whole step + i carry
-
- mov IintWithCarry,esp ; C3 9 ; save in i-carry slot
- mov esp,_SCASM_StartI ; C4 1
-
- mov edx,esp ; C4 2
- mov esi,_SCASM_StartU ; C5 1 ; get u 16.16 fixedpoint coordinate
-
- sar esp,16-8 ; C4 3
- mov ebx,esi ; C5 2 ; copy it
-
- sar edx,8 ; C4 4
- mov ecx,_SCASM_StartV ; C6 1 ; get v 16.16 fixedpoint coordinate
-
- sar esi,16 ; C5 3 ; get integer part
- mov eax,[edi] ; preread destination
-
- shl ebx,16 ; C5 4 ; get fractional part
- mov eax,ecx ; C6 2 ; copy it
-
- sar eax,16 ; C6 3 ; get integer part
- and esp,0xffffff00h ; C4 5
-
- shl ecx,16 ; C6 4 ; get fractional part shift [tears removal]
- add esp,_SCASM_Lighting ; C4 6
-
- imul eax,_SCASM_TextureDeltaScan ; C6 5 ; calc texture scanline address
-
-
- add esi,eax ; C7 1 ; calc texture offset
- xor eax,eax
-
- add esi,_SCASM_Bitmap ; C7 2 ; calc address
- test ebp,ebp
-
-
- sar ebx,16
- sar ecx,16
-
- mov eax,_SCASM_DeltaU
- mov bl,ah
- mov eax,_SCASM_DeltaV
- mov cl,ah
-
- mov esp,[PixelsRemaining]
- add edi,esp
- neg esp
-; mov eax,edx
-; add ch,cl
-
-
- jmp G3D_EndPixels
- jz G3D_EndPixels
-if 1
-G3D_ScanLoop:
- ; 8 pixel span code
- ; edi = dest dib bits at current pixel
- ; esi = texture pointer at current u,v
- ; esp = lighting pointer
- ; ebx = u fraction 0.32
- ; ecx = v fraction 0.32
- ; edx = i fraction 0.32
- ; ebp = carry scratch
-
-; mov al,[edi] ; preread the destination cache line
-
- mov al,[esi] ; get texture pixel 0
- add ecx,DeltaVFrac;test to remove tears
-
- sbb ebp,ebp ; get -1 if carry
- add ebx,DeltaUFrac
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add edx,DeltaIFrac
-
- sbb ebp,ebp
- mov al,[esp+eax]
-
- add esp,[4*ebp + IintStep]
- add ecx,DeltaVFrac;test to remove tears
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi],al ; store pixel 0
-
- add ebx,DeltaUFrac
- mov al,[esi] ; get texture pixel 1
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add edx,DeltaIFrac
-
- sbb ebp,ebp
- mov al,[esp+eax]
-
- add esp,[4*ebp + IintStep]
- add ecx,DeltaVFrac;test to remove tears
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+1],al ; store pixel 1
-
- add ebx,DeltaUFrac
- mov al,[esi] ; get texture pixel 2
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add edx,DeltaIFrac
-
- sbb ebp,ebp
- mov al,[esp+eax]
-
- add esp,[4*ebp + IintStep]
- add ecx,DeltaVFrac;test to remove tears
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+2],al ; store pixel 2
-
- add ebx,DeltaUFrac
- mov al,[esi] ; get texture pixel 3
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add edx,DeltaIFrac
-
- sbb ebp,ebp
- mov al,[esp+eax]
-
- add esp,[4*ebp + IintStep]
- add ecx,DeltaVFrac;test to remove tears
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+3],al ; store pixel 3
-
- add ebx,DeltaUFrac
- mov al,[esi] ; get texture pixel 4
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add edx,DeltaIFrac
-
- sbb ebp,ebp
- mov al,[esp+eax]
-
- add esp,[4*ebp + IintStep]
- add ecx,DeltaVFrac;test to remove tears
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+4],al ; store pixel 4
-
- add ebx,DeltaUFrac
- mov al,[esi] ; get texture pixel 5
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add edx,DeltaIFrac
-
- sbb ebp,ebp
- mov al,[esp+eax]
-
- add esp,[4*ebp + IintStep]
- add ecx,DeltaVFrac;test to remove tears
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+5],al ; store pixel 5
-
- add ebx,DeltaUFrac
- mov al,[esi] ; get texture pixel 6
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add edx,DeltaIFrac
-
- sbb ebp,ebp
- mov al,[esp+eax]
-
- add esp,[4*ebp + IintStep]
- add ecx,DeltaVFrac;test to remove tears
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+6],al ; store pixel 6
-
- add ebx,DeltaUFrac
- mov al,[esi] ; get texture pixel 7
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add edx,DeltaIFrac
-
- sbb ebp,ebp
- mov al,[esp+eax]
-
- add esp,[4*ebp + IintStep]
- dec Wholesections ; decrement span count
-
- mov [edi+7],al ; store pixel 7
- lea edi,[edi+8]
-
- jnz G3D_ScanLoop ; loop back
-endif
-
- mov eax,[PixelsRemaining]
- test eax,eax
- jz G3D_finish
-G3D_EndPixels:
-
- add ch,cl
- mov eax,edx
-
- sbb ebp,ebp ; get -1 if carry
- mov al,[esi]
-
- inc esp
- add bh,bl
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add edx,DeltaIFrac
-
- mov al,[eax+_TLT]
- test esp,esp
-
- mov [edi+esp],al
- jnz G3D_EndPixels
-G3D_finish:
- mov esp, [StackStore]
- popad
- ret
-
-endif
-
-
-;
-;
-; NEW CODE
-;
-;
-
-if 1
-align
-PUBLIC ScanDraw2D_Gouraud_
-PUBLIC _ScanDraw2D_Gouraud
-ScanDraw2D_Gouraud_:
-_ScanDraw2D_Gouraud:
-
-; calculate horizontal deltas
- pushad
-
- mov [StackStore],esp
- mov eax,_SCASM_ScanLength
-
- mov ebp,eax
- and eax,7
-
- shr ebp,3
- mov [PixelsRemaining],eax
-
- mov [Wholesections],ebp ; store widths
- mov eax,_SCASM_DeltaV ; C1 1 ; get v 16.16 step
-
- mov edx,_SCASM_DeltaU ; C2 1 ; get u 16.16 step
- mov ebx,eax ; C1 2 ; copy v 16.16 step
-
- sar eax,16 ; C1 3 ; get v int step
- mov ecx,edx ; C2 2 ; copy u 16.16 step
-
- shl ebx,16 ; C1 4 ; get v frac step
- mov esi,_SCASM_DeltaI ; C3 1 ; get i 16.16 step
-
- sar edx,16 ; C2 3 ; get u int step
- mov esp,esi ; C3 2 ; copy i 16.16 step
-
- shl ecx,16 ; C2 4 ; get u frac step
- mov DeltaVFrac,ebx ; C1 5 ; store it
-
- imul eax,_SCASM_TextureDeltaScan ; C1 6 ; calculate texture step for v int step
-
- sar esp,16-8 ; C3 3 ; get i int step
- mov DeltaUFrac,ecx ; C2 5 ; store it
-
- shl esi,16 ; C3 4 ; get i frac step
- add eax,edx ; C1+C2 1 ; calculate uint + vint step
-
- mov DeltaIFrac,esi ; C3 5 ; store it
- mov UVintVfracStepVNoCarry,eax ; C1+C2 2 ; save whole step in non-v-carry slot
-
- and esp,0xffffff00h ; C3 6
- add eax,_SCASM_TextureDeltaScan ; C1+C2 3 ; calculate whole step + v carry
-
- mov IintNoCarry,esp ; C3 7 ; save whole step in non-i-carry slot
- mov edi,_SCASM_Destination
-
- mov UVintVfracStepVCarry,eax ; C1+C2 4 ; save in v-carry slot
- add esp,256 ; C3 8 ; calculate whole step + i carry
-
- mov IintWithCarry,esp ; C3 9 ; save in i-carry slot
- mov esp,_SCASM_StartI ; C4 1
-
- mov edx,esp ; C4 2
- mov esi,_SCASM_StartU ; C5 1 ; get u 16.16 fixedpoint coordinate
-
- sar esp,16-8 ; C4 3
- mov ebx,esi ; C5 2 ; copy it
-
- shl edx,16 ; C4 4
- mov ecx,_SCASM_StartV ; C6 1 ; get v 16.16 fixedpoint coordinate
-
- sar esi,16 ; C5 3 ; get integer part
- mov eax,[edi] ; preread destination
-
- ; shl ebx,16 ; C5 4 ; get fractional part
- and ebx,0xffffh
- mov eax,ecx ; C6 2 ; copy it
-
- sar eax,16 ; C6 3 ; get integer part
- and esp,0xffffff00h ; C4 5
-
-; shl ecx,16 ; C6 4 ; get fractional part shift [tears removal]
- and ecx,0xffffh
- add esp,_SCASM_Lighting ; C4 6
-
- imul eax,_SCASM_TextureDeltaScan ; C6 5 ; calc texture scanline address
-
-
- add esi,eax ; C7 1 ; calc texture offset
- mov eax,_SCASM_DeltaU
-
- mov bl,ah
- mov eax,_SCASM_DeltaV
-
- mov cl,ah
- xor eax,eax
-
- add esi,_SCASM_Bitmap ; C7 2 ; calc address
- test ebp,ebp
-
- ; jmp G3D_EndPixels
- jz G3D_EndPixels
-if 1
-G3D_ScanLoop:
- ; 8 pixel span code
- ; edi = dest dib bits at current pixel
- ; esi = texture pointer at current u,v
- ; esp = lighting pointer
- ; ebx = u fraction 0.32
- ; ecx = v fraction 0.32
- ; edx = i fraction 0.32
- ; ebp = carry scratch
-
-; mov al,[edi] ; preread the destination cache line
-
- mov al,[esi] ; get texture pixel 0
- ; add ecx,DeltaVFrac;test to remove tears
- add ch,cl
-
- sbb ebp,ebp ; get -1 if carry
-; add ebx,DeltaUFrac
- add bh,bl
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add edx,DeltaIFrac
-
- sbb ebp,ebp
- mov al,[esp+eax]
-
- add esp,[4*ebp + IintStep]
- ; add ecx,DeltaVFrac;test to remove tears
- add ch,cl
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi],al ; store pixel 0
-
-; add ebx,DeltaUFrac
- add bh,bl
- mov al,[esi] ; get texture pixel 1
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add edx,DeltaIFrac
-
- sbb ebp,ebp
- mov al,[esp+eax]
-
- add esp,[4*ebp + IintStep]
-; add ecx,DeltaVFrac;test to remove tears
- add ch,cl
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+1],al ; store pixel 1
-
- ; add ebx,DeltaUFrac
- add bh,bl
- mov al,[esi] ; get texture pixel 2
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add edx,DeltaIFrac
-
- sbb ebp,ebp
- mov al,[esp+eax]
-
- add esp,[4*ebp + IintStep]
- ; add ecx,DeltaVFrac;test to remove tears
- add ch,cl
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+2],al ; store pixel 2
-
-; add ebx,DeltaUFrac
- add bh,bl
- mov al,[esi] ; get texture pixel 3
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add edx,DeltaIFrac
-
- sbb ebp,ebp
- mov al,[esp+eax]
-
- add esp,[4*ebp + IintStep]
-; add ecx,DeltaVFrac;test to remove tears
- add ch,cl
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+3],al ; store pixel 3
-
-; add ebx,DeltaUFrac
- add bh,bl
- mov al,[esi] ; get texture pixel 4
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add edx,DeltaIFrac
-
- sbb ebp,ebp
- mov al,[esp+eax]
-
- add esp,[4*ebp + IintStep]
- ; add ecx,DeltaVFrac;test to remove tears
- add ch,cl
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+4],al ; store pixel 4
-
-; add ebx,DeltaUFrac
- add bh,bl
- mov al,[esi] ; get texture pixel 5
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add edx,DeltaIFrac
-
- sbb ebp,ebp
- mov al,[esp+eax]
-
- add esp,[4*ebp + IintStep]
- ; add ecx,DeltaVFrac;test to remove tears
- add ch,cl
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+5],al ; store pixel 5
-
-; add ebx,DeltaUFrac
- add bh,bl
- mov al,[esi] ; get texture pixel 6
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add edx,DeltaIFrac
-
- sbb ebp,ebp
- mov al,[esp+eax]
-
- add esp,[4*ebp + IintStep]
-; add ecx,DeltaVFrac;test to remove tears
- add ch,cl
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+6],al ; store pixel 6
-
- ; add ebx,DeltaUFrac
- add bh,bl
- mov al,[esi] ; get texture pixel 7
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add edx,DeltaIFrac
-
- sbb ebp,ebp
- mov al,[esp+eax]
-
- add esp,[4*ebp + IintStep]
- dec Wholesections ; decrement span count
-
- mov [edi+7],al ; store pixel 7
- lea edi,[edi+8]
-
- jnz G3D_ScanLoop ; loop back
-endif
-
- mov eax,[PixelsRemaining]
- test eax,eax
- jz G3D_finish
-G3D_EndPixels:
-
- mov eax,[esi]
- add ch,cl
-; add ecx,DeltaVFrac
-
- sbb ebp,ebp ; get -1 if carry
- and eax,0xffh
-
- add bh,bl
-; add ebx,DeltaUFrac
- lea edi,[edi+1]
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add edx,DeltaIFrac
-
- sbb ebp,ebp
- mov al,[esp+eax]
-
- mov [edi-1],al
- mov eax,[PixelsRemaining]
-
- add esp,[4*ebp + IintStep]
- dec eax
-; dec [PixelsRemaining]
-
- mov [PixelsRemaining],eax
- jnz G3D_EndPixels
-G3D_finish:
- mov esp, [StackStore]
- popad
- ret
-endif
-;
-;
-; NEW CODE
-;
-;
-
-align
-PUBLIC ScanDraw2D_GouraudTransparent_
-PUBLIC _ScanDraw2D_GouraudTransparent
-ScanDraw2D_GouraudTransparent_:
-_ScanDraw2D_GouraudTransparent:
-
-; calculate horizontal deltas
- pushad
- mov [StackStore],esp
-
- mov eax,_SCASM_ScanLength
- mov [PixelsRemaining],eax
-
- mov eax,_SCASM_DeltaV ; get v 16.16 step
- mov ebx,eax ; copy it
- sar eax,16 ; get v int step
- shl ebx,16 ; get v frac step
- mov DeltaVFrac,ebx ; store it
-
- imul eax,_SCASM_TextureDeltaScan ; calculate texture step for v int step
-
- mov ebx,_SCASM_DeltaU ; get u 16.16 step
- mov ecx,ebx ; copy it
- sar ebx,16 ; get u int step
- shl ecx,16 ; get u frac step
-
- mov DeltaUFrac,ecx ; store it
- add eax,ebx ; calculate uint + vint step
- mov UVintVfracStepVNoCarry,eax; save whole step in non-v-carry slot
- add eax,_SCASM_TextureDeltaScan ; calculate whole step + v carry
- mov UVintVfracStepVCarry,eax ; save in v-carry slot
-
- ; setup initial coordinates
- mov edx,_SCASM_DeltaI ; get i 16.16 step
- mov eax,edx ; copy it
- sar eax,16 ; get i int step
- shl edx,16 ; get i frac step
- mov DeltaIFrac,edx ; store it
- imul eax,_SCASM_ShadingTableSize
- mov IintNoCarry,eax ; save whole step in non-i-carry slot
- add eax,_SCASM_ShadingTableSize ; calculate whole step + i carry
- mov IintWithCarry,eax ; save in i-carry slot
-
- mov esp,_SCASM_StartI
- mov edx,esp
- sar esp,16
- shl edx,16
- imul esp,_SCASM_ShadingTableSize
- add esp,_SCASM_Lighting
-
- mov esi,_SCASM_StartU ; get u 16.16 fixedpoint coordinate
- mov ebx,esi ; copy it
- sar esi,16 ; get integer part
- shl ebx,16 ; get fractional part
-
- mov ecx,_SCASM_StartV ; get v 16.16 fixedpoint coordinate
- mov eax,ecx ; copy it
- sar eax,16 ; get integer part
- shl ecx,16 ; get fractional part shift [tears removal]
- imul eax,_SCASM_TextureDeltaScan ; calc texture scanline address
- add esi,eax ; calc texture offset
- add esi,_SCASM_Bitmap ; calc address
-
-
-; mov eax,_SCASM_DeltaU
- ; mov bl,ah
-; mov eax,_SCASM_DeltaV
- ; mov cl,ah
-
- xor eax,eax
- mov edi,_SCASM_Destination
-
-G2DT_EndPixels:
-
- mov al,[esi] ; get texture pixel
- add ecx,DeltaVFrac;test to remove tears
-
- sbb ebp,ebp ; get -1 if carry
- test eax,eax
-
- jz G2DT_SkipPixel
-
- mov al,[esp+eax] ; store pixel 0
- mov [edi],al
-
-
- G2DT_SkipPixel:
-
- lea edi,[edi+1]
- add ebx,DeltaUFrac
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add edx,DeltaIFrac
-
- sbb ebp,ebp
- add esp,[4*ebp + IintStep]
-
- dec [PixelsRemaining]
- jnz G2DT_EndPixels
-
- mov esp, [StackStore]
- popad
- ret
-
-
-
-
-
-
-
-align
-PUBLIC ScanDraw2D_Opaque_
-PUBLIC _ScanDraw2D_Opaque
-ScanDraw2D_Opaque_:
-_ScanDraw2D_Opaque:
-
-; calculate horizontal deltas
- pushad
- mov [StackStore],esp
-
- mov eax,_SCASM_ScanLength
- mov ebp,eax
-
- and eax,7
- shr ebp,3
-
- mov [PixelsRemaining],eax
- mov [Wholesections],ebp ; store widths
-
-
- mov eax,_SCASM_DeltaV ; get v 16.16 step
- mov ebx,eax ; copy it
- sar eax,16 ; get v int step
- shl ebx,16 ; get v frac step
- mov DeltaVFrac,ebx ; store it
- ;shl eax,7
- imul eax,_SCASM_TextureDeltaScan ; calculate texture step for v int step
-
- mov ebx,_SCASM_DeltaU ; get u 16.16 step
- mov ecx,ebx ; copy it
- sar ebx,16 ; get u int step
- shl ecx,16 ; get u frac step
- mov DeltaUFrac,ecx ; store it
- add eax,ebx ; calculate uint + vint step
- mov UVintVfracStepVNoCarry,eax; save whole step in non-v-carry slot
- add eax,_SCASM_TextureDeltaScan ; calculate whole step + v carry
- mov UVintVfracStepVCarry,eax ; save in v-carry slot
-
- ; setup initial coordinates
-
- mov esi,_SCASM_StartU ; get u 16.16 fixedpoint coordinate
- mov ebx,esi ; copy it
- sar esi,16 ; get integer part
- shl ebx,16 ; get fractional part
-
- mov ecx,_SCASM_StartV ; get v 16.16 fixedpoint coordinate
- mov edx,ecx ; copy it
- sar edx,16 ; get integer part
- shl ecx,16 ; get fractional part
- ; shl edx,7
- imul edx,_SCASM_TextureDeltaScan ; calc texture scanline address
- add esi,edx ; calc texture offset
- add esi,_SCASM_Bitmap ; calc address
-
- mov edx,DeltaUFrac ; get register copy
- mov esp,DeltaVFrac
- mov edi,_SCASM_Destination
-
- test ebp,ebp
- jz O2D_EndPixels
-
-if 1
-O2D_ScanLoop:
- ; 8 pixel span code
- ; edi = dest dib bits at current pixel
- ; esi = texture pointer at current u,v
- ; ebx = u fraction 0.32
- ; ecx = v fraction 0.32
- ; edx = u frac step
- ; ebp = v carry scratch
-
-; mov al,[edi] ; preread the destination cache line
-
- mov al,[esi] ; get texture pixel 0
-
- add ecx,esp ; increment v fraction
- sbb ebp,ebp ; get -1 if carry
- add ebx,edx ; increment u fraction
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add ecx,esp ; increment v fraction
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+0],al ; store pixel 0
-
- add ebx,edx ; increment u fraction
- mov al,[esi] ; get texture pixel 1
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add ecx,esp ; increment v fraction
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+1],al ; store pixel 1
-
- add ebx,edx ; increment u fraction
- mov al,[esi] ; get texture pixel 2
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add ecx,esp ; increment v fraction
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+2],al ; store pixel 2
-
- add ebx,edx ; increment u fraction
- mov al,[esi] ; get texture pixel 3
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add ecx,esp ; increment v fraction
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+3],al ; store pixel 3
-
- add ebx,edx ; increment u fraction
- mov al,[esi] ; get texture pixel 4
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add ecx,esp ; increment v fraction
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+4],al ; store pixel 4
-
- add ebx,edx ; increment u fraction
- mov al,[esi] ; get texture pixel 5
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add ecx,esp ; increment v fraction
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+5],al ; store pixel 5
-
- add ebx,edx ; increment u fraction
- mov al,[esi] ; get texture pixel 6
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add ecx,esp ; increment v fraction
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+6],al ; store pixel 6
-
- add ebx,edx ; increment u fraction
- mov al,[esi] ; get texture pixel 7
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
-
- mov [edi+7],al ; store pixel 7
-
-
- add edi,8 ; increment to next span
- dec Wholesections ; decrement span count
- jnz O2D_ScanLoop ; loop back
-endif
-
- mov eax,[PixelsRemaining]
- test eax,eax
- jz O2D_finish
-O2D_EndPixels:
-
- mov al,[esi] ; get texture pixel
- add ecx,esp ; increment v fraction
-
- sbb ebp,ebp ; get -1 if carry
- add ebx,edx ; increment u fraction
-
- mov [edi],al ; store pixel
- lea edi,[edi+1]
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- dec [PixelsRemaining]
-
- jnz O2D_EndPixels
-
-
-
-O2D_finish:
- mov esp, [StackStore]
- popad
- ret
-
-
-align
-PUBLIC ScanDraw2D_Transparent_
-PUBLIC _ScanDraw2D_Transparent
-ScanDraw2D_Transparent_:
-_ScanDraw2D_Transparent:
-
-; calculate horizontal deltas
- pushad
- mov [StackStore],esp
-
- mov ebp,_SCASM_ScanLength
- mov [PixelsRemaining],ebp
-
- mov eax,_SCASM_DeltaV ; get v 16.16 step
- mov ebx,eax ; copy it
- sar eax,16 ; get v int step
- shl ebx,16 ; get v frac step
- mov DeltaVFrac,ebx ; store it
- ;shl eax,7
- imul eax,_SCASM_TextureDeltaScan ; calculate texture step for v int step
-
- mov ebx,_SCASM_DeltaU ; get u 16.16 step
- mov ecx,ebx ; copy it
- sar ebx,16 ; get u int step
- shl ecx,16 ; get u frac step
- mov DeltaUFrac,ecx ; store it
- add eax,ebx ; calculate uint + vint step
- mov UVintVfracStepVNoCarry,eax; save whole step in non-v-carry slot
- add eax,_SCASM_TextureDeltaScan ; calculate whole step + v carry
- mov UVintVfracStepVCarry,eax ; save in v-carry slot
-
- ; setup initial coordinates
-
- mov esi,_SCASM_StartU ; get u 16.16 fixedpoint coordinate
- mov ebx,esi ; copy it
- sar esi,16 ; get integer part
- shl ebx,16 ; get fractional part
-
- mov ecx,_SCASM_StartV ; get v 16.16 fixedpoint coordinate
- mov edx,ecx ; copy it
- sar edx,16 ; get integer part
- shl ecx,16 ; get fractional part
- ; shl edx,7
- imul edx,_SCASM_TextureDeltaScan ; calc texture scanline address
- add esi,edx ; calc texture offset
- add esi,_SCASM_Bitmap ; calc address
-
- mov edx,DeltaUFrac ; get register copy
- mov esp,DeltaVFrac
- mov edi,_SCASM_Destination
-
-T2D_EndPixels:
-
- mov al,[esi] ; get texture pixel
- add ecx,esp ; increment v fraction
-
- sbb ebp,ebp ; get -1 if carry
- test al,al
-
- jz T2D_SkipPixel
-
- mov [edi],al ; store pixel
- T2D_SkipPixel:
-
- lea edi,[edi+1]
- add ebx,edx ; increment u fraction
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- dec [PixelsRemaining]
-
- jnz T2D_EndPixels
-
- mov esp, [StackStore]
- popad
- ret
-
-align
-PUBLIC ScanDraw2D_TransparentLit_
-PUBLIC _ScanDraw2D_TransparentLit
-ScanDraw2D_TransparentLit_:
-_ScanDraw2D_TransparentLit:
-
-; calculate horizontal deltas
- pushad
- mov [StackStore],esp
-
- mov ebp,_SCASM_ScanLength
- mov [PixelsRemaining],ebp
-
- mov esp,_SCASM_StartI
- imul esp,_SCASM_ShadingTableSize
- add esp,_SCASM_Lighting
-
- mov eax,_SCASM_DeltaV ; get v 16.16 step
- mov ebx,eax ; copy it
- sar eax,16 ; get v int step
- shl ebx,16 ; get v frac step
- mov DeltaVFrac,ebx ; store it
- ;shl eax,7
- imul eax,_SCASM_TextureDeltaScan ; calculate texture step for v int step
-
- mov ebx,_SCASM_DeltaU ; get u 16.16 step
- mov ecx,ebx ; copy it
- sar ebx,16 ; get u int step
- shl ecx,16 ; get u frac step
- mov DeltaUFrac,ecx ; store it
- add eax,ebx ; calculate uint + vint step
- mov UVintVfracStepVNoCarry,eax; save whole step in non-v-carry slot
- add eax,_SCASM_TextureDeltaScan ; calculate whole step + v carry
- mov UVintVfracStepVCarry,eax ; save in v-carry slot
-
- ; setup initial coordinates
-
- mov esi,_SCASM_StartU ; get u 16.16 fixedpoint coordinate
- mov ebx,esi ; copy it
- sar esi,16 ; get integer part
- shl ebx,16 ; get fractional part
-
- mov ecx,_SCASM_StartV ; get v 16.16 fixedpoint coordinate
- mov edx,ecx ; copy it
- sar edx,16 ; get integer part
- shl ecx,16 ; get fractional part
- ; shl edx,7
- imul edx,_SCASM_TextureDeltaScan ; calc texture scanline address
- add esi,edx ; calc texture offset
- add esi,_SCASM_Bitmap ; calc address
-
- mov edx,DeltaUFrac ; get register copy
- ; mov esp,DeltaVFrac
- mov edi,_SCASM_Destination
- xor eax,eax
-
-TL2D_EndPixels:
-
- mov al,[esi] ; get texture pixel
- add ecx,DeltaVFrac ; increment v fraction
-
- sbb ebp,ebp ; get -1 if carry
- test al,al
-
- jz TL2D_SkipPixel
-
- mov al,[eax+esp]
- mov [edi],al ; store pixel
- TL2D_SkipPixel:
-
- lea edi,[edi+1]
- add ebx,edx ; increment u fraction
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- dec [PixelsRemaining]
-
- jnz TL2D_EndPixels
-
- mov esp, [StackStore]
- popad
- ret
-
-if 0
-PUBLIC MotionTrackerRotateBlit_
-MotionTrackerRotateBlit_:
-
-; calculate horizontal deltas
- pushad
- mov [StackStore],esp
-
-
- mov eax,_MTRB_Angle
- mov eax,[_cosine + eax * 4]
- shl eax,16 - 7
- imul [_MTRB_InvScale]
- shrd eax,edx,16
- mov [dUCol],eax
-
-
- mov eax,[_MTRB_Angle]
- mov eax,[_sine + eax * 4]
- shl eax,16 - 7
- imul [_MTRB_InvScale]
- shrd eax,edx,16
- mov [dVCol],eax
- mov esp,eax
-; calculate vertical deltas
-
- mov eax,[dVCol]
- neg eax
- ; imul [aspectAdjust]
- ; shrd eax,edx,16
- mov [dURow],eax
-
- mov eax,[dUCol]
-; imul [aspectAdjust]
-; shrd eax,edx,16
- mov [dVRow],eax
-
- mov eax,_MTRB_CentreU ; put CentreU&V in 16.16 for now
- shl eax,16-7
- mov [startingU],eax
- mov eax,_MTRB_CentreV
- shl eax,16-7
- mov [startingV],eax
-
-
-; move up by yOrg
-
- mov eax,[dUCol]
- imul eax,_MTRB_ScreenCentreX
- sub [startingU],eax
-
- mov eax,[dURow]
- imul eax,_MTRB_ScreenCentreY
- sub [startingU],eax
-
- mov eax,[dVCol]
- imul eax,_MTRB_ScreenCentreX
- sub [startingV],eax
-
- mov eax,[dVRow]
- imul eax,_MTRB_ScreenCentreY
- sub [startingV],eax
-
-; fixup end of row deltas
-
- mov eax,[dUCol]
- imul eax,_MTRB_ScreenWidth
- neg eax
- add eax,[dURow]
- mov [dURow],eax
-
-
- mov eax,[dVCol]
- imul eax,_MTRB_ScreenWidth
- neg eax
- add eax,[dVRow]
- mov [dVRow],eax
-
-
-
- mov esi,[_MTRB_Bitmap]
- mov edi,[_MTRB_Destination]
-
- mov ecx,[startingU]
- mov edx,[startingV]
-
- mov ebx,_MTRB_ScreenHeight ; initialize row count
- mov ah,bl
-MTRB_RowLoop:
- mov ebx,_MTRB_ScreenWidth ; initialize column count
-
-MTRB_ColLoop:
- mov ebp,edx
- shr ebp,32 - 7
- shld ebp,ecx,7
-
- add edx,esp
- add ecx,[dUCol]
-
- mov al,[esi+ebp]
- test al,al
- jz MTRB_SkipPixel
- mov [edi],al
- MTRB_SkipPixel:
-
- lea edi,[edi+1]
-
- dec ebx
-
- jnz MTRB_ColLoop
-
- add ecx,[dURow]
- add edx,[dVRow]
- add edi,[_MTRB_ScanOffset]
-
- dec ah
- jnz MTRB_RowLoop
-
-
- mov esp, [StackStore]
- popad
- ret
-
-PUBLIC MotionTrackerRotateBlit8_
-PUBLIC _MotionTrackerRotateBlit8
-MotionTrackerRotateBlit8_:
-_MotionTrackerRotateBlit8:
-
-; calculate horizontal deltas
- pushad
- mov [StackStore],esp
-
-
- mov eax,_MTRB_Angle
- mov eax,[_cosine + eax * 4]
- shl eax,16 - 8
- imul [_MTRB_InvScale]
- shrd eax,edx,16
- mov [dUCol],eax
-
-
- mov eax,[_MTRB_Angle]
- mov eax,[_sine + eax * 4]
- shl eax,16 - 8
- imul [_MTRB_InvScale]
- shrd eax,edx,16
- mov [dVCol],eax
- mov esp,eax
-; calculate vertical deltas
-
- mov eax,[dVCol]
- neg eax
- ; imul [aspectAdjust]
- ; shrd eax,edx,16
- mov [dURow],eax
-
- mov eax,[dUCol]
-; imul [aspectAdjust]
-; shrd eax,edx,16
- mov [dVRow],eax
-
- mov eax,_MTRB_CentreU ; put CentreU&V in 16.16 for now
- shl eax,16-8
- mov [startingU],eax
- mov eax,_MTRB_CentreV
- shl eax,16-8
- mov [startingV],eax
-
-
-; move up by yOrg
-
- mov eax,[dUCol]
- imul eax,_MTRB_ScreenCentreX
- sub [startingU],eax
-
- mov eax,[dURow]
- imul eax,_MTRB_ScreenCentreY
- sub [startingU],eax
-
- mov eax,[dVCol]
- imul eax,_MTRB_ScreenCentreX
- sub [startingV],eax
-
- mov eax,[dVRow]
- imul eax,_MTRB_ScreenCentreY
- sub [startingV],eax
-
-; fixup end of row deltas
-
- mov eax,[dUCol]
- imul eax,_MTRB_ScreenWidth
- neg eax
- add eax,[dURow]
- mov [dURow],eax
-
-
- mov eax,[dVCol]
- imul eax,_MTRB_ScreenWidth
- neg eax
- add eax,[dVRow]
- mov [dVRow],eax
-
-
-
- mov esi,[_MTRB_Bitmap]
- mov edi,[_MTRB_Destination]
-
- mov ecx,[startingU]
- mov edx,[startingV]
-
- mov ebx,_MTRB_ScreenHeight ; initialize row count
- mov ah,bl
-MTRB_RowLoop8:
- mov ebx,_MTRB_ScreenWidth ; initialize column count
-
-MTRB_ColLoop8:
- mov ebp,edx
- shr ebp,32 - 8
- shld ebp,ecx,8
-
- add edx,esp
- add ecx,[dUCol]
-
- mov al,[esi+ebp]
- test al,al
- jz MTRB_SkipPixel8
- mov [edi],al
- MTRB_SkipPixel8:
-
- lea edi,[edi+1]
-
- dec ebx
-
- jnz MTRB_ColLoop8
-
- add ecx,[dURow]
- add edx,[dVRow]
- add edi,[_MTRB_ScanOffset]
-
- dec ah
- jnz MTRB_RowLoop8
-
-
- mov esp, [StackStore]
- popad
- ret
-endif
-
-
-
-
-
-
-; floating point test area
-if 0
-
-PUBLIC ScanDrawF3D_Gouraud_
-ScanDrawF3D_Gouraud_:
-
-; calculate horizontal deltas
-
- pushad
-
- ; put the FPU in 32 bit mode
- ; @todo move this out of here!
-; fstcw [OldFPUCW] ; store copy of CW
- ; mov ax,OldFPUCW ; get it in ax
-; and eax,NOT 1100000000y ; 24 bit precision
-; mov [FPUCW],ax ; store it
-; fldcw [FPUCW] ; load the FPU
- finit
- ; mov [StackStore],esp
-
- mov eax,_SCASM_ScanLength
- mov ebp,eax
-
- and eax,7
- shr ebp,3
-
- mov [PixelsRemaining],eax
- mov [Wholesections],ebp ; store widths
-
-if 0
- ; setup initial coordinates
- mov edx,_SCASM_DeltaI ; get i 16.16 step
- mov eax,edx ; copy it
- sar eax,16 ; get i int step
- shl edx,16 ; get i frac step
- mov DeltaIFrac,edx ; store it
- imul eax,_SCASM_ShadingTableSize
- mov IintNoCarry,eax ; save whole step in non-i-carry slot
- add eax,_SCASM_ShadingTableSize ; calculate whole step + i carry
- mov IintWithCarry,eax ; save in i-carry slot
-
- mov esp,_SCASM_StartI
- mov edx,esp
- sar esp,16
- shl edx,16
- imul esp,_SCASM_ShadingTableSize
- add esp,_SCASM_Lighting
-endif
- ;******************************************************************************************
- mov ebx,_ScanDescPtr
-
- ; calculate ULeft and VLeft ; FPU Stack (ZL = ZLeft)
- ; st0 st1 st2 st3 st4 st5 st6 st7
- fld DWORD PTR [ebx+4] ; V/ZL
- fld DWORD PTR [ebx] ; U/ZL V/ZL
- fld DWORD PTR [ebx+8] ; 1/ZL U/ZL V/ZL
- fld1 ; 1 1/ZL U/ZL V/ZL
- fdiv st,st(1) ; ZL 1/ZL U/ZL V/ZL
- fld st ; ZL ZL 1/ZL U/ZL V/ZL
- fmul st,st(4) ; VL ZL 1/ZL U/ZL V/ZL
- fxch st(1) ; ZL VL 1/ZL U/ZL V/ZL
- fmul st,st(3) ; UL VL 1/ZL U/ZL V/ZL
-
- fstp st(5) ; VL 1/ZL U/ZL V/ZL UL
- fstp st(5) ; 1/ZL U/ZL V/ZL UL VL
-
- ; calculate right side OverZ terms ; st0 st1 st2 st3 st4 st5 st6 st7
-
- fadd DWORD PTR [ebx+20] ; 1/ZR U/ZL V/ZL UL VL
- fxch st(1) ; U/ZL 1/ZR V/ZL UL VL
- fadd DWORD PTR [ebx+12] ; U/ZR 1/ZR V/ZL UL VL
- fxch st(2) ; V/ZL 1/ZR U/ZR UL VL
- fadd DWORD PTR [ebx+16] ; V/ZR 1/ZR U/ZR UL VL
-
- ; calculate right side coords ; st0 st1 st2 st3 st4 st5 st6 st7
-
- fld1 ; 1 V/ZR 1/ZR U/ZR UL VL
- ; @todo overlap this guy
- fdiv st,st(2) ; ZR V/ZR 1/ZR U/ZR UL VL
- fld st ; ZR ZR V/ZR 1/ZR U/ZR UL VL
- fmul st,st(2) ; VR ZR V/ZR 1/ZR U/ZR UL VL
- fxch st(1) ; ZR VR V/ZR 1/ZR U/ZR UL VL
- fmul st,st(4) ; UR VR V/ZR 1/ZR U/ZR UL VL
- ;******************************************************************************************
- xor eax,eax
- mov edi,_SCASM_Destination
-
- test ebp,ebp
- jz GF3D_EndPixels
-
-GF3D_ScanLoop:
- ; at this point the FPU contains ; st0 st1 st2 st3 st4 st5 st6 st7
- ; UR VR V/ZR 1/ZR U/ZR UL VL
-
- ; convert left side coords
-
- fld st(5) ; UL UR VR V/ZR 1/ZR U/ZR UL VL
- fmul [FixedScale] ; UL16 UR VR V/ZR 1/ZR U/ZR UL VL
- fistp [_SCASM_StartU] ; UR VR V/ZR 1/ZR U/ZR UL VL
-
- fld st(6) ; VL UR VR V/ZR 1/ZR U/ZR UL VL
- fmul [FixedScale] ; VL16 UR VR V/ZR 1/ZR U/ZR UL VL
- fistp [_SCASM_StartV] ; UR VR V/ZR 1/ZR U/ZR UL VL
-
- ; calculate deltas ; st0 st1 st2 st3 st4 st5 st6 st7
-
- fsubr st(5),st ; UR VR V/ZR 1/ZR U/ZR dU VL
- fxch st(1) ; VR UR V/ZR 1/ZR U/ZR dU VL
- fsubr st(6),st ; VR UR V/ZR 1/ZR U/ZR dU dV
- fxch st(6) ; dV UR V/ZR 1/ZR U/ZR dU VR
-
- fmul [FixedScale8] ; dV8 UR V/ZR 1/ZR U/ZR dU VR
- fistp [_SCASM_DeltaV] ; UR V/ZR 1/ZR U/ZR dU VR
-
- fxch st(4) ; dU V/ZR 1/ZR U/ZR UR VR
- fmul [FixedScale8] ; dU8 V/ZR 1/ZR U/ZR UR VR
- fistp [_SCASM_DeltaU] ; V/ZR 1/ZR U/ZR UR VR
-
- ; increment terms for next span ; st0 st1 st2 st3 st4 st5 st6 st7
- ; Right terms become Left terms---->; V/ZL 1/ZL U/ZL UL VL
-
- mov ebx,_ScanDescPtr
- fadd DWORD PTR [ebx+16] ; V/ZR 1/ZL U/ZL UL VL
- fxch st(1) ; 1/ZL V/ZR U/ZL UL VL
- fadd DWORD PTR [ebx+20] ; 1/ZR V/ZR U/ZL UL VL
- fxch st(2) ; U/ZL V/ZR 1/ZR UL VL
- fadd DWORD PTR [ebx+12] ; U/ZR V/ZR 1/ZR UL VL
- fxch st(2) ; 1/ZR V/ZR U/ZR UL VL
- fxch st(1) ; V/ZR 1/ZR U/ZR UL VL
-
- ; calculate right side coords ; st0 st1 st2 st3 st4 st5 st6 st7
-
- fld1 ; 1 V/ZR 1/ZR U/ZR UL VL
- fdiv st,st(2) ; ZR V/ZR 1/ZR U/ZR UL VL
-
- ; set up affine registers
-
- ; setup delta values
-
- mov eax,_SCASM_DeltaV ; get v 16.16 step
- mov ebx,eax ; copy it
- sar eax,16 ; get v int step
- shl ebx,16 ; get v frac step
- mov DeltaVFrac,ebx ; store it
-
- imul eax,_SCASM_TextureDeltaScan ; calculate texture step for v int step
-
- mov ebx,_SCASM_DeltaU ; get u 16.16 step
- mov ecx,ebx ; copy it
- sar ebx,16 ; get u int step
- shl ecx,16 ; get u frac step
-
- mov DeltaUFrac,ecx ; store it
- add eax,ebx ; calculate uint + vint step
- mov UVintVfracStepVNoCarry,eax; save whole step in non-v-carry slot
- add eax,_SCASM_TextureDeltaScan ; calculate whole step + v carry
- mov UVintVfracStepVCarry,eax ; save in v-carry slot
-
-
- mov esi,_SCASM_StartU ; get u 16.16 fixedpoint coordinate
- mov ebx,esi ; copy it
- sar esi,16 ; get integer part
- shl ebx,16 ; get fractional part
-
- mov ecx,_SCASM_StartV ; get v 16.16 fixedpoint coordinate
- mov eax,ecx ; copy it
- sar eax,16 ; get integer part
- shl ecx,16 ; get fractional part shift [tears removal]
- imul eax,_SCASM_TextureDeltaScan ; calc texture scanline address
- add esi,eax ; calc texture offset
- add esi,_SCASM_Bitmap ; calc address
-
-
- ; 8 pixel span code
- ; edi = dest dib bits at current pixel
- ; esi = texture pointer at current u,v
- ; esp = lighting pointer
- ; ebx = u fraction 0.32
- ; ecx = v fraction 0.32
- ; edx = i fraction 0.32
- ; ebp = carry scratch
-
-; mov al,[edi] ; preread the destination cache line
-
- mov al,[esi] ; get texture pixel 0
-
- add ecx,DeltaVFrac;test to remove tears
- sbb ebp,ebp ; get -1 if carry
- add ebx,DeltaUFrac
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
-
-; add edx,DeltaIFrac
-; sbb ebp,ebp
-; mov al,[esp+eax]
-; add esp,[4*ebp + IintStep]
-
- add ecx,DeltaVFrac;test to remove tears
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi],al ; store pixel 0
-
- add ebx,DeltaUFrac
- mov al,[esi] ; get texture pixel 1
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
-
-; add edx,DeltaIFrac
-; sbb ebp,ebp
-; mov al,[esp+eax]
-; add esp,[4*ebp + IintStep]
-
- add ecx,DeltaVFrac;test to remove tears
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+1],al ; store pixel 1
-
- add ebx,DeltaUFrac
- mov al,[esi] ; get texture pixel 2
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
-
-; add edx,DeltaIFrac
-; sbb ebp,ebp
-; mov al,[esp+eax]
-; add esp,[4*ebp + IintStep]
-
- add ecx,DeltaVFrac;test to remove tears
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+2],al ; store pixel 2
-
- add ebx,DeltaUFrac
- mov al,[esi] ; get texture pixel 3
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
-
-; add edx,DeltaIFrac
-; sbb ebp,ebp
-; mov al,[esp+eax]
-; add esp,[4*ebp + IintStep]
-
- add ecx,DeltaVFrac;test to remove tears
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+3],al ; store pixel 3
-
- add ebx,DeltaUFrac
- mov al,[esi] ; get texture pixel 4
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
-
-; add edx,DeltaIFrac
-; sbb ebp,ebp
-; mov al,[esp+eax]
-; add esp,[4*ebp + IintStep]
-
- add ecx,DeltaVFrac;test to remove tears
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+4],al ; store pixel 4
-
- add ebx,DeltaUFrac
- mov al,[esi] ; get texture pixel 5
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
-
-; add edx,DeltaIFrac
-; sbb ebp,ebp
-; mov al,[esp+eax]
-; add esp,[4*ebp + IintStep]
-
- add ecx,DeltaVFrac;test to remove tears
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+5],al ; store pixel 5
-
- add ebx,DeltaUFrac
- mov al,[esi] ; get texture pixel 6
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
-
-; add edx,DeltaIFrac
-; sbb ebp,ebp
-; mov al,[esp+eax]
-; add esp,[4*ebp + IintStep]
-
- add ecx,DeltaVFrac;test to remove tears
-
- sbb ebp,ebp ; get -1 if carry
- mov [edi+6],al ; store pixel 6
-
- add ebx,DeltaUFrac
- mov al,[esi] ; get texture pixel 7
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
-
-; add edx,DeltaIFrac
-; sbb ebp,ebp
-; mov al,[esp+eax]
-; add esp,[4*ebp + IintStep]
- dec Wholesections ; decrement span count
-
-
- mov [edi+7],al ; store pixel 7
- lea edi,[edi+8]
-
-
- ; the fdiv is done, finish right ; st0 st1 st2 st3 st4 st5 st6 st7
- ; ZR V/ZR 1/ZR U/ZR UL VL
-
- fld st ; ZR ZR V/ZR 1/ZR U/ZR UL VL
- fmul st,st(2) ; VR ZR V/ZR 1/ZR U/ZR UL VL
- fxch st(1) ; ZR VR V/ZR 1/ZR U/ZR UL VL
- fmul st,st(4) ; UR VR V/ZR 1/ZR U/ZR UL VL
-
- jnz GF3D_ScanLoop ; loop back
-
- mov eax,[PixelsRemaining]
- test eax,eax
- jz GF3D_finish
-GF3D_EndPixels:
-if 0
- mov al,[esi] ; get texture pixel
- add ecx,DeltaVFrac;test to remove tears
-
- sbb ebp,ebp ; get -1 if carry
- add ebx,DeltaUFrac
-
- lea edi,[edi+1]
- mov al,[esp+eax] ; store pixel 0
-
- adc esi,[4*ebp+UVintVfracStep] ; add in step ints & carries
- add edx,DeltaIFrac
-
- sbb ebp,ebp
- mov [edi-1],al
-
- add esp,[4*ebp + IintStep]
- dec [PixelsRemaining]
-
- jnz GF3D_EndPixels
-endif
-
-FPUReturn:
-
- ; busy FPU registers: ; st0 st1 st2 st3 st4 st5 st6 st7
- ; xxx xxx xxx xxx xxx xxx xxx
- ffree st(0)
- ffree st(1)
- ffree st(2)
- ffree st(3)
- ffree st(4)
- ffree st(5)
- ffree st(6)
- finit
-; fldcw [OldFPUCW] ; restore the FPU
-
-GF3D_finish:
-; mov esp, [StackStore]
- popad
- ret
-
-endif
-
-
-
-
-_TEXT ENDS
-
-END
diff --git a/src/win95/vramtime.c b/src/win95/vramtime.c
deleted file mode 100644
index a4fae03..0000000
--- a/src/win95/vramtime.c
+++ /dev/null
@@ -1,33 +0,0 @@
-#include <windows.h>
-
-#include "vramtime.h"
-
-static DWORD transition_times_matrix[][VWS_MAXSTATES] =
-{
-/* from DDRELEASE */
- { 0, 20, 0, 100, 100 },
-/* from D3DTEXRELEASE */
- { 20, 0, 100, 100, 100 },
-/* from DDCREATE */
- { 0, 100, 0, 20, 100 },
-/* from D3DTEXCREATE */
- { 20, 100, 20, 20, 100 },
-/* from UNKNOWN */
- { 100, 100, 100, 100, 100 }
-};
-
-
-void WaitForVRamReady(VRAM_WAIT_STATE vws)
-{
- static DWORD old_time = 0;
- static VRAM_WAIT_STATE old_vws = VWS_UNKNOWN;
-
- DWORD new_time;
-
- if (0==old_time) old_time = timeGetTime();
-
- do new_time = timeGetTime(); while (new_time - old_time < transition_times_matrix[old_vws][vws]);
-
- old_time = new_time;
- old_vws = vws;
-}
diff --git a/src/win95/vramtime.h b/src/win95/vramtime.h
deleted file mode 100644
index aa740c2..0000000
--- a/src/win95/vramtime.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef _included_vramtime_h_
-#define _included_vramtime_h_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum VramWaitState
-{
- VWS_DDRELEASE,
- VWS_D3DTEXRELEASE,
- VWS_DDCREATE,
- VWS_D3DTEXCREATE,
- VWS_UNKNOWN,
- VWS_MAXSTATES
-
-} VRAM_WAIT_STATE;
-
-void WaitForVRamReady(VRAM_WAIT_STATE);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ! _included_vramtime_h_ */
diff --git a/src/win95/zmouse.h b/src/win95/zmouse.h
deleted file mode 100644
index 5064b31..0000000
--- a/src/win95/zmouse.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/****************************************************************************
-* *
-* ZMOUSE.H -- Include file for IntelliMouse(tm) 1.0 *
-* *
-* NOTE: Zmouse.h contains #defines required when providing IntelliMouse *
-* wheel support for Windows95 and NT3.51. Wheel is supported *
-* natively in WinNT4.0, please refer to the NT4.0 SDK for more info *
-* on providing support for IntelliMouse in NT4.0. *
-* *
-* Copyright (c) 1983-1996, Microsoft Corp. All rights reserved. *
-* *
-\***************************************************************************/
-
-
-/**************************************************************************
- Client Appplication (API) Defines for Wheel rolling
-***************************************************************************/
-
-
-// Apps need to call RegisterWindowMessage using the #define below to
-// get the message number that is sent to the foreground window
-// when a wheel roll occurs
-
-#ifdef UNICODE
-#define MSH_MOUSEWHEEL L"MSWHEEL_ROLLMSG"
-#else
-#define MSH_MOUSEWHEEL "MSWHEEL_ROLLMSG"
-#endif
- // wParam = wheel rotation expressed in multiples of WHEEL_DELTA
- // lParam is the mouse coordinates
-
-#define WHEEL_DELTA 120 // Default value for rolling one notch
-
-
-#ifndef WM_MOUSEWHEEL
-#define WM_MOUSEWHEEL (WM_MOUSELAST+1) // message that will be supported
- // by the OS
-#endif
-
-
-/**************************************************************************
- Client Appplication (API) Defines for
- * determining if wheel support active
- * determining # of Scroll Lines
-***************************************************************************/
-
-// Class name for MSWHEEL.EXE's invisible window
-// use FindWindow to get hwnd to MSWHEEL
-#ifdef UNICODE
-#define MOUSEZ_CLASSNAME L"MouseZ" // wheel window class
-#define MOUSEZ_TITLE L"Magellan MSWHEEL" // wheel window title
-#else
-#define MOUSEZ_CLASSNAME "MouseZ" // wheel window class
-#define MOUSEZ_TITLE "Magellan MSWHEEL" // wheel window title
-#endif
-
-#define MSH_WHEELMODULE_CLASS (MOUSEZ_CLASSNAME)
-#define MSH_WHEELMODULE_TITLE (MOUSEZ_TITLE)
-
-// Apps need to call RegisterWindowMessage using the #defines
-// below to get the message numbers for:
-// 1) the message that can be sent to the MSWHEEL window to
-// query if wheel support is active (MSH_WHEELSUPPORT)>
-// 2) the message to query for the number of scroll lines
-// (MSH_SCROLL_LINES)
-//
-// To send a message to MSWheel window, use FindWindow with the #defines
-// for CLASS and TITLE above. If FindWindow fails to find the MSWHEEL
-// window or the return from SendMessage is false, then Wheel support
-// is not currently available.
-
-#ifdef UNICODE
-#define MSH_WHEELSUPPORT L"MSH_WHEELSUPPORT_MSG" // name of msg to send
- // to query for wheel support
-#else
-#define MSH_WHEELSUPPORT "MSH_WHEELSUPPORT_MSG" // name of msg to send
- // to query for wheel support
-#endif
-
-// MSH_WHEELSUPPORT
-// wParam - not used
-// lParam - not used
-// returns BOOL - TRUE if wheel support is active, FALSE otherwise
-
-
-#ifdef UNICODE
-#define MSH_SCROLL_LINES L"MSH_SCROLL_LINES_MSG"
-#else
-#define MSH_SCROLL_LINES "MSH_SCROLL_LINES_MSG"
-#endif
-
-// MSH_SCROLL_LINES
-// wParam - not used
-// lParam - not used
-// returns int - number of lines to scroll on a wheel roll
-
-#ifndef WHEEL_PAGESCROLL
-#define WHEEL_PAGESCROLL (UINT_MAX) // signifies to scroll a page, also
- // defined in winuser.h in the
- // NT4.0 SDK
-#endif
-
-#ifndef SPI_SETWHEELSCROLLLINES
-#define SPI_SETWHEELSCROLLLINES 105 // Also defined in winuser.h in the
- // NT4.0 SDK, please see the NT4.0 SDK
- // documentation for NT4.0 implementation
- // specifics.
- // For Win95 and WinNT3.51,
- // Mswheel broadcasts the message
- // WM_SETTINGCHANGE (equivalent to
- // WM_WININICHANGE) when the scroll
- // lines has changed. Applications
- // will recieve the WM_SETTINGCHANGE
- // message with the wParam set to
- // SPI_SETWHEELSCROLLLINES. When
- // this message is recieved the application
- // should query Mswheel for the new
- // setting.
-#endif
-
-
-/*********************************************************************
-* INLINE FUNCTION: HwndMsWheel
-* Purpose : Get a reference to MSWheel Window, the registered messages,
-* wheel support active setting, and number of scrollLines
-* Params : PUINT puiMsh_MsgMouseWheel - address of UINT to contain returned registered wheel message
-* PUINT puiMsh_Msg3DSupport - address of UINT to contain wheel support registered message
-* PUINT puiMsh_MsgScrollLines - address of UINT to contain Scroll lines registered message
-* PBOOL pf3DSupport - address of BOOL to contain returned flag for wheel support active
-* PINT piScrollLines - address of int to contain returned scroll lines
-* Returns : HWND handle to the MsWheel window
-* Note : The return value for pf3DSupport and piScrollLines is dependant
-* on the POINT32 module. If POINT32 module is not running then
-* the values returned for these parameters will be
-* FALSE and 3, respectively.
-*********************************************************************/
-__inline HWND HwndMSWheel(
- PUINT puiMsh_MsgMouseWheel,
- PUINT puiMsh_Msg3DSupport,
- PUINT puiMsh_MsgScrollLines,
- PBOOL pf3DSupport,
- PINT piScrollLines
-)
-{
- HWND hdlMsWheel;
-
- hdlMsWheel = FindWindow(MSH_WHEELMODULE_CLASS, MSH_WHEELMODULE_TITLE);
-
- *puiMsh_MsgMouseWheel = RegisterWindowMessage(MSH_MOUSEWHEEL);
- *puiMsh_Msg3DSupport = RegisterWindowMessage(MSH_WHEELSUPPORT);
- *puiMsh_MsgScrollLines = RegisterWindowMessage(MSH_SCROLL_LINES);
-
- if (*puiMsh_Msg3DSupport)
- *pf3DSupport = (BOOL)SendMessage(hdlMsWheel, *puiMsh_Msg3DSupport, 0, 0);
- else
- *pf3DSupport = FALSE; // default to FALSE
-
- if (*puiMsh_MsgScrollLines)
- *piScrollLines = (int)SendMessage(hdlMsWheel, *puiMsh_MsgScrollLines, 0, 0);
- else
- *piScrollLines = 3; // default
-
- return(hdlMsWheel);
-}