Kernel 0.9.2

This commit is contained in:
Rémy GIBERT 2018-10-18 17:32:57 +02:00
parent 98617e93dc
commit 7f60e0e325
11 changed files with 83 additions and 130 deletions

View File

@ -1,6 +1,7 @@
*** Auto generated by docgen.cmd ***
# Args2ArgV
int args2argv(char* args, char* argv[])
## ASM
`>PUSHW argv`

Binary file not shown.

Binary file not shown.

View File

@ -5,14 +5,14 @@ ECHO *** A2osX Startup Script ***
SET PS1='$PWD'
# Main Screen
INSDRV CONSOLE.DRV
STARTPROC GETTY /DEV/CON ${A2OSX}SBIN/LOGIN
# Serial Login
#INSDRV SSC.DRV 9600,N,8,1,X
INSDRV SSC.I.DRV 9600,N,8,1,X
STARTPROC GETTY /DEV/CON ${A2OSX}SBIN/LOGIN
STARTPROC GETTY /DEV/COM2 ${A2OSX}SBIN/LOGIN
#INSDRV SSC.I.DRV 9600,N,8,1,X
#STARTPROC GETTY /DEV/COM2 ${A2OSX}SBIN/LOGIN
#INSDRV PIC.DRV
# Network Section
INSDRV UTHERNET.DRV 00:0E:3A:12:34:56
#INSDRV UTHERNET.DRV 00:0E:3A:12:34:56
#INSDRV LANCEGS.DRV
#INSDRV UTHER2.AI.DRV 00:08:DC:12:34:56
#INSDRV UTHERNET2.DRV 00:08:DC:12:34:56
@ -22,12 +22,10 @@ INSDRV UTHERNET.DRV 00:0E:3A:12:34:56
#STARTPROC HTTPD
#NFSMOUNT 192.168.1.5:/A2OSX /MNT/A2OSX
#CIFSMOUNT 192.168.1.5:/MSSHARE /MNT/MSSHARE
# End Network Section
# GUI Section
#INSDRV MOUSE.DRV
#INSDRV DHGR.DRV
#STARTPROC DESKTOP
# End GUI Section
ECHO *** End A2osX Startup file ***
MAN
TEXT A2OSX.STARTUP

View File

@ -46,9 +46,10 @@ CS.INIT clc
*--------------------------------------
CS.RUN ldy #S.PS.ARGC
lda (pPs),y
cmp #2
cmp #3
bcc .90
>PUSHWI 0 auxtype
>PUSHBI 0 type
>PUSHBI O.RDWR
@ -69,7 +70,7 @@ CS.RUN ldy #S.PS.ARGC
.90 >LDYA L.MSG.USAGE
>SYSCALL puts
lda #0
lda #K.E.SYN
sec
.9 rts
@ -115,6 +116,12 @@ CS.RUN.LOOP1 >SLEEP
bcc CS.RUN.LOOP1
.2 >PUSHBI S.PS.F.DUPENV+S.PS.F.HOLD
lda #2
>SYSCALL ArgV
>SYSCALL puts
lda #2
>SYSCALL ArgV
>SYSCALL Exec

View File

@ -32,13 +32,14 @@ CS.START cld
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.QUIT
L.MSG.HELP .DA MSG.HELP
L.MSG.USAGE .DA MSG.USAGE
L.MSG.LOAD .DA MSG.LOAD
.DA 0
*--------------------------------------
CS.RUN ldy #S.PS.ARGC
lda (pPs),y
beq .9
cmp #2
bne .9
lda #1 get PTR to ARG[1] (Driver name)
>SYSCALL ArgV
@ -58,9 +59,9 @@ CS.RUN ldy #S.PS.ARGC
sec we do not want to stay in memory
rts
.9 >LDYA L.MSG.HELP
.9 >LDYA L.MSG.USAGE
>SYSCALL puts
lda #0 tell TSKMGR that all done ok, but
lda #K.E.SYN tell TSKMGR that all done ok, but
sec we do not want to stay in memory
.99 rts
*--------------------------------------
@ -73,7 +74,7 @@ CS.DOEVENT sec
rts
*--------------------------------------
CS.END
MSG.HELP .AZ "Usage: insdrv file.drv <args>"
MSG.USAGE .AZ "Usage: insdrv file.drv <args>"
MSG.LOAD .AZ "INSDRV:Loading %s...\r\n"
*--------------------------------------
MAN

View File

@ -94,21 +94,8 @@ CS.RUN lda #0
>PUSHBI S.PS.F.HOLD
>LDYA L.SHELL
>SYSCALL ExpandStr
bcs .9
phx
>SYSCALL Exec
plx
php
pha
txa
>SYSCALL FreeMem
pla
plp
rts
*--------------------------------------
CS.DOEVENT
@ -199,6 +186,7 @@ CS.END
MSG.LOGIN .AZ "\r\nlogin:"
MSG.PASSWORD .AZ "\r\npassword:"
SHELL .AZ "${A2OSX}SBIN/SHELL"
.HS 00
*--------------------------------------
.DUMMY
.OR 0

View File

