Files
Work/common/Common.inc
2024-08-07 09:09:36 -04:00

81 lines
2.9 KiB
PHP

; **************************************************************************
; FILE:COMMON.INC
; FUNCTION: COMMON ASSEMBLER INCLUDE FILE
; AUTHOR: SEAN M. KESSLER
;****************************************************************************
INCLUDE ..\COMMON\WINDOWS.INC
LPDWORD TYPEDEF NEAR PTR DWORD
NPDWORD TYPEDEF FAR PTR DWORD
NPBYTE TYPEDEF PTR BYTE
String STRUC
String@@mnpStr NPDWORD ?
String@@mLengthBytes DD ?
String ENDS
Point STRUC
Point@@x DW ?
Point@@y DW ?
Point ENDS
PurePalette STRUC
PurePalette@@mhPalette HANDLE <>
PurePalette@@mhOldPalette HANDLE <>
PurePalette@@mPaletteData PALETTEENTRY 100h DUP (<>)
PurePalette@@mIsInUse DW ?
PurePalette ENDS
BitmapData STRUC
BitmapData@@mhGlobalBitmapData HANDLE <>
BitmapData@@mhGlobalBitmapInfo HANDLE <>
BitmapData@@mlpBitmapData LPDWORD ?
BitmapData@@mlpBitmapInfo PBITMAPINFO ?
BitmapData@@mInfoDisposition DD ?
BitmapData@@mDataDisposition DD ?
BitmapData ENDS
Bitmap STRUC
PBitmap TYPEDEF NEAR PTR Bitmap
PPBitmap TYPEDEF NEAR PTR PBitmap
Bitmap@@mBitmapData BitmapData <>
Bitmap@@mFileName String <>
Bitmap@@mMaxColors DW ?
Bitmap@@mCurrentMode DD ?
Bitmap@@mBitmapFileHeader BITMAPFILEHEADER <>
Bitmap@@mPaletteData PurePalette <>
Bitmap@@mBlockSize DD ?
Bitmap@@mhFile HANDLE <>
Bitmap@@mImageExtent DD ?
Bitmap@@mWidth DD ?
Bitmap@@mHeight DD ?
Bitmap ENDS
PureVectorBitmap STRUC
PPureVectorBitmap TYPEDEF FAR PTR PureVectorBitmap
PureVectorBitmap@@mhGlobalMemPool DD ?
PureVectorBitmap@@mhGlobalVectorTable DD ?
PureVectorBitmap@@mEntries DD ?
PureVectorBitmap@@mlpVectorTable PPBitmap ?
PureVectorBitmap@@mlpMemPool PBitmap ?
PureVectorBitmap ENDS
getBitmapPtr MACRO npPureVector,itemIndex
LOCAL @@boundFail,@@return
push edi ; save destination index register
mov edi,npPureVector ; move npPureVector to edi register
movzx eax,itemIndex ; move itemIndex to eax register
cmp eax,[edi].PureVectorBitmap@@mEntries ; check index boundary
jge @@boundFail ; handle out of bounds condition
shl eax,02h ; multiply eax by sizeof(PTR)
mov edi,[edi].PureVectorBitmap@@mlpVectorTable ; dereference vector table to edi
add edi,eax ; add in itemIndex
mov eax,[edi] ; dereference pointer to eax
jmp @@return ; return
@@boundFail: ; boundary error sync address
xor eax,eax ; error clears eax register
@@return: ; return sync address
pop edi ; restore detination index register
ENDM