1
0
mirror of https://github.com/mre/mos6502.git synced 2024-11-28 22:51:26 +00:00

return comments

This commit is contained in:
GooseDB 2019-10-13 00:18:07 +03:00
parent 71ac36b083
commit c837d7c986

View File

@ -27,12 +27,19 @@
extern crate mos6502; extern crate mos6502;
#[cfg(not(test))]
use mos6502::cpu; use mos6502::cpu;
#[cfg(not(test))]
use mos6502::address::Address; use mos6502::address::Address;
#[cfg(not(test))]
fn main() { fn main() {
let mut cpu = cpu::CPU::new(); let mut cpu = cpu::CPU::new();
// "Load" a program
let zero_page_data = [ let zero_page_data = [
// ZeroPage data start // ZeroPage data start
0x00, 0x00,
@ -91,7 +98,7 @@ fn main() {
0xFF, // Something invalid -- the end! 0xFF, // Something invalid -- the end!
]; ];
let data: [u8; 25] = [ let data = [
0x00, 0x00,
0x09, // ADC Absolute target 0x09, // ADC Absolute target
0x00, 0x00,
@ -119,7 +126,6 @@ fn main() {
0x06, // ADC IndirectIndexedY target 0x06, // ADC IndirectIndexedY target
]; ];
// "Load" a program
cpu.memory.set_bytes(Address(0x0000), &zero_page_data); cpu.memory.set_bytes(Address(0x0000), &zero_page_data);
cpu.memory.set_bytes(Address(0x4000), &program); cpu.memory.set_bytes(Address(0x4000), &program);
cpu.memory.set_bytes(Address(0x8000), &data); cpu.memory.set_bytes(Address(0x8000), &data);
@ -127,4 +133,6 @@ fn main() {
cpu.registers.program_counter = Address(0x4000); cpu.registers.program_counter = Address(0x4000);
cpu.run(); cpu.run();
println!("{:?}", cpu);
} }