1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-23 18:08:05 +11:00
Commit Graph

1666 Commits

Author SHA1 Message Date
Virgil Dupras
6a7c8ae1c8 VE: allow usage on screens narrower than 67 columns
Previously, display would be completely broken. We have yet to add
a way to display the "right" part of a buffer on such smaller
displays.
2020-11-13 15:52:12 -05:00
Virgil Dupras
10da104873 VE: decouple from core's LIST
I'm planning on de-hardcoding columns in VE a bit to add support
for screens narrower than 67 columns. There's a lot of hardcoding.

Let's begin with not using core's LIST anymore. This allows us to
spit 1-16 numbers only at startup.
2020-11-13 15:19:00 -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
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
2d54c3243d grid: add CLRLN and change _lf behavior
Instead of clearing the rest of the line on a _lf, it's simpler
to just clear any new line we're entering into.
2020-11-10 19:35:47 -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
f7ad84adae cvm: guard against segfaults
I've noticed that under certain conditions, such as a stack overflow,
I would segfault, something I though was impossible because my memory
size is 0x10000 and all my integer variables are uint16_t.

After having re-read my C handbook, it seems I wasn't sufficiently
knowledgeable about type conversion rules.
2020-11-08 20:20:01 -05:00
Virgil Dupras
a88c2b6b42 Fix stack leak in LIST 2020-11-08 17:30:27 -05:00
Virgil Dupras
3615944ffa Remove MIN and MAX from core
It isn't used in there anymore. Moved it to VE, the only place
where it's used.
2020-11-08 17:22:54 -05:00
Virgil Dupras
3171b03335 Allow list to stop spitting a line early
If a line has a char below 0x20, we consider the line ended, we
stop the EMIT loop for this line and spit our NL.

This makes LIST stop wasting rows in environments with a tight
screen.
2020-11-08 16:47:33 -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
11ebaaaa0b doc: add SPI relay instructions for the SMS 2020-11-08 11:35:06 -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
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
0a26acfee6 ps2: interpret KC 0x1f as '2'
The '2' key on my PS/2 keyoard never worked on Collapse OS, I
wasn't sure why. I thought the keyboard was broken, but then I
tried another one, still broken. But it's only the '2'!

The KC sent is 0x1f. Is it a timing problem with the ATtiny? I
have yet to wire my prototype for logic probing. Meanwhile, let's
apply a band-aid.
2020-11-06 17:21:13 -05:00
Virgil Dupras
29f3bf1e70 doc/hw/sms: adjust ROM hacking instructions
Previous instructions would only work with an AT28C64. Now, it also
work with an AT28C256.
2020-11-03 16:54:30 -05:00
Virgil Dupras
beddb6a375 sdc: fix stack underflow on mis-initialization 2020-11-02 18:59:04 -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
3a0084aa31 doc/bootstrap: fix inaccuracies 2020-10-31 15:30:07 -04: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
Virgil Dupras
480cf342fa Optimize SD card subsystem a bit 2020-10-29 21:03:11 -04: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
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