Kernel 0.9.1 : README.md

This commit is contained in:
Rémy GIBERT 2017-08-23 13:33:51 +02:00
parent 5aa61b6153
commit f8697c333a
10 changed files with 119 additions and 114 deletions

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,7 @@
# A2osX (0.9.1) Multi-Tasking OS for Apple II # A2osX (0.9.1) Multi-Tasking OS for Apple II
0.9 has been archived, next Kernel Version is 0.9.1 0.9 has been archived, next Kernel Version is 0.9.1
Target :
+ More Standard C API compliance + More Standard C API compliance
+ API Cleanup, many functions still use shared space + API Cleanup, many functions still use shared space
+ Per process Stack Segment + Per process Stack Segment

View File

@ -65,91 +65,91 @@ Cmd.ExecYA stz bStartProc
Cmd.ExecYA.1 >SYSCALL ExpandPStrYA Cmd.ExecYA.1 >SYSCALL ExpandPStrYA
>STYA ZPPtr1 >STYA ZPPtr1
phx >STYA ZPPtr2
stx Cmd.ExecYA.Exit.1+1
ldy #1 ldy #0 CMD len
ldx #0 ARGS len
lda (ZPPtr1),y lda (ZPPtr2)
tax ARGS len=Total Len
.10 sta CMD,y Store Cmd in Buffer .1 inc ZPPtr2 Next Cmd Char
sty CMD update CMD len bne .2
inc ZPPtr2+1
tya .2 lda (ZPPtr2)
cmp (ZPPtr1) cmp #" " we reached blank between CMD ARGS
beq .13 end of string beq .3
iny iny CMD+1
lda (ZPPtr1),y dex Total=0
cmp #' ' bne .1
bne .10
.12 tya .3 tya
cmp (ZPPtr1) sta (ZPPtr1) Cut CMD
beq .13 end of string txa
sta (ZPPtr2) Cut ARGS
iny
lda (ZPPtr1),y
inx
sta ARGS,x
bra .12
.13 stx ARGS update ARGS len
pla
>SYSCALL FreeMemA
>LDYA L.INTCMDS >LDYA L.INTCMDS
>STYA ZPPtr2 >STYA ZPPtr3
ldx #0 ldx #0
.1 lda (ZPPtr2) .4 lda (ZPPtr3)
beq Cmd.Exec.EXT Ending 0, must be an external Cmd.... beq Cmd.Exec.EXT Ending 0, must be an external Cmd....
cmp CMD Same Len ? cmp (ZPPtr1) Same Len ?
bne .4 bne .8
tay tay
.2 lda CMD,y .5 lda (ZPPtr1),y
cmp #'a' To Uppercase cmp #'a' To Uppercase
bcc .21 bcc .6
cmp #'z'+1 cmp #'z'+1
bcs .21 bcs .6
eor #$20 eor #$20
.21 cmp (ZPPtr2),y .6 cmp (ZPPtr3),y
bne .4 bne .8
dey dey
bne .2 bne .6
jsr .5 Found an internal Cmd... jsr Cmd.Exec.INT Found an internal Cmd...
bcs .3 bcs .7
lda #0 lda #0
.3 ldy #S.PS.RC .7 ldy #S.PS.RC
sta (pPS),y sta (pPS),y
rts bra Cmd.ExecYA.Exit
.5 jmp (J.INTCMDS,x) .8 inx
.4 inx
inx inx
lda ZPPtr2 lda ZPPtr3
sec sec
adc (ZPPtr2) adc (ZPPtr3)
sta ZPPtr2 sta ZPPtr3
bcc .1 bcc .4
inc ZPPtr2+1 inc ZPPtr3+1
bra .1 bra .4
*--------------------------------------
Cmd.ExecYA.Exit php
pha
Cmd.ExecYA.Exit.1
lda #$ff
>SYSCALL FreeMemA
pla
plp
rts
*--------------------------------------
Cmd.Exec.INT jmp (J.INTCMDS,x)
*-------------------------------------- *--------------------------------------
Cmd.Exec.EXT ldy #1 Cmd.Exec.EXT ldy #1
lda CMD,y lda (ZPPtr1),y
cmp #'/' Command line is already full path, no search cmp #'/' Command line is already full path, no search
beq .3 beq .3
@ -159,7 +159,7 @@ Cmd.Exec.EXT ldy #1
>PUSHYA push search list >PUSHYA push search list
>PUSHW L.CMD >PUSHW ZPPtr1
>SYSCALL FileSearch >SYSCALL FileSearch
bcc .2 bcc .2
@ -167,7 +167,7 @@ Cmd.Exec.EXT ldy #1
lda (pPs),y lda (pPs),y
>SYSCALL GetMemPtrA >SYSCALL GetMemPtrA
>PUSHYA push search list >PUSHYA push search list
>PUSHW L.CMD >PUSHW ZPPtr1
>SYSCALL FileSearch >SYSCALL FileSearch
bcs .99 bcs .99
@ -198,7 +198,7 @@ Cmd.Exec.EXT ldy #1
.9 lda #SYSMGR.ERRSYN .9 lda #SYSMGR.ERRSYN
sec sec
.99 rts .99 jmp Cmd.ExecYA.Exit
*-------------------------------------- *--------------------------------------
* TXT : Launch "/PATH/SHELL /PATH/CMD ARGS" * TXT : Launch "/PATH/SHELL /PATH/CMD ARGS"
*-------------------------------------- *--------------------------------------
@ -238,10 +238,10 @@ Cmd.Exec.EXT.BIN
bmi .2 startproc bmi .2 startproc
>SYSCALL ExecProcessNewEnvYA >SYSCALL ExecProcessNewEnvYA
rts jmp Cmd.ExecYA.Exit
.2 >SYSCALL CreateProcessYA .2 >SYSCALL CreateProcessYA
rts jmp Cmd.ExecYA.Exit
*-------------------------------------- *--------------------------------------
* Internal Commands * Internal Commands
*-------------------------------------- *--------------------------------------

