I am making a VGA print macro for my OS with no_std
, and it is for some reason not working. I am using the vga crate so that I do not have to do all the VGA code myself. I have a function called _print
:
use core::fmt::{Arguments, Write};
use vga::colors::Color16;
use vga::writers::{Graphics640x480x16, GraphicsWriter};
pub fn _print(args: Arguments) {
unsafe {
let mut i: usize = 0;
for (_offset, character) in args.as_str().unwrap().chars().enumerate() {
Mode.draw_character(CurrentTextX + i, CurrentTextY, character, CurrentTextColor);
i += 8;
}
}
}
I then have a macro called vprint!
:
#[macro_export]
macro_rules! vprint {
($($arg:tt)*) => {
crate::videographicsarray::_print(format_args!($($arg)*));
};
}
I am not using alloc
. I have seen code exactly like this work, but for some reason my code does not work. It displays text I enter, but if I pass any arguments, it panics. What am I doing wrong?