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

333 Commits

Author SHA1 Message Date
Virgil Dupras
16d6a0b377 pcat: begin implementing compiledWord/next 2020-06-16 19:05:36 -04:00
Virgil Dupras
feeedcc55c z80: small optimization in execute
I had more ambitious goals, but I backed out of it: not worth it.
This small optimization is an easy picking though.
2020-06-16 16:37:21 -04:00
Virgil Dupras
dabbd6c253 8086asm: add support for modrm 8-bit displacement 2020-06-15 06:52:47 -04:00
Virgil Dupras
d8d2e05eb2 pcat: make find compare strings
find is the biggest chunk of logic of the boot code. The 8086 version
is significantly terser than the z80 one. REP/CMPS helps...
2020-06-15 06:23:19 -04:00
Virgil Dupras
8c452f5add pcat: begin implementing find
Not comparing strings yet. Without asm tooling support, it's a big
chunk to swallow at once. It's progressing well!
2020-06-14 21:52:58 -04:00
Virgil Dupras
3be30e24bb pcat: implement execute and nativeWord 2020-06-14 15:27:26 -04:00
Virgil Dupras
bf0e999f8e pcat: read LATEST and jump to it 2020-06-14 14:51:32 -04:00
Virgil Dupras
a72322df31 pcat: begin structuring around words 2020-06-14 14:15:44 -04:00
Virgil Dupras
85a0b87da3 z80: reorder compiledWord and doesWord, saving ourselves a jump 2020-06-14 10:12:56 -04:00
Virgil Dupras
38d5a9f303 z80: inline cellWord in stable ABI 2020-06-14 10:07:46 -04:00
Virgil Dupras
40f92b9bab z80: optimize chkPS
Inline it in next and make chkPS, call a newly reserved label for
it directly, removing a layer of indirection. This frees a spot in
the stable ABI.
2020-06-14 09:48:10 -04:00
Virgil Dupras
31095bc04d z80: remove call indirections in tight spots 2020-06-14 09:29:34 -04:00
Virgil Dupras
2b7abf802f pcat: begin porting forth
I'm not sure yet where I'm going, but I'm not going to build the
8086 port from the ground up like I did with the z80, that is,
making is sustain itself and eventually merge its forth code with
core words. That would be too much work which would then be thrown
out (all those words I'll initially have to implement in asm which
are already implemented in Forth).

What I *think* I can do is build a mirror version of z80 boot code
and cross-compile it from the z80. This means it has to follow z80
stable ABI.

