Skip to content

Commit

Permalink
Start on display
Browse files Browse the repository at this point in the history
  • Loading branch information
commonkestrel committed Jul 2, 2024
1 parent 9f41ae9 commit a62147f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/emulator.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
mod display;

use std::{
cmp::Ordering,
collections::HashMap,
Expand Down
27 changes: 27 additions & 0 deletions src/emulator/display.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
use std::{cell::UnsafeCell, marker::PhantomData, pin::Pin, sync::atomic::{AtomicU16, AtomicU8, Ordering}};

use async_std::task::JoinHandle;

const FONT: &[u8; 1 << 12] = include_bytes!("../vga-font.rom");

pub struct TextBuffer {
data: Pin<Box<[u8; 1 << 12]>>,
handle: JoinHandle<()>,
}

struct BufferPtr(*const [u8; 1 << 12]);
unsafe impl Send for BufferPtr {}

impl TextBuffer {
pub fn spawn() -> TextBuffer {
let data = Box::pin([0; 1 << 12]);

let handle = async_std::task::spawn(run_handle(BufferPtr(&*data)));

TextBuffer {data, handle}
}
}

async fn run_handle(buffer: BufferPtr) {

}

0 comments on commit a62147f

Please sign in to comment.