📄 xsys0.asm
字号:
; Project: HARTIK 3.0
; Description: Hard Real TIme Kernel for 386 & higher machines
; Author: Gerardo Lamastra
; Date: 9/5/96
; Revision: Beta 1.0
;
; Assembler portion of the library!
; I shall use Watcom register calling convention along this module
;
.386
.387
.model flat
INCLUDE sel.inc
.data
PUBLIC __HugeValue
__HugeValue DB 00H,00H,00H,00H,00H,00H,0f0H,7fH
.code
PUBLIC _exit_
PUBLIC _x_callBIOS_
PUBLIC outp_
PUBLIC inp_
PUBLIC outpw_
PUBLIC inpw_
PUBLIC __GETDS
; Simple function to terminate PM application
;
; void _exit(int code)
; Input: EAX = code
_exit_ PROC
db 0eah ; Direct gate jmp
dd 0
dw X_RM_BACK_GATE
_exit_ ENDP
; Invoke 16 bit BIOS function from PM application
;
; void _x_callBIOS(void)
_x_callBIOS_ PROC
db 09ah ; Direct gate jmp
dd 0
dw X_CALLBIOS_GATE
ret
_x_callBIOS_ ENDP
; void outp(int port,char value)
; Input: EAX = port,EDX = value
outp_ PROC
push ebx
mov ebx,eax
mov al,dl
mov edx,ebx
out dx,al
pop ebx
ret
outp_ ENDP
; char inp(int port)
; Input: EAX = port
; Output: EAX
inp_ PROC
push edx
mov edx,eax
sub eax,eax
in al,dx
pop edx
ret
inp_ ENDP
; void outpw(int port,unsigned short value)
; Input: EAX = port,EDX = value
outpw_ PROC
push ebx
mov ebx,eax
mov ax,dx
mov edx,ebx
out dx,ax
pop ebx
ret
outpw_ ENDP
; char inpw(int port)
; Input: EAX = port
; Output: EAX
inpw_ PROC
push edx
mov edx,eax
sub eax,eax
in ax,dx
pop edx
ret
inpw_ ENDP
; void outpd(int port,unsigned short value)
; Input: EAX = port,EDX = value
outpd_ PROC
push ebx
mov ebx,eax
mov ax,dx
mov edx,ebx
out dx,eax
pop ebx
ret
outpd_ ENDP
; char inpd(int port)
; Input: EAX = port
; Output: EAX
inpd_ PROC
push edx
mov edx,eax
sub eax,eax
in eax,dx
pop edx
ret
inpd_ ENDP
; void __cdecl _GETDS(void);
; This function is a Watcom trick! In a C-written interrupt handler
; we need to reload DS because we do not know what value it can have!
__GETDS PROC
mov ax,PM_APPLDATA_SEL
mov ds,ax
ret
__GETDS ENDP
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -