Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.asm.x86    |    Ahh, the lost art of x86 assembly    |    4,675 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 3,021 of 4,675    |
|    wolfgang kern to John    |
|    Re: programming on PS2 mouse controller    |
|    11 Oct 17 17:02:23    |
      From: nowhere@never.at              Kerr-Mudd,John wrote:       ...       >> good, programming question are always welcome here.              > Ok, What's the smallest mouse driver using only BIOS int 15 or       > "keyboard" in/out. I'm thinking back a year to when I made a small       > scrollbar menu; be nice to have mouse support for up/down/select.              I rare use a mouse in text mode.              some BIOS support also INT33.              I never fully used the INT15_C2, I only call it to make an USB-mouse       behave like a PS/2, so I can use my old setup and driver routines.              INT15_C2 may save you a lot, you just need to write the handler and       let the BIOS work its IRQ-routine as long you remain in RM16.              My mice nest (setup/structs/IRQs) measure 512 bytes, still including dual       serial mouse support and one PS/2 mouse. The draw-part is apart within       the event handlers. Mouse-rectangle arrays and many mouse images are also       elsewhere in memory.              You can use less than this of course ie: ignore the 3rd button and/or renounce       of button @ pos info.       My IRQ driver (same code for RM16 and PM16) incl.accelleration within       the routine, fits 256 byte (it's really old and could be shortened):              My mousebuffer: (was once only 32 byte for two button mice)       *altered by IRQ input:       00 b input count       01 b 1st       02 b 2nd       03 b 3rd       04 b 4th       05 b reserved       *former reserved, later merged in:       06 w signed Z-value       *set by screen mode change:       08 w ver limit       0a w hor limit       *calculated/updated (all POS in pixels):       0c w ver current pos       0e w hor current pos       *last pressed/released button at POS:       10 q hor+ver Lbut pressed       14 q R       18 q Lbut released       1c q R       *this eight bytes were added somehow later:       20 q Mbut pressed       24 q Mbut released              IRQ_0C: ;aka '12'       push ds       push myseg ;either RM or PM-equivalent       pop ds ;from here on common for both modes       pusha       in al,[60]       sti ;enable to not loose any other event       mov si,mymouse ;40 byte buffer       movzx bx,[si] ;got bytes count       or bx,bx       jnz L1 ;already got some       test al,08       jz L2 ;resync, it's not a 1st       L1:       inc bx       mov [bx+si],al ;1st...4th byte       cmp bl,04 ;got all four ?       jc L2 ;no? then wait for next       or [mousebits],80 ;set packet complete in global event flags       ...       position updates and button on/off locations were stored here       into my buffer, button state changes alter event flags too.       my main idle loop handles all events if/when it wants to do it.       ...       L2:       mov [si],bh ;make count 0       mov al,20 ;eoi       out al,[a0]       out al,[20]       popa       pop ds       iret       __       wolfgang              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca