call INTERRUPT
-
- Posts: 385
- Joined: Oct 16, 2005 0:15
- Location: USA
- Contact:
call INTERRUPT
What happened to the "call interrupt" that existed in qbasic?
-
- Posts: 385
- Joined: Oct 16, 2005 0:15
- Location: USA
- Contact:
No. Windows and Linux place limits on the amount of hardware access you have, so you can't just, say, stick a keyboard TSR on there.
Instead, you have dynamically loadable libraries and function pointers. Check out the "DyLibLoad" and "DyLibSymbol" functions. You can also "thread" functions so they run in the background and can poll events.
Instead, you have dynamically loadable libraries and function pointers. Check out the "DyLibLoad" and "DyLibSymbol" functions. You can also "thread" functions so they run in the background and can poll events.
-
- Posts: 385
- Joined: Oct 16, 2005 0:15
- Location: USA
- Contact:
-
- Posts: 545
- Joined: Nov 08, 2005 14:36
With the DOS32 version of FreeBASIC you can call interrupts using an interface that is very similar to that of the InterruptX routine for QuickBASIC. This is one of the examples from Version 0.13 Beta:
Within limits, these interrupt calls will work under Windows.
Code: Select all
''
'' simple DOS graphics example to demonstrate DOS-specific features
''
Option Explicit
#include "dos/dpmi.bi"
#include "dos/go32.bi"
#include "dos/sys/farptr.bi"
Dim regs As __dpmi_regs
Dim buffer(320 * 200 - 1) As UByte
Dim i As Integer
' set VGA mode 13h
' 320x200x8bpp
' chain4 (linear)
regs.x.ax = &H13
__dpmi_int(&H10, @regs)
Do While Len(InKey) = 0
__dpmi_yield
For i = @buffer(0) To @buffer(320 * 200 - 1)
Poke i, Int(Rnd * 256)
Next i
dosmemput @buffer(0), 320 * 200, &HA0000
Loop
' set a standard text mode
regs.x.ax = &H03
__dpmi_int(&H10, @regs)
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Interrupt services are exist on both win and lin many C calls from runtime libs are "only" stubs in the right service with argument and type checking.
for example the Linux C call open ends in int &80 service in FB inlineassembler looks like this.
But of course this has nothing to do with 16 bit DOS int's from qbasic.
and i sugest you use the FB runtime (it's the stubs to the C runtime lib) it is more save and compatbile.
Joshy
for example the Linux C call open ends in int &80 service in FB inlineassembler looks like this.
Code: Select all
function SYS_OPEN(byval device as string,byval flag as integer=0,byval mode as integer=0) as integer
asm
mov eax, _OPEN
mov ebx, [device]
mov ecx, [flag]
mov edx, [mode]
int &H80
mov [function],eax
end asm
end function
dim as integer hFile
hFile=open("myfile")
and i sugest you use the FB runtime (it's the stubs to the C runtime lib) it is more save and compatbile.
Joshy
For what little the information may be worth, there is a narrow range of interrupts, starting with interrupt 50h, than can, at least normally, be used from a Windows program running under Windows 98 SE (possibly all Windows 9x, but I tested only 98 SE). The call will not generate a fault, it will be passed down to the normal real mode handler, and an IRET will return control to the Windows program with whatever the handler left in the registers. This will not work for interrupts outside the range, and it will not work for any interrupt under NT/2000/XP.
-
- Posts: 775
- Joined: Jul 01, 2005 18:45