rust-osdev / vga Goto Github PK
View Code? Open in Web Editor NEWLibrary to program vga hardware.
License: Apache License 2.0
Library to program vga hardware.
License: Apache License 2.0
Hello,
I was trying to compile a file using vga as a dependance. However, it uses an out of date version of the x86_64 crate (v0.12.4 while v0.13.2 is available as of writing).
With the new nightly versions, the old x86_64 refuses to compile. I therefore suggest that the dependency for x86_64 is updated.
This crate is fairly new, so I thought I'd take the approach that spinning_top took and ask for feedback if anyone's interested. My main goal was to get something working so I'm sure there are plenty of improvements. If anyone has some spare time to give it a look I'd greatly appreciate it.
trying to use the crate to make an operating system, but the build target is i686-unknown-none and this crate uses x86_64. wodnering how I could use it on a 32 bit system thanks.
Hello! I'm a newbie user of this crate and have a question.
In src/colors.rs
, the DEFAULT_PALETTE
for 256 colors are defined. However, The coloring after 65th color is always 0x3f, 0x3f, 0x3f
.
I think this is some kind of mistake, and we can improve it, for example, by conforming to one of the standards like mode 13h.
Since I'm quite new to this project, my opinion may be wrong. If so, please give me any feedback.
This is my current kernel main function:
extern crate vga;
use vga::colors::Color16;
use vga::writers::{Graphics640x480x16, GraphicsWriter};
#[no_mangle]
pub fn kmain()
{
log!("Booted!");
let mode = Graphics640x480x16::new();
log!("Created graphics mode");
mode.set_mode();
log!("Set graphics mode");
mode.clear_screen(Color16::White);
log!("Cleared screen");
for (offset, character) in "Hello World!".chars().enumerate() {
log!("Drawing character");
mode.draw_character(270 + offset * 8, 72, character, Color16::Black)
}
loop {} // If we exit, the machine shuts down - we don't want that, so we loop forever
}
Before adding the vga
crate, the system would boot and then hang at the loop at the end of the function - but now it seems to be rebooting repeatedly as you can see in the screenshot of the output below:
I'm not quite sure what the issue is - I'm following everything exactly as it is in the README. If you need to see more of the source, please let me know.
Edit: I also tested with text mode, and the same thing was happening: Everything was working right up to the point where I call text_mode.set_mode()
.
Are there any plans for this project?
I want to contribute to this but don't know the plan.
It would be easier for a vga writer to store a TextModeColor instead of storing both the foreground color and the background color. This will also make it easier to convert the current blog_os
vga to use this crate.
Something like this for example:
pub struct VgaWriter {
column_position: usize,
color_code: TextModeColor,
text_mode: Text80x25,
}
The issue with this would be when writing a character.
impl VgaWriter {
fn write_byte(&mut self, byte: u8) {
let row = self.text_mode.get_height() - 1;
let col = self.column_position;
self.text_mode.write_character(row, col, ScreenCharacter {
character: byte,
color: color_code,
});
self.column_position += 1;
}
}
The above code will not compile because character
and color
is private.
There are a couple options to for this:
character
and color
ScreenCharacter::new
that takes a TextModeColor
instead of two Color16Bit
sThanks for this crate and hopefully I'm not misunderstanding all of this. I'm also open to contribute if it helps.
On the latest nightly 1.49.0-nightly (ffa2e7ae8 2020-10-24)
the dependency x86_64 ^0.11.0
is causing the issue. One of the build-time errors is, for example:
error[E0658]: mutable references are not allowed in constant functions
--> C:\Users\xxxx\.cargo\registry\src\github.com-1ecc6299db9ec823\x86_64-0.11.8\src\structures\idt.rs:402:30
|
402 | interrupts: [Entry::missing(); 256 - 32],
| ^^^^^^^^^^^^^^^^
|
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
I think this is due to the new rust feature const_mut_refs
and the issue has been fixed in x86_64 ^0.12
. A dependency bump would be great :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.