mirror of
https://github.com/A2osX/A2osX.git
synced 2024-09-09 00:54:29 +00:00
Kernel 0.9.1 : Code reorganization & move to CSTR : External commands (CAT)
This commit is contained in:
parent
ad0eacec75
commit
f624c10bd7
@ -19,6 +19,31 @@ Returns argument count in the process command line.
|
|||||||
+ Y,A = CStr To Arg[A]
|
+ Y,A = CStr To Arg[A]
|
||||||
+ CS : Out Of Bound
|
+ CS : Out Of Bound
|
||||||
|
|
||||||
|
# FileSearch
|
||||||
|
Search a file in the provided PATH list
|
||||||
|
And return, if found, the full path to it.
|
||||||
|
|
||||||
|
## In:
|
||||||
|
+ PUSHW = Ptr to Search Path (CSTR) %LIB%;/SYS/SLIB
|
||||||
|
+ PUSHW = Ptr to File Name (CSTR)
|
||||||
|
+ PUSHW = Ptr to DstBuf
|
||||||
|
+ PUSHW = Ptr to DstStat
|
||||||
|
|
||||||
|
## Out:
|
||||||
|
+ CC : success
|
||||||
|
+ DstBuf = FilePath
|
||||||
|
+ DstStat = S.STAT
|
||||||
|
+ CS : not found
|
||||||
|
|
||||||
|
# Sleep
|
||||||
|
Make current process suspend until next RUN
|
||||||
|
|
||||||
|
## In :
|
||||||
|
+ (none)
|
||||||
|
|
||||||
|
## Out :
|
||||||
|
+ (none)
|
||||||
|
|
||||||
# GetDevByID.A
|
# GetDevByID.A
|
||||||
|
|
||||||
## IN:
|
## IN:
|
||||||
@ -32,7 +57,7 @@ Returns argument count in the process command line.
|
|||||||
# GetDevByName.YA
|
# GetDevByName.YA
|
||||||
|
|
||||||
## IN:
|
## IN:
|
||||||
+ Y,A = Ptr to device name (PStr)
|
+ Y,A = Ptr to device name (C-String)
|
||||||
|
|
||||||
## OUT:
|
## OUT:
|
||||||
+ CC = OK, CS = ERROR
|
+ CC = OK, CS = ERROR
|
||||||
@ -120,22 +145,6 @@ Returns argument count in the process command line.
|
|||||||
|
|
||||||
## Out:
|
## Out:
|
||||||
|
|
||||||
# FileSearch
|
|
||||||
Search a file in the provided PATH list
|
|
||||||
And return, if found, the full path to it.
|
|
||||||
|
|
||||||
## In:
|
|
||||||
+ PUSHW = Ptr to Search Path (CSTR) %LIB%;/SYS/SLIB
|
|
||||||
+ PUSHW = Ptr to File Name (CSTR)
|
|
||||||
+ PUSHW = Ptr to DstBuf
|
|
||||||
+ PUSHW = Ptr to DstStat
|
|
||||||
|
|
||||||
## Out:
|
|
||||||
+ CC : success
|
|
||||||
+ DstBuf = FilePath
|
|
||||||
+ DstStat = S.STAT
|
|
||||||
+ CS : not found
|
|
||||||
|
|
||||||
# GetFullPath.YA
|
# GetFullPath.YA
|
||||||
|
|
||||||
## In :
|
## In :
|
||||||
@ -280,18 +289,9 @@ Create a new copy of this C-String
|
|||||||
## Out:
|
## Out:
|
||||||
+ Buffer filled with memory stats
|
+ Buffer filled with memory stats
|
||||||
|
|
||||||
# Sleep
|
|
||||||
Make current process suspend until next RUN
|
|
||||||
|
|
||||||
## In :
|
|
||||||
+ (none)
|
|
||||||
|
|
||||||
## Out :
|
|
||||||
+ (none)
|
|
||||||
|
|
||||||
# ExecProcessNewEnv.YA
|
# ExecProcessNewEnv.YA
|
||||||
|
|
||||||
# ExecProcess.YA (Blocking Parent PID)
|
# ExecProcess.YA (Blocking Parent PID)
|
||||||
|
|
||||||
# CreateProcessNewEnv.YA
|
# CreateProcessNewEnv.YA
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
111
BIN/CAT.S.txt
111
BIN/CAT.S.txt
@ -13,6 +13,7 @@ AUTO 6
|
|||||||
.INB /A2OSX.BUILD/INC/MLI.ERR.I
|
.INB /A2OSX.BUILD/INC/MLI.ERR.I
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
ZPPTR1 .EQ ZPBIN
|
ZPPTR1 .EQ ZPBIN
|
||||||
|
ZPBufPtr .EQ ZPBIN+2
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
* File Header (16 Bytes)
|
* File Header (16 Bytes)
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
@ -38,15 +39,18 @@ L.MSG.CTRLCHAR .DA MSG.CTRLCHAR
|
|||||||
L.ASCII .DA ASCII
|
L.ASCII .DA ASCII
|
||||||
.DA 0
|
.DA 0
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CS.INIT >SYSCALL GetArgC
|
CS.INIT ldy #S.PS.ARGC
|
||||||
sta ArgCount
|
lda (pPs),y
|
||||||
cmp #1
|
|
||||||
beq .99
|
beq .99
|
||||||
|
|
||||||
.1 dec ArgCount
|
>STA.G ArgCount
|
||||||
beq .5
|
|
||||||
|
.1 >LDA.G ArgCount
|
||||||
|
dec
|
||||||
|
bmi .5
|
||||||
|
|
||||||
|
sta (pData),y
|
||||||
|
|
||||||
lda ArgCount
|
|
||||||
>SYSCALL GetArg.A
|
>SYSCALL GetArg.A
|
||||||
>STYA ZPPtr1
|
>STYA ZPPtr1
|
||||||
|
|
||||||
@ -80,21 +84,30 @@ CS.INIT >SYSCALL GetArgC
|
|||||||
sta (pData),y
|
sta (pData),y
|
||||||
bra .1
|
bra .1
|
||||||
|
|
||||||
.4 inc FileCount
|
.4 >LDA.G FileCount
|
||||||
|
inc
|
||||||
|
sta (pData),y
|
||||||
bra .1 scan for any other args
|
bra .1 scan for any other args
|
||||||
|
|
||||||
.5 lda FileCount
|
.5 >LDA.G FileCount
|
||||||
beq .99
|
beq .99
|
||||||
|
|
||||||
|
>LDYAI 256
|
||||||
|
>SYSCALL GetMem.YA
|
||||||
|
bcs .9
|
||||||
|
|
||||||
|
>STYA ZPBufPtr
|
||||||
|
txa
|
||||||
|
>STA.G hBuf
|
||||||
.8
|
.8
|
||||||
* lda (pPs)
|
* lda (pPs)
|
||||||
* ora #S.PS.F.EVENT Now accept events
|
* ora #S.PS.F.EVENT Now accept events
|
||||||
* sta (pPs)
|
* sta (pPs)
|
||||||
|
|
||||||
clc
|
clc
|
||||||
rts
|
.9 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CS.RUN >SYSCALL GetC
|
CS.RUN >SYSCALL GetChar
|
||||||
bcs .10 no char
|
bcs .10 no char
|
||||||
|
|
||||||
cmp #$03 Ctrl-C
|
cmp #$03 Ctrl-C
|
||||||
@ -103,22 +116,18 @@ CS.RUN >SYSCALL GetC
|
|||||||
cmp #$13 Ctrl-S
|
cmp #$13 Ctrl-S
|
||||||
bne .10
|
bne .10
|
||||||
|
|
||||||
ldy #bPause
|
>LDA.G bPause
|
||||||
lda (pData),y
|
|
||||||
eor #$ff
|
eor #$ff
|
||||||
sta (pData),y
|
sta (pData),y
|
||||||
bne .8
|
bne .8
|
||||||
|
|
||||||
.10 ldy #bPause
|
.10 >LDA.G bPause
|
||||||
lda (pData),y
|
|
||||||
bne .8 Pause...
|
bne .8 Pause...
|
||||||
|
|
||||||
ldy #hFILE
|
>LDA.G hFILE
|
||||||
lda (pData),y
|
|
||||||
bne .2
|
bne .2
|
||||||
|
|
||||||
.1 ldy #ArgIndex
|
.1 >LDA.G ArgIndex
|
||||||
lda (pData),y
|
|
||||||
inc
|
inc
|
||||||
sta (pData),y
|
sta (pData),y
|
||||||
>SYSCALL GetArg.A
|
>SYSCALL GetArg.A
|
||||||
@ -136,14 +145,13 @@ CS.RUN >SYSCALL GetC
|
|||||||
jsr CS.RUN.OPEN
|
jsr CS.RUN.OPEN
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
ldy #hFILE
|
>STA.G hFILE
|
||||||
sta (pData),y
|
|
||||||
|
|
||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.2 pha
|
.2 pha
|
||||||
>PUSHWI UsrBuf256
|
>PUSHW ZPBufPtr
|
||||||
>PUSHWI 256
|
>PUSHWI 256
|
||||||
pla
|
pla
|
||||||
>PUSHA
|
>PUSHA
|
||||||
@ -166,18 +174,9 @@ CS.RUN >SYSCALL GetC
|
|||||||
CS.RUN.PRINT sty BytesRead Y,A = Bytes read
|
CS.RUN.PRINT sty BytesRead Y,A = Bytes read
|
||||||
stz ByteIndex
|
stz ByteIndex
|
||||||
|
|
||||||
ldy #LineNum
|
>INCW.G LineNum
|
||||||
lda (pData),y
|
|
||||||
clc
|
|
||||||
adc #1
|
|
||||||
sta (pData),y
|
|
||||||
|
|
||||||
iny
|
>LDA.G bSuppressBlankLine
|
||||||
lda (pData),y
|
|
||||||
adc #0
|
|
||||||
sta (pData),y
|
|
||||||
|
|
||||||
ldy #bSuppressBlankLine
|
|
||||||
lda (pData),y
|
lda (pData),y
|
||||||
bpl .10
|
bpl .10
|
||||||
|
|
||||||
@ -185,41 +184,39 @@ CS.RUN.PRINT sty BytesRead Y,A = Bytes read
|
|||||||
beq .12 Empty line ?
|
beq .12 Empty line ?
|
||||||
dec
|
dec
|
||||||
bne .1 Only one CR ?
|
bne .1 Only one CR ?
|
||||||
lda UsrBuf256
|
lda (ZPBufPtr)
|
||||||
cmp #13
|
cmp #13
|
||||||
bne .1
|
bne .1
|
||||||
|
|
||||||
.12 ldy #bPrintedBlankLine
|
.12 >LDA.G bPrintedBlankLine
|
||||||
lda (pData),y
|
|
||||||
bmi .8
|
bmi .8
|
||||||
|
|
||||||
lda #$ff
|
lda #$ff
|
||||||
sta (pData),y
|
sta (pData),y
|
||||||
bra .10
|
bra .10
|
||||||
|
|
||||||
.1 ldy #bPrintedBlankLine
|
.1 lda #0
|
||||||
lda #0
|
>STA.G bPrintedBlankLine
|
||||||
sta (pData),y
|
|
||||||
|
|
||||||
.10 jsr CS.RUN.PRINTNUM
|
.10 jsr CS.RUN.PRINTNUM
|
||||||
bcs .9
|
bcs .9
|
||||||
|
|
||||||
.20 ldx ByteIndex
|
.20 ldy ByteIndex
|
||||||
lda UsrBuf256,x
|
lda (ZPBufPtr),y
|
||||||
cmp #' '
|
cmp #' '
|
||||||
bcs .6
|
bcs .6
|
||||||
|
|
||||||
cmp #13 Allow printing of CR even if not bPrintAll
|
cmp #13 Allow printing of CR even if not bPrintAll
|
||||||
beq .4
|
beq .4
|
||||||
|
|
||||||
ldy #bPrintAll
|
>LDA.G bPrintAll
|
||||||
lda (pData),y
|
|
||||||
bpl .7
|
bpl .7
|
||||||
|
|
||||||
>LDYA L.ASCII
|
>LDYA L.ASCII
|
||||||
>STYA ZPPtr1
|
>STYA ZPPtr1
|
||||||
|
|
||||||
lda UsrBuf256,x
|
ldy ByteIndex
|
||||||
|
lda (ZPBufPtr),y
|
||||||
tax
|
tax
|
||||||
|
|
||||||
.2 dex
|
.2 dex
|
||||||
@ -257,17 +254,10 @@ CS.RUN.PRINT sty BytesRead Y,A = Bytes read
|
|||||||
.9 rts
|
.9 rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CS.RUN.PRINTNUM clc
|
CS.RUN.PRINTNUM clc
|
||||||
ldy #bLineNum
|
>LDA.G bLineNum
|
||||||
lda (pData),y
|
|
||||||
bpl .8
|
bpl .8
|
||||||
|
|
||||||
ldy #LineNum
|
>LDYA.G LineNum
|
||||||
lda (pData),y
|
|
||||||
pha
|
|
||||||
|
|
||||||
iny
|
|
||||||
lda (pData),y
|
|
||||||
ply
|
|
||||||
|
|
||||||
>PUSHYA
|
>PUSHYA
|
||||||
>LDYA L.MSG.LINENUM
|
>LDYA L.MSG.LINENUM
|
||||||
@ -293,8 +283,7 @@ CS.RUN.OPEN >SYSCALL GetFullPath.YA
|
|||||||
pha
|
pha
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
ldy #bPrintedBlankLine Reset this flag for the new file
|
>STA.G bPrintedBlankLine Reset this flag for the new file
|
||||||
sta (pData),y
|
|
||||||
|
|
||||||
pla
|
pla
|
||||||
clc
|
clc
|
||||||
@ -307,8 +296,11 @@ CS.RUN.OPEN >SYSCALL GetFullPath.YA
|
|||||||
.9 sec
|
.9 sec
|
||||||
rts
|
rts
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
CS.RUN.CLOSE
|
CS.QUIT >LDA.G hBuf
|
||||||
CS.QUIT ldy #hFILE
|
beq CS.RUN.CLOSE
|
||||||
|
>SYSCALL FreeMem.A
|
||||||
|
|
||||||
|
CS.RUN.CLOSE ldy #hFILE
|
||||||
lda (pData),y
|
lda (pData),y
|
||||||
beq .8
|
beq .8
|
||||||
|
|
||||||
@ -366,8 +358,6 @@ ASCII >PSTR "NULL"
|
|||||||
>PSTR "RS"
|
>PSTR "RS"
|
||||||
>PSTR "US"
|
>PSTR "US"
|
||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
ArgCount .BS 1
|
|
||||||
FileCount .BS 1
|
|
||||||
hFullPath .BS 1
|
hFullPath .BS 1
|
||||||
BytesRead .BS 1
|
BytesRead .BS 1
|
||||||
ByteIndex .BS 1
|
ByteIndex .BS 1
|
||||||
@ -375,12 +365,15 @@ ByteIndex .BS 1
|
|||||||
.DUMMY
|
.DUMMY
|
||||||
.OR 0
|
.OR 0
|
||||||
DS.START
|
DS.START
|
||||||
|
ArgCount .BS 1
|
||||||
|
FileCount .BS 1
|
||||||
bPause .BS 1
|
bPause .BS 1
|
||||||
bPrintAll .BS 1
|
bPrintAll .BS 1
|
||||||
bLineNum .BS 1
|
bLineNum .BS 1
|
||||||
bSuppressBlankLine .BS 1
|
bSuppressBlankLine .BS 1
|
||||||
ArgIndex .BS 1
|
ArgIndex .BS 1
|
||||||
hFILE .BS 1
|
hBuf .BS 1
|
||||||
|
hFile .BS 1
|
||||||
LineNum .BS 2
|
LineNum .BS 2
|
||||||
bPrintedBlankLine .BS 1
|
bPrintedBlankLine .BS 1
|
||||||
DS.END
|
DS.END
|
||||||
|
Loading…
Reference in New Issue
Block a user