From b2b556911f7ffcb5f4ba8db93b86d5a10d02e12f Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sun, 7 Jun 2020 10:37:00 -0400 Subject: [PATCH] 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. --- blk/493 | 14 ++++---- blk/494 | 5 +++ recipes/trs80/README.md | 80 ++++++++++------------------------------- 3 files changed, 30 insertions(+), 69 deletions(-) diff --git a/blk/493 b/blk/493 index 420b8f2..891a52d 100644 --- a/blk/493 +++ b/blk/493 @@ -1,16 +1,16 @@ CODE (key) A 0x01 LDrn, ( @KEY ) 0x28 RSTn, - L A LDrr, H 0 LDrn, - HL PUSHqq, + PUSHA, ;CODE CODE (emit) - BC POPqq, ( c == @DSP arg ) - chkPS, + BC POPqq, ( c == @DSP arg ) chkPS, A 0x02 LDrn, ( @DSP ) 0x28 RSTn, ;CODE -CODE BYE - HL 0 LDddnn, - A 0x16 LDrn, ( @EXIT ) +CODE AT-XY + DE POPqq, H E LDrr, ( Y ) + DE POPqq, L E LDrr, ( X ) chkPS, + A 0x0f LDrn, ( @VDCTL ) B 3 LDrn, ( setcur ) 0x28 RSTn, +;CODE diff --git a/blk/494 b/blk/494 index abe4d8f..3acec14 100644 --- a/blk/494 +++ b/blk/494 @@ -1,3 +1,8 @@ +: LINES 24 ; : COLS 80 ; +CODE BYE + HL 0 LDddnn, + A 0x16 LDrn, ( @EXIT ) + 0x28 RSTn, CODE @DCSTAT ( drv -- f ) BC POPqq, chkPS, diff --git a/recipes/trs80/README.md b/recipes/trs80/README.md index 2476da0..a35810f 100644 --- a/recipes/trs80/README.md +++ b/recipes/trs80/README.md @@ -212,69 +212,12 @@ session on the other, type a few characters, and try `pingpong` again. ## Saving to disk -If everything went well, you could run Collapse OS with `g3000`. You -would get a usable Collapse OS prompt. But don't do that just yet. That -executable bootstraps itself from code and it takes a while to do that every -time you launch it. You don't want that right? Let's save a compiled version of -it to disk. +If everything went well, you could run Collapse OS with `g3000`. +But instead of doing that, why not save it to disk? -Turn off the debugger (which can mess up some things) and save your sent -content as-is by following the instructions you had for the `RECV` program. -This way, if you mess up a step below, you can quickly start over. Now you can -launch Collapse OS. Then, we need to: + dump cos/cmd:1 (start=x'5000',end=x'7000',tra='5000') -* Reclaim wasted memory -* Create hook entry -* Update LATEST -* Write down initialization code -* Write memory to floppy - -### Reclaim wasted memory - -During initialization, `RDLN$` allocated memory in `HERE` for its input buffer. -If you don't reclaim that space, that will be dead space in your binary. - -You can reclaim that space with `FORGET _` which will rewind to before we -defined our initialization routine (see xcomp.fs). - -However, that is not enough. If you only do that, there will be a conflict -between the rdln input buffer and your `HERE` space! So we need to go put that -input buffer somewhere else first. Therefore, your commands will be: - - 500 ALLOT RDLN$ FORGET _ - -### Create hook entry - -That one is easy: - - (entry) _ - -### Update LATEST - -At this point, both `HERE` and `CURRENT` point to your future `LATEST`. - - H@ 0x08 BIN+ ! - -Done. - -### Write down initialization code - -You'll do something similar to what we do in xcomp, except you'll have to add -"HERE rewinding" code because by default, `HERE` starts at RAMSTART+0x80. So: - - ," CURRENT @ HERE ! (ok) RDLN$ " - -As soon as `RDLN$` is called, the `C<` pointer changes and gives control to -keyboard, giving us our full forth interpreter. - -### Write memory to floppy - -What you currently have in memory is gold. You want that on floppy. First, run -`H@ .X` to know your upper bound (and `0 BIN+ .X` to know your lower one, but -you're already supposed to know that one). Then, run `BYE` to return to TRSDOS -(the TRSDOS driver overrides `BYE` so that it calls the proper SVC instead of -just halting). Then, you can dump memory to floppy as you already did for -`RECV`. +And there we go! A Collapse OS launchable from floppy! ## Sending blkfs to floppy @@ -294,7 +237,12 @@ prompt: ' *CL< 0x55 RAM+ ! See B80 for details about those RAM offsets. Your serial link now has the -prompt. Now, you can use `/tools/blkup` to send a disk's contents. First, +prompt. You will also have to make your newlines CRLF. The TRS-80 wants CR +only, but serial communications (and `blkup`) expect CRLF: + + ' CRLF 0x0a RAM+ ! + +Now, you can use `/tools/blkup` to send a disk's contents. First, extract the first 100 blocks from blkfs: dd if=emul/blkfs bs=1024 count=100 > d1 @@ -312,6 +260,14 @@ Making blkfs span multiple disk is a bit problematic with regards to absolute block references in the code. You'll need to work a bit to design your very own Collapse OS floppy set. See Usage guide (B3) for details. +## Coming back to keyboard + +Once you're done, you will want to go back to local control: + + ' CR 0x0a RAM+ ! + 0 0x55 RAM+ ! + 0 0x53 RAM+ ! + ## Self-hosting As it is, your installment of Collapse OS is self-hosting using instructions