DOS Timer Interrupt, serial Interrupt

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

DOS Timer Interrupt, serial Interrupt

Rainer Stratmann
Hello,

is there a document or sample code for accessing the timer interrupt and the
serial interrupt in DOS mode.

Rainer


This does not work:

program time;

uses crt,dos;

var timervar:longint;

procedure hardtime; interrupt;
begin
 inc(timervar);
end;

var htimeivecbak : pointer;  // Interrupt Vector
const int_vectime = $1c;

procedure starttim;
begin
 timervar:=0;
 getintvec(int_vectime,htimeivecbak);
 setintvec(int_vectime,@hardtime);
end;

procedure stoptim;
begin
 setintvec(int_vectime,htimeivecbak);
end;

begin
 starttim;
 repeat
  writeln(timervar);
 until keypressed;
 readkey;
 stoptim;
end.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: DOS Timer Interrupt, serial Interrupt

Andreas Berger
Rainer Stratmann wrote:
Hello,

is there a document or sample code for accessing the timer interrupt and the 
serial interrupt in DOS mode.

Rainer

  
I found that getintvec and setintvec do not work. Use get_pm_interrupt and set_pm_interrupt instead.

Andreas


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: DOS Timer Interrupt, serial Interrupt

Alexey Pavluchenko
In reply to this post by Rainer Stratmann
Hello Rainer,

Wednesday, August 09, 2006, 1:19:52 PM, you wrote:

RS> is there a document or sample code for accessing the timer interrupt and the
RS> serial interrupt in DOS mode.

RS> This does not work:
[skip]

You should use get_pm_interrupt and set_pm_interrupt from GO32 unit
instead of DOS unit procedures. At least it was so in FPC 1.x, I
didn't try to compile anything for DOS with 2.x.

--
Best regards,
 Alexey


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: DOS Timer Interrupt, serial Interrupt

Rainer Stratmann
Hello Alexey,

the program is changed now, but is has the same effect.
May be it has to do with the special role of the timer interrupt.

Best regards
Rainer

program time;

uses crt,dos,go32;

var timervar:longint;

procedure hardtime; interrupt;
begin
 inc(timervar);
end;

var
 htimeivecbak : tseginfo;  // old Interrupt Vector
 htimeivec    : tseginfo;  // new Interrupt Vector
const int_vectime = $1c;

procedure starttim;
begin
 get_pm_interrupt(int_vectime,htimeivecbak);
 htimeivec.offset:=@hardtime;
 htimeivec.segment:=get_ds;
 set_pm_interrupt(int_vectime,htimeivec);
end;

procedure stoptim;
begin
 set_pm_interrupt(int_vectime,htimeivecbak);
end;

begin
 timervar:=0;
 starttim;
 repeat
  writeln(timervar);
 until keypressed;
 readkey;
 stoptim;
end.


Am Mittwoch, 9. August 2006 13:35 schrieb Alexey Pavluchenko:

> Hello Rainer,
>
> Wednesday, August 09, 2006, 1:19:52 PM, you wrote:
>
> RS> is there a document or sample code for accessing the timer interrupt
> and the RS> serial interrupt in DOS mode.
>
> RS> This does not work:
> [skip]
>
> You should use get_pm_interrupt and set_pm_interrupt from GO32 unit
> instead of DOS unit procedures. At least it was so in FPC 1.x, I
> didn't try to compile anything for DOS with 2.x.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re[2]: DOS Timer Interrupt, serial Interrupt

Alexey Pavluchenko
Hello Rainer,

Wednesday, August 09, 2006, 7:07:13 PM, you wrote:

RS> Hello Alexey,

RS> the program is changed now, but is has the same effect.
RS> May be it has to do with the special role of the timer interrupt.

There is nothing really special about it. Int 1Ch is not even a
hardware interrupt.

RS> Best regards
RS> Rainer

RS> program time;

RS> uses crt,dos,go32;

RS> var timervar:longint;

RS> procedure hardtime; interrupt;
RS> begin
RS>  inc(timervar);
RS> end;

RS> var
RS>  htimeivecbak : tseginfo;  // old Interrupt Vector
RS>  htimeivec    : tseginfo;  // new Interrupt Vector
RS> const int_vectime = $1c;

RS> procedure starttim;
RS> begin
RS>  get_pm_interrupt(int_vectime,htimeivecbak);
RS>  htimeivec.offset:=@hardtime;
RS>  htimeivec.segment:=get_ds;

This one should be get_cs, not get_ds. The procedure code must be
executed from the code segment, not from the data segment. While
physically the segments do overlap, selector values and access rights
are different.

--
Best regards,
 Alexey


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: DOS Timer Interrupt, serial Interrupt

Rainer Stratmann
Hello Alexey,

yes, it should be get_cs, I wonder why it not crashes with ds.
Now it counts, but slowly, when running out of win98.
When running in 'pure' DOS mode (when ending windows) it has also no effect.
The timer interrupt normally counts 18.2 times per second.
???

Best regards
Rainer

Am Mittwoch, 9. August 2006 18:36 schrieb Alexey Pavluchenko:

> Hello Rainer,
>
> Wednesday, August 09, 2006, 7:07:13 PM, you wrote:
>
> RS> Hello Alexey,
>
> RS> the program is changed now, but is has the same effect.
> RS> May be it has to do with the special role of the timer interrupt.
>
> There is nothing really special about it. Int 1Ch is not even a
> hardware interrupt.
>
> RS> Best regards
> RS> Rainer
>
> RS> program time;
>
> RS> uses crt,dos,go32;
>
> RS> var timervar:longint;
>
> RS> procedure hardtime; interrupt;
> RS> begin
> RS>  inc(timervar);
> RS> end;
>
> RS> var
> RS>  htimeivecbak : tseginfo;  // old Interrupt Vector
> RS>  htimeivec    : tseginfo;  // new Interrupt Vector
> RS> const int_vectime = $1c;
>
> RS> procedure starttim;
> RS> begin
> RS>  get_pm_interrupt(int_vectime,htimeivecbak);
> RS>  htimeivec.offset:=@hardtime;
> RS>  htimeivec.segment:=get_ds;
>
> This one should be get_cs, not get_ds. The procedure code must be
> executed from the code segment, not from the data segment. While
> physically the segments do overlap, selector values and access rights
> are different.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: DOS Timer Interrupt, serial Interrupt

Lubomír Čabla
In reply to this post by Rainer Stratmann
Hello,
 
solution you can find in file "c:\pp\source\docs\go32ex\intpm.pas".

Best regards
 
--
Lubomir Cabla/CBL
Web page : http://www.hdat2.com/
Web forum: http://www.getphpbb.com/phpbb/index.php?mforum=lcabla

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

intpm.pas (2K) Download Attachment