delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/03/27/23:44:05

From: "Alexei A. Frounze" <alex DOT fru AT mtu-net DOT ru>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: keyboard interrupt
Date: Tue, 28 Mar 2000 03:05:33 +0400
Organization: MTU-Intel ISP
Lines: 81
Message-ID: <38DFE93D.342DB577@mtu-net.ru>
References: <8bod7h$rj1$1 AT gxsn DOT com> <38DFBCCB DOT 6A1BC333 AT mtu-net DOT ru> <38DFC431 DOT 8D19F7D6 AT corel DOT com>
NNTP-Posting-Host: ppp96-222.dialup.mtu-net.ru
Mime-Version: 1.0
X-Trace: gavrilo.mtu.ru 954198663 55282 212.188.96.222 (27 Mar 2000 23:11:03 GMT)
X-Complaints-To: usenet-abuse AT mtu DOT ru
NNTP-Posting-Date: 27 Mar 2000 23:11:03 GMT
X-Mailer: Mozilla 4.61 [en] (Win95; I)
X-Accept-Language: en,ru
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Simply look at mine:
----------------8<------------------
extern  ___djgpp_ds_alias
extern  _irq1_isr
GLOBAL  _IRQ1_ISR

[section .data]

o_ESP           dd      0
o_SS            dw      0

[section .bss]

stack_area      resb    4096
stack_top:

[section .text]
[bits 32]

_IRQ1_ISR:
        cli
        push    ds
        push    es
        push    fs
        push    gs
        pushad

        mov     ax, [cs:___djgpp_ds_alias]
        mov     ds, ax
        mov     es, ax
        mov     fs, ax
        mov     gs, ax

        mov     [o_ESP], esp
        mov     word [o_SS], ss

        mov     ss, ax
        mov     esp, stack_top

        cld
        call    _irq1_isr

        cli
        mov     ss, word [o_SS]
        mov     esp, [o_ESP]

        popad
        pop     gs
        pop     fs
        pop     es
        pop     ds
        iretd

----------------8<------------------
It saves all the registers, sets up segment registers, sets up own
stack, calls C handler, restores everything back.

CLI and CLD is put for more reliability.

Alexei A. Frounze
--
Homepage: http://alexfru.chat.ru
Mirror:   http://members.xoom.com/alexfru

Jonathan Meunier wrote:
> 
> Actually, you can (look my other post), but DJGPP doesn't allow
> reentrant interrupts.. Which means that you can either take over the
> interrupt, or just run code before the interrupt (after your code is
> done it automatically calls the BIOS one). It doesn't really matter for
> keyboard handler, unless you want to use stdio function (eg: getch())..
> Though, for timer interrupts, it's trivial to call the BIOS handler 18.2
> times per second.
> 
> My question is, where can I find information on those wrappers? Like,
> what they do, and what to put in them? As you can see from the other
> post, I use a _go32 function to make the wrapper for me, but in the case
> of timer interrupts, I read somewhere that I would need to make my own
> wrapper..


- Raw text -


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