Skip to content

VM restructure and refactor - #17

Merged
sofiazcoaga merged 2 commits into
devfrom
restructure
Jun 17, 2025
Merged

VM restructure and refactor#17
sofiazcoaga merged 2 commits into
devfrom
restructure

Conversation

@sofiazcoaga

@sofiazcoaga sofiazcoaga commented Jun 17, 2025

Copy link
Copy Markdown
Owner

This PR includes some restructuring of the VM. The major changes are:

  • Create a utils.rs file for functions read_file, get_char and disable_input_buffering.
  • Move the VMState to its own file and make functions mem_read, mem_write and write_ixs_to_mem part of its methods implementation.
  • Reuse the get_char util function in TRAP handles.

@DiegoCivi DiegoCivi left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks good! Just a little comment. Since getting the PC is very common, maybe you could implement the method vm.get_pc() so you avoid doing vm.registers[PC.usize()] all the time.

Comment thread src/main.rs
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