mirror of
https://github.com/A2osX/A2osX.git
synced 2025-01-15 22:30:13 +00:00
Kernel version 0.9 : Introducing Node API, FIFOs, DEVs, and sockets....
This commit is contained in:
parent
68c61c225f
commit
53e429b7bd
BIN
A2OSX.BOOT.po
BIN
A2OSX.BOOT.po
Binary file not shown.
BIN
A2OSX.DEV.po
BIN
A2OSX.DEV.po
Binary file not shown.
BIN
A2OSX.SRC.po
BIN
A2OSX.SRC.po
Binary file not shown.
10
BIN/LS.S.txt
10
BIN/LS.S.txt
@ -133,11 +133,11 @@ CS.RUN ldy #bCANCEL
|
||||
>SYSCALL PStrMatch
|
||||
bcs .8 no match, skip....
|
||||
|
||||
.4 ldy #S.STAT.PRODOS.DRIVE
|
||||
.4 ldy #S.STAT.P.DRIVE
|
||||
lda (ZPPtr2),y ProDOS Device ?
|
||||
bne .5
|
||||
|
||||
ldy #S.STAT.PRODOS.TYPE
|
||||
ldy #S.STAT.P.TYPE
|
||||
lda (ZPPtr2),y
|
||||
cmp #$0F Directory ?
|
||||
bne .6
|
||||
@ -169,7 +169,7 @@ CS.RUN.DEV ldy #bLong
|
||||
lda (pData),y
|
||||
bpl CS.RUN.DIR
|
||||
|
||||
ldy #S.STAT.PRODOS.DEVBLOCKS+1
|
||||
ldy #S.STAT.P.DEVBLOCKS+1
|
||||
>PUSHB (ZPPtr2),y
|
||||
dey
|
||||
>PUSHB (ZPPtr2),y
|
||||
@ -178,7 +178,7 @@ CS.RUN.DEV ldy #bLong
|
||||
dey
|
||||
>PUSHB (ZPPtr2),y
|
||||
|
||||
ldy #S.STAT.PRODOS.DRIVE
|
||||
ldy #S.STAT.P.DRIVE
|
||||
>PUSHB (ZPPtr2),y
|
||||
dey SLOT
|
||||
>PUSHB (ZPPtr2),y
|
||||
@ -300,7 +300,7 @@ CS.RUN.FILE ldy #bLong
|
||||
lda (ZPPtr2),y
|
||||
>PUSHA File Mode
|
||||
|
||||
ldy #S.STAT.PRODOS.AUXTYPE+1
|
||||
ldy #S.STAT.P.AUXTYPE+1
|
||||
lda (ZPPtr2),y
|
||||
>PUSHA
|
||||
dey
|
||||
|
@ -128,11 +128,11 @@ CS.RUN ldy #bCANCEL
|
||||
>SYSCALL PStrMatch
|
||||
bcs .8 no match, skip....
|
||||
|
||||
.4 ldy #S.STAT.PRODOS.DRIVE
|
||||
.4 ldy #S.STAT.P.DRIVE
|
||||
lda (ZPPtr2),y ProDOS Device ?
|
||||
bne .5
|
||||
|
||||
ldy #S.STAT.PRODOS.TYPE
|
||||
ldy #S.STAT.P.TYPE
|
||||
lda (ZPPtr2),y
|
||||
cmp #$0F Directory ?
|
||||
bne .6
|
||||
|
@ -139,11 +139,11 @@ CS.RUN ldy #bCANCEL
|
||||
>SYSCALL PStrMatch
|
||||
bcs .8 no match, skip....
|
||||
|
||||
.4 ldy #S.STAT.PRODOS.DRIVE
|
||||
.4 ldy #S.STAT.P.DRIVE
|
||||
lda (ZPPtr2),y ProDOS Device ?
|
||||
bne .5
|
||||
|
||||
ldy #S.STAT.PRODOS.TYPE
|
||||
ldy #S.STAT.P.TYPE
|
||||
lda (ZPPtr2),y
|
||||
cmp #$0F Directory ?
|
||||
bne .6
|
||||
|
@ -86,7 +86,7 @@ InitSrcDirYA ldx #0
|
||||
|
||||
bcs .1 File/DIR does not exists, go extract pattern
|
||||
|
||||
lda STAT+S.STAT.PRODOS.TYPE
|
||||
lda STAT+S.STAT.P.TYPE
|
||||
cmp #$0f
|
||||
beq .5 TYPE=DIR, do not extract wildcard
|
||||
|
||||
|
267
INC/A2osX.I.txt
267
INC/A2osX.I.txt
@ -63,6 +63,7 @@ D.STACK.TOP .EQ $03F0 ...Down to $0300
|
||||
KrnBuf256 .EQ $0C00 Main
|
||||
*--------------------------------------
|
||||
MLICALL.PARAMS .EQ $0D00 Main, $12 bytes min !!!!
|
||||
MLICALL.TMPBUF .EQ $0D12 Small buffer (14 bytes) for MLI calls
|
||||
BLKCALL.PARAMS .EQ $0D20 Max 6 Bytes copied to/from $42->$47 before Firmware call
|
||||
PRTCALL.PARAMS .EQ $D030 Max 8 bytes for smartport cmdnum $0->$9
|
||||
KrnSTAT .EQ $0D40 S.STAT
|
||||
@ -318,24 +319,6 @@ S.MEMSTAT.DH .EQ 20
|
||||
*
|
||||
S.MEMSTAT .EQ 24
|
||||
*--------------------------------------
|
||||
* DEVMGR (old API)
|
||||
*--------------------------------------
|
||||
S.DEV.CODE .EQ 0 cld,jmp...
|
||||
S.DEV.JMP .EQ 2 ...(code,x)
|
||||
S.DEV.ID .EQ 4
|
||||
S.DEV.F .EQ 5
|
||||
S.DEV.F.INUSE .EQ %10000000
|
||||
S.DEV.F.BUSY .EQ %01000000
|
||||
S.DEV.F.SHARE .EQ %00100000 Device is shareable
|
||||
S.DEV.F.IRQ .EQ %00010000 Device is irq driven
|
||||
S.DEV.F.EVENT .EQ %00001000 Device is event driven
|
||||
S.DEV.F.COUT .EQ %00000100 Device supports Char OUT
|
||||
S.DEV.F.BLOCK .EQ %00000010
|
||||
S.DEV.F.CHAR .EQ %00000001
|
||||
S.DEV.NAME .EQ 6 5 Bytes : LEN+NUL KBD CON COMx LPTx ETHx
|
||||
*
|
||||
S.DEV .EQ 16
|
||||
*--------------------------------------
|
||||
S.DEVINFO.TYPE .EQ 0
|
||||
S.DEVINFO.TYPE.CHAR .EQ %00000001
|
||||
S.DEVINFO.TYPE.XY .EQ %00000010
|
||||
@ -376,7 +359,25 @@ DEVMGR.GFX.HLINE .EQ 18
|
||||
DEVMGR.GFX.VLINE .EQ 20
|
||||
DEVMGR.GFX.BITBLT .EQ 22
|
||||
*--------------------------------------
|
||||
* DEVMGR (new API) = Smartport DIB
|
||||
* DEVMGR (old API)
|
||||
*--------------------------------------
|
||||
S.DEV.CODE .EQ 0 cld,jmp...
|
||||
S.DEV.JMP .EQ 2 ...(code,x)
|
||||
S.DEV.ID .EQ 4
|
||||
S.DEV.F .EQ 5
|
||||
S.DEV.F.INUSE .EQ %10000000
|
||||
S.DEV.F.BUSY .EQ %01000000
|
||||
S.DEV.F.SHARE .EQ %00100000 Device is shareable
|
||||
S.DEV.F.IRQ .EQ %00010000 Device is irq driven
|
||||
S.DEV.F.EVENT .EQ %00001000 Device is event driven
|
||||
S.DEV.F.COUT .EQ %00000100 Device supports Char OUT
|
||||
S.DEV.F.BLOCK .EQ %00000010
|
||||
S.DEV.F.CHAR .EQ %00000001
|
||||
S.DEV.NAME .EQ 6 5 Bytes : LEN+NUL KBD CON COMx LPTx ETHx
|
||||
*
|
||||
S.DEV .EQ 16
|
||||
*--------------------------------------
|
||||
* DEVMGR (new API) = Smartport
|
||||
*--------------------------------------
|
||||
* JMP :
|
||||
* DEVID :
|
||||
@ -385,43 +386,38 @@ DEVMGR.GFX.BITBLT .EQ 22
|
||||
* XY : X=Slot, Y=Device (<$80)
|
||||
* > $80 : IDs for PIPE,SOCK....
|
||||
*--------------------------------------
|
||||
S..DEV.JMP .EQ 0
|
||||
S..DEV.DEVID .EQ 2
|
||||
S..DEV.FLAGS .EQ 3
|
||||
S..DEV.FLAGS.IRQ .EQ %10000000
|
||||
S..DEV.FLAGS.TYPE .EQ %00110000
|
||||
S..DEV.FLAGS.TYPE.DRV .EQ %00000000
|
||||
S..DEV.FLAGS.TYPE.BLK .EQ %00010000
|
||||
S..DEV.FLAGS.TYPE.SP .EQ %00100000
|
||||
S..DEV.FLAGS.NAMELEN .EQ %00001111
|
||||
S..DEV.NAME .EQ 4
|
||||
S..DEV .EQ 8
|
||||
*S.DEV.JMP .EQ 0
|
||||
*S.DEV.DEVID .EQ 2
|
||||
*S.DEV.F .EQ 3
|
||||
*S.DEV.F.BLOCK .EQ %10000000
|
||||
*S.DEV.F.WRITE .EQ %01000000
|
||||
*S.DEV.F.READ .EQ %00100000
|
||||
*S.DEV.F.ONLINE .EQ %00010000
|
||||
*S.DEV.F.NOFMT .EQ %00001000
|
||||
*S.DEV.F.WENABL .EQ %00000100
|
||||
*S.DEV.F.IRQ .EQ %00000010
|
||||
*S.DEV.F.OPENED .EQ %00000001
|
||||
|
||||
*S.DEV.NAME .EQ 4
|
||||
*S.DEV .EQ 8
|
||||
*--------------------------------------
|
||||
DEVMGR..STATUS .EQ 0
|
||||
DEVMGR..READBLOCK .EQ 1
|
||||
DEVMGR..READBLOCK .EQ 2
|
||||
DEVMGR..FORMAT .EQ 3
|
||||
DEVMGR..CONTROL .EQ 4
|
||||
DEVMGR..INIT .EQ 5
|
||||
DEVMGR..OPEN .EQ 6
|
||||
DEVMGR..CLOSE .EQ 7
|
||||
DEVMGR..READ .EQ 8
|
||||
DEVMGR..WRITE .EQ 9
|
||||
*DEVMGR..STATUS .EQ 0
|
||||
*DEVMGR..READBLOCK .EQ 1
|
||||
*DEVMGR..WRITEBLOCK .EQ 2
|
||||
*DEVMGR..FORMAT .EQ 3
|
||||
*DEVMGR..CONTROL .EQ 4
|
||||
*DEVMGR..INIT .EQ 5
|
||||
*DEVMGR..OPEN .EQ 6
|
||||
*DEVMGR..CLOSE .EQ 7
|
||||
*DEVMGR..READ .EQ 8
|
||||
*DEVMGR..WRITE .EQ 9
|
||||
*--------------------------------------
|
||||
S.DEVSTAT.S .EQ 0
|
||||
S.DEVSTAT.S.BLOCK .EQ %10000000
|
||||
S.DEVSTAT.S.WRITE .EQ %01000000
|
||||
S.DEVSTAT.S.READ .EQ %00100000
|
||||
S.DEVSTAT.S.ONLINE .EQ %00010000
|
||||
S.DEVSTAT.S.NOFMT .EQ %00001000
|
||||
S.DEVSTAT.S.WENABL .EQ %00000100
|
||||
S.DEVSTAT.S.IRQ .EQ %00000010
|
||||
S.DEVSTAT.S.OPENED .EQ %00000001
|
||||
S.DEVSTAT.SIZE .EQ 1
|
||||
S.DEVSTAT.IDSTRING .EQ 4 1 (LEN) + 16 MAX
|
||||
S.DEVSTAT.TYPE .EQ 21
|
||||
S.DEVSTAT.SUBTYPE .EQ 22
|
||||
S.DEVSTAT.VERSION .EQ 23
|
||||
*S.DEVSTAT.F .EQ 0 same as S.DEV.F.* bitmasks
|
||||
*S.DEVSTAT.SIZE .EQ 1 3 bytes
|
||||
*S.DEVSTAT.IDSTRING .EQ 4 1 (LEN) + 16 MAX
|
||||
*S.DEVSTAT.TYPE .EQ 21
|
||||
*S.DEVSTAT.SUBTYPE .EQ 22
|
||||
*S.DEVSTAT.VERSION .EQ 23
|
||||
*--------------------------------------
|
||||
|
||||
*--------------------------------------
|
||||
@ -443,8 +439,11 @@ S.PS.hENV .EQ 6
|
||||
S.PS.hCMDLINE .EQ 7
|
||||
S.PS.UID .EQ 8
|
||||
S.PS.hINDEV .EQ 9
|
||||
S.PS.hStdIn .EQ 9
|
||||
S.PS.hOUTDEV .EQ 10
|
||||
S.PS.hStdOut .EQ 10
|
||||
S.PS.hERRDEV .EQ 11
|
||||
S.PS.hStdErr .EQ 11
|
||||
S.PS.CPID .EQ 12
|
||||
S.PS.RC .EQ 13
|
||||
S.PS.PC .EQ 14
|
||||
@ -494,6 +493,12 @@ S.TIME.WDAY .EQ 7 1..7
|
||||
*
|
||||
S.TIME .EQ 8
|
||||
*--------------------------------------
|
||||
S.PFT.PATH .EQ 0 /dev, /mnt
|
||||
S.PFT.HANDLER .EQ 16
|
||||
S.PFT.DATA .EQ 24 8 bytes OPAQUE data for handler
|
||||
*
|
||||
S.PFT .EQ 32
|
||||
*--------------------------------------
|
||||
* S.STAT
|
||||
*--------------------------------------
|
||||
S.STAT.MODE .EQ 0
|
||||
@ -510,13 +515,14 @@ S.STAT.MODE.RU .EQ $0100
|
||||
*S.STAT.MODE.SGID .EQ $0400
|
||||
*S.STAT.MODE.SUID .EQ $0800
|
||||
|
||||
S.STAT.MODE.REG .EQ $0000
|
||||
S.STAT.MODE.FIFO .EQ $1000
|
||||
S.STAT.MODE.CHR .EQ $2000
|
||||
S.STAT.MODE.BLK .EQ $2000
|
||||
S.STAT.MODE.DIR .EQ $4000
|
||||
S.STAT.MODE.LNK .EQ $5000
|
||||
S.STAT.MODE.SOCK .EQ $6000
|
||||
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
|
||||
*S.STAT.MODE.DSOCK .EQ $5000
|
||||
*S.STAT.MODE.SSOCK .EQ $6000
|
||||
*S.STAT.MODE.FIFO .EQ $7000
|
||||
|
||||
S.STAT.DEV .EQ 2 WORD
|
||||
S.STAT.UID .EQ 4 WORD
|
||||
@ -529,119 +535,56 @@ S.STAT.MTIME .EQ 30 S.TIME
|
||||
S.STAT.CTIME .EQ 38 S.TIME
|
||||
S.STAT.BLOCKS .EQ 46 DWORD
|
||||
S.STAT.BLKSIZE .EQ 50 WORD
|
||||
S.STAT.PRODOS.TYPE .EQ 52 BYTE
|
||||
S.STAT.PRODOS.AUXTYPE .EQ 53 WORD
|
||||
S.STAT.PRODOS.SLOT .EQ 55 BYTE
|
||||
S.STAT.PRODOS.DRIVE .EQ 56 BYTE
|
||||
S.STAT.PRODOS.DEVSTATUS .EQ 57 BYTE
|
||||
S.STAT.PRODOS.DEVCNFLCT .EQ 58 BYTE
|
||||
S.STAT.PRODOS.DEVBLOCKS .EQ 59 BYTE
|
||||
S.STAT.P.TYPE .EQ 52 BYTE
|
||||
S.STAT.P.AUXTYPE .EQ 53 WORD
|
||||
S.STAT.P.SLOT .EQ 55 BYTE
|
||||
S.STAT.P.DRIVE .EQ 56 BYTE
|
||||
S.STAT.P.DEVSTATUS .EQ 57 BYTE
|
||||
*S.STAT.P.DEVCNFLCT .EQ 58 BYTE
|
||||
S.STAT.P.DEVBLOCKS .EQ 59 BYTE
|
||||
*
|
||||
S.STAT .EQ 64
|
||||
*--------------------------------------
|
||||
* S.FILE for FOPEN,FREAD......
|
||||
* S.NODE
|
||||
*--------------------------------------
|
||||
S.FILE.HANDLER .EQ 0 0=KRNL,!0=hLIB (LIBNFS,LIBTCPIP.....)
|
||||
S.FILE.T .EQ 1
|
||||
S.FILE.T.REG .EQ 1
|
||||
S.FILE.T.DIR .EQ 2
|
||||
S.FILE.T.BDEV .EQ 3
|
||||
S.FILE.T.CDEV .EQ 4
|
||||
S.FILE.T.LNK .EQ 5
|
||||
S.FILE.T.DSOCK .EQ 6
|
||||
S.FILE.T.SSOCK .EQ 7
|
||||
S.FILE.T.FIFO .EQ 8
|
||||
S.NODE.HANDLER .EQ 0 0=KRNL,!0=hLIB (LIBNFS,LIBTCPIP.....)
|
||||
S.NODE.T .EQ 1
|
||||
S.NODE.T.REG .EQ 0
|
||||
S.NODE.T.DIR .EQ 1
|
||||
S.NODE.T.CDEV .EQ 2
|
||||
S.NODE.T.BDEV .EQ 3
|
||||
S.NODE.T.LNK .EQ 4
|
||||
S.NODE.T.DSOCK .EQ 5
|
||||
S.NODE.T.SSOCK .EQ 6
|
||||
S.NODE.T.FIFO .EQ 7
|
||||
*--------------------------------------
|
||||
S.FILE.REG.REF .EQ 2
|
||||
S.FILE.REG.IOBUF .EQ 3
|
||||
S.NODE.REG.REF .EQ 2
|
||||
S.NODE.REG.IOBUF .EQ 3
|
||||
*
|
||||
S.FILE.REG .EQ 4
|
||||
S.NODE.REG .EQ 4
|
||||
*--------------------------------------
|
||||
S.FILE.DIR.REF .EQ 2
|
||||
S.FILE.DIR.IOBUF .EQ 3
|
||||
S.FILE.DIR.EL .EQ 4
|
||||
S.FILE.DIR.EPB .EQ 5
|
||||
S.FILE.DIR.FC .EQ 6 word
|
||||
S.NODE.DIR.REF .EQ 2
|
||||
S.NODE.DIR.IOBUF .EQ 3
|
||||
S.NODE.DIR.EL .EQ 4
|
||||
S.NODE.DIR.EPB .EQ 5
|
||||
S.NODE.DIR.FC .EQ 6 word
|
||||
*
|
||||
S.FILE.DIR .EQ 8
|
||||
S.NODE.DIR .EQ 8
|
||||
*--------------------------------------
|
||||
S.FILE.DEV
|
||||
*--------------------------------------
|
||||
* S.FILE.LNK
|
||||
*--------------------------------------
|
||||
S.FILE.SOCK.SO .EQ 2
|
||||
S.FILE.SOCK.SO.DEBUG .EQ $01
|
||||
S.FILE.SOCK.SO.ACCEPTCONN .EQ $02
|
||||
S.FILE.SOCK.SO.REUSEADDR .EQ $04
|
||||
S.FILE.SOCK.SO.KEEPALIVE .EQ $08
|
||||
S.FILE.SOCK.SO.DONTROUTE .EQ $10
|
||||
S.FILE.SOCK.SO.BROADCAST .EQ $20
|
||||
S.FILE.SOCK.SO.USELOOPBACK .EQ $40
|
||||
S.FILE.SOCK.SO.LINGER .EQ $80
|
||||
|
||||
S.FILE.SOCK.S .EQ 3
|
||||
S.FILE.SOCK.S.CLOSED .EQ 0
|
||||
S.FILE.SOCK.S.LISTEN .EQ 1
|
||||
S.FILE.SOCK.S.SYNSENT .EQ 2
|
||||
S.FILE.SOCK.S.SYNRCVD .EQ 3
|
||||
S.FILE.SOCK.S.ESTBLSH .EQ 4
|
||||
S.FILE.SOCK.S.CLWAIT .EQ 5
|
||||
S.FILE.SOCK.S.LASTACK .EQ 6
|
||||
S.FILE.SOCK.S.FINWT1 .EQ 7
|
||||
S.FILE.SOCK.S.FINWT2 .EQ 8
|
||||
S.FILE.SOCK.S.CLOSING .EQ 9
|
||||
S.FILE.SOCK.S.TIMEWT .EQ 10
|
||||
|
||||
S.FILE.SOCK.SRC.ADDR .EQ 4
|
||||
S.FILE.SOCK.SRC.PORT .EQ 8
|
||||
S.FILE.SOCK.DST.ADDR .EQ 10
|
||||
S.FILE.SOCK.DST.PORT .EQ 14
|
||||
* Listen type Queue
|
||||
S.FILE.SOCK.LQ.HEAD .EQ 16
|
||||
S.FILE.SOCK.LQ.TAIL .EQ 17
|
||||
S.FILE.SOCK.LQ .EQ 18
|
||||
S.FILE.SOCK.LQ.MAX .EQ 14 14 hSocket
|
||||
* Datagram type Queue
|
||||
S.FILE.SOCK.DQ.HEAD .EQ 16
|
||||
S.FILE.SOCK.DQ.TAIL .EQ 17
|
||||
S.FILE.SOCK.DQ .EQ 18
|
||||
S.FILE.SOCK.DQ.MAX .EQ 14 14 hMem (frames)
|
||||
* Stream type Queue
|
||||
S.FILE.SOCK.SQ.hInMem .EQ 16
|
||||
S.FILE.SOCK.SQ.hOutMem .EQ 17
|
||||
S.FILE.SOCK.SQ.SIZE .EQ 18
|
||||
S.FILE.SOCK.SQ.HEAD .EQ 20
|
||||
S.FILE.SOCK.SQ.TAIL .EQ 22
|
||||
S.FILE.SOCK.SQ.SEQNUM .EQ 24
|
||||
S.FILE.SOCK.SQ.ACKNUM .EQ 28
|
||||
S.NODE.DEV.ID .EQ 2
|
||||
*
|
||||
S.FILE.SOCK .EQ 32
|
||||
S.NODE.DEV .EQ 3
|
||||
*--------------------------------------
|
||||
S.FILE.FIFO.hMem .EQ 2
|
||||
S.FILE.FIFO.InPtr .EQ 3
|
||||
S.FILE.FIFO.OutPtr .EQ 4
|
||||
* S.NODE.LNK
|
||||
*--------------------------------------
|
||||
S.NODE.FIFO.S .EQ 2
|
||||
S.NODE.FIFO.S.Opened .EQ 1
|
||||
S.NODE.FIFO.S.Closed .EQ 2
|
||||
S.NODE.FIFO.hMem .EQ 3
|
||||
S.NODE.FIFO.Tail .EQ 4
|
||||
S.NODE.FIFO.Head .EQ 5
|
||||
*
|
||||
S.FILE.FIFO .EQ 5
|
||||
*--------------------------------------
|
||||
* OLD API: S.DIR for OpenDir,ReadDir,CloseDir
|
||||
*--------------------------------------
|
||||
S.DIR.HANDLER .EQ 0
|
||||
S.DIR.F .EQ 1
|
||||
S.DIR.F.NOMORE .EQ $80
|
||||
S.DIR.PRODOS.REF .EQ 2
|
||||
S.DIR.PRODOS.IOBUF .EQ 3
|
||||
S.DIR.PRODOS.EL .EQ 4
|
||||
S.DIR.PRODOS.EPB .EQ 5
|
||||
S.DIR.PRODOS.FC .EQ 6
|
||||
*
|
||||
S.DIR.PRODOS .EQ 8
|
||||
* no S.DIR
|
||||
*--------------------------------------
|
||||
S.PFT.PATH .EQ 0
|
||||
S.PFT.HANDLER .EQ 23
|
||||
S.PFT.DATA .EQ 24 8 bytes OPAQUE data for handler
|
||||
*
|
||||
S.PFT .EQ 32
|
||||
S.NODE.FIFO .EQ 5
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE /A2OSX.DEV/INC/A2OSX.I
|
||||
|
56
INC/SOCKET.I.txt
Normal file
56
INC/SOCKET.I.txt
Normal file
@ -0,0 +1,56 @@
|
||||
PR#3
|
||||
PREFIX /A2OSX.SRC
|
||||
NEW
|
||||
INC 1
|
||||
AUTO 6
|
||||
*--------------------------------------
|
||||
S.NODE.SOCK.SO .EQ 2
|
||||
S.NODE.SOCK.SO.DEBUG .EQ $01
|
||||
S.NODE.SOCK.SO.ACCEPTCONN .EQ $02
|
||||
S.NODE.SOCK.SO.REUSEADDR .EQ $04
|
||||
S.NODE.SOCK.SO.KEEPALIVE .EQ $08
|
||||
S.NODE.SOCK.SO.DONTROUTE .EQ $10
|
||||
S.NODE.SOCK.SO.BROADCAST .EQ $20
|
||||
S.NODE.SOCK.SO.USELOOPBACK .EQ $40
|
||||
S.NODE.SOCK.SO.LINGER .EQ $80
|
||||
|
||||
S.NODE.SOCK.S .EQ 3
|
||||
S.NODE.SOCK.S.CLOSED .EQ 0
|
||||
S.NODE.SOCK.S.LISTEN .EQ 1
|
||||
S.NODE.SOCK.S.SYNSENT .EQ 2
|
||||
S.NODE.SOCK.S.SYNRCVD .EQ 3
|
||||
S.NODE.SOCK.S.ESTBLSH .EQ 4
|
||||
S.NODE.SOCK.S.CLWAIT .EQ 5
|
||||
S.NODE.SOCK.S.LASTACK .EQ 6
|
||||
S.NODE.SOCK.S.FINWT1 .EQ 7
|
||||
S.NODE.SOCK.S.FINWT2 .EQ 8
|
||||
S.NODE.SOCK.S.CLOSING .EQ 9
|
||||
S.NODE.SOCK.S.TIMEWT .EQ 10
|
||||
|
||||
S.NODE.SOCK.SRC.ADDR .EQ 4
|
||||
S.NODE.SOCK.SRC.PORT .EQ 8
|
||||
S.NODE.SOCK.DST.ADDR .EQ 10
|
||||
S.NODE.SOCK.DST.PORT .EQ 14
|
||||
* Listen type Queue
|
||||
S.NODE.SOCK.LQ.HEAD .EQ 16
|
||||
S.NODE.SOCK.LQ.TAIL .EQ 17
|
||||
S.NODE.SOCK.LQ .EQ 18
|
||||
S.NODE.SOCK.LQ.MAX .EQ 14 14 hSocket
|
||||
* Datagram type Queue
|
||||
S.NODE.SOCK.DQ.HEAD .EQ 16
|
||||
S.NODE.SOCK.DQ.TAIL .EQ 17
|
||||
S.NODE.SOCK.DQ .EQ 18
|
||||
S.NODE.SOCK.DQ.MAX .EQ 14 14 hMem (frames)
|
||||
* Stream type Queue
|
||||
S.NODE.SOCK.SQ.hInMem .EQ 16
|
||||
S.NODE.SOCK.SQ.hOutMem .EQ 17
|
||||
S.NODE.SOCK.SQ.SIZE .EQ 18
|
||||
S.NODE.SOCK.SQ.HEAD .EQ 20
|
||||
S.NODE.SOCK.SQ.TAIL .EQ 22
|
||||
S.NODE.SOCK.SQ.SEQNUM .EQ 24
|
||||
S.NODE.SOCK.SQ.ACKNUM .EQ 28
|
||||
*
|
||||
S.NODE.SOCK .EQ 32
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE /A2OSX.DEV/INC/SOCKET.I
|
54
LIB/LIBMATH.S.txt
Normal file
54
LIB/LIBMATH.S.txt
Normal file
@ -0,0 +1,54 @@
|
||||
PR#3
|
||||
PREFIX /A2OSX.SRC
|
||||
NEW
|
||||
INC 1
|
||||
AUTO 6
|
||||
.LIST OFF
|
||||
.OP 65C02
|
||||
.OR $2000
|
||||
.TF /A2OSX.BOOT/LIB/LIBMATH.O
|
||||
*--------------------------------------
|
||||
.INB /A2OSX.DEV/INC/MACROS.I
|
||||
.INB /A2OSX.DEV/INC/A2OSX.I
|
||||
.INB /A2OSX.DEV/INC/APPLESOFT.I
|
||||
* .INB /A2OSX.DEV/INC/LIBMATH.I
|
||||
*--------------------------------------
|
||||
ZPPtr1 .EQ ZPLIB
|
||||
*--------------------------------------
|
||||
* File Header (16 Bytes)
|
||||
*--------------------------------------
|
||||
CS.START cld
|
||||
jmp (.1,x)
|
||||
.DA #$61 6502,Level 1 (65c02)
|
||||
.DA #1 BIN Layout Version 1
|
||||
.DA 0
|
||||
.DA CS.END-CS.START
|
||||
.DA 0
|
||||
.DA 0
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
* Relocation Table
|
||||
*--------------------------------------
|
||||
.1 .DA LIB.LOAD
|
||||
.DA LIB.UNLOAD
|
||||
.DA COS
|
||||
.DA SIN
|
||||
.DA TAN
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
COS
|
||||
*--------------------------------------
|
||||
SIN
|
||||
*--------------------------------------
|
||||
TAN
|
||||
*--------------------------------------
|
||||
LIB.LOAD
|
||||
LIB.UNLOAD clc
|
||||
rts
|
||||
|
||||
*--------------------------------------
|
||||
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE LIB/LIBMATH.S
|
||||
ASM
|
615
LIB/LIBPAK.S.txt
Normal file
615
LIB/LIBPAK.S.txt
Normal file
@ -0,0 +1,615 @@
|
||||
PR#3
|
||||
PREFIX /A2OSX.SRC
|
||||
NEW
|
||||
INC 1
|
||||
AUTO 6
|
||||
.LIST OFF
|
||||
.OP 65C02
|
||||
.OR $2000
|
||||
.TF /A2OSX.BOOT/LIB/LIBPAK.O
|
||||
*--------------------------------------
|
||||
.INB /A2OSX.DEV/INC/MACROS.I
|
||||
.INB /A2OSX.DEV/INC/A2OSX.I
|
||||
*--------------------------------------
|
||||
S.Pak.SrcPtr .EQ ZPLIB
|
||||
S.Pak.SrcBlPtr .EQ ZPLIB+2
|
||||
S.Pak.SrcBlPtrT .EQ ZPLIB+4
|
||||
S.Pak.DstPtr .EQ ZPLIB+6
|
||||
*--------------------------------------
|
||||
* File Header (16 Bytes)
|
||||
*--------------------------------------
|
||||
CS.START cld
|
||||
jmp (.1,x)
|
||||
.DA #$61 6502,Level 1 (65c02)
|
||||
.DA #1 BIN Layout Version 1
|
||||
.DA 0
|
||||
.DA CS.END-CS.START
|
||||
.DA 0
|
||||
.DA 0
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
* Relocation Table
|
||||
*--------------------------------------
|
||||
.1 .DA LIB.LOAD
|
||||
.DA LIB.UNLOAD
|
||||
.DA Pak
|
||||
.DA Unpak
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
LIB.LOAD
|
||||
LIB.UNLOAD clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
* UNPACK code as short as possible
|
||||
* For Self Extract
|
||||
*--------------------------------------
|
||||
* File Header :
|
||||
* SFX :
|
||||
* - BIN must begin with CLD (QCODE)
|
||||
* - BIN must be relocatable
|
||||
* - BIN must overwrite itself
|
||||
* (well, best way is moving CODE to $200)
|
||||
*--------------------------------------
|
||||
* Shunk Header :
|
||||
* WORD : !Target Length
|
||||
* USED TO STOP UNPACK
|
||||
* !!!NO EOF TOKEN!!!
|
||||
* Short4 : [0..15]
|
||||
* Short3 : [0..7]
|
||||
*--------------------------------------
|
||||
S.PAK.LEN .EQ 0
|
||||
S.PAK.SHORT4 .EQ 2
|
||||
S.PAK.SHORT3 .EQ 18
|
||||
S.PAK .EQ 26
|
||||
*--------------------------------------
|
||||
* BITSTREAM :
|
||||
* 0 = STORE :
|
||||
* 00 : 1 byte follow (10 bits)
|
||||
* 01 = 2 + n (4 bits count)
|
||||
*--------------
|
||||
* 1 = CMD :
|
||||
*---SHORT4 --- (3)+4=7 bits --------
|
||||
* 100 : SHORT4
|
||||
* xxxx = index in Short4 Table
|
||||
*---SHORT3 --- (3)+3=6 bits --------
|
||||
* 101 : SHORT3
|
||||
* xxx = index in Short3 Table
|
||||
*--- BACKLINK : (3)+8+5=16 bits ----
|
||||
* 110 : BackLink
|
||||
* 9 bits : Offset (LO8,HI1)
|
||||
* 4 bits : 3 + n (4 bits count) (18 max)
|
||||
*--- REP : (3)+1, (3)+1+4 =4/8 bits ----
|
||||
* 111 : REP
|
||||
* 0 : repeat last byte
|
||||
* 1 : repeat 2 + n (4 bits count)
|
||||
*--------------------------------------
|
||||
* In :
|
||||
* PULLW = Src PTR
|
||||
* PULLW = Src LEN
|
||||
* PULLW = Dst PTR Compressed Buffer
|
||||
*--------------------------------------
|
||||
PIPELEN .EQ 18
|
||||
STATS.SIZE .EQ 0
|
||||
STATS.BL .EQ 2
|
||||
STATS.REP .EQ 4
|
||||
STATS.S3 .EQ 6
|
||||
STATS.S4 .EQ 8
|
||||
*--------------------------------------
|
||||
S.Pak >PULLYA
|
||||
>STYA S.Pak.Src Init for pass #1
|
||||
>STYA S.Pak.SrcPtr
|
||||
>PULLA Get Src Len LO
|
||||
eor #$ff
|
||||
sta S.Pak.SrcCnt
|
||||
sta S.Pak.Cnt Init for pass #1
|
||||
tax
|
||||
|
||||
>PULLA Get Src Len HI
|
||||
eor #$ff
|
||||
sta S.Pak.SrcCnt+1
|
||||
sta S.Pak.Cnt+1 Init for pass #1
|
||||
tay
|
||||
|
||||
>PULLW S.Pak.DstPtr
|
||||
txa
|
||||
jsr S.Pak.PutByte
|
||||
tya
|
||||
jsr S.Pak.PutByte
|
||||
|
||||
ldx #9
|
||||
.1 stz S.Pak.Stat.Size,x Reset Stats
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
* PASS #1 : Count occurence for each value...
|
||||
|
||||
S.Pak.1 ldx #0
|
||||
.1 stz S.Pak.CntL,x
|
||||
stz S.Pak.CntH,x
|
||||
inx
|
||||
bne .1
|
||||
|
||||
ldy #0
|
||||
|
||||
.2 inc S.Pak.Cnt
|
||||
bne .3
|
||||
inc S.Pak.Cnt+1
|
||||
beq .5
|
||||
|
||||
.3 lda (S.Pak.SrcPtr),y
|
||||
tax
|
||||
inc S.Pak.CntL,x
|
||||
bne .4
|
||||
inc S.Pak.CntH,x
|
||||
.4 iny
|
||||
bne .2
|
||||
inc S.Pak.SrcPtr+1
|
||||
bra .2
|
||||
|
||||
* ...Search for Top 24
|
||||
.5 ldy #23
|
||||
|
||||
.6 stz S.Pak.Cnt Init best score to 0
|
||||
stz S.Pak.Cnt+1
|
||||
|
||||
stz S.Pak.Byte
|
||||
ldx #0
|
||||
|
||||
.7 lda S.Pak.CntL,x is it better at X
|
||||
cmp S.Pak.Cnt
|
||||
lda S.Pak.CntH,x
|
||||
sbc S.Pak.Cnt+1
|
||||
bcs .8 not better
|
||||
|
||||
stx S.Pak.Byte
|
||||
lda S.Pak.CntL,x
|
||||
sta S.Pak.Cnt
|
||||
lda S.Pak.CntH,x
|
||||
sta S.Pak.Cnt+1
|
||||
|
||||
.8 inx
|
||||
bne .7
|
||||
|
||||
lda S.Pak.Byte
|
||||
sta S.Pak.Short,y
|
||||
stz S.Pak.CntL,x Discard this entry
|
||||
stz S.Pak.CntH,x
|
||||
dey
|
||||
bpl .6
|
||||
|
||||
ldx #15
|
||||
|
||||
.9 lda S.Pak.Short4,x Store SHORT4 in reverse order
|
||||
jsr S.Pak.PutByte
|
||||
dex
|
||||
bpl .9
|
||||
|
||||
ldx #7
|
||||
|
||||
.10 lda S.Pak.Short3,x Store SHORT3 in reverse order
|
||||
jsr S.Pak.PutByte
|
||||
dex
|
||||
bpl .10
|
||||
|
||||
>LDYAI S.PAK Total Header Size
|
||||
>STYA S.Pak.Stat.Size
|
||||
* PASS #2 :
|
||||
S.Pak.2 >LDYA S.Pak.Src Init for pass #2
|
||||
>STYA S.Pak.SrcPtr
|
||||
>STYA S.Pak.SrcBlPtr
|
||||
|
||||
>LDYA S.Pak.SrcCnt
|
||||
>STYA S.Pak.Cnt
|
||||
|
||||
lda #8
|
||||
sta S.Pak.PutBit+1 Initialize properly for first "PutBit" Call
|
||||
stz S.Pak.Byte
|
||||
|
||||
stz S.Pak.PipeLen
|
||||
|
||||
S.Pak.2.LOOP ldx S.Pak.PipeLen Always fill Bytes in the PIPE until full
|
||||
|
||||
.1 jsr S.Pak.GetByte Load PIPE....
|
||||
bcs .2 end of Buffer ?
|
||||
sta S.Pak.Pipe,x
|
||||
inx
|
||||
cpx #PIPELEN PIPE Full ?
|
||||
bne .1
|
||||
clc
|
||||
|
||||
.2 stx S.Pak.PipeLen
|
||||
|
||||
txa PIPE empty ....exit
|
||||
beq .99
|
||||
|
||||
* try finding REPeating same bytes.....
|
||||
S.Pak.2.REP dex
|
||||
beq S.Pak.2.SHORT Only one char in PIPE...
|
||||
|
||||
ldx #0
|
||||
|
||||
.1 lda S.Pak.Pipe,x
|
||||
cmp S.Pak.Pipe+1,x
|
||||
bne .2
|
||||
inx
|
||||
cpx S.Pak.PipeLen
|
||||
bne .1
|
||||
|
||||
.2 dex if one char.....no REP
|
||||
beq .S.Pak.2.BL
|
||||
dex if 2, -> REP ONE (not 2)
|
||||
phx REP 1 + 0 or more....save REP count for later....
|
||||
|
||||
jsr S.Pak.2.STORE1 a = byte to store
|
||||
|
||||
lda #%11100000
|
||||
plx
|
||||
phx
|
||||
beq .3
|
||||
ora #%00010000
|
||||
ldy #4
|
||||
jsr S.Pak.PutYBits
|
||||
txa
|
||||
beq .4 if not REP 2 or more no extra count
|
||||
ldy #4
|
||||
jsr S.Pak.PutYBits
|
||||
|
||||
.4 pla
|
||||
clc
|
||||
adc #2
|
||||
tay
|
||||
jsr S.Pak.StripPipe Remove REP bytes from PIPE
|
||||
|
||||
ldy #STATS.REP
|
||||
jsr S.Pak.UpdateStats
|
||||
jmp S.Pak.2.LOOP
|
||||
S.Pak.2.BL
|
||||
* Try finding best matching BackLink between SrcBlPtr and SrcPtr (max 512)
|
||||
.4 lda S.Pak.SrcPtr
|
||||
sec
|
||||
sbc S.Pak.PipeLen
|
||||
sta S.Pak.Limit setup Limit to SrcPtr-PIPE
|
||||
lda S.Pak.SrcPtr+1
|
||||
sbc #0
|
||||
sta S.Pak.Limit+1
|
||||
|
||||
.40 lda S.Pak.SrcBlPtr
|
||||
sta S.Pak.SrcBlPtrT
|
||||
lda S.Pak.SrcBlPtr+1
|
||||
sta S.Pak.SrcBlPtrT+1
|
||||
|
||||
.5 txa Get PIPE Len
|
||||
|
||||
clc make sure SrcBlPtrT+PIPE < Limit
|
||||
adc S.Pak.SrcBlPtrT
|
||||
tay
|
||||
lda S.Pak.SrcBlPtrT+1
|
||||
adc #0
|
||||
cpy S.Pak.Limit
|
||||
sbc S.Pak.Limit+1
|
||||
bcc .10 not enough room
|
||||
|
||||
txa
|
||||
dec
|
||||
tay
|
||||
.8 lda (S.Pak.SrcBlPtrT),y
|
||||
cmp S.Pak.Pipe,y
|
||||
bne .9
|
||||
dey
|
||||
bpl .8
|
||||
|
||||
* Found a BL at S.Pak.SrcBlPtrT, Store it and remove X bytes from PIPE
|
||||
phx save BL length
|
||||
|
||||
lda #%1100000
|
||||
ldy #3
|
||||
jsr S.Pak.PutYBits
|
||||
|
||||
lda S.Pak.Limit
|
||||
sec
|
||||
sbc S.Pak.SrcBlPtrT
|
||||
php save C
|
||||
|
||||
ldy #8
|
||||
jsr S.Pak.PutYBits
|
||||
|
||||
plp
|
||||
lda S.Pak.Limit+1
|
||||
sec
|
||||
sbc S.Pak.SrcBlPtrT+1
|
||||
|
||||
jsr S.Pak.PutBit
|
||||
|
||||
ply Get back BL len
|
||||
phy
|
||||
|
||||
jsr S.Pak.StripPipe Remove LEN bytes from PIPE
|
||||
|
||||
pla Get back BL len
|
||||
sec
|
||||
sbc #3 Adjust Range..3-18 to 0->15
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
ldy #4 store 4 bits len
|
||||
jsr S.Pak.PutYBits
|
||||
ldy #STATS.BL
|
||||
jsr S.Pak.UpdateStats
|
||||
jmp S.Pak.2.LOOP
|
||||
|
||||
* No match...try starting at next byte
|
||||
.9 inc S.Pak.SrcBlPtrT
|
||||
bne .5
|
||||
inc S.Pak.SrcBlPtrT+1
|
||||
bra .5
|
||||
.10 dex reduce PIPE
|
||||
cpx #2 2 bytes remaining? no need to BL, a BL is 16bits wide.....
|
||||
bne .40 and start over from BLPtr
|
||||
|
||||
* NO Bl Found, STORE
|
||||
S.Pak.STORE lda S.Pak.Pipe
|
||||
jsr S.Pak.2.STORE1
|
||||
ldy #1
|
||||
jsr S.Pak.StripPipe
|
||||
jmp S.Pak.2.LOOP
|
||||
*--------------------------------------
|
||||
S.Pak.2.STORE1
|
||||
rts
|
||||
*--------------------------------------
|
||||
S.Pak.GetByte inc S.UnPak.Cnt
|
||||
bne .1
|
||||
inc S.UnPak.Cnt+1
|
||||
.1 beq .9
|
||||
lda (S.Pak.SrcPtr)
|
||||
pha
|
||||
inc S.Pak.SrcPtr
|
||||
bne .2
|
||||
inc S.Pak.SrcPtr+1
|
||||
.2 clc
|
||||
rts
|
||||
.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
S.Pak.PutYBits asl
|
||||
jsr S.Pak.PutBit
|
||||
dey
|
||||
bne S.Pak.PutYBits
|
||||
rts
|
||||
*--------------------------------------
|
||||
* S.Pak.PutBit (bit in C)
|
||||
*--------------------------------------
|
||||
S.Pak.PutBit ldx #$ff
|
||||
pha
|
||||
bne .1
|
||||
lda S.Pak.Byte
|
||||
jsr S.Pak.PutByte
|
||||
stz S.Pak.Byte
|
||||
ldx #8
|
||||
|
||||
.1 dex
|
||||
stx S.Pak.PutBit+1
|
||||
bcc .8 Nothing to "light up"
|
||||
|
||||
lda S.Pak.Byte
|
||||
lda S.Pak.BitMask,x
|
||||
sta S.Pak.Byte
|
||||
.8 pla
|
||||
rts
|
||||
*--------------------------------------
|
||||
S.Pak.PutByte sta (S.UnPak.DstPtr)
|
||||
inc S.UnPak.DstPtr
|
||||
bne .1
|
||||
inc S.UnPak.DstPtr+1
|
||||
|
||||
.1 inc S.Pak.Stat.Size
|
||||
bne .2
|
||||
inc S.Pak.Stat.Size+1
|
||||
.2
|
||||
rts
|
||||
*--------------------------------------
|
||||
* Y = count to remove from PIPE
|
||||
*--------------------------------------
|
||||
S.Pak.StripPipe ldx S.Pak.PipeLen
|
||||
beq .9
|
||||
|
||||
ldx #0
|
||||
|
||||
.1 lda S.Pak.Pipe+1,x
|
||||
sta S.Pak.Pipe,x
|
||||
inx
|
||||
cpx S.Pak.PipeLen
|
||||
bne .1
|
||||
dec S.Pak.PipeLen
|
||||
dey
|
||||
bne S.Pak.StripPipe
|
||||
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
S.Pak.UpdateStats
|
||||
inc S.Pak.Stat.Size,y
|
||||
bne .8
|
||||
inc S.Pak.Stat.Size+1,y
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
S.Pak.BitMask .HS 0102040810204080
|
||||
S.Pak.Src .BS 2
|
||||
S.Pak.SrcCnt .BS 2
|
||||
S.Pak.Cnt .BS 2
|
||||
S.Pak.CntL .BS 256
|
||||
S.Pak.CntH .BS 256
|
||||
S.Pak.Short4 .BS 16
|
||||
S.Pak.Short3 .BS 8
|
||||
S.Pak.Byte .BS 1
|
||||
S.Pak.Limit .BS 2
|
||||
S.Pak.PipeLen .BS 1
|
||||
S.Pak.Pipe .BS 18
|
||||
*--------------------------------------
|
||||
S.Pak.Stat.Size .BS 2
|
||||
S.Pak.Stat.BL .BS 2
|
||||
S.Pak.Stat.REP .BS 2
|
||||
S.Pak.Stat.S3 .BS 2
|
||||
S.Pak.Stat.S4 .BS 2
|
||||
*--------------------------------------
|
||||
* S.UnPak
|
||||
* In :
|
||||
* PULLW = Src PTR Compressed Buffer
|
||||
* PULLW = Dst PTR
|
||||
*--------------------------------------
|
||||
S.UnPak.SrcPtr .EQ ZPLIB
|
||||
S.UnPak.DstPtr .EQ ZPLIB+2
|
||||
S.UnPak.ShrtTbl .EQ ZPLIB+4
|
||||
S.UnPak.Cnt .EQ ZPLIB+6
|
||||
*--------------------------------------
|
||||
S.UnPak >PULLW S.UnPak.SrcPtr
|
||||
>PULLA Get Dst PTR LO
|
||||
sec
|
||||
sbc #1
|
||||
sta S.UnPak.DstPtr
|
||||
>PULLA Get Dst PTR HI
|
||||
sbc #0
|
||||
sta S.UnPak.DstPtr+1 setup Dst PTR-1
|
||||
|
||||
jsr S.UnPak.GetByte Get !LEN for counting up to $0000
|
||||
sta S.UnPak.Cnt
|
||||
|
||||
jsr S.UnPak.GetByte
|
||||
sta S.UnPak.Cnt+1
|
||||
|
||||
>LDYA S.UnPak.SrcPtr Get PTR to Short Table.....
|
||||
>STYA S.UnPak.ShrtTbl and save it for SHORTx
|
||||
|
||||
lda #8
|
||||
sta S.UnPak.GetBit+1 Initialize properly for first "GetBit" Call
|
||||
|
||||
.1 inc S.UnPak.Cnt
|
||||
bne .2
|
||||
inc S.UnPak.Cnt+1
|
||||
beq .99
|
||||
|
||||
.2 jsr S.UnPak.GetBit
|
||||
bcs .4 CMD....
|
||||
*---- STORE
|
||||
jsr S.UnPak.GetBit
|
||||
ldx #1
|
||||
bcc .3 if CC one byte
|
||||
jsr S.UnPak.Get4Bits CC
|
||||
adc #2 range is 2->17
|
||||
tax
|
||||
|
||||
.3 jsr S.UnPak.Get8Bits
|
||||
jsr S.UnPak.PutByte
|
||||
dex
|
||||
bne .3
|
||||
bra .1
|
||||
.99 rts
|
||||
*---- CMD
|
||||
.4 jsr S.UnPak.GetBit
|
||||
bcs .6 BACKLINK or REP...
|
||||
*---- CMD : SHORT
|
||||
lda #0
|
||||
ldy #4
|
||||
|
||||
jsr S.UnPak.GetBit if CS short3
|
||||
rol make offset 00000001
|
||||
asl ....00000010
|
||||
beq .5
|
||||
|
||||
dey if short3, only 3 bits
|
||||
|
||||
.5 jsr S.UnPak.GetBit
|
||||
rol
|
||||
dey
|
||||
bne .5
|
||||
|
||||
tay if s3, offset is 00010xxx
|
||||
lda (S.UnPak.ShrtTbl),y if s4, offset is 0000xxxx
|
||||
jsr S.UnPak.PutByte
|
||||
bra .1
|
||||
*---- CMD : BACKLINK or REP
|
||||
.6 jsr S.UnPak.GetBit
|
||||
bcs .8 if CS -> REP
|
||||
*---- CMD : BACKLINK
|
||||
jsr S.UnPak.Get8Bits get Offset LO, (CC)
|
||||
eor #$ff !offset LO
|
||||
adc S.UnPak.DstPtr equiv. SUB offset
|
||||
sta .7+1 PTR to Backlink LO
|
||||
lda S.UnPak.DstPtr+1
|
||||
bcs .61 if ADC sets C, no need to dec HI
|
||||
dec
|
||||
.61 jsr S.UnPak.GetBit get Offset HI in C
|
||||
bcc .62
|
||||
dec
|
||||
.62 sta .7+2 PTR to Backlink HI
|
||||
|
||||
jsr S.UnPak.Get4Bits CC
|
||||
adc #3 Backlink are ate least 3 bytes...
|
||||
tax
|
||||
ldy #0
|
||||
|
||||
.7 lda $ffff,y Self Modified code : PTR to Backlink
|
||||
jsr S.UnPak.PutByte
|
||||
iny
|
||||
dex
|
||||
bne .7
|
||||
beq .1
|
||||
*---- CMD : REP
|
||||
.8 jsr S.UnPak.GetBit
|
||||
ldx #1
|
||||
bcc .9 REP 1
|
||||
|
||||
jsr S.UnPak.Get4Bits REP xxxx, CC
|
||||
adc #2 range is 2->17
|
||||
tax
|
||||
|
||||
.9 lda (S.UnPak.DstPtr) Get Last Byte
|
||||
jsr S.UnPak.PutByte
|
||||
dex
|
||||
bne .9
|
||||
beq .1
|
||||
*--------------------------------------
|
||||
S.UnPak.Get8Bits
|
||||
ldy #8
|
||||
.HS 2C bit abs
|
||||
S.UnPak.Get4Bits
|
||||
ldy #4
|
||||
lda #0 make sure to reset A before reading less than 8 bits only
|
||||
.1 jsr S.UnPak.GetBit and to exit with CC if even if 8 bits read
|
||||
rol
|
||||
dey
|
||||
bne .1
|
||||
rts always CC
|
||||
*--------------------------------------
|
||||
S.UnPak.GetBit ldx #$ff Self Modified code
|
||||
bne .1
|
||||
jsr S.UnPak.NxtByte
|
||||
|
||||
ldx #8
|
||||
|
||||
.1 dex
|
||||
stx S.UnPak.GetBit+1
|
||||
|
||||
pha Don't trash A
|
||||
lda (S.UnPak.SrcPtr)
|
||||
and S.UnPak.BitMask,x
|
||||
cmp #1 if 0:CC, i>0 CS
|
||||
|
||||
pla
|
||||
rts Bit is in C
|
||||
*--------------------------------------
|
||||
S.UnPak.GetByte lda (S.UnPak.SrcPtr)
|
||||
S.UnPak.NxtByte inc S.UnPak.SrcPtr
|
||||
bne .8
|
||||
inc S.UnPak.SrcPtr+1
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
S.UnPak.PutByte inc S.UnPak.DstPtr
|
||||
bne .8
|
||||
inc S.UnPak.DstPtr+1
|
||||
.8 sta (S.UnPak.DstPtr)
|
||||
rts
|
||||
*--------------------------------------
|
||||
S.UnPak.BitMask .HS 8040201008040201
|
||||
MAN
|
||||
SAVE LIB/LIBPAK.S
|
||||
ASM
|
231
SBIN/NFSD.S.txt
Normal file
231
SBIN/NFSD.S.txt
Normal file
@ -0,0 +1,231 @@
|
||||
PR#3
|
||||
PREFIX /A2OSX.SRC
|
||||
NEW
|
||||
INC 1
|
||||
AUTO 6
|
||||
.LIST OFF
|
||||
.OP 65C02
|
||||
.OR $2000
|
||||
.TF /A2OSX.BOOT/SBIN/NFSD
|
||||
*--------------------------------------
|
||||
.INB /A2OSX.DEV/INC/MACROS.I
|
||||
.INB /A2OSX.DEV/INC/A2OSX.I
|
||||
.INB /A2OSX.DEV/INC/LIBTCPIP.I
|
||||
*--------------------------------------
|
||||
TIMEOUT.MAX .EQ 30 30 sec.
|
||||
*--------------------------------------
|
||||
ZPIPCfgPtr .EQ ZPBIN
|
||||
ZPSktPtr .EQ ZPBIN+2
|
||||
*--------------------------------------
|
||||
* File Header (16 Bytes)
|
||||
*--------------------------------------
|
||||
CS.START cld
|
||||
jmp (.1,x)
|
||||
.DA #$61 6502,Level 1 (65c02)
|
||||
.DA #1 BIN Layout Version 1
|
||||
.DA 0
|
||||
.DA CS.END-CS.START Code Length To Relocate
|
||||
.DA DS.END-DS.START Data Segment to Allocate
|
||||
.DA 0
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
* Relocation Table
|
||||
*--------------------------------------
|
||||
.1 .DA CS.INIT
|
||||
.DA CS.RUN
|
||||
.DA CS.DOEVENT
|
||||
.DA CS.QUIT
|
||||
.DA CS.HOOK
|
||||
L.LIBTCPIP .DA LIBTCPIP
|
||||
L.Socket .DA Socket
|
||||
L.MSG.TCPWAIT .DA MSG.TCPWAIT
|
||||
L.MSG.INITOK .DA MSG.INITOK
|
||||
L.MSG.TCPIPERR .DA MSG.TCPIPERR
|
||||
L.MSG.SKTERR .DA MSG.SKTERR
|
||||
L.MSG.ABORT .DA MSG.ABORT
|
||||
L.MSG.INCOMING .DA MSG.INCOMING
|
||||
.DA 0
|
||||
*--------------------------------------
|
||||
CS.INIT >LDYA L.LIBTCPIP
|
||||
>SYSCALL LoadLibYA
|
||||
sta hLIBTCPIP
|
||||
|
||||
lda (pPs)
|
||||
ora #S.PS.F.EVENT Now accept events
|
||||
sta (pPs)
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.RUN jsr Init.Timeout
|
||||
|
||||
>LDYA L.MSG.TCPWAIT
|
||||
>SYSCALL PSTROutYA
|
||||
|
||||
.1 >LIBCALL hLIBTCPIP,LIBTCPIP.GET.IPCFG is TCPIP loaded ?
|
||||
bcs .99
|
||||
>STYA ZPIPCfgPtr
|
||||
|
||||
lda (ZPIPCfgPtr) Configured ?
|
||||
bmi CS.RUN.INIT
|
||||
|
||||
>SYSCALL Sleep
|
||||
jsr Wait.Timeout
|
||||
bcc .1
|
||||
|
||||
.99 >LDYA L.MSG.TCPIPERR
|
||||
>SYSCALL PSTROutYA
|
||||
lda #SYSMGR.ERRSYN
|
||||
sec
|
||||
rts
|
||||
|
||||
CS.RUN.INIT ldx #3
|
||||
ldy #S.IPCFG.IP+3
|
||||
.1 lda (ZPIPCfgPtr),y
|
||||
sta Socket.Src.Addr,x
|
||||
dey
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
>PUSHW L.Socket
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.NEW
|
||||
bcs .9
|
||||
txa
|
||||
ldy #hSocket
|
||||
sta (pData),y
|
||||
|
||||
>LDYA L.MSG.INITOK
|
||||
>SYSCALL PSTROutYA
|
||||
|
||||
.11 >SYSCALL Sleep
|
||||
ldy #bCTRLC
|
||||
lda (pData),y
|
||||
bmi .99
|
||||
bra .11
|
||||
|
||||
ldy #hSocket
|
||||
lda (pData),y
|
||||
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.ACCEPTA
|
||||
bcs .11
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.GETA
|
||||
>STYA ZPSktPtr
|
||||
|
||||
ldx #3
|
||||
ldy #S.SOCKET.DST.ADDR+3
|
||||
|
||||
.2 >PUSHB (ZPSktPtr),y
|
||||
dey
|
||||
dex
|
||||
bpl .2
|
||||
|
||||
>LDYA L.MSG.INCOMING
|
||||
>SYSCALL PSTROutYA
|
||||
bra .11
|
||||
|
||||
.9 >LDYA L.MSG.SKTERR
|
||||
>SYSCALL PSTROutYA
|
||||
lda #SYSMGR.ERRSYN
|
||||
sec
|
||||
rts
|
||||
|
||||
.99 >LDYA L.MSG.ABORT
|
||||
>SYSCALL PSTROutYA
|
||||
lda #0
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.DOEVENT lda (pEvent)
|
||||
bpl .1 is it a TIMER event?
|
||||
|
||||
asl One second ?
|
||||
bpl .9
|
||||
|
||||
ldy #TimeOut
|
||||
lda (pData),y
|
||||
beq .9
|
||||
|
||||
dec
|
||||
sta (pData),y
|
||||
sec do not discard TIMER event
|
||||
rts
|
||||
|
||||
.1 bit #S.EVT.F.KEY is it a KEY event?
|
||||
beq .9
|
||||
|
||||
ldy #S.EVT.DATAHI is it an O or SAPPLE key ?
|
||||
lda (pEvent),y
|
||||
bne .9
|
||||
|
||||
ldy #S.EVT.DATALO
|
||||
lda (pEvent),y
|
||||
cmp #$03 Ctrl-C
|
||||
bne .9
|
||||
|
||||
lda #$FF
|
||||
ldy #bCTRLC
|
||||
sta (pData),y
|
||||
clc
|
||||
rts
|
||||
|
||||
.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.QUIT ldy #hSocket
|
||||
lda (pData),y
|
||||
>LIBCALL hLIBTCPIP,LIBTCPIP.SKT.CLOSEA
|
||||
|
||||
lda hLIBTCPIP
|
||||
>SYSCALL UnloadLibA
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
CS.HOOK
|
||||
*--------------------------------------
|
||||
Init.Timeout ldy #TimeOut
|
||||
lda #TIMEOUT.MAX
|
||||
sta (pData),y
|
||||
rts
|
||||
*--------------------------------------
|
||||
Wait.TimeOut sec
|
||||
ldy #TimeOut
|
||||
lda (pData),y
|
||||
beq .9
|
||||
ldy #bCTRLC
|
||||
lda (pData),y
|
||||
bmi .9
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
CS.END
|
||||
*--------------------------------------
|
||||
LIBTCPIP >PSTR "libtcpip.o"
|
||||
MSG.TCPWAIT >PSTR "NFSD:Waiting for TCP/IP initializing...\n"
|
||||
MSG.INITOK >PSTR "NFSD:Init Ok, Listening.\n"
|
||||
MSG.TCPIPERR >PSTR "NFSD:TCP/IP Not initialized properly\n"
|
||||
MSG.SKTERR >PSTR "NFSD:Listen Error\n"
|
||||
MSG.ABORT >PSTR "NFSD:User Aborted\n"
|
||||
MSG.INCOMING >PSTR "NFSD:Incoming Connection From : %d.%d.%d.%d\n"
|
||||
hLIBTCPIP .BS 1
|
||||
*--------------------------------------
|
||||
Socket .DA #S.SOCKET.SOCK.DGRAM
|
||||
.DA #S.SOCKET.SO.ACCEPTCONN
|
||||
.DA #S.SOCKET.STATUS.LISTEN
|
||||
.BS 1
|
||||
Socket.Src.Addr .BS 4
|
||||
Socket.Src.Port .DA 2049
|
||||
Socket.Dst.Addr .BS 4
|
||||
Socket.Dst.Port .BS 2
|
||||
.BS 16
|
||||
*--------------------------------------
|
||||
.DUMMY
|
||||
.OR 0
|
||||
DS.START
|
||||
TimeOut .BS 1
|
||||
bCTRLC .BS 1
|
||||
hSocket .BS 1
|
||||
DS.END
|
||||
.ED
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE SBIN/NFSD.S
|
||||
ASM
|
@ -129,7 +129,7 @@ Cmd.Exec.EXT ldy #1
|
||||
>SYSCALL STAT
|
||||
bcs .99
|
||||
|
||||
lda STAT+S.STAT.PRODOS.TYPE
|
||||
lda STAT+S.STAT.P.TYPE
|
||||
cmp #$04 TXT File ?
|
||||
beq Cmd.Exec.EXT.TXT
|
||||
cmp #$06 BIN File ?
|
||||
@ -283,7 +283,7 @@ Cmd.Exec.CD1 stz UsrBuf256
|
||||
>SYSCALL STAT
|
||||
bcs .9
|
||||
|
||||
lda STAT+S.STAT.PRODOS.TYPE
|
||||
lda STAT+S.STAT.P.TYPE
|
||||
cmp #$0F Directory ?
|
||||
bne Cmd.Exec.ERRSYN
|
||||
|
||||
|
@ -31,7 +31,7 @@ K.LoadEXEYA.1 >PUSHWI KrnBuf256
|
||||
jsr K.STAT Look for AUXTYPE
|
||||
bcs .9
|
||||
|
||||
>LDYA KrnBuf256+S.STAT.PRODOS.AUXTYPE
|
||||
>LDYA KrnBuf256+S.STAT.P.AUXTYPE
|
||||
>STYA BIN.Relocate.Start
|
||||
|
||||
>PUSHYA Push AUXTYPE
|
||||
|
@ -86,14 +86,16 @@ K.SScanF jsr PullPtr1Ptr2Ptr3
|
||||
.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
K.SScanF.IncPtr1 dex
|
||||
K.SScanF.IncPtr1
|
||||
dex
|
||||
beq .1
|
||||
inc ZPQuickPtr1
|
||||
bne .1
|
||||
inc ZPQuickPtr1+1 never Zero
|
||||
.1 rts
|
||||
*--------------------------------------
|
||||
K.SScanF.IsDigit cmp #'0'
|
||||
K.SScanF.IsDigit
|
||||
cmp #'0'
|
||||
bcc .1
|
||||
cmp #'9'+1
|
||||
bcs .1
|
||||
@ -496,6 +498,22 @@ K.COutA phx
|
||||
plx
|
||||
rts
|
||||
*/--------------------------------------
|
||||
* #FPutCAY
|
||||
* Print A (char) to File
|
||||
* ##In:
|
||||
* A : char to print
|
||||
* Y = hFILE
|
||||
* none.
|
||||
* ##Out:
|
||||
* CC = success
|
||||
*\--------------------------------------
|
||||
K.FPutCAY sta K.PutC.Char
|
||||
sty K.PutC.Node
|
||||
tya
|
||||
bne K.PutCA.1
|
||||
K.PutCA.8 clc
|
||||
rts
|
||||
*/--------------------------------------
|
||||
* #PutCA
|
||||
* Print A (char) to StdOut
|
||||
* ##In:
|
||||
@ -504,10 +522,77 @@ K.COutA phx
|
||||
* ##Out:
|
||||
* CC = success
|
||||
*\--------------------------------------
|
||||
K.FPutCA
|
||||
|
||||
K.PutCA
|
||||
ldx #DEVMGR..WRITE
|
||||
K.PutCA sta K.PutC.Char
|
||||
ldy #S.PS.hStdOut
|
||||
lda (pPs),y
|
||||
beq K.PutCA.8 NUL
|
||||
|
||||
K.PutCA.1 sta K.PutC.Node
|
||||
jsr K.GetMemPtrA
|
||||
>STYA pNode
|
||||
|
||||
ldy #S.NODE.T
|
||||
lda (pNode),y
|
||||
asl
|
||||
tax
|
||||
jmp (K.PutCA.Jmp,x)
|
||||
*--------------------------------------
|
||||
K.PutCA.Jmp .DA K.PutCA.REG
|
||||
.DA K.PutCA.IOERR DIR
|
||||
.DA K.PutCA.CDEV
|
||||
.DA K.PutCA.IOERR BDEV
|
||||
.DA K.PutCA.IOERR LNK
|
||||
.DA K.PutCA.IOERR DSOCK
|
||||
.DA K.PutCA.SSOCK
|
||||
.DA K.PutCA.FIFO
|
||||
*--------------------------------------
|
||||
K.PutCA.REG lda K.PutC.Node
|
||||
ldy K.PutC.Char
|
||||
jmp K.FWriteAY
|
||||
*--------------------------------------
|
||||
K.PutCA.CDEV
|
||||
*--------------------------------------
|
||||
K.PutCA.SSOCK
|
||||
*--------------------------------------
|
||||
K.PutCA.FIFO ldy #S.NODE.FIFO.S
|
||||
lda (pNode),y
|
||||
beq .9 Remote PS did not opened yet the pipe
|
||||
cmp #S.NODE.FIFO.S.Closed
|
||||
beq .99 Remote PS closed the Pipe
|
||||
|
||||
ldy #S.NODE.FIFO.hMem
|
||||
lda (pNode),y
|
||||
jsr K.GetMemPtrA
|
||||
>STYA .1+2
|
||||
|
||||
ldy #S.NODE.FIFO.Head
|
||||
lda (pNode),y
|
||||
inc
|
||||
iny
|
||||
cmp (pNode),y
|
||||
beq .9 FIFO is full
|
||||
dey
|
||||
sta (pNode),y
|
||||
tay
|
||||
lda K.PutC.Char
|
||||
.1 sta $ffff,y
|
||||
clc
|
||||
rts
|
||||
|
||||
.9 lda #MLI.ERR.VOLFULL
|
||||
sec
|
||||
rts
|
||||
|
||||
.99 lda #MLI.ERR.EOF
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
K.PutCA.IOERR lda #MLI.ERR.IO
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
K.PutC.Char .BS 1
|
||||
K.PutC.Node .BS 1
|
||||
*--------------------------------------
|
||||
K.FGetC
|
||||
*--------------------------------------
|
||||
@ -559,7 +644,7 @@ PRINTDEC lda PADLEN any Len format ?
|
||||
clc
|
||||
.9 rts
|
||||
*--------------------------------------
|
||||
TYPES .AS "-pcbdls"
|
||||
TYPES .AS "-dbclssp"
|
||||
ACCESS .AS "rwxrwxrwx"
|
||||
SIGN .BS 1
|
||||
PADLEN .BS 1
|
||||
|
@ -10,7 +10,7 @@ AUTO 6
|
||||
* A = DevID
|
||||
* ##OUT:
|
||||
* CC = OK, CS = ERROR
|
||||
* Y,A = devslot
|
||||
* Y,A = DEVSLOT
|
||||
* note: X Unmodified
|
||||
*\--------------------------------------
|
||||
K.GetDevByIDA cmp DevMgr.LastDevID
|
||||
@ -41,7 +41,7 @@ K.GetDevByIDA cmp DevMgr.LastDevID
|
||||
* ##OUT:
|
||||
* CC = OK, CS = ERROR
|
||||
* X = DEVID
|
||||
* Y,A = pDev
|
||||
* Y,A = DEVSLOT
|
||||
*\--------------------------------------
|
||||
K.GetDevByNameYA
|
||||
>STYA ZPQuickPtr1
|
||||
@ -108,15 +108,33 @@ K.GetDevInfoA jsr K.GetDevByIDA
|
||||
* CC = OK, CS = ERROR
|
||||
* A = hFILE
|
||||
*\--------------------------------------
|
||||
K.MkNodYA jsr K.GetDevByNameYA
|
||||
K.MkNodYA jsr K.GetDevByNameYA Ptr1=NAME,Ptr2=DEVSLOT
|
||||
bcs .9
|
||||
|
||||
>PUSHWI S.FILE.DEV
|
||||
>PUSHWI S.NODE.DEV
|
||||
>PUSHBI S.MEM.F.INIT0
|
||||
jsr K.GetMem
|
||||
bcs
|
||||
bcs .9
|
||||
|
||||
|
||||
>STYA ZPQuickPtr3 Ptr3=S.NODE
|
||||
|
||||
ldy #S.DEV.DEVID
|
||||
lda (ZPQuickPtr2),y
|
||||
pha
|
||||
|
||||
iny #S.DEV.F
|
||||
lda (ZPQuickPtr2),y
|
||||
asl CS if Block device
|
||||
|
||||
ldy #S.NODE.T
|
||||
lda #S.NODE.T.CDEV
|
||||
adc #0 add CS if blok
|
||||
sta (ZPQuickPtr3),y
|
||||
|
||||
iny #S.NODE.DEV.ID
|
||||
pla
|
||||
sta (ZPQuickPtr3),y
|
||||
|
||||
clc
|
||||
.9 rts
|
||||
*/--------------------------------------
|
||||
@ -134,7 +152,7 @@ K.MKFIFO >PUSHWI 256
|
||||
|
||||
phx save FIFO buffer
|
||||
|
||||
>PUSHWI S.FILE.FIFO
|
||||
>PUSHWI S.NODE.FIFO
|
||||
>PUSHBI S.MEM.F.INIT0
|
||||
jsr K.GetMem
|
||||
|
||||
@ -142,11 +160,11 @@ K.MKFIFO >PUSHWI 256
|
||||
|
||||
>STYA ZPQuickPtr1
|
||||
|
||||
ldy #S.FILE.T
|
||||
lda #S.FILE.T.FIFO
|
||||
ldy #S.NODE.T
|
||||
lda #S.NODE.T.FIFO
|
||||
sta (ZPQuickPtr1),y
|
||||
|
||||
iny S.FILE.FIFO.hMem
|
||||
iny S.NODE.FIFO.hMem
|
||||
pla
|
||||
sta (ZPQuickPtr1),y
|
||||
txa
|
||||
|
@ -18,7 +18,7 @@ K.OpenDirYA jsr PFT.CheckPathYA
|
||||
>STYA ZPQuickPtr2
|
||||
>STYA MLICALL.PARAMS+1 For GETFILEINFO,MLIOPEN
|
||||
|
||||
>PUSHWI S.DIR.PRODOS
|
||||
>PUSHWI S.NODE.DIR
|
||||
>PUSHBI S.MEM.F.INIT0
|
||||
jsr K.GetMem
|
||||
bcs .9
|
||||
@ -51,14 +51,14 @@ K.OpenDirYA jsr PFT.CheckPathYA
|
||||
|
||||
>STYA MLICALL.PARAMS+3 Save Ptr to IOBUF for MLIOPEN call
|
||||
txa
|
||||
ldy #S.DIR.PRODOS.IOBUF
|
||||
ldy #S.NODE.DIR.IOBUF
|
||||
sta (ZPQuickPtr1),y
|
||||
|
||||
>MLICALL MLIOPEN
|
||||
bcs .98
|
||||
|
||||
lda MLICALL.PARAMS+5 get ref_num
|
||||
ldy #S.DIR.PRODOS.REF
|
||||
ldy #S.NODE.DIR.REF
|
||||
sta (ZPQuickPtr1),y
|
||||
|
||||
.8 lda K.ReadDirA.hDir
|
||||
@ -92,26 +92,26 @@ K.ReadDirA.EL .BS 1
|
||||
K.ReadDirA.EPB .BS 1
|
||||
K.ReadDirA.EC .BS 2
|
||||
*--------------------------------------
|
||||
K.ReadDirA jsr PFT.CheckDirA
|
||||
K.ReadDirA jsr PFT.CheckNodeA
|
||||
sta K.ReadDirA.hDir
|
||||
jsr K.GetMemPtrA
|
||||
>STYA ZPQuickPtr1
|
||||
|
||||
ldy #S.DIR.F
|
||||
lda (ZPQuickPtr1),y
|
||||
and #S.DIR.F.NOMORE
|
||||
bne .9
|
||||
|
||||
ldy #S.DIR.PRODOS.REF
|
||||
ldy #S.NODE.DIR.REF
|
||||
lda (ZPQuickPtr1),y
|
||||
beq K.ReadDirA.ROOT
|
||||
jmp K.ReadDirA.DIR
|
||||
|
||||
.9 lda #0
|
||||
K.ReadDirA.NoMore
|
||||
lda #0
|
||||
sec CS,A=0 no more entry
|
||||
rts
|
||||
*--------------------------------------
|
||||
K.ReadDirA.ROOT stz MLICALL.PARAMS+1 All Volumes
|
||||
K.ReadDirA.ROOT ldy #S.NODE.DIR.FC did we already returned something ?
|
||||
lda (ZPQuickPtr1),y
|
||||
bne K.ReadDirA.NoMore
|
||||
|
||||
stz MLICALL.PARAMS+1 All Volumes
|
||||
|
||||
>LDYAI KrnBuf256
|
||||
>STYA MLICALL.PARAMS+2
|
||||
@ -182,24 +182,24 @@ K.ReadDirA.ROOT stz MLICALL.PARAMS+1 All Volumes
|
||||
lda #0
|
||||
rol
|
||||
inc
|
||||
sta KrnSTAT+S.STAT.PRODOS.DRIVE
|
||||
sta KrnSTAT+S.STAT.P.DRIVE
|
||||
pla
|
||||
lsr CC
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
sta KrnSTAT+S.STAT.PRODOS.SLOT
|
||||
sta KrnSTAT+S.STAT.P.SLOT
|
||||
|
||||
>LDYAI KrnOut256
|
||||
>STYA MLICALL.PARAMS+1
|
||||
|
||||
>MLICALL MLIGETFILEINFO
|
||||
sta KrnSTAT+S.STAT.PRODOS.DEVSTATUS
|
||||
sta KrnSTAT+S.STAT.P.DEVSTATUS
|
||||
|
||||
bcs .80
|
||||
>LDYA MLICALL.PARAMS+5 AUXTYPE=TOTAL BLOCKS
|
||||
>STYA KrnSTAT+S.STAT.PRODOS.DEVBLOCKS
|
||||
>STYA KrnSTAT+S.STAT.P.DEVBLOCKS
|
||||
>LDYA MLICALL.PARAMS+8
|
||||
>STYA KrnSTAT+S.STAT.BLOCKS
|
||||
|
||||
@ -217,9 +217,9 @@ K.ReadDirA.ROOT stz MLICALL.PARAMS+1 All Volumes
|
||||
* lda #0 done by S.MEM.F.INIT0
|
||||
* sta (ZPQuickPtr4) Ending 0
|
||||
|
||||
ldy #S.DIR.F
|
||||
lda #S.DIR.F.NOMORE
|
||||
sta (ZPQuickPtr1),y
|
||||
ldy #S.NODE.DIR.FC
|
||||
lda #16
|
||||
sta (ZPQuickPtr1),y Flag that we returned somthing for next time
|
||||
|
||||
lda K.ReadDirA.hDIRENT
|
||||
tax
|
||||
@ -252,7 +252,7 @@ K.ReadDirA.DIR sta MLICALL.PARAMS+1 A=#S.DIR.PRODOS.REF
|
||||
>MLICALL MLIREAD Read A block from directory
|
||||
bcs .98
|
||||
|
||||
ldy #S.DIR.PRODOS.EL Check if first run....
|
||||
ldy #S.NODE.DIR.EL Check if first run....
|
||||
lda (ZPQuickPtr1),y
|
||||
bne .2 no, we have all we need....
|
||||
|
||||
@ -274,7 +274,7 @@ K.ReadDirA.DIR sta MLICALL.PARAMS+1 A=#S.DIR.PRODOS.REF
|
||||
sec
|
||||
.99 rts
|
||||
|
||||
.2 ldy #S.DIR.PRODOS.EL+3
|
||||
.2 ldy #S.NODE.DIR.EL+3
|
||||
ldx #3
|
||||
|
||||
.3 lda (ZPQuickPtr1),y get this session parameters from S.DIR
|
||||
@ -417,7 +417,7 @@ K.ReadDirA.DIR2 jsr K.ReadDirA.GetBuf
|
||||
>STYA ZPQuickPtr1
|
||||
|
||||
ldx #3
|
||||
ldy #S.DIR.PRODOS.EL+3
|
||||
ldy #S.NODE.DIR.EL+3
|
||||
|
||||
.81 lda K.ReadDirA.EL,x Store back this session prameters to S.DIR
|
||||
sta (ZPQuickPtr1),y
|
||||
@ -468,7 +468,7 @@ K.ReadDirA.ADD..
|
||||
* sta KrnSTAT+S.STAT.BLOCKS+1
|
||||
*--------------------------------------
|
||||
K.ReadDirA.ADDD lda #$0F
|
||||
sta KrnSTAT+S.STAT.PRODOS.TYPE
|
||||
sta KrnSTAT+S.STAT.P.TYPE
|
||||
|
||||
lda /S.STAT.MODE.DIR
|
||||
sta KrnSTAT+S.STAT.MODE+1
|
||||
@ -569,9 +569,9 @@ K.ReadDirA.ConvertTime
|
||||
jmp K.PTime2Time Will destroy Ptr1 & Ptr2 !!!!
|
||||
*--------------------------------------
|
||||
ADDF.SRC .HS 1013141516171f20
|
||||
ADDF.DST .DA #S.STAT.PRODOS.TYPE,#S.STAT.BLOCKS,#S.STAT.BLOCKS+1
|
||||
ADDF.DST .DA #S.STAT.P.TYPE,#S.STAT.BLOCKS,#S.STAT.BLOCKS+1
|
||||
.DA #S.STAT.SIZE,#S.STAT.SIZE+1,#S.STAT.SIZE+2
|
||||
.DA #S.STAT.PRODOS.AUXTYPE,#S.STAT.PRODOS.AUXTYPE+1
|
||||
.DA #S.STAT.P.AUXTYPE,#S.STAT.P.AUXTYPE+1
|
||||
*/-------------------------------------
|
||||
* #CloseDirA
|
||||
* ##In:
|
||||
@ -579,18 +579,18 @@ ADDF.DST .DA #S.STAT.PRODOS.TYPE,#S.STAT.BLOCKS,#S.STAT.BLOCKS+1
|
||||
* ##Out:
|
||||
* none, always succeed.
|
||||
*\-------------------------------------
|
||||
K.CloseDirA jsr PFT.CheckDirA
|
||||
K.CloseDirA jsr PFT.CheckNodeA
|
||||
sta K.ReadDirA.hDir
|
||||
jsr K.GetMemPtrA
|
||||
>STYA ZPQuickPtr1
|
||||
|
||||
K.CloseDirA.1 ldy #S.DIR.PRODOS.REF
|
||||
K.CloseDirA.1 ldy #S.NODE.DIR.REF
|
||||
lda (ZPQuickPtr1),y
|
||||
beq .1
|
||||
sta MLICALL.PARAMS+1
|
||||
>MLICALL MLICLOSE
|
||||
|
||||
.1 ldy #S.DIR.PRODOS.IOBUF
|
||||
.1 ldy #S.NODE.DIR.IOBUF
|
||||
lda (ZPQuickPtr1),y
|
||||
beq .2
|
||||
jsr K.FreeMemA
|
||||
|
@ -58,7 +58,7 @@ K.FOPEN jsr PFT.CheckPathSTK
|
||||
bcc K.FOPEN.10
|
||||
K.FOPEN.9 rts
|
||||
|
||||
K.FOPEN.10 >PUSHWI S.FILE.T.REG
|
||||
K.FOPEN.10 >PUSHWI S.NODE.REG
|
||||
>PUSHBI S.MEM.F.INIT0
|
||||
jsr K.GetMem
|
||||
bcs K.FOPEN.9
|
||||
@ -73,14 +73,14 @@ K.FOPEN.10 >PUSHWI S.FILE.T.REG
|
||||
|
||||
>STYA MLICALL.PARAMS+3 Save Ptr to IOBUF for MLIOPEN call
|
||||
txa
|
||||
ldy #S.FILE.REG.IOBUF
|
||||
ldy #S.NODE.REG.IOBUF
|
||||
sta (ZPQuickPtr1),y
|
||||
|
||||
>MLICALL MLIOPEN
|
||||
bcs .98
|
||||
|
||||
lda MLICALL.PARAMS+5 get ref_num
|
||||
ldy #S.FILE.REG.REF
|
||||
ldy #S.NODE.REG.REF
|
||||
sta (ZPQuickPtr1),y
|
||||
|
||||
sta MLICALL.PARAMS+1 Next MLI Calls are REF_NUM based
|
||||
@ -115,8 +115,8 @@ K.FOPEN.10 >PUSHWI S.FILE.T.REG
|
||||
sta MLICALL.PARAMS+3
|
||||
>MLICALL MLINEWLINE
|
||||
|
||||
.30 ldy #S.FILE.T
|
||||
lda #S.FILE.T.REG
|
||||
.30 ldy #S.NODE.T
|
||||
lda #S.NODE.T.REG
|
||||
sta (ZPQuickPtr1),y
|
||||
lda hFILE
|
||||
clc
|
||||
@ -139,18 +139,18 @@ hFILE .BS 1
|
||||
* A = hFILE
|
||||
* ##Out :
|
||||
*\--------------------------------------
|
||||
K.FCloseA jsr PFT.CheckFileA
|
||||
K.FCloseA jsr PFT.CheckNodeA
|
||||
sta hFILE
|
||||
jsr K.GetMemPtrA
|
||||
>STYA ZPQuickPtr1
|
||||
|
||||
K.FCloseA.1 ldy #S.FILE.REG.REF
|
||||
K.FCloseA.1 ldy #S.NODE.REG.REF
|
||||
lda (ZPQuickPtr1),y
|
||||
beq .1
|
||||
sta MLICALL.PARAMS+1
|
||||
>MLICALL MLICLOSE
|
||||
|
||||
.1 ldy #S.FILE.REG.IOBUF
|
||||
.1 ldy #S.NODE.REG.IOBUF
|
||||
lda (ZPQuickPtr1),y
|
||||
beq .2
|
||||
jsr K.FreeMemA
|
||||
@ -159,6 +159,39 @@ K.FCloseA.1 ldy #S.FILE.REG.REF
|
||||
jsr K.FreeMemA
|
||||
rts
|
||||
*/--------------------------------------
|
||||
* #FReadA
|
||||
* Read ONE byte from file
|
||||
* ##In :
|
||||
* A = hFILE
|
||||
* ##Out :
|
||||
* A = Byte Read
|
||||
*\--------------------------------------
|
||||
K.FReadA jsr PFT.CheckNodeA
|
||||
ldx #MLIREAD
|
||||
bra K.FReadWrite.0
|
||||
*/--------------------------------------
|
||||
* #FWriteAY
|
||||
* ##In:
|
||||
* A = hFILE
|
||||
* Y = char
|
||||
* #Out:
|
||||
* Y,A = Bytes Written
|
||||
*\--------------------------------------
|
||||
K.FWriteAY jsr PFT.CheckNodeA
|
||||
sty MLICALL.TMPBUF
|
||||
ldx #MLIWRITE
|
||||
K.FReadWrite.0 jsr FILE.SetupPrt1A
|
||||
>LDYAI MLICALL.TMPBUF
|
||||
>STYA MLICALL.PARAMS+2
|
||||
lda #1
|
||||
sta MLICALL.PARAMS+4
|
||||
stz MLICALL.PARAMS+5
|
||||
lda #4 Param Count = 4 for MLIREAD & MLIWRITE
|
||||
jsr A2osX.MLICALL
|
||||
bcs .9
|
||||
lda MLICALL.TMPBUF
|
||||
.9 rts
|
||||
*/--------------------------------------
|
||||
* #FRead
|
||||
* Read bytes from file
|
||||
* ##In :
|
||||
@ -168,9 +201,9 @@ K.FCloseA.1 ldy #S.FILE.REG.REF
|
||||
* ##Out :
|
||||
* Y,A = Bytes Read
|
||||
*\--------------------------------------
|
||||
K.FRead jsr PFT.CheckFileSTK
|
||||
K.FRead jsr PFT.CheckNodeSTK
|
||||
ldx #MLIREAD
|
||||
bra K.FRead.1
|
||||
bra K.FReadWrite.1
|
||||
*/--------------------------------------
|
||||
* #FWrite
|
||||
* ##In:
|
||||
@ -180,15 +213,13 @@ K.FRead jsr PFT.CheckFileSTK
|
||||
* #Out:
|
||||
* Y,A = Bytes Written
|
||||
*\--------------------------------------
|
||||
K.FWrite jsr PFT.CheckFileSTK
|
||||
K.FWrite jsr PFT.CheckNodeSTK
|
||||
ldx #MLIWRITE
|
||||
K.FRead.1 >PULLA
|
||||
K.FReadWrite.1 >PULLA
|
||||
jsr FILE.SetupPrt1A
|
||||
>PULLW MLICALL.PARAMS+4
|
||||
>PULLW MLICALL.PARAMS+2
|
||||
|
||||
* >MLICALL MLIWRITE
|
||||
|
||||
lda #4 Param Count = 4 for MLIREAD & MLIWRITE
|
||||
jsr A2osX.MLICALL
|
||||
bcs .9
|
||||
@ -199,7 +230,7 @@ K.FRead.1 >PULLA
|
||||
* ##In:
|
||||
* A = hFILE
|
||||
*\--------------------------------------
|
||||
K.FFlushA jsr PFT.CheckFileA
|
||||
K.FFlushA jsr PFT.CheckNodeA
|
||||
jsr FILE.SetupPrt1A
|
||||
>MLICALL MLIFLUSH
|
||||
rts
|
||||
@ -211,7 +242,7 @@ K.FFlushA jsr PFT.CheckFileA
|
||||
* PUSHB = From
|
||||
* PUSHB = hFILE
|
||||
*\-------------------------------------
|
||||
K.FSeek jsr PFT.CheckFileSTK
|
||||
K.FSeek jsr PFT.CheckNodeSTK
|
||||
>PULLA
|
||||
jsr FILE.SetupPrt1A
|
||||
>PULLB K.FSEEK.FROM
|
||||
@ -269,7 +300,7 @@ K.FSEEK.OFFSET .BS 4
|
||||
* ##Out:
|
||||
* Y,A,X = Offset
|
||||
*\--------------------------------------
|
||||
K.FTellA jsr PFT.CheckFileA
|
||||
K.FTellA jsr PFT.CheckNodeA
|
||||
K.FTellA.1 jsr FILE.SetupPrt1A
|
||||
>MLICALL MLIGETMARK
|
||||
bcs .9
|
||||
@ -286,7 +317,7 @@ K.FTellA.1 jsr FILE.SetupPrt1A
|
||||
* A !=0 NOT EOF
|
||||
* CS :
|
||||
*\--------------------------------------
|
||||
K.FEOFA jsr PFT.CheckFileA
|
||||
K.FEOFA jsr PFT.CheckNodeA
|
||||
jsr FILE.SetupPrt1A
|
||||
jsr K.FTELLA.1
|
||||
bcs .9
|
||||
@ -347,7 +378,7 @@ K.Stat jsr PFT.CheckPathSTK
|
||||
*--------------------------------------
|
||||
FILE.SetupPrt1A jsr K.GetMemPtrA
|
||||
>STYA ZPQuickPtr1
|
||||
ldy #S.FILE.PRODOS.REF
|
||||
ldy #S.NODE.REG.REF
|
||||
lda (ZPQuickPtr1),y
|
||||
sta MLICALL.PARAMS+1
|
||||
rts
|
||||
@ -368,7 +399,7 @@ FILE.MLI2STAT
|
||||
sta (ZPQuickPtr2),y
|
||||
|
||||
ldx #2
|
||||
ldy #S.STAT.PRODOS.TYPE+2
|
||||
ldy #S.STAT.P.TYPE+2
|
||||
|
||||
.3 lda MLICALL.PARAMS+S.FILEINFO.TYPE,x
|
||||
sta (ZPQuickPtr2),y
|
||||
|
@ -85,10 +85,9 @@ PFT.CheckPathYA
|
||||
* PULLB/A = hFILE/hDIR
|
||||
* Out :
|
||||
*--------------------------------------
|
||||
PFT.CheckFileSTK
|
||||
PFT.CheckNodeSTK
|
||||
lda (pStack) read hFILE on top of stack
|
||||
PFT.CheckFileA
|
||||
PFT.CheckDirA stx S.PFT.SYSCALL save #SYSCALL
|
||||
PFT.CheckNodeA stx S.PFT.SYSCALL save #SYSCALL
|
||||
sta S.PFT.hFILE
|
||||
jsr K.GetMemPtrA X = unmidified
|
||||
>STYA ZPQuickPtr1
|
||||
|
@ -70,6 +70,27 @@ Prints Pascal/C-Style String
|
||||
+ CC : success
|
||||
+ CS : I/O error from COut
|
||||
|
||||
#FPutCAY
|
||||
Print A (char) to File
|
||||
|
||||
##In:
|
||||
+ A : char to print
|
||||
+ Y = hFILE
|
||||
+ none.
|
||||
|
||||
##Out:
|
||||
+ CC = success
|
||||
|
||||
#PutCA
|
||||
Print A (char) to StdOut
|
||||
|
||||
##In:
|
||||
+ A : char to print
|
||||
+ none.
|
||||
|
||||
##Out:
|
||||
+ CC = success
|
||||
|
||||
#GetDevByIDA
|
||||
|
||||
##IN:
|
||||
@ -77,7 +98,7 @@ Prints Pascal/C-Style String
|
||||
|
||||
##OUT:
|
||||
+ CC = OK, CS = ERROR
|
||||
+ Y,A = devslot
|
||||
+ Y,A = DEVSLOT
|
||||
+ note: X Unmodified
|
||||
|
||||
#GetDevIDByNameYA
|
||||
@ -88,7 +109,7 @@ Prints Pascal/C-Style String
|
||||
##OUT:
|
||||
+ CC = OK, CS = ERROR
|
||||
+ X = DEVID
|
||||
+ Y,A = pDev
|
||||
+ Y,A = DEVSLOT
|
||||
|
||||
#GetDevInfoA
|
||||
|
||||
@ -99,6 +120,25 @@ Prints Pascal/C-Style String
|
||||
+ CC = OK, CS = ERROR
|
||||
+ Y,A = Ptr to S.DEVINFO
|
||||
|
||||
#MkNodYA
|
||||
return a S.FILE from a given Device
|
||||
|
||||
##IN:
|
||||
+ Y,A=DevName
|
||||
|
||||
##OUT:
|
||||
+ CC = OK, CS = ERROR
|
||||
+ A = hFILE
|
||||
|
||||
#MKFIFO
|
||||
return a S.FILE to a new FIFO
|
||||
|
||||
##IN:
|
||||
|
||||
##OUT:
|
||||
+ CC = OK, CS = ERROR
|
||||
+ A = hFILE
|
||||
|
||||
#OpenDirYA
|
||||
|
||||
##In:
|
||||
@ -207,6 +247,24 @@ Close a file
|
||||
|
||||
##Out :
|
||||
|
||||
#FReadA
|
||||
Read ONE byte from file
|
||||
|
||||
##In :
|
||||
+ A = hFILE
|
||||
|
||||
##Out :
|
||||
+ A = Byte Read
|
||||
|
||||
#FWriteAY
|
||||
|
||||
##In:
|
||||
+ A = hFILE
|
||||
+ Y = char
|
||||
|
||||
#Out:
|
||||
+ Y,A = Bytes Written
|
||||
|
||||
#FRead
|
||||
Read bytes from file
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user