stevenrwalter

Rust on C64

Sep 13th, 2019
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.52 KB | None | 0 0
  1. #![no_std]
  2.  
  3. pub struct VIC;
  4.  
  5. impl VIC {
  6.     pub fn set_border_color(color: u8) {
  7.         unsafe {
  8.             let border_color = 0xd020 as *mut u8;
  9.             *border_color = color;
  10.         }
  11.     }
  12.    
  13.     pub fn get_screen_mem() -> &'static mut [u8] {
  14.        unsafe {
  15.            let screen_mem = 0x400 as *mut u8;
  16.            core::slice::from_raw_parts_mut(screen_mem, 2048)
  17.        }
  18.    }
  19. }
  20.  
  21. pub fn main() {
  22.    VIC::set_border_color(1);
  23.    let mem = VIC::get_screen_mem();
  24.    mem[0] = 'A' as u8;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment