Code: Select all
;*****************************************
;* *
;* File: memory_access.pb *
;* *
;* Author: teachco *
;* *
;* Used: WinIO from Yariv Kaplan *
;* [url]http://www.internals.com[/url] *
;* and wrapper-lib (Danilo) *
;* *
;* Successful tested under Windows 2ooo *
;* *
;*****************************************
OpenConsole()
; Initialize WinIO to have access to the memory
If InitializeWinIo()
; ****** Writing to the memory ******
; Load $40 into the variable PAdr1
PAdr1 = $40
; With *PAdr1 we interprete $40 as a physical address in the memory
; 9867 is the value (DWORD in decimal), we write to the memory address $40
SetPhysLong(*PAdr1,9867)
; ****** Reading from the memory ******
; Same address in another variable (but doesn't matter)
PAdr2 = $40
; In the second parameter we need a physical memory location
; for the value we want to read. Therefore we use the address oprerator @.
GetPhysLong(*PAdr2,@DWValue)
; Now it's simple. We read the value from the variable,
; we addressed one step above
PrintN(Str(DWValue))
Else
PrintN("WinIO initialization failed (**** happens !)")
EndIf
; To keep the console window open, ...
Input()
[/code)