Parallel Programming #4

Blitz3D Forums/Blitz3D Beginners Area/Parallel Programming #4

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

soja,

OK, here is where I am at (I feel more behind than ahead!).

1. I made all the changes to the .decls file, including the boolean (%) expressions and pointer (*) expression.

2. I did a test for the return value for InstallWinIoDriver. I guess the test passed -- I didn't get any "bad news".

3. I created (I think) the peekbyte method to read the data for GetPortVal.

4. Thanks for finding my boo-boo on SetPortVal... I think I fixed it.

5. I did not understand your PPS at all!

Anyway, here is where I am currently at...
When I run the program the error message I get is "Type can only appear in main program.". Here is the current files:

Again, thanks!


.DECLS FILE

.lib "winio.dll"

;Initializes the WinIo library (boolean). Does not have to be used with Windows XP.
InitializeWinIo%():"InitializeWinIo"

;Performs shutdown of the WinIo library. Must be called before terminiating an application or when no longer using the WinIo library.
ShutdownWinIo():"ShutdownWinIo"

;Calls the WinIo driver (boolean). Parameters: (Points to a null-terminated string to specify the winio.sys driver path, Set to false).
InstallWinIoDriver%(WinIoDriverPath$, IsDemandLoaded):"InstallWinIoDriver"

;Removes the WinIo driver (boolean).
RemoveWinIoDriver%():"RemoveWinIoDriver"

;Reads a 1, 2, or 4 byte value from specifies I/O port (pointer). Parameters: (Input port $379, DWORD variable, BYTE = 1).
GetPortVal*(PortAddr, PortVal, Size):"GetPortVal"

;Writes a 1, 2, or 4 byte value to an I/O port (boolean). Parameters: (Output port $378, Hex value written to port, BYTE = 1).
SetPortVal%(PortAddr, PortVal, Size):"SetPortVal"


BLITZBASIC FILE

;The BlitzBASIC code for:
;Direct Port access from BlitzBASIC using WinIo.

;Set graphics mode.
Graphics 800, 600, 16, 2
SetBuffer BackBuffer()

;Initializes the WinIo library.
;InitializeWinIo()

;Call the WinIo driver
If Not InstallWinIoDriver(".\", False) Then
Print "Initialization failed."
End
EndIf

Repeat

Type PortVal
Field val
End Type
p.PortVal = New PortVal
;Read a 1 byte value from the specified port and place in variable DWORD.
GetPortVal($379, p, 4)
DebugLog p\val

;Print variable p
Print p

Until KeyDown(1)

;Removes the WinIo driver.
RemoveWinIoDriver()

;Shutsdown the WinIo library.
;ShutdownWinIo()

End