1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-02 03:30:54 +11:00
Commit Graph

19 Commits

Author SHA1 Message Date
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
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
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
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
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
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
09c01c4a43 emul/z80: extract tms9918 unit from sms_vdp
I'm planning on supporting Text Mode soon, and SMS' VDP, when mode
4 is not active, behaves mostly like a regular TMS9918.

By having this behavior in a separate unit, we'll be able to use it
in other systems.
2020-11-12 11:13:18 -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
6cb310c38c emul+cvm: link to curses instead of ncurses
NetBSD doesn't have ncurses. Linking to curses doesn't seem to change
anything. Tried on OpenBSD and Ubuntu.
2020-11-07 08:45:26 -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
ce10320030 emul/z80/sms: add SPI exchange through controller port
Theoretically, it works. I can access an emulated SD card on it.

Will it work on real hardware?

I've also made SMS emulation faster. It was unbearably slow for SDC
access.
2020-10-29 19:42:19 -04:00
Virgil Dupras
97a46a7b9b emul/z80: decouple SDC and SPI
My idea of plugging a RC2014 bridge directly onto a Sega Master System
cartridge doesn't work. The SMS eats all I/O addr space, we can't use
it. Therefore, this naive idea, in the emulator, of reusing sdc.c in
sms.c as-is, doesn't work either.

I'll have to find another way of communicating to a SPI device on the
SMS. I'll probably do it through a controller port. Meanwhile, I need
to decouple SPI from SDC in the emulator code so that I can reuse
sdc.c. This is what is done here.
2020-10-29 15:01:25 -04:00
Virgil Dupras
705d68deec Move most of the high layer of comp core into the low one
With KEY and EMIT being switch words, most of the high layer can
be defined before drivers.

In addition to this change, I've compacted core blocks which were
becoming quite sparse.
2020-10-28 18:18:00 -04:00
Virgil Dupras
6947fea2a8 emul/z80: add SD card support to SMS
It works (in emulation, but soon on real hardware!), but the LIST
command is awkward due to tight screen estate...
2020-10-25 16:53:58 -04:00
Virgil Dupras
490eceab6d emul/z80: flatten directory structure
I'm about to reuse sdc.c in sms.c and the old directory structure
was becoming awkward.
2020-10-25 15:58:00 -04:00
Virgil Dupras
efe4b13a4e Move /emul to /emul/z80
I'm planning on adding other subfolders. 8086 for example...
2020-10-24 16:50:22 -04:00