diff options
| author | Tianhao Wang <shrik3@riseup.net> | 2023-03-10 19:26:31 +0100 |
|---|---|---|
| committer | Tianhao Wang <shrik3@riseup.net> | 2023-03-10 19:26:31 +0100 |
| commit | 29e28bc9c67378d0d9a7174dec6a0b541fb7f4d5 (patch) | |
| tree | ff9cd708e41ffb7f3b84347d404ffde758c18ab5 /src/machine | |
| parent | 285508a3c9c2fa35b608e3a561f0c7a63cfacf62 (diff) | |
a minimal working demo on bare metal
Diffstat (limited to 'src/machine')
| -rw-r--r-- | src/machine/cgascr.rs | 36 | ||||
| -rw-r--r-- | src/machine/mod.rs | 1 |
2 files changed, 37 insertions, 0 deletions
diff --git a/src/machine/cgascr.rs b/src/machine/cgascr.rs new file mode 100644 index 0000000..a43e073 --- /dev/null +++ b/src/machine/cgascr.rs @@ -0,0 +1,36 @@ +const CGA_START:u32 = 0xb8000; + +#[allow(dead_code)] +pub struct CGAScreen{ + max_cows:u32, + max_rows:u32, +} + +#[allow(dead_code)] +impl CGAScreen{ + pub fn new(cows:u32, rows:u32) -> Self { + Self {max_cows: cows, max_rows:rows,} + } + + pub fn set_pos(x:u32, y:u32){ + + } + + pub fn get_pos(x:&mut u32, y:&mut u32){ + // TODO + *x = 1; + *y = 1; + } + + pub fn putchar(c:char, attr:u8){ + + } + + // this function should be the only one that "directly touches" + // the memory by address. + // and since it's unsafe, it shouldn't be public + fn show(&self, x:u32, y:u32, c:char, attr:u8){ + + } + +} diff --git a/src/machine/mod.rs b/src/machine/mod.rs new file mode 100644 index 0000000..4622e0b --- /dev/null +++ b/src/machine/mod.rs @@ -0,0 +1 @@ +pub mod cgascr; |
