1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-09-21 16:38:44 +10:00
collapseos/emul/z80
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
..
.gitignore emul: add TRS-80 emulator 2020-12-05 22:04:22 -05:00
acia.c Make KEY non-blocking 2021-01-01 08:23:59 -05:00
acia.h Make KEY non-blocking 2021-01-01 08:23:59 -05:00
at28.c emul/z80: add AT28 EEPROM emulator 2020-12-08 20:07:53 -05:00
at28.h emul/z80: add AT28 EEPROM emulator 2020-12-08 20:07:53 -05:00
emul.c emul/z80: add AT28 EEPROM emulator 2020-12-08 20:07:53 -05:00
emul.h emul/z80: add AT28 EEPROM emulator 2020-12-08 20:07:53 -05:00
forth.c emul/trs80: implement floppy emulation 2020-12-06 19:52:18 -05:00
Makefile emul/z80: add AT28 EEPROM emulator 2020-12-08 20:07:53 -05:00
opcodes_decl.h Move /emul to /emul/z80 2020-10-24 16:50:22 -04:00
opcodes_impl.c Move /emul to /emul/z80 2020-10-24 16:50:22 -04:00
opcodes_table.h Move /emul to /emul/z80 2020-10-24 16:50:22 -04:00
ps2_kbd.c emul/z80: flatten directory structure 2020-10-25 15:58:00 -04:00
ps2_kbd.h emul/z80: flatten directory structure 2020-10-25 15:58:00 -04:00
rc2014_spi.c emul/z80: decouple SDC and SPI 2020-10-29 15:01:25 -04:00
rc2014_spi.h emul/z80: decouple SDC and SPI 2020-10-29 15:01:25 -04:00
rc2014.c Make KEY non-blocking 2021-01-01 08:23:59 -05:00
README.md emul/z80: add AT28 EEPROM emulator 2020-12-08 20:07:53 -05:00
sdc.c emul/z80: decouple SDC and SPI 2020-10-29 15:01:25 -04:00
sdc.h emul/z80: decouple SDC and SPI 2020-10-29 15:01:25 -04:00
sio.c emul/z80: flatten directory structure 2020-10-25 15:58:00 -04:00
sio.h emul/z80: flatten directory structure 2020-10-25 15:58:00 -04:00
sms_pad.c emul/z80: flatten directory structure 2020-10-25 15:58:00 -04:00
sms_pad.h emul/z80: flatten directory structure 2020-10-25 15:58:00 -04:00
sms_ports.c sms: CPORT_CTL is write-only! 2020-11-08 08:43:24 -05:00
sms_ports.h sms: CPORT_CTL is write-only! 2020-11-08 08:43:24 -05:00
sms_spi.c emul/z80/sms: add SPI exchange through controller port 2020-10-29 19:42:19 -04:00
sms_spi.h emul/z80/sms: add SPI exchange through controller port 2020-10-29 19:42:19 -04:00
sms_vdp.c sms: add support for VDP's text mode 2020-11-13 12:18:00 -05:00
sms_vdp.h sms: add support for VDP's text mode 2020-11-13 12:18:00 -05:00
sms.c emul: add TRS-80 emulator 2020-12-05 22:04:22 -05:00
t6a04.c emul/z80: flatten directory structure 2020-10-25 15:58:00 -04:00
t6a04.h emul/z80: flatten directory structure 2020-10-25 15:58:00 -04:00
ti84_kbd.c emul/z80: flatten directory structure 2020-10-25 15:58:00 -04:00
ti84_kbd.h emul/z80: flatten directory structure 2020-10-25 15:58:00 -04:00
ti84.c emul: add TRS-80 emulator 2020-12-05 22:04:22 -05:00
tms9918.c sms: fix cursor mis-display in text mode 2020-11-16 13:10:04 -05:00
tms9918.h sms: fix cursor mis-display in text mode 2020-11-16 13:10:04 -05:00
trs80.c emul/trs80: implement floppy emulation 2020-12-06 19:52:18 -05:00
xcomp.fs Make KEY non-blocking 2021-01-01 08:23:59 -05:00
z80.c Move /emul to /emul/z80 2020-10-24 16:50:22 -04:00
z80.h Move /emul to /emul/z80 2020-10-24 16:50:22 -04:00

Z80 emulation

This folder contains a couple of tools running under the [libz80][libz80] emulator.

Requirements

You need curses to build the forth executable.

For sms and ti84 emulators, you need XCB and pkg-config.

Build

Running make builds all targets described below

Vanilla Forth

The ./forth executable here works like the one in /cvm, except that it runs under an emulated z80 machine instead of running natively. Refer to /cvm/README.md for details.

./forth doesn't try to emulate real hardware because the goal here is to facilitate "high level" development.

These apps run on imaginary hardware and use many cheats to simplify I/Os.

RC2014 emulation

This emulates a RC2014 classic with 8K of ROM, 32K of RAM and an ACIA hooked to stdin/stdout.

Run ./rc2014 /path/to/rom (for example, os.bin from RC2014's recipe). Serial I/O is hooked to stdin/stdout. CTRL+D to quit.

You can press CTRL+E to dump the whole 64K of memory into memdump.

Options:

  • -s replaces the ACIA with a Zilog SIO.
  • -e puts a 8K AT28 EEPROM at address 0x2000.
  • -c/path/to/image hooks up a SD card with specified contents.

Sega Master System emulator

This emulates a Sega Master system with a monochrome screen and a Genesis pad hooked to port A.

Launch the emulator with ./sms /path/to/rom (you can use the binary from the sms recipe.

This will show a window with the screen's content on it. The mappings to the pad are:

  • W --> Up
  • A --> Left
  • S --> Down
  • D --> Right
  • H --> A
  • J --> B
  • K --> C
  • L --> Start

If your ROM is configured with PS/2 keyboard input, run this emulator with the -k flag to replace SMS pad emulation with keyboard emulation.

The -c option connects a SD card in the same way as the RC2014 emulator.

In both cases (pad or keyboard), only port A emulation is supported.

Press ESC to quit.

TI-84

This emulates a TI-84+ with its screen and keyboard. This is suitable for running the ti84 recipe.

Launch the emulator with ./ti84 /path/to/rom (you can use the binary from the ti84 recipe. Use the small one, not the one having been filled to 1MB).

This will show a window with the LCD screen's content on it. Most applications, upon boot, halt after initialization and stay halted until the ON key is pressed. The ON key is mapped to the tilde (~) key.

Press ESC to quit.

As for the rest of the mappings, they map at the key level. For example, the 'Y' key maps to '1' (which yields 'y' when in alpha mode). Therefore, '1' and 'Y' map to the same calculator key. Backspace maps to DEL.

Left Shift maps to 2nd. Left Ctrl maps to Alpha. [libz80]: https://github.com/ggambetta/libz80