Kernel 0.94

This commit is contained in:
Rémy GIBERT 2020-03-16 07:50:15 +01:00
parent b9c8617882
commit 416bb500ca
26 changed files with 400 additions and 361 deletions

Binary file not shown.

View File

@ -3,7 +3,7 @@ NEW
.LIST OFF
.OP 65C02
.OR $2000
.TF BIN/LS
.TF bin/ls
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I

View File

@ -225,7 +225,7 @@ InitSrcDirYA >PUSHYA
lda #0
sta (ZPPtr2),y
.7 >PUSHW ZPPtr2
.7 >LDYA ZPPtr2
>SYSCALL OpenDir
bcs .9
@ -444,7 +444,7 @@ EnterSubDirYA >STYA ZPPtr2 save SUBDIR for StrCat
ldy #hSrcBasePath
jsr EnterSubDirY
>PUSHW ZPPtr1
>LDYA ZPPtr1
>SYSCALL OpenDir
bcs .9

View File

@ -84,9 +84,11 @@ Dev.Detect >LDYA L.MSG.DETECT
>LDYA L.DRV.CS.START
>SYSCALL InsDrv
bcs .9
>STYA FD.DEV+S.FD.DEV.DRVPTR
>PUSHW L.FD.DEV
>PUSHW L.FD.DEV.NAME
>LDYA L.FD.DEV
>SYSCALL MKDEV
bcs .9
php

View File

@ -92,8 +92,9 @@ Dev.Detect >STYA ARGS
.99 bcs .9
>STYA FD.DEV+S.FD.DEV.DRVPTR
>PUSHW L.FD.DEV
>PUSHW L.FD.DEV.NAME
>LDYA L.FD.DEV
>SYSCALL MKDEV
bcs .9

View File

@ -96,8 +96,9 @@ Dev.Detect >STYA ARGS
bcs .9
>STYA FD.DEV+S.FD.DEV.DRVPTR
>PUSHW L.FD.DEV
>PUSHW L.FD.DEV.NAME
>LDYA L.FD.DEV
>SYSCALL MKDEV
.9 rts

View File

@ -86,9 +86,11 @@ Dev.Detect >LDYA L.MSG.DETECT
>LDYA L.DRV.CS.START
>SYSCALL InsDrv
bcs .9
>STYA FD.DEV+S.FD.DEV.DRVPTR
>PUSHW L.FD.DEV
>PUSHW L.FD.DEV.NAME
>LDYA L.FD.DEV
>SYSCALL MKDEV
rts

View File

@ -100,9 +100,11 @@ Dev.Detect >STYA ARGS
>LDYA L.DRV.CS.START
>SYSCALL InsDrv
bcs .9
>STYA FD.DEV+S.FD.DEV.DRVPTR
>PUSHW L.FD.DEV
>PUSHW L.FD.DEV.NAME
>LDYA L.FD.DEV
>SYSCALL MKDEV
bcs .9

View File

@ -108,9 +108,11 @@ Dev.Detect >STYA ARGS
>LDYA L.DRV.CS.START
>SYSCALL InsDrv
bcs .9
>STYA FD.DEV+S.FD.DEV.DRVPTR
>PUSHW L.FD.DEV
>PUSHW L.FD.DEV.NAME
>LDYA L.FD.DEV
>SYSCALL MKDEV
.9 rts

View File

@ -116,8 +116,9 @@ Dev.Detect >STYA ARGS
.99 bcs .9
>STYA FD.DEV+S.FD.DEV.DRVPTR
>PUSHW L.FD.DEV
>PUSHW L.FD.DEV.NAME
>LDYA L.FD.DEV
>SYSCALL MKDEV
bcs .9

View File

