From bd38d46892a3aa3f814be5fe97f6d7349bcc6428 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Fri, 21 Feb 2020 08:40:42 -0500 Subject: [PATCH] recipes/trs80: fix double line feeds Lines should be terminated only with a CR on this system, not CRLF. --- kernel/stdio.asm | 3 +++ recipes/trs80/README.md | 10 ++++++++++ recipes/trs80/glue.asm | 10 ++++++++++ 3 files changed, 23 insertions(+) diff --git a/kernel/stdio.asm b/kernel/stdio.asm index 1ae2d6d..231fbd5 100644 --- a/kernel/stdio.asm +++ b/kernel/stdio.asm @@ -76,6 +76,9 @@ printnstr: pop bc ret +; Prints a line terminator. This routine is a bit of a misnomer because it's +; designed to be overridable to, for example, printlf, but we'll live with it +; for now... printcrlf: push af ld a, CR diff --git a/recipes/trs80/README.md b/recipes/trs80/README.md index b3f49c5..52d3cf8 100644 --- a/recipes/trs80/README.md +++ b/recipes/trs80/README.md @@ -151,6 +151,10 @@ A memory range dumped this way will be re-loaded at the same offset through using the `RUN` command. Therefore, you can avoid all this work above in later sessions by simply typing `recv` in the DOS prompt. +Note that you might want to turn `debug` off for these commands to run. I'm not +sure why, but when the debugger is on, launching the command triggers the +debugger. + ## Sending binary through the RS-232 port Once you're finished punching your program in memory, you can run it with @@ -186,6 +190,12 @@ If there was no error during `pingpong`, the content should be exact. Nevertheless, I recommend that you manually validate a few bytes using TRSDOS debugger before carrying on. +*debugging tip*: Sometimes, the communication channel can be a bit stubborn and +always fail, as if some leftover data was consistently blocking the channel. It +would cause a data mismatch at the very beginning of the process, all the time. +What I do in these cases is start a `COMM *cl` session on one side and a screen +session on the other, type a few characters, and try `pingpong` again. + ## Running Collapse OS If everything went well, you can run Collapse OS with `g3000`. You'll diff --git a/recipes/trs80/glue.asm b/recipes/trs80/glue.asm index 8718164..164938e 100644 --- a/recipes/trs80/glue.asm +++ b/recipes/trs80/glue.asm @@ -18,6 +18,9 @@ .equ STDIO_PUTC trs80PutC .inc "stdio.asm" +; The TRS-80 generates a double line feed if we give it both CR and LF. +.equ printcrlf printcr + ; *** BASIC *** ; RAM space used in different routines for short term processing. @@ -44,4 +47,11 @@ init: call basInit jp basStart +printcr: + push af + ld a, CR + call STDIO_PUTC + pop af + ret + RAMSTART: