aboutsummaryrefslogtreecommitdiff
path: root/src/inst.c
AgeCommit message (Collapse)Author
2023-10-23Added and implemented OP_JUMP_IF_*Aryadev Chavali
Performs a jump when the (BYTE|HWORD|WORD) at the top of the stack is non zero.
2023-10-23Added and implemented OP_PRINT*Aryadev Chavali
Here is where we may have differing interpretations of what the bits in the data pile may actually mean. This in particular refers to printing the signed or unsigned versions of the bits given. Also, interpreting some byte as a character or just a raw number.
2023-10-22Remove get_opcode_data_typeAryadev Chavali
Was only used for OP_PUSH data types anyway, so is essentially useless. Only OP_PUSH has operands after it that directly relate to it: the rest either have a fixed type (a byte for registers, for example) or NIL (because they have no operand).
2023-10-22Added OP_PLUS_*Aryadev Chavali
Takes two operands from the stack then pushes their sum.
2023-10-22Fix bug where negative opcodes lead to invalid bytecode parsingAryadev Chavali
2023-10-22Added and implemented OP_JUMP_(STACK|REGISTER)Aryadev Chavali
Uses the stack and register, respectively, to jump to an absolute address. The stack based jump pops a word off the stack to perform a jump, while the register based one uses the operand to figure out which register to use.
2023-10-22Added and implemented OP_JUMP_ABSAryadev Chavali
Jumps to the operand given, interpreted as a word, an absolute address.
2023-10-22Added NUMBER_OF_OPCODES which aids in compilation errorsAryadev 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-22Added 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-22Cleaned up inst.cAryadev Chavali
Use (H)WORD_SIZE more, added some notes, etc
2023-10-22Functions which convert (h)words to and from bytesAryadev Chavali
Uses memcpy internally, so we don't need to care about endianness.
2023-10-22Changed format of inst_printAryadev Chavali
Prints the opcode then any operands in the following brackets
2023-10-21Implemented opcode_as_cstr for NOT,OR,AND,XOR,EQAryadev Chavali
2023-10-21Helper functions for read/write instructions from darr or FILE*Aryadev Chavali
2023-10-21Switched from floats to halfwordAryadev 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-16Added opcode_as_cstr, opcode_type_as_cstr and inst_printAryadev Chavali
Pretty self explanatory, helps with logging.
2023-10-16Fixed bug with get_opcode_data_typeAryadev Chavali
Pushed the bits one step too far.
2023-10-16Set opcode after reading parameters in inst_read_byteAryadev Chavali
2023-10-16Added functionality to read and write instruction bytecodeAryadev 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.