Article View: comp.lang.modula2
Article #3442Re: Interrupt Handlers in Topspeed Modula 2 V1.17
From: Michel De Rosa
Date: Sat, 30 Mar 1996 22:15
Date: Sat, 30 Mar 1996 22:15
50 lines
2452 bytes
2452 bytes
Martin Harvey (mch24@harvey27.demon.co.uk) wrote: : : -- Hi, : : I'm trying to write an interrupt handler that intercepts the keyboard : interrupt. I've looked in the documentation that I have, and two : alternative approaches seem to appear: hmmm from the rest of the post, i gather you're trying to replace the BIOS call that passes information back to your program (INT 16H), and not the actual kbd handler (INT 9H, the one that interprets each key as their entered, and stores them in a buffer).. There's a big difference, one is a software interrupt, while the latter is a hardware interrupt.. And each one involves different steps, to implement... : VAR KbdInt [??:??] :ADDRESS; : (*seg ofs address for keyboard interrupt vector *) : OldInt:ADDRESS; Later you ask how to figure out the value of [??:??]... The first 1k of the x86 'real' mode memory map, is a list of interrupt addresses... each is 32-bits (seg+ofs) wide, i.e. 4bytes wide.. You therefore multiply the interrupt number by 4... for Int16H (22 Decimal), that's [0000:0058H] (or segment 0, offset 88decimal).. Like Mark Morgan Lloyd points out, tho... you'd usually use a DOS call instead (recommended for so called well-behaved programs).. Of course that won't work with the above declaration ( KbdInt [????:????] ...). : (*$J+,C FF*) (*Save all regs, and have IRET *) That line also 'partly' answers your question about setting up registers, for your return... I'm using TopSpeed v3.01, and the pragmas have changed, but i suspect you'd use a set of pragmas to define 'how/where' your results are returned.. : And lastly: which of the above is the most practical/workable?? I would : greatly appreciate a quick pointer in the right direction from someone : who has tried this before :-) For replacing Int16H i wouldn't use IOTRANSFER.. this is a completely different beast... It (iotransfer) would be more usefull for Int9H, tho.. Ciao! Michel De Rosa. aliath@nyongwa.montreal.qc.ca
Technical Details
Message-ID:
<Dp3pu6.72H@nyongwa.montreal.qc.ca>Path:
arc1-ca.pugleaf.net!mcrcim.mcgill.edu!nyongwa!aliathReferences:
<496207970wnr@harvey27.demon.co.uk>Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.modula2 Path: arc1-ca.pugleaf.net!mcrcim.mcgill.edu!nyongwa!aliath From: aliath@nyongwa.montreal.qc.ca (Michel De Rosa) Subject: Re: Interrupt Handlers in Topspeed Modula 2 V1.17 Message-ID: <Dp3pu6.72H@nyongwa.montreal.qc.ca> Organization: Radio Free Nyongwa, Montreal (Qc), Canada Date: Sat, 30 Mar 1996 22:15:41 GMT References: <496207970wnr@harvey27.demon.co.uk> X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]