@ -408,29 +408,29 @@ S.DIB.S.NOFMT .EQ %00001000
S.DIB.S.WENABL .EQ %00000100
S.DIB.S.IRQ .EQ %00000010
S.DIB.S.OPENED .EQ %00000001
S.DIB.SIZE .EQ 1 3 bytes
S.DIB.IDS .EQ 4 1 (LEN) + 16 MAX
S.DIB.SIZE .EQ 1 3 bytes
S.DIB.IDS .EQ 4 1 (LEN) + 16 MAX
S.DIB.T .EQ 21
S.DIB.T.RAM .EQ $00 Memory Expansion Card (RAM disk)
S.DIB.T.3.5 .EQ $01 3.5" disk
S.DIB.T.PROFILE .EQ $02 ProFile-type hard disk
S.DIB.T.GENSCSI .EQ $03 Generic SCSI
S.DIB.T.ROM .EQ $04 ROM disk
S.DIB.T.CDROM .EQ $05 SCSI CD-ROM
S.DIB.T.TAPE .EQ $06 SCSI tape or other SCSI sequential device
S.DIB.T.HD .EQ $07 SCSI hard disk
* .EQ $08 Reserved
*S.DIB.T.SPRINTER .EQ $09 SCSI printer
S.DIB.T.5.25 .EQ $0A 5-1/4" disk
* .EQ $0B Reserved
* .EQ $0C Reserved
*S.DIB.T.PRINTER .EQ $0D Printer
*S.DIB.T.CLOCK .EQ $0E Clock
*S.DIB.T.MODEM .EQ $0F Modem
S.DIB.T.RAM .EQ $00 Memory Expansion Card (RAM disk)
S.DIB.T.3.5 .EQ $01 3.5" disk
S.DIB.T.PROFILE .EQ $02 ProFile-type hard disk
S.DIB.T.GENSCSI .EQ $03 Generic SCSI
S.DIB.T.ROM .EQ $04 ROM disk
S.DIB.T.CDROM .EQ $05 SCSI CD-ROM
S.DIB.T.TAPE .EQ $06 SCSI tape or other SCSI sequential device
S.DIB.T.HD .EQ $07 SCSI hard disk
* .EQ $08 Reserved
*S.DIB.T.SPRINTER .EQ $09 SCSI printer
S.DIB.T.5.25 .EQ $0A 5-1/4" disk
* .EQ $0B Reserved
* .EQ $0C Reserved
*S.DIB.T.PRINTER .EQ $0D Printer
*S.DIB.T.CLOCK .EQ $0E Clock
*S.DIB.T.MODEM .EQ $0F Modem
S.DIB.T.DISKII .EQ $10
S.DIB.T.PRODOS .EQ $11
S.DIB.T.NIC .EQ $12 Network Interface Card
S.DIB.T.XY .EQ $13 X,Y Pointing Device
S.DIB.T.NIC .EQ $12 Network Interface Card
S.DIB.T.XY .EQ $13 X,Y Pointing Device
S.DIB.T.CHAR .EQ $14
S.DIB.T.GFX .EQ $15
S.DIB.T.SND .EQ $16
@ -438,7 +438,7 @@ S.DIB.ST .EQ 22
S.DIB.ST.EXT .EQ $80
S.DIB.ST.DSKSW .EQ $40
S.DIB.ST.NOREM .EQ $20
S.DIB.VERSION .EQ 23
S.DIB.VERSION .EQ 23 word
*
S.DIB .EQ 25
*--------------------------------------
@ -508,11 +508,11 @@ S.FD.PIPE .EQ 14
* PS STRUCT
*--------------------------------------
S.PS.F .EQ 0
S.PS.F.HOLD .EQ %10000000
S.PS.F.SLEEP .EQ %01000000
S.PS.F.CLOSEONX .EQ %00000100
S.PS.F.EVENT .EQ %00000010
S.PS.F.NOHUP .EQ %00000001
S.PS.F.HOLD .EQ %10000000
S.PS.F.SLEEP .EQ %01000000
S.PS.F.CLOSEONX .EQ %00000100
S.PS.F.EVENT .EQ %00000010
S.PS.F.NOHUP .EQ %00000001
S.PS.S .EQ 1
S.PS.S.INIT .EQ 0
@ -559,10 +559,10 @@ LIBMGR.UNLOAD .EQ 2
* EVENT STRUCT
*--------------------------------------
S.EVT.F .EQ 0
S.EVT.F.T10TH .EQ %10000000
S.EVT.F.T1SEC .EQ %01000000
S.EVT.F.hMEM2 .EQ %00100000 Indicates That S.EVT.B2 is a hMem
S.EVT.F.hMEM1 .EQ %00010000 Indicates That S.EVT.B1 is a hMem
S.EVT.F.T10TH .EQ %10000000
S.EVT.F.T1SEC .EQ %01000000
S.EVT.F.hMEM2 .EQ %00100000 Indicates That S.EVT.B2 is a hMem
S.EVT.F.hMEM1 .EQ %00010000 Indicates That S.EVT.B1 is a hMem
*S.EVT.hDEV .EQ 1
S.EVT.B1 .EQ 2
@ -602,8 +602,8 @@ S.STAT.MODE.FU .EQ $01C0
*S.STAT.MODE.SGID .EQ $0400
*S.STAT.MODE.SUID .EQ $0800
S.STAT.MODE.REG .EQ $0000
S.STAT.MODE.DIR .EQ $1000
S.STAT.MODE.REG .EQ $0000
S.STAT.MODE.DIR .EQ $1000
S.STAT.MODE.CDEV .EQ $2000
S.STAT.MODE.BDEV .EQ $3000
*S.STAT.MODE.LNK .EQ $4000

View File

@ -1237,7 +1237,7 @@ SKT.FindMatchingLocRem
ldy #S.TCP.OPTIONS Listening, only SYN packet....
lda (ZPFrameInPtr),y
cmp #S.TCP.OPTIONS.SYN
beq .7 SYN recieved on a LISTEN socket, ok
beq .7 SYN received on a LISTEN socket, ok
bne .8 bad packet for this listening
.6 lda SKT.REM.ADDR+S.SOCKADDR.ADDR

View File

@ -94,7 +94,7 @@ SHARED.GetPDrv ldy #S.FD.DEV.DRVPTR
* ## ASM
* `>PUSHW fd`
* `>PUSHW devname`
* `>SYSCALL mkdev
* `>SYSCALL mkdev`
* ## RETURN VALUE
* A = hDEV
*\--------------------------------------

View File

@ -5,7 +5,7 @@ NEW
* ## C
* `int hDIR opendir (const char * dirpath);`
* ## ASM
* `>PUSHW dirpath`
* `>LDYA dirpath`
* `>SYSCALL opendir`
* ## RETURN VALUE
* CC : success
@ -13,7 +13,7 @@ NEW
* CS : error
* A = EC
*\--------------------------------------
K.OpenDir jsr PFT.CheckPath0
K.OpenDir jsr PFT.CheckPathYA
bcs .9
ldx #1
@ -28,6 +28,7 @@ K.OpenDir jsr PFT.CheckPath0
lda K.MLI.PARAMS+4
cmp #$0F Directory ?
bne .98
jsr IO.MLI.OPEN
bcs .98
@ -66,17 +67,23 @@ K.ReadDir.hBuf .BS 1
*--------------------------------------
K.ReadDir jsr PFT.CheckNodeA
bcs K.ReadDir.RTS
ldy #S.FD.REG.REF
lda (pFD),y
beq K.ReadDir.ROOT
jmp K.ReadDir.DIR
jsr UNISTD.CheckDev
bcs .1
jmp K.ReadDir.DEV
.1 jmp K.ReadDir.DIR
K.ReadDir.NoMore
lda #MLI.E.EOF
sec
K.ReadDir.RTS rts
*--------------------------------------
K.ReadDir.ROOT
ldy #S.FD.DIR.FC did we already returned something ?
K.ReadDir.ROOT ldy #S.FD.DIR.FC did we already returned something ?
lda (pFD),y
bne K.ReadDir.NoMore
@ -164,9 +171,13 @@ K.ReadDir.ROOT
ldy #S.FD.DIR.FC
lda #16
sta (pFD),y Flag that we returned somthing for next time
sta (pFD),y Flag that we returned something for next time
jmp K.ReadDir.EXIT
*--------------------------------------
K.ReadDir.DEV >DEBUG
jmp K.ReadDir.NoMore
*--------------------------------------
K.ReadDir.DIR sta K.MLI.PARAMS+1 A=#S.DIR.PRODOS.REF
>LDYAI 512 Get a 512 bytes buffer for reading dir...

View File

@ -326,7 +326,7 @@ ENVX.SIDVarsGID ldx #S.SESSION.GID
tay
lda (ZPPtr3),y
jsr MATH.A2STR10NP
jsr MATH32.A2STR10NP
>LDYAI A2osX.NumStrBuf

View File

@ -59,6 +59,7 @@ IO.WRITE.CDEV ldx #IOCTL.WRITE
>LDYAI K.S.IOCTL
jsr SHARED.pDrvJmp
bcs .9
>LDYA K.S.IOCTL+S.IOCTL.BYTECNT
.9 rts
@ -183,10 +184,12 @@ IO.CLOSE.NOD ldx #2
.1 cmp Nod.Table.hFD-2,x
bne .2
stz Nod.Table.hFD-2,x
lda Nod.Table.hPath-2,x
stz Nod.Table.hPath-2,x
jmp K.FreeMem
.2 inx
cpx #K.Nod.MAX+2
bne .1

View File

@ -1,267 +1,6 @@
NEW
AUTO 3,1
*--------------------------------------
MATH.A2STR10NP ldx #3 3 digit max
ldy #0 Disable Padding
MATH.A2STR10 jsr MATH.A2ACC32
clc unsigned
*--------------------------------------
* CS = signed long
* CC = unsigned long
* X = Pad Len
* Y = Pad Char
*--------------------------------------
MATH.ACC322STR10
stx .5+1 Pad Len
sty .81+1 Pad Char
stz A2osX.NumStrLen
bcc .1
clc
lda ACC32+3
bpl .1
jsr MATH.ACC32NEG
sec
.1 ror ACC32.Sign Save sign
ldx #4
.2 stz RESULT,x Clear all 5 bytes
dex
bpl .2
sed switch to BCD mode
ldx #32 let's roll 32 bits
.3 jsr MATH.ACC32.T2
ldy #4
.4 lda RESULT,y
adc RESULT,y
sta RESULT,y
dey
bpl .4
dex
bne .3
cld
ldx .5+1 no padding
beq .6
lda #10 starts at 10-padlen
sec
.5 sbc #$ff SELF MODIFIED
tax
.6 txa
lsr
tay
lda RESULT,y
bcs .7
lsr
lsr
lsr
lsr
.7 and #$0F
ora #$30
cmp #'0'
beq .80
ldy #'0' next 0s always printed
sty .81+1
bra .82
.80 cpx #9 last char, print always
beq .82
.81 lda #$ff SELF MODIFIED Get Padding char
beq .87
.82 bit ACC32.Sign "-" to print ?
bpl .86
pha
lda #'-'
jsr .88
stz ACC32.Sign
pla
.86 jsr .88
.87 inx
cpx #10
bne .6
lda #0
.88 ldy A2osX.NumStrLen
inc A2osX.NumStrLen
sta A2osX.NumStrBuf,y
rts
*--------------------------------------
* Convert Hex int at ZPPtr2 to ACC32
*--------------------------------------
MATH.Hex2ACC32 lda (ZPPtr2)
beq .9
jsr SHARED.IsHexDigit
bcs .9
jsr MATH.A2ACC32
ldy #0
.1 iny
lda (ZPPtr2),y
beq .8
jsr SHARED.IsHexDigit
bcs .8
pha
ldx #4
.2 jsr MATH.ACC32.T2
dex
bne .2
pla
ora ACC32
sta ACC32
bra .1
.8 clc
rts
.9 sec
rts
*--------------------------------------
* Convert A to 2 hex digits in AX
*--------------------------------------
MATH.AToHexAX pha
and #$0F
jsr .8
tax
pla
lsr
lsr
lsr
lsr
.8 ora #$30
cmp #'9'+1
bcc .9
adc #6
.9 rts
*--------------------------------------
* Convert Decimal int at ZPPtr2 to ACC32
*--------------------------------------
MATH.Dec2ACC32 jsr MATH.ACC32ZERO
clc
lda (ZPPtr2)
eor #'-'
bne .10
jsr SHARED.NextCharPtr2 skip '-'
sec
.10 ror .80+1 set pos/neg flag
ldy #$ff
.1 iny
lda (ZPPtr2),y
beq .8
jsr ZP.IsDigit
bcs .8
phy Save Y, pointing to next char
jsr MATH.ACC32.T10
ply
bcs .9
lda (ZPPtr2),y
and #$0F
* clc
adc ACC32
sta ACC32
bcc .1
inc ACC32+1
bne .1
inc ACC32+2
bne .1
inc ACC32+3
bne .1 if 0, overflow!!!
.9 lda #E.INUM
sec
rts
.8 tya no digit parsed...error
beq .9
.80 lda #$FF SELF MODIFIED
bpl .88
phy
jsr MATH.ACC32NEG
ply
.88 clc
rts
*--------------------------------------
MATH.ACC32.T10 ldx #3
.1 lda ACC32,x save ACC32 for 4+1
pha
dex
bpl .1
jsr MATH.ACC32.T2 ACC32 * 2 -> ACC32
jsr MATH.ACC32.T2 ACC32 * 4 -> ACC32
ldx #0
ldy #4
* clc
.2 pla ACC32 * 4 + ACC32 -> ACC32
adc ACC32,x
sta ACC32,x
inx
dey
bne .2
MATH.ACC32.T2 asl ACC32
rol ACC32+1
rol ACC32+2
rol ACC32+3
rts
*--------------------------------------
MATH.A2ACC32 sta ACC32
.HS 2C BIT ABS
MATH.ACC32ZERO stz ACC32
stz ACC32+1
stz ACC32+2
stz ACC32+3
rts
*--------------------------------------
MATH.TMP32ZERO stz TMP32
stz TMP32+1
stz TMP32+2
stz TMP32+3
rts
*--------------------------------------
MATH.ARG32ABS lda ARG32.Sign
bmi MATH.ARG32NEG
rts
*--------------------------------------
MATH.ACC32ABS lda ACC32.Sign
bpl MATH.ACC32NEG.RTS
*--------------------------------------
MATH.ACC32NEG ldy #ACC32
.HS 2C BIT ABS
MATH.ARG32NEG ldy #ARG32
ldx #3
sec
.1 lda $0,y two's complement of X bytes
eor #$ff
adc #0
sta $0,y
iny
dex
bpl .1
MATH.ACC32NEG.RTS
rts
*--------------------------------------
MAN
SAVE USR/SRC/SYS/KERNEL.S.MATH
LOAD USR/SRC/SYS/KERNEL.S

View File

@ -167,15 +167,15 @@ MATH32.MULDIVMOD.COMMON
jsr MATH32.GetARG32
plp
bcc MATH32.GetARG32.RTS
jsr MATH.ACC32ABS
jmp MATH.ARG32ABS
jsr MATH32.ACC32ABS
jmp MATH32.ARG32ABS
*--------------------------------------
* http://6502.org/source/integers/32muldiv.htm
* http://nparker.llx.com/a2/mult.html
*--------------------------------------
* ARG32*ACC32->TMP32
*--------------------------------------
MATH32.MUL jsr MATH.TMP32ZERO
MATH32.MUL jsr MATH32.TMP32ZERO
ldx #32
.1 lsr ARG32+3
ror ARG32+2
@ -193,7 +193,7 @@ MATH32.MUL jsr MATH.TMP32ZERO
tya
eor #4
bne .2
.3 jsr MATH.ACC32.T2
.3 jsr MATH32.ACC32.T2
dex
bne .1
clc
@ -202,7 +202,7 @@ MATH32.MUL jsr MATH.TMP32ZERO
* ARG32 = ARG32 div ACC32
* TMP32 = ARG32 mod ACC32
*--------------------------------------
MATH32.DIVMOD jsr MATH.TMP32ZERO
MATH32.DIVMOD jsr MATH32.TMP32ZERO
ldx #32
@ -250,6 +250,272 @@ MATH32.DIVMOD jsr MATH.TMP32ZERO
rts
*--------------------------------------
MATH32.A2STR10NP ldx #3 3 digit max
ldy #0 Disable Padding
MATH32.A2STR10 jsr MATH32.A2ACC32
clc unsigned
*--------------------------------------
* CS = signed long
* CC = unsigned long
* X = Pad Len
* Y = Pad Char
*--------------------------------------
MATH32.ACC322STR10
stx .5+1 Pad Len
sty .81+1 Pad Char
stz A2osX.NumStrLen
bcc .1
clc
lda ACC32+3
bpl .1
jsr MATH32.ACC32NEG
sec
.1 ror ACC32.Sign Save sign
ldx #4
.2 stz RESULT,x Clear all 5 bytes
dex
bpl .2
sed switch to BCD mode
ldx #32 let's roll 32 bits
.3 jsr MATH32.ACC32.T2
ldy #4
.4 lda RESULT,y
adc RESULT,y
sta RESULT,y
dey
bpl .4
dex
bne .3
cld
ldx .5+1 no padding
beq .6
lda #10 starts at 10-padlen
sec
.5 sbc #$ff SELF MODIFIED
tax
.6 txa
lsr
tay
lda RESULT,y
bcs .7
lsr
lsr
lsr
lsr
.7 and #$0F
ora #$30
cmp #'0'
beq .80
ldy #'0' next 0s always printed
sty .81+1
bra .82
.80 cpx #9 last char, print always
beq .82
.81 lda #$ff SELF MODIFIED Get Padding char
beq .87
.82 bit ACC32.Sign "-" to print ?
bpl .86
pha
lda #'-'
jsr .88
stz ACC32.Sign
pla
.86 jsr .88
.87 inx
cpx #10
bne .6
lda #0
.88 ldy A2osX.NumStrLen
inc A2osX.NumStrLen
sta A2osX.NumStrBuf,y
rts
*--------------------------------------
* Convert Hex int at ZPPtr2 to ACC32
*--------------------------------------
MATH32.Hex2ACC32
lda (ZPPtr2)
beq .9
jsr SHARED.IsHexDigit
bcs .9
jsr MATH32.A2ACC32
ldy #0
.1 iny
lda (ZPPtr2),y
beq .8
jsr SHARED.IsHexDigit
bcs .8
pha
ldx #4
.2 jsr MATH32.ACC32.T2
dex
bne .2
pla
ora ACC32
sta ACC32
bra .1
.8 clc
rts
.9 sec
rts
*--------------------------------------
* Convert A to 2 hex digits in AX
*--------------------------------------
MATH32.AToHexAX pha
and #$0F
jsr .8
tax
pla
lsr
lsr
lsr
lsr
.8 ora #$30
cmp #'9'+1
bcc .9
adc #6
.9 rts
*--------------------------------------
* Convert Decimal int at ZPPtr2 to ACC32
*--------------------------------------
MATH32.Dec2ACC32
jsr MATH32.ACC32ZERO
clc
lda (ZPPtr2)
eor #'-'
bne .10
jsr SHARED.NextCharPtr2 skip '-'
sec
.10 ror .80+1 set pos/neg flag
ldy #$ff
.1 iny
lda (ZPPtr2),y
beq .8
jsr ZP.IsDigit
bcs .8
phy Save Y, pointing to next char
jsr MATH32.ACC32.T10
ply
bcs .9
lda (ZPPtr2),y
and #$0F
* clc
adc ACC32
sta ACC32
bcc .1
inc ACC32+1
bne .1
inc ACC32+2
bne .1
inc ACC32+3
bne .1 if 0, overflow!!!
.9 lda #E.INUM
sec
rts
.8 tya no digit parsed...error
beq .9
.80 lda #$FF SELF MODIFIED
bpl .88
phy
jsr MATH32.ACC32NEG
ply
.88 clc
rts
*--------------------------------------
MATH32.ACC32.T10
ldx #3
.1 lda ACC32,x save ACC32 for 4+1
pha
dex
bpl .1
jsr MATH32.ACC32.T2 ACC32 * 2 -> ACC32
jsr MATH32.ACC32.T2 ACC32 * 4 -> ACC32
ldx #0
ldy #4
* clc
.2 pla ACC32 * 4 + ACC32 -> ACC32
adc ACC32,x
sta ACC32,x
inx
dey
bne .2
MATH32.ACC32.T2 asl ACC32
rol ACC32+1
rol ACC32+2
rol ACC32+3
rts
*--------------------------------------
MATH32.A2ACC32 sta ACC32
.HS 2C BIT ABS
MATH32.ACC32ZERO
stz ACC32
stz ACC32+1
stz ACC32+2
stz ACC32+3
rts
*--------------------------------------
MATH32.TMP32ZERO
stz TMP32
stz TMP32+1
stz TMP32+2
stz TMP32+3
rts
*--------------------------------------
MATH32.ARG32ABS lda ARG32.Sign
bmi MATH32.ARG32NEG
rts
*--------------------------------------
MATH32.ACC32ABS lda ACC32.Sign
bpl MATH32.ACC32NEG.RTS
*--------------------------------------
MATH32.ACC32NEG ldy #ACC32
.HS 2C BIT ABS
MATH32.ARG32NEG ldy #ARG32
ldx #3
sec
.1 lda $0,y two's complement of X bytes
eor #$ff
adc #0
sta $0,y
iny
dex
bpl .1
MATH32.ACC32NEG.RTS
rts
*--------------------------------------
MAN
SAVE USR/SRC/SYS/KERNEL.S.MATH32
LOAD USR/SRC/SYS/KERNEL.S

View File

@ -28,15 +28,15 @@ PFT.CheckPath2 ldy #2
.HS 2C BIT ABS
PFT.CheckPath4 ldy #4
stx .6+1 Save SYSCALL #
lda (pStack),y
pha
iny
lda (pStack),y
>PUSHA
pla
>PUSHA
ply
PFT.CheckPathYA >PUSHYA
stx .6+1 Save SYSCALL #
>PUSHWI K.Buf256
>SYSCALL2 realpath

View File

@ -472,7 +472,7 @@ PWD.StoreString iny
*--------------------------------------
PWD.StoreByte php
phx
jsr MATH.A2STR10NP
jsr MATH32.A2STR10NP
plx
plp
ldy #0

View File

@ -6,7 +6,6 @@ NEW
* ## C
* `int chtyp(const char *filepath, short int filetype);`
* ## ASM
* **In:**
* `>PUSHW filepath`
* `>PUSHB filetype`
* `>SYSCALL chtyp`
@ -29,7 +28,6 @@ K.ChTyp jsr PFT.CheckPath1
* ## C
* `int chmod(const char *pathname, int mode);`
* ## ASM
* **In:**
* `>PUSHW pathname`
* `>PUSHW mode`
* `>SYSCALL chmod`
@ -98,7 +96,6 @@ K.ChMod.RET4 >RET 4 discard statbuf
* ## C
* `int fstat(short int hFILE, struct stat *statbuf);`
* ## ASM
* **In:**
* `>PUSHB hFILE`
* `>PUSHW statbuf`
* `>SYSCALL fstat`
@ -150,7 +147,6 @@ K.Stat.Store.RTS
* ## C
* `int stat(const char *pathname, struct stat *statbuf);`
* ## ASM
* **In:**
* `>PUSHW pathname`
* `>PUSHW statbuf`
* `>SYSCALL stat`
@ -174,7 +170,6 @@ K.Stat jsr PFT.CheckPath2
* ## C
* `int mkdir(const char *pathname, int mode);`
* ## ASM
* **In:**
* `>PUSHW pathname`
* `>PUSHW mode`
* `>SYSCALL mkdir`
@ -198,15 +193,14 @@ K.MKDir jsr PFT.CheckPath2
* # MKFIFO
* return a pathname to a new FIFO
* ## C
* `int mkfifo( char *pathname, int mode);`
* `hFILE mkfifo(const char *pathname, int mode);`
* ## ASM
* **In:**
* `>PUSHW pathname`
* `>PUSHW mode`
* `>SYSCALL mkfifo`
* ## RETURN VALUE
* CC = OK, CS = ERROR
* A = hFD
* A = hFILE
*\--------------------------------------
K.MKFIFO jsr STAT.PullPathAndMode
@ -216,13 +210,13 @@ K.MKFIFO jsr STAT.PullPathAndMode
ldy #0
.1 lda DEV.FIFO,y
sta (ZPPtr1),y
sta (ZPPtr1),y fill pathname buffer
iny
cpy #9
bne .1
lda IO.hFD
jsr MATH.AToHexAX
jsr MATH32.AToHexAX
sta (ZPPtr1),y
txa
iny
@ -238,7 +232,6 @@ K.MKFIFO jsr STAT.PullPathAndMode
* ## C
* `hFILE mknod(const char *pathname, int mode, hFD fd);`
* ## ASM
* **In:**
* `>PUSHW pathname`
* `>PUSHW mode`
* `>PUSHB fd`
@ -252,20 +245,25 @@ K.MkNod >PULLB IO.hFD
jsr STAT.PullPathAndMode
K.MkNod.I ldx #2
.1 lda Nod.Table.hPath-2,x
beq .2
inx
cpx #K.Nod.MAX+2
bne .1
lda #E.OOH
* sec
rts
.2 stx .3+1 Store hFILE
>LDYA ZPPtr1
ldx #SYS.StrDup
jsr K.SYSCALL2
>SYSCALL2 StrDup
bcs .9
txa
.3 ldx #$ff SELF MODIFIED
sta Nod.Table.hPath-2,x
lda IO.hFD
@ -301,7 +299,9 @@ K.Pipe sta .1+1 SIZE HI
ldy #S.FD.PIPE.Size+1
sta (pFD),y
ldy #S.FD.PIPE.hMem
.8 lda #$ff Self Modified
sta (pFD),y
txa hFD

View File

@ -117,7 +117,7 @@ K.PrintF.1 jsr STDIO.GetFormat
jsr ZP.IsDigit
bcs .6 %0x ??????
.4 jsr MATH.Dec2ACC32
.4 jsr MATH32.Dec2ACC32
bcs .99
lda ACC32
sta K.PrintF.PadL
@ -162,7 +162,7 @@ K.PrintF.1 jsr STDIO.GetFormat
cmp #'x' \xHH
bne .1
jsr MATH.Hex2ACC32
jsr MATH32.Hex2ACC32
bcs .99
jsr SHARED.AddYToPtr2
@ -254,7 +254,7 @@ PrintF.U clc unsigned long (DWORD)
ldy #4
PrintF.NUM ror ACC32.Sign
jsr MATH.ACC32ZERO
jsr MATH32.ACC32ZERO
.1 jsr STDIO.GetStackByte
bcs PrintF.B.RTS
@ -265,7 +265,7 @@ PrintF.NUM ror ACC32.Sign
ldx K.PrintF.PadL
ldy K.PrintF.PadC
rol ACC32.Sign
jsr MATH.ACC322STR10
jsr MATH32.ACC322STR10
bra PrintF.StrNum
*--------------------------------------
* EXP(8) 1(s) 1significants(31)
@ -371,7 +371,7 @@ PrintF.HH jsr STDIO.GetStackByte
*--------------------------------------
PrintF.H jsr STDIO.GetStackByte
bcs PrintF.COut.RTS
PrintF.H.1 jsr MATH.AToHexAX
PrintF.H.1 jsr MATH32.AToHexAX
jsr PrintF.COut
bcs PrintF.COut.RTS
txa
@ -532,14 +532,14 @@ K.SScanF.L
K.SScanF.U lda K.SScanFTBL+1,x Get VAR size
pha Save VAL size
jsr MATH.Dec2ACC32
jsr MATH32.Dec2ACC32
bra K.SScanF.GetVAL
*--------------------------------------
K.SScanF.HH
K.SScanF.H lda K.SScanFTBL+1,x Get VAR size
pha
jsr MATH.Hex2ACC32
jsr MATH32.Hex2ACC32
K.SScanF.GetVAL jsr SHARED.AddYToPtr1 Y=char count parsed

View File

@ -94,7 +94,7 @@ K.AToL >STYA ZPPtr2 C-String in Ptr2, Dst buffer in Ptr1
* lda #10 base 10
sec signed
K.AToL.I jsr MATH.Dec2ACC32
K.AToL.I jsr MATH32.Dec2ACC32
bcs .9
ldx #3
@ -121,7 +121,7 @@ K.AToL.I jsr MATH.Dec2ACC32
K.atoi >STYA ZPPtr2
* lda #10 base 10
sec signed
jsr MATH.Dec2ACC32
jsr MATH32.Dec2ACC32
bcs .9
>LDYA ACC32
@ -468,7 +468,7 @@ ENV.SysVar jsr ZP.IsDigit $0 ... $9 ?
ldy ENV.SysVars.PS-1,x
lda (pPS),y
*--------------------------------------
ENV.SysVarsNum jsr MATH.A2STR10NP
ENV.SysVarsNum jsr MATH32.A2STR10NP
ldy #0

View File

@ -506,7 +506,7 @@ TERMX.CSI.Exec stz CsiHeader
.1 jsr SHARED.NextCharPtr2
.2 jsr MATH.Dec2ACC32
.2 jsr MATH32.Dec2ACC32
bcs .5
jsr SHARED.AddYToPtr2
@ -1053,7 +1053,7 @@ TERMX.CURBLNK.OFF
TERMX.CURBLNK.RTS
rts
*--------------------------------------
Decimal.Out jsr MATH.A2STR10NP
Decimal.Out jsr MATH32.A2STR10NP
ldx #0
.1 lda A2osX.NumStrBuf,x

View File

@ -138,7 +138,7 @@ K.StrFTime.addDecA
ldx #2
ldy #'0'
clc
jsr MATH.A2STR10
jsr MATH32.A2STR10
lda A2osX.NumStrBuf
jsr SHARED.FORPNT.PutNext
lda A2osX.NumStrBuf+1
@ -390,7 +390,7 @@ K.CTime2Time.HMS
.2 phy
lda #60
jsr MATH.A2ACC32
jsr MATH32.A2ACC32
jsr MATH32.DIVMOD
ply
lda TMP32

View File

@ -29,17 +29,10 @@ K.Open jsr PFT.YAToMLIPATH
stz IO.Open.AUXTYPE
stz IO.Open.AUXTYPE+1
*--------------------------------------
UNISTD.Open ldx #5 /DEV/
cpx K.MLI.PATH
UNISTD.Open jsr UNISTD.CheckDev
bcs IO.OPEN.REG
.1 lda K.MLI.PATH,x
cmp DEV.FIFO-1,x
bne IO.OPEN.REG
dex
bne .1
*--------------------------------------
* /DEV/xxxxxx (CDEV,BDEV,LNK,DSOCK,SSOCK,PIPE)
* /DEV/xxxxxx (CDEV,BDEV,DSOCK,SSOCK,PIPE)
*--------------------------------------
>LDYAI K.MLI.PATH+6 skip $/DEV/
@ -81,10 +74,10 @@ UNISTD.Open ldx #5 /DEV/
.71 lda (pFD) #S.FD.T
tax
jmp (.8-4,x)
jmp (.8-2,x)
.8
* .DA STDIO.IOERR REG
* .DA STDIO.IOERR DIR
.DA STDIO.IOERR DIR
.DA IO.OPEN.CDEV
.DA IO.OPEN.BDEV
.DA STDIO.IOERR LNK
@ -237,6 +230,22 @@ UNISTD.GetPFD sta IO.hFD
>STYA pFD
rts
*--------------------------------------
UNISTD.CheckDev ldx #5 /DEV/
cpx K.MLI.PATH
bcs .99
.1 lda K.MLI.PATH,x
cmp DEV.FIFO-1,x
bne .9
dex
bne .1
clc
rts
.9 sec
.99 rts
*--------------------------------------
DEV.FIFO .AS "/dev/fifo" STAT,UNISTD
*/--------------------------------------
* # ChOwn