Windows NT was designed so that (theoretically) no application could crash the operating system. Part of that security model is that NT will not allow any user-mode (Ring 3) application to access hardware ports. For this reason, INP and OUT was removed from the PowerBASIC language in PB/DLL 32-bit and PB/CC.
However, Windows 95/98 is not a true 32-bit operating system and does not support the NT security model. So technically, an application *can* directly access a hardware port (although we highly recommend that you NOT do it). To do so, you simply use the "in" and "out" assembler instructions.
The following code encapsulates this for those of you not familiar with assembler:
SUB pbOut(BYVAL port AS INTEGER, BYVAL value AS INTEGER)
! mov AX, value
! mov DX, port
! out DX, AL
END SUB
FUNCTION pbInp(BYVAL port AS INTEGER) AS INTEGER
! mov DX, port
! in AL, DX
! mov FUNCTION[0], AL
END FUNCTION
I have read this message and try to use the function,
everything fine when compiling, but when I run it
the windows illegal operation window come-up, I am
using Windows 98 SE.
What's wrong, anybody can help.
However, Windows 95/98 is not a true 32-bit operating system and does not support the NT security model. So technically, an application *can* directly access a hardware port (although we highly recommend that you NOT do it). To do so, you simply use the "in" and "out" assembler instructions.
The following code encapsulates this for those of you not familiar with assembler:
SUB pbOut(BYVAL port AS INTEGER, BYVAL value AS INTEGER)
! mov AX, value
! mov DX, port
! out DX, AL
END SUB
FUNCTION pbInp(BYVAL port AS INTEGER) AS INTEGER
! mov DX, port
! in AL, DX
! mov FUNCTION[0], AL
END FUNCTION
I have read this message and try to use the function,
everything fine when compiling, but when I run it
the windows illegal operation window come-up, I am
using Windows 98 SE.
What's wrong, anybody can help.
Comment