#![no_std]
#![feature(start)]
extern crate mos_alloc;
use core::panic::PanicInfo;
use mos_hardware::{c64, poke, vic2};
use vic2::*;
const RUST_LOGO: [u8; 63] = [
0, 90, 0, 1, 255, 128, 7, 239, 224, 15, 24, 240, 28, 0, 56, 63, 255, 28, 127, 255, 158, 127,
255, 222, 235, 195, 215, 115, 255, 142, 227, 255, 135, 99, 199, 142, 247, 195, 223, 127, 243,
254, 127, 241, 254, 62, 0, 60, 29, 0, 184, 15, 129, 240, 7, 255, 224, 1, 255, 128, 0, 90, 0,
];
#[start]
fn _main(_argc: isize, _argv: *const *const u8) -> isize {
const SPRITE_ADDRESS: u16 = 0x2000;
const SPRITE_PTR: u8 = to_sprite_pointer(SPRITE_ADDRESS);
let vic = c64::vic2();
unsafe {
*(SPRITE_ADDRESS as *mut [u8; 63]) = RUST_LOGO;
poke!(c64::DEFAULT_SPRITE_PTR[0], SPRITE_PTR);
poke!(c64::DEFAULT_SPRITE_PTR[2], SPRITE_PTR);
}
vic.set_sprite_pos(0, 180, 100);
vic.set_sprite_color(0, GREEN);
unsafe {
vic.sprite_expand_x.write(Sprites::SPRITE0);
vic.sprite_expand_y.write(Sprites::SPRITE0);
}
vic.set_sprite_pos(2, 180, 60);
vic.set_sprite_color(2, RED);
unsafe { vic.sprite_background_priority.write(Sprites::SPRITE2) };
unsafe {
vic.sprite_enable
.write(Sprites::SPRITE0 | Sprites::SPRITE2 | Sprites::SPRITE7)
};
let mut enabled_sprites = vic.sprite_enable.read();
enabled_sprites.remove(Sprites::SPRITE7);
unsafe { vic.sprite_enable.write(enabled_sprites) };
0
}
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {
unsafe {
c64::vic2().border_color.write(RED);
c64::vic2().border_color.write(BLACK);
}
}
}