www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/10/09/18:55:15

Xref: news-dnh.mv.net comp.os.msdos.djgpp:2514
Newsgroups: comp.os.msdos.djgpp
Path: news-dnh.mv.net!mv!news.sprintlink.net!in2.uu.net!psinntp!psinntp!psinntp!psinntp!netrixgw.netrix.com!root
From: ld AT jasmine DOT netrix DOT com (Long Doan)
Subject: Re: Keyboard handler
Lines: 44
Sender: root AT netrix DOT com
Organization: Netrix Corporation
References: <458h8r$cek$1 AT mhafc DOT production DOT compuserve DOT com>
Date: Mon, 9 Oct 1995 15:16:27 GMT
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

In article <458h8r$cek$1 AT mhafc DOT production DOT compuserve DOT com> Owen <100607 DOT 3203 AT CompuServe DOT COM> writes:

> From: Owen <100607 DOT 3203 AT CompuServe DOT COM>
> Newsgroups: comp.os.msdos.djgpp
> Date: 8 Oct 1995 12:47:23 GMT
> Organization: CompuServe, Inc. (1-800-689-0736)
> 
> I am using V2 beta of DJGPP and trying to replace the default 
[snipped]
> int keys;
> void keyb_handler(void);
> void keyb_handler()
> { keys++; }
> main()
> {
[snipped]
> new_handler.offset32=(long)keyb_handler;
> new_handler.selector=_go32_my_ds();
> if (__dpmi_set_protected_mode_interrupt_vector(9,&new_handler)==0)
[snipped]

  You have two options:
  1. Allocate a wrapper for your ISR. This warpper will do the
necessary stuffs (save registers, setup %ds, swap stacks, locking, etc) that
your function does not (and needs to) do.
  2. Write your function in assembly or inline assembly. You'll have
to do some of the above stuff in the ISR, mainly:
     - Save some general registers.
     - Setup %ds to points to a descriptor that has base = cs's
descriptor base. This doesn't have to be done if the ISR doesn't
access any variable.
     - Swap stack (if necessary)
     - Cleanup properly and iret.
Also, you'll have to lock your code, data, and stack if you plan to do
without the wrapper.

Long.
-- 
==============================================================
Long Doan                                        ld AT netrix DOT com     
Netrix Corporation                         ldoan1 AT osf1 DOT gmu DOT edu
13595 Dulles Technology Drive                               
Herndon Va 22071
==============================================================

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019