WIP
This commit is contained in:
@@ -21,12 +21,13 @@ pub static mut CALL_ABI_TABLE: [usize; CallAbiTable::COUNT] = [0; CallAbiTable::
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum CallAbiTable {
|
||||
Print = 0,
|
||||
DrawIter = 1,
|
||||
GetKey = 2,
|
||||
Sleep = 1,
|
||||
DrawIter = 2,
|
||||
GetKey = 3,
|
||||
}
|
||||
|
||||
impl CallAbiTable {
|
||||
pub const COUNT: usize = 3;
|
||||
pub const COUNT: usize = 4;
|
||||
}
|
||||
|
||||
pub type PrintAbi = extern "Rust" fn(msg: &str);
|
||||
@@ -39,6 +40,16 @@ pub fn print(msg: &str) {
|
||||
}
|
||||
}
|
||||
|
||||
pub type SleepAbi = extern "Rust" fn(ticks: u64);
|
||||
|
||||
pub fn sleep(ticks: u64) {
|
||||
unsafe {
|
||||
let ptr = CALL_ABI_TABLE[CallAbiTable::Print as usize];
|
||||
let f: SleepAbi = core::mem::transmute(ptr);
|
||||
f(ticks);
|
||||
}
|
||||
}
|
||||
|
||||
pub type DrawIterAbi = extern "Rust" fn(pixels: &[Pixel<Rgb565>]);
|
||||
|
||||
pub fn draw_iter(pixels: &[Pixel<Rgb565>]) {
|
||||
|
||||
Reference in New Issue
Block a user