View File

@ -20,12 +20,12 @@ K.LoadDrvYA >STYA K.LoadDrv.CmdArray
>PUSHW K.LoadDrv.CmdArray (ARG[0] = DRVNAME) >PUSHW K.LoadDrv.CmdArray (ARG[0] = DRVNAME)
jsr K.FileSearch find Driver in $DRV jsr K.FileSearch.I find Driver in $DRV
bcs .9 bcs .9
stx .99+1
>LDYAI KrnBuf256
jsr K.LoadExeYA Y,A =filename full path jsr K.LoadExeYA Y,A =filename full path
bcs .98 bcs .9
>STYA pDrv >STYA pDrv
stx .97+1 stx .97+1
@ -58,12 +58,6 @@ K.LoadDrvYA >STYA K.LoadDrv.CmdArray
.97 lda #$ff .97 lda #$ff
jsr K.FreeMemA jsr K.FreeMemA
pla pla
.98 pha
.99 lda #$ff
jsr K.FreeMemA
pla
sec
rts rts
*-------------------------------------- *--------------------------------------
K.LoadDrv.CmdArray .BS 2 K.LoadDrv.CmdArray .BS 2

View File

@ -364,7 +364,7 @@ K.Rename jsr PFT.CheckPathSTK
*\-------------------------------------- *\--------------------------------------
K.Stat jsr PFT.CheckPathSTK K.Stat jsr PFT.CheckPathSTK
>PULLW K.MLI.PARAMS+1 >PULLW K.MLI.PARAMS+1
>PULLW ZPPtr2 >PULLW K.Stat.StoreY+1
>MLICALL MLIGETFILEINFO >MLICALL MLIGETFILEINFO
bcs .9 bcs .9
@ -381,41 +381,44 @@ K.Stat jsr PFT.CheckPathSTK
lda #0 lda #0
.2 ldy #S.STAT.MODE .2 ldy #S.STAT.MODE
sta (ZPPtr2),y jsr K.Stat.StoreY
ldx #K.Stat.DST-K.Stat.SRC ldx #K.Stat.DST-K.Stat.SRC
.3 ldy K.Stat.SRC-1,x .3 ldy K.Stat.SRC-1,x
lda K.MLI.PARAMS,y lda K.MLI.PARAMS,y
ldy K.Stat.DST-1,x ldy K.Stat.DST-1,x
sta (ZPPtr2),y jsr K.Stat.StoreY
dex dex
bne .3 bne .3
ldy #S.STAT.SIZE ldy #S.STAT.SIZE
lda #0 lda #0
sta (ZPPtr2),y jsr K.Stat.StoreY
iny iny
lda K.MLI.PARAMS+S.FILEINFO.BLOCKSUSED lda K.MLI.PARAMS+S.FILEINFO.BLOCKSUSED
asl asl
sta (ZPPtr2),y jsr K.Stat.StoreY
iny iny
lda K.MLI.PARAMS+S.FILEINFO.BLOCKSUSED+1 lda K.MLI.PARAMS+S.FILEINFO.BLOCKSUSED+1
rol rol
sta (ZPPtr2),y jsr K.Stat.StoreY
iny iny
lda #0 lda #0
rol rol
sta (ZPPtr2),y jsr K.Stat.StoreY
clc clc
.9 rts .9 rts
K.Stat.StoreY sta $ffff,y
rts
*-------------------------------------- *--------------------------------------
K.Stat.SRC .DA #S.FILEINFO.TYPE K.Stat.SRC .DA #S.FILEINFO.TYPE
.DA #S.FILEINFO.AUXTYPE,#S.FILEINFO.AUXTYPE+1 .DA #S.FILEINFO.AUXTYPE,#S.FILEINFO.AUXTYPE+1
@ -424,7 +427,7 @@ K.Stat.SRC .DA #S.FILEINFO.TYPE
K.Stat.DST .DA #S.STAT.P.TYPE K.Stat.DST .DA #S.STAT.P.TYPE
.DA #S.STAT.P.AUXTYPE,#S.STAT.P.AUXTYPE+1 .DA #S.STAT.P.AUXTYPE,#S.STAT.P.AUXTYPE+1
.DA #S.STAT.BLOCKS,#S.STAT.BLOCKS+1 .DA #S.STAT.BLOCKS,#S.STAT.BLOCKS+1
.DA #S.STAT.SIZE+1,#S.STAT.SIZE+2 * .DA #S.STAT.SIZE+1,#S.STAT.SIZE+2
*-------------------------------------- *--------------------------------------
FILE.SetIOBUF >PUSHWI 1024 get a ProDOS IOBUF FILE.SetIOBUF >PUSHWI 1024 get a ProDOS IOBUF

