Hello from Germany
It would be very nice if someone could help me.
Excude me for this terribel english. I will do my very best.
I found a code snippet on the net where the guy
called "Mark Junker" programms a multitasking add
on for Power Basic DOS. I found it very interesting
and tried to modify it. So, pricipil it works fine
but the problem is that you must start the programm
more then one time.
First time the User Event never happens.
When you stop the programm and restart it again then
it works. After that you can stop and start how much
you like. It never fails.
After new rebooting (cold or warm) the problem is back.
Too fix this problem i have removed all "Mutitasking"
Programm Lines and all unnessary parts.
Now there are a few lines left . Only the Uvent Hook
is nearly the same. And it looks now much like many
Uvent Code, Tips and Tricks i found here on your great BBS.
Now i will explain what the programm shood do.
I must hook on the RealTimeClock Period Interupt.
By the way. When i change this Hook to Timer Int &H1C
it works...............
But Sorry, i need this special RTC Interupt &H70
Because this Hardware Interupt is controlled via PIC2
(Interupt Controller 2) i think i had send zwo EOI
Command. First to the Slave then to the Master PIC.
But that is the problem. I don't know where and how.
I have tried many. I cannot find special information
in the Power Basic Doku or the net. Most examples only
explain how to hook on software interupts (which works)
not on hardware interupts. (And when hardware int's then
only via PIC1 Interuptcontroller 1)
Does anyone has an idea whats going wrong or how Power Basic
handles EOI's in IRS Service Routines.
I attach the code which i have compiled with PB 3.2 and 3.5.
Tested on W98 (DosBox), DOS6.2, Caldera DOS,W95 Command Line
Always the same result.
I think that somethings going wrong with the PIC Controller.
Perharps the Interupt is Requested but when no EOI Commando
returns because i shortly disabled INT8 while installing the
hook the SetUvent Procedur is never called.
Can Anyone please help
Best Regards
Rainer
It would be very nice if someone could help me.
Excude me for this terribel english. I will do my very best.
I found a code snippet on the net where the guy
called "Mark Junker" programms a multitasking add
on for Power Basic DOS. I found it very interesting
and tried to modify it. So, pricipil it works fine
but the problem is that you must start the programm
more then one time.
First time the User Event never happens.
When you stop the programm and restart it again then
it works. After that you can stop and start how much
you like. It never fails.
After new rebooting (cold or warm) the problem is back.
Too fix this problem i have removed all "Mutitasking"
Programm Lines and all unnessary parts.
Now there are a few lines left . Only the Uvent Hook
is nearly the same. And it looks now much like many
Uvent Code, Tips and Tricks i found here on your great BBS.
Now i will explain what the programm shood do.
I must hook on the RealTimeClock Period Interupt.
By the way. When i change this Hook to Timer Int &H1C
it works...............
But Sorry, i need this special RTC Interupt &H70
Because this Hardware Interupt is controlled via PIC2
(Interupt Controller 2) i think i had send zwo EOI
Command. First to the Slave then to the Master PIC.
But that is the problem. I don't know where and how.
I have tried many. I cannot find special information
in the Power Basic Doku or the net. Most examples only
explain how to hook on software interupts (which works)
not on hardware interupts. (And when hardware int's then
only via PIC1 Interuptcontroller 1)
Does anyone has an idea whats going wrong or how Power Basic
handles EOI's in IRS Service Routines.
I attach the code which i have compiled with PB 3.2 and 3.5.
Tested on W98 (DosBox), DOS6.2, Caldera DOS,W95 Command Line
Always the same result.
I think that somethings going wrong with the PIC Controller.
Perharps the Interupt is Requested but when no EOI Commando
returns because i shortly disabled INT8 while installing the
hook the SetUvent Procedur is never called.
Can Anyone please help
Best Regards
Rainer
Code:
############################################################### $LIB ALL OFF ' Alles übrflüssige weg $LIB COM ON ' Com Unterstützung linken $STRING 32 declare sub SetUEvent () ' SetUEvent' verfuegbar machen %INT_HOOK = &H70 'Real Time Clock %IMR1=33 ' $H21 IMR (Interupt Mask Register von Controller 1) %IMR2=161 ' $HA1 IMR (Interupt Mask Register von Controller 2) DIM IRQ8HandlerPTR AS SHARED DWORD PTR DIM OldStatRegB AS SHARED BYTE ' CMOS Register merken DIM OldPic2Value AS SHARED BYTE ' Interupt Controller 2 '*************************************************************************** on uevent gosub TaskHandler ' Basic-Part des INT-Handlers aktivieren on error goto TaskerStop ' Bei Fehlern Programm SOFORT beenden exit far at TaskerStop ' Bei kritischen Fehlern bei TASK.CREATE ' wird EXIT FAR ausgefuehrt (SOFORT ENDE) Set_CMOS_Register ' Handler installierund und RTC ' aktivieren UEVENT ON $EVENT ON cls do call Test1 loop until inkey$ = chr$(27) 'ESC $EVENT OFF TaskerStop: Reset_CMOS_Register 'Handler deinstallieren und RTC auf Default end '*************************************************************************** $event off IRQ8Handler: ! PUSH AX ! PUSH BX ! PUSH CX ! PUSH DX ! PUSH SI ! PUSH DI ! PUSH BP ! PUSH DS ! PUSH ES ! CALL far ptr SetUEvent ' ! MOV DX,&HA0 ' For Test Purposes ' ! MOV AX,&H20 ' ! OUT DX,AX ' EOI Slave ' ! MOV DX,AX ' Adress is &h20 too ' ! OUT DX,AX ' EOI Master ! POP ES ! POP DS ! POP BP ! POP DI ! POP SI ! POP DX ! POP CX ! POP BX ! POP AX ! jmp dword ptr OldIRQ8Handler ; Alten IRQ8-Handler aufrufen OldIRQ8Handler: ! dd 0 ; New Pointer ! dd 0 ; Patched here ! dd 255 ! dd 255 $event on '*************************************************************************** $event off TaskHandler: locate 12,1 incr ticker??? print ticker??? return $event on '*************************************************************************** sub Test1 'Dummy SUB static x??? $event off locate 10,1 print "This counter runs ";;x???; $event on incr x??? end sub '*************************************************************************** SUB Set_CMOS_Register $event off ! cli out &H70,11 OldStatRegB = inp(&H71) ' Alten C-MOS-Wert (f. INTs) merken out &H70,11 out &H71,OldStatRegB and 7 ' Alle RTC-Ints abschalten DISABLEHARDINT 8 IRQ8HandlerPtr = codeptr32(OldIRQ8Handler) ' Adresse f. alten Handler @IRQ8HandlerPTR = GetInteruptVektor(%INT_HOOK) SetInteruptVektor %INT_HOOK, codeptr32(IRQ8Handler) out &H70,10 OldStageDiv?=inp(&H71) and &HF0 out &H70,10 out &H71,OldStageDiv? or &B1010 ' Interrupt-Speed=15,258*2^Wert Mikrosek. ' Je langsamer, desto sicherer ... ' ... unter WIN u. a. Multitaskern ' &B1010 out &H70,11 out &H71,OldStatRegB or 64 ' periodischen RTC-Interrupt anschalten ENABLEHARDINT 8 ! sti END SUB '*************************************************************************** SUB Reset_CMOS_Register $event off ' UEvent verbieten ! cli ; Interrupts verbieten out &Ha1,OldPIC2Value : ' Alte IRQ-Maske fuer PIC 2 out &H70,11 : ' Interrupts so an- od. ausstellen, wie vorher out &H71,OldStatRegB out &H70,10 OldStageDiv?=inp(&H71) and &HF0 out &H70,10 out &H71,OldStageDiv? or &B0110 : ' Standard RTC-Interrupt-Speed DISABLEHARDINT 8 SetInteruptVektor %INT_HOOK,@IRQ8HandlerPTR ENABLEHARDINT 8 ! sti ; Interrupts wieder zulassen if err>0 then print "ERROR: ",pbvErr,eradr : ' Wenn Abbruch durch Fehler, dann ... end if END SUB '*************************************************************************** Sub SetInteruptVektor (Byval Interupt As Integer,Zeiger As Dword) DIM Segment AS Local Word DIM Offset AS Local Word Segment = PointSeg (Zeiger) Offset= PointOff (Zeiger) ! Push DS ! Push DX ! MOV AH,&H25 ! MOV AL,Interupt ! MOV DS,Segment ! Mov DX,Offset ! INT &H21 ! Pop DX ! Pop DS End Sub '*************************************************************************** Function GetInteruptVektor (BYVAL NU AS INTEGER) AS DWORD DIM TEMP AS LOCAL DWORD ! MOV AH,&H35 ! MOV AL,NU ! INT &H21 ! MOV TEMP[2],ES ! MOV TEMP[0],BX GetInteruptVektor=Temp End Function '*************************************************************************** Function PointSeg (Adresse AS DWORD) AS WORD PointSeg=Adresse \ 65536 End Function '**************************************************************************** Function Pointoff (Adresse AS DWORD) AS WORD PointOff=Adresse MOD 65536 End Function '**************************************************************************** Sub EnableHardInt (IntNr%) DIM IrqMaske AS Byte Nr%=IntNr% IF Nr% >7 Then DECR Nr%,8 MaskPort%=%IMR2 ELSE MaskPort%=%IMR1 END IF irqMaske=255 BIT RESET irqMaske,NR% irqMaske=INP(MaskPort%) AND irqMASKE ! CLI OUT MaskPort%,irqMASKE ! STI END Sub '*************************************************************************** Sub DisableHardInt (IntNr%) Nr%=IntNr% IF Nr% >7 Then DECR Nr%,8 MaskPort%=%IMR2 ELSE MaskPort%=%IMR1 END IF irqMaske%=0 BIT SET irqMaske%,NR% ! CLI OUT MaskPort%,INP(MaskPort%) OR irqMASKE% ! STI End Sub '*************************************************************************** ------------------
Comment