@@ -12,5 +12,5 @@ ceres-sys = { path = "ceres-sys" } | |||||
[workspace] | [workspace] | ||||
members = [ | members = [ | ||||
"ceres-sys" | |||||
"ceres-sys", | |||||
] | ] |
@@ -1,9 +1,11 @@ | |||||
# Ceres | |||||
a shitty fantasy console written in rust using a proprietary MIPS based asm instruction set. a bit of inspiration from PICO-8 | |||||
# CERES-16 | |||||
a shitty fantasy console written in rust using a proprietary MIPS based asm instruction set. a lot of inspiration from PICO-8. ceres is structured of these crates: | |||||
### GRAPHICS | |||||
- ceres-sys: the core system structure of ceres-16 | |||||
uhhhhh funny 256x144 screen | |||||
### Graphics | |||||
ceres uses a 256x144 screen with a separate video buffer from the standard memory. colors are 16-bit structured like `0b0000_rrrr_gggg_bbbb` where the first four bits are ignored. the video buffer is structured row major where each u16 is an individual pixel | |||||
### Register layout and info | ### Register layout and info | ||||
@@ -6,10 +6,14 @@ pub use memory::Memory; | |||||
pub use registers::Registers; | pub use registers::Registers; | ||||
pub use video::VideoMemory; | pub use video::VideoMemory; | ||||
/// ceres screen width | |||||
pub const SCREEN_WIDTH: usize = 256; | pub const SCREEN_WIDTH: usize = 256; | ||||
/// ceres screen height | |||||
pub const SCREEN_HEIGHT: usize = 144; | pub const SCREEN_HEIGHT: usize = 144; | ||||
/// ceres video memory buffer length | |||||
pub const VIDEO_MEMORY_LEN: usize = SCREEN_HEIGHT * SCREEN_WIDTH; | pub const VIDEO_MEMORY_LEN: usize = SCREEN_HEIGHT * SCREEN_WIDTH; | ||||
/// the core system structure of ceres | |||||
pub struct System { | pub struct System { | ||||
pub registers: Registers, | pub registers: Registers, | ||||
pub memory: Memory, | pub memory: Memory, | ||||
@@ -17,6 +21,7 @@ pub struct System { | |||||
} | } | ||||
impl System { | impl System { | ||||
/// initialize a new system and all of it's component parts | |||||
pub fn init() -> System { | pub fn init() -> System { | ||||
System { | System { | ||||
registers: Registers::init(), | registers: Registers::init(), | ||||
@@ -4,6 +4,7 @@ pub struct Memory { | |||||
} | } | ||||
impl Memory { | impl Memory { | ||||
/// initialize the main memory buffer | |||||
pub fn init() -> Memory { | pub fn init() -> Memory { | ||||
Memory { data: [0x00; std::u16::MAX as usize] } | Memory { data: [0x00; std::u16::MAX as usize] } | ||||
} | } | ||||
@@ -1,8 +1,10 @@ | |||||
/// video memory | |||||
pub struct VideoMemory { | pub struct VideoMemory { | ||||
data: [u16; crate::VIDEO_MEMORY_LEN], | data: [u16; crate::VIDEO_MEMORY_LEN], | ||||
} | } | ||||
impl VideoMemory { | impl VideoMemory { | ||||
/// initialize the video memory | |||||
pub fn init() -> VideoMemory { | pub fn init() -> VideoMemory { | ||||
VideoMemory { data: [0x0000; crate::VIDEO_MEMORY_LEN] } | VideoMemory { data: [0x0000; crate::VIDEO_MEMORY_LEN] } | ||||
} | } | ||||