decodes all instructions i think.
start of a beneater pc
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// This is the GUI for the BenEater PC
|
||||
use macroquad::prelude::*;
|
||||
|
||||
#[macroquad::main("Ben Eaters PC")]
|
||||
async fn main() {
|
||||
println!("Taxation is Theft");
|
||||
|
||||
let computer = BenEaterPC::new();
|
||||
|
||||
loop {
|
||||
clear_background(BLUE);
|
||||
|
||||
draw_text("Ben Eater", 20.0, 20.0, 30.0, BLACK);
|
||||
next_frame().await
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
pub mod parts;
|
||||
@@ -0,0 +1,25 @@
|
||||
use crate::parts::clock::Clock;
|
||||
use core::mos6502cpu::Mos6502Cpu;
|
||||
|
||||
struct BenEaterPC {
|
||||
clock: Clock,
|
||||
cpu: Mos6502Cpu,
|
||||
}
|
||||
|
||||
impl BenEaterPC {
|
||||
pub fn new() -> Self {
|
||||
BenEaterPC {
|
||||
clock: Clock::new(),
|
||||
cpu: Mos6502Cpu::default()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn tick_system(&mut self) {
|
||||
let (address, data, rw) = self.cpu.tick();
|
||||
if self.cpu.microcode_step == 0 {
|
||||
// tick the clock.
|
||||
// tick the memory
|
||||
// tick the VIA
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
pub struct Clock {
|
||||
ticks: u32
|
||||
}
|
||||
|
||||
impl Clock {
|
||||
pub fn new() -> Self {
|
||||
|
||||
Clock {
|
||||
ticks: 0
|
||||
}
|
||||
}
|
||||
|
||||
pub fn tick(&mut self) {
|
||||
self.ticks += 1;
|
||||
}
|
||||
|
||||
pub fn ticks(&self) -> u32 {
|
||||
self.ticks
|
||||
}
|
||||
|
||||
pub fn reset(&mut self) {
|
||||
self.ticks = 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
pub mod clock;
|
||||
mod ben_eater_pc;
|
||||
mod via6522;
|
||||
@@ -0,0 +1,31 @@
|
||||
#[derive(Default)]
|
||||
pub struct Via6522 {
|
||||
port_a_state: u8,
|
||||
port_b_data: u8,
|
||||
port_a_direction: u8,
|
||||
port_b_direction: u8,
|
||||
memory_offset: u16,
|
||||
}
|
||||
|
||||
impl Via6522 {
|
||||
pub fn new(offset: u16) -> Self {
|
||||
Via6522 {
|
||||
memory_offset: offset,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_a_direction(&mut self, new_direction: u8) {
|
||||
|
||||
}
|
||||
|
||||
// check for output pins and see what they say
|
||||
pub fn update_pins(&mut self) {
|
||||
|
||||
}
|
||||
|
||||
// check for input mode pins and see what they say
|
||||
pub fn read_pins(&self) {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user