mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-25 20:33:13 +00:00
Kernel 0.93+
This commit is contained in:
parent
1df9d5e505
commit
7639e30658
@ -41,7 +41,7 @@ CS.START cld
|
||||
.DA #0
|
||||
.DA CS.END-CS.START Code Size (without Constants)
|
||||
.DA DS.END-DS.START Data SegmentSize
|
||||
.DA #16 Stack Size
|
||||
.DA #64 Stack Size
|
||||
.DA #ZS.END-ZS.START Zero Page Size
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
|
@ -42,7 +42,7 @@ CS.START cld
|
||||
.DA #0
|
||||
.DA CS.END-CS.START Code Size (without Constants)
|
||||
.DA DS.END-DS.START Data Segment Size
|
||||
.DA #16 Stack Size
|
||||
.DA #64 Stack Size
|
||||
.DA #ZS.END-ZS.START Zero Page Size
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
|
@ -95,7 +95,7 @@ Dev.Detect >LDYA L.MSG.DETECT
|
||||
.3 >SYSCALL puts
|
||||
|
||||
>PUSHWI DRV.END
|
||||
>PUSHWI DRV.CS.END
|
||||
>PUSHWI DRV.CS.END-DRV.CS.START
|
||||
>PUSHWI DRV.CS.START
|
||||
>LDYA L.DRV.CS.START
|
||||
>SYSCALL InsDrv
|
||||
|
@ -86,7 +86,7 @@ Dev.Detect >STYA ARGS
|
||||
>SYSCALL printf
|
||||
|
||||
>PUSHWI DRV.END
|
||||
>PUSHWI DRV.CS.END
|
||||
>PUSHWI DRV.CS.END-DRV.CS.START
|
||||
>PUSHWI DRV.CS.START
|
||||
>LDYA L.DRV.CS.START
|
||||
>SYSCALL InsDrv
|
||||
|
@ -86,7 +86,7 @@ Dev.Detect >LDYA L.MSG.DETECT
|
||||
>SYSCALL printf
|
||||
|
||||
>PUSHWI DRV.END
|
||||
>PUSHWI DRV.CS.END
|
||||
>PUSHWI DRV.CS.END-DRV.CS.START
|
||||
>PUSHWI DRV.CS.START
|
||||
>LDYA L.DRV.CS.START
|
||||
>SYSCALL InsDrv
|
||||
|
@ -105,7 +105,7 @@ Dev.Detect >STYA ARGS
|
||||
>SYSCALL printf
|
||||
|
||||
>PUSHWI DRV.END
|
||||
>PUSHWI DRV.CS.END
|
||||
>PUSHWI DRV.CS.END-DRV.CS.START
|
||||
>PUSHWI DRV.CS.START
|
||||
>LDYA L.DRV.CS.START
|
||||
>SYSCALL InsDrv
|
||||
|
@ -108,7 +108,7 @@ Dev.Detect >STYA ARGS
|
||||
>SYSCALL printf
|
||||
|
||||
>PUSHWI DRV.END
|
||||
>PUSHWI DRV.CS.END
|
||||
>PUSHWI DRV.CS.END-DRV.CS.START
|
||||
>PUSHWI DRV.CS.START
|
||||
>LDYA L.DRV.CS.START
|
||||
>SYSCALL InsDrv
|
||||
|
@ -106,7 +106,7 @@ Dev.Detect >STYA ARGS
|
||||
>SYSCALL printf
|
||||
|
||||
>PUSHWI DRV.END
|
||||
>PUSHWI DRV.CS.END
|
||||
>PUSHWI DRV.CS.END-DRV.CS.START
|
||||
>PUSHWI DRV.CS.START
|
||||
>LDYA L.DRV.CS.START
|
||||
>SYSCALL InsDrv
|
||||
|
@ -3,9 +3,7 @@ NEW
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR FAC 15 Bytes
|
||||
BIN.CmdLine .BS 2
|
||||
BIN.hMem .BS 1
|
||||
BIN.Move.Len .BS 2
|
||||
BIN.R.CS.Start .BS 2
|
||||
BIN.R.CS.End .BS 2
|
||||
BIN.R.End .BS 2
|
||||
@ -14,28 +12,24 @@ BIN.R.Offset .BS 2
|
||||
*--------------------------------------
|
||||
* LoadLib
|
||||
* in :
|
||||
* Y,A = PTR To "LibName.o" C-String
|
||||
* Y,A = PTR To "LibName" C-String
|
||||
* out :
|
||||
* A = hMem To loaded LIB
|
||||
*--------------------------------------
|
||||
K.LoadLib jsr ENV.Search.LIB
|
||||
bcs .9
|
||||
>LDYAI K.Buf256
|
||||
|
||||
jsr BIN.Load Y,A = "/PATH/BIN"
|
||||
bcs .9
|
||||
|
||||
>STYA .1+1
|
||||
stx .8+1
|
||||
|
||||
txa Pass hLib to LibLoad
|
||||
ldx #LIBMGR.LOAD
|
||||
.1 jsr $ffff SELF MODIFIED, Call LIB.LOAD function
|
||||
|
||||
ldx .8+1
|
||||
bcs BIN.Load.Cleanup
|
||||
|
||||
.8 lda #$ff SELF MODIFIED, hLib
|
||||
lda BIN.hMem
|
||||
* clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
@ -71,12 +65,10 @@ K.LoadDrv >STYA .2+1 Save "BIN\0ARGS\0\0"
|
||||
|
||||
jsr ENV.Search.DRV
|
||||
bcs .9
|
||||
>LDYAI K.Buf256
|
||||
jsr BIN.Load Y,A = "/PATH/BIN"
|
||||
bcs .9
|
||||
|
||||
>STYA .3+1
|
||||
stx .8+1
|
||||
|
||||
ldx #$ff
|
||||
|
||||
@ -93,18 +85,17 @@ K.LoadDrv >STYA .2+1 Save "BIN\0ARGS\0\0"
|
||||
|
||||
.3 jsr $ffff SELF MODIFIED, call Dev.Detect
|
||||
|
||||
.8 ldx #$ff SELF MODIFIED, hMem
|
||||
jsr BIN.Load.Cleanup
|
||||
bcs .9
|
||||
|
||||
lda #0 Make sure RC = 0 if success
|
||||
clc
|
||||
* clc
|
||||
.9 rts
|
||||
|
||||
BIN.Load.Cleanup
|
||||
php
|
||||
pha
|
||||
txa
|
||||
lda BIN.hMem
|
||||
jsr K.FreeMem
|
||||
pla
|
||||
plp
|
||||
@ -118,9 +109,7 @@ BIN.Load.Cleanup.RTS
|
||||
* Y,A = MEMPTR
|
||||
* X = hMem of Code Segment
|
||||
*--------------------------------------
|
||||
BIN.Load >STYA BIN.CmdLine
|
||||
|
||||
ldx #0
|
||||
BIN.Load ldx #0
|
||||
|
||||
.1 cpx Mem.LastSlot
|
||||
beq BIN.Load.1
|
||||
@ -142,21 +131,19 @@ BIN.Load >STYA BIN.CmdLine
|
||||
|
||||
ldy #0
|
||||
|
||||
.2 lda (BIN.CmdLine),y
|
||||
.2 lda K.Buf256,y
|
||||
.3 cmp $ffff,y SELF MODIFIED
|
||||
bne .1
|
||||
iny
|
||||
ora #0
|
||||
bne .2
|
||||
|
||||
stx BIN.hMem save hMem
|
||||
txa
|
||||
jsr MEM.GetMemByID
|
||||
|
||||
jsr Mem.IncRefCnt
|
||||
|
||||
clc
|
||||
jmp MEM.GetMEMPTR
|
||||
* X=hMem, Y,A=Ptr
|
||||
jmp MEM.GetMEMPTR Y,A=Ptr
|
||||
*--------------------------------------
|
||||
* STAT Already called by Filesearch in FindDRV, FindLIB
|
||||
* STAT Already called by PS.Load (TXT,BIN,SYS)
|
||||
@ -167,18 +154,16 @@ BIN.Load.1 >LDYA K.S.STAT+S.STAT.P.AUXTYPE
|
||||
>PUSHYA Push AUXTYPE
|
||||
>PUSHBI S.FI.T.BIN
|
||||
>PUSHBI O.RDONLY
|
||||
>LDYA BIN.CmdLine
|
||||
>LDYAI K.Buf256
|
||||
|
||||
ldx #SYS.LoadFile
|
||||
jsr K.SYSCALL2.BANK BANK1!!!
|
||||
bcs BIN.Load.Cleanup.RTS Error Loading file
|
||||
|
||||
stx BIN.hMem save hMem
|
||||
|
||||
pha YA=CODE+DATA size
|
||||
tya
|
||||
* clc CC from bcs .99
|
||||
|
||||
* clc
|
||||
adc BIN.R.CS.Start Get AUXTYPE for actual Base Address
|
||||
sta BIN.R.End compute Range End=AUXTYPE+FILELEN
|
||||
pla
|
||||
@ -187,30 +172,20 @@ BIN.Load.1 >LDYA K.S.STAT+S.STAT.P.AUXTYPE
|
||||
|
||||
txa
|
||||
jsr K.GetMemPtr
|
||||
>STYA ZPPtr1 set ZPPtr1 -> Code start
|
||||
>STYA ZPPtr1 set ZPPtr1 -> New Code start
|
||||
|
||||
pha YA = actual load address
|
||||
tya
|
||||
sec
|
||||
sbc BIN.R.CS.Start
|
||||
sta BIN.R.Offset Offset=ZPPtr1-AUXTYPE
|
||||
pla
|
||||
sbc BIN.R.CS.Start+1
|
||||
sta BIN.R.Offset+1
|
||||
jsr BIN.ComputeOffsetYA YA = actual load address
|
||||
|
||||
ldy #H.BIN.CS.SIZE get Code Len
|
||||
lda (ZPPtr1),y
|
||||
clc
|
||||
adc BIN.R.CS.Start
|
||||
sta BIN.R.CS.End ZPPtr1 + CodeLen
|
||||
pha
|
||||
iny
|
||||
lda (ZPPtr1),y
|
||||
adc BIN.R.CS.Start+1
|
||||
sta BIN.R.CS.End+1
|
||||
|
||||
ply
|
||||
jsr BIN.ComputeCSEndYA
|
||||
jsr BIN.RelExe
|
||||
|
||||
>LDYA BIN.CmdLine get back bin path
|
||||
>LDYAI K.Buf256 get back bin path
|
||||
ldx #SYS.strdup make a copy of this string
|
||||
jsr K.SYSCALL2.BANK
|
||||
bcs .98
|
||||
@ -226,65 +201,53 @@ BIN.Load.1 >LDYA K.S.STAT+S.STAT.P.AUXTYPE
|
||||
ldy #S.MEM.BIN
|
||||
sta (ZPMemMgrSPtr),y
|
||||
|
||||
ldx BIN.hMem return hMEM to Caller...
|
||||
clc
|
||||
jmp MEM.GetMEMPTR ...and Y,A=PTR to CS
|
||||
|
||||
.98 ldx BIN.hMem
|
||||
jmp BIN.Load.Cleanup Discard Loaded Code, exits CS
|
||||
.98 jmp BIN.Load.Cleanup Discard Loaded Code, exits CS
|
||||
*/--------------------------------------
|
||||
* # InsDrv
|
||||
* ## C
|
||||
* `void * insdrv (void * src, void * crvcsstart, void * drvcsend, void * drvend);`
|
||||
* `void * insdrv (void * src, void * crvcsstart, void * drvcssize, void * drvend);`
|
||||
* ## ASM
|
||||
* **In:**
|
||||
* `>PUSHW DRV.END`
|
||||
* `>PUSHW DRV.CS.END`
|
||||
* `>PUSHW DRV.CS.SIZE`
|
||||
* `>PUSHW DRV.CS.START`
|
||||
* `>LDYA L.SRC`
|
||||
* `>SYSCALL insdrv`
|
||||
* ## RETURN VALUE
|
||||
* Y,A = Ptr to installed driver
|
||||
*\--------------------------------------
|
||||
K.InsDrv >STYA ZPPtr2 SRC PTR
|
||||
K.InsDrv >STYA ZPPtr3 SRC PTR for move
|
||||
|
||||
>PULLW BIN.R.CS.Start
|
||||
>PULLW BIN.R.CS.End
|
||||
>PULLYA CS Len
|
||||
jsr BIN.ComputeCSEndYA
|
||||
>PULLW BIN.R.End
|
||||
|
||||
lda BIN.R.End Compute DRVLen=End-start
|
||||
sec
|
||||
sbc BIN.R.CS.Start
|
||||
sta BIN.Move.Len
|
||||
tay
|
||||
|
||||
lda BIN.R.End+1
|
||||
sbc BIN.R.CS.Start+1
|
||||
sta BIN.Move.Len+1
|
||||
|
||||
jsr MEM.GetKrnlBuf Y,A = LEN
|
||||
jsr MEM.GetKrnlBuf Y,A = CODE + DATA
|
||||
bcs .9 No More Room to load Driver
|
||||
|
||||
>STYA ZPPtr1 Y,A = DST Buf for RelDrv...
|
||||
>STYA ZPPtr3 ...for move...
|
||||
>STYA ZPPtr4 ...for move...
|
||||
sty .7+1 ...and for exit
|
||||
sta .8+1
|
||||
|
||||
lda ZPPtr1
|
||||
jsr BIN.ComputeOffsetYA
|
||||
|
||||
lda BIN.R.End
|
||||
sec
|
||||
sbc BIN.R.CS.Start
|
||||
sta BIN.R.Offset
|
||||
|
||||
lda ZPPtr1+1
|
||||
sbc BIN.R.CS.Start+1
|
||||
sta BIN.R.Offset+1
|
||||
|
||||
lda BIN.Move.Len+1
|
||||
eor #$ff
|
||||
pha
|
||||
lda BIN.Move.Len
|
||||
tay
|
||||
eor #$ff
|
||||
tax
|
||||
|
||||
lda BIN.R.End+1
|
||||
sbc BIN.R.CS.Start+1
|
||||
eor #$ff
|
||||
pha
|
||||
|
||||
ldy #0
|
||||
|
||||
.1 inx
|
||||
@ -296,13 +259,13 @@ K.InsDrv >STYA ZPPtr2 SRC PTR
|
||||
|
||||
pha
|
||||
|
||||
.2 lda (ZPPtr2),y
|
||||
sta (ZPPtr3),y
|
||||
.2 lda (ZPPtr3),y
|
||||
sta (ZPPtr4),y
|
||||
iny
|
||||
bne .1
|
||||
|
||||
inc ZPPtr2+1
|
||||
inc ZPPtr3+1
|
||||
inc ZPPtr4+1
|
||||
bra .1
|
||||
|
||||
.3 jsr BIN.RelDrv Relocate at Ptr1
|
||||
@ -345,16 +308,15 @@ BIN.RelDrv ldy #H.BIN.DRV.REL.TABLE
|
||||
* + 1 to skip last 00 from beq .2
|
||||
* ZPPtr1=Current Code PTR
|
||||
|
||||
.3 lda BIN.R.CS.End compute new CS.END to stop relocating
|
||||
lda BIN.R.End
|
||||
clc
|
||||
adc BIN.R.Offset
|
||||
sta .6+1
|
||||
lda BIN.R.End+1
|
||||
adc BIN.R.Offset+1
|
||||
sta .7+1
|
||||
|
||||
lda BIN.R.CS.End+1
|
||||
adc BIN.R.Offset+1
|
||||
sta .8+1
|
||||
|
||||
lda (ZPPtr1) get OPCODE
|
||||
.3 lda (ZPPtr1) get OPCODE
|
||||
lsr /2
|
||||
tax
|
||||
lda BIN.65816,x get OPCODE definition
|
||||
@ -366,7 +328,7 @@ BIN.RelDrv ldy #H.BIN.DRV.REL.TABLE
|
||||
.4 and #$0f
|
||||
|
||||
bit #$8 abs addressing?
|
||||
beq .6 no....
|
||||
beq .5 no....
|
||||
|
||||
and #7 save Opcode length...
|
||||
pha
|
||||
@ -374,21 +336,42 @@ BIN.RelDrv ldy #H.BIN.DRV.REL.TABLE
|
||||
ldy #1
|
||||
jsr BIN.RelocateAtPtr1Y
|
||||
|
||||
.5 pla get back Opcode length...
|
||||
pla get back Opcode length...
|
||||
|
||||
.6 clc A = OPCODE length
|
||||
adc ZPPtr1
|
||||
sta ZPPtr1
|
||||
bcc .7
|
||||
inc ZPPtr1+1
|
||||
clc Make sure exit with CC
|
||||
.5 tay A = OPCODE length
|
||||
jsr MEM.AddYToPtr1
|
||||
|
||||
.7 eor #$ff SELF MODIFIED A = ZPPtr1
|
||||
.6 cmp #$ff SELF MODIFIED, A = ZPPtr1
|
||||
bne .3
|
||||
|
||||
lda ZPPtr1+1
|
||||
.8 eor #$ff SELF MODIFIED
|
||||
.7 cmp #$ff SELF MODIFIED
|
||||
bne .3 next opcode....
|
||||
|
||||
clc Make sure exit with CC
|
||||
|
||||
rts
|
||||
*-------------------------------------- YA = CS Size
|
||||
BIN.ComputeCSEndYA
|
||||
pha
|
||||
tya
|
||||
clc
|
||||
adc BIN.R.CS.Start
|
||||
sta BIN.R.CS.End ZPPtr1 + CodeLen
|
||||
pla
|
||||
adc BIN.R.CS.Start+1
|
||||
sta BIN.R.CS.End+1
|
||||
rts
|
||||
*-------------------------------------- YA = Target Address
|
||||
BIN.ComputeOffSetYA
|
||||
pha
|
||||
tya
|
||||
sec
|
||||
sbc BIN.R.CS.Start
|
||||
sta BIN.R.Offset
|
||||
pla
|
||||
sbc BIN.R.CS.Start+1
|
||||
sta BIN.R.Offset+1
|
||||
rts
|
||||
*--------------------------------------
|
||||
BIN.RelocateAtPtr1Y
|
||||
|
@ -14,22 +14,23 @@ ENV.SearchPath .BS 2
|
||||
ENV.BufLen .BS 1
|
||||
ENV.bNoExp .BS 1
|
||||
ENV.VarLen .BS 1
|
||||
ENV.hMem .BS 1
|
||||
ENV.bInVar .BS 1
|
||||
ENV.bExp .BS 1
|
||||
ENV.VarName .BS 16
|
||||
.ED
|
||||
*--------------------------------------
|
||||
K.ExpandStr stz .88+1 Reset Intermediate string...
|
||||
K.ExpandStr stz ENV.hMem Reset Intermediate string...
|
||||
|
||||
.1 >STYA ZPPtr2
|
||||
stz ENV.BufLen init Expanded String len=0
|
||||
|
||||
stz .82+1 No var found yet
|
||||
|
||||
stz ENV.bExp No var found yet
|
||||
stz ENV.bNoExp Reset no expand flag
|
||||
|
||||
ldy #0
|
||||
|
||||
.10 stz ENV.VarLen
|
||||
stz .23+1 reset In var flag
|
||||
stz ENV.bInVar reset In var flag
|
||||
|
||||
.11 lda (ZPPtr2),y End of CSTR?
|
||||
beq .8
|
||||
@ -50,15 +51,15 @@ K.ExpandStr stz .88+1 Reset Intermediate string...
|
||||
.22 jsr ENV.AddAToBuf
|
||||
bra .11
|
||||
|
||||
.23 ldx #$ff SELF MODIFIED already in a var?
|
||||
.23 ldx ENV.bInVar already in a var?
|
||||
bne .3 yes...
|
||||
|
||||
cmp #'$' no, found one ?
|
||||
bne .22 no, store...
|
||||
|
||||
sta .82+1 Toggle Expanded flag
|
||||
ror ENV.bExp Toggle Expanded flag
|
||||
|
||||
sta .23+1 Set In Var flag
|
||||
sta ENV.bInVar Set In Var flag
|
||||
|
||||
bra .11 skip this char
|
||||
|
||||
@ -86,6 +87,7 @@ K.ExpandStr stz .88+1 Reset Intermediate string...
|
||||
.32 ldx ENV.VarLen
|
||||
cpx #16
|
||||
beq .11 varname longer than 15....ignore
|
||||
|
||||
sta ENV.VarName,x
|
||||
inx
|
||||
stx ENV.VarLen
|
||||
@ -94,13 +96,13 @@ K.ExpandStr stz .88+1 Reset Intermediate string...
|
||||
.5 dey last char was invalid...move back
|
||||
|
||||
.50 ldx ENV.VarLen
|
||||
beq .52 var name is empty...start over
|
||||
beq .10 var name is empty...start over
|
||||
|
||||
.51 stz ENV.VarName,x
|
||||
phy save current index
|
||||
jsr ENV.GetValue
|
||||
ply restore index in string...
|
||||
.52 jmp .10 reset start flag and continue
|
||||
.52 bra .10 reset start flag and continue
|
||||
|
||||
.8 ldx ENV.VarLen end of STR,are we in a var?
|
||||
beq .80 no...exit...
|
||||
@ -108,7 +110,7 @@ K.ExpandStr stz .88+1 Reset Intermediate string...
|
||||
stz ENV.VarName,x
|
||||
jsr ENV.GetValue yes, expand and add to STR
|
||||
|
||||
.80 lda .88+1 working from our temp string ?
|
||||
.80 lda ENV.hMem working from our temp string ?
|
||||
beq .81 no...
|
||||
|
||||
jsr K.FreeMem yes, discard....
|
||||
@ -117,18 +119,16 @@ K.ExpandStr stz .88+1 Reset Intermediate string...
|
||||
stz K.Buf256,x
|
||||
|
||||
>LDYAI K.Buf256
|
||||
ldx #SYS.StrDup
|
||||
jsr K.SYSCALL2.BANK
|
||||
jsr K.strdup
|
||||
bcs .9
|
||||
|
||||
stx .88+1 save this as temp string, in case of recurse
|
||||
.82 ldx #$ff SELF MODIFIED Did we expand something ?
|
||||
beq .88
|
||||
stx ENV.hMem save this as temp string, in case of recurse
|
||||
bit ENV.bExp SELF MODIFIED Did we expand something ?
|
||||
bpl .9
|
||||
jmp .1 Yes, start over with hPStr
|
||||
|
||||
.88 ldx #$ff SELF MODIFIED
|
||||
* or exit with Y,A from STRDUP
|
||||
|
||||
* clc
|
||||
.9 rts
|
||||
*/--------------------------------------
|
||||
* # FileSearch
|
||||
@ -484,9 +484,10 @@ ENV.ExpandSysVar
|
||||
rts
|
||||
|
||||
.3 txa
|
||||
asl
|
||||
tax
|
||||
jmp (ENV.SysVarsJmp,x)
|
||||
beq ENV.SysVarsArgs
|
||||
|
||||
ldy ENV.SysVars.PS-1,x
|
||||
bra ENV.SysVars.PSY
|
||||
|
||||
.4 >LDYAI ENV.StrVars
|
||||
>STYA ZPPtr3
|
||||
@ -516,24 +517,46 @@ ENV.ExpandSysVar
|
||||
jsr ENV.NextEnvP3A
|
||||
bra .5
|
||||
*--------------------------------------
|
||||
ENV.SysVarsArgs lda #1
|
||||
jsr K.ArgV
|
||||
bcs ENV.SysVarsNum.8
|
||||
|
||||
>STYA ZPPtr3
|
||||
|
||||
.1 lda (ZPPtr3)
|
||||
beq ENV.SysVarsNum
|
||||
|
||||
.2 jsr ENV.AddP3ToBuf
|
||||
|
||||
jsr ENV.NextEnvP3
|
||||
lda (ZPPtr3)
|
||||
beq ENV.SysVarsNum
|
||||
|
||||
lda #' '
|
||||
jsr ENV.AddAToBuf
|
||||
bra .2
|
||||
*--------------------------------------
|
||||
ENV.SysVars.PSY lda (pPS),y
|
||||
|
||||
ENV.SysVarsNum jsr MATH.A2STR10NP
|
||||
|
||||
ldy #0
|
||||
|
||||
.1 lda A2osX.NumStrBuf,y
|
||||
beq ENV.SysVarsNum.8
|
||||
|
||||
iny
|
||||
|
||||
jsr ENV.AddAToBuf
|
||||
bra .1
|
||||
|
||||
ENV.SysVarsNum.8
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
ENV.SysVars .AS "*#?@$!"
|
||||
ENV.SysVars.Cnt .EQ *-ENV.SysVars
|
||||
*--------------------------------------
|
||||
ENV.SysVarsJmp .DA ENV.SysVarsArgs
|
||||
.DA ENV.SysVarsArgC
|
||||
.DA ENV.SysVarsRC
|
||||
.DA ENV.SysVarsPPID
|
||||
.DA ENV.SysVarsPID
|
||||
.DA ENV.SysVarsCPID
|
||||
*--------------------------------------
|
||||
ENV.StrVars >PSTR "LOGNAME"
|
||||
>PSTR "GECOS"
|
||||
>PSTR "HOME"
|
||||
>PSTR "SHELL"
|
||||
>PSTR "PWD"
|
||||
>PSTR "UID"
|
||||
>PSTR "GID"
|
||||
.DA #0
|
||||
ENV.SysVars.PS .DA #S.PS.ARGC,#S.PS.RC,#S.PS.PPID,#S.PS.PID,#S.PS.CPID
|
||||
*--------------------------------------
|
||||
ENV.StrVarsJmp .DA ENV.StrVarsSession
|
||||
.DA ENV.StrVarsSession
|
||||
@ -577,56 +600,6 @@ ENV.StrVarsSession
|
||||
|
||||
.3 jmp ENV.AddP3ToBuf
|
||||
*--------------------------------------
|
||||
ENV.SysVarsArgC ldy #S.PS.ARGC
|
||||
.HS 2C
|
||||
ENV.SysVarsRC ldy #S.PS.RC
|
||||
.HS 2C
|
||||
ENV.SysVarsPPID ldy #S.PS.PPID
|
||||
.HS 2C
|
||||
ENV.SysVarsPID ldy #S.PS.PID
|
||||
.HS 2C
|
||||
ENV.SysVarsCPID ldy #S.PS.CPID
|
||||
|
||||
lda (pPS),y
|
||||
|
||||
ENV.SysVarsNum jsr MATH.A2STR10NP
|
||||
|
||||
ldy #0
|
||||
|
||||
.1 lda A2osX.NumStrBuf,y
|
||||
beq .8
|
||||
|
||||
iny
|
||||
|
||||
jsr ENV.AddAToBuf
|
||||
bra .1
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
ENV.SysVarsArgs lda #1
|
||||
jsr K.ArgV
|
||||
bcs .8
|
||||
|
||||
>STYA ZPPtr3
|
||||
|
||||
.1 lda (ZPPtr3)
|
||||
beq .8
|
||||
|
||||
.2 jsr ENV.AddP3ToBuf
|
||||
|
||||
jsr ENV.NextEnvP3
|
||||
lda (ZPPtr3)
|
||||
beq .8
|
||||
|
||||
lda #' '
|
||||
jsr ENV.AddAToBuf
|
||||
|
||||
bra .2
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
* ENV.FindVarP1
|
||||
* In:
|
||||
* ZPPtr1 -> NAME
|
||||
@ -653,7 +626,7 @@ ENV.FindVarP1 jsr ENV.InitEnvP3 Store ENV
|
||||
ora #0
|
||||
bne .2
|
||||
|
||||
.8 clc
|
||||
clc
|
||||
rts
|
||||
|
||||
.3 jsr ENV.NextEnvP3x2 Skip NAME & VALUE
|
||||
@ -678,18 +651,17 @@ ENV.DelVarP3 >LDYA ZPPtr3 save actual Ptr
|
||||
bne .2
|
||||
|
||||
tya
|
||||
beq .8 we moved back ending \0
|
||||
beq ENV.InitEnvP3.RTS we moved back ending \0
|
||||
|
||||
jsr ENV.NextEnvP3Y
|
||||
jsr ENV.NextEnvP4Y
|
||||
bra .1
|
||||
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
ENV.InitEnvP3 ldy #S.PS.hENV
|
||||
lda (pPs),y
|
||||
jsr K.GetMemPtr
|
||||
>STYA ZPPtr3 Store ENV
|
||||
ENV.InitEnvP3.RTS
|
||||
rts
|
||||
*--------------------------------------
|
||||
ENV.NextEnvP3x2 jsr ENV.NextEnvP3
|
||||
@ -771,6 +743,15 @@ ENV.Dup.A sta .8+1 Store target page Count
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
ENV.StrVars >PSTR "LOGNAME"
|
||||
>PSTR "GECOS"
|
||||
>PSTR "HOME"
|
||||
>PSTR "SHELL"
|
||||
>PSTR "PWD"
|
||||
>PSTR "UID"
|
||||
>PSTR "GID"
|
||||
.DA #0
|
||||
*--------------------------------------
|
||||
ENV.VARS .DA .1
|
||||
.DA .2
|
||||
.DA .3
|
||||
|
@ -739,6 +739,8 @@ MEM.NextCharPtr1
|
||||
*--------------------------------------
|
||||
MEM.AddYp1ToPtr1
|
||||
sec
|
||||
.HS 90 BCC
|
||||
MEM.AddYToPtr1 clc
|
||||
tya
|
||||
adc ZPPtr1
|
||||
sta ZPPtr1
|
||||
|
@ -320,8 +320,7 @@ PS.Load.SCRIPT ldx #$ff
|
||||
cmp #S.FI.T.BIN
|
||||
bne PS.Load.IBIN K.Buf256= /.../SHELL, K.IOBuf=/.../SCRIPT
|
||||
*--------------------------------------
|
||||
PS.LoadBIN >LDYAI K.Buf256
|
||||
jsr BIN.Load
|
||||
PS.LoadBIN jsr BIN.Load
|
||||
bcs .9
|
||||
>STYA ZPPtr4 save PTR to Code Segment
|
||||
|
||||
|
@ -350,57 +350,53 @@ K.StrFTime.MDAY .DA #3,#0,#3,#2,#3,#2,#3,#3,#2,#3,#2,#3
|
||||
K.StrFTime jsr MEM.SPtr1PPtr2
|
||||
>PULLW ZPPtr3 timeptr
|
||||
|
||||
.1 lda (ZPPtr2)
|
||||
.1 jsr MEM.GetCharPtr2
|
||||
beq .8
|
||||
|
||||
jsr MEM.NextCharPtr2
|
||||
|
||||
cmp #'%'
|
||||
beq .2
|
||||
|
||||
jsr MEM.PutCharPtr1
|
||||
bra .1
|
||||
|
||||
.2 ldx #K.StrFTime.JMP-K.StrFTime.Tbl-1
|
||||
.2 ldx #K.StrFTime.Cnt-1
|
||||
|
||||
lda (ZPPtr2)
|
||||
jsr MEM.GetCharPtr2
|
||||
beq .8
|
||||
|
||||
jsr MEM.NextCharPtr2
|
||||
|
||||
.3 cmp K.StrFTime.Tbl,x
|
||||
beq .4
|
||||
dex
|
||||
bpl .3
|
||||
bra .1
|
||||
|
||||
.4 txa
|
||||
asl
|
||||
tax
|
||||
jsr .5
|
||||
.4 cpx #7
|
||||
bcc .5
|
||||
jsr K.StrFTime.AtX
|
||||
bra .1
|
||||
|
||||
.5 jmp (K.StrFTime.JMP,x)
|
||||
.5 txa
|
||||
asl
|
||||
tax
|
||||
jsr .7
|
||||
bra .1
|
||||
|
||||
.7 jmp (K.StrFTime.JMP,x)
|
||||
|
||||
.8 lda #0 Terminate C string
|
||||
sta (ZPPtr1)
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
K.StrFTime.TBL .AS "aAbBdHImMpSwyY"
|
||||
K.StrFTime.Tbl .AS "aAbBIpYydHSwmM"
|
||||
K.StrFTime.Cnt .EQ *-K.StrFTime.TBL
|
||||
K.StrFTime.OfsX .DA #S.Time.YEAR,#S.Time.DAY,#S.Time.HOUR,#S.Time.SECOND,#S.Time.WDAY,#S.Time.MONTH,#S.Time.MINUTE
|
||||
K.StrFTime.JMP .DA K.StrFTime.A
|
||||
.DA K.StrFTime.AA
|
||||
.DA K.StrFTime.B
|
||||
.DA K.StrFTime.BB
|
||||
.DA K.StrFTime.D
|
||||
.DA K.StrFTime.HH
|
||||
.DA K.StrFTime.II
|
||||
.DA K.StrFTime.M
|
||||
.DA K.StrFTime.MM
|
||||
.DA K.StrFTime.P
|
||||
.DA K.StrFTime.SS
|
||||
.DA K.StrFTime.W
|
||||
.DA K.StrFTime.Y
|
||||
.DA K.StrFTime.YY
|
||||
*--------------------------------------
|
||||
K.StrFTime.A sec Short day of week, 3 chars...
|
||||
@ -479,19 +475,8 @@ K.StrFTime.P ldy #S.Time.HOUR
|
||||
K.StrFTime.YY ldy #S.Time.CENTURY
|
||||
jsr K.StrFTime.addDecPtr1Y
|
||||
|
||||
K.StrFTime.Y ldy #S.Time.YEAR
|
||||
.HS 2C bit abs
|
||||
K.StrFTime.D ldy #S.Time.DAY
|
||||
.HS 2C bit abs
|
||||
K.StrFTime.HH ldy #S.Time.HOUR
|
||||
.HS 2C bit abs
|
||||
K.StrFTime.SS ldy #S.Time.SECOND
|
||||
.HS 2C bit abs
|
||||
K.StrFTime.W ldy #S.Time.WDAY
|
||||
.HS 2C bit abs
|
||||
K.StrFTime.M ldy #S.Time.MONTH
|
||||
.HS 2C bit abs
|
||||
K.StrFTime.MM ldy #S.Time.MINUTE
|
||||
ldx #7 "y"
|
||||
K.StrFTime.AtX ldy K.StrFTime.OfsX-7,x
|
||||
*--------------------------------------
|
||||
K.StrFTime.addDecPtr1Y
|
||||
lda (ZPPtr3),y
|
||||
|
Loading…
Reference in New Issue
Block a user