Scrolling terminal in software-emulated text mode
Scrolling terminal in software-emulated text mode
So I wrote a terminal driver that can work in UEFI, by using an LFB and using bitmap text fonts.
Some of the terminal functions I did not update as I was clueless as how to.
In real text mode, you have a simple text buffer. Easily, all you have to do to scroll this buffer is shift this buffer to the left VGA_WIDTH times.
In my software-emulated text mode, you have a pixel LFB.
There is no text buffered anywhere, just pixels.
So how would I scroll this terminal?
Some of the terminal functions I did not update as I was clueless as how to.
In real text mode, you have a simple text buffer. Easily, all you have to do to scroll this buffer is shift this buffer to the left VGA_WIDTH times.
In my software-emulated text mode, you have a pixel LFB.
There is no text buffered anywhere, just pixels.
So how would I scroll this terminal?
Skylight: https://github.com/austanss/skylight
I make stupid mistakes and my vision is terrible. Not a good combination.
NOTE: Never respond to my posts with "it's too hard".
I make stupid mistakes and my vision is terrible. Not a good combination.
NOTE: Never respond to my posts with "it's too hard".
-
- Member
- Posts: 5568
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Scrolling terminal in software-emulated text mode
The same way, just individual pixels instead of whole characters.
Re: Scrolling terminal in software-emulated text mode
You should still have a text buffer, and just draw to the screen the same way. I’ve looked at your code and you don’t have a text buffer.rizxt wrote:So I wrote a terminal driver that can work in UEFI, by using an LFB and using bitmap text fonts.
Some of the terminal functions I did not update as I was clueless as how to.
In real text mode, you have a simple text buffer. Easily, all you have to do to scroll this buffer is shift this buffer to the left VGA_WIDTH times.
In my software-emulated text mode, you have a pixel LFB.
There is no text buffered anywhere, just pixels.
So how would I scroll this terminal?
CuriOS: A single address space GUI based operating system built upon a fairly pure Microkernel/Nanokernel. Download latest bootable x86 Disk Image: https://github.com/h5n1xp/CuriOS/blob/main/disk.img.zip
Discord:https://discord.gg/zn2vV2Su
Discord:https://discord.gg/zn2vV2Su
-
- Member
- Posts: 5568
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Scrolling terminal in software-emulated text mode
A text buffer is unnecessary for scrolling (although it can make it easier, and it can be useful in other ways).
Re: Scrolling terminal in software-emulated text mode
I'm reluctant to create a text buffer as the text buffer would need to be dynamically sized, and it would be a bit difficult to find a place to put it. It's not MMIO, like the real text mode, but actual physical RAM. If a person has a very large monitor but has minimal RAM, then an issue can arise.
Skylight: https://github.com/austanss/skylight
I make stupid mistakes and my vision is terrible. Not a good combination.
NOTE: Never respond to my posts with "it's too hard".
I make stupid mistakes and my vision is terrible. Not a good combination.
NOTE: Never respond to my posts with "it's too hard".
Re: Scrolling terminal in software-emulated text mode
If you look at the console I implemented in my OS, when you resize the window it uses a text buffer to redraw the window contents. It is very pleasing.Octocontrabass wrote:A text buffer is unnecessary for scrolling (although it can make it easier, and it can be useful in other ways).
Scrolling pixels without a blitter is just painful
CuriOS: A single address space GUI based operating system built upon a fairly pure Microkernel/Nanokernel. Download latest bootable x86 Disk Image: https://github.com/h5n1xp/CuriOS/blob/main/disk.img.zip
Discord:https://discord.gg/zn2vV2Su
Discord:https://discord.gg/zn2vV2Su
Re: Scrolling terminal in software-emulated text mode
Thank god for C, I would hate to write this in assembly:
Code: Select all
for (uint64_t i = 0; i < 4 * (gop.x_resolution * gop.y_resolution); i+=4)
{
*((uint32_t *)i) = (*(uint32_t *)(i + 4 * (gop.x_resolution * 25)));
}
Skylight: https://github.com/austanss/skylight
I make stupid mistakes and my vision is terrible. Not a good combination.
NOTE: Never respond to my posts with "it's too hard".
I make stupid mistakes and my vision is terrible. Not a good combination.
NOTE: Never respond to my posts with "it's too hard".
Re: Scrolling terminal in software-emulated text mode
The largest your buffer just needs to be is one screen of text, no dynamic sizing, just allocate it using your normal memory allocator... it probably won’t be more than 16k at the largest resolution... that’s nothing.rizxt wrote:I'm reluctant to create a text buffer as the text buffer would need to be dynamically sized, and it would be a bit difficult to find a place to put it. It's not MMIO, like the real text mode, but actual physical RAM. If a person has a very large monitor but has minimal RAM, then an issue can arise.
-edit- I just checked my console, and the text buffer is 64kb when running on a 4K monitor! 64k is nothing.
Last edited by bloodline on Wed Dec 02, 2020 12:42 pm, edited 1 time in total.
CuriOS: A single address space GUI based operating system built upon a fairly pure Microkernel/Nanokernel. Download latest bootable x86 Disk Image: https://github.com/h5n1xp/CuriOS/blob/main/disk.img.zip
Discord:https://discord.gg/zn2vV2Su
Discord:https://discord.gg/zn2vV2Su
Re: Scrolling terminal in software-emulated text mode
I suppose I was overestimating.
However, one screen of text differs in size. The terminal is dynamically sized by this function:
However, one screen of text differs in size. The terminal is dynamically sized by this function:
Code: Select all
dimensions Terminal::get_optimal_size(dimensions screen_res) {
dimensions term_size;
term_size.w = (screen_res.w / 16);
term_size.h = (screen_res.h / 25);
return term_size;
}
Skylight: https://github.com/austanss/skylight
I make stupid mistakes and my vision is terrible. Not a good combination.
NOTE: Never respond to my posts with "it's too hard".
I make stupid mistakes and my vision is terrible. Not a good combination.
NOTE: Never respond to my posts with "it's too hard".
-
- Member
- Posts: 5568
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Scrolling terminal in software-emulated text mode
You can always add one later, once you have in-kernel memory allocation working properly.rizxt wrote:I'm reluctant to create a text buffer as the text buffer would need to be dynamically sized, and it would be a bit difficult to find a place to put it.
That looks like a pretty good candidate to replace with a single call to memmove(), which you should have already written since it's required by your GCC cross-compiler.rizxt wrote:Thank god for C, I would hate to write this in assembly:
Re: Scrolling terminal in software-emulated text mode
It is? I haven't written it...
Skylight: https://github.com/austanss/skylight
I make stupid mistakes and my vision is terrible. Not a good combination.
NOTE: Never respond to my posts with "it's too hard".
I make stupid mistakes and my vision is terrible. Not a good combination.
NOTE: Never respond to my posts with "it's too hard".
Re: Scrolling terminal in software-emulated text mode
I calculated the maximum possible size of a terminal using today's display technology...
7680x4320 (8K)
7680 / 16 (font width) = 480
4320 / 25 (font height + one line of padding) = ~172
One byte for ASCII code
4 bytes for RGBA value
480 * 172 = 82560
82560 * (1 + 4) = 412800
412800 / 1024 = 403.125
403KiB maximum
7680x4320 (8K)
7680 / 16 (font width) = 480
4320 / 25 (font height + one line of padding) = ~172
One byte for ASCII code
4 bytes for RGBA value
480 * 172 = 82560
82560 * (1 + 4) = 412800
412800 / 1024 = 403.125
403KiB maximum
Skylight: https://github.com/austanss/skylight
I make stupid mistakes and my vision is terrible. Not a good combination.
NOTE: Never respond to my posts with "it's too hard".
I make stupid mistakes and my vision is terrible. Not a good combination.
NOTE: Never respond to my posts with "it's too hard".
Re: Scrolling terminal in software-emulated text mode
400kb is a drop in the ocean when the cheapest sbc you can buy comes with at least a gigabyte! Or is it too hard for you to implement?rizxt wrote:I calculated the maximum possible size of a terminal using today's display technology...
7680x4320 (8K)
7680 / 16 (font width) = 480
4320 / 25 (font height + one line of padding) = ~172
One byte for ASCII code
4 bytes for RGBA value
480 * 172 = 82560
82560 * (1 + 4) = 412800
412800 / 1024 = 403.125
403KiB maximum
CuriOS: A single address space GUI based operating system built upon a fairly pure Microkernel/Nanokernel. Download latest bootable x86 Disk Image: https://github.com/h5n1xp/CuriOS/blob/main/disk.img.zip
Discord:https://discord.gg/zn2vV2Su
Discord:https://discord.gg/zn2vV2Su
Re: Scrolling terminal in software-emulated text mode
I grossly overestimated, ok? I realize that's not that much ram.
However, this implementation I made dudn't work, however I can't figure out if the entries are being sent to memory or not because QEMU isn't dumping the memory correctly.
source: https://github.com/microNET-OS/microCOR ... operations
However, this implementation I made dudn't work, however I can't figure out if the entries are being sent to memory or not because QEMU isn't dumping the memory correctly.
source: https://github.com/microNET-OS/microCOR ... operations
Skylight: https://github.com/austanss/skylight
I make stupid mistakes and my vision is terrible. Not a good combination.
NOTE: Never respond to my posts with "it's too hard".
I make stupid mistakes and my vision is terrible. Not a good combination.
NOTE: Never respond to my posts with "it's too hard".
-
- Member
- Posts: 5568
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Scrolling terminal in software-emulated text mode
Do you ever call the code to put pixels into the frame buffer?
How are you dumping memory with QEMU?
How are you dumping memory with QEMU?