TOP
Module 1 Bas
Attribute VB_Name = "mod_main"
'the ReadX and ReadY function is used to read the data that is being
'sent to the parallel port by the screen. the details of this function
'are discussed in the parallel port interface documentation by Alexis Artes
'the main subroutine is the initial code to be executed at the start of the
'program. it simply loads all the forms and sets the menu form and enter form
'to be initially visible while the others are hidden
'the delayer subroutine is used to make a delay between changing floors so that
'the change between floors would not be abrupt
Private Declare Sub Anjan Lib "vbio.dll" ()
Private Declare Function Inp Lib "vbio.dll" (ByVal portaddr&) As Integer
Private Declare Sub Out Lib "vbio.dll" (ByVal port&, ByVal byt%)
Private Declare Function Peek Lib "vbio.dll" (ByVal memaddr&) As Integer
Private Declare Sub Enable Lib "vbio.dll" ()
Private Declare Sub Disable Lib "vbio.dll" ()
Private Declare Sub delay Lib "vbio.dll" Alias "Delay" (ByVal count&)
Private Declare Sub AboutVBIO Lib "vbio.dll" ()
Function ReadX() As Integer
Anjan
Out &H37A, &HE0
register = Inp(&H378)
xregister = 0
If register And 2 ^ 6 Then
For i = 0 To 2
If register And 2 ^ i Then
xregister = xregister + 2 ^ i
End If
Next i
End If
If register And 2 ^ 7 Then
xregister = xregister + 1
For i = 3 To 5
If register And 2 ^ (i - 3) Then
xregister = xregister + 2 ^ (i - 3)
End If
Next i
End If
ReadX% = xregister
End Function
Function ReadY() As Integer
Anjan
Out &H37A, &HE1
register = Inp(&H378)
yregister = 0
If register And 2 ^ 6 Then
For i = 0 To 2
If register And 2 ^ i Then
yregister = yregister + 2 ^ i
End If
Next i
End If
If register And 2 ^ 7 Then
yregister = yregister + 1
For i = 3 To 5
If register And 2 ^ (i - 3) Then
yregister = yregister + 2 ^ (i - 3)
End If
Next i
End If
ReadY% = yregister
End Function
Public Sub main()
frm_Menu.Enabled = True
frm_Menu.Show
frm_enter.Enabled = True
frm_1stfloor.Enabled = True
frm_2ndFloor.Enabled = True
frm_3rdFloor.Enabled = True
frm_enter.Show
End Sub
Public Sub delayer()
Dim varbefore, varafter, vardelay As Variant
Dim delayloop As Boolean
vardelay = 0.1
varbefore = Timer
delayloop = True
While delayloop
varafter = Timer
If vardelay <= (varafter - varbefore) Then
delayloop = False
End If
Wend
End Sub
|