mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-26 07:18:05 +11:00
Compare commits
4 Commits
66dacd1816
...
08392fee60
Author | SHA1 | Date | |
---|---|---|---|
|
08392fee60 | ||
|
0fb7995166 | ||
|
30a0f69101 | ||
|
270ad926c9 |
@ -33,47 +33,56 @@ jp aciaInt
|
|||||||
.equ STDIO_PUTC aciaPutC
|
.equ STDIO_PUTC aciaPutC
|
||||||
.inc "stdio.asm"
|
.inc "stdio.asm"
|
||||||
|
|
||||||
|
.inc "lib/args.asm"
|
||||||
.equ AT28W_RAMSTART STDIO_RAMEND
|
.equ AT28W_RAMSTART STDIO_RAMEND
|
||||||
.inc "at28w/main.asm"
|
.inc "at28w/main.asm"
|
||||||
|
|
||||||
; *** Shell ***
|
; *** BASIC ***
|
||||||
.inc "lib/util.asm"
|
|
||||||
.inc "lib/parse.asm"
|
|
||||||
.inc "lib/args.asm"
|
|
||||||
.inc "lib/stdio.asm"
|
|
||||||
.equ SHELL_RAMSTART AT28W_RAMEND
|
|
||||||
.equ SHELL_EXTRA_CMD_COUNT 5
|
|
||||||
.inc "shell/main.asm"
|
|
||||||
; Extra cmds
|
|
||||||
.dw a28wCmd
|
|
||||||
.dw blkBselCmd, blkSeekCmd, blkLoadCmd, blkSaveCmd
|
|
||||||
|
|
||||||
.inc "shell/blkdev.asm"
|
; RAM space used in different routines for short term processing.
|
||||||
|
.equ SCRATCHPAD_SIZE 0x20
|
||||||
|
.equ SCRATCHPAD AT28W_RAMEND
|
||||||
|
.inc "lib/util.asm"
|
||||||
|
.inc "lib/ari.asm"
|
||||||
|
.inc "lib/parse.asm"
|
||||||
|
.inc "lib/fmt.asm"
|
||||||
|
.equ EXPR_PARSE parseLiteralOrVar
|
||||||
|
.inc "lib/expr.asm"
|
||||||
|
.inc "basic/util.asm"
|
||||||
|
.inc "basic/parse.asm"
|
||||||
|
.inc "basic/tok.asm"
|
||||||
|
.equ VAR_RAMSTART SCRATCHPAD+SCRATCHPAD_SIZE
|
||||||
|
.inc "basic/var.asm"
|
||||||
|
.equ BUF_RAMSTART VAR_RAMEND
|
||||||
|
.inc "basic/buf.asm"
|
||||||
|
.inc "basic/blk.asm"
|
||||||
|
.equ BAS_RAMSTART BUF_RAMEND
|
||||||
|
.inc "basic/main.asm"
|
||||||
|
|
||||||
init:
|
init:
|
||||||
di
|
di
|
||||||
; setup stack
|
; setup stack
|
||||||
ld hl, RAMEND
|
ld sp, RAMEND
|
||||||
ld sp, hl
|
|
||||||
im 1
|
im 1
|
||||||
|
|
||||||
call aciaInit
|
call aciaInit
|
||||||
call shellInit
|
|
||||||
|
|
||||||
xor a
|
xor a
|
||||||
ld de, BLOCKDEV_SEL
|
ld de, BLOCKDEV_SEL
|
||||||
call blkSel
|
call blkSel
|
||||||
|
|
||||||
|
call basInit
|
||||||
|
ld hl, basFindCmdExtra
|
||||||
|
ld (BAS_FINDHOOK), hl
|
||||||
ei
|
ei
|
||||||
jp shellLoop
|
jp basStart
|
||||||
|
|
||||||
a28wCmd:
|
|
||||||
.db "a28w", 0b011, 0b001, 0
|
|
||||||
ld a, (hl)
|
|
||||||
ld (AT28W_MAXBYTES), a
|
|
||||||
inc hl
|
|
||||||
ld a, (hl)
|
|
||||||
ld (AT28W_MAXBYTES+1), a
|
|
||||||
jp at28wInner
|
|
||||||
|
|
||||||
|
|
||||||
|
basFindCmdExtra:
|
||||||
|
ld hl, basBLKCmds
|
||||||
|
call basFindCmd
|
||||||
|
ret z
|
||||||
|
ld hl, .mycmds
|
||||||
|
jp basFindCmd
|
||||||
|
.mycmds:
|
||||||
|
.db "at28w", 0
|
||||||
|
.dw at28wMain
|
||||||
|
.db 0xff
|
||||||
|
@ -37,7 +37,7 @@ thing!
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
On boot, you will get a regular Collapse OS shell. See the rest of the
|
On boot, you will get a regular Collapse OS BASIC shell. See the rest of the
|
||||||
documentation for shell usage instructions.
|
documentation for shell usage instructions.
|
||||||
|
|
||||||
The particularity here is that, unlike with the RC2014, we don't access Collapse
|
The particularity here is that, unlike with the RC2014, we don't access Collapse
|
||||||
|
@ -24,14 +24,26 @@
|
|||||||
.equ STDIO_PUTC vdpPutC
|
.equ STDIO_PUTC vdpPutC
|
||||||
.inc "stdio.asm"
|
.inc "stdio.asm"
|
||||||
|
|
||||||
; *** Shell ***
|
; *** BASIC ***
|
||||||
|
|
||||||
|
; RAM space used in different routines for short term processing.
|
||||||
|
.equ SCRATCHPAD_SIZE 0x20
|
||||||
|
.equ SCRATCHPAD STDIO_RAMEND
|
||||||
.inc "lib/util.asm"
|
.inc "lib/util.asm"
|
||||||
|
.inc "lib/ari.asm"
|
||||||
.inc "lib/parse.asm"
|
.inc "lib/parse.asm"
|
||||||
.inc "lib/args.asm"
|
.inc "lib/fmt.asm"
|
||||||
.inc "lib/stdio.asm"
|
.equ EXPR_PARSE parseLiteralOrVar
|
||||||
.equ SHELL_RAMSTART STDIO_RAMEND
|
.inc "lib/expr.asm"
|
||||||
.equ SHELL_EXTRA_CMD_COUNT 0
|
.inc "basic/util.asm"
|
||||||
.inc "shell/main.asm"
|
.inc "basic/parse.asm"
|
||||||
|
.inc "basic/tok.asm"
|
||||||
|
.equ VAR_RAMSTART SCRATCHPAD+SCRATCHPAD_SIZE
|
||||||
|
.inc "basic/var.asm"
|
||||||
|
.equ BUF_RAMSTART VAR_RAMEND
|
||||||
|
.inc "basic/buf.asm"
|
||||||
|
.equ BAS_RAMSTART BUF_RAMEND
|
||||||
|
.inc "basic/main.asm"
|
||||||
|
|
||||||
init:
|
init:
|
||||||
di
|
di
|
||||||
@ -41,8 +53,8 @@ init:
|
|||||||
|
|
||||||
call padInit
|
call padInit
|
||||||
call vdpInit
|
call vdpInit
|
||||||
call shellInit
|
call basInit
|
||||||
jp shellLoop
|
jp basStart
|
||||||
|
|
||||||
.fill 0x7ff0-$
|
.fill 0x7ff0-$
|
||||||
.db "TMR SEGA", 0x00, 0x00, 0xfb, 0x68, 0x00, 0x00, 0x00, 0x4c
|
.db "TMR SEGA", 0x00, 0x00, 0xfb, 0x68, 0x00, 0x00, 0x00, 0x4c
|
||||||
|
@ -26,14 +26,26 @@
|
|||||||
.equ STDIO_PUTC vdpPutC
|
.equ STDIO_PUTC vdpPutC
|
||||||
.inc "stdio.asm"
|
.inc "stdio.asm"
|
||||||
|
|
||||||
; *** Shell ***
|
; *** BASIC ***
|
||||||
|
|
||||||
|
; RAM space used in different routines for short term processing.
|
||||||
|
.equ SCRATCHPAD_SIZE 0x20
|
||||||
|
.equ SCRATCHPAD STDIO_RAMEND
|
||||||
.inc "lib/util.asm"
|
.inc "lib/util.asm"
|
||||||
|
.inc "lib/ari.asm"
|
||||||
.inc "lib/parse.asm"
|
.inc "lib/parse.asm"
|
||||||
.inc "lib/args.asm"
|
.inc "lib/fmt.asm"
|
||||||
.inc "lib/stdio.asm"
|
.equ EXPR_PARSE parseLiteralOrVar
|
||||||
.equ SHELL_RAMSTART STDIO_RAMEND
|
.inc "lib/expr.asm"
|
||||||
.equ SHELL_EXTRA_CMD_COUNT 0
|
.inc "basic/util.asm"
|
||||||
.inc "shell/main.asm"
|
.inc "basic/parse.asm"
|
||||||
|
.inc "basic/tok.asm"
|
||||||
|
.equ VAR_RAMSTART SCRATCHPAD+SCRATCHPAD_SIZE
|
||||||
|
.inc "basic/var.asm"
|
||||||
|
.equ BUF_RAMSTART VAR_RAMEND
|
||||||
|
.inc "basic/buf.asm"
|
||||||
|
.equ BAS_RAMSTART BUF_RAMEND
|
||||||
|
.inc "basic/main.asm"
|
||||||
|
|
||||||
init:
|
init:
|
||||||
di
|
di
|
||||||
@ -53,8 +65,8 @@ init:
|
|||||||
|
|
||||||
call kbdInit
|
call kbdInit
|
||||||
call vdpInit
|
call vdpInit
|
||||||
call shellInit
|
call basInit
|
||||||
jp shellLoop
|
jp basStart
|
||||||
|
|
||||||
.fill 0x7ff0-$
|
.fill 0x7ff0-$
|
||||||
.db "TMR SEGA", 0x00, 0x00, 0xfb, 0x68, 0x00, 0x00, 0x00, 0x4c
|
.db "TMR SEGA", 0x00, 0x00, 0xfb, 0x68, 0x00, 0x00, 0x00, 0x4c
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
|
; TODO: This recipe has not been tested since its conversion to the BASIC shell.
|
||||||
|
; My PS/2 adapter has been acting up and probably has a loose wire. I need to
|
||||||
|
; fix it beore I can test this recipe on real hardware.
|
||||||
|
; But theoretically, it works...
|
||||||
|
|
||||||
; 8K of onboard RAM
|
; 8K of onboard RAM
|
||||||
.equ RAMSTART 0xc000
|
.equ RAMSTART 0xc000
|
||||||
.equ USER_RAMSTART 0xc200
|
.equ USER_CODE 0xd500
|
||||||
; Memory register at the end of RAM. Must not overwrite
|
; Memory register at the end of RAM. Must not overwrite
|
||||||
.equ RAMEND 0xddd0
|
.equ RAMEND 0xddd0
|
||||||
|
|
||||||
@ -19,7 +24,6 @@
|
|||||||
jp fsGetB
|
jp fsGetB
|
||||||
jp fsPutB
|
jp fsPutB
|
||||||
jp fsSetSize
|
jp fsSetSize
|
||||||
jp parseArgs
|
|
||||||
jp printstr
|
jp printstr
|
||||||
jp _blkGetB
|
jp _blkGetB
|
||||||
jp _blkPutB
|
jp _blkPutB
|
||||||
@ -70,25 +74,32 @@
|
|||||||
.equ FS_HANDLE_COUNT 2
|
.equ FS_HANDLE_COUNT 2
|
||||||
.inc "fs.asm"
|
.inc "fs.asm"
|
||||||
|
|
||||||
; *** Shell ***
|
; *** BASIC ***
|
||||||
|
|
||||||
|
; RAM space used in different routines for short term processing.
|
||||||
|
.equ SCRATCHPAD_SIZE 0x20
|
||||||
|
.equ SCRATCHPAD FS_RAMEND
|
||||||
.inc "lib/util.asm"
|
.inc "lib/util.asm"
|
||||||
|
.inc "lib/ari.asm"
|
||||||
.inc "lib/parse.asm"
|
.inc "lib/parse.asm"
|
||||||
.inc "lib/args.asm"
|
.inc "lib/fmt.asm"
|
||||||
.inc "lib/stdio.asm"
|
.equ EXPR_PARSE parseLiteralOrVar
|
||||||
.equ SHELL_RAMSTART FS_RAMEND
|
.inc "lib/expr.asm"
|
||||||
.equ SHELL_EXTRA_CMD_COUNT 10
|
.inc "basic/util.asm"
|
||||||
.inc "shell/main.asm"
|
.inc "basic/parse.asm"
|
||||||
.dw edCmd, zasmCmd, fnewCmd, fdelCmd, fopnCmd, flsCmd, blkBselCmd
|
.inc "basic/tok.asm"
|
||||||
.dw blkSeekCmd, blkLoadCmd, blkSaveCmd
|
.equ VAR_RAMSTART SCRATCHPAD+SCRATCHPAD_SIZE
|
||||||
|
.inc "basic/var.asm"
|
||||||
|
.equ BUF_RAMSTART VAR_RAMEND
|
||||||
|
.inc "basic/buf.asm"
|
||||||
|
.equ BFS_RAMSTART BUF_RAMEND
|
||||||
|
.inc "basic/fs.asm"
|
||||||
|
.inc "basic/blk.asm"
|
||||||
|
.equ BAS_RAMSTART BFS_RAMEND
|
||||||
|
.inc "basic/main.asm"
|
||||||
|
|
||||||
.inc "shell/blkdev.asm"
|
; USER_CODE is set according to this output below.
|
||||||
.inc "shell/fs.asm"
|
.out BAS_RAMEND
|
||||||
|
|
||||||
.equ PGM_RAMSTART SHELL_RAMEND
|
|
||||||
.equ PGM_CODEADDR USER_RAMSTART
|
|
||||||
.inc "shell/pgm.asm"
|
|
||||||
|
|
||||||
.out PGM_RAMEND
|
|
||||||
|
|
||||||
init:
|
init:
|
||||||
di
|
di
|
||||||
@ -116,10 +127,28 @@ init:
|
|||||||
call kbdInit
|
call kbdInit
|
||||||
call vdpInit
|
call vdpInit
|
||||||
|
|
||||||
call shellInit
|
call basInit
|
||||||
ld hl, pgmShellHook
|
ld hl, basFindCmdExtra
|
||||||
ld (SHELL_CMDHOOK), hl
|
ld (BAS_FINDHOOK), hl
|
||||||
jp shellLoop
|
jp basStart
|
||||||
|
|
||||||
|
basFindCmdExtra:
|
||||||
|
ld hl, basFSCmds
|
||||||
|
call basFindCmd
|
||||||
|
ret z
|
||||||
|
ld hl, basBLKCmds
|
||||||
|
call basFindCmd
|
||||||
|
ret z
|
||||||
|
ld hl, .mycmds
|
||||||
|
call basFindCmd
|
||||||
|
ret z
|
||||||
|
jp basPgmHook
|
||||||
|
.mycmds:
|
||||||
|
.db "ed", 0
|
||||||
|
.dw 0x1e00
|
||||||
|
.db "zasm", 0
|
||||||
|
.dw 0x2300
|
||||||
|
.db 0xff
|
||||||
|
|
||||||
f0GetB:
|
f0GetB:
|
||||||
ld ix, FS_HANDLES
|
ld ix, FS_HANDLES
|
||||||
@ -137,30 +166,14 @@ f1PutB:
|
|||||||
ld ix, FS_HANDLES+FS_HANDLE_SIZE
|
ld ix, FS_HANDLES+FS_HANDLE_SIZE
|
||||||
jp fsPutB
|
jp fsPutB
|
||||||
|
|
||||||
edCmd:
|
; last time I checked, PC at this point was 0x1df8. Let's give us a nice margin
|
||||||
.db "ed", 0, 0, 0b1001, 0, 0
|
|
||||||
push hl \ pop ix
|
|
||||||
ld l, (ix)
|
|
||||||
ld h, (ix+1)
|
|
||||||
jp 0x1900
|
|
||||||
|
|
||||||
zasmCmd:
|
|
||||||
.db "zasm", 0b1001, 0, 0
|
|
||||||
push hl \ pop ix
|
|
||||||
ld l, (ix)
|
|
||||||
ld h, (ix+1)
|
|
||||||
jp 0x1d00
|
|
||||||
|
|
||||||
; last time I checked, PC at this point was 0x183c. Let's give us a nice margin
|
|
||||||
; for the start of ed.
|
; for the start of ed.
|
||||||
.fill 0x1900-$
|
.fill 0x1e00-$
|
||||||
.bin "ed.bin"
|
.bin "ed.bin"
|
||||||
|
|
||||||
; Last check: 0x1c4e
|
; Last check: 0x22dd
|
||||||
.fill 0x1d00-$
|
.fill 0x2300-$
|
||||||
.bin "zasm.bin"
|
.bin "zasm.bin"
|
||||||
|
|
||||||
.fill 0x7ff0-$
|
.fill 0x7ff0-$
|
||||||
.db "TMR SEGA", 0x00, 0x00, 0xfb, 0x68, 0x00, 0x00, 0x00, 0x4c
|
.db "TMR SEGA", 0x00, 0x00, 0xfb, 0x68, 0x00, 0x00, 0x00, 0x4c
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.equ USER_RAMSTART 0xc200
|
.equ USER_CODE 0xc200
|
||||||
; Make ed fit in SMS's memory
|
; Make ed fit in SMS's memory
|
||||||
.equ ED_BUF_MAXLINES 0x100
|
.equ ED_BUF_MAXLINES 0x100
|
||||||
.equ ED_BUF_PADMAXLEN 0x800
|
.equ ED_BUF_PADMAXLEN 0x800
|
||||||
@ -22,7 +22,6 @@
|
|||||||
.equ fsGetB @+3
|
.equ fsGetB @+3
|
||||||
.equ fsPutB @+3
|
.equ fsPutB @+3
|
||||||
.equ fsSetSize @+3
|
.equ fsSetSize @+3
|
||||||
.equ parseArgs @+3
|
|
||||||
.equ printstr @+3
|
.equ printstr @+3
|
||||||
.equ _blkGetB @+3
|
.equ _blkGetB @+3
|
||||||
.equ _blkPutB @+3
|
.equ _blkPutB @+3
|
||||||
|
@ -54,7 +54,7 @@ static int inpt_size;
|
|||||||
static int inpt_ptr;
|
static int inpt_ptr;
|
||||||
static uint8_t middle_of_seek_tell = 0;
|
static uint8_t middle_of_seek_tell = 0;
|
||||||
|
|
||||||
static uint8_t fsdev[0x40000] = {0};
|
static uint8_t fsdev[0x80000] = {0};
|
||||||
static uint32_t fsdev_size = 0;
|
static uint32_t fsdev_size = 0;
|
||||||
static uint32_t fsdev_ptr = 0;
|
static uint32_t fsdev_ptr = 0;
|
||||||
static uint8_t fsdev_seek_tell_cnt = 0;
|
static uint8_t fsdev_seek_tell_cnt = 0;
|
||||||
|
@ -47,14 +47,26 @@ def main():
|
|||||||
|
|
||||||
for i, c in enumerate(fcontents):
|
for i, c in enumerate(fcontents):
|
||||||
c = bytes([c])
|
c = bytes([c])
|
||||||
|
print('.', end='', flush=True)
|
||||||
|
for _ in range(5): # try 5 times
|
||||||
sendcmd(fd, 'getc')
|
sendcmd(fd, 'getc')
|
||||||
os.write(fd, c)
|
os.write(fd, c)
|
||||||
os.read(fd, 2) # read prompt
|
os.read(fd, 2) # read prompt
|
||||||
sendcmd(fd, 'putc a')
|
sendcmd(fd, 'print a')
|
||||||
|
s = b''
|
||||||
|
while True:
|
||||||
r = os.read(fd, 1) # putc result
|
r = os.read(fd, 1) # putc result
|
||||||
os.read(fd, 2) # read prompt
|
if not r.isdigit():
|
||||||
if r != c:
|
break
|
||||||
print(f"Mismatch at byte {i}! {c} != {r}")
|
s += r
|
||||||
|
os.read(fd, 3) # read prompt
|
||||||
|
if int(s) == c[0]:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
print(f"Mismatch at byte {i}! {c} != {r}. Retrying")
|
||||||
|
else:
|
||||||
|
print("Maximum retries reached, abort")
|
||||||
|
return 1
|
||||||
sendcmd(fd, 'poke m a')
|
sendcmd(fd, 'poke m a')
|
||||||
os.read(fd, 2) # read prompt
|
os.read(fd, 2) # read prompt
|
||||||
sendcmd(fd, 'm=m+1')
|
sendcmd(fd, 'm=m+1')
|
||||||
|
Loading…
Reference in New Issue
Block a user