Commit Graph

598 Commits

Author SHA1 Message Date
Jorde Kang 5460f28cfb Removed unnecessary import sys (#46) 2019-10-15 22:41:44 -04:00
James Stanley 7f7251d57f Fix buffer overrun in shell emulator (#51) 2019-10-15 21:21:40 -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
Keith Stellyes 4180b5873d Fix for tools/zasm.sh being dependent on readlink -f (an issue on macOS, preventing builds) (#28)
* Fix for tools/zasm.sh being dependent on readlink -f (an issue on macOS, preventing builds)

* Wrap zasm.sh shebang in /usr/bin/env ; remove comment about BSDs
2019-10-10 15:21:37 -04:00
Clanmaster21 6281e2036f Optimised intoXX functions (#19)
* Optimised intoXX functions

Rewrote intoXX functions to mainly rely on intoHL, as the HL instructions are smaller and faster. Also removed some redundant push and pop instructions. I edited the given unit tests to test these, and they seem to work as expected.

* Doesn't use self-modifying code

The number of bytes is the same as my previous attempt, with 11 more cycles in intoHL, so although I don't feel as clever this time it's still a good optimisation. I found an equivalent method for intoDE, however relying on intoHL still allows for  `ex (sp), hl` to be used in intoIX, which is smaller and faster.

* Update core.asm

* Tried harder to follow coding convention

Added tabs between mnemonics and operands, and replaced a new line I accidentally removed.
2019-10-10 14:44:23 -04:00
Virgil Dupras e259e3d02e
Merge pull request #13 from luzpaz/typos
Fix misc. source comment typos
2019-10-09 19:20:04 -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 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 63d6cf0875 Fix mis-documentation 2019-10-04 13:52:14 -04:00
Virgil Dupras 8db1bdb245 ed: add '.' and '$' support 2019-10-04 13:49:33 -04:00
Virgil Dupras 55be698f61 Pimp up the docs a little bit 2019-10-04 12:05:05 -04:00
Virgil Dupras c96c8e7df0 ed: update curline after a, i and d 2019-07-25 21:24:36 -04:00
Virgil Dupras c839703682 recipes/sms/romasm: ed and zasm, fully functional! 2019-07-25 14:24:18 -04:00
Virgil Dupras 22f9b4f07e kbd: add keypad codes to keycode table 2019-07-25 14:22:17 -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 13028d431e recipes/sms/romasm: limit mmap size
Otherwise, we overflow into the RAM mirror, which means we
overwrite the beginning of the RAM.
2019-07-23 23:01:17 -04:00
Virgil Dupras 4f6c230dc8 mmap: add MMAP_LEN parameter 2019-07-23 23:00:32 -04:00
Virgil Dupras 985d56ca5a core: preserve A in cpHLDE 2019-07-23 22:59:10 -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 af0b6231ca recipes/sms/romasm: make ed's memory usage fit the SMS
Yup, that's ultimately why I've just made this whole big zasm
refactoring in the previous commits. To allow for this.

But also, zasm is in much better shape now...
2019-07-23 16:13:52 -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 ffa28195b1 recipes/sms/romasm: adjust glue to zasm changes
Forward reference of SHELL_MEM_PTR wasn't working (nor should it
have been...).
2019-07-23 15:42:52 -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 518f12b07f sms/vdp: clear 2 lines forward when doing LF
It allows to see much more easily where the action happens on the screen.
2019-07-22 11:03:44 -04:00
Virgil Dupras 87d794d426 recipes/sms/romasm: adjust ed/zasm offsets 2019-07-22 10:11:59 -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 f43241a5a0 kbd: support shifted characters 2019-07-21 17:30:50 -04:00
Virgil Dupras 52e5f5b5bf kbd: simplify code 2019-07-21 16:58:16 -04:00
Virgil Dupras 77d805ea0f shell: allow cmds to be shorter than 4 chars 2019-07-21 15:57:55 -04:00
Virgil Dupras 70a42e8c4d recipes/sms/romasm: first steps 2019-07-21 15:37:03 -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