Skip to content

Commit

Permalink
code sync, messy debug
Browse files Browse the repository at this point in the history
  • Loading branch information
miakizz committed Nov 22, 2023
1 parent 2ec3214 commit 2a594ce
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 22 deletions.
Binary file renamed aiie/applesoft.bin → aiie/appleiie.bin
Binary file not shown.
Binary file modified aiie/char.bin
Binary file not shown.
Binary file added aiie/char.bin.new.bin
Binary file not shown.
Binary file removed aiie/char.old.bin
Binary file not shown.
Binary file removed aiie/monitor.bin
Binary file not shown.
4 changes: 4 additions & 0 deletions src/cpu/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ pub trait Execute {

impl Execute for Mos6502 {
fn execute(&mut self, opcode: u8) -> Result<u8, ()> {
if self.registers.a == 13{
println!("Return");
}
println!("{:04X} {:02X}",self.registers.pc.address()-1, opcode);
match opcode {
// === LOAD ===
0xA1 | 0xA5 | 0xA9 | 0xAD | 0xB1 | 0xB5 | 0xB9 | 0xBD => {
Expand Down
5 changes: 3 additions & 2 deletions src/systems/aiie/keyboard.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::keyboard::{KeyAdapter, KeyState, KeySymbol};

pub struct AppleIISymbolAdapter;

static mut DEBUG_START: bool = false;

Check warning on line 4 in src/systems/aiie/keyboard.rs

View workflow job for this annotation

GitHub Actions / WASM Build, Docs Build, and Web Deploy

static `DEBUG_START` is never used
impl KeyAdapter<KeySymbol, u8> for AppleIISymbolAdapter {
fn map(state: &KeyState<KeySymbol>) -> KeyState<u8> {
let mut mapped = KeyState::new();
Expand All @@ -11,7 +11,8 @@ impl KeyAdapter<KeySymbol, u8> for AppleIISymbolAdapter {

let mapped_symbol = match symbol {
&Char(c) => Some(c as u8),
Return => Some(0x0D), // Carriage Return
Return => {
Some(0x0D)}, // Carriage Return
Backspace => Some(0x08),
Escape => Some(0x1B),
_ => None,
Expand Down
24 changes: 13 additions & 11 deletions src/systems/aiie/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl AiieSoftSwitches {

/// Set or clear a softswitch value.
fn softswitch(&mut self, address: u16) {
let value = address & 1 != 0;
let value = (address & 1) == 1;

println!("softswitch {:02X} <- {}", address & !1, value);

Expand Down Expand Up @@ -161,8 +161,8 @@ impl Memory for AiieSoftSwitches {
std::io::stdout().flush().unwrap();
0
}
0x61 => todo!("OPNAPPLE: open apple (command) key data"),
0x62 => todo!("CLSAPPLE: closed apple (option) key data"),
0x61 => 0, //todo!("OPNAPPLE: open apple (command) key data"),
0x62 => 0, //todo!("CLSAPPLE: closed apple (option) key data"),
0x70 => todo!("PDLTRIG : trigger paddles"),

_ => unimplemented!(),
Expand Down Expand Up @@ -228,8 +228,9 @@ impl SystemBuilder<AiieSystem, AiieSystemRoms, AiieSystemConfig> for AiieSystemB
let io = AiieSoftSwitches::new(platform);
let peripheral_card =

Check warning on line 229 in src/systems/aiie/mod.rs

View workflow job for this annotation

GitHub Actions / WASM Build, Docs Build, and Web Deploy

unused variable: `peripheral_card`
LoggingMemory::new(Box::new(NullMemory::new()), "Peripheral Card", 0xC100);
let applesoft_interpreter = BlockMemory::from_file(0x2800, roms.applesoft);
let monitor = BlockMemory::from_file(0x800, roms.monitor);
//let applesoft_interpreter = BlockMemory::from_file(0x2800, roms.applesoft);
//let monitor = BlockMemory::from_file(0x4000, roms.monitor);
let rom = BlockMemory::from_file(16128, roms.rom);

let memory = BranchMemory::new()
.map(0x0000, Box::new(ram))
Expand All @@ -239,9 +240,9 @@ impl SystemBuilder<AiieSystem, AiieSystemRoms, AiieSystemConfig> for AiieSystemB
Box::new(io),
// Box::new(LoggingMemory::new(Box::new(io), "I/O", 0xC000)),
)
.map(0xC100, Box::new(peripheral_card))
.map(0xD000, Box::new(applesoft_interpreter))
.map(0xF800, Box::new(monitor));
.map(0xC100, Box::new(rom));
//.map(0xD000, Box::new(applesoft_interpreter))
//.map(0xF800, Box::new(monitor));

let cpu = Mos6502::new(Box::new(memory));

Expand Down Expand Up @@ -290,15 +291,16 @@ impl System for AiieSystem {

let value = self.cpu.read((0x0400 + index) as u16);

let character_index = ((value & 0b0011_1111) as usize) * 8;
let mode = (value & 0b1100_0000) >> 6;
let character_index = ((value & 0b0111_1111) as usize) * 8;
let inverted = (value & 0b1000_0000) == 0;
/*let mode = (value & 0b1100_0000) >> 6;
let inverted = match mode {
0b00 => true,
0b01 => flash_state,
0b10 | 0b11 => false,
_ => unreachable!(),
};
};*/

let character = self.characters[character_index..(character_index + 8)].to_vec();

Expand Down
14 changes: 5 additions & 9 deletions src/systems/aiie/roms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ pub struct AiieSystemRoms {
/// Character ROM. Used to generate the 7x8 character bitmaps.
pub character: RomFile,

/// Applesoft ROM. Contains the Applesoft BASIC interpreter.
pub applesoft: RomFile,

/// Monitor ROM. Contains the operating system.
pub monitor: RomFile,
pub rom: RomFile,
}

impl AiieSystemRoms {
Expand All @@ -19,13 +15,13 @@ impl AiieSystemRoms {
use crate::roms::DiskLoadable;

// let character = RomFile::from_file("aiie/char.bin");
let applesoft = RomFile::from_file("aiie/applesoft.bin");
let monitor = RomFile::from_file("aiie/monitor.bin");
//let applesoft = RomFile::from_file("aiie/applesoft.bin");
//let monitor = RomFile::from_file("aiie/monitor.bin");
let rom = RomFile::from_file("aiie/appleiie.bin");
let character = RomFile::from_file("aiie/char.bin");
Self {
character,
applesoft,
monitor,
rom
}
}
}

0 comments on commit 2a594ce

Please sign in to comment.