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

TRAP instruction should modify R7 #52

Closed
rpendleton opened this issue May 8, 2022 · 0 comments
Closed

TRAP instruction should modify R7 #52

rpendleton opened this issue May 8, 2022 · 0 comments

Comments

@rpendleton
Copy link
Collaborator

According to the LC3 spec, the TRAP instruction should save the incremented PC to R7 and then jump to the trap implementation using the trap vector table.

Since we're implementing traps directly in the VM instead of relying on a assembly-based implementations, we don't need to jump to the implementation. However, the fact that R7 changes is technically part of the spec and is an observable side-effect, so we should still make that change. Without it, it's easy to write programs that work on our VM but not the official VM due to forgetting to save R7.

justinmeiners added a commit that referenced this issue May 8, 2022
update R7 when invoking a trap (fixes #52)
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

No branches or pull requests

1 participant