[LispM-Hackers] Interrupts work (mostly), and Yet Another Question

Nyef nyef@softhome.net
Sat Mar 9 19:11:01 2002


On Sat, 9 Mar 2002, John Morrison wrote:

> Hi;

Hello.

> (Hope this gets out -- first message from newly-configured sendmail
> implementation and I lack real DNS entries.)

No, it didn't get out. Sorry. ;-P

> The Bad News is that, when I push a key on the keyboard, I *do* get an
> interrupt (number 9 or 011), but I cannot generate another one on
> subsequent key presses, probably because I am not resetting the 8259
> PIC (or something like that).

Or not reading the keycode, which leaves the KB interrupt line high, and
it's edge triggered, so it won't ever go off again.

> However, this brings up the issue of how to reset the PIC, etc, and
> the larger issue of how to handle drivers in e3.  As I said earlier,
> I'd really like to do this kind of thing in Lisp (field an interrupt
> in Lisp, service it in Lisp, and move on).  I would hate to write a
> TON of code the other way (e.g., make the 8259 PIC and keyboard combo
> look just like the Explorer one by writing lots of code in C++).
> However, it is by far the most expedient thing to do now.
>
> Suggestions?

(defun %write-port-8 (address data)
    "Write 8-bit data value data to I/O port address."
    ; FIXME: Implement
    )

(defun interrupt-acknowledge (interrupt-level)
    "Acknowledge an interrupt on a PC/AT or better class machine."
    (if (> interrupt-level 7)
        (%write-port-8 #xa0 #x20))
    (%write-port-8 #x20 #x20))

I could go on for quite a while in this vein. Remapping the PICs to point
to CPU interrupts #x20 through #x2f instead of the poorly-chosen locations
they are by default is really simple, too... A primitive keyboard driver
shouldn't be too hard...

In short, provide a good set of I/O and memory access primitives and the
basic set of device drivers can be done quite easily. Depending on how
sneaky you want to get, we might even be able to handle most/all of the
processor exceptions from Lisp as well. That still leaves interfacing it
to the rest of the Explorer system code, but it beats writing all that
emulation code in C++, right?

> -jm

---------------------------
All programming can be viewed as an exercise.
---------------------------
Alastair Bridgewater
e-mail: nyef@softhome.net