Text mode enhancements! #39
Text mode enhancements! #39
Conversation
Interesting! 😄 👍 So, we also have an |
|
||
CONSOLE_ROWS - 1 | ||
if current_line + 1 >= CONSOLE_ROWS { | ||
self.scroll_up(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
much more readable this way 👍
Yeah! I was going to do so, but I wasn't really sure where to put it or what to call it. Was thinking maybe |
outb(0x3D4, 0x0E); | ||
outb(0x3D5, (position >> 8) as u8); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Want to change this too... Use self.position
instead of an arg and call it update_cursor()
or maybe move it out of Vga impl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is an interesting question.
So, I pulled this down and tried it, but I'm not actually seeing the cursor. Hm. |
I'm thinking it might just be its own crate entirely. But.... http://gz.github.io/rust-x86/x86/io/fn.outb.html 😉 |
Oh, awesome! Looks good to me |
Hm... weird. I did this last night on os x, but i don't think that should matter. Now I'm trying to remember if I ever saw the cursor on my linux box. It used to just sit around the 3rd or 4th row and idle. |
Okay, so this is interesting... The only reason I added the cursor code was because on my mac there would be this static blinking cursor that annoyed me, but I just hopped on my linux box and I don't see a cursor at all; not on master, nor for my branch. First thought is a qemu difference and they are on my machines (Linux is 2.2.0, os x is 2.4.0.1). Maybe a BIOS difference could cause the cursor to be disabled by default? I'll do a little digging. |
Okie dokie! So apparently QEMU sets up VGA registers differently for different machines, or versions (I don't know). Anyway, after looking at this very helpful document VGA Regs I was able to write an initialize function that setup the Cursor Start/End Register so that the cursor will work on both of my machines. Looks like the version on my mac had the cursor visibility flag set to true by default with the scanlines going from |
Awesome. Works great here. 👍 |
Eventually, we can deduplicate |
Work in progress:
Fixed scrolling a bit by allowing the scroll to happen if we're about to write to a position outside the buffer. Before it only scrolled on newlines. Also added a bit of code to update the cursors location!
As stated above this is a WIP, I was just messing around a bit but it works well enough! I just copied the
outb
asm function from the interrupts lib, so that's something that might need to change.Let me know what you guys think!