Nope, I'm not sure where I'm going...
2020-06-13 21:37:54 -04:00
Virgil Dupras
1a467efae1 pcat: use a far jump to boot into the OS
Unless I misunderstood, this is supposed to set CS. This would make
all SREG have the same value. This allows us to remove BIN( offset
from os.bin.

I've tried booting to offset 0, but it didn't seem to work. Let's
settle for 0x8000. 512kb of system RAM is way more than we need
anyways.
2020-06-13 20:06:51 -04:00
Virgil Dupras
507c2c12e7 8086asm: clarify operands and fix stupidities 2020-06-13 17:58:42 -04:00
Virgil Dupras
5033f17be2 8086asm: tidy up a bit 2020-06-13 16:21:56 -04:00
Virgil Dupras
07e50313c7 pcat: separate MBR code and OS code
MBR code now strictly loads OS code into memory and jumps into it.

Now, I've got to consolidate my assembler code, modrm logic is
messed up.
2020-06-13 15:35:16 -04:00
Virgil Dupras
e17f2e6907 pcat: read sector from floppy 2020-06-13 13:29:04 -04:00
Virgil Dupras
b037c86598 recipes/pcat: now tested on real hardware! 2020-06-13 11:47:32 -04:00
Virgil Dupras
66b27b0790 8086asm: properly initialize DS and DF 2020-06-12 19:07:23 -04:00
Virgil Dupras
177750c928 recipes/pcat: first steps into 8086! 2020-06-12 14:03:31 -04:00
Virgil Dupras
4e18fafe46 8086asm: now enough tooling to assemble a PC/AT Hello World boot 2020-06-12 13:12:41 -04:00
Virgil Dupras
210b833c71 8086asm: begin adding MODRM-enabled ops 2020-06-12 12:07:48 -04:00
Virgil Dupras
749fdf1b18 8086asm: add 8-bit JMP, MOVrI, INT,
Verified against nasm with equivalent code.
2020-06-12 11:29:00 -04:00
Virgil Dupras
405444d630 8086asm: first steps 2020-06-12 10:49:27 -04:00
Virgil Dupras
1871c46614 VE: add backspace support in replace mode 2020-06-11 22:29:05 -04:00
Virgil Dupras
dc368597a6 VE: Add dirtiness indicator in status bar
Written from VE!
2020-06-11 21:52:08 -04:00
Virgil Dupras
838c88459b Make BLK@ FLUSH only if loading a different block
Otherwise, when editing a file with VE, we would constantly write
to disk, which is a bit inefficient.
2020-06-11 21:42:52 -04:00
Virgil Dupras
e317e9cc78 VE: use system input buffer for IBUF and FBUF typing
This gives us backspace handling. Also, remove all usages of C<
which allows us to remove the C<* override.
2020-06-11 20:45:46 -04:00
Virgil Dupras
4146110e0d Move EMPTY to core words
It's a quite useful word and it doesn't make sense to reload it from
disk after each usage.
2020-06-11 19:04:03 -04:00
Virgil Dupras
f6ded7712e VE: add 't'
This is the first commit I do entirely in VE. It's a habit I'm planning
on taking as it helps a lot to find usability issues.
2020-06-11 18:12:01 -04:00
Virgil Dupras
e83d5073ba VE: disallow buffer overflow during typing
When reaching the end of the buffer when typing in IBUF or FBUF, stop
typing instead of overflowing.
2020-06-11 14:48:18 -04:00
Virgil Dupras
bd7da4658b VE: add gutter 2020-06-11 12:01:22 -04:00
Virgil Dupras
a405f77185 ed: don't crash when inserting in 64th char of the line 2020-06-10 20:56:19 -04:00
Virgil Dupras
7cad9ffe40 LIST: simplify logic
There wasn't much of a reason to leave a loop early on 0x0d or null.
The idea was that once you have a CR or null, the rest is garbage
and you shouldn't see it.

However, it brought a problem: In VE, you couldn't insert characters
past that limit. It would be written, but never displayed. So let's
get rid of this logic and simply always display a 64x16 grid.
2020-06-10 19:00:03 -04:00
Virgil Dupras
bc951a5ff1 ed and VE: add command Y 2020-06-10 17:27:14 -04:00
Virgil Dupras
8f0e51a21c VE: make D copy first deleted line to IBUF 2020-06-10 16:59:12 -04:00
Virgil Dupras
6a6c59300e VE: make ACC reset after each non-digit keystrokes
It simplifies things. Also, removed ';' which became useless.
2020-06-10 16:54:36 -04:00
Virgil Dupras
c16c5c98ce Improve usage docs 2020-06-09 22:55:42 -04:00
Virgil Dupras
1adfd0c1a6 ed: make X and E cut to IBUF
This allows cut&paste similar to VI's
2020-06-09 22:09:15 -04:00
Virgil Dupras
f90e03b0cb ed: free some blocks for the docs 2020-06-09 21:48:49 -04:00
Virgil Dupras
64ce8ab3e9 ed: Improve F with repeated searches
Make F search from curpos+1 so that it's possible to search the
same word we've just found a second time. Previously, it would find
the word under the cursor.

Also, improve docs a bit.
2020-06-09 21:17:08 -04:00
Virgil Dupras
4d893d90fc VE: Improve I and F buffer typing
Previously, it would keep the old buffer displayed why typing over
it. I had kept it thus because I didn't want to erase the buffer
right away because the behavior is that when we type nothing, we
keep the buffer as-is and repeat the action.

Now, the behavior of I and F is much better. It keeps the buffer
displayed until the first non-return keystroke and then erases it.

Also, fixed PSP leak in _type and fixed PSP overuse in successful
_F (they balanced out).
2020-06-08 21:23:23 -04:00
Virgil Dupras
a36db99651 VE: properly initialize variables
This fixes weird glitches I had on trs80. It's *always* a matter of
RAM initialization. By now, I should know...
2020-06-07 16:16:07 -04:00
Virgil Dupras
b2b556911f trs80: implement AT-XY
Also, I've run VE on the TRS-80 for the first time! It doesn't work
well though. Screen is mostly blank all the time.

I removed instructions from the recipe which became obsolete when
Collapse OS became 100% bootstrapped. Also, I've updated instructions
to change the NL override which is necessary for blkup to work.
2020-06-07 11:14:57 -04:00
Virgil Dupras
ab76d8d648 VE: add 'D' 2020-06-07 09:30:31 -04:00
Virgil Dupras
15acf30ca3 VE: add 'o' and 'O' 2020-06-07 07:25:02 -04:00
Virgil Dupras
c6016cd429 VE: fix buffer overflow with 'f' and make 'H' and 'L' affect 'f' 2020-06-06 21:59:22 -04:00
Virgil Dupras
b22ab8437b VE: add command 'f'
Kinda proud of this one. Efficiently piggy-backing on the Block
Editor, keeping things simple, and yet, building power into the
editor.
2020-06-06 21:46:46 -04:00
Virgil Dupras
204a66277e VE: replace 'W' with 'b' and implement 'W' and 'B'
Which are end-of-word movements.
2020-06-06 21:01:35 -04:00
Virgil Dupras
9d4e9ef08d VE: Add X 2020-06-05 14:01:39 -04:00
Virgil Dupras
6212a08866 VE: Add F and E 2020-06-05 13:54:45 -04:00
Virgil Dupras
a1b99275e6 VE: Add replace mode 2020-06-05 11:01:26 -04:00
Virgil Dupras
e7a6c777c7 VE: refactor mode indicators
The indicator is going to be empty most of the time and will be
emitted by the mode changer directly. That's going to the upper-right
corner and the status bar avoids emitting in that area.
2020-06-05 10:38:05 -04:00
Virgil Dupras
4af93d53e3 VE: add I command
Also, add insert and find buffers to the header, making it 3 lines
high.

Also, fix the "I" overshadowing word which wasn't operating on the
proper RSP level.

Also, fix I which didn't mark the block as dirty.
2020-06-04 22:54:27 -04:00
Virgil Dupras
e36080d7b8 VE: load Block Editor and reuse some of its words 2020-06-04 20:20:35 -04:00
Virgil Dupras
297c187426 VE: add mode indicator in status bar 2020-06-04 20:07:02 -04:00
Virgil Dupras
2bf4db59ed VE: Add H and L
Also, add MODE indirection.
2020-06-04 19:20:40 -04:00
Virgil Dupras
878df2d53b VE: make w affected by modifier 2020-06-04 18:59:54 -04:00
Virgil Dupras
98e820cf51 WE: why case-insensitive again? 2020-06-04 18:52:59 -04:00
Virgil Dupras
11843cc613 VE: add W and S movements 2020-06-04 17:22:07 -04:00
Virgil Dupras
77aedd7338 VE: add H, J, K, L 2020-06-04 12:04:13 -04:00
Virgil Dupras
c07a594e1a Begin working on a Visual Editor 2020-06-04 10:39:59 -04:00
Virgil Dupras
f53f91558b find: don't protect BC
not needed
2020-06-03 20:57:29 -04:00
Virgil Dupras
c26c454cbf extra words: allow finer-grained loading 2020-06-03 20:28:18 -04:00
Virgil Dupras
d8a6456206 (parsed): fix crash on parsing non-decimal staring with '-'
The address returned in the error condition would be off by one.
2020-05-25 21:15:07 -04:00
Virgil Dupras
2d17b4e8ec Make string length-prefixed instead of null-terminated
I'm not sure why I chose null-terminated initially. Probably because
the z80asm version had null-terminated strings.

Length-prefixes strings are the traditional form of strings in Forth
and it's a bit easier to work with them with traditional forth words
when they're under this form.
2020-05-25 20:34:52 -04:00
Virgil Dupras
6a507bcaac Add word MOVE, 2020-05-24 19:55:00 -04:00
Virgil Dupras
2d2a846b25 Inline SCPY
I'm planning a string reform and it's standing in the way.
2020-05-24 14:19:25 -04:00
Virgil Dupras
a59322c252 Remove XPACK
Now that everything is cross-compiled, no need to XPACK. If we ever
need it again, we know where to find it.
2020-05-24 13:45:22 -04:00
Virgil Dupras
4c1cacd8d0 Remove Linker
Now that the boot binary is fully cross-compiled, there's no use for
the linker anymore. Theoretically, it could still be useful, but I
can't think of a real use case.

Let's take it out of the picture. If it's ever needed again, I'll
know where to find it.
2020-05-24 10:22:56 -04:00
Virgil Dupras
ed2b91411a Limit ourselves to 8-bit branching
I'm planning on going back to 8-bit branching. 16-bit br cells incur
a non-negligible penalty and, while at first 64 words (128 bytes
forward or backward) seemed a bit limiting, I now don't see why one
would ever construct such a big branch. It would be un-forthy.

Also, I looked at using BC instead of IY to hold IP and the transition
would be a lot easier with 8-bit branching.

In this commit, all I do is add overflow checks in IF. The mechanic
below doesn't change. I'll give myself some time to think it over so
that I avoid yet another back and forth.
2020-05-24 10:16:25 -04:00
Virgil Dupras
5bbc256faf Flush input buffer on QUIT
Prebiously, when encountering an error during a : ; definition from
input buffer, because the input buffer wasn't flushed, we would continue
interpreting and quit the whole program when encountering ;.
2020-05-24 09:23:19 -04:00
Virgil Dupras
d041b91846 Optimize chkPS
Use EXX instead of the stack for HL protection and remove all
spurious uses of chkPS,

I wanted to inline chkPS in next because of its "tight loop" status,
but for reasons I don't understand, doing so breaks Collapse OS.
Later...
2020-05-22 23:12:03 -04:00
Virgil Dupras
4f2c2ab80a z80a: add a few ops 2020-05-22 22:23:24 -04:00
Virgil Dupras
581c6d015c Fix blk overflow in usage guide index 2020-05-22 20:39:28 -04:00
Virgil Dupras
6bff03a48b Move adev to core
It's small enough to be worth it.
2020-05-22 14:50:34 -04:00
Virgil Dupras
bb190f9665 Add word TUCK 2020-05-22 14:19:02 -04:00
Virgil Dupras
41d439376d Add word NIP 2020-05-22 14:19:02 -04:00
Virgil Dupras
f75b1c8864 Add word ?DUP 2020-05-22 14:19:02 -04:00
Virgil Dupras
ae87e88c52 Add 5x7 font
Also, fix PSP leak in font compilers.
2020-05-22 08:06:55 -04:00
Virgil Dupras
0939241db1 Add bootstrap guide 2020-05-21 15:25:12 -04:00
Virgil Dupras
e9e3bd80f6 ps2: fix PS2_SHIFT check 2020-05-21 08:53:36 -04:00
Virgil Dupras
7d28637740 ps2: add shift support 2020-05-20 20:31:56 -04:00
Virgil Dupras
b874a1c175 ps2: wip 2020-05-20 18:56:18 -04:00
Virgil Dupras
c86d8a74a0 sms/kbd: PS/2 driver WIP 2020-05-19 21:18:44 -04:00
Virgil Dupras
aad6b5c2e5 avra: add global constants 2020-05-19 10:48:48 -04:00
Virgil Dupras
ac309bbd9e avra: rename AGAIN, to AGAIN?,
AGAIN, becomes a shortcut for "' RJMP AGAIN?,"
2020-05-19 10:36:07 -04:00
Virgil Dupras
7a41c5c6f9 avra: add IF, .. THEN,
I decided to keep SKIP, .. TO, (renamed from AT,) around and limit
IF, .. THEN, to the simple BRNE case.
2020-05-19 10:26:57 -04:00
Virgil Dupras
8bbd29d37d avra: add SKIP, .. AT,
Will change to IF, .. THEN, but I need a way to easily reverse a
BR op. But from this commit, the translation of sms/kbd/ps2ctl.asm
is complete! perfect binary match!
2020-05-19 10:19:37 -04:00
Virgil Dupras
8ca85abfbd avra: add BEGIN, .. AGAIN, 2020-05-19 07:39:34 -04:00
Virgil Dupras
7b7e60ed4a avra: implement LD/ST
Still making great progress on sms/kbd/ps2ctl. Still matching ref
binary.
2020-05-18 22:28:58 -04:00
Virgil Dupras
e0bc14e55c avra: implement BR*
Getting good! still advancing on ps2ctl in sms/kbd and still
matching reference binary.
2020-05-18 20:34:06 -04:00
Virgil Dupras
cdddfdefae avra: add a layer of indirection to FLBL!
This will make it easier to fit BR* in there.
2020-05-18 19:45:30 -04:00
Virgil Dupras
63dec372ce sms/kbd: continue advancing on ps2ctl rewrite
Still binary matching. Next step is branching support.
2020-05-17 21:10:02 -04:00
Virgil Dupras
177e70580f sms/kbd: begin rewriting ps2ctl to Forth
So far, the resulting binary matches.
2020-05-17 14:24:27 -04:00
Virgil Dupras
8c4c879a65 avra: begin implementing forward label system 2020-05-17 11:04:08 -04:00
Virgil Dupras
212126d6d2 avra: add RJMP and RCALL 2020-05-17 10:13:43 -04:00
Virgil Dupras
b5d42924ba avra: add arg range checks 2020-05-17 09:30:36 -04:00
Virgil Dupras
5227777b34 avra: add OPb and OPRdb instr classes 2020-05-17 08:57:23 -04:00