writes bins better now

This commit is contained in:
2025-07-07 16:28:13 -04:00
parent 9c672741ed
commit 8c08555003
29 changed files with 1381 additions and 108 deletions
+18 -18
View File
@@ -483,7 +483,7 @@ impl Mos6502Cpu {
mod test {
use super::*;
use crate::constants::constants_isa_op::*;
use crate::instruction_table::{INSTRUCTION_CYCLES, INSTRUCTION_TABLE};
use crate::instruction_table::{instruction_cycles, INSTRUCTION_TABLE};
#[test]
fn clc() {
@@ -496,7 +496,7 @@ mod test {
cpu.pc = 0x6000;
// Tick the CPU through the instruction
for _ in 0..INSTRUCTION_CYCLES(ISA_OP_CLC) {
for _ in 0..instruction_cycles(ISA_OP_CLC) {
cpu.tick();
}
@@ -510,7 +510,7 @@ mod test {
cpu.memory[0x6000] = ISA_OP_CLD;
cpu.pc = 0x6000;
for _ in 0..INSTRUCTION_CYCLES(ISA_OP_CLD) {
for _ in 0..instruction_cycles(ISA_OP_CLD) {
cpu.tick();
}
@@ -524,7 +524,7 @@ mod test {
cpu.memory[0x6000] = ISA_OP_CLI;
cpu.pc = 0x6000;
for _ in 0..=INSTRUCTION_CYCLES(ISA_OP_CLI) {
for _ in 0..=instruction_cycles(ISA_OP_CLI) {
cpu.tick();
}
@@ -538,7 +538,7 @@ mod test {
cpu.memory[0x6000] = ISA_OP_CLV;
cpu.pc = 0x6000;
for _ in 0..=INSTRUCTION_CYCLES(ISA_OP_CLV) {
for _ in 0..=instruction_cycles(ISA_OP_CLV) {
cpu.tick();
}
@@ -552,7 +552,7 @@ mod test {
cpu.memory[0x6001] = 0xab;
cpu.pc = 0x6000;
for _ in 0..=INSTRUCTION_CYCLES(ISA_OP_LDA_I) {
for _ in 0..=instruction_cycles(ISA_OP_LDA_I) {
cpu.tick();
}
@@ -568,7 +568,7 @@ mod test {
cpu.memory[0x00ac] = 0xbe;
cpu.pc = 0x6000;
for _ in 0..=INSTRUCTION_CYCLES(ISA_OP_LDA_ZX) {
for _ in 0..=instruction_cycles(ISA_OP_LDA_ZX) {
cpu.tick();
}
@@ -589,7 +589,7 @@ mod test {
cpu.memory[0x00ab] = 0xbe;
cpu.pc = 0x6000;
for _ in 0..INSTRUCTION_CYCLES(ISA_OP_LDA_Z) {
for _ in 0..instruction_cycles(ISA_OP_LDA_Z) {
cpu.tick();
}
@@ -605,7 +605,7 @@ mod test {
cpu.memory[0x0eef] = 0xab;
cpu.pc = 0x6000;
for _ in 0..=INSTRUCTION_CYCLES(ISA_OP_LDA_ABS) {
for _ in 0..=instruction_cycles(ISA_OP_LDA_ABS) {
cpu.tick();
}
@@ -622,7 +622,7 @@ mod test {
cpu.memory[0x0ef0] = 0xab;
cpu.pc = 0x6000;
for _ in 0..=INSTRUCTION_CYCLES(ISA_OP_LDA_ABSX) {
for _ in 0..=instruction_cycles(ISA_OP_LDA_ABSX) {
cpu.tick();
}
@@ -639,7 +639,7 @@ mod test {
cpu.memory[0x0ef0] = 0xab;
cpu.pc = 0x6000;
for _ in 0..=INSTRUCTION_CYCLES(ISA_OP_LDA_ABSY) {
for _ in 0..=instruction_cycles(ISA_OP_LDA_ABSY) {
cpu.tick();
}
@@ -654,11 +654,11 @@ mod test {
cpu.memory[0x6001] = ISA_OP_INX;
cpu.pc = 0x6000;
for _ in 0..=INSTRUCTION_CYCLES(ISA_OP_DEX) {
for _ in 0..=instruction_cycles(ISA_OP_DEX) {
cpu.tick();
}
assert_eq!(0xaa, cpu.x);
for _ in 0..=INSTRUCTION_CYCLES(ISA_OP_INX) {
for _ in 0..=instruction_cycles(ISA_OP_INX) {
cpu.tick();
}
assert_eq!(0xab, cpu.x);
@@ -672,11 +672,11 @@ mod test {
cpu.memory[0x6001] = ISA_OP_INY;
cpu.pc = 0x6000;
for _ in 0..=INSTRUCTION_CYCLES(ISA_OP_DEY) {
for _ in 0..=instruction_cycles(ISA_OP_DEY) {
cpu.tick();
}
assert_eq!(0xaa, cpu.peek_y());
for _ in 0..=INSTRUCTION_CYCLES(ISA_OP_INY) {
for _ in 0..=instruction_cycles(ISA_OP_INY) {
cpu.tick();
}
assert_eq!(0xab, cpu.peek_y());
@@ -690,11 +690,11 @@ mod test {
cpu.memory[0x6001] = ISA_OP_ROR_A;
cpu.pc = 0x6000;
for _ in 0..=INSTRUCTION_CYCLES(ISA_OP_ROL_A) {
for _ in 0..=instruction_cycles(ISA_OP_ROL_A) {
cpu.tick();
}
assert_eq!(cpu.peek_a(), 0b0101_0101);
for _ in 0..=INSTRUCTION_CYCLES(ISA_OP_ROR_A) {
for _ in 0..=instruction_cycles(ISA_OP_ROR_A) {
cpu.tick();
}
assert_eq!(cpu.peek_a(), 0b1010_1010);
@@ -708,7 +708,7 @@ mod test {
cpu.memory[0x6001] = 0xab;
cpu.pc = 0x6000;
for _ in 0..=INSTRUCTION_CYCLES(ISA_OP_ROL_ZP) {
for _ in 0..=instruction_cycles(ISA_OP_ROL_ZP) {
cpu.tick();
}