Page 1 of 1
Blinking cursor
Posted: Sun Oct 26, 2014 12:37 pm
by morgoth
Hello guys
Maybe this is a stupid question, but is there a way to have a blinking cursor in a 16 bit real mode bootloader?
I am using video mode 0x12, which is graphical, but I see that setting the cursor shape with INT 10h only works for text modes. I am writing stuff in teletype.
Thanks
Re: Blinking cursor
Posted: Sun Oct 26, 2014 12:43 pm
by Cjreek
Obiously if you're in graphics mode you have to draw your cursor yourself. Things blink when they alternate between beeing visible and not beeing visible
Re: Blinking cursor
Posted: Sun Oct 26, 2014 1:16 pm
by Combuster
For a VGA, the character height is exactly one pixel for graphics modes, and the cursor can ever be one character tall. Block cursors are impossible by virtue of the system, so the default cursor settings won't produce anything.
How a real VGA responds to trying to configure an 8x1 cursor in graphics mode, I don't know. It's not a scenario I have ever tried. It is most likely though that any attempt to do so will never show the result on emulated computers, and trying it using BIOS interrupts will most likely result in failure as well. The only proper way to test is to use the actual
registers on real hardware, which will eventually tell you if it was possible in the first place - which might not be the case.
So only try that if you're really adventurous.
You might just have to emulate the cursor you want in software. If you ever want to draw something more complicated such as a mousepointer, you won't get away without doing it this way. You might just want build it in software and save you some headaches later.
Re: Blinking cursor
Posted: Mon Oct 27, 2014 5:37 am
by freecrac
Hello,
for to emulate a block cursor in software i redirect the int 8 vector to an own ISR (default timer with 18,2 Hz) for to increase a reserved byte in the ram 7 times that i used as a flag, for to trigger the blinking with starting to invert the underlying character of the cursor position in the main routine, by drawing directly into the framebuffer. (The new ISR ends with a jump far to the old vector.)
But i like to use a higher SVGA resolution of 800x600 with 32 bits of colors (also for to show some true color pictures on the screen). Because for videomodes with 4 bits and 16 colors we need to have a port access for to set every single pixel and for all other videomodes with 15/16 and 24/32 bits of colors we do not need a port access and we only have to write the bytes of the color directly into the frambuffer.
And i like to get the 8x8 ASCII character from the character table of the int 1F-vector address, that we can get from the bios function AX=1130h, BH=0 (get Font Information) of the int 10h. And for each bit of the 8x8 character i draw 2x2=4 Pixel into the framebuffer for to get larger characters of 16x16 bits and for to get a virtual text screen of 48 columns and 35 rows. (Because i think the default characters of 8x8 and 16x8 for a higher resolutions of 800x600 and above is a little to undersized.)
For to switch into the SVGA resolution of 800x600x32 i used the VBE-BIOS of the current display device. One of the the first steps for a VBE2/3-bios is to get the modenumber from the modetable of the current used vbe bios and to check the mode specific data of each modenumber, if it provide the resolution and other properties that we want to use. More details of the VBE-bios can be found in the public and costfree document "vbe3.pdf" from vesa.org(need register/login).
Dirk