⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 grmac.inc

📁 Microsoft MS-DOS6.0 完整源代码
💻 INC
📖 第 1 页 / 共 2 页
字号:
	?mSetMode
	?mSetPages
	?mPalReset
	?mPalPut
	?mPalTrans
	?mPalSet
	?mSetColor
    ifnb    <tlen>
	tlen	 =   $ - ?mStart	;length of text mode tables
    endif
    ifnb    <glen>
	;graphic mode-dependent data
	define	B,ForeMapped		;fore color mapped to external value
					;  for text ops in graphics modes
	define	B,BitsPerPixel		;bits per pixel
	define	B,Planes		;number of graphic planes
	define	W,BytesPerRow		;number of bytes per row
	define	B,MaskLeft		;mask with leftmost bit set
	define	B,MaskRight		;mask with rightmost bit set
	define	W,PixelsPerByte 	;pixels per byte
	define	B,DivShift		;shift count for x DIV b$PixelsPerByte
	define	W,ModMask		;mask for x MOD b$PixelsPerByte
	define	W,Aspect		;aspect ratio * 256
	define	W,AspectInv		;inverse aspect ratio * 256
	;graphic mode-dependent function hooks
    if	    ?mDEF
	labelW	GraphVectStart		;start of graphics vectors
    endif
	?mMapXYC
	?mLeftC
	?mChkUpC
	?mUpC
	?mChkDownC
	?mDownC
	?mSetAttr
	?mReadC
	?mSetC
	?mSetPixC
	?mSetPixFirstC
	?mSetPixLastC
	?mLineX
	?mLineY
	?mLineV
	?mPutAction
	?mNReadL
	?mNWriteL
	?mNSetC
	?mPaintBound
	?mSetTile
	?mScanL
	?mScanR
    endif
    ifnb    <glen>
	glen	 =   $ - ?mStart	;length of graphics mode tables
    endif
    if	    ?mDEF
	GraphVectCnt = ($-GraphVectStart)/2 ;count of graphics vectors
    endif
	endm

;*** 
; define (internal macro)
;
;Purpose:
;	Build a numeric data item into the table, given a name and type.
;
;	If ?mDEF is set TRUE by "mEnd", "define" generate a public label
;	for the item.
;
;	Afterwards, the symbol is set to a known invalid value.  (Symbols
;	cannot be purged.)  This value is tested for to prevent subsequent
;	tables from inheriting values from a previous table by omitting
;	an entry.
;
;	NOTE:  Be sure, when modifying the table structure in "mEnd" that
;	       a symbol's value is used in any computations before use
;	       with "define", since it invalidates the value.
;
;Arguments:
;	<data storage type (B or W)>
;	<numeric item name>
;
;******************************************************************************

define	macro	t,n
    if	?mDEF
	label&t <PUBLIC,b$&n>
    endif
	D&t	?m&n
    if	?m&n EQ 7FFFH
	.ERR
	%OUT &n: invalid (residual) value
    endif
	?m&n	= 07FFFH	;set value to "invalid" to trap residue
	endm

;*** 
; mmd (internal macro) "make macro data"
;
;Purpose:
;	This macro is used internally to generate each of the macros
;	for use in recording the values of numeric data items.
;	"mmd ScreenMode", for example generates a macro named "mScreenMode".
;	When "mScreenMode" is later invoked with a value as an argument, the
;	symbol "?mScreenMode" will be set to that value for later use by
;	the "mEnd" macro.
;
;Arguments:
;	<numeric item name>
;
;******************************************************************************

mmd	macro	n
	mmdi	m&n,?m&n
	endm

;*** 
; mmdi (internal macro) "make macro data item"
;
;Purpose:
;	Used by macro mmd to create a macro (e.g. mScreenMode) which will
;	set a symbol (e.g. ?mScreenMode) to the value of its argument.
;
;Arguments:
;	<macro name>
;	<value symbol>
;******************************************************************************

mmdi	macro	n1,n2
	n1	macro	v
		n2	= v
		endm
	endm

;*** 
; mmwv (internal macro) "make macro word vector"
;
;Purpose:
;	This macro is used internally to generate each of the macros
;	for use in recording the values of word vector data items.
;	"mmwv AlphaDim", for example generates a macro named "mAlphaDim".
;	When "mAlphaDim" is later invoked with a label as an argument, a
;	new macro "?mAlphaDim" will be created.  "mEnd" invokes the
;	"?mAlphaDim" macro to build the "DW <label>" item.
;
;	This method is used as the only mechanism to "store" label
;	names for later use.  (The label name is essentially "stored"
;	in the final macro.)  With MASM (4.0), EQU's cannot be purged
;	or reassigned, and "="'s appear not to be able to handle
;	assignments involving external labels.
;
;Arguments:
;	<label item name>
;
;******************************************************************************

mmwv	macro	n
	mmv	m&n,?m&n,b$&n,W
	endm

;*** 
; mmdv (internal macro)
;
;Purpose:
;	This macro is used internally to generate each of the macros
;	The method is identical to "mmwv" except that a double-word
;	vector is ultimately generated.
;
;Arguments:
;	<label item name>
;
;******************************************************************************

mmdv	macro	n
	mmv	m&n,?m&n,b$&n,D
	endm

;*** 
; mmv (internal macro)
;
;Purpose:
;	Used by macros "mmwv" and "mmdv" to create a macro (e.g. mAlphaDim)
;	which will create a macro (e.g. ?mAlphaDim) to build the appropriate
;	short or double word pointer table entry.
;
;	The final macro (e.g. ?mAlphaDim) purges itself after use (by mEnd)
;	so that a subsequent table definition omitting a value will not
;	pick up residual data from a previous table construction.
;
;Arguments:
;	<first macro name (mXX)>
;	<second macro name (?mXX)>
;	<public name for item (b$XX)>
;	<data storage type (W or D)>
;******************************************************************************

mmv	macro	n1,n2,n3,t
	n1	macro	v
		n2	macro
		    if	?mDEF
			label&t <PUBLIC,n3>
		    endif
			D&t	v
			purge	n2	;avoid residue from one table to next
			endm
		endm
	endm
;
; MACRO CREATION:
; --------------
; Now create all the macros for all the data items (using the macros
; described above).  These macros, all named "mXX" where XX is the
; name argument, are then used to specify values for the table items.
;
mmdv	InitPalette
mmdv	InitVgaPal		;[1]
mmwv	AlphaDim
mmwv	SetMode
mmwv	SetPages
mmwv	PalReset
mmwv	PalPut
mmwv	PalTrans
mmwv	PalSet
mmwv	SetColor
mmwv	MapXYC
mmwv	LeftC
mmwv	ChkUpC
mmwv	UpC
mmwv	ChkDownC
mmwv	DownC
mmwv	SetAttr
mmwv	ReadC
mmwv	SetC
mmwv	SetPixC
mmwv	SetPixFirstC
mmwv	SetPixLastC
mmwv	LineX
mmwv	LineY
mmwv	LineV
mmwv	PutAction
mmwv	NReadL
mmwv	NWriteL
mmwv	NSetC
mmwv	PaintBound
mmwv	SetTile
mmwv	ScanL
mmwv	ScanR
mmd	ScreenMode
mmd	BiosMode
mmd	Burst
mmd	ScrWidth
mmd	ScrHeight
mmd	HorzRes
mmd	VertRes
mmd	VideoBase
mmd	MaxAttr
mmd	MaxColor
mmd	PageSize
mmd	CurrPSize
mmd	MaxPage
mmd	NullColor
mmd	ForeColor
mmd	BackColor
mmd	EgaWrMd
mmd	ForeMapped
mmd	BitsPerPixel
mmd	Planes

purge	mmd, mmwv, mmdv, mmv, mmdi  ;no longer needed

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -