I am developing a realmode operating system in x86 assembly. I managed to move cursor with keyboard, but I want to move the cursor with mouse. I don't know how. I found int 33h deals with the mouse, but I can't seem to move the cursor using int 33h.
Asked
Active
Viewed 663 times
-1
-
4Writing an OS is a complec undertaking. Nothing is easy when DOS isn't loaded.Int 33h doesn't exist, but Int 15h has some useful features on BIOSes that support IBM PS/1 and PS/2 BIOS extensions (most machines these days do, but isn't always the case). To show the complexities of dealing with the mouse just in a text mode (80x25) you may find this small project of interest: http://www.capp-sysware.com/misc/stackoverflow/54042732/ – Michael Petch Jan 05 '19 at 05:37
-
2That code is a simple polling mouse driver that displays a test pattern, allows you to move the mouse cursor around and responds to left and right mouse button (the current version doesn't support 3 buttons, a mouse wheel etc). The test pattern exists to show what happens when the mouse cursor moves over top of different foreground and background colors. A real mosue driver would handle all the standard text modes, would handle graphics modes etc. This version for simplicity is designed for 80x25 text mode. – Michael Petch Jan 05 '19 at 05:39
1 Answers
5
Interrupts int 10h
to int 1Fh
are BIOS interrupts; they can be used before the OS is booted.
Interrupts int 20h
to int 2Fh
are DOS interrupts; they can only be used when DOS has already been loaded.
Other interrupts (e.g. int 33h
) are interrupts used by device drivers; int 33h
can only be used when a DOS mouse driver is loaded.
When you want to access the mouse when there is no mouse driver installed (e.g. in your own boot loader), you'll directly have to access the hardware.
See the following articles in OSDEV:
https://wiki.osdev.org/%228042%22_PS/2_Controller
https://wiki.osdev.org/PS/2_Mouse

Martin Rosenau
- 17,897
- 3
- 19
- 38
-
6He's writing a real mode OS (I've answered other questions related to this for him). I should note that any BIOS that conforms to the IBM PS/2 BIOS (many, but not all BIOSes support it) have a feature to help develop a mouse driver.**ff** available, BIOS interrupts [Int 15h/AX=0C200h to Int 15h/AX=0C209h](http://www.ctyme.com/intr/int-15.htm) put a wrapper around the direct hardware access, allow a mouse handler hook etc.The interrupt handler that gets installed will build the mouse packets for you. It can be a useful starting point to create a driver(if available) – Michael Petch Jan 04 '19 at 19:53