mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-25 20:33:13 +00:00
Kernel 0.94
This commit is contained in:
parent
a395d3fe03
commit
8a81ee27bc
Binary file not shown.
@ -586,9 +586,10 @@ CSH.fCall ldx ZPPtr1
|
||||
pla
|
||||
sta ZPPtr1
|
||||
phy
|
||||
jsr .80
|
||||
plx
|
||||
jsr CSH.fCall.Exec
|
||||
plx restore returned type
|
||||
rts
|
||||
|
||||
.90 lda #CSH.E.SYNTAX
|
||||
.HS 2C BIT ABS
|
||||
.91 lda #CSH.E.TMISMATCH
|
||||
@ -607,7 +608,9 @@ CSH.fCall ldx ZPPtr1
|
||||
|
||||
.99 rts
|
||||
|
||||
.80 jmp (J.CSH.EXEC,x)
|
||||
*--------------------------------------
|
||||
CSH.fCall.Exec
|
||||
jmp (J.CSH.EXEC,x)
|
||||
*--------------------------------------
|
||||
* Input:
|
||||
* ZPFileBufPtr, A = Expected type
|
||||
@ -887,8 +890,8 @@ CSH.GetNumOnStack
|
||||
bcc .1
|
||||
bne .99
|
||||
|
||||
>PUSHW ZPFileBufPtr
|
||||
>PUSHWI ZPFileBufPtr
|
||||
>LDYA ZPFileBufPtr
|
||||
>SYSCALL StrToF
|
||||
clc
|
||||
rts
|
||||
|
@ -81,12 +81,16 @@ CORE.Events jsr CORE.GetEvents
|
||||
*--------------------------------------
|
||||
.4 bit OPENAPPLE
|
||||
bpl .8
|
||||
|
||||
lda KBD
|
||||
bpl .8
|
||||
|
||||
cmp #"0"
|
||||
bcc .8
|
||||
cmp #"6"
|
||||
|
||||
cmp #"9"+1
|
||||
bcs .8
|
||||
|
||||
sta KBDSTROBE
|
||||
and #$0F
|
||||
tax
|
||||
|
@ -64,7 +64,28 @@ K.GetDevStatus >PULLW K.S.IOCTL+S.IOCTL.BUFPTR
|
||||
>STYA pFD
|
||||
|
||||
lda #S.IOCTL.STATCODE.GETDIB
|
||||
jmp SHARED.GetDevStatus
|
||||
*--------------------------------------
|
||||
SHARED.GetDevStatus
|
||||
sta K.S.IOCTL+S.IOCTL.STATCODE
|
||||
|
||||
ldy #S.FD.DEV.DEVID
|
||||
lda (pFD),y
|
||||
sta K.S.IOCTL+S.IOCTL.UNITNUM
|
||||
|
||||
jsr SHARED.GetPDrv
|
||||
|
||||
>LDYAI K.S.IOCTL
|
||||
ldx #IOCTL.STATUS
|
||||
*--------------------------------------
|
||||
SHARED.pDrvJmp jmp (pDrv)
|
||||
*--------------------------------------
|
||||
SHARED.GetPDrv ldy #S.FD.DEV.DRVPTR
|
||||
lda (pFD),y
|
||||
sta pDRV
|
||||
iny
|
||||
lda (pFD),y
|
||||
sta pDRV+1
|
||||
rts
|
||||
*/--------------------------------------
|
||||
* # MKDev
|
||||
* Create a hDEV
|
||||
@ -163,7 +184,7 @@ K.MKDev >PULLW ZPPtr2 ptr2=name
|
||||
*/--------------------------------------
|
||||
* # IOCTL
|
||||
* ## C
|
||||
* `int ioctl(short int DevID, int request, void * param );`
|
||||
* `int ioctl(short int DevID, short int request, void *param);`
|
||||
* ## ASM
|
||||
* `>PUSHB hDEV`
|
||||
* `>PUSHB request`
|
||||
|
@ -31,8 +31,7 @@ K.OpenDir jsr PFT.CheckPath0
|
||||
jsr IO.MLI.OPEN
|
||||
bcs .98
|
||||
|
||||
.8 lda IO.hFD
|
||||
jsr STDIO.NewHFile
|
||||
.8 jsr STDIO.NewHFile
|
||||
|
||||
bcc K.ReadDir.RTS
|
||||
.98 jmp UNISTD.Open.ERR
|
||||
@ -56,12 +55,13 @@ K.OpenDir jsr PFT.CheckPath0
|
||||
*\--------------------------------------
|
||||
.DUMMY
|
||||
.OR ZPTMP 8 Bytes
|
||||
K.ReadDir.hMem .BS 1
|
||||
K.ReadDir.BufSize .BS 2
|
||||
K.ReadDir.hBlk .BS 1
|
||||
K.ReadDir.ECIB .BS 1
|
||||
K.ReadDir.EL .BS 1
|
||||
K.ReadDir.EPB .BS 1
|
||||
K.ReadDir.EC .BS 2
|
||||
K.ReadDir.BufSize .BS 2
|
||||
K.ReadDir.hBuf .BS 1
|
||||
.ED
|
||||
*--------------------------------------
|
||||
K.ReadDir jsr PFT.CheckNodeA
|
||||
@ -173,7 +173,7 @@ K.ReadDir.DIR sta K.MLI.PARAMS+1 A=#S.DIR.PRODOS.REF
|
||||
jsr K.GetMem
|
||||
bcs .99
|
||||
|
||||
stx K.ReadDir.hMem
|
||||
stx K.ReadDir.hBlk
|
||||
>STYA K.MLI.PARAMS+2 For reading
|
||||
pha
|
||||
tya
|
||||
@ -210,8 +210,8 @@ K.ReadDir.DIR sta K.MLI.PARAMS+1 A=#S.DIR.PRODOS.REF
|
||||
inc K.ReadDir.EC+1 ...and ProDOS does NOT include header entry in EC
|
||||
bra .4
|
||||
|
||||
.98 jsr K.ReadDir.CLN
|
||||
sec
|
||||
.98 jmp K.ReadDir.FreeBlk
|
||||
|
||||
.99 rts
|
||||
|
||||
.2 ldy #S.FD.DIR.EL+3
|
||||
@ -287,7 +287,7 @@ K.ReadDir.DIR1 lda (ZPPtr2) X = EntryCount In This Block
|
||||
bne K.ReadDir.DIR1
|
||||
* pass #2 Fill Buffer...(ZPPtr1 & Ptr2 can now be trashed)
|
||||
K.ReadDir.DIR2 jsr K.ReadDir.GetBuf
|
||||
bcs .9
|
||||
bcs K.ReadDir.FreeBlk
|
||||
|
||||
lda K.ReadDir.EPB
|
||||
sta K.ReadDir.ECIB
|
||||
@ -338,37 +338,35 @@ K.ReadDir.DIR2 jsr K.ReadDir.GetBuf
|
||||
inc ZPPtr3+1
|
||||
bra .1
|
||||
|
||||
.9 jsr K.ReadDir.CLN
|
||||
sec
|
||||
rts
|
||||
|
||||
.8 ldx #3
|
||||
ldy #S.FD.DIR.EL+3
|
||||
|
||||
.81 lda K.ReadDir.EL,x Store back this session prameters to S.DIR
|
||||
.81 lda K.ReadDir.EL,x Store back this session parameters to S.DIR
|
||||
sta (pFD),y
|
||||
dey
|
||||
dex
|
||||
bpl .81
|
||||
|
||||
jsr K.ReadDir.CLN Discard READBUFFER
|
||||
jsr K.ReadDir.FreeBlk
|
||||
|
||||
K.ReadDir.EXIT ldx #$ff Self Modified : hDIRENT
|
||||
K.ReadDir.EXIT ldx K.ReadDir.hBuf
|
||||
txa
|
||||
jmp K.GetMemPtr
|
||||
*--------------------------------------
|
||||
K.ReadDir.CLN pha
|
||||
lda K.ReadDir.hMem
|
||||
K.ReadDir.FreeBlk
|
||||
pha
|
||||
lda K.ReadDir.hBlk
|
||||
jsr K.FreeMem
|
||||
pla
|
||||
rts
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
K.ReadDir.GetBuf
|
||||
>LDYA K.ReadDir.BufSize Get a BufSize bytes buffer for storing results
|
||||
K.ReadDir.GetBufYA
|
||||
jsr K.GetMem0 make sure 0 filled
|
||||
bcs .9
|
||||
stx K.ReadDir.EXIT+1
|
||||
stx K.ReadDir.hBuf
|
||||
>STYA ZPPtr4
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
|
@ -37,11 +37,11 @@ IO.WRITE.REG.RTS
|
||||
IO.OPEN.CDEV
|
||||
IO.OPEN.BDEV jsr SHARED.GetPDrv
|
||||
ldx #IOCTL.OPEN
|
||||
lda IO.hDev
|
||||
lda IO.hFD
|
||||
jsr SHARED.pDrvJmp
|
||||
bcs IO.WRITE.REG.RTS
|
||||
|
||||
lda IO.hDev
|
||||
lda IO.hFD
|
||||
*--------------------------------------
|
||||
IO.CLOSE.CDEV
|
||||
IO.CLOSE.BDEV
|
||||
@ -125,13 +125,16 @@ IO.EOF.CDEV lda #S.IOCTL.STATCODE.EOF
|
||||
* X = 2 > PIPE
|
||||
*--------------------------------------
|
||||
IO.MkFD stx .8+1
|
||||
|
||||
ldy IO.MkFD.Y,x
|
||||
lda #0
|
||||
ldx #S.MEM.F.INIT0+S.MEM.F.FD
|
||||
jsr MEM.GetMem.YAX
|
||||
bcs .9
|
||||
|
||||
>STYA pFD
|
||||
stx IO.hFD
|
||||
|
||||
.8 ldx #$ff SELF MODIFIED
|
||||
lda IO.MkFD.T,x
|
||||
sta (pFD) X = hFD, A = T
|
||||
|
@ -315,13 +315,13 @@ K.SYSCALL.BANK .DA #RRAMWRAMBNK1 $00
|
||||
.DA #RRAMWRAMBNK2
|
||||
.DA #0
|
||||
|
||||
.DA #RRAMWRAMBNK2 $90 : DEV
|
||||
.DA #RRAMWRAMBNK1 $90 : DEV
|
||||
.DA #0
|
||||
.DA #RRAMWRAMBNK2
|
||||
.DA #RRAMWRAMBNK1
|
||||
.DA #0
|
||||
.DA #RRAMWRAMBNK2
|
||||
.DA #RRAMWRAMBNK1
|
||||
.DA #0
|
||||
.DA #RRAMWRAMBNK2
|
||||
.DA #RRAMWRAMBNK1
|
||||
.DA #0
|
||||
.DA #RRAMWRAMBNK2 $98 : BIN
|
||||
.DA #0
|
||||
|
@ -1,28 +1,6 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*--------------------------------------
|
||||
SHARED.GetDevStatus
|
||||
sta K.S.IOCTL+S.IOCTL.STATCODE
|
||||
|
||||
ldy #S.FD.DEV.DEVID
|
||||
lda (pFD),y
|
||||
sta K.S.IOCTL+S.IOCTL.UNITNUM
|
||||
|
||||
jsr SHARED.GetPDrv
|
||||
|
||||
>LDYAI K.S.IOCTL
|
||||
ldx #IOCTL.STATUS
|
||||
*--------------------------------------
|
||||
SHARED.pDrvJmp jmp (pDrv)
|
||||
*--------------------------------------
|
||||
SHARED.GetPDrv ldy #S.FD.DEV.DRVPTR
|
||||
lda (pFD),y
|
||||
sta pDRV
|
||||
iny
|
||||
lda (pFD),y
|
||||
sta pDRV+1
|
||||
rts
|
||||
*--------------------------------------
|
||||
SHARED.IsIDValid
|
||||
cmp #'.'
|
||||
beq SHARED.IsDigit.8
|
||||
|
@ -197,7 +197,7 @@ K.FGetS jsr PFT.CheckNodeA
|
||||
sta ZPPtr1+1
|
||||
bmi .3 already something in buffer
|
||||
|
||||
.1 jsr STDIO.Read.1
|
||||
.1 jsr STDIO.Get.1
|
||||
bcc .2
|
||||
cmp #MLI.E.EOF
|
||||
beq .9
|
||||
@ -206,6 +206,7 @@ K.FGetS jsr PFT.CheckNodeA
|
||||
bpl .9 IO error
|
||||
inc NO DATA -> BLOCKING
|
||||
rts
|
||||
|
||||
.2 lda K.IOBuf
|
||||
cmp #C.LF Discard any leading LF
|
||||
beq .1
|
||||
@ -222,12 +223,13 @@ K.FGetS jsr PFT.CheckNodeA
|
||||
lda ZPPtr1+1
|
||||
eor #$ff
|
||||
sta ZPPtr1+1
|
||||
|
||||
.3 inc ZPPtr1
|
||||
bne .4
|
||||
inc ZPPtr1+1
|
||||
beq .8 Buffer full
|
||||
|
||||
.4 jsr STDIO.Read.1
|
||||
.4 jsr STDIO.Get.1
|
||||
bcs .5
|
||||
|
||||
lda K.IOBuf
|
||||
@ -293,7 +295,7 @@ K.GetChar ldy #S.PS.hStdIn
|
||||
K.GetC jsr PFT.CheckNodeA
|
||||
bcs K.GetC.RTS
|
||||
|
||||
jsr STDIO.Read.1
|
||||
jsr STDIO.Get.1
|
||||
bcc .8
|
||||
tay
|
||||
bpl K.GetC.RTS I/O error
|
||||
@ -305,7 +307,7 @@ K.GetC jsr PFT.CheckNodeA
|
||||
|
||||
K.GetC.RTS rts
|
||||
*--------------------------------------
|
||||
STDIO.Read.1 lda #0
|
||||
STDIO.Get.1 lda #0
|
||||
>PUSHA
|
||||
inc read 1 byte
|
||||
>PUSHA
|
||||
@ -342,7 +344,7 @@ STDIO.Read.1 lda #0
|
||||
* CS : A = EC
|
||||
*\--------------------------------------
|
||||
K.FOpen jsr PFT.CheckPath4
|
||||
bcs K.FOpen.RET6
|
||||
bcs .9
|
||||
|
||||
>PULLW IO.Open.AUXTYPE
|
||||
>PULLB IO.Open.TYPE
|
||||
@ -352,14 +354,15 @@ K.FOpen jsr PFT.CheckPath4
|
||||
inc pStack
|
||||
|
||||
jsr UNISTD.Open
|
||||
bcs K.FClose.RTS
|
||||
bcs .99
|
||||
|
||||
jsr STDIO.NewHFile
|
||||
bcc K.FClose.RTS
|
||||
bcc .99
|
||||
|
||||
jmp UNISTD.Open.ERR
|
||||
|
||||
K.FOpen.RET6 >RET 6
|
||||
.9 >POP 6
|
||||
.99 rts
|
||||
*/--------------------------------------
|
||||
* # FClose
|
||||
* Close a file
|
||||
@ -645,8 +648,7 @@ K.Rename jsr PFT.CheckPath2
|
||||
* K.Buf256 = filepath
|
||||
* X = hFD
|
||||
*--------------------------------------
|
||||
STDIO.NewHFile sta .4+1 Store hFD
|
||||
ldx #1
|
||||
STDIO.NewHFile ldx #1
|
||||
.1 lda OF.Table.hFD-1,x
|
||||
beq .2
|
||||
|
||||
@ -658,26 +660,26 @@ STDIO.NewHFile sta .4+1 Store hFD
|
||||
* sec
|
||||
rts
|
||||
|
||||
.2 stx .3+1 Store hFILE
|
||||
.2 stx .4+1
|
||||
|
||||
ldx #0
|
||||
|
||||
lda (pFD)
|
||||
cmp #S.FD.T.CDEV
|
||||
beq .20
|
||||
beq .3
|
||||
|
||||
cmp #S.FD.T.BDEV
|
||||
bne .21
|
||||
beq .3 No hPath for DEV
|
||||
|
||||
.20 lda #0 No hPath for DEV
|
||||
bra .3
|
||||
|
||||
.21 >LDYAI K.buf256
|
||||
>LDYAI K.buf256
|
||||
>SYSCALL2 StrDup
|
||||
bcs .9
|
||||
|
||||
txa
|
||||
.3 ldx #$ff SELF MODIFIED
|
||||
.3 txa
|
||||
|
||||
.4 ldx #$ff SELF MODIFIED
|
||||
sta OF.Table.hPath-1,x
|
||||
.4 lda #$ff SELF MODIFIED
|
||||
lda IO.hFD
|
||||
sta OF.Table.hFD-1,x
|
||||
txa hFILE
|
||||
|
||||
|
@ -1,21 +1,20 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
*/--------------------------------------
|
||||
* # strtof
|
||||
* # StrToF
|
||||
* Convert String to 40 bits Float
|
||||
* ## C
|
||||
* `float strtof (const char* str, char** endptr);`
|
||||
* ## ASM
|
||||
* **In:**
|
||||
* `>PUSHW str`
|
||||
* `>PUSHWI EndPtr`
|
||||
* `>LDYA str`
|
||||
* `>SYSCALL strtof`
|
||||
* `>SYSCALL StrToF`
|
||||
* ## RETURN VALUE
|
||||
* On stack (float)
|
||||
*\--------------------------------------
|
||||
K.strtof pha
|
||||
>PULLW ZPPtr1
|
||||
pla
|
||||
K.StrToF >PULLW ZPPtr1
|
||||
>PULLYA
|
||||
jsr K.AToF
|
||||
|
||||
lda TXTPTR
|
||||
@ -56,7 +55,7 @@ K.AToF >STYA TXTPTR Ptr to source string
|
||||
* `>PUSHW str`
|
||||
* `>PUSHW EndPtr`
|
||||
* `>PUSHB Base`
|
||||
* `>SYSCALL strtol`
|
||||
* `>SYSCALL StrToL`
|
||||
* ## RETURN VALUE
|
||||
* On stack (long)
|
||||
*\--------------------------------------
|
||||
|
@ -171,7 +171,7 @@ TERMX.READ bit bActive is screen active?
|
||||
bpl .6 no....go check flush...
|
||||
jsr TERMX.CURBLNK
|
||||
|
||||
lda OPENAPPLE
|
||||
bit OPENAPPLE
|
||||
bpl .1
|
||||
|
||||
jsr TERMX.Title.ON
|
||||
|
@ -18,9 +18,7 @@ NEW
|
||||
IO.Open.FLAGS .BS 1
|
||||
IO.Open.TYPE .BS 1
|
||||
IO.Open.AUXTYPE .BS 2
|
||||
IO.hDev .BS 1
|
||||
IO.hFD .BS 1
|
||||
IO.hFILE .BS 1
|
||||
.ED
|
||||
*--------------------------------------
|
||||
K.Open jsr PFT.YAToMLIPATH
|
||||
@ -47,6 +45,7 @@ UNISTD.Open ldx #5 /DEV/
|
||||
|
||||
>SYSCALL2 GetDevByName
|
||||
bcc .7
|
||||
|
||||
ldx #2
|
||||
.10 lda Nod.Table.hPath-2,x
|
||||
beq .3
|
||||
@ -71,8 +70,8 @@ UNISTD.Open ldx #5 /DEV/
|
||||
lda #MLI.E.NODEV
|
||||
* sec
|
||||
rts no OF found
|
||||
|
||||
.7 stx IO.hDev
|
||||
*--------------------------------------
|
||||
.7 stx IO.hFD
|
||||
>STYA pFD
|
||||
|
||||
.71 lda (pFD) #S.FD.T
|
||||
@ -106,31 +105,40 @@ IO.OPEN.REG >MLICALL MLIGETFILEINFO
|
||||
IO.OPEN.REG.E ldx #0
|
||||
jsr IO.MkFD
|
||||
bcs IO.OPEN.RTS
|
||||
|
||||
jsr IO.MLI.OPEN
|
||||
bcs UNISTD.Open.ERR
|
||||
|
||||
lda IO.Open.FLAGS
|
||||
bit #O.WRONLY
|
||||
beq .20 Write mode ?
|
||||
|
||||
and #O.APPEND Append ?
|
||||
bne .11 yes, go to end of file
|
||||
|
||||
stz K.MLI.PARAMS+2
|
||||
stz K.MLI.PARAMS+3
|
||||
stz K.MLI.PARAMS+4
|
||||
>MLICALL MLISETEOF no, reset size to 0
|
||||
bra .21
|
||||
|
||||
.11 >MLICALL MLIGETEOF
|
||||
bcs UNISTD.Open.ERR
|
||||
|
||||
>MLICALL MLISETMARK
|
||||
.21 bcs UNISTD.Open.ERR
|
||||
|
||||
.20 lda IO.Open.FLAGS
|
||||
and #O.TEXT Text Mode ?
|
||||
beq .8
|
||||
|
||||
lda #$FF
|
||||
sta K.MLI.PARAMS+2
|
||||
lda #C.CR
|
||||
sta K.MLI.PARAMS+3
|
||||
>MLICALL MLINEWLINE
|
||||
bcs UNISTD.Open.ERR
|
||||
|
||||
.8 lda IO.hFD
|
||||
IO.OPEN.RTS rts
|
||||
|
||||
|
@ -74,6 +74,7 @@ A2osX.D1.B .PH $D000
|
||||
.INB USR/SRC/SYS/KERNEL.S.IO
|
||||
.INB USR/SRC/SYS/KERNEL.S.STDIO
|
||||
.INB USR/SRC/SYS/KERNEL.S.STDIO2
|
||||
.INB USR/SRC/SYS/KERNEL.S.DEV
|
||||
.EP
|
||||
A2osX.D1.S .EQ *-A2osX.D1.B
|
||||
|
||||
@ -85,7 +86,6 @@ A2osX.D2.B .PH $D000
|
||||
.INB USR/SRC/SYS/KERNEL.S.ARG
|
||||
.INB USR/SRC/SYS/KERNEL.S.STDLIB
|
||||
.INB USR/SRC/SYS/KERNEL.S.STRING
|
||||
.INB USR/SRC/SYS/KERNEL.S.DEV
|
||||
.INB USR/SRC/SYS/KERNEL.S.BIN
|
||||
.INB USR/SRC/SYS/KERNEL.S.PS
|
||||
.EP
|
||||
|
Loading…
Reference in New Issue
Block a user