📄 diskwriteread.bas
字号:
Dim bufferdata(100) As Integer
Dim diskdata(2048) As Integer
Dim sensedata(16) As Integer
Dim highblock As Long
Dim blocksize As Long
Dim count As Integer
Dim ha As Integer
Dim target As Integer
Dim lun As Integer
Dim retval As Integer
Dim i As Integer
Dim testloop As Integer
Dim results As String
Dim NL As String
NL = Chr(10)
' set the ha, target, & lun below to match yours
ha = 2
target = 0
lun = 0
startblock = 0
count = 4
For i = 0 To 64
bufferdata(i) = i
Next
' set the first 2k of buffer 0 to a pattern that increments from 0 to 64
' (this is the data put into bufferdata with the for loop above
'
retval = SCSIFillBuffer(0,2048,64,bufferdata)
' write 4 blocks of this data, starting at block 0
retval = SCSIDiskWrite(ha,target,lun,count,startblock,512,0)
If retval <> 0 Then
results = "Disk Write failed - Status = " & retval
retval = SCSIViewSense(sensedata)
results = results & NL & "Sense Key = " & Format(Hex(sensedata(2)), "@@")
results = results & NL & "Sense Code = " & Format(Hex(sensedata(12)),"@@")
results = results & NL & "ASQ = " & Format(Hex(sensedata(13)),"@@")
MsgBox results
Stop
End If
' read 4 blocks of data into buffer 1
retval = SCSIDiskRead(ha,target,lun,count,startblock,512,1)
If retval <> 0 Then
results = "Read command failed - Status = " & retval
retval = SCSIViewSense(sensedata)
results = results & NL & "Sense Key = " & Format(Hex(sensedata(2)), "@@")
results = results & NL & "Sense Code = " & Format(Hex(sensedata(12)),"@@")
results = results & NL & "ASQ = " & Format(Hex(sensedata(13)),"@@")
MsgBox results
Stop
End If
' move some data into the local buffer so we can print it
retval = SCSIGetBuffer(0,128,diskdata)
' print 70 bytes so you can see the 64 byte pattern
For i = 0 To 70
results = results & Format(Hex(diskdata(i)),"@@") & " "
Next
MsgBox results
MsgBox "Test Passed"
Stop
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -