Commit Graph

16 Commits

Author SHA1 Message Date
Bradford Lamson-Scribner 67416900b4 internal/vm: update Appleone and all it’s `a` handlers to VM with `vm` handler 2020-06-04 20:47:35 -06:00
Bradford Lamson-Scribner b7a3ec4a6c internal/vm/{cpu,exec_funcs,opcodes,vm}: rename op -> operation for clarity (I hope), also general refactors 2020-05-31 22:50:07 -06:00
Bradford Lamson-Scribner 1b3f1f5b1f internal/vm/exec_funcs: remove the todo exec func! 2020-05-31 22:23:02 -06:00
Bradford Lamson-Scribner fea9257e84 internal/vm/{exec_funcs,vm}: refactor flag get/set/clears
Hit me like a brick wall, remove all the specific flag get/set/clear funcs
in favor of a single getFlag, setFlag, and clearFlag funcs that take a flag
(byte) as its argument.
2020-05-31 22:20:08 -06:00
Bradford Lamson-Scribner 2a17dda142 internal/vm/{cpu,mem,opcodes,vm}: stick to using byte instead of uint8
I can never decide on these things but I generally
prefer using `byte` in go.
2020-05-31 21:47:05 -06:00
Bradford Lamson-Scribner 01bb2379ce internal/vm/{exec_funcs,opcodes,vm}: update design around opcode addr and operand fetching
Refactor:
`(o op) getAddr` -> `(a *Appleone) getAddr`
`(o op) getOperand` `(a *Appleone) getOperand`

This makes way more sense to me and has been bothering me for a while.
2020-05-31 21:41:47 -06:00
Bradford Lamson-Scribner e5709ad58b Internal/vm/{exec_funcs,opcodes}: missed one, add exec func for BCS opcode 2020-05-31 21:34:48 -06:00
Bradford Lamson-Scribner a9a3ae5c0a internal/vm/{exec_funcs,opcodes,vm}: implement the rest of the opcode exec funcs 2020-05-31 21:32:00 -06:00
Bradford Lamson-Scribner ca699a78af internal/vm/{exec_funcs,opcodes,vm}: add support for executing LDX, LDY, and ADC 2020-05-31 09:59:58 -06:00
Bradford Lamson-Scribner da70e2cfe3 internal/vm/{exec_funcs,opcodes}: add support for executing DEY, DEX, TAY, TAX opcodes 2020-05-31 09:41:57 -06:00
Bradford Lamson-Scribner 00cec5678e internal/vm/{exec_funcs,opcodes}: add support for executing INX 2020-05-31 08:59:09 -06:00
Bradford Lamson-Scribner 35bdeac2c8 internal/vm/{exec_funcs,opcodes}: handle INX instruction execution 2020-05-30 17:14:13 -06:00
Bradford Lamson-Scribner 8d6a0f8fd3 internal/vm: start playing with op executions
So far the pattern feels a tiny bit weird but also has been nice to work
with. As you can see, the op now contains it’s instruction execution func
which can be called directly from the op.
2020-05-30 17:06:36 -06:00
Bradford Lamson-Scribner 2bd748fccd docs: update some funcs with light docs 2020-05-30 11:13:35 -06:00
Bradford Lamson-Scribner cdca8f735d internal/vm: add the first few opcode handlers
Still a little iffy on the code design, although this seems like it
could be a desirable pattern. This way I would have to write an opcode
handler for all the cases and register it to the “op”. That way step
calls are super simple from Appleone’s point of view -> get the operation
and that operation has everything needed to execute on the vm.
2020-05-30 11:03:58 -06:00
Bradford Lamson-Scribner f77b94f885 internal/{cpu,vm}: add memory to the vm, and refactor cpu/vm/memory code 2020-05-27 21:19:43 -06:00