Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

Text mode enhancements! #39

Merged
merged 3 commits into from Jun 10, 2016

Conversation

WilsonGiese
Copy link
Contributor

@WilsonGiese WilsonGiese commented Jun 7, 2016

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!

@steveklabnik
Copy link
Member

Interesting! 😄 👍

So, we also have an outb already: https://github.com/intermezzOS/kernel/blob/master/src/interrupts/src/lib.rs#L196-L199 This probably means that this is a good thing to extract to another crate...


CONSOLE_ROWS - 1
if current_line + 1 >= CONSOLE_ROWS {
self.scroll_up();
Copy link
Member

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 👍

@WilsonGiese
Copy link
Contributor Author

So, we also have an outb already: https://github.com/intermezzOS/kernel/blob/master/src/interrupts/src/lib.rs#L196-L199 This probably means that this is a good thing to extract to another crate...

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 common/src/lib or common/src/asm

outb(0x3D4, 0x0E);
outb(0x3D5, (position >> 8) as u8);
}
}
}
Copy link
Contributor Author

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

Copy link
Member

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.

@steveklabnik
Copy link
Member

So, I pulled this down and tried it, but I'm not actually seeing the cursor. Hm.

@steveklabnik
Copy link
Member

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 common/src/lib or common/src/asm

I'm thinking it might just be its own crate entirely. But.... http://gz.github.io/rust-x86/x86/io/fn.outb.html 😉

@WilsonGiese
Copy link
Contributor Author

WilsonGiese commented Jun 8, 2016

http://gz.github.io/rust-x86/x86/io/fn.outb.html

Oh, awesome! Looks good to me

@WilsonGiese
Copy link
Contributor Author

WilsonGiese commented Jun 8, 2016

So, I pulled this down and tried it, but I'm not actually seeing the cursor. Hm.

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.

@WilsonGiese
Copy link
Contributor Author

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.

@WilsonGiese
Copy link
Contributor Author

WilsonGiese commented Jun 8, 2016

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 0xE-0xF, and my linux box had the visibility flag set to false by default with the scanlines going from 0x0-0x0. I don't know much of anything about the VGA hardware (a little more now 👍 ), so there is probably more that should be done.

@steveklabnik steveklabnik merged commit 6cdbcb8 into intermezzOS:master Jun 10, 2016
@steveklabnik
Copy link
Member

Awesome. Works great here. 👍

@steveklabnik
Copy link
Member

Eventually, we can deduplicate outb and such, but for now, I'm not worrying about it too much. Thanks a ton for this 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants