Pregunta

I want to get the number entered by the user into a register. This is my own OS. So, I cannot use this:

mov al,0x01
int 0x21
mov dl,al ;move the integer entered by the user, into dl

since int 0x21 calles ms-dos. So what interuppt can I use?

¿Fue útil?

Solución 2

If you are running on a "regular" PC in real mode you can use int 0x10 for screen output, int 0x16 for keyboard input and int 0x13 (functions AH=2, 3, 8, 0x41, 0x42, 0x43) for disk access.

Most interrupts on a regular PC are documented quite well in "Ralph Brown's interrupt list" (search for that list in Google).

Otros consejos

Depends on what your OS provides. If it's your OS, you can use anything you write.

Possibilities include checking the keyboard controller or a serial port, depending on what input you want. If your OS runs in 8086 Real Mode, you can ask the BIOS for these, otherwise you need to do direct port I/O.

If you want to program the BIOS, check the RBIL. In fact, do check it, no matter what you do.

If you want to talk directly to the KBC (keyboard controller) or UART (serial port controller), I suggest looking at how other OSes do it and reading the docs on e.g. osdev.org and the OSdev Wiki.

If you’re in Real Mode, then you can call the BIOS to wait for a keypress and read it from the keyboard buffer:

MOV AH,00h
INT 16h

The ASCII code is in AL and the scancode in AH. But if you’re not in Real Mode, there is no keyboard buffer to begin with. A keyboard driver would get the data via direct port I/O to the keyboard controller from the KBC interrupt handler, then (and buffer by itself).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top