mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-02 14:30:55 +11:00
Compare commits
3 Commits
2860a10f71
...
434c8d5c0d
Author | SHA1 | Date | |
---|---|---|---|
|
434c8d5c0d | ||
|
6224ea2fe9 | ||
|
c3213e1e8c |
@ -1,6 +1,4 @@
|
||||
; *** Requirements ***
|
||||
; BLOCKDEV_SIZE
|
||||
; FS_HANDLE_SIZE
|
||||
; _blkGetB
|
||||
; _blkPutB
|
||||
; _blkSeek
|
||||
|
@ -31,6 +31,7 @@
|
||||
; _blkSeek
|
||||
; _blkTell
|
||||
; printstr
|
||||
; printcrlf
|
||||
|
||||
.inc "user.h"
|
||||
|
||||
|
@ -287,11 +287,5 @@ _ioIncBlk:
|
||||
|
||||
; call printstr followed by newline
|
||||
ioPrintLN:
|
||||
push hl
|
||||
call printstr
|
||||
ld hl, .sCRLF
|
||||
call printstr
|
||||
pop hl
|
||||
ret
|
||||
.sCRLF:
|
||||
.db 0x0a, 0x0d, 0
|
||||
jp printcrlf
|
||||
|
@ -26,6 +26,7 @@ jp _blkPutB
|
||||
jp _blkSeek
|
||||
jp _blkTell
|
||||
jp printstr
|
||||
jp printcrlf
|
||||
|
||||
.inc "core.asm"
|
||||
.inc "str.asm"
|
||||
|
Binary file not shown.
@ -1,7 +1,5 @@
|
||||
.org 0x4800 ; in sync with USER_CODE in glue.asm
|
||||
.equ USER_RAMSTART 0x6000
|
||||
.equ FS_HANDLE_SIZE 8
|
||||
.equ BLOCKDEV_SIZE 8
|
||||
|
||||
; *** JUMP TABLE ***
|
||||
.equ strncmp 0x03
|
||||
@ -17,3 +15,4 @@
|
||||
.equ _blkSeek @+3
|
||||
.equ _blkTell @+3
|
||||
.equ printstr @+3
|
||||
.equ printcrlf @+3
|
||||
|
Binary file not shown.
3
recipes/trs80/.gitignore
vendored
Normal file
3
recipes/trs80/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/cfsin/user.h
|
||||
/cfsin/zasm
|
||||
/cfsin/ed
|
@ -1,10 +1,30 @@
|
||||
SHELLAPPS = zasm ed
|
||||
APPTARGETS = ${SHELLAPPS:%=cfsin/%}
|
||||
CFSTARGETS = $(APPTARGETS) cfsin/user.h
|
||||
TARGET = os.bin
|
||||
BASEDIR = ../..
|
||||
ZASM = $(BASEDIR)/emul/zasm/zasm
|
||||
KERNEL = $(BASEDIR)/kernel
|
||||
APPS = $(BASEDIR)/apps
|
||||
CFSPACK = $(BASEDIR)/tools/cfspack/cfspack
|
||||
|
||||
.PHONY: all
|
||||
all: $(TARGET)
|
||||
all: $(TARGET) floppy.cfs
|
||||
$(TARGET): glue.asm
|
||||
$(ZASM) $(KERNEL) $(APPS) < glue.asm > $@
|
||||
|
||||
$(CFSPACK):
|
||||
make -C $(BASEDIR)/tools/cfspack
|
||||
|
||||
floppy.cfs: $(CFSTARGETS) $(CFSPACK)
|
||||
$(CFSPACK) cfsin > $@
|
||||
|
||||
$(APPTARGETS):
|
||||
$(ZASM) $(KERNEL) $(APPS) user.h < $(APPS)/${@:cfsin/%=%}/glue.asm > $@
|
||||
|
||||
cfsin/user.h: user.h
|
||||
cp user.h $@
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f $(CFSTARGETS) floppy.cfs $(TARGET)
|
||||
|
@ -102,20 +102,20 @@ As stated in the overview, we need a program on the TRS-80 that:
|
||||
That program has already been written, it's in `recv.asm` in this folder. You
|
||||
can get the binary with `zasm < recv.asm | xxd`.
|
||||
|
||||
It's designed to run from offset `0x4000` and write received data in `0x3000`
|
||||
It's designed to run from offset `0x5000` and write received data in `0x3000`
|
||||
and onwards.
|
||||
|
||||
How will you punch that in? The `debug` program! This very useful piece of
|
||||
software is supplied in TRSDOS. To invoke it, first run `debug (on)` and then
|
||||
press the `BREAK` key. You'll get the debug interface which allows you to punch
|
||||
in any data in any memory address. Let's use `0x4000` which is the offset it's
|
||||
in any data in any memory address. Let's use `0x5000` which is the offset it's
|
||||
designed for.
|
||||
|
||||
For reference: to go back to the TRSDOS prompt, it's `o<return>`.
|
||||
|
||||
First, display the `0x4000-0x403f` range with the `d4000<space>` command (I
|
||||
First, display the `0x5000-0x503f` range with the `d5000<space>` command (I
|
||||
always press Enter by mistake, but it's space you need to press). Then, you can
|
||||
begin punching in with `h4000<space>`. This will bring up a visual indicator of
|
||||
begin punching in with `h5000<space>`. This will bring up a visual indicator of
|
||||
the address being edited. Punch in the stuff with a space in between each byte
|
||||
and end the edit session with `x`.
|
||||
|
||||
@ -141,10 +141,10 @@ before `02`.
|
||||
|
||||
If you want to save yourself typing for later sessions, why not save the
|
||||
program you've painfully typed to disk? TRSDOS enables that easily. Let's say
|
||||
that you typed your program at `0x4000` and that you want to save it to
|
||||
that you typed your program at `0x5000` and that you want to save it to
|
||||
`RECV/CMD` on your second floppy drive, you'd do:
|
||||
|
||||
dump recv/cmd:1 (start=x'4000',end=x'4030',tra='4000')
|
||||
dump recv/cmd:1 (start=x'5000',end=x'5030',tra='5000')
|
||||
|
||||
A memory range dumped this way will be re-loaded at the same offset through
|
||||
`load recv/cmd:1`. Even better, `TRA` indicates when to jump after load when
|
||||
@ -158,7 +158,7 @@ debugger.
|
||||
## Sending binary through the RS-232 port
|
||||
|
||||
Once you're finished punching your program in memory, you can run it with
|
||||
`g4000<enter>` (not space). If you've saved it to disk, run `recv` instead.
|
||||
`g5000<enter>` (not space). If you've saved it to disk, run `recv` instead.
|
||||
Because it's an infinite loop, your screen will freeze. You can start sending
|
||||
your data.
|
||||
|
||||
@ -222,3 +222,13 @@ writing `CFS\0\0\0\0` to the disk). If it doesn't error out, commands like
|
||||
There is also a custom `recv` command that does the same "ping pong" as in
|
||||
`recv.asm`, but once. It puts the result in `A`. This can be useful to send down
|
||||
a raw CFS: you just need a while loop that repeatedly call `recv:putb a`.
|
||||
|
||||
## Assembling programs
|
||||
|
||||
Running `make` will yield a `floppy.cfs` file that you can dump on a disk. This
|
||||
CFS contains a properly configured `zasm` as well as a test `hello.asm` file.
|
||||
|
||||
By mounting this CFS (running `fson` with the active device properly placed),
|
||||
you can assemble and run a binary from `hello.asm` in the same way that you
|
||||
would in any CFS-enabled shell. You'll then see those sweet "Assembled from a
|
||||
TRS-80" words!
|
||||
|
11
recipes/trs80/cfsin/hello.asm
Normal file
11
recipes/trs80/cfsin/hello.asm
Normal file
@ -0,0 +1,11 @@
|
||||
.inc "user.h"
|
||||
|
||||
ld hl, sAwesome
|
||||
call printstr
|
||||
xor a ; success
|
||||
ret
|
||||
|
||||
sAwesome:
|
||||
.db "Assembled from a TRS-80", 0x0d, 0
|
||||
|
||||
|
@ -9,6 +9,30 @@
|
||||
.org 0x3000
|
||||
jp init
|
||||
|
||||
; The TRS-80 generates a double line feed if we give it both CR and LF.
|
||||
; Has to be defined before the jump table.
|
||||
.equ printcrlf printcr
|
||||
|
||||
; *** Jump Table ***
|
||||
jp strncmp
|
||||
jp upcase
|
||||
jp findchar
|
||||
jp printstr
|
||||
jp printcrlf
|
||||
jp blkSet
|
||||
jp blkSel
|
||||
jp _blkGetB
|
||||
jp _blkPutB
|
||||
jp _blkSeek
|
||||
jp _blkTell
|
||||
jp fsFindFN
|
||||
jp fsOpen
|
||||
jp fsGetB
|
||||
jp fsPutB
|
||||
jp fsSetSize
|
||||
jp stdioPutC
|
||||
jp stdioReadLine
|
||||
|
||||
.inc "err.h"
|
||||
.inc "blkdev.h"
|
||||
.inc "fs.h"
|
||||
@ -38,9 +62,6 @@
|
||||
.equ FS_HANDLE_COUNT 2
|
||||
.inc "fs.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.
|
||||
@ -142,7 +163,9 @@ basFindCmdExtra:
|
||||
call basFindCmd
|
||||
ret z
|
||||
ld hl, .cmds
|
||||
jp basFindCmd
|
||||
call basFindCmd
|
||||
ret z
|
||||
jp basPgmHook
|
||||
|
||||
.cmds:
|
||||
.db "recv", 0
|
||||
|
19
recipes/trs80/user.h
Normal file
19
recipes/trs80/user.h
Normal file
@ -0,0 +1,19 @@
|
||||
.org 0x5800
|
||||
.equ strncmp 0x3003
|
||||
.equ upcase @+3
|
||||
.equ findchar @+3
|
||||
.equ printstr @+3
|
||||
.equ printcrlf @+3
|
||||
.equ blkSet @+3
|
||||
.equ blkSel @+3
|
||||
.equ _blkGetB @+3
|
||||
.equ _blkPutB @+3
|
||||
.equ _blkSeek @+3
|
||||
.equ _blkTell @+3
|
||||
.equ fsFindFN @+3
|
||||
.equ fsOpen @+3
|
||||
.equ fsGetB @+3
|
||||
.equ fsPutB @+3
|
||||
.equ fsSetSize @+3
|
||||
.equ stdioPutC @+3
|
||||
.equ stdioReadLine @+3
|
Loading…
Reference in New Issue
Block a user