@ -26,52 +26,12 @@ Cmd.Parse >LDYA ZPCMDBuf
>SYSCALL ExpandStr
bcs .99
>STYA ZPPtr1 Ptr to expanded CMD ARGS\0
txa
>STA.G CMD.hCmdLine
ldy #0
lda (ZPPtr1) empty line...quit
beq .9
.1 jsr Cmd.NextCharPtr1
beq .8 no more char, exit
cmp #' ' skip leading spaces
beq .1
cmp #'#' Comment ?
beq .8 ignore remaining chars
.3 sta (ZPCMDBuf),y add char to buffer
iny
jsr Cmd.NextCharPtr1
beq .8
cmp #' '
bne .3
lda #0
sta (ZPCMDBuf),y add \0 to buffer
iny
.5 jsr Cmd.NextCharPtr1
beq .8
cmp #' '
beq .5 skip additional spaces
bne .3 no more space, add next word...
.8 lda #0
sta (ZPCMDBuf),y
.9 tya
>STA.G CmdBuflen
.90 >LDA.G CMD.hCmdLine
phx save expanded string
pha
>PUSHW ZPCMDBuf
pla
>SYSCALL Args2ArgV
plx
>SYSCALL FreeMem
.99 rts
@ -83,7 +43,7 @@ CMD.Exec lda #S.PS.F.HOLD+S.PS.F.DUPENV
>LDYA L.CMD.INT
>STYA ZPPtr2
ldx #0
.1 phx
@ -162,7 +122,9 @@ Cmd.Exec.EXT ldy #0
* CMD.hCmdLine = /path/bin
.2 ldx #0
.2 >DEBUG
ldx #0
jsr Cmd.RemoveStrAtX
>LDA.G CMD.hCmdLine

View File

@ -186,7 +186,7 @@ CSH.Run jsr CL.RESET
>STA.G bCmdBufexec
>LDA.G bSET.X
beq .80
* beq .80
>PUSHW ZPCMDBuf
>PUSHBI 2

View File

@ -3,6 +3,7 @@ PREFIX /A2OSX.BUILD
AUTO 4,1
*/--------------------------------------
* # Args2ArgV
* int args2argv(char* args, char* argv[])
* ## ASM
* `>PUSHW argv`
* `>LDYA args`
@ -13,45 +14,44 @@ ARG.bInQuote .BS 1
*--------------------------------------
K.Args2ArgV jsr MEM.SPtr1PPtr2
stz ARG.bInQuote
ldy #$ff
ldx #0 Arg Count
.4 iny
lda (ZPPtr1),y
beq .7
stz ARG.bInQuote
.1 jsr ARG.GetCharPtr1
beq .8
cmp #C.SPACE
beq .1 skip leading spaces
.2 cmp #'"' found a quote ?
bne .3
cmp #'"' found a quote ?
bne .5
lda ARG.bInQuote
eor #$ff
sta ARG.bInQuote
bra .4
bra .7 skip quote and check next char
.5 cmp #' '
bne .6
.3 cmp #C.SPACE
bne .6 regular char ...store...
bit ARG.bInQuote
bmi .6
bmi .6 between quotes... store space...
inx Found one arg !!!
lda #0 set this token End
jsr ARG.PutCharPtr2
bra .1
.6 sta (ZPPtr2)
.6 jsr ARG.PutCharPtr2
inc ZPPtr2
bne .4
inc ZPPtr2+1
bra .4
.7 jsr ARG.GetCharPtr1
bne .2
.7 sta (ZPPtr2) set Arg Ending 0
inc ZPPtr2
bne .8
inc ZPPtr2+1
inx
.8 sta (ZPPtr2) set Array Ending 0
.8 jsr ARG.PutCharPtr2 set Argv[x] Ending 0
sta (ZPPtr2) set Array Ending 0
txa X=Arg Count
@ -67,39 +67,28 @@ K.Args2ArgV jsr MEM.SPtr1PPtr2
* Y,A = PTR To Arg[A]
* CS : Out Of Bound
*\--------------------------------------
K.ArgV pha save requested arg#
K.ArgV tax save requested arg#
ldy #S.PS.hARGV
lda (pPs),y
jsr K.GetMemPtr
plx we want 0 ?
beq .8 yes, returns MemPtr
>STYA ZPPtr1 no, save it
>STYA ZPPtr1
.1 lda (ZPPtr1) end of ARGV[] ?
beq .9 yes, not found....
.3 inc ZPPtr1 skip next one....
bne .4
inc ZPPtr1+1
dex
bmi .7
.4 lda (ZPPtr1)
.3 jsr ARG.GetCharPtr1 skip str
bne .3
inc ZPPtr1 ....and point to next, or ending 0
bne .5
inc ZPPtr1+1
.5 dex
bne .1 stop here....
lda (ZPPtr1) at end of ARGV[] ?
beq .9
jsr ARG.NextCharPtr1 skip \0
bra .1
>LDYA ZPPtr1
.7 >LDYA ZPPtr1
.8 clc
rts
@ -107,12 +96,19 @@ K.ArgV pha save requested arg#
.9 sec
rts
*--------------------------------------
ARG.NextChrPtr1 lda (ZPPtr1)
beq .8
ARG.GetCharPtr1 lda (ZPPtr1)
beq ARG.GetCharPtr1.8
ARG.NextCharPtr1
inc ZPPtr1
bne .8
bne ARG.GetCharPtr1.8
inc ZPPtr1+1 never Z
ARG.GetCharPtr1.8
rts
*--------------------------------------
ARG.PutCharPtr2 sta (ZPPtr2)
inc ZPPtr2
bne .8
inc ZPPtr2+1
.8 rts
*--------------------------------------
MAN

View File

@ -140,11 +140,11 @@ Kernel.Init3 sta SETALTZP
>LDYAI MSG.Prefix
>SYSCALL printf
lda KBD
bpl .1
sta KBDSTROBE
cmp #$84 CTRL-D for Maintenace mode
bne .1
* lda KBD
* bpl .1
* sta KBDSTROBE
* cmp #$84 CTRL-D for Maintenace mode
* bne .1
>PUSHBI 0
>LDYAI MSG.MMode