Skip to content

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

Open
123zmz123 wants to merge 1 commit intobugzmanov:masterfrom
123zmz123:ch3_3_test_fix
Open

fix code to pass cpu.rs module test at ch3.3#12
123zmz123 wants to merge 1 commit intobugzmanov:masterfrom
123zmz123:ch3_3_test_fix

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

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