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
0237ff105f
ed: fix 'd' going crazy when deleting last lines of buf
2019-07-21 19:43:45 -04:00
Virgil Dupras
0fd16a0bb6
ed: fix boken 'a' and 'd' cmds
2019-07-21 19:32:24 -04:00
Virgil Dupras
421d881fae
ed: allow inserting in empty file
2019-07-21 15:06:03 -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
f6479486f2
ed: allow appending at the end of the file
2019-07-21 11:12:49 -04:00
Virgil Dupras
8d7abd9994
ed: fix broken buf insert logic
2019-07-21 10:53:11 -04:00
Virgil Dupras
1a5a1b9861
ed: make scratchpad memory only
...
The dual scraptchpad thing doesn't work. Things become very
complicated when it's time to write that back to the file. We
overwrite our contents and end up with garbage.
2019-07-21 10:45:58 -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
77a23cee84
ed: fix bufDelLines logic
...
It was mostly wrong.
2019-07-14 16:18:33 -04:00
Virgil Dupras
5669884508
ed: read initial contents in bufInit
2019-07-14 12:19:37 -04:00
Virgil Dupras
3b0029335a
ed: add README
2019-07-14 11:31:14 -04:00
Virgil Dupras
8af1cf468c
ed: add 'd' cmd
2019-07-14 10:32:28 -04:00
Virgil Dupras
50d0dc982c
ed: check addr bounds
2019-07-14 09:04:51 -04:00
Virgil Dupras
c811d5330c
apps/ed: add support for addr ranges
2019-07-13 22:09:17 -04:00
Virgil Dupras
2d9f74c2af
apps/ed: refactoring
2019-07-13 21:08:16 -04:00
Virgil Dupras
8cf68dc7ad
apps/ed: handle +[n] and -[n] addresses
2019-07-13 16:30:30 -04:00
Virgil Dupras
951dd2206d
apps/ed: add the concept of "current line"
2019-07-13 15:28:44 -04:00
Virgil Dupras
e0f2a71dfc
apps/ed: print specified line
2019-07-13 14:01:20 -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
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
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
5e31de0bac
apps/memt: new app
2019-06-16 20:53:21 -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
92a04f4627
sdc: support 24-bit addressing
...
Needed if we want to compile the kernel and zasm from within a SD card.
I didn't go straight for 32-bit because it was significantly more
complex and 24-bit give us 16M. Enough to go on for a while...
2019-06-15 13:41:20 -04:00
Virgil Dupras
e7c07cdd9a
apps/at28w: fix argument byte order
2019-06-14 21:11:45 -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
c613f7b0ee
recipes/rc2014/eeprom: fix broken a28w args passing
...
That's why the command seemed slow! It's much faster than I thought.
2019-06-14 16:30:01 -04:00
Virgil Dupras
817636242a
Add at28w app and recipe
...
This allows us to write to an AT28 EEPROM from within collapse os.
2019-06-14 14:15:30 -04:00
Virgil Dupras
145b48efb7
Add apps/sdct
...
A new app to stress test the SD card driver. Also, accompanying this
commit, changes solidifying the SD card driver so that stress tests
actually pass :)
2019-06-10 15:54: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
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
Virgil Dupras
f9118ef88e
xasm: expand ERR_BAD_ARG condition
2019-05-27 12:05:42 -04:00
Virgil Dupras
e1e6d52fea
zasm: add ERR_BAD_FMT
2019-05-27 11:58:12 -04:00
Virgil Dupras
412b3f374a
zasm: add ERR_BAD_ARG
2019-05-27 11:22:38 -04:00
Virgil Dupras
af2c561c6b
zasm: begin erroring out reliably
...
Up until now, invalid source input had undefined behavior. We're now
beginning to define that behavior so that zasm can be a bit more usable.
2019-05-27 11:04:31 -04:00
Virgil Dupras
976a93971c
zasm: improve docs
2019-05-27 10:38:29 -04:00
Virgil Dupras
c40bc329d5
zasm: fix expr returning wrong values on first pass
...
To run a parseExpr on first pass would always return a false success
with dummy value because symbols are configured to always succeed on
first pass. This would make expressions like ".fill 0x38-$" so bad
things to labels because "0x38-$" wouldn't return the same thing on
first and second pass.
Revert to parsing literals and symbols after having scanned for
expressions and add a special case specifically for char literals (which
is why we scanned for literals and symbols first in the first place).
2019-05-20 10:46:27 -04:00
Virgil Dupras
e18f9b53a9
zasm: add support for "$" symbol
...
Allows for the ".fill x-$" pattern.
2019-05-20 09:17:50 -04:00
Virgil Dupras
848a7500bc
zasm: add support for .fill directive
2019-05-20 08:39:53 -04:00
Virgil Dupras
acddb045a5
zasm: add support for .org directive
2019-05-19 14:40:42 -04:00
Virgil Dupras
bc1496a7e3
zasm emul: bring back kernel/user distinction
...
It was a bad idea to remove it. Now that I'm introducing the concept of
a per-app glue file, it becomes much easier to build emulated zasm as a
userspace app.
2019-05-19 12:57:59 -04:00
Virgil Dupras
7fad3b0c90
Move /parts/z80 to /kernel
...
Let go of that "meta os" thing. it's not as meta as I made it sound
like. It's a kernel.
2019-05-19 11:19:41 -04:00
Virgil Dupras
78d9764005
zasm: can now assemble zasm/expr.asm!
2019-05-19 10:45:11 -04:00
Virgil Dupras
6cbce0533a
zasm: can now assemble zasm/instr.asm!
2019-05-19 10:40:45 -04:00
Virgil Dupras
ea8477bb91
zasm: accept whitespaces before separating comma
2019-05-19 10:39:29 -04:00
Virgil Dupras
3b1ef2b9af
zasm: bump global symbol limit to 0x200
2019-05-19 09:54:42 -04:00
Virgil Dupras
44abc79850
zasm: add support for SBC HL, ss
2019-05-19 09:54:02 -04:00
Virgil Dupras
d9fff16157
zasm emul: get rid of the kernel/user distinction
...
Made things complicated for nothing.
2019-05-19 09:14:40 -04:00
Virgil Dupras
98695f9912
zasm: de-index symRegister
...
Make symRegister's logic pointer-based so we can break through the 0x100
limit.
2019-05-19 09:06:24 -04:00
Virgil Dupras
c01816b055
zasm: make instr a bit more zasm-friendly
...
But we're still at a certain distance from assembling it with zasm:
we're busting the 0x100 symbol limit.
2019-05-18 21:07:35 -04:00
Virgil Dupras
bccf933ea9
zasm: try for regular number or symbol before parsing expr
...
Previously, we would mess up literals like '-'.
2019-05-18 21:06:31 -04:00
Virgil Dupras
723497af69
zasm: can now assemble zasm/directive.asm!
2019-05-18 20:37:34 -04:00
Virgil Dupras
9f6ebf538d
zasm: can assemble zasm/tok.asm!
2019-05-18 20:31:52 -04:00
Virgil Dupras
fd11941867
zasm: can now assemble zasm/parse.asm!
2019-05-18 19:59:58 -04:00
Virgil Dupras
2ce6b61964
zasm: add support for RLC r and RRC r
2019-05-18 19:59:31 -04:00
Virgil Dupras
29f0bcbe23
zasm: can now assemble zasm/symbol.asm!
2019-05-18 18:56:27 -04:00
Virgil Dupras
84090dcd14
zasm: add support for RL r and RR r
...
Also, make zasm assemble zasm/util.asm again!
2019-05-18 15:41:21 -04:00
Virgil Dupras
d47d07757e
zasm: fix expr operator priority
2019-05-18 15:17:56 -04:00
Virgil Dupras
068e4327ec
zasm: fix false truncation error on "-" expressions
2019-05-18 14:51:11 -04:00
Virgil Dupras
650eec23de
zasm: add LD r, (IX/Y+d) support
2019-05-17 23:01:29 -04:00
Virgil Dupras
f44c3e5413
zasm: fix 3-digit hex parsing
2019-05-17 23:00:57 -04:00
Virgil Dupras
cdb6cce914
zasm: add multiplication expressions
2019-05-17 22:22:10 -04:00
Virgil Dupras
157ac03e25
zasm: can now assemble zasm/util.asm!
2019-05-17 20:47:43 -04:00
Virgil Dupras
28d5ebdc8a
Make apps folder into a namespace
...
To straighten out includes and to pave the way into zasm being part of
the same "include CFS" as parts, we make zasm includes namespaced.
2019-05-17 20:22:32 -04:00
Virgil Dupras
ae2187ad06
zasm: avoid ';' literal
...
Simplifies comment stripping through sed.
2019-05-17 19:49:37 -04:00
Virgil Dupras
d58cf122a8
zasm: fix regression with lowercase (ix+d) parsing
2019-05-17 19:32:58 -04:00
Virgil Dupras
2a97966bdc
zasm: add LD IX/IY, NN instructions
2019-05-17 17:43:42 -04:00
Virgil Dupras
21c49d80cf
zasm: allow single quote to contain whitespace
2019-05-17 17:22:16 -04:00
Virgil Dupras
40d5530666
zasm: allow expression in .db
2019-05-17 17:21:49 -04:00
Virgil Dupras
556be3f0ce
zasm: allow for whitespace inside string literals
...
Also, increase scratchpad size. It wasn't big enough for some
expressions in shell unit.
2019-05-17 16:44:08 -04:00
Virgil Dupras
f9dac15449
zasm: add support for string literals in .db
2019-05-17 16:17:22 -04:00
Virgil Dupras
16922da3d4
zasm: support multiple elements in .dw and .db
2019-05-17 15:39:28 -04:00
Virgil Dupras
b0318f4891
zasm: make instr unt write directly to ioPutC
...
Couldn't get rid of instrUpcode though, too complicated.
2019-05-17 15:35:49 -04:00
Virgil Dupras
26d6dd1912
zasm: remove direcData buffer
2019-05-17 15:14:38 -04:00
Virgil Dupras
ad7428e471
zasm: make io unit handle PC and output suppression
2019-05-17 14:58:16 -04:00
Virgil Dupras
6547e83f20
zasm: improve comma processing
...
We don't treat "," exactly as a whitespace anymore. We have specific
processing for it.
2019-05-17 14:34:38 -04:00
Virgil Dupras
3a91e9eb46
zasm: add support for PUSH/POP IX/IY
2019-05-17 14:00:37 -04:00
Virgil Dupras
c1b09123f1
zasm: add support for RETI and RETN
2019-05-17 13:21:49 -04:00
Virgil Dupras
072aad775a
zasm: don't match prefixes in symFind
...
Only match when full names match.
2019-05-17 13:14:16 -04:00
Virgil Dupras
92a119105d
zasm: add support for "0b" literals
2019-05-17 10:34:01 -04:00
Virgil Dupras
0f5fab23e9
zasm: don't accept "0X" prefix for hex anymore
...
This was only necessary in the time where input was upcased right after
reading.
2019-05-17 10:03:36 -04:00
Virgil Dupras
4075c90d44
Add unit test for zasm's parse unit
2019-05-17 10:00:30 -04:00
Virgil Dupras
7083116379
zasm: remove JUMP_ prefixes
...
They serve no purpose and make the code less flexible.
2019-05-17 09:50:11 -04:00
Virgil Dupras
2f0dd5d668
zasm: iiiiiiiincluuuuuuudes!!1!
2019-05-16 21:15:00 -04:00
Virgil Dupras
22c7eeaa5d
Move apps/zasm/tests to tools/tests/zasm
...
This 'apps' folder is going to disappear. Everything is going to be a
"part" to be assembled through recipes. 'apps' has no meaning.
2019-05-16 11:23:15 -04:00
Virgil Dupras
0ae91e55ec
zasm: big local symbols overhaul
2019-05-16 08:26:00 -04:00
Virgil Dupras
e9244b80ee
zasm: big I/O overhaul
...
Instead of buffering input in memory one line at a time, we go in "just
in time" mode and always read contents directly from I/O, without
buffering.
It forces us to implement a `ioPutback` scheme, but on the other hand it
greatly simplifies cases where multiple tokens are on the same line
(when a label is directly followed by an instruction).
The end result feels much more solid and less hackish.
2019-05-16 07:53:42 -04:00
Virgil Dupras
34ff0a6c2a
zasm: consolidate code
2019-05-15 15:27:33 -04:00
Virgil Dupras
a2b5b1efab
zasm: add one layer of indirection in symbol registry
...
We'll need it for an upcoming "local labels" registry.
2019-05-15 14:30:41 -04:00
Virgil Dupras
fa28d64278
zasm: change ioRewind to ioSeek
...
Will need it soon.
2019-05-15 13:41:56 -04:00
Virgil Dupras
33a1ee250d
zasm: rename curOutputOffset to ZASM_PC
2019-05-15 13:31:49 -04:00
Virgil Dupras
a994867a86
Wohoo! zasm assembles core.asm!!!
2019-05-14 16:50:35 -04:00
Virgil Dupras
b0218349ff
zasm: support multiple instructions on single line
2019-05-14 16:45:56 -04:00
Virgil Dupras
1010e8372c
zasm: add support for subtractions in expressions
2019-05-14 16:39:10 -04:00
Virgil Dupras
67803f6cb5
zasm: don't upcase char literals
2019-05-14 15:42:15 -04:00
Virgil Dupras
72d2a8f073
zasm: add support for + expressions
2019-05-14 15:26:29 -04:00
Virgil Dupras
99a7c94c9f
zasm: make "double parsing" a bit more solid
...
It was previously skipped on a local label.
2019-05-14 14:35:34 -04:00
Virgil Dupras
7972b92be1
zasm: refactoring
2019-05-14 14:32:12 -04:00
Virgil Dupras
2c0166814f
zasm: support inline labels
...
That is, labels with code following right afterwards.
2019-05-14 14:10:20 -04:00
Virgil Dupras
a486a2a81e
zasm: support char literals
2019-05-14 13:53:12 -04:00
Virgil Dupras
2de69ee7cd
zasm: add support for local labels
2019-05-13 20:23:10 -04:00
Virgil Dupras
17dbee6a49
zasm: deduplicate code
2019-05-13 19:47:34 -04:00
Virgil Dupras
746c86cbf8
zasm: make getSymVal not responsible for calling symFind
...
With local labels, these two will have to be decoupled.
2019-05-13 16:53:52 -04:00
Virgil Dupras
c9deac599e
zasm: add support for LD r, r' instructions
2019-05-13 16:38:09 -04:00
Virgil Dupras
878bc2919f
zasm: add support for relative labels
2019-05-12 22:07:21 -04:00
Virgil Dupras
1e3982d3ab
zasm: make DE indicate the last line to be read
...
Facilitates debugging
2019-05-12 21:44:59 -04:00
Virgil Dupras
dd6fa5d38b
zasm: properly propagate error conditions
...
Gives clearer output on errors. Easier debugging...
2019-05-12 21:31:11 -04:00
Virgil Dupras
86cad39de4
zasm: fix wrong logic in .numberTruncated error condition
...
`xor c` didn't do what I thought it did at the time. Newbie mistake,
there are probably a lot like this scattered around...
2019-05-12 21:23:24 -04:00
Virgil Dupras
d6f5cf5b90
zasm: fix first pass inversion bug
...
Also, confirm in tests that we can refer to other symbols in `.equ`.
2019-05-12 08:50:29 -04:00
Virgil Dupras
89848dbfe2
zasm: add support for .equ
2019-05-11 22:11:05 -04:00
Virgil Dupras
6d4515cd03
zasm: little code reorganisation
2019-05-10 21:19:34 -04:00
Virgil Dupras
95f53d0ce3
zasm: support symbols in .dw directive
2019-05-10 21:17:19 -04:00
Virgil Dupras
c000d5cfb1
zasm: support forward label references!
2019-05-10 21:14:46 -04:00
Virgil Dupras
c239ec7dea
zasm: read input in two passes
2019-05-10 20:32:05 -04:00
Virgil Dupras
34ee91a0d7
zasm: use blkdev IDs as input and output
...
This will soon allow use to seek and tell on input, which is necessary
for a second pass which is necessary for forward symbol references.
This require making `blkSel` a bit more flexible. Rather than having one
global selected blkdev, each app can select its own, in its own memory
space.
2019-05-10 19:33:34 -04:00
Virgil Dupras
5a6078df4d
zasm: add support for hex literals
2019-05-09 22:14:11 -04:00
Virgil Dupras
b87feac785
zasm: add support for labels!
2019-05-09 21:21:08 -04:00
Virgil Dupras
1c17dcb7a2
zasm: consolidate code
2019-05-09 15:55:29 -04:00
Virgil Dupras
d34aff67bb
zasm: Read from and write to streams instead of memory
2019-05-09 15:36:03 -04:00
Virgil Dupras
7f27d63c19
Move apps/zasm/emul to tools/emul
2019-05-09 14:09:40 -04:00
Virgil Dupras
f9ae5ca46b
zasm: simplify readWord calling
...
It always reads in the scratchpad with the same max size. No need for
DE-dancing anymore.
2019-05-01 14:19:43 -04:00
Virgil Dupras
6811d98618
zasm: add support for the ".dw" directive
2019-05-01 14:07:01 -04:00