Commit Graph

129 Commits

Author SHA1 Message Date
Virgil Dupras 6e1e8e0e59 avra: add LSL 2019-12-22 18:36:15 -05:00
Virgil Dupras 8ded02bc78 avra: fix misordered MOV, MUL, NEG and NOP 2019-12-22 18:35:08 -05:00
Virgil Dupras f54e10f9fd avra: add CALL and JMP 2019-12-22 15:54:46 -05:00
Virgil Dupras 10b925e0e0 avra: add BCLR and BSET 2019-12-22 15:11:15 -05:00
Virgil Dupras 1771ee8da7 avra: add SER 2019-12-22 15:01:08 -05:00
Virgil Dupras 0a9ac27cf6 avra: add SBIC and SBIS 2019-12-22 14:55:38 -05:00
Virgil Dupras a9dcba5793 avra: add CBR instruction 2019-12-22 14:45:10 -05:00
Virgil Dupras c968995ec0 avra: add CBI and SBI
This completes instruction support for the Blink tn45 example.
2019-12-15 20:51:31 -05:00
Virgil Dupras 2652c81519 avra: make CLR work properly 2019-12-15 16:43:32 -05:00
Virgil Dupras aa8df95f7d Add "avr/" includes folder
Also, add a "real world" example in AVRA tests, a blink program on
a ATtiny45. Some instructions are commented out because they aren't
implemented yet, but not many.

The output of the program has been verified against AVRA's own
output.
2019-12-15 09:38:01 -05:00
Virgil Dupras 64935d8b40 avra: add IN and OUT instructions 2019-12-15 08:43:59 -05:00
Virgil Dupras fa75f30ffb avra: add RJMP and RCALL instructions 2019-12-14 12:28:27 -05:00
Virgil Dupras a5efc695e9 avra: add "Rd + bit" instructions 2019-12-14 09:33:46 -05:00
Virgil Dupras c696fcbce4 avra: add "with immediate" instructions 2019-12-14 09:05:38 -05:00
Virgil Dupras 4b9712a224 avra: add branching instructions 2019-12-13 22:49:15 -05:00
Virgil Dupras 57c1a10434 avra: first steps 2019-12-13 17:38:40 -05:00
Virgil Dupras e691dab070 zasm: little drive-by optimization
Use IX directly for argspec rows instead of going through DE. It saves a bit
of processing. The code was this way because I initially didn't use IX at all,
so as code evolved, that DE translation stayed as an artifact.
2019-12-13 10:54:01 -05:00
Virgil Dupras 948a06cb41 tools/tests: add missing doc about shell tests 2019-12-12 16:31:52 -05:00
Virgil Dupras 4f7a05e3b7 core: remove cpHLDE
It wasn't used much, so I replaced its use in the kernel with direct code
and moved the routine in apps/ed, the only other place where it was used.
2019-12-12 15:53:14 -05:00
Virgil Dupras c002c69208 Include tools/tests/shell/test.cfs in repo
The order in which cfspack includes its file depend on the platform. To have
tests that reliably pass, test.cfs has to be committed in.
2019-12-12 14:49:09 -05:00
Virgil Dupras 9ab292a6d5 Add shell automated tests 2019-12-12 14:32:47 -05:00
Virgil Dupras beaea6f978 basic: add puth command 2019-12-09 14:34:14 -05:00
Virgil Dupras d9db0a824e Make makefiles and shell scripts portable
It's no longer required to use `gmake` under OpenBSD and shell scripts
no longer require bash.
2019-12-09 09:45:22 -05:00
Virgil Dupras a680fd3328 basic: add support for signed integers 2019-11-23 14:56:23 -05:00
Virgil Dupras 2f71ad6d2f lib/expr: add left/right shifting operators 2019-11-22 18:35:10 -05:00
Virgil Dupras a03c5ac700 lib/expr: add bitwise operators 2019-11-22 17:16:51 -05:00
Virgil Dupras 972e8221f1 lib/expr: add division and modulo operators 2019-11-22 15:03:16 -05:00
Virgil Dupras 1b01f13105 lib/expr: refactor for easier operator addition 2019-11-22 14:45:12 -05:00
Virgil Dupras 7262993f14 basic: add if 2019-11-21 16:06:14 -05:00
Virgil Dupras f5b04fc02f basic: add expression support to print
Again, same thing as in zasm.
2019-11-18 15:52:44 -05:00
Virgil Dupras 0bd58fd178 basic: parse hex, binary and char literals
Same thing as in zasm.
2019-11-18 15:22:09 -05:00
Virgil Dupras 1cea6e71e0 basic: add a print cmd
It can only print a decimal literal. But still, that's a big step because
I hadn't implemented decimal formatting yet.
2019-11-18 13:40:23 -05:00
Virgil Dupras 019d05f64c Make the shell a userspace app
That's my mega-commit you've all been waiting for.

