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

📄 llega.asm

📁 [随书类]Dos6.0源代码
💻 ASM
📖 第 1 页 / 共 4 页
字号:
mUpC		B$EgaUpC
mChkDownC	B$EgaChkDownC
mDownC		B$EgaDownC
mSetAttr	B$EgaSetAttr
mReadC		B$EgaReadC
mSetC		B$EgaSetC
mSetPixC	B$EgaSetPixC
mSetPixFirstC	B$EgaSetPixFirstC
mSetPixLastC	B$ResetEGA
mLineX		B$EgaLineX
mLineY		B$EgaLineY
mLineV		B$EgaLineV
mPutAction	B$EgaPutAction
mNReadL 	B$EgaNReadL
mNWriteL	B$EgaNWriteL
mNSetC		B$EgaNSetC
mPaintBound	B$EgaPaintBound
mSetTile	B$EgaSetTile
mScanL		B$EgaScanL
mScanR		B$EgaScanR
mEnd		GraphDataLen
;===========================================================================

;===========================================================================
mModeData	Mode10Data_64K
;
; SCREEN 9, BIOS mode 10 (with 64K video memory)
;
; Mode-dependent data follows to initialize the the "b$ModeData" table
; in LLCGRP.
;
;===========================================================================
mScreenMode	9
mBiosMode	10H
mBurst		0
mScrWidth	80
mScrHeight	25
mHorzRes	640
mVertRes	350
mVideoBase	0A000H
mMaxAttr	3
mMaxColor	63
mPageSize	64		    ;page size in K
mCurrPSize	<(64/2*1024) shr 4> ;page size in paragraphs (1 plane)
mMaxPage	0
mNullColor	0
mForeColor	3
mBackColor	0
mEgaWrMd	12H
mInitPalette	Mode10Palette_64K
mInitVgaPal	Mode10VgaPal_64K	
mAlphaDim	AlphaDim_10
mSetMode	SetMode
mSetPages	SetPages
mPalReset	B$EgaPalReset
mPalPut 	B$EgaPalPut
mPalTrans	PalTrans_10_64K
mPalSet 	B$EgaPalSet
mSetColor	SetColor
mForeMapped	15			
mBitsPerPixel	1
mPlanes 	2
mMapXYC 	B$EgaMapXYC
mLeftC		B$EgaLeftC
mChkUpC 	B$EgaChkUpC
mUpC		B$EgaUpC
mChkDownC	B$EgaChkDownC
mDownC		B$EgaDownC
mSetAttr	SetAttr_F_10_64K
mReadC		B$EgaReadC_64K
mSetC		B$EgaSetC
mSetPixC	B$EgaSetPixC
mSetPixFirstC	B$EgaSetPixFirstC
mSetPixLastC	B$ResetEGA
mLineX		B$EgaLineX
mLineY		B$EgaLineY
mLineV		B$EgaLineV
mPutAction	B$EgaPutAction_64K
mNReadL 	NReadL_64K
mNWriteL	NWriteL_64K
mNSetC		B$EgaNSetC
mPaintBound	B$EgaPaintBound
mSetTile	B$EgaSetTile
mScanL		ScanLX
mScanR		ScanRX
mEnd		GraphDataLen
;===========================================================================

;
; ModeFPalette - used to initialize the EGA palette for SCREEN 10
;		 (BIOS mode F).
;
labelB	ModeFPalette		;EGA palette for BIOS mode 0FH
	;	RGBrgb
	DB	000000B 	;black
	DB	001000B 	;video
	DB	000000B 	;black
	DB	000000B 	;black
	DB	011000B 	;intensified
	DB	011000B 	;intensified
	DB	000000B 	;black
	DB	000000B 	;black
	DB	000000B 	;black
	DB	001000B 	;video
	DB	000000B 	;black
	DB	000000B 	;black
	DB	000000B 	;black
	DB	011000B 	;intensified
	DB	000000B 	;black
	DB	000000B 	;black
;
; Mode10Palette_64K - used to initialize the EGA palette for SCREEN 9
;		  (BIOS mode 10) with 64K of video memory.
;
labelB	Mode10Palette_64K	;EGA palette for BIOS mode 10H with only 64K
	;	RGBrgb
	DB	000000B 	;black
	DB	111011B 	;light cyan
	DB	000000B 	;black (not used)
	DB	000000B 	;black (not used)
	DB	111101B 	;light magenta
	DB	111111B 	;bright white
	;DB      10 DUP (0)      ;brown


labelNP <PUBLIC,B$EGAUSED>	

;*** 
; B$Screen7
;
;Purpose:
;	Establish all relevent mode dependent data values and function
;	vectors for BASIC screen mode 7.
;Entry:
;	AL = screen mode (7)
;	AH = burst (0 or 1)
;	CL = alpha columns
;Exit:
;	PSW.C = set indicates error
;Uses:
;	per conv.
;Exceptions:
;******************************************************************************
cProc	B$Screen7,<PUBLIC,NEAR>
cBegin
	mov	bx,GR_TEXTOFFSET ModeDData  ;mode-specific data
	jmp	short ScrCommon2	    ;common routine
cEnd	<nogen>

;*** 
; B$Screen8
;
;Purpose:
;	Establish all relevent mode dependent data values and function
;	vectors for BASIC screen mode 8.
;Entry:
;	AL = screen mode (8)
;	AH = burst (0 or 1)
;	CL = alpha columns
;Exit:
;	PSW.C = set indicates error
;Uses:
;	per conv.
;Exceptions:
;******************************************************************************
cProc	B$Screen8,<PUBLIC,NEAR>
cBegin
	mov	bx,GR_TEXTOFFSET ModeEData  ;mode-specific data
ScrCommon2:
	test	b$Monitor,AnalogColor + EnhColor + StdColor
				;check for monitor support
	je	ScrErr		;exit w/error if not supported
	jmp	short ScrCommon ;common routine
cEnd	<nogen>

;*** 
; B$Screen9
;
;Purpose:
;	Establish all relevent mode dependent data values and function
;	vectors for BASIC screen mode 9.
;Entry:
;	AL = screen mode (9)
;	AH = burst (0 or 1)
;	CL = alpha columns
;Exit:
;	PSW.C = set indicates error
;Uses:
;	per conv.
;Exceptions:
;******************************************************************************
cProc	B$Screen9,<PUBLIC,NEAR>
cBegin
	test	b$Monitor,AnalogColor + EnhColor ;check for monitor support
	je	ScrErr		;exit w/error if not supported
	mov	bx,GR_TEXTOFFSET Mode10Data ;mode-specific data
	cmp	b$VideoMem,64	;check for mode 10 w/only 64K
	ja	ScrCommon	;go if greater, otherwise use diff table
	mov	bx,GR_TEXTOFFSET Mode10Data_64K ;mode-specific data
ScrCommon:
	test	b$Adapter,VGA + EGA ;check for adapter support
	je	ScrErr		;exit w/error if not supported
	mov	cx,GraphDataLen 
	call	B$InitModeData ;initialize table data
	mov	ax,b$VideoMem	;MaxPage = VideoMem / PageSize - 1
	div	b$PageSize	
	dec	al		;MaxPage = #pages-1
	mov	b$MaxPage,al
	clc			;indicate no error
cEnd

;*** 
; B$Screen10
;
;Purpose:
;	Establish all relevent mode dependent data values and function
;	vectors for BASIC screen mode 10.
;Entry:
;	AL = screen mode (10)
;	AH = burst (0 or 1)
;	CL = alpha columns
;Exit:
;	PSW.C = set indicates error
;Uses:
;	per conv.
;Exceptions:
;******************************************************************************
cProc	B$Screen10,<PUBLIC,NEAR>
cBegin
	test	b$Monitor,AnalogMono + Monochrome ;check monitor support
	je	ScrErr		;exit w/error if not supported
	mov	bx,GR_TEXTOFFSET ModeFData  ;mode-specific data
	cmp	b$VideoMem,64	;check for mode F w/only 64K
	ja	Scr10Common	;go if greater, otherwise use diff table
	mov	bx,GR_TEXTOFFSET ModeFData_64K ;mode-specific data
Scr10Common:
	test	b$Adapter,VGA + EGA ;check for adapter support
	je	ScrErr		;exit w/error if not supported
	mov	cx,GraphDataLen 
	call	B$InitModeData ;initialize table data
	mov	ax,b$VideoMem	; MaxPage = VideoMem / 2 / PageSize - 1
	shr	ax,1		; divide VideoMem by 2
	div	b$PageSize	
	sub	al,1		;MaxPage = #pages-1
	adc	al,0		;if MaxPage < 0 (64K EGA), force back to 0
	mov	b$MaxPage,al
	clc			;indicate no error
	jmp	short ScrExit	
ScrErr:
	stc
ScrExit:			
cEnd

;***
; AlphaDim_D
;
;Purpose:
;	Validate the proposed text dimensions for Screen 7.
;	  If 40x25 is requested, this mode satisfies the request
;	  elseif 80x25 is requested, suggest screen mode 8
;	  else suggest screen mode 0.
;Entry:
;	BH = number of lines
;	BL = number of columns
;Exit:
;	AL = -1 if this mode satisfies the request, otherwise
;		AL is suggested screen mode to invoke for desired dimensions
;Uses:
;	per conv.
;Exceptions:
;******************************************************************************
DbPub	AlphaDim_D
cProc	AlphaDim_D,<NEAR>
cBegin
	mov	al,-1		;flag request satisfied (maybe)
	cmp	bx,40+25*256	;40x25?
	je	ADimSet 	;exit if so, standard stuff
	mov	al,8		;prepare request for screen 8, JIC
	cmp	bx,80+25*256	;80x25?
	je	ADimDOk 	;exit if so, try screen 8
	xor	al,al		;flag request for screen 0
ADimDOk:
cEnd

;***
; AlphaDim_F
;
;Purpose:
;	Validate the proposed text dimensions for Screen 10.
;	  If 40 columns are requested, treat as if 80 were requested.
;	  Fall through to AlphaDim_10 for validation.
;Entry:
;	BL = number of lines
;	BH = number of columns
;Exit:
;	falls through to AlphaDim_10
;Uses:
;	per conv.
;Exceptions:
;******************************************************************************
DbPub	AlphaDim_F
cProc	AlphaDim_F,<NEAR>
cBegin
	cmp	bl,40		;40 columns?
	jne	AlphaDim_10	;go if not, as if mode 10H
	mov	bl,80		;treat 40 as if request for 80
cEnd	<nogen> 		;fall thru to AlphaDim_10

;***
; AlphaDim_10/AlphaDim_E
;
;Purpose:
;	Validate the proposed text dimensions for Screen 9 or Screen 8,
;	depending on entry point.
;	  If 80x25 or 80x43 is requested, this mode satisfies the request
;	  elseif 40x25 is requested, suggest screen mode 7
;	  else suggest screen mode 0.
;Entry:
;	BL = number of lines
;	BH = number of columns
;Exit:
;	If this mode satisfies request
;	  AL = -1
;	  b$ScrHeight is set to value in BL
;	else
;	  AL = suggested screen mode to invoke for desired dimensions
;Uses:
;	per conv.
;Exceptions:
;******************************************************************************
DbPub	AlphaDim_10
cProc	AlphaDim_10,<NEAR>
cBegin
	mov	al,-1		;flag request satisfied (maybe)
	cmp	bx,80+43*256	;80x43?
	je	ADimSet 	;exit if so, standard stuff

labelNP AlphaDim_E

	mov	al,-1		;flag request satisfied (maybe)
	cmp	bx,80+25*256	;80x25?
	je	ADimSet 	;exit if so, standard stuff
	mov	al,7		;prepare request for screen 7, JIC
	cmp	bx,40+25*256	;40x25?
	je	ADimOk		;exit if so, try screen 7
	xor	al,al		;flag request for screen 0
	jmp	short ADimOk	;  and exit
ADimSet:
	mov	b$ScrHeight,bh ;set alpha rows
ADimOk:
	clc			;no error
cEnd

;***
; SetMode
;
;Purpose:
;	Set EGA screen mode according to the characteristics established
;	by previous call to B$Screenx and b$AlphaDim.  Set 8x8 character
;	font if new mode is to be 43 lines.
;Entry:
;	b$BiosMode is mode to set
;	b$ScrHeight is number of lines
;Exit:
;	None
;Uses:
;	per conv.
;Exceptions:
;******************************************************************************
cProc	SetMode,<NEAR>
cBegin
	mov	al,b$BiosMode	;set BIOS mode
	SCNIO	vSetMode
	cmp	b$ScrHeight,43 ;43 lines?
	jne	SetMode25	;go if not
	mov	dl,43		; char gen call wants # of lines in DL
	mov	ax,1123H	;character generator request
	xor	bl,bl		;  to load 8x8 font
	SCNIO			;  which gets 43 lines
SetMode25:
	call	B$ResetEGA
	MOV	DX,b$CURSOR	; Get current cursor position
	MOV	BYTE PTR b$CSRTYP,-1 ; invalidate present cursor type so it
				; will get changed
	CALL	B$USRCSR	; display user cursor
cEnd

;***
; SetPages
;
;Purpose:
;	Set the current active and visual pages and calculate page size
;	and video segment offset for EGA modes.
;Entry:
;	AL = active page
;	AH = visual page
;Exit:
;	b$CurPages set to new active and visual pages.
;	b$SegC set to start of new active page.
;Uses:
;	per conv.
;Exceptions:
;******************************************************************************
cProc	SetPages,<NEAR>
cBegin
	mov	b$CurPages,ax	;save page numbers
	push	ax
	mov	al,ah
	SCNIO	vSelActivePage	;set visual page
	pop	ax
	cbw			;extend active page to word
	mul	b$CurrPSize	;times page size in paras
	add	ax,b$VideoBase ;set video segment
	mov	b$SegC,ax
cEnd

;***
; PalPut_F
;
;Purpose:
;	Change palette entry for Screen 10 with translation/verification.
;	A color value of -1 indicates that the associated palette
;	entry is not to be modified.
;Entry:
;	DX:AX = color
;	BL = attribute
;Exit:
;	PSW.C reset indicates successful operation
;		set indicates PALETTE function call error
;Uses:
;	per conv.
;Exceptions:
;******************************************************************************
DbPub	PalPut_F
cProc	PalPut_F,<NEAR>
cBegin
	cmp	ax,-1		;lo word of color == -1?
	jne	PalPut1 	;go if not, can't ignore
	cmp	dx,ax		;hi word too?
	je	PalPutExit	;exit if color == -1
PalPut1:			
	call	PalTrans_F	;translate to external form
	jc	PalPutExit	;exit if invalid w/error
	mov	bh,al		;BH:BL = color:attribute
	mov	al,bl		;ah:al = 2nd pair
	add	al,8
	push	ax		;save 2nd values in pair
	xor	al,al		;subfunction "Set Individual Palette Register"
	SCNIO	vSetEgaPalette
	pop	ax
	xchg	bx,ax		;2nd pair
	xor	al,al		;subfunction "Set Individual Palette Register"
	SCNIO	vSetEgaPalette
	clc			;no error
PalPutExit:
cEnd

labelW	TransF
	DB	0,0,0,8,0,24	;9 possible value pairs of mode 0FH
	DB	8,0,8,8,8,24	;0 - black, 8 - video, 18H - intensified
	DB	24,0,24,8,24,24

;***
; PalTrans_F
;
;Purpose:
;	Translate a user supplied attribute/color pair for Screen 10 to
;	the corresponding hardware values after verifying that they are
;	in the legal range.
;	    Attribute mapping:	0 --> 0
;				1 --> 1
;				2 --> 4
;				3 --> 5
;	    Color pair mapping per TransF table.
;Entry:
;	DX:AX = user supplied color value
;	BL    = user supplied attribute value
;Exit:
;	PSW.C set if illegal value, reset if Ok
;	AX = actual color pair value
;	BL = actual attribute value
;Uses:
;	per conv.
;Exceptions:
;	can exit through PalTrans_10_64K error exit.
;******************************************************************************
DbPub	PalTrans_F
cProc	PalTrans_F,<NEAR>
cBegin
	cmp	bl,b$MaxAttr	;is legal attribute ?
	ja	PalTrErr	;error return
	or	dh,dl		;hi 3 bytes of color must be 0
	or	dh,ah		
	jnz	PalTrErr	;error if not
	cmp	al,b$MaxColor	;is legal color ?
	ja	PalTrErr	;error return

⌨️ 快捷键说明

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