Commit Graph

1639 Commits

Author SHA1 Message Date
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
e31527f5ac Add word ROT>
There are many situations where it can be useful. Worth it.
2020-10-29 12:41:08 -04:00
Virgil Dupras
75ef1f440c Make MOVE* words use A@ and A!
This allows us to remove AMOVE* words.
2020-10-29 12:15:21 -04:00
Virgil Dupras
69bb34ce7b Add tests for MOVE* words 2020-10-29 11:52:39 -04:00
Virgil Dupras
de7cb4a80f Add word A,
This would be useful, for example, to allow the assembler to write
straight to an AT28 EEPROM without going to RAM. This would be a
life saver in machines with tight RAM such as the SMS.
2020-10-28 20:45:50 -04:00
Virgil Dupras
30b56185e9 Optimize parsing routines 2020-10-28 20:29:28 -04:00
Virgil Dupras
f027f13042 Remove an indirection in ERR 2020-10-28 19:23:34 -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
8f3891f7d3 Move EMIT to low core
This allows us to remove one layer of indirection in (wnf). This is
possible now that EMIT is a switch word.
2020-10-28 16:34:49 -04:00
Virgil Dupras
038c25957b Make C<* into a switch word
Slightly larger binary, but clearer code and slightly faster.
2020-10-28 16:18:37 -04:00
Virgil Dupras
5e13dcedf3 Make KEY and EMIT into switch words 2020-10-28 16:00:58 -04:00
Virgil Dupras
d3ec0e3a6c Use SYSVARS instead of RAM+ in core switches defs
RAM+ is the host's setup! Use SYSVARS instead, which is the guest's
value.
2020-10-28 15:47:49 -04:00
Virgil Dupras
adea75e50a Add alias and switch word types
I'm pretty happy about how lightweight the implementation turns
out to be.
2020-10-28 15:02:06 -04:00
Virgil Dupras
a82db0739a z80: make exec routine a wee bit tighter
1 whole byte!
2020-10-28 13:28:27 -04:00
Virgil Dupras
788453b89c Simplify NL
I think that when I added NL, I had troubles having access to CRLF's
address at boot time, which is why I had this system. But now that
CRLF is easily accessible during BOOT, we can simplify.

(and that will help us in the hopefully-upcoming change, which is
quite nice...)
2020-10-28 11:35:32 -04:00
Virgil Dupras
04bd57b527 Remove BIT@ and BIT!
They were only used in the ti84 recipe and were not worth their cost.
2020-10-27 22:51:08 -04:00
Virgil Dupras
fc63541725 Improve documentation 2020-10-27 19:53:02 -04:00
Virgil Dupras
3198cd8d08 emul/8086/pcat: fix broken AT-XY 2020-10-25 18:42:48 -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
44abcaa8f8 emul/8086: a little bit of cleanup in cpu.c
De-macroisation negatively impacts speed, but this emulator doesn't
need to be fast. Clear code is more important.
2020-10-25 14:25:12 -04:00
Virgil Dupras
8760766bb4 emul/8086: cleanup a couple of ifdefs
We assume CPU_V20 configuration at all times.
2020-10-25 14:01:46 -04:00
Virgil Dupras
5a77b80d3d emul/8086/pcat: fix broken int13h logic
I had forgotten that heads index increment before track index.
2020-10-25 12:21:44 -04:00
Virgil Dupras
ba21b6a9f5 emul/8086: add PC/AT emulator 2020-10-25 10:27:52 -04:00
Virgil Dupras
c912158744 Run "all" tests under the 8086 emulator 2020-10-24 23:38:06 -04:00
Virgil Dupras
885e7db054 emul/8086: add BLK support 2020-10-24 23:20:20 -04:00
Virgil Dupras
de9103942d emul/8086: implement AT-XY 2020-10-24 23:00:45 -04:00
Virgil Dupras
d11ac3f006 emul/8086: and we have liftoff!
Getting a Collapse OS prompt.
2020-10-24 22:06:51 -04:00
Virgil Dupras
942a50a86d emul/8086: add INT hooks 2020-10-24 21:50:44 -04:00
Virgil Dupras
939c018792 emul/8086: wip 2020-10-24 20:41:51 -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
Virgil Dupras
329219fa89 emul: copy libz80 directly into tree, pre-generated
libz80 doesn't move much anymore, there not much advantage to the
git module indirection.
2020-10-24 15:42:08 -04:00
Virgil Dupras
c072096909 tests: run "generic" tests under all Collapse OS architectures
There's no reason to run them only under CVM.
2020-10-24 14:57:33 -04:00
Virgil Dupras
ae62e291e6 Update libz80 submodule 2020-10-24 14:46:21 -04:00
Virgil Dupras
46c95320af emul: bring "hw" subfolders one level higher 2020-10-24 14:37:19 -04:00
Virgil Dupras
8cecd54410 emul/sms: add PS/2 keyboard emulation 2020-10-24 11:18:48 -04:00
Virgil Dupras
cc8068f8ab emul: don't hardcode X11 keycodes in key handling routines
I thought it wasn't possible with XCB to transform keycodes into
symbols for the current keyboard mapping, but I hadn't looked
hard enough.
2020-10-23 21:33:56 -04:00
Virgil Dupras
473d04d7d9 recipes/sms: add cartridge hacking instructions 2020-10-12 21:39:53 -04:00
Virgil Dupras
1681e61956 emul/sms: don't hardcode name table offset
Use reg 2 as specified.
2020-10-12 21:11:46 -04:00
Virgil Dupras
6b895d0745 sms: explicitly set ourselves in IM 1
I'm not sure if not setting IM 1 explicitly can be the source of bugs,
but SMS Power's tutorial mentions that everyone is doing it, so...
2020-10-10 13:31:54 -04:00
Virgil Dupras
0d172cc2c4 tools: add smsrom
Running a ROM on an everdrive is one thing, but running a ROM
directly is another: my hacked up sega.bin didn't have a proper
checksum, so the ROM didn't run.

This new tool transforms a binary into a properly-headered ROM.

Has been tested on an actual SMS.
2020-10-10 13:30:43 -04:00
Virgil Dupras
32d5f87b4e sms: don't use BC
The PAD driver was broken since IP moved to BC. Oops.
2020-10-06 20:36:29 -04:00
Virgil Dupras
eafcb0c440 avrpgm: add EEPROM support
also, verify all 3 first bytes of SPI commands. I'm not sure why
I wasn't doing that, probably because I was getting a lot of AVR
err and thought that only 2 bytes of the cmd were echoed. But now,
with a reliable SPI setup, verifying 3 bytes seems to work.
2020-10-05 19:36:49 -04:00
Virgil Dupras
8630b0a8ed recipes/rc2014/avr: new recipe 2020-10-05 18:46:22 -04:00
Virgil Dupras
dafcf72d5b Add ATmega328P definitions 2020-10-05 16:56:09 -04:00
Virgil Dupras
ebafa79795 Improve AVR docs
After many trials and errors in reliably accessing AVR chips through
my SPI relay design, I resigned myself to accepting 125kHz communication
speed with it. I find the complexity of solutions allowing to keep 250kHz
speeds to be excessive.
2020-10-05 16:46:16 -04:00
Virgil Dupras
44bcdd4327 Document 8086 asm instructions list
Also, remove needless argtype in CALL and RET
2020-09-25 19:44:32 -04:00
Virgil Dupras
8bf6258673 Add word TICKS
Adding a delay such as the 20ms one we have in AVR programmer's
initialization routine is tricky without a word like TICKS.

This implementation is highly inaccurate, but more accurate and
reliable than a "ballpark" DO..LOOP...
2020-09-25 17:31:06 -04:00
Virgil Dupras
1195b0313b emul/rc2014: add support for Zilog SIO
Very very simplistic, but works with our driver.
2020-09-24 21:01:14 -04:00
Virgil Dupras
35840ad8e6 sdc: don't use ABORT"
ABORT" doesn't work in xcomp.

Also, improve xcomp docs and fix misdocumentation.
2020-09-24 13:10:41 -04:00