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

Make Register Access Consistent #17

Closed
clbx opened this issue Nov 26, 2019 · 4 comments
Closed

Make Register Access Consistent #17

clbx opened this issue Nov 26, 2019 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@clbx
Copy link
Owner

clbx commented Nov 26, 2019

Some Instructions when given R1 take from r[0], some take from r[1].

Example:
MOV R0 points to [0]
JMP R0 points to [1]

A proper way should be decided and made uniform

@clbx clbx added the bug Something isn't working label Nov 26, 2019
@clbx
Copy link
Owner Author

clbx commented Nov 26, 2019

The given example is wrong. The issue is actually between two MOV functions.

@clbx
Copy link
Owner Author

clbx commented Nov 26, 2019

0x39 and 0x33 use registers differently

@clbx
Copy link
Owner Author

clbx commented Nov 28, 2019

Should check the following

Cosmic/src/cosproc.cpp

Lines 353 to 362 in 4c5f7c7

/* 0x17 ADDXR */
void cosproc::ADDXR(uint16_t src){
uint16_t data;
if(src % 2 == 0){
data = ((r[src] << 8) | r[src+1]);
}else{
data = ((r[src-1] << 8) | r[src]);
}

And all similar uses

Cosmic/src/cosproc.cpp

Lines 728 to 732 in 4c5f7c7

void cosproc::MOVXAR(uint16_t src){
uint16_t dst = ((Read(pc+2) << 8 | Read(pc+3))); //Get the 16bit destination
Write(dst, r[src]);
Write(dst+1, r[src+1]);
}

and all similar uses

@CarmanK
Copy link
Collaborator

CarmanK commented Dec 8, 2019

Fixed

@CarmanK CarmanK closed this as completed Dec 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants