|
-
Apr 16th, 2001, 10:49 PM
#1
Thread Starter
Junior Member
Hi all,
I want to call BIOS Interrupt routine from VB
how can I use API to do that ?
I use Windows 2000 and VB 6.
-
Apr 18th, 2001, 03:11 PM
#2
Guru
You will have to use ASM code to do that.
The code is:
Code:
int <interrupt number>
ret
You can use a CallWindowProc trick to do this in VB.
This passes 4 parameters to the function as well, so the 'ret' instruction has to be changed to fix the stack alignment thingie: 
Code:
int <interrupt number>
ret 0010
And in VB:
Code:
Option Explicit
Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Sub Main()
Dim ASMCode(0 To 4) As Byte
' int <interrupt number> = CD <interrupt number>
ASMCode(0) = &HCD
ASMCode(1) = &H3 ' Testing: Interrupt 3h (debug break)
' ret 0010 = C2 10 00
ASMCode(2) = &HC2
ASMCode(3) = &H8
ASMCode(4) = &H0
Call CallWindowProc(VarPtr(ASMCode(0)), 0, 0, 0, 0)
End Sub
This will call interrupt 3h. You can change ASMCode(1) to the interrupt number you need.
-
Apr 18th, 2001, 11:07 PM
#3
Thread Starter
Junior Member
Thank's Yonatan.
Some Interrupt have sub function dan return value
ie. calling int 1AH, function 0 (read clock)
returns cx= high word count
dx= low word count
al=0
what is the code ?
-
Apr 19th, 2001, 06:34 AM
#4
Guru
That specific interrupt might work in DOS (16-bit), but definitely not in a Windows program... 
Interrupts are very rarely used in Win32 programs, not to mention VB programs.
In DOS, you can use this code:
Code:
xor ax, ax
int 1Ah
push cx
push dx
call SomeFunctionWhichDealsWithCxAndDx
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|