-1

I am building an operating system in assembly. I know how to move the cursor through the CRT microcontroller (ports 0x3D4-0x3D5) but I don’t know how to change the size.

Also can I create a vertical cursor in text mode (like windows cursor)?

Any ideas?

Michael Petch
  • 46,082
  • 8
  • 107
  • 198
ARISTOS
  • 336
  • 3
  • 7

1 Answers1

1

No, in text mode you can't make hardware caret look like | and in general expect that much from bare metal with VGA, if you meant that under windows likelihood. You can only make it block-like. See this.

Optionally, you might also use BIOS services (int 0x10, function ah = 1, with ch holding start scanline and cl - end scanline) if not in PM, say on the very early stage just before jumping into PM.

rfx
  • 394
  • 1
  • 6
  • 16
  • 1
    Title of question says protected mode, so unless you are jumping in and out of protected mode to real mode (or use a VM8086 task) to deal with mouse using the BIOS - that suggestion won't work. In txt mode you can use whatever character you wish if you don't use a hardware cursor. It is up to your mouse driver in that case to place the cursor on the screen in whatever form you wish. – Michael Petch May 16 '17 at 19:18
  • AFAIR, coming out from usage of VGA IO ports, OP wants hw-cursor. Regarding BIOS you're right, but I assumed it might be needed on the very early stage when these services are usable. Anyway, edited the answer. Thanks for suggestion. – rfx May 16 '17 at 19:47
  • The upper and lower extents of the hardware cursor can be modified by outputting the desired values on the CRT's _Cursor Start Register_ port and _Cursor End Register_ port (per the link in your answer). When it comes to using the BIOS - usually the BIOS is convenient for querying all the supported video modes, and physically changing the video mode. – Michael Petch May 16 '17 at 20:35
  • Thanks, exactly what I was looking for. Can you post en example please beacouse I cannot understand exactly how to use, I have some problems. For example I don’t understand how I sould set the "Cursor Skew" bits "Cursor End Register" – ARISTOS May 17 '17 at 04:32
  • You can refer to [linux kernel](http://elixir.free-electrons.com/linux/latest/source/drivers/video/console/vgacon.c#L656) implementation. Starting from the line 667 theres code which first reads current caret size and then sets readjusted size at line 680. Hope this helps and gives you some idea how to set values. – rfx May 17 '17 at 09:27