The code for the shell share more routines with userspace apps than with kernel
units, because, well, its behavior is that of a userspace app, not a device
driver.

This created a weird situation with libraries and jump tables. Some routine
belonging to the `kernel/` directory felt weird there.

And then comes `apps/basic`, which will likely share even more code with the
shell. I was seeing myself creating huge jump tables to reuse code from the
shell. It didn't feel right.

Moreover, we'll probably want basic-like apps to optionnally replace the shell.

So here I am with this huge change in the project structure. I didn't test all
recipes on hardware yet, I will do later. I might have broken some...

But now, the structure feels better and the line between what belongs to
`kernel` and what belongs to `apps` feels clearer.
2019-11-15 15:37:49 -05:00
Virgil Dupras e5255d22f9 zasm: make .org affect "@" symbol 2019-11-15 08:59:26 -05:00
Virgil Dupras 6e714875dc zasm: Constants now override labels at all times
Will be important for a mega-commit I'm preparing.
2019-11-14 21:16:36 -05:00
Virgil Dupras 7cf3ed38da Extract str.asm from core.asm and make core included by userspace
Most of register fiddling routines (which is now the only thing contained
in care.asm) are used by almost all userspace apps, often in inner loops.

That makes the penalty of using jump tables for those a bit too high.
Moreover, it burdens jump tables needlessly.

Because this unit is very small (now that string routines are out), it makes
sense to always include it in binaries.
2019-11-14 10:14:15 -05:00
Virgil Dupras 0e79035d9c Disable test failing on Travis 2019-11-13 22:37:00 -05:00
Virgil Dupras 82995eb346 zasm: have .fill generate an error on overflow
Can possibly avoid a lot of debugging pain.
2019-11-13 22:27:48 -05:00
Virgil Dupras 8d46895dd3 lib/parse: decimal ending with a whitespace are now valid
Also, make empty strings be parsed as invalid by parseDecimal.
2019-11-13 22:10:06 -05:00
Virgil Dupras 1ae51bea3a tests: remove instr blacklist
Because scas isn't used as a reference anymore, no need to blacklist its bugs
anymore.
2019-11-12 20:47:09 -05:00
Virgil Dupras 4de2ce3ceb zasm: add RST instruction 2019-11-12 14:07:45 -05:00
Virgil Dupras 5f6b303e75 zasm: add IX/IY support to SRL, RR and RL 2019-11-10 22:03:18 -05:00
Virgil Dupras 506c3d0a96 zasm: generalize handling of IX/IY in 0xcb upcode family
There's a couple of bit fiddling instructions that didn't have their
IX/IY variant implemented yet and without this commit, each of them
would have required a special routine. Not anymore.
2019-11-10 21:02:18 -05:00
Virgil Dupras d9d6093287 zasm: simplify (IX/Y+d) handling
We now require less special handling.
2019-11-10 20:16:50 -05:00
Virgil Dupras a3c47f6272 Add tests for parseArgs 2019-11-08 10:53:52 -05:00
Virgil Dupras e972dfe220 Add test documentation 2019-11-08 10:37:52 -05:00
Virgil Dupras b745f49186 Rename blockdev's API routines to GetB/PutB
The goal is to avoid mixing those routines with "character devices"
(acia, vpd, kbd) which aren't block devices and have routines that
have different expectations.

This is a first step to fixing #64.
2019-10-30 16:59:35 -04:00
Virgil Dupras a7aa2fc702 Improve test_parse_z coverage
Will help with #45
2019-10-20 18:19:02 -04:00
Virgil Dupras 3b1bbc1751 zasm: support negative displacement for IX/IY
Needed by #30.
2019-10-17 15:38:11 -04:00
Virgil Dupras 8926c33ab1 Fix tools/tests/zasm/runtests.sh shebang
It needs bash after all. On OpenBSD, /usr/sh works, but not on Ubuntu.
2019-10-10 15:22:21 -04:00