View File

@ -10,26 +10,42 @@ AUTO 6
* ## In: * ## In:
* PUSHW = Ptr to Search Path (PSTR) %LIB%;/SYS/SLIB * PUSHW = Ptr to Search Path (PSTR) %LIB%;/SYS/SLIB
* PUSHW = Ptr to File Name (PSTR) * PUSHW = Ptr to File Name (PSTR)
* PUSHW = Ptr to DstBuf
* ## Out: * ## Out:
* CC : success * CC : success
* Y,A = PSTR to FilePath (PSTR) * DstBuf = FilePath
* X = hMem to FilePath
* CS : not found * CS : not found
*\-------------------------------------- *\--------------------------------------
K.FileSearch >PULLW ZPPtr4 ZPPtr1 trashed by ExpandPStrYA K.FileSearch >PULLW ZPPtr2 DstBuf
jsr K.FileSearch.I
bcs .9
lda KrnBuf256
sta (ZPPtr2)
tay
.1 lda KrnBuf256,y
sta (ZPPtr2),y
dey
bne .1
.9 rts
K.FileSearch.I >PULLW ZPPtr4 ZPPtr1 trashed by ExpandPStrYA
>PULLYA Get Search list >PULLYA Get Search list
>SYSCALL ExpandPStrYA Expand it (SYSCALL to BNK1) >SYSCALL ExpandPStrYA Expand it (SYSCALL to BNK1)
bcs .99 bcs .99
stx .98+1 stx .98+1
>STYA ZPPtr3 ZPPtr2 trashed by K.STAT !!! expanded search list ; >STYA ZPPtr3 expanded search list ;
stz K.FileSearch.Index stz .11+1
.1 stz KrnBuf256 reset String .1 stz KrnBuf256 reset String
ldx #0 ldx #0
ldy K.FileSearch.Index .11 ldy #$ff Self Modified
.2 tya .2 tya
cmp (ZPPtr3) end of src string ? cmp (ZPPtr3) end of src string ?
@ -45,7 +61,7 @@ K.FileSearch >PULLW ZPPtr4 ZPPtr1 trashed by ExpandPStrYA
.3 txa .3 txa
beq .98 String is empty....nothing to try beq .98 String is empty....nothing to try
sty K.FileSearch.Index save current index sty .11+1 save current index
ldy #0 ldy #0
@ -66,15 +82,14 @@ K.FileSearch >PULLW ZPPtr4 ZPPtr1 trashed by ExpandPStrYA
jsr .98 Discard Expanded hSrch list jsr .98 Discard Expanded hSrch list
bra K.GetFullPathYA.NewStr clc
rts
.98 lda #$ff SELF MODIFIED : Discard Expanded hSrch list .98 lda #$ff SELF MODIFIED : Discard Expanded hSrch list
jsr K.FreeMemA jsr K.FreeMemA
lda #MLI.ERR.FNOTFND lda #MLI.ERR.FNOTFND
sec sec
.99 rts .99 rts
*--------------------------------------
K.FileSearch.Index .BS 1
*/-------------------------------------- */--------------------------------------
* # GetFullPathYA * # GetFullPathYA
* ## In : * ## In :

