1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-08 09:28:06 +11:00
Commit Graph

249 Commits

Author SHA1 Message Date
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
James Stanley
1b8b113536 Fix filesystem in shell emulator
We now treat the block device as fixed-size rather than trying to grow it in response
to kernel activity.

Previously, if you tried to create 2 files in a row, only the first 1 would actually appear,
because the device only ever got larger when a byte was written immediately past the end of
the device.

Now we just let the kernel write bytes to the disk anywhere, so new files can be created even
when the previous file is not completely full.

Also, fix buffer overrun in reading filesystem image, and use a more idiomatic fgetc loop.
2019-12-12 16:58:17 -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
5b155a5c15 tools: use BASIC's new while loop
Also, increase STDIO_BUFSIZE to 0x40 so that those while loops work.
2019-12-12 12:04:56 -05:00
Virgil Dupras
3db38b0d89 basic: add while command 2019-12-12 11:17:10 -05:00
Virgil Dupras
5d33d165a2 cfspack: allow multiple patterns and multiple paths in args
Also, always end the CFS chain with a stop block.

fixes #55 #56 #57
2019-12-11 21:08:46 -05:00
Virgil Dupras
888395d496 tools: replace tools for old shell with tools for new shell
ref #80
2019-12-11 14:58:50 -05:00
Virgil Dupras
25d25d017c Replace old shell with BASIC shell
fixes #80
2019-12-11 14:05:34 -05:00
Virgil Dupras
20151a97f8 recipes/rc2014/zasm: use BASIC shell
Also made Makefile actually portable.
2019-12-11 13:01:51 -05:00
Virgil Dupras
7907687abf tools/uploadb: make it much much faster
By uploading a BASIC loop and then run it, we can reduce the serial
communication to pure content which greatly reduces the overhead and make
the process much much faster.
2019-12-11 09:27:05 -05:00
Virgil Dupras
b40b39f45c tools: add blkdumpb 2019-12-10 10:33:29 -05:00
Virgil Dupras
9ec71ecfee tools/uploadb: rewrite in C 2019-12-09 22:05:39 -05:00
Virgil Dupras
fcee98ee4e tools: use the new "puth" BASIC command 2019-12-09 21:17:45 -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
8ff4b18c51 tools: add memdumpb
In C this time. Python/Perl code is barely terser than C for these little
tools. Why bother with interpreted?
2019-12-08 22:33:33 -05:00
Virgil Dupras
b56d6ca1c7 Rewrite uploadb.py in perl
I know, this is silly, but I'm moving tools to something a bit closer to the
system. I consider perl to be more system-like than python for a simple reason:
perl is part of the OpenBSD base system and python is not.

Also, I'm learning perl and using this as an opportunity.
2019-12-08 08:32:19 -05:00
Virgil Dupras
30a0f69101 Fix broken uploadb.py
putc didn't work well with any byte value on most terminal configuration. It
was a bad idea...
2019-12-02 22:57:22 -05:00
Virgil Dupras
270ad926c9 recipes/sms: use BASIC shell 2019-12-02 20:18:41 -05:00
Virgil Dupras
66dacd1816 tools/emul: add "Min SP" debug value
This gives the maximum size of the stack at any given moment during the
execution of the program. It's useful to figure out if the stack gets
dangerously close to the heap.
2019-12-02 17:44:54 -05:00
Virgil Dupras
2f07d849a8 tools/emul: deduplicate a little bit of C code 2019-12-02 17:28:01 -05:00
Virgil Dupras
572e3566eb Add upload tooling for BASIC shell 2019-11-30 22:36:14 -05:00
Virgil Dupras
871b06fecf bshell: adjust RAMSTART to avoid clashwith USER_CODE
With a 0x4000 RAMSTART, bshell's RAM usage clashed with USER_CODE, making
RAM-using userapp break everything.
2019-11-30 19:50:23 -05:00
Virgil Dupras
7c893dada1 basic: can now execute user apps!
Shell replacement sequence beginning in 3, 2, 1...
2019-11-25 22:05:10 -05:00
Virgil Dupras
12bc120375 basic: add bsel, bseek, getb, putb commands 2019-11-24 20:34:23 -05:00
Virgil Dupras
e1df320d44 basic: add ldbas command 2019-11-24 14:26:32 -05:00
Virgil Dupras
13f935aa88 basic: add fls command
Also, add the new `bshell` emulated tool. BASIC is on its way to replace the
shell.
2019-11-24 10:24:15 -05:00
Virgil Dupras
585e9f3b6e tools/emul: add troubleshooting instructions in README
fixes #79
2019-11-23 15:22:26 -05:00
Virgil Dupras
a680fd3328 basic: add support for signed integers 2019-11-23 14:56:23 -05:00
Virgil Dupras
43b450ca30 Update bootstrap binaries 2019-11-22 19:57:11 -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
cdd0b64570 Modify userspace .org and RAMSTART expectations
Instead of expecting a `USER_CODE` symbol to be set, we expect `.org` to be
set in all userspace glue code. This gives us more flexibility with regards to
how we manage that.

Moreover, instead of making `USER_RAMSTART` mandatory, we make it default to
the end of the binary, which is adequate in a majority of cases.

Will be useful for my upcoming mega-commit... :)
2019-11-15 10:33:13 -05:00