Commit Graph

122 Commits

Author SHA1 Message Date
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
Virgil Dupras d74b85f146 zasm: allow .org to be specified from command line
Also important for upcoming mega commit...
2019-11-15 09:57:53 -05:00
Virgil Dupras e5255d22f9 zasm: make .org affect "@" symbol 2019-11-15 08:59:26 -05:00
Virgil Dupras 79e04189b0 Update bootstrap binaries 2019-11-14 21:25:11 -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 69750b4da6 Update bootstrap binaries 2019-11-13 22:28:47 -05:00
Virgil Dupras 7274dccbe7 Move ASCII consts to ascii.h
And made them shorter in name. The new ascii.h file allow reuse in userspace
code.
2019-11-13 20:38:06 -05:00
Virgil Dupras f3992ed598 basic: begin an implementation from sratch
Let's see where it will lead us...
2019-11-13 15:28:16 -05:00
Virgil Dupras 4de2ce3ceb zasm: add RST instruction 2019-11-12 14:07:45 -05:00
Virgil Dupras cbc6fb5931 zasm: clean up jump table requirements
There was a little bit of cruft.
2019-11-11 20:21:13 -05:00
Virgil Dupras 2bff486cd2 Update bootstrap binaries 2019-11-10 22:03:46 -05:00
Virgil Dupras 2a55bfd375 stdio: remove a layer of indirection in GetC/PutC
We use zasm's ability to use labels in .equ directive.

We didn't do it before because for a while, we were in between scas
and zasm (scas was used in automated tests) so we needed to use the
lowest common denominator: zasm doesn't have macros and scas can't
use labels in .equ directives.

This forced us to add this layer of indirection. But now that we are
completely cut from scas' dependency, we can use this nice zasm's
ability.
2019-11-04 09:55:12 -05:00
Virgil Dupras a86234c87e Fix typo in shell's emul{Get,Put}C 2019-10-31 18:49:02 -04: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 f41ccdbc81 Update bootstrap binaries 2019-10-17 15:47:39 -04:00
James Stanley 7f7251d57f Fix buffer overrun in shell emulator (#51) 2019-10-15 21:21:40 -04:00
Virgil Dupras 83b314c450 zasm: lower RAM requirements
I've tested RAM usage when self-assembling and there weren't as high
as I thought. zasm's defaults now use less than 0x1800 bytes of RAM,
making it possible, theoretically for now, for a Sega Master System
to assemble Collapse OS from within itself.
2019-10-06 15:42:09 -04:00
Virgil Dupras e4732d79dc zasm: tighten directive detection a bit 2019-10-06 14:39:47 -04:00
Virgil Dupras f4b6c7637d zasm: rename #inc to .inc
scas, it's not needed any more.
2019-10-06 14:32:23 -04:00
Virgil Dupras 340a474941 emul/shell: use '@' symbol in jump table 2019-10-04 20:29:42 -04:00
Virgil Dupras 612323f714 zasm: add "last value" symbol (@) 2019-10-04 20:26:21 -04:00
Virgil Dupras d1735c3a73 zasm: remove last remnants of "old style" variables
This makes zasm suitable to run from ROM.
2019-07-25 14:02:04 -04:00
Virgil Dupras c2d84563dd zasm: allow duplicate const definition
This will allow interesting override scenarios, adding flexibility.
2019-07-23 16:01:23 -04:00
Virgil Dupras 1dec33e02a zasm: make symbol registry a bit more straightforward
Instead of strings of variable length driving the iteration of the
registry, we do so through records that keep track of lengths and
counts.
2019-07-23 15:21:42 -04:00
Virgil Dupras cdb206b7a5 zasm: fix nasty (iy+d) misparsing bug
*sob*...
2019-07-23 13:58:18 -04:00
Virgil Dupras b95f4c8c24 zasm: remove SYM_CTX_PTR 2019-07-22 16:34:40 -04:00
Virgil Dupras f4f91ebd79 zasm: remove SYM_CTX 2019-07-22 16:13:00 -04:00
Virgil Dupras 311d04e9aa zasm: make symbol registry easily parametrizable
I'm about to split the global registry in two (labels and consts)
and the previous state of registry selection made things murky.
Now it's much better.
2019-07-22 15:13:09 -04:00
Virgil Dupras 34f499184d zasm: add ".bin" directive
Also, remove zasm/test7 because it changes too much all time time
(whenever zasm changes) and isn't precise enough. Too much noise,
not worth it.
2019-07-21 12:58:02 -04:00
Virgil Dupras 01031a780a ed: Add 'w' command 2019-07-21 11:40:26 -04:00
Virgil Dupras 942d2a952d ed: take filename as an argument
This hard-binds ed to the filesystem (I liked the idea of working
only with blockdevs though...), but this is necessary for the
upcoming `w` command. We need some kind of way to tell the
destination to write to truncate itself.

This only has a meaning in the filesystem, but it's necessary to
let the file know that its registered file size has possibly
shrunk.

I thought of alternatives that would have allowed me to keep ed
blkdev-centered, but they were all too hackish to my own taste.

Hence, this new hard-bind on files.
2019-07-20 19:43:07 -04:00
Virgil Dupras fe15bafeca zasm: fix bug with registry selection
During expression parsing, if a local label was parsed, it would
select the local registry and keep that selection, making
subsequent global labels register in the wrong place.
2019-07-20 18:07:52 -04:00
Virgil Dupras eefadc3917 ed: add support for 'a' and 'i' 2019-07-14 17:35:21 -04:00
Virgil Dupras e0f2a71dfc apps/ed: print specified line 2019-07-13 14:01:20 -04:00
Virgil Dupras 237d04fefd zasm: update bootstrap bin 2019-07-13 11:54:47 -04:00
Virgil Dupras 3491c26132 apps/ed: start implementing I/O 2019-07-13 11:29:06 -04:00
Virgil Dupras 3d474c9121 apps/ed: first steps 2019-07-13 09:57:37 -04:00
Virgil Dupras 252d71f1b8 Make tools/emul *BSD-friendly 2019-07-11 21:21:54 -04:00
Virgil Dupras ff7a114736 zasm: update bootstrap bin 2019-07-02 14:12:49 -04:00
Virgil Dupras 63486126ef zasm: update bootstrap bin 2019-07-01 10:56:38 -04:00
Virgil Dupras d6b391e39a Update bootstrap binaries 2019-06-19 13:22:51 -04:00
Virgil Dupras 7cdc288ef2 zasm: print progress indicator while assembling 2019-06-19 11:42:39 -04:00
Virgil Dupras 3bc165c8f6 Update bootstrap bin 2019-06-15 20:54:27 -04:00
Virgil Dupras 3e7d181d3c zasm: properly raise error on bas ioPutC calls 2019-06-15 20:01:17 -04:00
Virgil Dupras 7ba8e85a4a Update bootstrap binaries 2019-06-15 15:53:03 -04:00
Virgil Dupras b742d48b75 Update bootstrap binaries 2019-06-05 19:52:56 -04:00
Virgil Dupras 3dde51ae98 Allow file-to-file compilation in the emulated shell 2019-06-05 19:51:19 -04:00
Virgil Dupras fc81bce70f Fix error handling when writing to files in emulated shell 2019-06-05 16:13:15 -04:00
Virgil Dupras c18d42f08b fs: further adjust to previous blkdev refactoring
Previous refacoring broke all seek/tell within fs. fs handles now lost
the responsibility to keep track of current position. It's blkdev's job.
2019-06-04 20:45:01 -04:00
Virgil Dupras ae028e3a86 blockdev: make implementors "random access"
This huge refactoring remove the Seek and Tell routine from blockdev
implementation requirements and change GetC and PutC's API so that they
take an address to read and write (through HL/DE) at each call.

The "PTR" approach in blockdev implementation was very redundant from
device to device and it made more sense to generalize. It's possible
that future device aren't "random access", but we'll be able to add more
device types later.

Another important change in this commit is that the "blockdev handle" is
now opaque. Previously, consumers of the API would happily call routines
directly from one of the 4 offsets. We can't do that any more. This
makes the API more solid for future improvements.

This change forced me to change a lot of things in fs, but overall,
things are now simpler. No more `FS_PTR`: the "device handle" now holds
the active pointer.

Lots, lots of changes, but it also feels a lot cleaner and solid.
2019-06-04 15:36:20 -04:00