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

1641 Commits

Author SHA1 Message Date
Virgil Dupras
e8cc3040d1 Improve impl's word execution documentation
Add an example, which I think helps a lot to grasp the idea.

Also, improve comments in Z80 boot code.
2020-11-28 13:15:16 -05:00
Virgil Dupras
038ca61ea5 Fix broken tools makefile 2020-11-28 11:31:27 -05:00
Virgil Dupras
db1d6424b3 Rename (print) to STYPE
This brings us a bit closer to TYPE from Forth 2012. I don't think
I'll add TYPE (sig "addr len") anytime soon because there is few
use cases for it, but having "STYPE" instead of "(print)" feels
cleaner.
2020-11-28 11:28:28 -05:00
Virgil Dupras
b48455e4db Improve initialization sequence documentation 2020-11-28 11:17:50 -05:00
Virgil Dupras
f8b7a3ce65 Rename switch to ialias
The switch name was confusing.
2020-11-28 10:58:16 -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
631e7f1008 tools/exec: fix segfault 2020-11-17 17:02:10 -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
4d26f1c490 VE: try to use CELL! more
At-XY+EMIT is slow compared to direct CELL! usage. It is seen very
clearly on a SMS when VE is doing its initial clrscr (yes, I could
manage to load VE from a SD card and run it on a real SMS!).

The grid protocol wasn't there when I wrote VE initially. I only had
AT-XY. Now that we have a solid protocol to build on, let's do it.
2020-11-17 12:07:22 -05:00
Virgil Dupras
224e9183fb cvm: fix NEWLN behavior
I hadn't noticed yet, but making CVM use the Grid subsystem made
me lose scrolling. It's fine because that scrolling was "artificial"
in the sense that it was provided by curses, not Collapse OS and I
prefer having something that closer emulates a real machine.

However, CVM didn't properly clear the new line when entering it.
Fixed.

Scrolling behavior will come back when it's implemented in the Grid
subsystem.
2020-11-17 11:52:54 -05:00
Virgil Dupras
eab8ab6f60 Fix "," char in 5x7 font 2020-11-17 11:24:51 -05:00
Virgil Dupras
30da1bd75b grid: fix PSP leak on newline 2020-11-17 11:19:37 -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
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
7bfec5d9e9 grid: Add CURSOR! to the grid protocol
With the move of CVM's forth to the grid protocol, we've lost the
cursor's visual indication. Now, we have it back.

The challenge now is in implementing it in SMS' text mode. In mode
4, it's easy to mark a cell as inverted, but in text mode, that's
not possible.
2020-11-16 08:41:09 -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
7722db0762 Fix mis-documentation in 8086 boot code comments 2020-11-14 20:28:44 -05:00
Virgil Dupras
c939c7e84a cvm: use Grid in /cvm/forth
Also, fixed broken AT-XY in Grid...
2020-11-14 20:08:18 -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
532bcc7e78 cvm: split stage and forth xcomp units
I wanted to make CVM's forth use the Grid subsystem, but doing so
would break the stage binary. Hence, this split.
2020-11-14 15:00:03 -05:00
Virgil Dupras
4720714bd4 doc: improve "hook word" description 2020-11-14 14:34:01 -05:00
Virgil Dupras
3f38c025e7 VE: add support for tight screens 2020-11-13 20:44:39 -05:00
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