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

186 Commits

Author SHA1 Message Date
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
Clanmaster21
cca3157c66 addHL and subHL affect flags, and are smaller (#30)
* addHL and subHL affect flags, and are smaller

Most importantly, addHL and subHL now affect the flags as you would expect from a 16 bit addition/subtraction. This seems like it'd be preferred behaviour, however I realise any code relying on it not affecting flags would break. One byte saved in addHL, and two bytes saved in subHL. Due to the branching nature of the original code, it's difficult to compare speeds, subHL is either 1 or 6 cycles faster depending on branching, and addHL is between -1 and 3 cycles faster. If the chance of a carry is 50%, addHL is expected to be a cycle faster, but for a chance of carry below 25% (so a < 0x40) this will be up to a cycle slower.

* Update core.asm

* Reworked one use of addHL

By essentially inlining both addHL and cpHLDE, 100 cycles are saved, but due to the registers not needing preserving, a byte is saved too.

* Corrected spelling error in comment

* Reworked second use of addHL

43 cycles saved, and no more addHL in critical loops. No bytes saved or used.

* Fixed tabs and spacing, and made a comment clearer.

* Clearer comments

* Adopted push/pop notation
2019-10-17 16:45:27 -04:00
Virgil Dupras
f806786bd3 zasm: document lack of support for undocumented instructions 2019-10-17 15:52:59 -04:00
Virgil Dupras
3b1bbc1751 zasm: support negative displacement for IX/IY
Needed by #30.
2019-10-17 15:38:11 -04:00
luz.paz
6a635fddd9 Fix misc. source comment typos
Found via `codespell -q 3 -S ./tools -L splitted`
2019-10-09 11:12:08 -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
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
1c6a7caeae recipes/sms/romasm: make zasm's memory usage fit the SMS 2019-07-23 16:50:19 -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
02c7eb0161 zasm: clarify strlen's API 2019-07-23 14:59:38 -04:00
Virgil Dupras
cc7a4bae58 zasm: improve .equ duplicate detection handling
Things are a bit more straightforward now.
2019-07-23 14:00:01 -04:00
Virgil Dupras
9ea72dc1d0 zasm: add separate symbol registry for constants
This will allow me to make the ".org" treatment a bit less murky.
2019-07-23 13:59:55 -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
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
6dbbfa837d apps/ed: add (dummy) line number processing
Starting to feel interactive...
2019-07-13 11:53:30 -04:00
Virgil Dupras
54b0602710 zasm: add support for RES and SET 2019-07-02 14:12:29 -04:00
Virgil Dupras
3a8b5108f7 zasm: make .fill support word arguments 2019-07-01 10:56:03 -04:00
Virgil Dupras
9fb77054c0 Update docs w.r.t. its relationship with scas 2019-06-19 13:34:06 -04:00
Virgil Dupras
7cdc288ef2 zasm: print progress indicator while assembling 2019-06-19 11:42:39 -04:00
Virgil Dupras
6516ff7212 zasm: add support for "XOR n" and "SLA r" 2019-06-18 14:24:43 -04:00
Virgil Dupras
3e7d181d3c zasm: properly raise error on bas ioPutC calls 2019-06-15 20:01:17 -04:00
Virgil Dupras
4327153ffd zasm: fix include EOF detection
That was an interesting bug. It didn't cause a problem in emulation, but
in an RC2014 on an SD card, an include that didn't end with two newlines
would cause an infinite loop.
2019-06-15 15:50:27 -04:00
Virgil Dupras
93981e00eb zasm: fix include line no in error reports
Weren't properly saved during local pass back and forth.
2019-06-14 20:26:39 -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
Virgil Dupras
465da6a79d zasm: add .out directive 2019-06-03 11:13:31 -04:00
Virgil Dupras
04bf2117b2 tools/emul: re-organize .h files
What used to be `tools/emul/user.h` was in fact specific to zasm, so I
moved it there.

To avoid name confusion, I renamed what used to be kernel.h and user.h
to kernel-bin.h and user-bin.h.
2019-06-03 08:12:44 -04:00
Virgil Dupras
21c677a950 Make parseArgs not expect a leading space 2019-06-02 14:46:07 -04:00
Virgil Dupras
f8bd8eeaaf Make userspace parse args the same way the shell does 2019-06-02 14:05:20 -04:00
Virgil Dupras
7c191fd978 fs: standardize file handle routine argument to IX
Using HL/DE was awkward and error-prone.
2019-05-31 14:28:06 -04:00
Virgil Dupras
83771b538f fs: check for file size bounds in GetC 2019-05-31 11:12:29 -04:00
Virgil Dupras
6403ab1acf zasm: add support for SRL r 2019-05-30 14:46:25 -04:00
Virgil Dupras
2c80924df9 zasm: indicate include lineno in errors 2019-05-28 09:57:29 -04:00
Virgil Dupras
8def8e7c38 zasm: add lineno to error reports
For now, top-level only
2019-05-27 20:52:40 -04:00
Virgil Dupras
e414e600ea zasm: add ERR_DUPSYM and ERR_OOM error conditions 2019-05-27 17:45:05 -04:00
Virgil Dupras
b298e607bd zasm: implement error conditions for #inc 2019-05-27 14:21:46 -04:00
Virgil Dupras
31f7c7771d zasm: implement error conditions in .org and .fill 2019-05-27 14:16:40 -04:00
Virgil Dupras
371076190f zasm: implement error conditions in .equ 2019-05-27 14:07:07 -04:00
Virgil Dupras
436ff51c39 zasm: implement error conditions in .dw 2019-05-27 13:52:58 -04:00
Virgil Dupras
f5d4321ece zasm: implement error conditions in .db 2019-05-27 13:44:53 -04:00
Virgil Dupras
d76dd54f4b zasm: add ERR_OVFL 2019-05-27 12:12:21 -04:00