mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 15:08:05 +11:00
pgm: properly pass shell args in HL
This commit is contained in:
parent
ecbb77072e
commit
a48a91c8da
@ -35,16 +35,19 @@ pgmShellHook:
|
|||||||
call fsFindFN
|
call fsFindFN
|
||||||
jr nz, .noFile
|
jr nz, .noFile
|
||||||
; We have a file! Load it and run it.
|
; We have a file! Load it and run it.
|
||||||
|
ex de, hl ; but first, make HL point to unparsed args.
|
||||||
jp pgmRun
|
jp pgmRun
|
||||||
.noFile:
|
.noFile:
|
||||||
ld a, SHELL_ERR_IO_ERROR
|
ld a, SHELL_ERR_IO_ERROR
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; Loads code in file that FS_PTR is currently pointing at and place it in
|
; Loads code in file that FS_PTR is currently pointing at and place it in
|
||||||
; PGM_CODEADDR. Then, jump to PGM_CODEADDR.
|
; PGM_CODEADDR. Then, jump to PGM_CODEADDR. We expect HL to point to unparsed
|
||||||
|
; arguments being given to the program.
|
||||||
pgmRun:
|
pgmRun:
|
||||||
call fsIsValid
|
call fsIsValid
|
||||||
jr nz, .ioError
|
jr nz, .ioError
|
||||||
|
push hl ; unparsed args
|
||||||
ld ix, FS_HANDLES
|
ld ix, FS_HANDLES
|
||||||
call fsOpen
|
call fsOpen
|
||||||
ld hl, PGM_CODEADDR
|
ld hl, PGM_CODEADDR
|
||||||
@ -53,6 +56,8 @@ pgmRun:
|
|||||||
ld (hl), a ; Z preserved
|
ld (hl), a ; Z preserved
|
||||||
inc hl ; Z preserved in 16-bit
|
inc hl ; Z preserved in 16-bit
|
||||||
jr z, .loop
|
jr z, .loop
|
||||||
|
|
||||||
|
pop hl ; recall args
|
||||||
; ready to jump!
|
; ready to jump!
|
||||||
jp PGM_CODEADDR
|
jp PGM_CODEADDR
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user