Skip to content

Commit f307c80

Browse files
committed
fixed warnings
1 parent 590392b commit f307c80

5 files changed

Lines changed: 16 additions & 17 deletions

File tree

src/cpu/branch_test.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ mod branch_test {
2525

2626
// Literally same as above but just testing if branch can branch negative
2727
fn jump_neg(cpu: &mut CPU, op: u8, clear: bool, flag: CpuFlags){
28-
cpu.load_and_reset(vec![op, 0xFE, 0x00]);
29-
cpu.memory[cpu.mem_read(0xFFFC).wrapping_sub(2) as usize] = op::INX;
30-
cpu.memory[cpu.mem_read(0xFFFC).wrapping_sub(1) as usize] = 0x00;
28+
cpu.load_and_reset(vec![op, 0xFC, 0x00]);
29+
cpu.memory[0x7FFE] = op::INX;
30+
cpu.memory[0x7FFF] = 0x00;
3131
if clear {
3232
println!("branch_test: Allocating flags to clear!");
3333
cpu.flags = CpuFlags::from_bits_truncate(0b1111_1111);
@@ -51,7 +51,7 @@ mod branch_test {
5151
cpu.x
5252
);
5353

54-
jump(&mut cpu, op, clear, flag);
54+
jump_neg(&mut cpu, op, clear, flag);
5555
assert!(
5656
cpu.x == 1,
5757
"jump neg Helper_test positive failed on {:#x}, cpu.x is {}",
@@ -68,9 +68,9 @@ mod branch_test {
6868
cpu.x
6969
);
7070

71-
jump(&mut cpu, op, clear, flag);
71+
jump_neg(&mut cpu, op, !clear, flag);
7272
assert!(
73-
cpu.x == 1,
73+
cpu.x == 0,
7474
"jump neg Helper_test negative failed on {:#x}, cpu.x is {}",
7575
op,
7676
cpu.x

src/cpu/group1_test.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ mod group1_test {
5757

5858
// Zero Page Testing
5959
print_title!("Zero Page Test");
60-
cpu.load_and_reset((vec![first_half + g1_op::ZP, 0xFF]));
60+
cpu.load_and_reset(vec![first_half + g1_op::ZP, 0xFF]);
6161
gen_test_flag(cpu, carry);
6262
cpu.memory[0xFF] = load_mem;
6363
cpu.a = load_a;
@@ -87,7 +87,7 @@ mod group1_test {
8787

8888
// Absolute testing
8989
// Note 0xFE is first due to little endian
90-
cpu.load_and_reset((vec![first_half + g1_op::ABSOLUTE_X, 0xFE, 0x01]));
90+
cpu.load_and_reset(vec![first_half + g1_op::ABSOLUTE_X, 0xFE, 0x01]);
9191
gen_test_flag(cpu, carry);
9292
cpu.memory[0x01FE] = load_mem;
9393
cpu.a = load_a;
@@ -374,7 +374,7 @@ mod group1_test {
374374

375375
// Zero Page Testing
376376
print_title!("Zero Page Test");
377-
cpu.load_and_reset((vec![first_half + g1_op::ZP, 0xA1]));
377+
cpu.load_and_reset(vec![first_half + g1_op::ZP, 0xA1]);
378378
cpu.a = load_a;
379379
cpu.run();
380380
assert!(
@@ -384,7 +384,7 @@ mod group1_test {
384384

385385
// Absolute testing
386386
// Note 0xFE is first due to little endian
387-
cpu.load_and_reset((vec![first_half + g1_op::ABSOLUTE_X, 0xFE, 0x01]));
387+
cpu.load_and_reset(vec![first_half + g1_op::ABSOLUTE_X, 0xFE, 0x01]);
388388
cpu.a = load_a;
389389
cpu.run();
390390
assert!(

src/cpu/group3_test.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ mod group3_test {
143143

144144
// Zero Page Testing
145145
print_title!("Zero Page Test");
146-
cpu.load_and_reset((vec![first_half + zp_end, 0xFF]));
146+
cpu.load_and_reset(vec![first_half + zp_end, 0xFF]);
147147
cpu.memory[0xFF] = load_mem;
148148
reg_loader(cpu, x, load_reg);
149149
cpu.run();
@@ -171,7 +171,7 @@ mod group3_test {
171171

172172
// Absolute testing
173173
// Note 0xFE is first due to little endian
174-
cpu.load_and_reset((vec![first_half + abs_end, 0xFE, 0x01]));
174+
cpu.load_and_reset(vec![first_half + abs_end, 0xFE, 0x01]);
175175
cpu.memory[0x01FE] = load_mem;
176176
reg_loader(cpu, x, load_reg);
177177
cpu.run();
@@ -218,7 +218,7 @@ mod group3_test {
218218
// Set x to be true for cpx, false for cpy
219219
for i in 0..2 {
220220
let mut cpu = CPU::new();
221-
let mut x = i == 1;
221+
let x = i == 1;
222222
gen_test(&mut cpu, x, 0, 0x05, 0x05);
223223
assert!(!cpu.flags.contains(CpuFlags::NEGATIVE) && !cpu.flags.contains(CpuFlags::ZERO));
224224

@@ -250,7 +250,7 @@ mod group3_test {
250250
second_half_zp = g2_op::ZP;
251251
second_half_abs = g2_op::ABS;
252252
}
253-
cpu.load_and_reset((vec![first_half + second_half_zp, 0xA1]));
253+
cpu.load_and_reset(vec![first_half + second_half_zp, 0xA1]);
254254
reg_loader(&mut cpu, x, load_reg);
255255
cpu.run();
256256
assert!(
@@ -260,7 +260,7 @@ mod group3_test {
260260

261261
// Absolute testing
262262
// Note 0xFE is first due to little endian
263-
cpu.load_and_reset((vec![first_half + second_half_abs, 0xFE, 0x01]));
263+
cpu.load_and_reset(vec![first_half + second_half_abs, 0xFE, 0x01]);
264264
reg_loader(&mut cpu, x, load_reg);
265265
cpu.run();
266266
assert!(

src/cpu/op.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,6 @@ pub mod branch_op {
118118
#[cfg(test)]
119119
pub mod other_op{
120120
pub const JSR:u8 = 0x20;
121-
pub const RTI: u8 = 0x40;
121+
// pub const RTI: u8 = 0x40;
122122
pub const RTS: u8 = 0x60;
123123
}

src/cpu/other_test.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#[cfg(test)]
33
mod branch_test {
44
use crate::cpu::op::*;
5-
use crate::cpu::CpuFlags;
65
use crate::cpu::CPU;
76

87
// BRK is not tested as every other test hinges on BRK working...

0 commit comments

Comments
 (0)