mix.git
3 months agoFix a panic in as_field_spec master
Jacob Casper [Tue, 16 Jan 2024 03:04:06 +0000 (21:04 -0600)]
Fix a panic in as_field_spec

When field specs got implemented correctly 0 stopped representing the
"special case" where we read a word without modifications. I just need
to make note that the F byte should be 5 for now in that case. Anything
that is unrepresentable should probably _also_ represent that case, so
63 would be a fine number as well.

3 months agoImplement LDA Operation
Jacob Casper [Tue, 16 Jan 2024 02:21:29 +0000 (20:21 -0600)]
Implement LDA Operation

The LDA operation reads the value from a memory location given by the
instruction, and loads it to rA. Implementing this required fleshing out
the address calculations, fixing bugs in the `Word::as_field_spec()`
method, and fixing up visibilities of various structs. Pulling the
FieldSpec out of a Word being used as an Instruction was also necessary.

Work to have addressing respect the index offset is still necessary, but
we can update state with registers now!

This desperately needs convenience methods for testing so I can take
human readable opcodes and convert them to Words more easily.

3 months agoRefactor machine types to separate file
Jacob Casper [Tue, 16 Jan 2024 01:14:55 +0000 (19:14 -0600)]
Refactor machine types to separate file

3 months agoImplement addressing on Word structs
Jacob Casper [Tue, 16 Jan 2024 00:10:23 +0000 (18:10 -0600)]
Implement addressing on Word structs

This is more useful than taking 2 MixBits and more easily keeps the sign
of the Word in scope.

3 months agoRemember bitwise operations exist for addressing
Jacob Casper [Mon, 15 Jan 2024 19:24:17 +0000 (13:24 -0600)]
Remember bitwise operations exist for addressing

It's been a long time since undergrad -- okay?

Instructions from the MIX specification frequently use a Word for
addressing. A given Instruction's address should be the W(0:2) field
specification, note this includes the sign.

3 months agoKinda implement field specifications
Jacob Casper [Mon, 15 Jan 2024 18:06:21 +0000 (12:06 -0600)]
Kinda implement field specifications

Field specifications non-optimally and with no appropriate bounds
checking. As long as I only call this with good data it should be
fine... right?

3 months agoInitial commit with types representing machine description
Jacob Casper [Mon, 15 Jan 2024 17:21:22 +0000 (11:21 -0600)]
Initial commit with types representing machine description