1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-15 02:58:06 +11:00
Commit Graph

1511 Commits

Author SHA1 Message Date
Virgil Dupras
0e8af3cea4 forth: clarify the meaning of "wordref"
Also, make entry labels in dict.asm be wordref instead of entry ref.
2020-03-09 15:12:44 -04:00
Virgil Dupras
e8a4768304 forth: add words "IF", "ELSE", "THEN" 2020-03-09 14:19:51 -04:00
Virgil Dupras
03e529b762 forth: simplify execution model and handle literals better
This scheme of "when we handle line-by-line, compile one word at a time then
execute" so that we could allow words like "CREATE" to call "readword" before
continuing was a bad scheme. It made things like branching outside of a colon
definition impossible.

This commit implement a new "litWord". When an undefined word is encountered at
compile time, it is included as-is in a string literal word. It is at run time
that we decide what to do with it.
2020-03-09 14:14:26 -04:00
Virgil Dupras
5cadde557c forth: add "VARIABLE" 2020-03-07 22:23:08 -05:00
Virgil Dupras
989d8bbabf forth: add "DOES>" and "CONSTANT" 2020-03-07 22:18:14 -05:00
Virgil Dupras
53024d88f5 forth: add "DUP", "OVER", "SWAP", "?", "+!", "ALLOT" 2020-03-07 21:12:30 -05:00
Virgil Dupras
f0cf10ab7c forth: Check for PS underflow 2020-03-07 20:20:11 -05:00
Virgil Dupras
580214426a forth: add +-*/ 2020-03-07 19:42:07 -05:00
Virgil Dupras
ad2aca4620 forth: add number literals support 2020-03-07 19:25:55 -05:00
Virgil Dupras
30f188b984 forth: add word ":" 2020-03-07 18:54:16 -05:00
Virgil Dupras
e7cd3182d0 forth: add words "CREATE", "@", "!", "HERE", "QUIT" 2020-03-07 17:09:45 -05:00
Virgil Dupras
6f9d28b325 forth: add word "bye"
And make interpret action looping until BYE.
2020-03-07 13:15:19 -05:00
Virgil Dupras
391ddb9984 forth: add word "." 2020-03-07 12:50:54 -05:00
Virgil Dupras
49228e418c apps/forth: new (WIP) application 2020-03-07 12:13:15 -05:00
Virgil Dupras
97dcad9b15 recipes/sms/kbd: use Collapse OS' AVR assembler 2020-02-26 23:10:43 -05:00
Virgil Dupras
64a54c72f8 Fix broken recipes 2020-02-26 21:44:37 -05:00
Virgil Dupras
92ddc7ebc1 recipes/trs80: use grid module
Not much of a gain in terms of usability (a bit of a loss in fact, things are
a bit slow and glitchy), but it's a necessary move if we want to use upcoming
grid-enabled userspace apps, such as a visual text editor.
2020-02-26 16:27:27 -05:00
Virgil Dupras
a442c46935 sms/vdp: highlight cursor with inverted palette 2020-02-26 09:43:50 -05:00
Virgil Dupras
247b200dcc New kernel module: grid 2020-02-24 20:36:08 -05:00
Virgil Dupras
434c8d5c0d recipes/trs80: add ed 2020-02-23 20:52:44 -05:00
Virgil Dupras
6224ea2fe9 zasm: use printcrlf instead of hardcoded CRLF 2020-02-23 18:52:25 -05:00
Virgil Dupras
c3213e1e8c recipes/trs80: can now run zasm! 2020-02-23 14:51:19 -05:00
Virgil Dupras
2860a10f71 recipes/trs80: add CFS support 2020-02-22 20:06:59 -05:00
Virgil Dupras
ec6df3087d recipes/trs80: add "recv" command
This allows us to write contents from RS-232 directly to floppy! it works!
2020-02-22 14:43:07 -05:00
Virgil Dupras
049f2cf222 Reverse ttysafe escaping order
Sending the escape after its target made things complicated for upcoming
stuff I want to add. Although it makes `recv.asm` slightly larger, it's really
worth it.
2020-02-22 14:11:43 -05:00
Virgil Dupras
69f0c6dafd trs80/floppy: implement write 2020-02-22 12:09:43 -05:00
Virgil Dupras
438c71ad3d trs80/floppy: new module
Read-only support for now, hardcoded on drive :1. But it seems to work.

Can't wait to get a CFS running on this!
2020-02-21 19:30:57 -05:00
Virgil Dupras
08328b86a9 doc: add reverse engineering notes for trs80-4p 2020-02-21 10:39:51 -05:00
Virgil Dupras
bd38d46892 recipes/trs80: fix double line feeds
Lines should be terminated only with a CR on this system, not CRLF.
2020-02-21 08:40:42 -05:00
Virgil Dupras
0f2b3aca24 zasm: allow zasm to omit its 3rd argument
A bug in rdWS made zasm error out when omiting its 3rd argument.

