Linked by Thom Holwerda on Sun 26th May 2013 18:48 UTC
OSNews, Generic OSes "A tiny 32 bit kernel written in Rust. I was inspired to download Rust and try to do this after seeing zero.rs - a stub that lets Rust programs run almost freestanding. It paints the screen bright red and then hangs. That's it."
Thread beginning with comment 562907
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE: I clicked it, I liked it
by Brendan on Mon 27th May 2013 05:03 UTC in reply to "I clicked it, I liked it"
Brendan
Member since:
2005-11-16

Hi,

This is exactly the kind of thing I like to see on here amongst all the other articles.


Agreed (in theory).

Sure the results aren't ground breaking, but hearing about someone doing something like this in a language i"ve never heard of is definitely of interest.


I'm not sure what they're doing in Rust; but the boot loader and the code to paint the screen red is all written in assembly.

- Brendan

Reply Parent Score: 4

RE[2]: I clicked it, I liked it
by LaceySnr on Mon 27th May 2013 05:24 in reply to "RE: I clicked it, I liked it"
LaceySnr Member since:
2009-09-28

Ah I didn't dig through the source yet, but I have been reading up on Rust as a result of it.

The clearing to red seems to be written in Rust: https://github.com/charliesome/rustboot/blob/master/main.rs

Edited 2013-05-27 05:26 UTC

Reply Parent Score: 2

Brendan Member since:
2005-11-16

Hi,

The clearing to red seems to be written in Rust: https://github.com/charliesome/rustboot/blob/master/main.rs


You're right - the assembly I saw ( https://github.com/charliesome/rustboot/blob/master/runtime.asm ) fills the screen with blue smiley faces on a black background(character 0x01) before the Rust code fills the screen with black null characters (character 0x00) on either a light pink or flashing red background (depending on how the video card felt like handling the attribute, as this isn't setup properly).

Of course this assumes that the firmware left the direction flag clear - the assembly "fill the screen" code may clear nothing and simply trash the EBDA instead, as there's no "CLD" instruction anywhere. It also assumes that the video mode actually is 80*25 text mode (I've seen cases where it's not).

- Brendan

Reply Parent Score: 3

moondevil Member since:
2005-07-08

I'm not sure what they're doing in Rust; but the boot loader and the code to paint the screen red is all written in assembly.


Only the boot loader is written in Assembly, like in any OS.

Have you read the code at all?!


unsafe fn clear_screen(background: Color) {
range(0, 80*25, |i| {
*((0xb8000 + i * 2) as *mut u16) = (background as u16) << 12;
});
}

Reply Parent Score: 3

Brendan Member since:
2005-11-16

Hi,

Only the boot loader is written in Assembly, like in any OS.


Except for https://github.com/charliesome/rustboot/blob/master/runtime.asm . Have you read the code at all?!


- Brendan

Reply Parent Score: 1