24 Commits

Author SHA1 Message Date
Aryadev Chavali
05136fdd25 Fixed examples for changes in lexer
Name assigned to %CONST is the next symbol in stream, not the symbol
attached to it.
2024-04-16 15:38:24 +06:30
Aryadev Chavali
9bf1d123b8 Changed limit for examples/factorial.asm
Did some analysis and found that 21! takes above 64 bit integers to
store hence set the limit to 20 instead.
2024-04-07 03:40:19 +06:30
Aryadev Chavali
04a27bcfec Use a limit on $I rather than on $B for examples/fib.asm 2023-11-29 23:14:01 +00:00
Aryadev Chavali
fa3ecc0073 Easier to read documentation in examples 2023-11-29 17:00:39 +00:00
Aryadev Chavali
bd6fb54e31 Use constants in examples where possible
Stuff like numeric limits can be codified in constants which act self
documenting.
2023-11-09 08:52:28 +00:00
Aryadev Chavali
dc047fd69b Fixed up example comments and some assembly 2023-11-04 06:40:14 +00:00
Aryadev Chavali
32ee84ef70 Used more subroutines in fib.asm to make code clearer
Looks way more high level but parses down to a very simple bytecode.
However, because of lack of inline code processing, it relies on the
call stack quite heavily.  With inline labels this would be a much
more compact bytecode.
2023-11-03 21:49:40 +00:00
Aryadev Chavali
bc4c57b243 Use label features and entry points for examples 2023-11-03 21:27:18 +00:00
Aryadev Chavali
b4fce03177 Made test.asm an example asm program 2023-11-03 07:55:23 +00:00
Aryadev Chavali
bc3f129093 Updated instruction-test example for removal of jump.register 2023-11-02 20:42:05 +00:00
Aryadev Chavali
753514e9a8 Added MALLOC_STACK and SUB to instruction-test example 2023-11-01 22:57:31 +00:00
Aryadev Chavali
101d7d372d Updated instruction-test example file for new memory management instructions 2023-11-01 22:12:58 +00:00
Aryadev Chavali
6677424f12 Deleted fib.c as fib.asm replaces it 2023-11-01 18:49:59 +00:00
Aryadev Chavali
bfa0a1f85c Implemented a factorial program in the assembly
Very cool, easy, and reads well
2023-11-01 18:12:55 +00:00
Aryadev Chavali
d521871b98 Removed the index printing in fib.asm 2023-11-01 18:12:27 +00:00
Aryadev Chavali
809cc1b26a examples/fib.asm now terminates on a very large bound
This is using the comparators and a jump-if
2023-11-01 17:55:34 +00:00
Aryadev Chavali
0bab4ec014 Made an example translation of fib.c to the custom assembly (fib.asm) 2023-11-01 16:39:07 +00:00
Aryadev Chavali
5d800d4366 Moved inst module to lib
As it has no dependencies on vm specifically, and it's more necessary
for any vendors who wish to target the virtual machine, it makes more
sense for inst to be a lib module rather than a vm module.
2023-10-31 21:14:14 +00:00
Aryadev Chavali
228f548bd9 Changed asm/parser instruction push-reg->push.reg 2023-10-31 20:37:11 +00:00
Aryadev Chavali
7c367f95c9 Added some examples to instruction-test for positive/negative literals
Use the push.* instructions to see this.
2023-10-29 16:56:19 +00:00
Aryadev Chavali
025b26b877 Introduced an example source file for all instructions
Provides calling conventions, ensures parser and lexer are working
correctly.  Will be updated as more instructions are introduced and
supported in the assembler.
2023-10-29 16:56:19 +00:00
Aryadev Chavali
1177a5a45b Auto-fill copyright notice in examples/fib.c 2023-10-29 16:56:19 +00:00
Aryadev Chavali
42ac28d44a Make root directory an include path, set #include's properly
Easier to write includes now just using < with the module name, in
comparison to using relative paths.
2023-10-23 04:46:09 +01:00
Aryadev Chavali
0ac634a9be Reintroduced example fib.c via examples/ folder 2023-10-23 04:25:48 +01:00