Well I think that the last obstacle to using FB has been eliminated,Hooking Interupts.
After hours of googling , reading and a little help from my fellow 16bit Dos programmers at, www.masmforum.com (thank you gustav) the following code works very nicely on a Dos box.
Code: Select all
common shared dssave,OldHandler&,TickCount&
Call HookInt
IF TickCount& > 0 THEN
'do your error handling
END IF
Do
'do whatever
Print TickCount&
Loop
SUB HookInt
asm
mov dssave,ds
mov ax,&H0204
mov bx,&H1c
int &h31 'get addr of current Handler
mov OldHandler+0,edx 'and save it as OldHandler
mov OldHandler+4,cx
'--------------------
mov ax,&H0205 'assign an extra
mov bx,&H1c 'handler
mov cx,cs
mov edx, offset SaveTick 'offset of label where we
int &H31 'want the int to go to every 1/18s.
jnc HookExit 'if no error jump to exit
mov TickCount,eax 'otherwise use it as err store.
jmp HookExit 'then get out by jumping over int routine.
'--------------------
SaveTick:
push eax 'save all registers which are modified!
push ds
mov ds, cs:[dssave] 'set it to segment of our variable.
mov eax,TickCount 'get last TickCount
inc eax 'inc by one
mov TickCount,eax 'and save it again.
pop ds 'restore ds of other handler.
pop eax
iretD 'and return to it.
HookExit:
end asm
END SUB
After I have done more testing, I will use it as an example for others.
For example I want to know the speed difference to Qb.
Regards