diff --git a/SYS/KERNEL.S.PS.txt b/SYS/KERNEL.S.PS.txt index e68de8b7..82dd024b 100644 --- a/SYS/KERNEL.S.PS.txt +++ b/SYS/KERNEL.S.PS.txt @@ -57,19 +57,26 @@ K.ExecL sty .1+1 K.ExecV >STYA PS.ArgV >PULLB PS.Flags -PS.Exec jsr PS.CreateChild Child S.PS at ZPPtr3 +PS.Exec stz PS.Load.hBIN + + jsr PS.CreateChild Child S.PS at ZPPtr3 bcs .9 sta .8+1 jsr PS.Load - bcs .99 + bcs .90 jsr PS.AddArgV bcc .8 -.99 pha save error code - lda .8+1 +.90 pha save error code + lda PS.Load.hBIN + beq .91 + + jsr K.FreeMem + +.91 lda .8+1 jsr CORE.PSFree pla get back error code sec @@ -248,6 +255,10 @@ PS.Load >PUSHWI K.S.STAT bne .4 >LDYAI K.Buf256 + >SYSCALL NewStr + bcs .99 + stx PS.Load.hBIN + bra PS.LoadBIN.YA .97 lda #E.BADPATH @@ -371,9 +382,61 @@ PS.LoadGetHeader *-------------------------------------- PS.Load.ROOT .AZ "ROOT" PS.Load.HEADER .AZ "#!/" +PS.Load.hBIN .BS 1 +PS.Load.ArgSize .BS 2 *-------------------------------------- -PS.AddArgV >LDYA PS.ArgV - jsr PS.DupArgs +* hBIN + PS.ArgV -> #S.PS.hARGV +*-------------------------------------- +PS.AddArgV stz PS.Load.ArgSize + stz PS.Load.ArgSize+1 + + lda PS.Load.hBIN + beq .10 + + jsr K.GetMemPtr + >STYA PS.Load.ArgSize + + >LDYA PS.ArgV + >STYA ZPPtr1 + >STYA ZPPtr2 + +.1 lda (ZPPtr2) + beq .4 + + ldy #0 + +.2 iny + lda (ZPPtr2),y + bne .2 + + tya + sec + adc PS.Load.ArgSize + sta PS.Load.ArgSize + bcc .3 + + inc PS.Load.ArgSize+1 + +.3 tya + sec + adc ZPPtr2 + sta ZPPtr2 + bcc .1 + inc ZPPtr2+1 + bra .1 + +.4 >LDYA PS.Load.ArgSize + iny + bne .5 + inc + + jsr K.GetMem + bcs .9 + + + + + bcs .9 ldy #S.PS.hARGV sta (ZPPtr3),y