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

Automatically insert HALT at end of bytecode, before running #51

Merged
merged 2 commits into from
Nov 28, 2024

Conversation

dxrcy
Copy link
Contributor

@dxrcy dxrcy commented Nov 28, 2024

Prevents program counter running through no-ops to the end of memory.

Program will also now panic if program counter is in invalid memory region, although pc = u16::MAX is still used to signify a halt.

Replace panics due to incorrect bytecode with custom exception! macro.

@dxrcy dxrcy marked this pull request as ready for review November 28, 2024 01:41
concat!("exception: ", $fmt, ", exiting")
$($tt)*
);
std::process::exit(0xEE);
Copy link
Owner

Choose a reason for hiding this comment

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

What is the significance of 238 as an exit code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No reason, it's just unique. If used in a script it can be easily checked if the error was with the lc3 program.

Copy link
Owner

Choose a reason for hiding this comment

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

reasonable enough 👍

@rozukke rozukke merged commit 7ba70b9 into rozukke:main Nov 28, 2024
3 checks passed
@dxrcy dxrcy deleted the implicit-halt branch November 29, 2024 04:23
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