Commit Graph

35 Commits

Author SHA1 Message Date
Virgil Dupras 0f83451193 trs80: Improve RS-232 driver
I could drive my RC2014 from my TRS-80 4P (using the Remote Shell
coming in the next commit)! A challenge I faced was that the RC2014
spits characters too fast and the CTS line of its ACIA modules
(both the 6850 and SIO/2 ones) are hard-wired to ground, making
flow control difficult. I solved this, for now, by lowering comm
speed.

This driver improvement makes CL<? faster and makes baud rate
configurable in CL$.
2021-01-03 13:56:53 -05:00
Virgil Dupras ac3629b817 Make BLK@* and BLK!* into ialiases 2021-01-02 15:51:12 -05:00
Virgil Dupras d09de0a0d3 Integrate RDLN input buffer into sysvars
In the beginning of Collapse OS' Forth version, the readline sub-
system was optional. This is why we had this separate RDLN$ routine
and that the input buffer was allocated at boot time.

It's been a while since the RDLN system has been made mandatory, but
we still paid the complexity tax of this separation. Not anymore.
2021-01-02 14:32:03 -05:00
Virgil Dupras 527f5977d7 Add BS, CR, LF, SPC ASCII consts
Previously, these words would be ascii emitters, but seldom used
except for the SPC emitter. However, I would often end up hardcoding
these constants. With useless emitters removed and ASCII constants
added, we have a more usable system.

Also, fix broken test harness.
2021-01-02 10:26:05 -05:00
Virgil Dupras cbf9ecfb1e Make NL, renamed to NL> a bit simpler
It doesn't require emitting words anymore. The rename to NL> is
linked to the upcoming commit.
2021-01-02 10:03:27 -05:00
Virgil Dupras 1a48ff047f trs80: make (key?) non-blocking 2021-01-02 09:15:33 -05:00
Virgil Dupras 475caf35f4 Make KEY non-blocking
... and rename it to KEY?. Then, add KEY from KEY? for its blocking
version.

I need this for an upcoming Remote Shell feature. If a Collapse OS
system remotely controls another shell, it needs to be able to poll
both the remote system and the local keyboard at the same time. A
blocking KEY is incompatible with this.

In some places, the polling mechanism doesn't make sense, so this
new KEY? always returns a character. In some places, I just haven't
implemented the mechanism yet, so I kept the old blocking code and
added a "always 1" flag as a temporary shim.

I have probably broken something, but in emulators, Collapse OS runs
fine. It's an important reminder of what will be lost with the new
"dogfooding" approach (see recent mailing list message): without
emulators, it's much harder to to sweeping changes like this without
breaking stuff.

It's fine, I don't expect many more of these core changes to the
system. It's nearly feature-complete.
2021-01-01 08:23:59 -05:00
Virgil Dupras 3581beace0 rc2014: de-buffer MC6850 and SIO drivers
The buffer's implementation wasn't buying us much in exchange for its
complexity. A modern machine was still too fast for it (copy/pasting
text from a modern machine would send bytes too fast for the RC2014)
and in the (theoretical so far) case of COS-to-COS communication, the
buffer didn't help in cases where the baud rate was faster than the
processing of each byte received (for example, if the byte was written
directly to EEPROM).

I'm scrapping it and, instead, use the RTS flag to signal the other
side when we're ready to receive a new byte.

Also, implement driver for channel B in SIO. I will need it to talk
to my TRS-80 4P.
2020-12-29 21:36:19 -05:00
Virgil Dupras 5ca99ad410 trs80: implement a standalone RS-232 driver
No more relying on the TRS-DOS driver!
2020-12-25 16:54:02 -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 7dae33ce36 rc2014: add SIO xcomp unit 2020-12-12 10:08:16 -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 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 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 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 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 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 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
Virgil Dupras 95ab1ad588 Transform "blk/" folders into "blk.fs" text files
Working in "blk/" folder from a modern system is harder than it
should be. Moving blocks around is a bit awkward, grepping is a
bit less convenient than it could be, git blame has troubles
following, etc.

In this commit, we modify blkpack and blkunpack to work with single
text files with blocks being separated by a special markup.

I think this will make the code significantly more convenient to
work into.
2020-11-14 18:34:15 -05:00
Virgil Dupras d1718a90c7 sms: add support for VDP's text mode
Because that mode behaves exactly like in a regular TMS9918, a new
driver for TMS9918 has been added in blkfs and SMS' VDP now uses it.

Also, fix broken 5x7 font.
2020-11-13 12:18:00 -05:00
Virgil Dupras c7d8de25b2 ti84: use Grid subsystem
Also, rename CLRLN to NEWLN and make it clear that it's only called
on entering a new line. This way, we can set Z offset in there for
the TI-84+ LCD driver.
2020-11-10 20:30:37 -05:00
Virgil Dupras e0bcf3473e Adjust Grid subsystem
Rename ROWS to LINES (it's what VE uses). Also, don't use COLS and
LINES as immediates in the Grid subsystem: we expect those words to
be available at runtime.
2020-11-10 19:06:39 -05:00
Virgil Dupras b97e761942 Add Grid subsystem
The goal is to offload the SMS VDP driver a little bit.
2020-11-09 17:26:15 -05:00
Virgil Dupras 603ad5d255 sms: don't use MIN in drivers
it has been removed from the core.
2020-11-09 15:03:41 -05:00
Virgil Dupras be52fb1383 sms/vdp: fix bad mirroring
On the real machine, I ended up at some point getting a weird "bottom
mirroring" issue. It turns out that it was because when I revamped my
VDP flags in an earlier commit, I hadn't read the whole technical
notes about register $02 and falsely thought that B0 was ignored. No
it's not. When set, it mirrors the bottom 8 rows.
2020-11-09 14:56:25 -05:00
Virgil Dupras f09950a12a sms/vdp: clear rest of line on line feed
This allows us (in the following commit), to stop unvariably
spitting 64 chars by line in LIST. This way, short lines don't use
3 rows per line (the line number uses 3 chars, which brings us to
67 chars per line).

If we don't do that, we end up with the old contents of the line
being kept at the right of the printed line.
2020-11-08 16:43:37 -05:00
Virgil Dupras 4b71f0a344 sms/spi: sample DO when CLK is high
I was sampling DO at the wrong moment, so my input was always
one-off.
2020-11-08 10:24:36 -05:00
Virgil Dupras 2b8524d11e sms: CPORT_CTL is write-only!
why did I think that I could read from it?
2020-11-08 08:43:24 -05:00
Virgil Dupras 7d568bd782 sms: simplify and solidify ports-related drivers
Add _TRA!, _THA!, _TRB!, _THB! routines to easily handle those pins'
value without stepping on other pins like the drivers previously
did. For SDC driver, it's going to be important soon because it turns
out that I can't get away with "always on" CS, so I'll need a scheme
where it's important that TH/TR pins have stable values.
2020-11-02 18:53:57 -05:00
Virgil Dupras 7001446212 Complete overhaul of recipes
Recipes contain bits and pieces of hardware-related knowledge, but
these bits feel sparse. I've been wanting to consolidate hardware-
related documentation for a while, but always fell at odds with the
recipes organisation.

We don't have recipes anymore, just a /doc/hw section that contains
hardware-related documentation which often translate to precise
instructions to run Collapse OS on a specific machine.

With this new organisation, I hope to end up with a better, more
solid documentation.
2020-10-30 20:39:39 -04:00