Commit Graph

1672 Commits

Author SHA1 Message Date
Virgil Dupras 2fa88176c0 VE: don't emit chars higher than 0x7f
Uninitialized blocks often contains garbage, and emitting it on
the TRS-80 4P results in serious visual glitches.
2020-12-22 18:34:03 -05:00
Virgil Dupras 20c38e5cd0 trs80: implement Grid shim in video driver
Loading the grid subsystem on top of the TRS-80 driver, which is
an interface to its ROM BIOS, would be counter-productive because
the BIOS already has the concept of cursor.

However, VE needs the Grid interface, so we implement a shim for it.

Again, all this work (and the re-assembly that it entails) has been
done from within Collapse OS on the TRS-80!
2020-12-22 18:24:30 -05:00
Virgil Dupras 625afba86a VE: avoid spitting control chars in "bufp"
On a TRS-80 4P, spitting control chars, in addition to being
visually distasteful, generated a bug where the blinking cursor
would disappear, making using VE much, much harder.

I had a hard time reproducing the bug: you don't trigger it by
simply spitting control chars, it had to be a specific number of
them in a specific order. I didn't identify the sequence, but I
know that "bufp" triggered it.

This commit was written on a TRS-80 4P and downloaded from my work
floppies!
2020-12-21 17:02:36 -05:00
Virgil Dupras 8992cdbbf6 tools: add "blkdown" tool
When developing from a Collapse OS environment, it's necessary to
be able to download blocks from it.
2020-12-21 17:02:36 -05:00
Virgil Dupras 45fbce4eb9 tools/blkunpack: add "upto" argument 2020-12-21 17:02:36 -05:00
Virgil Dupras efa2556c82 tools/blkup: add shortcut for zero blocks 2020-12-17 20:19:12 -05:00
Virgil Dupras da72d7bbe1 doc: add TRS-80 4P keyboard cheat sheet 2020-12-17 15:32:13 -05:00
Virgil Dupras 40b41d296c tools/upload: send data as string hex to avoid control characters
So far, I've been using this tool on remotes that had no control
character handling, but it doesn't work on a TRS-80 4P remote.

Much slower, but at least it works.

Later, I'll try to put some order in this so that we use the fast
lane when possible.
2020-12-16 16:52:54 -05:00
Virgil Dupras f0087cd48e Revert "tools: make upload a bit faster"
This optimisation appears to make the upload process unreliable in
some cases. I can't appear to reliably upload to my TRS-80 with this
version. I prefer reliability than speed...
2020-12-16 12:44:29 -05:00
Virgil Dupras 63d2c97386 z80 asm: document the 0x8000 limitation better
When I get bitten by it myself, it's because it's clearly
underdocumented!
2020-12-14 14:40:22 -05:00
Virgil Dupras 8c89fc147c tms9918: fix character range which was too narrow
We couldn't get a tilde!
2020-12-12 17:28:32 -05:00
Virgil Dupras 35dca04ec9 doc/sms/at28: add note about CE-inhibit jumper 2020-12-12 10:47:30 -05:00
Virgil Dupras 7dae33ce36 rc2014: add SIO xcomp unit 2020-12-12 10:08:16 -05:00
Virgil Dupras 2571d20c4c tools: make upload a bit faster 2020-12-12 10:06:55 -05:00
Virgil Dupras 94f5b9d141 doc: add notes about cross-compiling directly to EEPROM
I've tested that it works in emulation. The only test left is the
real deal my a Sega Master System.
2020-12-11 21:52:46 -05:00
Virgil Dupras 374a0a8e46 doc: update AT28 instructions for new ~AT28 routine 2020-12-09 20:44:04 -05:00
Virgil Dupras cbd9f035ae Add ~C!ERR
A ~C! override can, if it wants, go put an error code in there,
which ~AT28 does.

This way, after a copy or xcomp process directly to EEPROM, one
can verify whether all bytes were successfully written by checking
whether "~C!ERR C@" is zero.
2020-12-09 19:52:58 -05:00
Virgil Dupras dda80801d5 Remove WORD( and PREV
They're only used once.
2020-12-09 17:46:22 -05:00
Virgil Dupras 594b3c3348 Add ~C! to override memory low level write routines
Also, turn AT28! and AT28, into ~AT28, pluggable into ~C!.

~AT28 doesn't check for mismatches. It was too complicated to turn
a mismatch into a compiled word we would jump to next. Data
integrity has to be checked through another path.

Also, remove MOVEW. Without indirect memory access, this word
doesn't make sense. Some AVR-specific words will have to be
defined.
2020-12-08 21:55:39 -05:00
Virgil Dupras 953e040231 emul/z80: add AT28 EEPROM emulator
This will facilitate the development of a solution for
cross-compiling directly to EEPROM.
2020-12-08 20:07:53 -05:00
Virgil Dupras 74f46c1288 z80a: add ELSE, 2020-12-07 23:06:12 -05:00
Virgil Dupras 45eceaaf61 Remove indirect memory access
I got bitten again, I've over-designed my solution. The last time
it happened, it was that memory mapping thing I was wanting to add.

The indirect memory access feature I was adding was to solve a
specific problem: Allow Collapse OS to cross-compile directly on a
AT28 EEPROM.

It began well. As long as we were staying in the assembler realm,
things were looking good. However, when we got into the xcomp realm
(B260), things became ugly, and I had to creep up indirection where
I didn't want to.

All of this because I wanted to solve my initial problem in a
slightly more generalized way. The broad idea was that these indirect
memory access could allow xcomp into a broad kind of memory-like
devices.

This idea broke on the "@" part of the equation. If I want
indirections to be two-way and allow xcomp to work properly, I have
to add this indirection to FIND (and possibly others) and this just
isn't practical or elegant.

So, I'm taking a step back and accepting that the solution I design
for now is exclusively for the AT28. What I'm thinking is to add a
low-level hook for memory writing, at the assembly level.
2020-12-07 22:34:53 -05:00
Virgil Dupras 80d1b59050 Add words |M and |L
Splitting a word into MSB/LSB pairs happens often and is worth, I
think, native words. Also, I'm going to need it in the upcoming
commits.
2020-12-07 20:11:49 -05:00
Virgil Dupras 55a7726f70 Have FILL use indirect memory access
This allows SMS xcomp to use ALLOT0 instead of ZFILL,
2020-12-07 19:17:51 -05:00
Virgil Dupras e5a983ab7f Rename A!, A@ and A, to C!*, C@* and C,*
Also, rename "Addressed devices" to "Indirect memory access".

I do this because I need to add indirect versions of !, @ and ,
to allow boostrapping directly to EEPROM and that A,, thing I've
added to assemblers felt like really bad names.

With this change, I'd like to generalize the use of the * suffix
for aliases.
2020-12-07 19:06:58 -05:00
Virgil Dupras c5bf0ade1b Use A! instead of C! in THEN, in z80 and 8086 assemblers 2020-12-07 12:32:32 -05:00
Virgil Dupras 06b71a6906 Add AT28, as a companion to AT28!
This word, suitable to plug to A, , increases HERE before doing its
verification to minimize waiting time: While we increase HERE, the
AT28 has the time to do its programming, and thus we'll need to idle
for less time afterwards.

Also, made the mismatch check silently ignore MSB. Previously, writing
a value larger than 0xff with AT28! would always result in a mismatch.
2020-12-07 12:28:48 -05:00
Virgil Dupras 1e8f957910 emul/trs80: implement floppy emulation
So far, only the first 400 sectors of the disk image are accessible.

TODO: add keybindings to swap floppies on the emulated machine.
2020-12-06 19:52:18 -05:00
Virgil Dupras bb8d66a425 doc/hw/z80/sms: add Dual EEPROM cartridge design 2020-12-06 15:44:45 -05:00
Virgil Dupras 23885dac33 emul: add TRS-80 emulator
Not complete yet, but has @KEY and @DSP, enough to get prompt.
2020-12-05 22:04:22 -05:00
Virgil Dupras b12ac4b672 doc: fix PS/2 recipe
During the recipe overhaul, I forgot to carry PS/2 schematics over.
Also, the recipe should go in hw/z80 because it's specific to Z80.
2020-12-05 19:48:38 -05:00
Virgil Dupras e8cc3040d1 Improve impl's word execution documentation
Add an example, which I think helps a lot to grasp the idea.

Also, improve comments in Z80 boot code.
2020-11-28 13:15:16 -05:00
Virgil Dupras 038ca61ea5 Fix broken tools makefile 2020-11-28 11:31:27 -05:00
Virgil Dupras db1d6424b3 Rename (print) to STYPE
This brings us a bit closer to TYPE from Forth 2012. I don't think
I'll add TYPE (sig "addr len") anytime soon because there is few
use cases for it, but having "STYPE" instead of "(print)" feels
cleaner.
2020-11-28 11:28:28 -05:00
Virgil Dupras b48455e4db Improve initialization sequence documentation 2020-11-28 11:17:50 -05:00
Virgil Dupras f8b7a3ce65 Rename switch to ialias
The switch name was confusing.
2020-11-28 10:58:16 -05:00
Virgil Dupras b4f3fde062 sms: generate TMR SEGA signature in Collapse OS itself
Having the signature generation code in /tools prevents self-hosting
on the SMS.
2020-11-25 21:42:07 -05:00
Virgil Dupras 631e7f1008 tools/exec: fix segfault 2020-11-17 17:02:10 -05:00
Virgil Dupras 959382c079 sms: implement (spix) in z80 asm
Doing SPI bit-banging through a controller port is already really
slow, but doing so with the Forth version of (spix) was really,
really slow.

With this pure z80 version of (spix), it's more bearable.
2020-11-17 17:01:49 -05:00
Virgil Dupras 4d26f1c490 VE: try to use CELL! more
At-XY+EMIT is slow compared to direct CELL! usage. It is seen very
clearly on a SMS when VE is doing its initial clrscr (yes, I could
manage to load VE from a SD card and run it on a real SMS!).

The grid protocol wasn't there when I wrote VE initially. I only had
AT-XY. Now that we have a solid protocol to build on, let's do it.
2020-11-17 12:07:22 -05:00
Virgil Dupras 224e9183fb cvm: fix NEWLN behavior
I hadn't noticed yet, but making CVM use the Grid subsystem made
me lose scrolling. It's fine because that scrolling was "artificial"
in the sense that it was provided by curses, not Collapse OS and I
prefer having something that closer emulates a real machine.

However, CVM didn't properly clear the new line when entering it.
Fixed.

Scrolling behavior will come back when it's implemented in the Grid
subsystem.
2020-11-17 11:52:54 -05:00
Virgil Dupras eab8ab6f60 Fix "," char in 5x7 font 2020-11-17 11:24:51 -05:00
Virgil Dupras 30da1bd75b grid: fix PSP leak on newline 2020-11-17 11:19:37 -05:00
Virgil Dupras 57fd14b0b3 sms: fix cursor mis-display in text mode
In CURSOR!, I was using a write commande to read from VRAM and the
emulator didn't properly behave and did as if everything was fine.

The result on a real SMS was that the cursor would contain the
inverted glyph of the contents of the *old* cursor position.
2020-11-16 13:10:04 -05:00
Virgil Dupras c8be290b88 sms: add cursor indicator to text mode
I do this by adding an inverted version of all glyphs in the upper
range of the pattern memory. This is a big waste of the pattern
space (only one inverted character is needed at once), but it's the
simplest way to proceed. I'll change this if I ever need more
pattern space.

Also, remove _blank. It was wastefully blanking the whole memory.
Only the name table needs to be blanked on initialization.
2020-11-16 11:13:38 -05:00
Virgil Dupras cf79ceefea sms: add cursor visual indicator in VDP mode 4
This required the change of CURSOR! signature: we now supply it
with both old and new cursor positions.

Also, fix broken _bs in Grid subsystem.
2020-11-16 10:05:48 -05:00
Virgil Dupras 74d2a5d722 sms: use CELL! directly in Pad driver 2020-11-16 09:19:55 -05:00
Virgil Dupras b1e162b8a3 grid: change the meaning of CELL!
Replace the "g" arg (glyph) with "c" (character). The reason why "g"
was used was to save a "0x20 -" operation at all CELL! implementations,
but this came with too big a drawback: it made CELL! hardly usable
outside of the Grid subsystem, mostly because the user of CELL! would
often have to do "0x20 -".

For example, I want the SMS's Pad driver to use CELL! directly instead
of having to do EMIT+XYPOS-messing-around. I would have had to do a
"0x20 -" there.
2020-11-16 09:11:47 -05:00
Virgil Dupras 7bfec5d9e9 grid: Add CURSOR! to the grid protocol
With the move of CVM's forth to the grid protocol, we've lost the
cursor's visual indication. Now, we have it back.

The challenge now is in implementing it in SMS' text mode. In mode
4, it's easy to mark a cell as inverted, but in text mode, that's
not possible.
2020-11-16 08:41:09 -05:00
Virgil Dupras d3049b2404 grid: add XYMODE
In VE on the SMS, the first contents line would always be cleared
because of NEWLN being called when the FBUF would spit its last
char. Inconvenient...

I've added a "graphical" mode to the grid subsystem to inhibit this
behavior in a graphical situation such as in VE.

Also, write a more complete Grid documentation.
2020-11-14 22:35:08 -05:00