int10h.asm
来自「开放源码的编译器open watcom 1.6.0版的源代码」· 汇编 代码 · 共 819 行 · 第 1/2 页
ASM
819 行
xor edx,edx
mov es:[edi].Real_EAX,1002h
mov es:[edi].Real_EDX,edx
mov ax,fs:w[EPSP_TransReal]
mov es:[edi].Real_ES,ax
assume es:nothing
mov bl,10h
sys IntXX
popm ds,es,fs
popm eax,ebx,ecx,edx,esi,edi,ebp
jmp @@Done
;
@@GetPens: ;ES:DX - Space for list of 17 pen numbers.
;
pushm eax,ebx,ecx,edx,esi,edi,ebp
pushm ds,es,fs
push eax
xor eax,eax
mov ax,es
lsl eax,eax
cmp eax,10000h
jnc @@Use32Bit51
movzx edx,dx
@@Use32Bit51: pop eax
pushm edx,es
;
mov edi,offset Int10Buffer
mov es,cs:Int10hDseg
assume es:_cwMain
mov fs,es:PSPSegment
xor edx,edx
mov es:[edi].Real_EAX,1009h
mov es:[edi].Real_EDX,edx
mov ax,fs:w[EPSP_TransReal]
mov es:[edi].Real_ES,ax
assume es:nothing
mov bl,10h
sys IntXX ;read pen values.
popm edi,es
mov ds,cs:Int10hDseg
assume ds:_cwMain
xor esi,esi
mov ds,fs:w[EPSP_TransProt]
assume ds:nothing
mov ecx,17
cld
rep movsb ;copy the results.
popm ds,es,fs
popm eax,ebx,ecx,edx,esi,edi,ebp
jmp @@Done
;
@@SetColours: ;ES:DX - list of RGB values.
;CX - number of values.
;
pushm eax,ebx,ecx,edx,esi,edi,ebp
pushm ds,es,fs
push eax
xor eax,eax
mov ax,es
lsl eax,eax
cmp eax,10000h
jnc @@Use32Bit52
movzx edx,dx
@@Use32Bit52: pop eax
mov esi,edx ;source buffer.
push es
mov ds,cs:Int10hDseg
assume ds:_cwMain
mov fs,PSPSegment
xor edi,edi
mov es,fs:w[EPSP_TransProt]
pop ds
assume ds:nothing
cld
push cx
movzx ecx,cx
mov eax,ecx
add ecx,ecx
add ecx,eax ;3 bytes per entry.
rep movsb ;copy into transfer buffer.
pop cx
mov edi,offset Int10Buffer
mov es,cs:Int10hDseg
assume es:_cwMain
xor edx,edx
mov es:[edi].Real_EAX,1012h
mov es:[edi].Real_EDX,edx
mov es:[edi].Real_ECX,ecx
mov es:[edi].Real_EBX,ebx
mov ax,fs:w[EPSP_TransReal]
mov es:[edi].Real_ES,ax
assume es:nothing
mov bl,10h
sys IntXX
popm ds,es,fs
popm eax,ebx,ecx,edx,esi,edi,ebp
jmp @@Done
;
@@GetColours: ;ES:DX - Buffer for list of RGB values.
;CX - Number of values.
;
pushm eax,ebx,ecx,edx,esi,edi,ebp
pushm ds,es,fs
push eax
xor eax,eax
mov ax,es
lsl eax,eax
cmp eax,10000h
jnc @@Use32Bit53
movzx edx,dx
@@Use32Bit53: pop eax
pushm ecx,edx,es
;
mov edi,offset Int10Buffer
mov es,cs:Int10hDseg
assume es:_cwMain
mov fs,es:PSPSegment
xor edx,edx
mov es:[edi].Real_EAX,1017h
mov es:[edi].Real_EDX,edx
mov es:[edi].Real_ECX,ecx
mov es:[edi].Real_EBX,ebx
mov ax,fs:w[EPSP_TransReal]
mov es:[edi].Real_ES,ax
assume es:nothing
mov bl,10h
sys IntXX ;read pen values.
popm ecx,edi,es
mov ds,cs:Int10hDseg
assume ds:_cwMain
xor esi,esi
mov ds,fs:w[EPSP_TransProt]
assume ds:nothing
movzx ecx,cx
mov eax,ecx
add ecx,ecx
add ecx,eax ;3 bytes per entry.
cld
rep movsb ;copy the results.
popm ds,es,fs
popm eax,ebx,ecx,edx,esi,edi,ebp
jmp @@Done
;
@@WriteString: ;ES:BP - String to write.
;CX - Number of characters to write.
;
pushm eax,ebx,ecx,edx,esi,edi,ebp
pushm ds,es,fs
push eax
xor eax,eax
mov ax,es
lsl eax,eax
cmp eax,10000h
jnc @@Use32Bit54
movzx ebp,bp
@@Use32Bit54: pop eax
mov esi,ebp ;source buffer.
push es
mov ds,cs:Int10hDseg
assume ds:_cwMain
mov fs,PSPSegment
xor edi,edi
mov es,fs:w[EPSP_TransProt]
pop ds
assume ds:nothing
cld
push cx
cmp al,2
jc @@noatts
add cx,cx
@@noatts: movzx ecx,cx
rep movsb ;copy into transfer buffer.
pop cx
mov edi,offset Int10Buffer
mov es,cs:Int10hDseg
assume es:_cwMain
xor ebp,ebp
mov es:[edi].Real_EAX,eax
; mov es:[edi].Real_EBP,edx
mov es:[edi].Real_EBP,ebp
mov es:[edi].Real_ECX,ecx
mov es:[edi].Real_EBX,ebx
mov es:[edi].Real_EDX,edx
mov ax,fs:w[EPSP_TransReal]
mov es:[edi].Real_ES,ax
assume es:nothing
mov bl,10h
sys IntXX
popm ds,es,fs
popm eax,ebx,ecx,edx,esi,edi,ebp
jmp @@Done
;
@@StateSize: ;Return state size.
;
pushm eax,ecx,edi,es
mov edi,offset Int10Buffer
mov es,cs:Int10hDseg
mov es:[edi].Real_EAX,eax
mov es:[edi].Real_ECX,ecx
mov bl,10h
sys IntXX
mov ebx,es:Real_EBX[edi]
cmp bx,2048/64
jc @@ss3
;
xor bx,bx
test cl,1
jz @@ss0
add bx,0c0h
@@ss0: test cl,2
jz @@ss1
add bx,0c0h
@@ss1: test cl,4
jz @@ss2
add bx,0380h
@@ss2: add bx,63
shr bx,6
@@ss3: popm eax,ecx,edi,es
jmp @@Done
;
@@StateSave: ;Save state function.
;
pushm eax,ebx,ecx,edx,esi,edi,ebp
pushm ds,es,fs
push eax
xor eax,eax
mov ax,es
lsl eax,eax
cmp eax,10000h
jnc @@Use32Bit58
movzx ebx,bx
@@Use32Bit58: pop eax
pushm eax,ebx,ecx,es
;
mov edi,offset Int10Buffer
mov es,cs:Int10hDseg
assume es:_cwMain
mov fs,es:PSPSegment
xor ebx,ebx
mov es:[edi].Real_EAX,eax
mov es:[edi].Real_EBX,ebx
mov es:[edi].Real_ECX,ecx
mov ax,fs:w[EPSP_TransReal]
mov es:[edi].Real_ES,ax
assume es:nothing
mov bl,10h
sys IntXX
popm eax,ebx,ecx,es
;
pushm eax,ebx,es
mov ax,1c00h
int 10h ;Get buffer size.
movzx ecx,bx
popm eax,ebx,es
shl ecx,6 ;*64
mov edi,ebx ;destination buffer.
mov ds,cs:Int10hDseg
assume ds:_cwMain
xor esi,esi
mov ds,fs:w[EPSP_TransProt]
assume ds:nothing
cld
rep movsb
popm ds,es,fs
popm eax,ebx,ecx,edx,esi,edi,ebp
jmp @@Done
;
@@StateRestore: ;Restore state function.
;
pushm eax,ebx,ecx,edx,esi,edi,ebp
pushm ds,es,fs
push eax
xor eax,eax
mov ax,es
lsl eax,eax
cmp eax,10000h
jnc @@Use32Bit59
movzx ebx,bx
@@Use32Bit59: pop eax
;
pushm eax,ebx,ecx,es
pushm eax,ebx,es
mov ax,1c00h
int 10h ;Get buffer size.
movzx ecx,bx
popm eax,ebx,es
shl ecx,6 ;*64
mov esi,ebx ;source buffer.
push es
mov ds,cs:Int10hDseg
assume ds:_cwMain
mov fs,PSPSegment
xor edi,edi
mov es,fs:w[EPSP_TransProt]
assume ds:nothing
pop ds
cld
rep movsb
popm eax,ebx,ecx,es
;
mov edi,offset Int10Buffer
mov es,cs:Int10hDseg
assume es:_cwMain
xor ebx,ebx
mov es:[edi].Real_EAX,eax
mov es:[edi].Real_EBX,ebx
mov es:[edi].Real_ECX,ecx
mov ax,fs:w[EPSP_TransReal]
mov es:[edi].Real_ES,ax
assume es:nothing
mov bl,10h
sys IntXX
;
popm ds,es,fs
popm eax,ebx,ecx,edx,esi,edi,ebp
jmp @@Done
;
@@Done: ;Now update stacked flags.
;
pushm eax,ebx
pushf
pop ax ;get new flags.
push ds
mov ds,cs:Int10hDSeg
assume ds:_cwMain
test SystemFlags,1
assume ds:nothing
pop ds
jz @@Use32Bit8
mov bx,sp
mov bx,ss:[bx+(4+4)+(2+2)] ;get origional flags.
jmp @@Use16Bit8
@@Use32Bit8: mov bx,ss:[esp+(4+4)+(4+4)] ;get origional flags.
@@Use16Bit8: and bx,0000011000000000b ;retain IF.
and ax,1111100111111111b ;lose IF.
or ax,bx ;get old IF.
push ds
mov ds,cs:Int10hDseg
assume ds:_cwMain
test SystemFlags,1
assume ds:nothing
pop ds
jz @@Use32Bit9
mov bx,sp
mov ss:[bx+(4+4)+(2+2)],ax ;modify stack flags.
jmp @@Use16Bit9
@@Use32Bit9: mov ss:[esp+(4+4)+(4+4)],ax ;modify stack flags.
@@Use16Bit9: popm eax,ebx
push ds
mov ds,cs:Int10hDseg
assume ds:_cwMain
test SystemFlags,1
assume ds:nothing
pop ds
jz @@Use32Bit10
iret
@@Use32Bit10: ;
iretd
;
@@NotOurs: ;Not a function recognised by us so pass control to previous handler.
;
push ds
mov ds,cs:Int10hDSeg
assume ds:_cwMain
test SystemFlags,1
assume ds:nothing
pop ds
jz @@Use32Bit11
db 66h
jmp cs:f[OldInt10h] ;pass it onto previous handler.
@@Use32Bit11: jmp cs:f[OldInt10h] ;pass it onto previous handler.
Int10h endp
;
;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==
Bord10 proc near
pushm ax,dx
mov ah,al
mov dx,3dah
in al,dx
mov dl,0c0h
mov al,11h
out dx,al
mov al,ah
out dx,al
mov al,20h
out dx,al
popm ax,dx
ret
Bord10 endp
OldInt10h df 0
Int10hCSeg dw ?
Int10hDSeg dw ?
Int10hDDSeg dw ?
;
Int10hStaticSel dw ?
Int10hUltraFont dw ?
;
db 4 dup (0)
Int10hEnd label byte
_Int10h ends
.286
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?