PortWait proc a_type:dword
;A read from port 64H gives the following status byte:
;
; Bit Function
; 7 1 = Parity error
; 6 1 = General Time Out
; 5 1 = Auxiliary output buffer full
; 4 1 = Inhibit switch
; 3 1 = Command/data
; 2 1 = System flag
; 1 1 = Input buffer full
; 0 1 = Output buffer full
cli
.if a_type==WAIT_READ
wait_type_0:
in al,64h
bt ax,6
jc error
bt ax,7
jc error
bt ax,WAIT_READ ; if bit 3 set data is available at 64h
jnc wait_type_0
xor eax,eax
.elseif a_type==WAIT_WRITE
wait_type_1: ; Bit 1 should be zero before we able to send command
in al,64h
bt ax,6
jc error
bt ax,7
jc error
bt ax,WAIT_WRITE
jc wait_type_1
xor eax,eax
.elseif a_type==WAIT_COMMAND
wait_type_2: ; Bit 0 and 1 should be zero before we able to send command
in al,64h
bt ax,6
jc error
bt ax,7
jc error
bt ax,WAIT_COMMAND
jc wait_type_2
xor eax,eax
.elseif a_type==WAIT_READ60
wait_type_4:
in al,64h
bt ax,6
jc error
bt ax,7
jc error
bt ax,WAIT_READ ; if bit 3 not set data is available at 60h
jc wait_type_4
xor eax,eax
.elseif a_type==WAIT_OUTPUT
wait_type_5:
in al,64h
bt ax,6
jc error
bt ax,7
jc error
bt ax,WAIT_OUTPUT ; if bit 3 set data is available at 64h
jnc wait_type_5
xor eax,eax
.endif
error:
sti
ret
PortWait endp
PortRead proc
invoke PortWait,WAIT_READ
in al,60h
ret
PortRead endp
PortWrite proc a_cmd:byte
invoke PortWait,WAIT_WRITE
mov al,a_cmd
out 64h,al
ret
PortWrite endp
KeyBoardRead proc
LOCAL key:byte
invoke PortWrite,0AEh
invoke PortWrite,0D2h
in al,60h
; invoke PortRead
; mov key,al
; invoke PortWrite,0AEh
; mov al,key
; push eax
; push eax
; invoke dw2bin,eax,base_buffer
; invoke Print,base_buffer
; pop eax
; invoke dw2hex,eax,base_buffer
; invoke Print,base_buffer
; invoke PrintRel,addr crg
; pop eax
; invoke PortWrite,0A7h
ret
KeyBoardRead endp
Worked on my Boot sector Code. I need the information for the "magic byte" for my graphic card.