fixes #90
2020-02-18 15:46:55 -05:00
Virgil Dupras
9515d63d47 recipes/trs80: Collapse OS runs on the TRS-80 Model 4P! 2020-02-12 11:23:49 -05:00
Virgil Dupras
c5116b39ae Fix tools Makefile for GNU make
It seems that my little "@.c" trick only worked in BSD make...
2020-02-12 10:12:46 -05:00
Virgil Dupras
bab18216aa recipes/trs80: add instructions to save recv program to floppy 2020-02-10 11:25:05 -05:00
Virgil Dupras
9d8aa3a0d0 Add TRS-80 model 4P hardware doc
It's a condensed version of the technical manual that can be a bit
more practical to use for quick referencing.
2020-01-25 14:44:30 -05:00
Virgil Dupras
a74ee81822 recipes/trs80: new recipe (WIP) 2020-01-11 23:01:28 -05:00
Virgil Dupras
e1e0676191 emul/hw/sms: add A/B ports and a Genesis pad
This makes the emulator suitable to run the base SMS recipe.
2020-01-10 21:20:44 -05:00
Virgil Dupras
b60252e330 emul/hw/(ti|sms): detect window being closed
Previously, it would never get out of the event loop.
2020-01-10 16:59:48 -05:00
Clanmaster21
9cddaf1b59 String functions optimised (#86)
* String functions optimised

A few functions have been tweaked, but the biggest changes are in strlen, strskip and toWS, which take around two third of the cycles they used to (although strskip has more overhead). 10 bytes saved total.
toWS had two bytes added inlining the isWS call, and a jump to unsetZ was inlined too, saving a byte. This saved 29 cycles, with the original function being 90 cycles. I looked at other uses of isWS and it's difficult to inline it effectively in every situation, so I haven't inlined it elsewhere.
rdWS had a byte and two cycles saved by inlining a jump to unsetZ.
strskip is the same size, with the loop cut down from 35 cycles to 21 cycles, but 18 cycles are added outside the loop. I expect one character strings are in the minority, so this should save cycles overall.
strlen had 8 bytes saved, with the loop cut down from 38 cycles to 21 cycles, and 18 cycles removed outside the loop.

* Fixed strskip

Strskip wasn't preserving a properly. The new code uses the shadow af register, so whilst a byte and 4 cycles have been added outside the loop, it's safer and cleaner. The flags register isn't affected, but since the search goes for up to 64Kb I think it's safe to say the end of the string will always be reached.

* Remove inlining of isWS
2020-01-09 20:10:27 -05:00
Virgil Dupras
66744c0026 emul/hw/(ti|sms): fix compilation with gcc
It seems to be picky about where it accepts its link flags.
2020-01-09 08:36:29 -05:00
Virgil Dupras
6acd22492c emul/hw/sms: WIP
VDP kinda works. Can see the Collapse OS prompt with SMS base recipe
if `STDIO_GETC` gets replaced with infinite loop (no input emul yet).
2020-01-08 22:06:50 -05:00
Virgil Dupras
d70c6d3b5f sms/vdp: improve comments 2020-01-08 18:38:55 -05:00
Clanmaster21
927d5f2392 Reworked parseHexadecimal and parseDecimal, other minor tweaks (#85)
I've tweaked nearly every function in this file, so I'll go through them one by one.
parseDecimal has been reworked a little so that `a` can be used instead of `b` for checking for overflow. I had originally intended to redo it to work like the old parseDecimal, but I think the current method (once reworked a little) is cleaner and smaller, and should be just as fast. 7 bytes and 27 cycles saved.
parseHexadecimal has been changed to load hex digits into `b` `d` `c` `e` from the right (so all the digits move along to the left so the new digit can be inserted on the right), and then only at the end is any shifting done, using the faster `add a, a` to do left shifts. 9 bytes saved and 78 cycles saved inside the loop, and then 49 cycles added after the loop. 
parseBinaryLiteral had a few instructions moved around, saving two bytes and 5 cycles inside the loop, and a further 15 cycles saved on error.
parseLiteral has been reworked slightly, the isDigit call has been replaced with an inline parseDecimalDigit, saving a byte and around 20-30 cycles, with around 16 more cycles saved if the number is a decimal. The .char routine has been reduced by a byte, and 6 cycles saved on success, but 5 cycles added on error.
isDigit has been reduced by 4 bytes and 10 cycles on success, with a few more cycles saved on fail (hard to estimate due to branching).
2020-01-08 16:12:40 -05:00
Virgil Dupras
fb2117dc2e sms/vdp: use fonts from kernel/fnt
Instead of its own version of one. Additionally, add a 7x7 font to
the collection.
2020-01-07 22:15:35 -05:00
Virgil Dupras
439f880abe Rewrite font_compile.pl to C 2020-01-07 18:26:40 -05:00
Virgil Dupras
9a7617115f doc: add "Understanding the code" walkthrough 2020-01-05 10:47:23 -05:00
Virgil Dupras
c7ef8bf915 recipes: add "make emul" targets where appropriate 2020-01-02 16:59:38 -05:00
Virgil Dupras
9216057db8 emul/hw: add TI-84+ emulator
I implement the screen using XCB which is much more friendly
than z80e's SDL+CMake for development machines that want to install
minimal dependencies (for example, a port-less OpenBSD rig).
2020-01-01 22:48:01 -05:00
Virgil Dupras
25fc0a3c72 Add RC2014 classic emulation 2019-12-31 22:03:48 -05:00
Virgil Dupras
eed67c4768 tests/shell: bring back the static test.cfs
I had forgotten about that ordering thing: depending on the platform
cfspack doesn't read files in a directory in the same order.
2019-12-31 15:17:22 -05:00
Virgil Dupras
359991c005 cfspack: fix compilation error
Some compilers don't like assigning stdout statically.
2019-12-31 15:12:17 -05:00