Hardware Reference
In-Depth Information
out &H378, &H55 ' write 01010101 to data port
print "Using BASIC: port data = 01010101"
delay 2
return
'
' Demonstration of in-line assembler access to I/O ports
'
assem:
' read status byte
asm mov dx, &H379
asm in al, dx
asm mov status%, al
print "Using inline assembler: status byte = "; hex$(status%)
' write 10101010 to data port
asm mov al, &HAA
asm mov dx, &H378
asm out dx, al
print "Using inline assembler: port data = 10101010"
delay 2
' write 01010101 to data port
asm mov al, &H55
asm mov dx, &H378
asm out dx, al
print "Using inline assembler: port data = 01010101"
delay 2
return
'
' Reset all data port bits and shutdown
'
shutdown:
asm mov al, &H00
asm mov dx, &H378
asm out dx, al
print "Shutting down ..."
delay 2
cls
end
The output produced by the program is shown in Figure 6.7.
Figure 6.7 Output produced by the PowerBASIC 3.5 port read/write
demonstration program
Search WWH ::




Custom Search