View File

@ -4,11 +4,6 @@ LOMEM $A00
INC 1 INC 1
AUTO 6 AUTO 6
*-------------------------------------- *--------------------------------------
ZPPtr1 .EQ ZPKERNEL
ZPPtr2 .EQ ZPKERNEL+2
ZPPtr3 .EQ ZPKERNEL+4
ZPPtr4 .EQ ZPKERNEL+6
*--------------------------------------
Kernel.Init sei Kernel.Init sei
ldx #$FF ldx #$FF
txs txs

View File

@ -13,19 +13,18 @@ AUTO 6
K.LoadLibYA >STYA K.LoadLib.Name SAVE LIBname for K.FileSearch K.LoadLibYA >STYA K.LoadLib.Name SAVE LIBname for K.FileSearch
>LDYAI ENV.LIB push ENVNAME=LIB >LDYAI ENV.LIB push ENVNAME=LIB
>SYSCALL GetEnvYA get value for ENV=LIB >SYSCALL GetEnvYA get value for ENV=LIB
bcs .99 bcs .9
>PUSHYA Push $LIB value >PUSHYA Push $LIB value
>PUSHW K.LoadLib.Name >PUSHW K.LoadLib.Name
jsr K.FileSearch find libname in $LIB jsr K.FileSearch.I find libname in $LIB
bcs .99 bcs .9
stx .9+1
>LDYAI KrnBuf256
jsr K.LoadExeYA Y,A=filename full path jsr K.LoadExeYA Y,A=filename full path
bcs .98 bcs .9
stx .8+1 stx .8+1
>STYA LIB.Jump+1 >STYA LIB.Jump+1
@ -34,26 +33,19 @@ K.LoadLibYA >STYA K.LoadLib.Name SAVE LIBname for K.FileSearch
ldx #LIBMGR.LOAD ldx #LIBMGR.LOAD
jsr LIB.Jump Call LIB.LOAD function jsr LIB.Jump Call LIB.LOAD function
bcs .97 bcs .99
jsr .98 Cleanup...
.8 lda #$ff hLib .8 lda #$ff hLib
clc clc
rts .9 rts
.97 pha .99 pha
lda .8+1 lda .8+1
jsr K.FreeMemA jsr K.FreeMemA
pla pla
.98 pha
.9 lda #$ff
jsr K.FreeMemA
pla
sec sec
.99 rts rts
*-------------------------------------- *--------------------------------------
K.LoadLib.Name .BS 2 K.LoadLib.Name .BS 2
*-------------------------------------- *--------------------------------------

View File

@ -14,6 +14,12 @@ AUTO 6
.INB INC/PRODOS.I .INB INC/PRODOS.I
.INB INC/MLI.ERR.I .INB INC/MLI.ERR.I
ZPPtr1 .EQ ZPKERNEL
ZPPtr2 .EQ ZPKERNEL+2
ZPPtr3 .EQ ZPKERNEL+4
ZPPtr4 .EQ ZPKERNEL+6
ZPPStr1 .EQ ZPKERNEL+8
.INB /A2OSX.SRC/SYS/KERNEL.S.INIT .INB /A2OSX.SRC/SYS/KERNEL.S.INIT
.INB /A2OSX.SRC/X.PRINTF.S .INB /A2OSX.SRC/X.PRINTF.S