mirror of
https://github.com/byteworksinc/ORCALib.git
synced 2025-03-25 19:30:03 +00:00
When argc==0, argv should be a valid pointer and argv[0] should be NULL.
This is normal for S16 programs or inits, and can happen with shell executables in certain cases like when being run from Prizm.
This commit is contained in:
parent
33ab148cea
commit
8533ea221c
20
cc.asm
20
cc.asm
@ -172,8 +172,8 @@ TAB equ 9 TAB key code
|
||||
plb
|
||||
plx
|
||||
ply
|
||||
pea 0 make room for argc, argv
|
||||
pea 0
|
||||
pea targv|-16 make room for argc, argv
|
||||
per targv (default argv = ptr to targv)
|
||||
pea 0
|
||||
phy put the return addr back on the stack
|
||||
phx
|
||||
@ -190,9 +190,12 @@ TAB equ 9 TAB key code
|
||||
|
||||
lda cLine if cLine == 0 then
|
||||
ora cLine+2
|
||||
jeq rtl exit
|
||||
bne lb0
|
||||
stz targv argv[0] = NULL
|
||||
stz targv+2
|
||||
brl rtl exit
|
||||
|
||||
add4 cLine,#8 skip the shell identifier
|
||||
lb0 add4 cLine,#8 skip the shell identifier
|
||||
ldx #0 count the arguments
|
||||
txy
|
||||
short M
|
||||
@ -348,8 +351,8 @@ start ds 2 start of the command line string
|
||||
plb
|
||||
plx
|
||||
ply
|
||||
pea 0 set argc, argv to 0
|
||||
pea 0
|
||||
pea targv|-16 set argc = 0, argv to point to targv
|
||||
per targv
|
||||
pea 0
|
||||
phy put the return addr back on the stack
|
||||
phx
|
||||
@ -357,8 +360,13 @@ start ds 2 start of the command line string
|
||||
stz ~ExitList no exit routines, yet
|
||||
stz ~ExitList+2
|
||||
|
||||
stz targv argv[0] = NULL
|
||||
stz targv+2
|
||||
|
||||
plb return
|
||||
rtl
|
||||
|
||||
targv ds 4
|
||||
end
|
||||
|
||||
****************************************************************
|
||||
|
Loading…
x
Reference in New Issue
Block a user