Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix code to pass cpu.rs module test at ch3.3 #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

123zmz123
Copy link

@123zmz123 123zmz123 commented Apr 28, 2021

to be honest , I do not think we should put reset() in load_and_run() at this chapter other features were not implemented currently, after load the program , if we force cpu reset,all the pre-configured parameter like prgrame file , register statu,will all be lost,definitely we can't pass any test. so I suggest change the code.
After the change test result will pass.
The test result as below
image

@@ -229,7 +229,7 @@ impl CPU {

pub fn load_and_run(&mut self, program: Vec<u8>) {
self.load(program);
self.reset();
self.program_counter = self.mem_read_u16(0xFFFC);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't have to hack load_and_run to make test past, you can use load, reset and run separately in the test case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants