-
Notifications
You must be signed in to change notification settings - Fork 176
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
bug in PUTSP trap implementation? #51
Comments
I believe the double null is actually expected. The sentence immediately after the portion of the spec that you quoted mentions the double null:
With that said though, it looks like there's an inconsistency between the opcode appendix and the official open source implementation of the LC3 trap implementations. Here's a comment from the beginning of the TRAP_PUTSP
; NOTE: This trap will end when it sees any NUL, even in
; packed form, despite the P&P second edition's requirement
; of a double NUL. So although the specification requires a double null, it seems the official open source implementation intentionally ignores that requirement... I'm not sure what the best answer is here. |
@rpendleton perhaps we should check the latest addition of the textbook on this subject. |
Confirmed that double NUL is still the specified behaviour. @pro465 do you have an application this breaks? Or, just bringing it for correctness/consistency sake? |
@justinmeiners well i was just implementing the LC-3 in Rust and was confused. so i would say i was bringing it up for consistency/correctness. |
@pro465 I talked with @rpendleton about it. We agree it's weird, but I don't see a great reason to not follow the spec here. Perhaps something else in the lc3 ecosystem will inform us. Either way, we have been getting several questions about detailed standards topics. I think it would be a good idea to start a markdown document that records these decisions. |
since, it seems there are widely different implementations and interpretations, i did not implement the traps and stuff, instead i left them to the OS and instead made an OS-agnostic VM: |
yeah i'd agree to that: to get some sort of FAQ section in the README that answers what kind of design decisions the maintainers took. |
in
lc3-vm/docs/index.html
Lines 929 to 944 in e854c34
it seems that the trap only stops printing when it encounters a 0x0000. however, the specification says that:
in my interpretation, it sounds like the trap should stop when it has encountered a 0x0000, or it should print the first byte, and if the second byte is 0x00, it should stop, otherwise it should print it too. but this does not align with your implementation. i wonder whether it is a bug or my interpretation is wrong?
The text was updated successfully, but these errors were encountered: