📄 findg4.asm
字号:
IDEAL
P386
SMART
MODEL COMPACT,C
GLOBAL C findg400:NEAR
GLOBAL C get_pm_table_offset:NEAR
GLOBAL C get_pm_table_segment:NEAR
GLOBAL C get_pm_table_length:NEAR
GLOBAL C own_pm_interface_supported:NEAR
GLOBAL C G400_outb:NEAR
GLOBAL C G400_inb:NEAR
DATASEG
device_bus_number dd 0
CODESEG
PROC findg400 NEAR
mov eax,0b101h
mov edi,0
int 01ah
cmp edx,20494350h
jne notfound
mov eax,0b102h
mov ecx,00525h
mov edx,0102Bh
mov esi,0
int 01ah
or ah,ah
jz found_g400
jmp notfound
found_g400:
mov [dword ptr device_bus_number], ebx
mov eax, 1
ret
notfound:
xor ax,ax
ret
ENDP
PROC own_pm_interface_supported NEAR
mov ax, 0
ret
ENDP
PROC get_pm_table_offset NEAR
mov ax, 0
ret
ENDP
PROC get_pm_table_segment NEAR
mov ax, 0
ret
ENDP
PROC get_pm_table_length NEAR
mov ax, 0
ret
ENDP
PROC G400_outb NEAR
push bp
mov bp, sp
mov eax, [dword ptr bp+4]
and eax, 03FFCh
mov ecx, eax ; G400 index
mov eax, 0B10Dh ; WRITE DWORD
mov edi, 00044h ; register number
mov ebx, [dword ptr device_bus_number]
int 01Ah
mov eax, [dword ptr bp+4]
and eax, 00003h
mov edi, 00048h
add edi, eax ; register number
xor ecx, ecx
mov cl, [byte ptr bp+8] ; G400 data
mov eax, 0B10Bh ; WRITE BYTE
mov ebx, [dword ptr device_bus_number]
int 01Ah
pop bp
ret
ENDP
PROC G400_inb NEAR
push bp
mov bp, sp
mov eax, [dword ptr bp+4]
and eax, 03FFCh
mov ecx, eax ; G400 index
mov eax, 0B10Dh ; WRITE DWORD
mov edi, 00044h ; register number
mov ebx, [dword ptr device_bus_number]
int 01Ah
mov eax, [dword ptr bp+4]
and eax, 00003h
mov edi, 00048h
add edi, eax ; register number
mov eax, 0B108h ; READ BYTE
mov ebx, [dword ptr device_bus_number]
int 01Ah
xor eax, eax
mov al, cl
pop bp
ret
ENDP
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -