📄 egaint10.inc
字号:
; 38h: gr 2 pos reg (3cah) ;
; es:bx points to table receiving default values ;
; (table must have room for full set of values) ;
; ;
; return: ax restored ;
; bx trashed ;
; dx trashed ;
; es restored ;
; all others restored ;
; ;
; ;
; Inquire Driver ;
; in: ah 0fah ;
; bx 0 ;
; ;
; return: ax restored ;
; es:bx nonzero (reserved) ;
; ;
; ;
; note: calls 0f9h, and 0fbh - 0fdh are reserved. 0feh & 0ffh are used by ;
; environments such as Windows, TopView, and Mondrian ;
; ;
;-----------------------------------------------------------------------------;
;[1]not for BASIC RUNTIME!!
;[1] .286c ;can use 286 instructions in os/2 driver
public Int10Vector
public ChangeRegs
public Int10Routine
MyCallTable label word
dw offset ReadReg ;call f0
dw offset WriteReg ;call f1
dw offset ReadRange ;call f2
dw offset WriteRange ;call f3
dw offset ReadSet ;call f4
dw offset WriteSet ;call f5
dw offset RevertDefault ;call f6
dw offset DefineDefault ;call f7
dw offset GetDefault ;call f8
dw offset CallInt10 ;call f9
dw offset InquireDriver ;call fa
dw offset CallInt10 ;call fb
dw offset CallInt10 ;call fc
dw offset CallInt10 ;call fd
dw offset CallInt10 ;call fe
dw offset CallInt10 ;call ff
MaxBIOSCall equ 13h ;max rom bios call
BIOSCallTable label word ;eventually none will be ignored
dw offset SetMode ;set display mode
dw offset Ignore
dw offset Ignore
dw offset Ignore
dw offset Ignore
dw offset Ignore ;set page now ignored 4/12/87
dw offset Ignore
dw offset Ignore
dw offset Ignore
dw offset Ignore
dw offset Ignore
dw offset SetCgaPalette ;set CGA palette registers
dw offset Ignore
dw offset Ignore
dw offset Ignore
dw offset Ignore
dw offset SetEgaPalette ;set EGA palette registers
dw offset Ignore
dw offset Ignore
dw offset Ignore
SetRec struc ;used in read/write set calls
SRPortNum dw ?
SRPtr db ?
SRData db ? ;must be last!
SetRec ends
PortRec struc
PRPortAddr dw ? ;io port address (can change)
PRCurrTable dw ? ;current shadow map table
PRDefTable dw ? ;default shadow map table
PRNumRegs db ? ;number of data regs
PRModFlag db ? ;modified since last "rev def"
PortRec ends
MasmBug macro pa,ct,dt,nr,mf ;masm 3.0 doesn't allow >1
dw pa ; ... relocatable in a record
dw ct
dw dt
db nr
db mf
endm
NumPtrData equ 4
PortTable label word ;code dependent on order
MasmBug 3d4h,<offset CRTCRegs >,<offset DefCRTCRegs >,19h,0
MasmBug 3c4h,<offset SeqRegs >,<offset DefSeqRegs >,4h,0
MasmBug 3ceh,<offset GraphicsRegs>,<offset DefGraphicsRegs>,9h,0
MasmBug 3c0h,<offset AttrRegs >,<offset DefAttrRegs >,14h,0
MasmBug 3c2h,<offset MiscOutReg >,<offset DefMiscOutReg >,1,0
MasmBug 3dah,<offset FeatureReg >,<offset DefFeatureReg >,1,0
MasmBug 3cch,<offset Gr1PosReg >,<offset DefGr1PosReg >,1,0
MasmBug 3cah,<offset Gr2PosReg >,<offset DefGr2PosReg >,1,0
PortTableEnd label byte
SequencerAddr equ 03c4h
SequencerClMReg equ 1
GraphicsAddr equ 03ceh ;graphics controller port address
GraphicsMiscReg equ 6 ;miscellaneous reg offset in gc
StartShadowMaps label byte
SeqRegs db 5h dup(?) ;these are the shadow map tables
MiscOutReg db ? ;order must be same as bios
CRTCRegs db 19h dup(?)
AttrRegs db 14h dup(?)
GraphicsRegs db 9h dup(?)
SizeShadowMaps equ $-StartShadowMaps
DefSeqRegs db 5h dup(?) ;these are default sm tables
DefMiscOutReg db ? ;order must be same as bios
DefCRTCRegs db 19h dup(?)
DefAttrRegs db 14h dup(?)
DefGraphicsRegs db 9h dup(?)
Gr1PosReg db ? ;these aren't included in bios
Gr2PosReg db ?
FeatureReg db 0 ;never changed
DefGr1PosReg db ?
DefGr2PosReg db ?
DefFeatureReg db 0 ;never changed
SingleRegMod db 0 ;>0 if a single reg modified
SaveAX dw ? ;temp variables
SaveSI dw ?
Int10Vector dd ? ;old int 10 vector
EgaStateVars label byte ;this is reserved for the future
Version db 1,60
CopyrightMsg dw offset Copyright
CheckSum dw 0
CheckSumStart dw offset SetMode
InBIOS db 0
Copyright db "*** This is Copyright (c) 1984,85,86 Microsoft ***"
; BIOS data segment offsets of display data
BiosCrtMode equ 49h ;40:49 = CRT mode
BiosCrtCols equ 4ah ;40:4a = CRT character columns/line
BiosCrtLen equ 4ch ;40:4c = regen buffer length
BiosCursorPosn equ 50h ;40:50 = start of cursor position array
BiosActivePage equ 62h ;40:62 = active display page #
BiosCrtPalette equ 66h ;40:66 = CRT palette byte
SetMode proc near ;this is called when a bios
push ds ; set mode call is made.
xor ax,ax ;it must predict which mode
mov ds,ax ; table the bios will use, so
mov ax,ds:[410h] ; the bios decision logic is
and al,30h ; duplicated here.
test byte ptr ds:[487h],2
jz SMNoMonochrome
cmp al,30h
jnz SMNoChange
mov ah,byte ptr cs:[SaveAX]
mov al,0b0h ;io addr = 3bx
and ah,7fh
cmp ah,0fh
jz SMChangeRegs
mov ah,07h
jmp short SMChangeRegs ;ah has mode
SMNoMonochrome: cmp al,30h
jz SMNoChange
mov ah,byte ptr cs:[SaveAX]
mov al,0d0h ;io addr = 3dx
and ah,7fh
SMChangeRegs: call ChangeRegs
SMNoChange: pop ds
Ignore: ret
SetMode endp
MakeBase proc near ;extracted from ChangeRegs 4/12/87
assume ds:nothing ;ds must be = 0
les si,ds:[4a8h]
les si,es:[si]
test byte ptr ds:[487h],60h
jz mb0 ;these labels correspond to
add si,440h ;... bios offsets.
cmp ah,0fh
je mbx
add si,40h
cmp ah,10h
je mbx
sub si,480h
mb0: cmp ah,3
ja mb2
mov al,0fh
and al,ds:[488h]
cmp al,03h
je mb1
cmp al,09h
jne mb2
mb1: add si,4c0h
mb2: xor al,al
shr ax,1
shr ax,1
add si,ax
mbx: ret ;es:si points to correct table
MakeBase endp
ChangeRegs proc near ;inp: ah=mode,al=io addr,ds=0
push es ;sets up shadow map tables
push cx
push di
pushf ; save direction flag
cld ; clear direction flag
and byte ptr cs:PortTable[0].PRPortAddr,0fh
or byte ptr cs:PortTable[0].PRPortAddr,al
and byte ptr cs:PortTable[5 * size PortRec].PRPortAddr,0fh
or byte ptr cs:PortTable[5 * size PortRec].PRPortAddr,al
call MakeBase
mov ax,es ;es:si points to correct table
mov ds,ax
assume ds:nothing
mov ax,cs
mov es,ax ;ds is source, es dest
add si,5
mov di,offset StartShadowMaps
mov al,3
stosb
mov cx,SizeShadowMaps-1
shr cx,1
push cx
if (SizeShadowMaps-1) and 1
movsb
endif
rep movsw
sub si,(SizeShadowMaps-1)
stosb
pop cx
if (SizeShadowMaps-1) and 1
movsb
endif
rep movsw
mov ax,cs
mov ds,ax
assume ds:Code
mov [Gr1PosReg],cl
mov [DefGr1PosReg],cl
inc cl
mov [Gr2PosReg],cl
mov [DefGr2PosReg],cl
xor di,di
mov cx,NumPtrData
CRClearModFlag: mov byte ptr PortTable[di].PRModFlag,0
add di,size PortRec
loop CRClearModFlag
mov [SingleRegMod],0
popf
pop di
pop cx
pop es
ret
ChangeRegs endp
; Since both hardware regs this routine is trying to shadow are readable,
; and since BVS has taken responsibility for this anyway, this routine
; is unnecessary. It has perhaps not even been tested, since it
; expects AL to have page # on entry, when in fact it must use SaveAX. 4/12/87
;
;SetDisplayPage proc near
; push ax ;save registers that may get
; push bx ; destroyed
; push cx
; push dx
; push di
;
; cbw ;ax <- display page #
; mov bx,ax ;bx <- display page #
; push ds ;save ds
; mov cx,40h ;set ds pointing to the BIOS
; mov ds,cx ; data segment
; mov cl,ds:[BiosActivePage] ;cl <- BIOS active display page
; mov dh,ds:[BiosCrtMode] ;dh <- BIOS display mode
; mov dl,ds:[BiosCrtCols] ;dl <- BIOS chars/line
; mov di,offset BiosCursorPosn[bx] ;di <- cursor position
; mov bx,ds:[BiosCrtLen] ;bx <- BIOS regen buffer length
; pop ds ;restore ds
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -