Kernel 0.93

This commit is contained in:
Rémy GIBERT 2019-05-04 23:13:50 +02:00
parent 7c6e4a8f47
commit b966ec2681
20 changed files with 166 additions and 124 deletions

Binary file not shown.

View File

@ -686,5 +686,5 @@ DCB .DA #S.DCB.T.NIC
DRV.END
MAN
SAVE USR/SRC/DRV/X.U2.DRV.S
LOAD USR/SRC/DRV/UTHER2.AI.DRV.S
LOAD USR/SRC/DRV/UTHERNET2.DRV.S
ASM

View File

@ -204,11 +204,11 @@ SYS.FPrintF .EQ $5C
* .EQ $5E
* .EQ $60
* .EQ $62
SYS.ChTyp .EQ $62
SYS.LoadFile .EQ $64
SYS.LoadTxtFile .EQ $66
SYS.ChTyp .EQ $68
* .EQ $68
* .EQ $6A
* .EQ $6C
* .EQ $6E

View File

@ -399,7 +399,11 @@ SKT.Read jsr SKT.PullhFDDataInPtrLen
.9 lda #0
tay
.99 rts
rts
.99 ora #0
beq *
rts
*/--------------------------------------
* # Write (STREAM)
* ## C
@ -686,7 +690,8 @@ SKT.CheckStream ldy #S.SOCKET.T
bcc .8
cmp #S.SOCKET.TCP.S.CLWAIT
bcs .91
.8 rts CC=ESTBLSH...or less
.8 lda #0
rts CC=ESTBLSH...or less
.91 lda #MLI.E.IO
sec

View File

@ -344,7 +344,7 @@ CS.RUN.GetLine sta ZPGetLineMax
bit ZPbEsc
bpl .11
* clc
* clc
ror ZPbEsc
cmp #'D'
bne .1

View File

@ -177,7 +177,8 @@ BIN.Load.1 >LDYA K.S.STAT+S.STAT.P.AUXTYPE
>PUSHBI O.RDONLY
>LDYA BIN.CmdLine
>SYSCALL LoadFile BANK1!!!
ldx #SYS.LoadFile
jsr K.SYSCALL.GoB BANK1!!!
bcs BIN.Load.Cleanup.RTS Error Loading file
stx BIN.hMem save hMem
@ -218,7 +219,8 @@ BIN.Load.1 >LDYA K.S.STAT+S.STAT.P.AUXTYPE
jsr BIN.RelExe
>LDYA BIN.CmdLine get back bin path
>SYSCALL StrDup make a copy of this string
ldx #SYS.strdup make a copy of this string
jsr K.SYSCALL.GoB
bcs .98
lda BIN.hMem Keep X=new string hMem

View File

@ -529,7 +529,8 @@ CORE.PSFree sta .10+1 Save PS ID
bne .10
txa
>SYSCALL fclose
ldx #SYS.fclose
jsr K.SYSCALL.GoB
.10 lda #$ff Self Modified

View File

@ -578,7 +578,8 @@ K.ReadDir.ConvertTime
tay
lda ZPPtr3+1
adc #0
>SYSCALL PTime2Time BANK2
ldx #SYS.PTime2Time BANK2
jsr K.SYSCALL.GoB
rts
*/-------------------------------------
* # CloseDir

View File

@ -118,7 +118,8 @@ K.ExpandStr stz .88+1 Reset Intermediate string...
stz K.Buf256,x
>LDYAI K.Buf256
>SYSCALL StrDup
ldx #SYS.StrDup
jsr K.SYSCALL.GoB
bcs .9
stx .88+1 save this as temp string, in case of recurse
@ -229,8 +230,10 @@ ENV.Search.YA >STYA .4+1
inx
bra .4
.5 >LDYAI K.Buf256
jsr K.STAT.YA.JMP
.5 >PUSHWI K.S.STAT
>LDYAI K.Buf256
ldx #SYS.stat
jsr K.SYSCALL.GoB
bcs .1 Failed...retry next path...
lda K.S.STAT+S.STAT.P.TYPE

View File

@ -1,6 +1,31 @@
NEW
AUTO 3,1
*/--------------------------------------
* # ChTyp
* Change The type of a ProDOS File
* ## C
* `int chtyp(const char *filepath, const char filetype);`
* ## ASM
* **In:**
* `>PUSHBI filetype`
* `>LDYA filepath`
* `>SYSCALL chtyp`
* ## RETURN VALUE
*\--------------------------------------
K.ChTyp jsr PFT.CheckPathYA
bcs .99
>PULLB .1+1
>MLICALL MLIGETFILEINFO
bcs .9
.1 lda #$ff
sta K.MLI.PARAMS+S.FI.T
>MLICALL MLISETFILEINFO
.9 rts
.99 >RET 1 discard filetype
*/--------------------------------------
* # LoadTxtFile
* Load TXT a file in memory (with ending 0)
* ## C
@ -122,31 +147,6 @@ K.LoadFile clc
clc
rts
*/--------------------------------------
* # ChTyp
* Change The type of a ProDOS File
* ## C
* `int chtyp(const char *filepath, const char filetype);`
* ## ASM
* **In:**
* `>PUSHBI filetype`
* `>LDYA filepath`
* `>SYSCALL chtyp`
* ## RETURN VALUE
*\--------------------------------------
K.ChTyp jsr PFT.CheckPathYA
bcs .99
>PULLB .1+1
>MLICALL MLIGETFILEINFO
bcs .9
.1 lda #$ff
sta K.MLI.PARAMS+S.FI.T
>MLICALL MLISETFILEINFO
.9 rts
.99 >RET 1 discard filetype
*/--------------------------------------
* # ChOwn
* **In:**
* PUSHW = mod

View File

@ -54,7 +54,7 @@ GP.Sleep php
sta (pPs),y
pla
iny #S.PS.Y
iny #S.PS.Y
sta (pPs),y
pla
@ -65,10 +65,10 @@ GP.Sleep php
plx get PC HI
inc Advance one byte because of return by RTI
bne .1
bne GP.Sleep2
inx
.1 iny #S.PS.PC
GP.Sleep2 ldy #S.PS.PC
sta (pPs),y
txa
@ -112,62 +112,42 @@ GP.Sleep php
* *** MUST BE REINTRANT ***
*--------------------------------------
GP.SysCall dec IRQ.InKernel
sty .5+1 save Y (Func Arg)
sta .6+1 save A (Func Arg)
stx .7+1 save X (Func ID)
lda K.SYSCALL.BANK,x Get Target BNK
bpl .1 0, E000, no BNK change
cmp $D000 #RRAMWRAMBNK1 or #RRAMWRAMBNK2
beq .1 same as actual BNK...go restore A and JMP
tax set Target BNK in x
lda $D000 get source BNK
bit $C000,x switch to Target BNK
bit $C000,x
pha
phy
ldy #S.PS.A
sta (pPs),y
.1 pha remember source BNK
txa
iny #S.PS.X
sta (pPs),y
jsr .5 go to kernel.....
stx .4+1 save X
pla
iny #S.PS.Y
sta (pPs),y
plx get back Source BNK
tay
pla
bit $C000,x switch to Target BNK
bit $C000,x
bcc .4 no error quit...
jsr K.SYSCALL.Go
bcc .2 no error quit...
tax CS,A=0 ?
bne .4 no, return error to caller
beq .3 Yes, BLOCKING I/O
pla get PC LO
.2 inc IRQ.InKernel
rts Unmodified Carry
.3 pla get PC LO
plx get PC HI
sec
sbc #3 move back JSR GP.SysCall
bcs .2
* sec
sbc #2 move back JSR GP.SysCall -3 (jsr $BF00) +1 (RTI)
bcs .4
dex
.2 phx
pha
ldy .5+1
lda .6+1
ldx .7+1
inc IRQ.InKernel
jmp GP.Sleep
.4 ldx #$FF Self Modified
inc IRQ.InKernel
rts Unmodified Carry
.5 ldy #$FF Self Modified
.6 lda #$FF Self Modified
.7 ldx #$FF Self Modified
jmp (K.SYSCALL.JMP,x)
.4 inc IRQ.InKernel
bra GP.Sleep2
*--------------------------------------
GP.LibCall dec IRQ.InLib
@ -179,16 +159,16 @@ GP.LibCall dec IRQ.InLib
.1 jsr $FFFF SELF MODIFIED
GP.LibCall.8 inc IRQ.InLib
rts
GP.LibCall.RTS rts
*--------------------------------------
GP.AtkCall dec IRQ.InKernel
* >STYA .1
* jsr GO.ProDOS
* jsr MLI
* .DA #MLIATALK
*.1 .DA *
* jsr GO.A2osX
>STYA .1
jsr GO.ProDOS
jsr MLI
.DA #MLIATALK
.1 .DA *
jsr GO.A2osX
inc IRQ.InKernel
rts

View File

@ -2,12 +2,12 @@ NEW
PREFIX
AUTO 4,1
*--------------------------------------
* $E000-E1FF K.SYSCALL.JMP Jmp Table
* $E000-E1FF System calls Jump Table
*--------------------------------------
* Bank 1
*--------------------------------------
K.SYSCALL.JMP .DA K.GetMemStat $00
.DA 0
K.SYSCALL .DA K.GetMemStat $00
.DA K.ChMod
.DA K.FStat
.DA K.Stat
.DA K.MKDir
@ -61,11 +61,11 @@ K.SYSCALL.JMP .DA K.GetMemStat $00
.DA 0
.DA 0 $60
.DA 0
.DA K.ChTyp
.DA K.LoadFile
.DA K.LoadTxtFile
.DA K.ChTyp
.DA K.ChMod
.DA 0
.DA 0
.DA K.ChOwn
.DA K.ChGrp
@ -424,11 +424,37 @@ K.GUIOSD.JMP sta SETREADAUX
sta CLRWRITEAUX
rts
*--------------------------------------
K.STAT.YA.JMP pha
>PUSHWI K.S.STAT
pla
>SYSCALL stat
K.SYSCALL.Go bit K.SYSCALL.BANK,x Get Target BNK
bpl K.SYSCALL.JMP 0, E000, no BNK change
K.SYSCALL.GoB sta .7+1
lda $D000 #RRAMWRAMBNK1 or #RRAMWRAMBNK2
cmp K.SYSCALL.BANK,x
beq .7
pha remember source BNK
stx .6+1
lda K.SYSCALL.BANK,x
tax get Target BNK in x
bit $C000,x switch to Target BNK
bit $C000,x
jsr .6
stx .5+1 Save X
plx get back Source BNK
bit $C000,x switch to Target BNK
bit $C000,x
.5 ldx #$ff SELF MODIFIED
rts
.6 ldx #$ff SELF MODIFIED
.7 lda #$ff SELF MODIFIED
K.SYSCALL.JMP jmp (K.SYSCALL,x)
*--------------------------------------
MAN
SAVE USR/SRC/SYS/KERNEL.S.JMP

View File

@ -272,8 +272,8 @@ K.FreeMem.ERR phx
>PUSHBI 2
>LDYAI K.FreeMem.MSG
.1 >SYSCALL printf
.1 ldx #SYS.printf
jsr K.SYSCALL.GoB
plx
sec
@ -537,8 +537,10 @@ MEM.Kernel.JMP jmp (SYS.Kernel.JMP,x)
* Y,A = File Length
* X = hMem of Loaded Object in AUX mem
*\--------------------------------------
K.LoadStkObj >SYSCALL LoadTxtFile To get ending \0
K.LoadStkObj ldx #SYS.LoadTxtFile To get ending \0
jsr K.SYSCALL.GoB
bcs .99
sty .81+1
sta .82+1

View File

@ -654,7 +654,7 @@ CB.Update >LDYA ZPCmdPtr
GO.GetMem ldx #SYS.GetMem
.HS 2C BIT ABS
GO.GetMemPtr ldx #SYS.GetMemPtr
jmp (K.SYSCALL.JMP,x)
jmp (K.SYSCALL,x)
*--------------------------------------
CB.Cache .BS S.CB
FON.Cache .BS S.FON

View File

@ -142,7 +142,9 @@ PS.CreateChild ldx #0
ldy #S.PS.hPREFIX copy hPREFIX...
lda (pPs),y
jsr K.GetMemPtr
>SYSCALL StrDup
ldx #SYS.StrDup
jsr K.SYSCALL.GoB
bcs .9
jsr PS.SetMemOwner Set Ownership
@ -209,8 +211,10 @@ PS.Load ldy #$ff
cmp #'/'
bne .1
>PUSHWI K.S.STAT
>LDYA PS.ArgV found /, some path specified, no search
jsr K.STAT.YA.JMP
ldx #SYS.stat
jsr K.SYSCALL.GoB
bcc .6 REAL path in K.Buf256
.99 rts
@ -285,8 +289,10 @@ PS.Load.SCRIPT ldx #$ff
sta K.Buf256-1,x K.Buf256 = "/ROOT/BIN/SHELL\0"
.5 >LDYAI K.Buf256
jsr K.STAT.YA.JMP
.5 >PUSHWI K.S.STAT
>LDYAI K.Buf256
ldx #SYS.stat
jsr K.SYSCALL.GoB
bcs PS.Load.RTS
lda K.S.STAT+S.STAT.P.TYPE
@ -392,19 +398,22 @@ PS.LoadGetHeader
>PUSHBI S.FI.T.TXT
>PUSHBI O.RDONLY
>LDYAI K.IOBuf
>SYSCALL fopen
ldx #SYS.fopen
jsr K.SYSCALL.GoB
bcs .9
sta .1+1
>PUSHWI 128
>PUSHWI K.IOBuf+128
.1 lda #$ff SELF MODIFIED
>SYSCALL fread
ldx #SYS.fread
jsr K.SYSCALL.GoB
php
pha
lda .1+1
>SYSCALL fclose
ldx #SYS.fclose
jsr K.SYSCALL.GoB
pla
plp
.9 rts

View File

@ -73,7 +73,8 @@ PWD.Store lda PWD.DBPtr
>PUSHBI S.FI.T.TXT
>PUSHBI O.WRONLY+O.CREATE
>LDYAI PWD.FILE
>SYSCALL FOpen
ldx #SYS.FOpen
jsr K.SYSCALL.GoB
bcc .1
pha
@ -89,7 +90,8 @@ PWD.Store lda PWD.DBPtr
jsr K.getmemptr
>PUSHYA
lda .7+1
>SYSCALL FWrite
ldx #SYS.FWrite
jsr K.SYSCALL.GoB
bcs .2
jsr .7
@ -103,7 +105,8 @@ PWD.Store lda PWD.DBPtr
rts
.7 lda #$ff
>SYSCALL fclose
ldx #SYS.fclose
jsr K.SYSCALL.GoB
.8 lda #$ff
jsr K.freemem

View File

@ -328,7 +328,8 @@ K.MkNod.I ldx #2
.2 stx .3+1 Store hFILE
>LDYA ZPPtr1
>SYSCALL StrDup
ldx #SYS.StrDup
jsr K.SYSCALL.GoB
bcs .9
txa

View File

@ -123,7 +123,9 @@ K.FPutS jsr PFT.CheckNodeA set IO.hFD
>PULLYA Get String
>STYA ZPPtr2 Save Buffer
>SYSCALL strlen Get String len in Y,A
ldx #SYS.strlen Get String len in Y,A
jsr K.SYSCALL.GoB
>PUSHYA push len
>PUSHW ZPPtr2 push buffer
jsr IO.Write.I
@ -900,6 +902,7 @@ K.GetC.I >PUSHWI 1
>RET 4 BLOCKING I/O
.8 lda K.IOBuf
K.GetC.RTS rts
*/--------------------------------------
* # SScanF
@ -1391,7 +1394,8 @@ STDIO.NewHFile sta .4+1 Store hFD
bra .3
.21 >LDYAI K.buf256
>SYSCALL strdup
ldx #SYS.strdup
jsr K.SYSCALL.GoB
bcs .9
txa

View File

@ -314,8 +314,10 @@ STDLIB.realpath.I
clc
ror .82+1
>SYSCALL ExpandStr
ldx #SYS.ExpandStr
jsr K.SYSCALL.GoB
bcs STDLIB.32.RTS
>STYA ZPPtr1
stx .99+1 save expanded buffer hMem
@ -423,7 +425,8 @@ STDLIB.realpath.I
.82 lda #$ff SELF MODIFIED
bpl .88
>LDYAI K.Buf256
>SYSCALL StrDup BANK 2
ldx #SYS.StrDup BANK 2
jsr K.SYSCALL.GoB
rts
.88 clc

View File

@ -25,7 +25,8 @@ K.StrLen >STYA .1+1
inc .1+2
bra .1
.8 rts
.8 clc
rts
*/--------------------------------------
* # StrCat
* Concatenate strings
@ -78,7 +79,8 @@ K.StrCpy clc
.8 ply
pla
K.StrCpy.RTS rts
K.StrCpy.RTS clc
rts
*/--------------------------------------
* # StrDup
* Create a new copy of this C-String
@ -129,7 +131,7 @@ K.StrDup >STYA .1+1
K.StrDup.8 pla
ply
* clc
clc
rts
*/--------------------------------------
* # StrUpr/StrLwr