Age | Commit message (Collapse) | Author |
|
|
|
Currently only for invalid character literals, but still a possible
problem.
|
|
Just takes the character literally as a number.
|
|
|
|
All objects target LIB anyway, so VERBOSE is a universal macro for
this code base.
|
|
Prints useful and pretty messages when verbose being at least 1.
|
|
|
|
This is due to checking for equality instead of just greater than in
darr->used against darr->available.
|
|
Use the push.* instructions to see this.
|
|
Provides calling conventions, ensures parser and lexer are working
correctly. Will be updated as more instructions are introduced and
supported in the assembler.
|
|
|
|
Pretty simple implementation, I've stopped printing the tokens cos I
think the lexer is done.
|
|
Introduced some functions to parse differing types of opcodes. Use
the same style of a.b.c... for namespacing or type specification for
certain opcodes. Bit hacky and not tested, but does work.
Parse errors can be reported with an exact location using the token
column, line.
|
|
Easier to do it here than at the parser.
|
|
Accurate error reporting can be introduced using this.
|
|
Default C just lets overflows occur for subtraction, so this macro
will default to 0 if the subtraction causes an overflow.
|
|
Just prints instructions so far.
|
|
|
|
Though we deal with unsigned numbers internally, it should be possible
to read and manipulate negative numbers through 2s complement. Later
on we'll add support for signed operations via 2s complement, so this
should be allowed.
|
|
This is an easy fix.
|
|
|
|
|
|
|
|
|
|
Doesn't make sense for them to be in the VM module when they have a
more general purpose now.
|
|
Also prints a usage for incorrect usage.
|
|
|
|
|
|
No implementations yet
|
|
|
|
Pretty simple tokeniser, doesn't do a lot and needs to error check better.
|
|
If an empty file is read, we want to deal with it in later user code
rather than just failing immediately.
|
|
|
|
Easier to write includes now just using < with the module name, in
comparison to using relative paths.
|
|
|
|
|
|
|
|
Changed folder names for sake of clarity (will be introducing a new
build target soon), and Makefile can now easily support more targets.
|
|
|
|
Performs a jump when the (BYTE|HWORD|WORD) at the top of the stack is
non zero.
|
|
Checks if the operand given is a well defined program address, then
performs the jump.
|
|
This is because we just OR the bits into the specific byte of the
word. This means the previous state may leave artefacts as the OR
doesn't clear the bits away.
To do so, we apply a bit mask to clear the specified byte(s) of the
word, then perform the OR.
|
|
|
|
First the program, then the registers then the stack.
|
|
Prints an error message, returns a non zero code based on error
code (255 - err).
In main, I propagate this exit code.
|
|
This is simply a program with an embedded set of instructions which
indefinitely computes and prints fibonacci numbers, computing them in
pairs.
Does it completely through the virtual machine rather than just hard C
instructions.
Also amended the Makefile to compile it. Required moving the main.c
object file into the dependencies of $(DIST)/$(OUT).
I should track the dependencies for fib.c and main.c as well.
|
|
Also fixed an overflow error in vm_dup_word, where I underflow the
index of vm->stack.data which causes a buffer overflow.
|
|
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.
|
|
Only happens when vm_print_program(STDERR), as STDERR occurs before
STDOUT on Emacs. So while the lines would print, no instructions
would follow. This fixes that by using fp.
|
|
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).
|