Age | Commit message (Collapse) | Author | |
---|---|---|---|
2023-10-22 | Removed `ret` register | Aryadev Chavali | |
Wasn't useful or necessary. | |||
2023-10-22 | Added and implemented OP_JUMP_ABS | Aryadev Chavali | |
Jumps to the operand given, interpreted as a word, an absolute address. | |||
2023-10-22 | Fixed bug in vm_execute_all, if no OP_HALT then program kept going | Aryadev Chavali | |
This adds a bound on vm_execute_all to stop program->ptr from going past program->max. | |||
2023-10-22 | Implemented vm_* routines for OP_DUP and vm_execute code | Aryadev Chavali | |
2023-10-22 | Use conversion functions for (h)word to and from bytes instead of bit shifting | Aryadev Chavali | |
Wasn't very secure for endianness, and using these helpers abstracts the details away a bit in case I want to enforce a certain system. | |||
2023-10-22 | Added NUMBER_OF_OPCODES which aids in compilation errors | Aryadev Chavali | |
If I add a new operand I want the build system to be more helpful in finding the places I need to change to make it work. | |||
2023-10-22 | Added opcode OP_DUP_* | Aryadev Chavali | |
Duplicates the nth datum off the stack, pushing it to the top. Useful for operations such as MOV which eat the stack. | |||
2023-10-22 | Cleaned up inst.c | Aryadev Chavali | |
Use (H)WORD_SIZE more, added some notes, etc | |||
2023-10-22 | Functions which convert (h)words to and from bytes | Aryadev Chavali | |
Uses memcpy internally, so we don't need to care about endianness. | |||
2023-10-22 | Simple program which assembles instructions then executes them | Aryadev Chavali | |
2023-10-22 | Fix bug where accessing byte/hword registers > 8 wouldn't work | Aryadev Chavali | |
This is because we were checking them as if they were word registers. | |||
2023-10-22 | Added flag to Makefile to set VERBOSE macro in base.h | Aryadev Chavali | |
2023-10-22 | Made a debug and release configuration via flags | Aryadev Chavali | |
Also split out the check for whether $(DIST) exists by making it its own recipe. Removes the repeated checks in each object compilation. | |||
2023-10-22 | When VEROBSE flag is set greater than 0, print traces in vm_execute_all | Aryadev Chavali | |
For each cycle, print the cycle and any changes. We track changes on the stack by remembering the previous stack pointer. For registers, I remember the previous array of registers and do a byte level compare of the current registers and the remembered ones. Produces pretty log messages and an easy way to track execution. | |||
2023-10-22 | Changed formats for vm_print_(stack|program) | Aryadev Chavali | |
Easier to read now | |||
2023-10-22 | Fix bug where FILE is closed when passing to darr_(write|read) | Aryadev Chavali | |
2023-10-22 | Added flag in base.h, VERBOSE | Aryadev Chavali | |
Will be used to provide traces during program execution or assembly. | |||
2023-10-22 | Added macros for NOOP and HALT | Aryadev Chavali | |
2023-10-22 | Changed format of inst_print | Aryadev Chavali | |
Prints the opcode then any operands in the following brackets | |||
2023-10-22 | Store the result of OP_POP in the last register as a word | Aryadev Chavali | |
Instead of making routines to handle data in the `ret` register, just store the result of POP into the last word register. This means we are no longer using vm_pop_* or POP_ROUTINES for the vm_execute script on OP_POP: instead we'll just use vm_mov_* which automatically pops the datum for us, while moving the datum to the last register. | |||
2023-10-21 | Implemented vm routines for OP_EQ_* | Aryadev Chavali | |
2023-10-21 | Implemented vm routines for OP_XOR_* | Aryadev Chavali | |
2023-10-21 | Implemented vm routines for OP_AND_* | Aryadev Chavali | |
2023-10-21 | Implemented vm routines for OP_OR_* | Aryadev Chavali | |
2023-10-21 | Implemented vm routines for OP_NOT_* | Aryadev Chavali | |
2023-10-21 | Implemented opcode_as_cstr for NOT,OR,AND,XOR,EQ | Aryadev Chavali | |
2023-10-21 | Introduced opcodes for NOT, OR, AND, XOR and EQ | Aryadev Chavali | |
Does a bit level version of each of these. | |||
2023-10-21 | Cleaned up and used macro magic to shorten the INST_* macros | Aryadev Chavali | |
Instead of having 3 differing macros for each typed version of each opcode, just supply the type as a symbol to the macro, which will concatenated the type to all the places necessary. Relies on D(BYTE|HWORD|WORD) and OP_*_(BYTE|HWORD|WORD) being a consistent naming style. | |||
2023-10-21 | Added vm_execute_all which executes an entire program | Aryadev Chavali | |
Handles OP_HALT | |||
2023-10-21 | Wrote a quick tutorial on targeting the virtual machine | Aryadev Chavali | |
2023-10-21 | Wrote generalised procedures for interpret and assembly | Aryadev Chavali | |
2023-10-21 | Helper functions for read/write instructions from darr or FILE* | Aryadev Chavali | |
2023-10-21 | Helper darr functions to read/write bytes from FILE * | Aryadev Chavali | |
2023-10-21 | Switched from floats to halfword | Aryadev Chavali | |
Registers are now just words, with pushing from and moving to registers with specified subtypes just pushing those types into the word registers. That means there are 8 word registers which can act as 16 half word registers, which themselves can act as 64 byte registers. | |||
2023-10-16 | Implemented vm_print_* routines | Aryadev Chavali | |
Prints each aspect of the vm, and vm_print_all does it all. | |||
2023-10-16 | Added opcode_as_cstr, opcode_type_as_cstr and inst_print | Aryadev Chavali | |
Pretty self explanatory, helps with logging. | |||
2023-10-16 | Added helper functions to read and write bytes from files | Aryadev Chavali | |
Given a filepath, helper function to write a buffer of bytes to a file and to read a file completely as a buffer. | |||
2023-10-16 | Made a sample program, loaded into VM and executed | Aryadev Chavali | |
Seems pretty nice to use, and it works according to GDB. | |||
2023-10-16 | Fixed bug with get_opcode_data_type | Aryadev Chavali | |
Pushed the bits one step too far. | |||
2023-10-16 | Set opcode after reading parameters in inst_read_byte | Aryadev Chavali | |
2023-10-16 | Fixed error with OP_PUSH where bits weren't in the pattern of data_type_t | Aryadev Chavali | |
2023-10-16 | MOV and PUSH_*_REGISTER should only need bytes for their operand | Aryadev Chavali | |
We won't have more than 255 registers, so a byte is all that's necessary. | |||
2023-10-16 | Added functionality to read and write instruction bytecode | Aryadev Chavali | |
Uses some bit hacks to quickly check what data type an opcode may have by shifting down to units then casting it to a data_type_t. Not very well tested yet, we'll need to see now. | |||
2023-10-16 | Made OP_HALT the only instruction to have the top byte filled | Aryadev Chavali | |
2023-10-16 | MOV now uses the stack, removed register member in inst_t | Aryadev Chavali | |
Instead of taking an operand and a register, mov just uses the stack for the operand. Therefore, there's no need for a register member in inst_t. As a result, PUSH_*_REGISTER now uses the operand for the register. | |||
2023-10-15 | Better checking of opcode types | Aryadev Chavali | |
Introduced an enum (opcode_type_t) for the masks and values of each opcode, which allows defining a single enum which checks an opcode by a opcode_type_t. | |||
2023-10-15 | Remove parameter for INST_*POP | Aryadev Chavali | |
POP instructions do not require an operand: they're a unary operator. | |||
2023-10-15 | Set register parameter for inst_t to be a byte | Aryadev Chavali | |
We at most have 255 registers, so no need to have a word for it. | |||
2023-10-15 | Implemented a dynamically sized byte array | Aryadev Chavali | |
Pretty simple, want to ensure amortised constant big O so I use a REALLOC_MULT, which can be redefined if wished. | |||
2023-10-15 | Added macros for getting the maximum and minimum of two numbers | Aryadev Chavali | |