KERNEL 0.95

This commit is contained in:
burniouf 2023-10-18 07:41:12 +02:00
parent 9c547bcd35
commit a8cf411cd7
94 changed files with 2840 additions and 1791 deletions

View File

@ -49,7 +49,6 @@ A = Arg count
# LoadDrv
## ASM
**In:**
Y,A = PTR to "NAME.DRV [PARAM]" C-String
## RETURN VALUE
@ -61,7 +60,6 @@ none
`void * insdrv (void * src, void * crvcsstart, void * drvcssize, void * drvend);`
## ASM
**In:**
`>PUSHW DRV.END`
`>PUSHW DRV.CS.SIZE`
`>PUSHW DRV.CS.START`
@ -199,7 +197,6 @@ Change or add an environment variable, string is 'NAME=VALUE'
`int putenv(char *string);`
## ASM
**In:**
`>PUSHW string`
`>SYSCALL putenv`
@ -221,7 +218,6 @@ Remove an environment variable
Return X+Y, X-Y, X*Y, X/Y, X mod Y....
## ASM
**In:**
`>PUSHL X (long)`
`>PUSHL Y (long)`
`>FPU add32`
@ -237,7 +233,6 @@ Return X*Y, X/Y, X+Y, X-Y
`float pwr ( float x, float y);`
## ASM
**In:**
`>PUSHF X (float)`
`>PUSHF Y (float)`
`>FPU fmul`
@ -263,7 +258,6 @@ Return Log(x), Sqr(x), E^X, Cos(x), Sin(X), Tan(x), ATan(x)
`float atan ( float x);`
## ASM
**In:**
`>PUSHF x (Float)`
`>FPU log`
@ -277,7 +271,6 @@ Return 'floated' long
`float f = (float)l;
## ASM
**In:**
`>PUSHL l` (long)
`>FPU float`
@ -291,7 +284,6 @@ Return float rounded into a long
`long int lrintf (float x);`
## ASM
**In:**
`>PUSHF x`
`>FPU lrintf`
@ -528,7 +520,6 @@ Load TXT a file in memory (with ending 0)
`int loadtxtfile ( const char * filename );`
## ASM
**In:**
`>LDYA filename`
`>SYSCALL loadtxtfile`
@ -543,7 +534,6 @@ Load a file in memory
`int loadfile ( const char * filename, short int flags, short int ftype, int auxtype );`
## ASM
**In:**
`>PUSHW filename`
`>PUSHB flags`
`>PUSHB ftype`
@ -562,7 +552,6 @@ And return, if found, the full path to it.
`int filesearch( char *filename, char *searchpath, char *fullpath, stat *filestat);`
## ASM
**In:**
`>PUSHW filename`
`>PUSHW fullpath`
`>PUSHW searchpath`
@ -576,7 +565,6 @@ DstStat = S.STAT
CS : not found
# GetMemStat
**In:**
Y,A = Ptr to 24 bytes buffer
## RETURN VALUE
@ -835,7 +823,7 @@ A = hFILE
# MkNod
Create a special or ordinary file.
(CDEV, BDEV, DSOCKS, SSOCK, PIPE)
(CDEV, BDEV, DSOCK, SSOCK, PIPE)
## C
`hFILE mknod(const char *pathname, int mode, hFD fd);`
@ -870,7 +858,6 @@ Print A (char) to hFILE
`int fputc ( hFILE stream , short int character );`
## ASM
**In:**
`>PUSHB stream`
`>PUSHB character`
`>SYSCALL fputc`
@ -885,7 +872,6 @@ Print A (char) to StdOut
`int putchar ( short int character );`
## ASM
**In:**
`lda character`
`>SYSCALL putchar`
@ -897,7 +883,6 @@ Write Str to StdOut, appends '\r\n'
## C
`int puts ( const char * str );`
**In:**
## ASM
`>LDYAI str`
@ -913,7 +898,6 @@ Write Str to hFILE
`int fputs (hFILE stream, const char * str );`
## ASM
**In:**
`>PUSHB stream`
`>PUSHW str`
`>SYSCALL fputs`
@ -931,7 +915,6 @@ string is then terminated with a null byte.
`char *fgets(hFILE stream, char * s, int n);`
## ASM
**In:**
`>PUSHB hFILE`
`>PUSHW s`
`>PUSHW n`
@ -948,7 +931,6 @@ Get char from StdIn
`short int getchar ( );`
## ASM
**In:**
`>SYSCALL getchar`
## RETURN VALUE
@ -962,7 +944,6 @@ Get char from Node
`short int getc ( short int stream );`
## ASM
**In:**
`lda stream`
`>SYSCALL getc`
@ -990,7 +971,6 @@ Open a file
## C
`short int fopen ( const char *filename, short int flags, short int ftype, int auxtype );`
**In:**
## ASM
`>PUSHW filename`
@ -1024,7 +1004,6 @@ Close a file
`int fclose ( short int stream );`
## ASM
**In:**
`lda stream`
`>SYSCALL FClose`
@ -1037,7 +1016,6 @@ Read bytes from file
`int fread (short int stream, void * ptr, int count );`
## ASM
**In:**
`>PUSHB stream`
`>PUSHW ptr`
`>PUSHW count`
@ -1053,7 +1031,6 @@ Write bytes to file
`int fwrite ( short int stream, const void * ptr, int count );`
## ASM
**In:**
`>PUSHB stream`
`>PUSHW ptr`
`>PUSHW count`
@ -1068,7 +1045,6 @@ Write bytes to file
`int fflush( short int stream );`
## ASM
**In:**
`lda stream`
`>SYSCALL fflush`
@ -1079,7 +1055,6 @@ Set the file-position indicator for hFILE
`int fseek( short int stream, long offset, short int whence );`
## ASM
**In:**
`>PUSHB stream`
`>PUSHL offset`
`>PUSHB whence`
@ -1092,7 +1067,6 @@ Test the end-of-file indicator for hFILE
`short int feof( short int stream );`
## ASM
**In:**
`lda stream`
`>SYSCALL feof`
@ -1109,7 +1083,6 @@ Return the current value of the file-position indicator
`long ftell( short int stream );`
## ASM
**In:**
`lda stream`
`>SYSCALL ftell`
@ -1123,7 +1096,6 @@ Remove a file or directory
`int remove ( const char *pathname );`
## ASM
**In:**
`>LDYA pathname`
`>SYSCALL remove`
@ -1136,7 +1108,6 @@ Rename a file
`int rename ( const char * oldpath, const char * newpath );`
## ASM
**In:**
`>PUSHW oldpath`
`>PUSHW newpath`
`>SYSCALL rename`
@ -1156,7 +1127,6 @@ Prints C-Style String
`int sprintf ( char *str, const char *format, ... );`
## ASM
**In:**
PrintF : (example is for printing Y,A as integer : format="%I", 2 bytes)
`>PUSHW format`
`>PUSHW i`
@ -1218,7 +1188,6 @@ Read formatted data from string
`int sscanf ( const char *s, const char *format, ... );`
## ASM
**In:**
ScanF :
`>PUSHW format`
`>PUSHW ptr`
@ -1262,7 +1231,6 @@ Convert String to 40 bits Float
`float strtof (const char* str, char** endptr );`
## ASM
**In:**
`>PUSHW str`
`>PUSHWI EndPtr`
`>SYSCALL StrToF`
@ -1277,7 +1245,6 @@ Convert String to 40 bits Float
`float atof ( const char* str );`
## ASM
**In:**
`>LDYA str`
`>SYSCALL atof`
@ -1292,7 +1259,6 @@ Convert String to 32 bits (unsigned) int
`unsigned long strtoul (const char* str, char** endptr, int base);`
## ASM
**In:**
`>PUSHW str`
`>PUSHW EndPtr`
`>PUSHB Base`
@ -1308,7 +1274,6 @@ Convert String to 32 bits long
`long atol ( const char * str );`
## ASM
**In:**
`>LDYA str`
`>SYSCALL atol`
@ -1322,7 +1287,6 @@ Convert String to 16 bits int
`int atoi ( const char * str );`
## ASM
**In:**
`>LDYAI str`
`>SYSCALL atoi`
@ -1336,7 +1300,6 @@ Return the canonicalized absolute pathname
`char *realpath(const char *path, char *resolvedpath);`
## ASM
**In:**
`>PUSHW path`
`>PUSHW resolvedpath`
`>SYSCALL realpath`
@ -1411,7 +1374,6 @@ Concatenate strings
`char * strcat ( char * destination, const char * source );`
## ASM
**In:**
`>PUSHWI destination`
`>PUSHWI source`
`>SYSCALL strcat`
@ -1426,7 +1388,6 @@ Copy string
`char * strcpy ( char * destination, const char * source );`
## ASM
**In:**
`>PUSHWI destination`
`>PUSHWI source`
`>SYSCALL strcpy`
@ -1456,7 +1417,6 @@ Convert string to UPPERCASE/lowercase
`int strlwr ( char * str);`
## ASM
**In:**
`>LDYAI str`
`>SYSCALL strupr`
`>SYSCALL strlwr`
@ -1472,7 +1432,6 @@ Compare 2 strings
`int strcmp(const char *s1, const char *s2);`
## ASM
**In:**
`>PUSHWI s1`
`>PUSHWI s2`
`>SYSCALL strcmp`
@ -1490,7 +1449,6 @@ Compare 2 strings, ignoring case
`int strcasecmp(const char *s1, const char *s2);`
## ASM
**In:**
`>PUSHWI s1`
`>PUSHWI s2`
`>SYSCALL strcasecmp`
@ -1614,7 +1572,6 @@ Convert S.TIME struct to CSTR
`hFD open(const char *pathname, short int flags);`
## ASM
**In:**
`>PUSHW pathname`
`>PUSHB flags`
`>SYSCALL open`
@ -1629,7 +1586,6 @@ REG File created on ProDOS : T=TXT,X=$0000
`int close(hFD fd);`
## ASM
**In:**
`lda fd`
`>SYSCALL close`
@ -1639,7 +1595,6 @@ REG File created on ProDOS : T=TXT,X=$0000
`int read(hFD fd, void *buf, int count);`
## ASM
**In:**
`>PUSHB fd`
`>PUSHW buf`
`>PUSHW count`
@ -1655,7 +1610,6 @@ CS: A = EC
`int write(hFD fd, const void *buf, int count);`
## ASM
**In:**
`>PUSHB fd`
`>PUSHW buf`
`>PUSHW count`
@ -1672,7 +1626,6 @@ Set the file-position indicator for hFD
`int lseek( short int hFD, long offset, short int whence );`
## ASM
**In:**
`>PUSHB hFD`
`>PUSHL offset`
`>PUSHB whence`
@ -1684,7 +1637,6 @@ Set the file-position indicator for hFD
`short int chown(const char *pathname, short int owner, short int group);`
## ASM
**In:**
`>PUSHW pathname`
`>PUSHB owner`
`>PUSHB group`

View File

@ -37,7 +37,8 @@ Write a track (16 sectors)
# D2TrkWriteNIB
Write a track (NIBBLE)
**In:**
## ASM
PUSHB = DSSS0000
PUSHW = Ptr to NIBBLE buffer (0 ended)
@ -53,7 +54,6 @@ Write a track (NIBBLE)
int getprodoscatsize (short int options, short int catsize, int devsize );
## ASM
**In:**
PUSHW = DevSize (in 512b blocks)
PUSHB = Catalog Size (in blocks)
PUSHB = Options
@ -63,7 +63,8 @@ int getprodoscatsize (short int options, short int catsize, int devsize );
Y,A=BufSize (max $4400)
# BuildProDOSCat
**In:**
## ASM
PUSHW = DevSize (in 512b blocks)
PUSHB = Catalog Size (in blocks)
PUSHB = Options

View File

@ -5,13 +5,15 @@ Copyright 2015 - 2020, Remy Gibert and the A2osX contributors.
# ARP.Clear
Clear ARP Cache
**In:**
## ASM
## RETURN VALUE
# ARP.Query
Query ARP Cache and returns HW address
**In:**
## ASM
PUSHW PTR to MAC (to fill)
PUSHW PTR to IP
@ -21,26 +23,30 @@ Copyright 2015 - 2020, Remy Gibert and the A2osX contributors.
# ARP.Add
Add a static ARP cache record
**In:**
## ASM
PUSHW PTR to MAC
PUSHW PTR to IP
# ARP.GetCache
Return a Ptr to ARP Cache Table
**In:**
## ASM
## RETURN VALUE
Y,A = PTR to ARP.CACHE
# DNS.Clear
Clear DNS Cache
**In:**
## ASM
## RETURN VALUE
# DNS.Query
Query DNS for specified host
**In:**
## ASM
PUSHW = PTR to IP to fill with cached data
* PUSHW = hostname PTR to PSTR
@ -50,13 +56,15 @@ Copyright 2015 - 2020, Remy Gibert and the A2osX contributors.
# DNS.Add
Add a static DNS record
**In:**
## ASM
PUSHW = PTR to IP
PUSHW = hostname CSTR to Add
# DNS.GetCAche
Return a Ptr to DNS Cache Table
**In:**
## ASM
## RETURN VALUE
Y,A = PTR to DNS.CACHE
@ -68,7 +76,6 @@ Create a new socket
`hFD socket(short int type, short int protocol);`
## ASM
**In:**
`>PUSHB type`
`>PUSHB protocol`
`>LIBCALL hLIBTCPIP,LIBTCPIP.socket`
@ -84,7 +91,6 @@ bind a name to a socket
`int bind(hFD fd, const struct sockaddr *addr);`
## ASM
**In:**
`>PUSHB fd`
`>PUSHW addr`
`>LIBCALL hLIBTCPIP,LIBTCPIP.socket`
@ -100,7 +106,6 @@ Initiate a connection on a socket
`int connect(hFD fd, const struct sockaddr *addr);`
## ASM
**In:**
`>PUSHB fd`
`>PUSHW addr`
`>LIBCALL hLIBTCPIP,LIBTCPIP.socket`
@ -116,7 +121,6 @@ Listen for connections on a socket
`int listen(hFD fd);`
## ASM
**In:**
`lda fd`
`>LIBCALL hLIBTCPIP,LIBTCPIP.listen`
@ -130,7 +134,6 @@ Accept a connection on a socket
`hFD Accept(hFD fd);`
## ASM
**In:**
`lda fd`
`>LIBCALL hLIBTCPIP,LIBTCPIP.accept`
@ -144,7 +147,6 @@ Close socket
`int shutdown(int fd);`
## ASM
**In:**
`lda fd`
`>LIBCALL hLIBTCPIP,LIBTCPIP.shutdown`
@ -156,7 +158,6 @@ Close socket
`int skt.read(hFD fd, void *buf, int count);`
## ASM
**In:**
`>PUSHB fd`
`>PUSHW buf`
`>PUSHW count`
@ -172,7 +173,6 @@ CS: A = EC
`int skt.write(hFD fd, const void *buf, int count);`
## ASM
**In:**
`>PUSHB fd`
`>PUSHW buf`
`>PUSHW count`
@ -188,7 +188,6 @@ CS: A = EC
`hMem recvfrom(hFD fd, struct sockaddr *addr);`
## ASM
**In:**
`>PUSHB fd`
`>PUSHW addr` (RecvFrom)
`>LIBCALL hLIBTCPIP,LIBTCPIP.Recv`
@ -203,7 +202,6 @@ CS: A = EC
`hMem recv(hFD fd);`
## ASM
**In:**
`lda fd`
`>LIBCALL hLIBTCPIP,LIBTCPIP.Recv`
@ -217,7 +215,6 @@ CS: A = EC
`int skt.sendto(hFD fd, const void *buf, int count, const struct sockaddr *addr);`
## ASM
**In:**
`>PUSHB fd`
`>PUSHW buf`
`>PUSHWI count`
@ -234,7 +231,6 @@ CS: A = EC
`int skt.send(hFD fd, const void *buf, int count);`
## ASM
**In:**
`>PUSHB fd`
`>PUSHW buf`
`>PUSHWI count`
@ -251,7 +247,6 @@ Set Socket Options
`int getsockopt(hFD fd);`
## ASM
**In:**
`lda fd`
`>LIBCALL hLIBTCPIP,LIBTCPIP.GetSockOpt`
@ -264,7 +259,6 @@ Set Socket Options
`int setsockopt(hFD fd, short int opts);`
## ASM
**In:**
`>PUSHB fd`
`>PUSHB opts`
`>LIBCALL hLIBTCPIP,LIBTCPIP.SetSockOpt`
@ -278,7 +272,6 @@ End Of File
`int eof(hFD fd);`
## ASM
**In:**
`lda fd`
`>LIBCALL hLIBTCPIP,LIBTCPIP.EOF`
@ -286,18 +279,6 @@ End Of File
CC : A = 0 if some data, A = $ff if EOF
CS : A = Socket Error
# GetTable
Get socket table
## C
`void * gettable();`
## ASM
**In:**
`>LIBCALL hLIBTCPIP,LIBTCPIP.GetTable`
## RETURN VALUE
## License
A2osX is licensed under the GNU General Public License.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -46,20 +46,24 @@ L.MSG2 .DA MSG2
CS.INIT >LDYA L.LIBETALK
>SYSCALL LoadLib
bcs .9
sta hLIBETALK
.9 rts
*--------------------------------------
CS.RUN >LIBCALL hLIBETALK,LIBETALK.GETCFG
>STYA ZPPTR1
* lda (ZPPTR1)
* bmi .1
lda (ZPPTR1)
bne .1
jmp CS.RUN.ERR
* jmp CS.RUN.ERR
.1 ldy #S.PS.ARGC
lda (pPS),y
cmp #1
bcs .2
jmp CS.RUN.DUMP
.2 >PUSHEA.G DST.ADDR+3
@ -70,17 +74,18 @@ CS.RUN >LIBCALL hLIBETALK,LIBETALK.GETCFG
>SYSCALL ArgV
>SYSCALL SScanF
bcs CS.RUN.ERR
ldy #S.PS.ARGC
lda (pPS),y
cmp #1
beq CS.RUN.QUERY
cmp #3
cmp #2
bcc CS.RUN.QUERY
bne CS.RUN.ERR
jmp CS.RUN.ADD
CS.RUN.ERR >PUSHBI 0
>LDYA L.MSG.Usage
>SYSCALL PrintF
CS.RUN.ERR >LDYA L.MSG.Usage
>SYSCALL PutS
lda #E.SYN
sec
rts
@ -91,30 +96,41 @@ CS.RUN.QUERY jsr Init.Timeout
>PUSHEA.G DST.ADDR
>LIBCALL hLIBETALK,LIBETALK.AARP.Query
bcc .2 success, print & exit
jsr Wait.TimeOut
bcs .8
>SLEEP
>SYSCALL GetChar
bcs .1
cmp #3
beq .9
bra .1
.2 ldx #5
ldy #DST.MAC+5
.3 >PUSHB (pData),y
dey
dex
bpl .3
ldx #3
ldy #DST.ADDR+3
.4 >PUSHB (pData),y
dey
dex
bne .4
>PUSHBI 8
>LDYA L.MSG2
>SYSCALL PrintF
.8 lda #0
.9 sec
rts
*--------------------------------------
@ -133,9 +149,12 @@ CS.RUN.ADD >PUSHEA.G DST.MAC+5
>PUSHEA.G DST.MAC
>PUSHEA.G DST.ADDR
>LIBCALL hLIBETALK,LIBETALK.AARP.Add
* >LIBCALL hLIBETALK,LIBETALK.AARP.Add
clc
.8 rts
.9 jmp CS.RUN.ERR
*--------------------------------------
CS.RUN.DUMP >LIBCALL hLIBETALK,LIBETALK.AARP.GetCache
@ -144,8 +163,10 @@ CS.RUN.DUMP >LIBCALL hLIBETALK,LIBETALK.AARP.GetCache
>SYSCALL PutS
ldx #K.AARPCACHE.SIZE
.1 lda (ZPPTR1)
beq .4
ldy #S.AARPCACHE.ADDR+3
>PUSHB (ZPPTR1),y
dey
@ -154,6 +175,7 @@ CS.RUN.DUMP >LIBCALL hLIBETALK,LIBETALK.AARP.GetCache
iny
>PUSHB (ZPPTR1),y
ldy #S.AARPCACHE.MAC+6
.3 dey
>PUSHB (ZPPTR1),y
cpy #S.AARPCACHE.MAC
@ -168,14 +190,18 @@ CS.RUN.DUMP >LIBCALL hLIBETALK,LIBETALK.AARP.GetCache
phx
>SYSCALL PrintF
plx
.4 lda ZPPTR1
clc
adc #S.AARPCACHE
sta ZPPTR1
bcc .5
inc ZPPTR1+1
.5 dex
bne .1
.8 lda #0 tell TSKMGR that all done ok, but
sec we do not want to stay in memory
rts
@ -186,14 +212,18 @@ CS.DOEVENT lda (pEvent)
ldy #TimeOut
lda (pData),y
beq .9
dec
sta (pData),y
.9 sec do not discard TIMER event
rts
*--------------------------------------
CS.QUIT lda hLIBETALK
beq .8
>SYSCALL UnloadLib
.8 clc
rts
*--------------------------------------
@ -203,10 +233,13 @@ Init.Timeout ldy #TimeOut
rts
*--------------------------------------
Wait.TimeOut sec
ldy #TimeOut
lda (pData),y
beq .9
clc
.9 rts
*--------------------------------------
CS.END

View File

@ -272,6 +272,7 @@ CS.RUN.PrintListYAX
adc ZPPTR1
sta ZPPTR1
bcc .2
inc ZPPTR1+1
.2 dex
@ -285,6 +286,7 @@ CS.DOEVENT sec
*--------------------------------------
CS.QUIT lda hBuf
beq .8
>SYSCALL FreeMem
.8 clc

View File

@ -115,11 +115,10 @@ CS.RUN inc ArgCount
ldy #S.PS.hStdOut
lda (pPS),y
tax
lda hFDs-1,x
>SYSCALL GetMemPtr
tay
ldx FILEs.hFD-1,y
ldy FDs.pLO-1,x
lda FDs.pHI-1,x
>STYA ZPPtr1
lda (ZPPtr1)

View File

@ -142,9 +142,10 @@ CS.RUN lda #C.SPACE
.80 ldy #S.PS.hStdIn
lda (pPS),y
tax
lda hFDs-1,x
>SYSCALL GetMemPtr
tay
ldx FILEs.hFD-1,y
ldy FDs.pLO-1,x
lda FDs.pHI-1,x
>STYA ZPPtr1
lda (ZPPtr1)

View File

@ -420,7 +420,7 @@ CS.RUN.NewLine lda #C.CR
CS.RUN.SetCRLF ldy #S.PS.hStdOut
lda (pPS),y
tax
lda hFDs-1,x
lda FILEs.hFD-1,x
>SYSCALL GetMemPtr
>STYA ZPPtr1
lda (ZPPtr1) #S.FD.T.REG ?

View File

@ -26,9 +26,13 @@ ZPFrameBase .BS 2
ZPFramePtr .BS 2
BufPtr .BS 2
DevID .BS 1
ProbeCnt .BS 1
TimeOut .BS 1
hFrame .BS 1
ZPPtr1 .BS 1
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
@ -67,25 +71,27 @@ L.MSG2.C .DA MSG2.C
L.MSG2.U .DA MSG2.U
L.MSG2.ADDR .DA MSG2.ADDR
L.MSG2.ROUTER .DA MSG2.ROUTER
L.MSG2.MCAST .DA MSG2.MCAST
L.MSG2.NETRANGE .DA MSG2.NETRANGE
L.MSG2.OBJECT .DA MSG2.OBJECT
L.MSG.CFG .DA MSG.CFG
L.MSG.CFG.KO .DA MSG.CFG.KO
L.MSG.CFG.OK .DA MSG.CFG.OK
L.HOSTNAME .DA HOSTNAME
L.CFG.DefaultHost .DA CFG.DefaultHost
L.ETKCFG .DA ETKCFG
L.ETKCFG.OBJECT .DA ETKCFG+S.ETKCFG.OBJECT
*--------------------------------------
L.MSG.PROBE .DA MSG.PROBE
L.MSG.PROBE.KO .DA MSG.PROBE.KO
L.MSG.PROBE.OK .DA MSG.PROBE.OK
L.AARP.PRB .DA AARP.PRB
L.DDP.GetNetInfo .DA DDP.GetNetInfo
L.NBP.Browse .DA NBP.Browse
.DA 0
*--------------------------------------
CS.INIT >LDYA L.LIBETALK
>SYSCALL LoadLib
bcs .9
sta hLIBETALK
.9 rts
@ -93,36 +99,34 @@ CS.INIT >LDYA L.LIBETALK
CS.RUN >LIBCALL hLIBETALK,LIBETALK.GETCFG
>STYA pETKCFG
ldy #S.ETKCFG-1
.1 lda (pETKCFG),y
sta ETKCFG,y
dey
bpl .1
lda ETKCFG+S.NETCFG.DevID
ldy #S.NETCFG.DevID
lda (pETKCFG),y
bne CS.RUN.SETUP
>LDYA L.MSG.NODEV
>SYSCALL PutS
lda #MLI.E.NODEV
sec
rts
CS.RUN.SETUP lda ETKCFG+S.NETCFG.STATUS
bne .7
CS.RUN.SETUP sta DevID
lda (pETKCFG)
bmi .7
jsr CFG.EtcFiles
bne .1
jsr CS.RUN.EtcFiles
jsr CS.RUN.PROBE
jsr CS.RUN.GETNETINFO
lda #$80
sta ETKCFG+S.NETCFG.STATUS
>PUSHW L.ETKCFG
>LIBCALL hLIBETALK,LIBETALK.SETCFG
.1 jsr CS.RUN.GETNETINFO
.7 jsr CS.RUN.DUMP
>PUSHW L.NBP.Browse
>LIBCALL hLIBETALK,LIBETALK.NBP.Lookop
.8 lda #0
sec
CS.RUN.SETUP.RTS
@ -139,20 +143,17 @@ CS.RUN.DUMP >LEA.G DCB.NIC
ldx #S.IOCTL.S.GETDIB
jsr CS.RUN.IOCTL
bcs CS.RUN.SETUP.RTS
*--------------------------------------
CS.RUN.DUMPNIC >PUSHW L.MSG1.DEV
lda ETKCFG+S.NETCFG.DevID
>PUSHA
>PUSHB DevID
>SYSCALL GetMemPtr
pha
tya
tax
lda FDs.pLO-1,x
clc
adc #S.FD.DEV
tay
pla
lda FDs.pHI-1,x
adc /S.FD.DEV
>PUSHYA
@ -201,10 +202,11 @@ CS.RUN.DUMPNIC >PUSHW L.MSG1.DEV
>LDA.G DCB.NIC+S.DCB.NIC.LINK
and #S.DCB.NIC.LINK.OK
bne CS.RUN.LINK
>LDYA L.MSG1.LINK.KO
>SYSCALL PutS
bra CS.RUN.DUMPNET
bra CS.RUN.DUMPETKCFG
*--------------------------------------
CS.RUN.LINK >LDYA L.MSG1.LINK.OK
>SYSCALL PutS
@ -215,82 +217,149 @@ CS.RUN.LINK >LDYA L.MSG1.LINK.OK
>LDA.G DCB.NIC+S.DCB.NIC.SPEED
and #$0F
tax
.4 phx
lda #'0'
>SYSCALL PutChar
plx
dex
bne .4
>LDA.G DCB.NIC+S.DCB.NIC.LINK
and #S.DCB.NIC.LINK.FD
bne .5
>LDYA L.MSG1.DPLX.HD
bra .6
.5 >LDYA L.MSG1.DPLX.FD
.6 >SYSCALL PutS
CS.RUN.DUMPNET >PUSHW L.MSG2
.5 >LDYA L.MSG1.DPLX.FD
.6 >SYSCALL PutS
*--------------------------------------
CS.RUN.DUMPETKCFG
>PUSHW L.MSG2
>PUSHBI 0
>SYSCALL PrintF
lda ETKCFG+S.ETKCFG.NodID
lda (pETKCFG)
beq .11
>LDYA L.MSG2.C
bra .10
.11 >LDYA L.MSG2.U
.10 >SYSCALL PutS
>PUSHW L.MSG2.ADDR
>PUSHW ETKCFG+S.ETKCFG.NetID
>PUSHB ETKCFG+S.ETKCFG.NodID
ldy #S.ETKCFG.NetID+1
lda (pETKCFG),y
>PUSHA
dey
lda (pETKCFG),y
>PUSHA
ldy #S.ETKCFG.NodID
lda (pETKCFG),y
>PUSHA
>PUSHBI 3
>SYSCALL PrintF
>PUSHW L.MSG2.ROUTER
>PUSHW ETKCFG+S.ETKCFG.NetID
>PUSHB ETKCFG+S.ETKCFG.Router
ldy #S.ETKCFG.NetID+1
lda (pETKCFG),y
>PUSHA
dey
lda (pETKCFG),y
>PUSHA
ldy #S.ETKCFG.Router
lda (pETKCFG),y
>PUSHA
>PUSHBI 3
>SYSCALL PrintF
>PUSHW L.MSG2.OBJECT
>PUSHW L.ETKCFG.OBJECT
>PUSHBI 2
>PUSHW L.MSG2.MCAST
ldy #S.ETKCFG.MCAddress+1
.1 >PUSHB (pETKCFG),y
iny
cpy #S.ETKCFG.MCAddress+7
bcc .1
>PUSHBI 6
>SYSCALL PrintF
lda #0 tell TSKMGR that all done ok, but
sec we do not want to stay in memory
>PUSHW L.MSG2.NETRANGE
ldy #S.ETKCFG.NetStart+1
lda (pETKCFG),y
>PUSHA
dey
lda (pETKCFG),y
>PUSHA
ldy #S.ETKCFG.NetEnd+1
lda (pETKCFG),y
>PUSHA
dey
lda (pETKCFG),y
>PUSHA
>PUSHBI 4
>SYSCALL PrintF
>PUSHW L.MSG2.OBJECT
lda pETKCFG
clc
adc #S.ETKCFG.Object
tay
lda pETKCFG+1
adc /S.ETKCFG.Object
>PUSHYA
lda pETKCFG
clc
adc #S.ETKCFG.Zone
tay
lda pETKCFG+1
adc /S.ETKCFG.Zone
>PUSHYA
>PUSHBI 4
>SYSCALL PrintF
rts
*--------------------------------------
CS.RUN.PROBE >LDYA L.MSG.PROBE
>SYSCALL PutS
ldy #S.ETKCFG.MAC+5
ldx #5
.20 lda ETKCFG+S.NETCFG.MAC,x
.20 lda (pETKCFG),y
sta AARP.PRB.SHA,x
dey
dex
bpl .20
lda #$FF
sta AARP.PRB.SPA+2
sta AARP.PRB.TPA+2
lda #$FE
sta AARP.PRB.SPA+1
sta AARP.PRB.TPA+1
lda #$FE
sta AARP.PRB.SPA+2
sta AARP.PRB.TPA+2
lda A2osX.TIMER16
eor A2osX.TIMER16+1
bne .1
inc
.1 cmp #$FE
bcc .2
eor #$80
.2 sta AARP.PRB.SPA+3
sta AARP.PRB.TPA+3
lda #PROBE.MAX
sta ProbeCnt
@ -299,27 +368,31 @@ CS.RUN.PROBE >LDYA L.MSG.PROBE
>LDYAI AARP.PRB.LEN
>STYA.G DEV.IOCTL+S.IOCTL.BYTECNT
>PUSHB ETKCFG+S.NETCFG.DevID
lda #IOCTL.WRITE
jsr CS.RUN.IOCTL.A
ldx #IOCTL.WRITE
jsr CS.RUN.IOCTL.X
>SLEEP
dec ProbeCnt
bne .3
lda AARP.PRB.SPA+2
sta ETKCFG+S.ETKCFG.NetID
sta DDP.GetNetInfo+S.DDP2.SRC.NET
lda AARP.PRB.SPA+1
sta ETKCFG+S.ETKCFG.NetID+1
ldy #S.ETKCFG.NetID
sta (pETKCFG),y
sta DDP.GetNetInfo+S.DDP2.SRC.NET+1
lda AARP.PRB.SPA+1
iny
sta (pETKCFG),y
sta DDP.GetNetInfo+S.DDP2.SRC.NET
lda AARP.PRB.SPA+3
sta ETKCFG+S.ETKCFG.NodID
ldy #S.ETKCFG.NodID
sta (pETKCFG),y
sta DDP.GetNetInfo+S.DDP2.SRC.NOD
* clc
lda (pETKCFG)
inc
sta (pETKCFG)
rts
*--------------------------------------
@ -329,54 +402,45 @@ CS.RUN.GETNETINFO
>LDYAI DDP.GetNetInfo.LEN
>STYA.G DEV.IOCTL+S.IOCTL.BYTECNT
>PUSHW ETKCFG+S.NETCFG.DevID
lda #IOCTL.WRITE
jsr CS.RUN.IOCTL.A
ldx #IOCTL.WRITE
jsr CS.RUN.IOCTL.X
bcs .9
lda #TIMEOUT.MAX
sta TimeOut
.1 >SLEEP
dec TimeOut
beq .9
lda (pETKCFG)
bmi .8
>PUSHW ETKCFG+S.NETCFG.DevID
lda #IOCTL.READ
jsr CS.RUN.IOCTL.A
bcs .1
dec TimeOut
bne .1
sta hFrame
>SYSCALL GetMemPtr
>STYA ZPFrameBase
sec
rts
lda hFrame
>SYSCALL FreeMem
>LDYA L.MSG.PROBE.OK
.8 >LDYA L.MSG.PROBE.OK
>SYSCALL PutS
rts
.9 sec
rts
.9 rts
*--------------------------------------
CS.RUN.IOCTL >STYA.G DEV.IOCTL+S.IOCTL.BUFPTR
txa
>STA.G DEV.IOCTL+S.IOCTL.S
>PUSHB ETKCFG+S.NETCFG.DevID
lda #IOCTL.STATUS
ldx #IOCTL.STATUS
CS.RUN.IOCTL.A >PUSHA
CS.RUN.IOCTL.X >PUSHB DevID
txa
>PUSHA
>PUSHEA.G DEV.IOCTL
>SYSCALL IOCTL
rts
*--------------------------------------
CFG.EtcFiles >LDYAI 256
CS.RUN.EtcFiles >LDYAI 256
>SYSCALL GetMem
bcs .9
@ -386,22 +450,26 @@ CFG.EtcFiles >LDYAI 256
jsr CFG.Read.PrintF
jsr CFG.Read.HOSTNAME
lda ETKCFG+S.ETKCFG.OBJECT
ldy #S.ETKCFG.Object
lda (pETKCFG),y
bne .2
>LDYA L.ETKCFG.OBJECT
iny
bne .1
inc
lda pETKCFG
clc
adc #S.ETKCFG.Object+1
tay
lda pETKCFG+1
adc /S.ETKCFG.Object+1
.1 >PUSHYA
>PUSHYA
>PUSHW L.CFG.DefaultHost
>PUSHW A2osX.TIMER16
>PUSHBI 2
>SYSCALL SPrintF
lda #10
sta ETKCFG+S.ETKCFG.OBJECT
ldy #S.ETKCFG.Object
sta (pETKCFG),y
.2 lda CFG.hBuf1
>SYSCALL FreeMem
@ -417,6 +485,14 @@ CFG.Read.PrintF pha
rts
*--------------------------------------
CFG.Read.HOSTNAME
lda pETKCFG
clc
adc #S.ETKCFG.Object
sta ZPPtr1
lda pETKCFG+1
adc /S.ETKCFG.Object
sta ZPPtr1+1
>LDYA L.HOSTNAME
jsr CFG.Read.Open
bcs .9
@ -429,6 +505,7 @@ CFG.Read.HOSTNAME
lda (BufPtr)
beq .1 empty line...
cmp #'#
beq .1 comment...
@ -437,12 +514,13 @@ CFG.Read.HOSTNAME
.2 lda (BufPtr),y
beq .8 end of name
sta ETKCFG+S.ETKCFG.OBJECT+1,y
iny
sta (ZPPtr1),y
cpy #32
bne .2
.8 sty ETKCFG+S.ETKCFG.OBJECT
.8 tya
sta (ZPPtr1)
clc
.HS B0 BCS
@ -450,6 +528,7 @@ CFG.Read.HOSTNAME
jmp CFG.Read.Close
*--------------------------------------
CFG.Read.Result bcc .1
pha
>PUSHW L.MSG.CFG.KO
pla
@ -506,7 +585,9 @@ CS.DOEVENT lda (pEvent)
*--------------------------------------
CS.QUIT lda hLIBETALK
beq .8
>SYSCALL UnloadLib
.8 clc
rts
*--------------------------------------
@ -519,7 +600,7 @@ MSG.USAGE .CZ "Usage : ETCONFIG\r\n"
MSG.NODEV .CZ "EtherTalk not bound to any device."
*--------------------------------------
MSG1.DEV .CS "NIC Device Configuration :\r\n"
.CS " Device ID : $%h\r\n"
.CS " Device ID : %d\r\n"
.CS " Device Name : %s\r\n"
.CS " Device Type : %S\r\n"
.CZ " HW Address : %02h:%02h:%02h:%02h:%02h:%02h\r\n"
@ -537,7 +618,9 @@ MSG2.C .CZ "Configured"
MSG2.U .CZ "Not Configured"
MSG2.ADDR .CZ " Network/Node : %D/%d\r\n"
MSG2.ROUTER .CZ " Router : %D/%d\r\n"
MSG2.OBJECT .CZ " Object Name : %S\r\n"
MSG2.MCAST .CZ " Multicast @ : %h:%h:%h:%h:%h:%h\r\n"
MSG2.NETRANGE .CZ " Netrange : %D/%D\r\n"
MSG2.OBJECT .CZ " Object.Zone : %S@%S\r\n"
*--------------------------------------
MSG.CFG .CZ "ETCONFIG:Reading %s..."
MSG.CFG.KO .CZ "Not Found. [%h]\r\n"
@ -551,35 +634,40 @@ MSG.PROBE .CZ "ETCONFIG:Acquiring NODE..."
MSG.PROBE.KO .CZ "ETCONFIG:Time Out [%h].\r\n"
MSG.PROBE.OK .CZ "ETCONFIG:Success."
*--------------------------------------
ETKCFG .BS S.ETKCFG
CFG.hCfgFile .BS 1
CFG.hBuf1 .BS 1
*--------------------------------------
AARP.PRB .HS 090007FFFFFF S.ETH.DSTMAC
AARP.PRB.SRCMAC .BS 6
.DA #0,#36 S.ETH.802.3.LENGTH
.BS 6
.DA /AARP.PRB.DEND-AARP.PRB.LLC
.DA #AARP.PRB.DEND-AARP.PRB.LLC
AARP.PRB.LLC
.HS AA S.ETH.802.2.DSTSAP
.HS AA S.ETH.802.2.SRCSAP
.HS 03 S.ETH.802.2.CTRL
.HS 00.00.00.80.F3 S.ETH.SNAP.PROTO
.HS 00.00.00
.HS 80.F3 S.ETH.SNAP.PROTO
*--------------------------------------
.HS 00.01.80.9B.06.04
.HS 0003 Probe
AARP.PRB.SHA .BS 6
AARP.PRB.SPA .BS 4
AARP.PRB.THA .BS 6
AARP.PRB.TPA .BS 4
AARP.PRB.DEND .EQ *
.BS AARP.PRB+60-*
AARP.PRB.LEN .EQ 60
*--------------------------------------
DDP.GetNetInfo .HS 090007FFFFFF S.ETH.DSTMAC
.BS 6
.DA #0,#DDP.GetNetInfo.DEND-DDP.GetNetInfo.LLC
*--------------------------------------
.DA /DDP.GetNetInfo.DEND-DDP.GetNetInfo.LLC
.DA #DDP.GetNetInfo.DEND-DDP.GetNetInfo.LLC
DDP.GetNetInfo.LLC
.HS AA
.HS AA
.HS 03
.HS 08.00.07.80.9B
.HS 08.00.07
.HS 80.9B S.ETH.SNAP.PROTO
*--------------------------------------
DDP.GetNetInfo.DDP
.DA #0,#DDP.GetNetInfo.DEND-DDP.GetNetInfo.DDP
@ -600,6 +688,11 @@ DDP.GetNetInfo.DEND .EQ *
.BS DDP.GetNetInfo+60-*
DDP.GetNetInfo.LEN .EQ 60
*--------------------------------------
NBP.Browse .PS "="
.PS "="
.PS "*"
.HS 00
*--------------------------------------
.DUMMY
.OR 0
DS.START

View File

@ -23,7 +23,7 @@ GFX.TEXT ldy #S.PS.hStdIn
lda (pPS),y
tax
lda hFDs-1,x
lda FILEs.hFD-1,x
bra GFX.IOCTL
GFX.TEXT.RTS clc

View File

@ -189,18 +189,18 @@ CS.RUN.CheckArgs
ldy #S.PS.hStdIn
lda (pPS),y
tax
lda hFDs-1,x
>SYSCALL GetMemPtr
>STYA ZPPtr1
tay
ldx FILEs.hFD-1,y
lda FDs.pLO-1,x
sta ZPPtr1
lda FDs.pHI-1,x
sta ZPPtr1+1
lda (ZPPtr1)
cmp #S.FD.T.PIPE
bne .97
ldy #S.PS.hStdIn
lda (pPS),y
sta hFile
sty hFile
.8 clc

View File

@ -246,14 +246,12 @@ CS.RUN.DUMPNIC >PUSHW L.MSG1.DEV
lda IPCFG+S.NETCFG.DevID
>PUSHA
>SYSCALL GetMemPtr
pha
tya
tax
lda FDs.pLO-1,x
clc
adc #S.FD.DEV
tay
pla
lda FDs.pHI-1,x
adc /S.FD.DEV
>PUSHYA
@ -461,7 +459,7 @@ MSG.USAGE .CS "Usage : IPCONFIG <switches>\r\n"
MSG.NODEV .AZ "TCP/IP not bound to any device."
*--------------------------------------
MSG1.DEV .CS "NIC Device Configuration :\r\n"
.CS " Device ID : $%h\r\n"
.CS " Device ID : %d\r\n"
.CS " Device Name : %s\r\n"
.CS " Device Type : %S\r\n"
.CZ " HW Address : %02h:%02h:%02h:%02h:%02h:%02h\r\n"

View File

@ -5,7 +5,7 @@ NEW
.OR $2000
.TF bin/irc
*--------------------------------------
TLS .EQ 1
TLS .EQ 0
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
@ -637,18 +637,20 @@ CS.RUN.CMD.PRIVMSG
.1 iny
lda (ZPMsgPfxPtr),y
beq .2
eor #'!'
bne .1
sta (ZPMsgPfxPtr),y
.2 sta (ZPMsgPfxPtr),y
.2 >PUSHW L.SEQ.PRIVMSG
>PUSHW L.SEQ.PRIVMSG
>PUSHW ZPMsgPfxPtr
>PUSHW ZPMsgExtPtr
>PUSHBI 4
>SYSCALL PrintF
rts
*--------------------------------------
CS.RUN.CMD.MODE
@ -1091,7 +1093,7 @@ IRC.PRIVMSG .CZ "PRIVMSG %s :%s\r\n"
*--------------------------------------
SEQ.INIT .CZ "\ec\e(B\e)0\e[?7l\e[2;20r\e[22;1H\e[?7h"
SEQ.BAR .CZ "\e[?7l\e7\e[%d;1H\e[7m\e[37;40m%80s\e[0m\e8\e[?7h"
SEQ.TXTCLR .CZ "\e[22;1H\e[97;41m\e[K\r\n\e[K\r\n\e[K\e[22;1H"
SEQ.TXTCLR .CZ "\e[97;41m\e[24;1H\e[K\e[23;1H\e[K\e[22;1H\e[K"
SEQ.PRIVMSG .CZ "\e7\e[20;1H\r\n\e[93;44m\e[7m%s:\e[0m\e[93;44m%s\e[K\e8"
SEQ.DUMPMSG .CZ "\e7\e[20;1H\r\n\e[7m%s \e[0m%s %s %s\e8"
SEQ.INFOMSG .CZ "\e7\e[20;1H\e[92;44m%s\r\n\e8"

View File

@ -1,6 +1,5 @@
NEW
PREFIX
AUTO 4,1
AUTO 3,1
.LIST OFF
.OP 65C02
.OR $2000

View File

@ -97,10 +97,13 @@ CS.INIT clc
*--------------------------------------
CS.RUN ldy #S.PS.hStdOut
lda (pPS),y
tax
lda hFDs-1,x
>SYSCALL GetMemPtr
>STYA ZPPtr1
tay
ldx FILEs.hFD-1,y
lda FDs.pLO-1,x
sta ZPPtr1
lda FDs.pHI-1,x
sta ZPPtr1+1
lda (ZPPtr1)
* cmp #S.FD.T.REG
beq .10

View File

@ -14,7 +14,7 @@ NEW
.OR ZPBIN
ZS.START
ZPFDPtr .BS 2
Index .BS 1
hFD .BS 1
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
@ -37,14 +37,13 @@ CS.START cld
.DA CS.RUN
.DA CS.EVENT
.DA CS.QUIT
L.MSG0 .DA MSG0
L.MSG.Header .DA MSG.Header
L.MSG.FD .DA MSG.FD
L.MSG.DEV .DA MSG.DEV
L.MSG.DEV.ERR .DA MSG.DEV.ERR
L.MSG.DEV.DIB .DA MSG.DEV.DIB
L.MSG.DEV.C .DA MSG.DEV.C
L.MSG.DEV.NA .DA MSG.DEV.NA
L.MSG.DEV.B .DA MSG.DEV.B
L.MSG.PIPE .DA MSG.PIPE
L.NO.PATH .DA NO.PATH
J.FD .DA DumpFD.REG
.DA DumpFD.DIR
.DA DumpFD.CDEV
@ -66,59 +65,77 @@ L.FD.T .DA FD.T.REG
CS.INIT clc
rts
*--------------------------------------
CS.RUN >LDYA L.MSG0
CS.RUN >LDYA L.MSG.Header
>SYSCALL PutS
ldx #0
.1 stx Index
lda hFDs,x
ldx #1
.1 stx hFD
lda FDs.pHI-1,x
beq .7
>SYSCALL GetMemPtr
>STYA ZPFDPtr
sta ZPFDPtr+1
lda FDs.pLO-1,x
sta ZPFDPtr
jsr DumpFD
bcs .9
ldx Index
ldx hFD
.7 inx
cpx #K.hFD.MAX
cpx #K.FD.MAX+1
bne .1
lda #0
.8 lda #0
sec
.9 rts
*--------------------------------------
DumpFD lda (ZPFDPtr)
DumpFD >PUSHW L.MSG.FD
>PUSHB hFD
ldy #S.FD.DEV.BUSID
lda (ZPFDPtr),y
asl
asl
asl
asl
iny #S.FD.DEV.DEVID
ora (ZPFDPtr),y
>PUSHA
lda (ZPFDPtr) S.FD.T
tax
>PUSHW L.FD.T,x
ldy #S.FD.DEV.BUSPTR+1
>PUSHB (ZPFDPtr),y
dey
>PUSHB (ZPFDPtr),y
>PUSHBI 6
>SYSCALL PrintF
lda (ZPFDPtr)
tax
jmp (J.FD,x)
*--------------------------------------
DumpFD.REG
DumpFD.DIR
clc
rts
*--------------------------------------
DumpFD.CDEV
DumpFD.BDEV >PUSHW L.MSG.DEV
jsr DumpFD.T
lda ZPFDPtr
clc
adc #S.FD.DEV
tay
lda ZPFDPtr+1
adc /S.FD.DEV
>PUSHYA
ldy #S.FD.DEV.BUSPTR+1
>PUSHB (ZPFDPtr),y
dey
>PUSHB (ZPFDPtr),y
>PUSHBI 8
>PUSHBI 2
>SYSCALL PrintF
bcs .9
@ -138,8 +155,7 @@ DumpFD.BDEV >PUSHW L.MSG.DEV
>LEA.G DEV.DIB
>STYA.G DEV.IOCTL+S.IOCTL.BUFPTR
ldx Index
>PUSHB hFDs,x
>PUSHB hFD
>PUSHBI IOCTL.STATUS
>PUSHEA.G DEV.IOCTL
>SYSCALL IOCTL
@ -187,7 +203,7 @@ DumpFD.DevDIB >PUSHW L.MSG.DEV.DIB
bcs .9
>LDA.G DEV.DIB+S.DIB.S
bpl .4 char device...
bpl DumpFD.NA char device...
>PUSHW L.MSG.DEV.B
@ -196,58 +212,18 @@ DumpFD.DevDIB >PUSHW L.MSG.DEV.DIB
>PUSHB.G DEV.DIB+S.DIB.SIZE+1
>PUSHB.G DEV.DIB+S.DIB.SIZE
>PUSHBI 4
bra .8
.4 >PUSHW L.MSG.DEV.C
>PUSHBI 0
.8 >SYSCALL PrintF
>SYSCALL PrintF
.9 rts
*--------------------------------------
*--------------------------------------
DumpFD.REG
DumpFD.DIR
DumpFD.LNK
DumpFD.DSOCK
DumpFD.SSOCK clc
rts
*--------------------------------------
DumpFD.PIPE >PUSHW L.MSG.PIPE
DumpFD.SSOCK
DumpFD.PIPE
jsr DumpFD.T
jsr DumpFD.Name
>PUSHBI 6
>SYSCALL PrintF
clc
rts
*--------------------------------------
DumpFD.T ldx Index
>PUSHB hFDs,x
ldy #S.FD.DEV.BUSID
lda (ZPFDPtr),y
asl
asl
asl
asl
iny #S.FD.DEV.DEVID
ora (ZPFDPtr),y
>PUSHA
lda (ZPFDPtr) S.FD.T
tax
>PUSHW L.FD.T,x
rts
*--------------------------------------
DumpFD.Name ldx Index
lda hFDs.hName,x
beq .1
>SYSCALL GetMemPtr
>PUSHYA
rts
.1 >PUSHYA L.NO.PATH
DumpFD.NA >LDYA L.MSG.DEV.NA
>SYSCALL PutS
rts
*--------------------------------------
CS.EVENT sec
@ -257,16 +233,15 @@ CS.QUIT clc
rts
*--------------------------------------
CS.END
MSG0 .CZ "hFD ID Type Name Addr Status TP.ST IDString Version Size (BLK)"
MSG.DEV .CZ "%3d %h %4s %12s %H "
MSG.Header .CZ "hFD ID Type Addr Name Status TP.ST IDString Version Size (BLK)"
MSG.FD .CZ " %2h %h %4s %H "
MSG.DEV .CZ "%12s "
MSG.DEV.ERR .CZ "[%h] Device Error.\r\n"
MSG.DEV.DIB .CZ "%s %h.%h %16S %3d.%3d "
MSG.DEV.B .CZ "%10u\r\n"
MSG.DEV.C .CZ "n/a\r\n"
MSG.PIPE .CZ "%3d %h %4s %s\r\n"
MSG.DEV.NA .CZ "n/a"
*--------------------------------------
MSG.SFLAGS .AS "bwrlneio"
NO.PATH .AZ "(no path)"
*--------------------------------------
FD.T.REG .AZ "REG"
FD.T.DIR .AZ "DIR"

View File

@ -14,6 +14,7 @@ NEW
.OR ZPBIN
ZS.START
ZPFDPtr .BS 2
ZPFNPtr .BS 2
FILE.ID .BS 2
ZS.END .ED
*--------------------------------------
@ -37,8 +38,7 @@ CS.START cld
.DA CS.EVENT
.DA CS.QUIT
L.MSG.HEADER .DA MSG.HEADER
L.MSG.BODY .DA MSG.REGDIR
.DA MSG.SPECIAL
L.MSG.BODY .DA MSG.BODY
L.FD.T .DA FD.T.REG
.DA FD.T.DIR
.DA FD.T.CDEV
@ -59,72 +59,59 @@ CS.RUN >LDYA L.MSG.HEADER
.1 stx FILE.ID
lda hFDs-1,x
ldy FILEs.hFD-1,x
beq .7
lda FDs.pLO-1,y
sta ZPFDPtr
lda FDs.pHI-1,y
sta ZPFDPtr+1
>SYSCALL GetMemPtr
>STYA ZPFDPtr
ldx FILE.ID
lda hFDs.oCnt-1,x
beq .7
ldy #0
lda (ZPFDPtr)
cmp #S.FD.T.DIR+1
bcc .2
iny
iny
.2 >PUSHW L.MSG.BODY,y
>PUSHW L.MSG.BODY
txa
>PUSHA
lda hFDs-1,x
>PUSHA
lda hFDs.oCnt-1,x
>PUSHA
lda (ZPFDPtr)
tay
>PUSHW L.FD.T,y
jsr CS.RUN.GetName
lda FILEs.hFD-1,x
>PUSHA
>PUSHYA
>PUSHW ZPFDPtr
>PUSHBI 7
lda FILEs.oCnt-1,x
>PUSHA
>SYSCALL PrintF
lda FILEs.hName-1,x
beq .2
.7 ldx FILE.ID
inx
cpx #K.hFD.MAX+1
bne .1
lda #0
sec
.9 rts
*--------------------------------------
CS.RUN.GetName lda hFDs.hName-1,x
bne .1
lda ZPFDPtr
>SYSCALL GetMemPtr
bra .6
.2 lda ZPFDPtr
clc
adc #S.FD.DEV
tay
lda ZPFDPtr+1
adc /S.FD.DEV
rts
.6 >PUSHYA
.1 >SYSCALL GetMemPtr
>PUSHBI 9
rts
>SYSCALL PrintF
* bcs .9
.7 ldx FILE.ID
inx
cpx #K.FILE.MAX+1
bcc .1
lda #0
* sec
.9 rts
*--------------------------------------
CS.EVENT sec
rts
@ -133,9 +120,8 @@ CS.QUIT clc
rts
*--------------------------------------
CS.END
MSG.HEADER .CZ "hFILE hFD Cnt Type Filepath"
MSG.REGDIR .CZ "%3d %3d %3d %4s %s\r\n"
MSG.SPECIAL .CZ "%3d %3d %3d %4s /dev/%s\r\n"
MSG.HEADER .CZ "hFILE Type hFD pFD Cnt Filepath"
MSG.BODY .CZ " %3d %4s %3d %H %3d %s\r\n"
FD.T.REG .CZ "REG"
FD.T.DIR .CZ "DIR"
FD.T.CDEV .CZ "CDEV"

View File

@ -373,7 +373,7 @@ CS.RUN.PRINTMEMX
*--------------------------------------
CS.RUN.CHECKPS ldx #0
.1 cmp PS.Table.PID,x
.1 cmp PSs.PID,x
beq .8
inx

View File

@ -59,7 +59,7 @@ CS.START cld
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.DOEVENT
.DA CS.QUIT
L.MSG.USAGE .DA MSG.USAGE
L.MSG.Init .DA MSG.Init
@ -78,7 +78,7 @@ CS.RUN inc ArgCount
cmp #'-'
bne .4
ldy #1
ldy #1
lda (ZPPtr1),y
beq .99
@ -89,7 +89,7 @@ CS.RUN inc ArgCount
dex
bpl .2
.99 >LDYA L.MSG.USAGE
>SYSCALL PutS
lda #E.SYN
@ -100,11 +100,11 @@ CS.RUN inc ArgCount
tax
sec
ror $0,x
iny
lda (ZPPtr1),y
bne .1
bra CS.RUN
.4 lda hFile
@ -128,23 +128,20 @@ CS.RUN inc ArgCount
ldy #S.PS.hStdIn
lda (pPS),y
pha
tax
tay
ldx FILEs.hFD-1,y
lda FDs.pLO-1,x
sta ZPPtr1
lda FDs.pHI-1,x
sta ZPPtr1+1
lda hFDs-1,x
>SYSCALL GetMemPtr
>STYA ZPPtr1
plx
lda (ZPPtr1)
cmp #S.FD.T.PIPE
bne .71
stx hFile
sty hFile
.80 >LDYAI 256
>SYSCALL GetMem
bcs .9
@ -155,7 +152,7 @@ CS.RUN inc ArgCount
>PUSHW L.MSG.Init
>PUSHBI 0
>SYSCALL PrintF
*--------------------------------------
*--------------------------------------
CS.RUN.LOOP jsr CS.RUN.GETLINE
bcs .9
@ -196,7 +193,7 @@ CS.RUN.OPEN >PUSHYA
>PUSHBI O.RDONLY+O.TEXT
>PUSHBI S.FI.T.TXT
>PUSHWZ Aux type
>SYSCALL FOpen
bcs .9
@ -209,7 +206,7 @@ CS.RUN.PAUSE ldy #S.PS.hStdErr
>PUSHA
>PUSHW L.MSG.Pause
>SYSCALL FPutS
.10 ldy #S.PS.hStdErr
lda (pPS),y
>SYSCALL GetC
@ -261,7 +258,7 @@ CS.RUN.ERASE ldy #S.PS.hStdErr
rts
*--------------------------------------
CS.RUN.GETLINE >PUSHB hFile
>PUSHW ZPBufPtr
>PUSHWI 256
>SYSCALL FGetS

View File

@ -7,6 +7,7 @@ NEW
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/kernel.i
.INB inc/eth.i
.INB inc/net.tcpip.i
.INB inc/libtcpip.i
@ -15,8 +16,7 @@ NEW
.OR ZPBIN
ZS.START
ZPPTR1 .BS 2
ZPPTR2 .BS 2
SocketIndex .BS 1
FDIndex .BS 1
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
@ -76,19 +76,24 @@ CS.INIT >LDYA L.LIBTCPIP
CS.RUN >LDYA L.MSG0
>SYSCALL PutS
>LIBCALL hLIBTCPIP,LIBTCPIP.GetTable
>STYA ZPPTR1
inc FDIndex
ldx FDIndex
ldy SocketIndex
.1 lda (ZPPTR1),y
.1 lda FDs.pHI-1,x
beq .7
>SYSCALL GetMemPtr
>STYA ZPPTR2
ldy FDs.pLO-1,x
>STYA ZPPTR1
ldy #S.SOCKET.AF
lda (ZPPTR2),y
lda (ZPPTR1)
cmp #S.FD.T.DSOCK
beq .2
cmp #S.FD.T.SSOCK
bne .7
.2 ldy #S.SOCKET.AF
lda (ZPPTR1),y
cmp #AF.INET
bne .7
@ -103,7 +108,7 @@ CS.RUN >LDYA L.MSG0
jsr CS.RUN.A
ldy #S.SOCKET.O
>PUSHB (ZPPTR2),y
>PUSHB (ZPPTR1),y
jsr CS.RUN.S 2 bytes
>PUSHBI 19
@ -111,17 +116,17 @@ CS.RUN >LDYA L.MSG0
>SYSCALL PrintF
bcs .9
.7 inc SocketIndex
ldy SocketIndex
cpy #K.SKTTABLE.SIZE
bne .1
.7 inc FDIndex
ldx FDIndex
cpx #K.FD.MAX+1
bcc .1
lda #0 tell TSKMGR that all done ok, but
sec we do not want to stay in memory
* sec we do not want to stay in memory
.9 rts
*--------------------------------------
CS.RUN.TP ldy #S.SOCKET.T
lda (ZPPTR2),y
lda (ZPPTR1),y
tax
cpx #S.SOCKET.T.STREAM+1
bcc .1
@ -132,7 +137,7 @@ CS.RUN.TP ldy #S.SOCKET.T
>PUSHB L.MSG1.T,x
ldy #S.SOCKET.PROTO
lda (ZPPTR2),y
lda (ZPPTR1),y
ldx #0
@ -152,20 +157,20 @@ CS.RUN.TP ldy #S.SOCKET.T
*--------------------------------------
CS.RUN.A ldx #4
.2 >PUSHB (ZPPTR2),y
.2 >PUSHB (ZPPTR1),y
iny
dex
bne .2
iny
>PUSHB (ZPPTR2),y
>PUSHB (ZPPTR1),y
dey
>PUSHB (ZPPTR2),y
>PUSHB (ZPPTR1),y
rts
*--------------------------------------
CS.RUN.S ldy #S.SOCKET.TCP.S
lda (ZPPTR2),y
lda (ZPPTR1),y
cmp #S.SOCKET.TCP.S.TIMEWT+1
bcc .1

View File

@ -1,8 +1,8 @@
NEW
AUTO 3,1
.LIST OFF
.OP 65C02
.OR $2000
.OP 65C02
.OR $2000
.TF bin/nl
*--------------------------------------
.INB inc/macros.i
@ -160,18 +160,18 @@ CS.RUN.CheckArgs
ldy #S.PS.hStdIn
lda (pPS),y
tax
lda hFDs-1,x
>SYSCALL GetMemPtr
>STYA ZPPtr1
tay
ldx FILEs.hFD-1,y
lda FDs.pLO-1,x
sta ZPPtr1
lda FDs.pHI-1,x
sta ZPPtr1+1
lda (ZPPtr1)
cmp #S.FD.T.PIPE
bne .97
ldy #S.PS.hStdIn
lda (pPS),y
sta hFile
sty hFile
inc bPipe
.80 >LDYAI 256
@ -217,10 +217,12 @@ CS.RUN.OPEN >PUSHYA
*--------------------------------------
CS.RUN.ISATTY ldy #S.PS.hStdOut
lda (pPS),y
tax
lda hFDs-1,x
>SYSCALL GetMemPtr
tay
ldx FILEs.hFD-1,y
ldy FDs.pLO-1,x
lda FDs.pHI-1,x
>STYA ZPPtr1
lda (ZPPtr1)
beq .9

View File

@ -27,7 +27,7 @@ bPipe .BS 1
bIsTTY .BS 1
bTemp .BS 1
bDummy .BS 1
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
@ -48,7 +48,7 @@ CS.START cld
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.DOEVENT
.DA CS.QUIT
L.MSG.USAGE .DA MSG.USAGE
L.MSG.CRLF .DA MSG.CRLF
@ -86,11 +86,11 @@ CS.RUN.LOOP lda bPipe If reading from pipe
beq .9
cmp #$13 Ctrl-S
bne .1
lda bPause
eor #$ff
sta bPause
bne CS.RUN.LOOP
bne CS.RUN.LOOP
.1 lda bPause
bne CS.RUN.LOOP
@ -117,75 +117,75 @@ CS.RUN.LOOP.RTS rts
CS.RUN.CheckArgs
jsr CS.RUN.NextArg
bcs .4
lda (ZPPtr1)
cmp #'-'
beq .1
.11 lda hFile
bne .97
>LDYA ZPPtr1
jsr CS.RUN.OPEN
bcs .9
sta hFile
bra CS.RUN.CheckArgs
.1 ldy #1
.1 ldy #1
lda (ZPPtr1),y
ldx #OptionList.Cnt-1
.2 cmp OptionList,x
beq .3
dex
bpl .2
bra .97
.3 txa
lsr
beq .98
tax
lda #$80
sta bDummy-1,x
sta bDummy-1,x
bra CS.RUN.CheckArgs
.4 lda hFile
bne .80
ldy #S.PS.hStdIn
lda (pPS),y
tax
lda hFDs-1,x
>SYSCALL GetMemPtr
>STYA ZPPtr1
tay
ldx FILEs.hFD-1,y
lda FDs.pLO-1,x
sta ZPPtr1
lda FDs.pHI-1,x
sta ZPPtr1+1
lda (ZPPtr1)
cmp #S.FD.T.PIPE
bne .97
ldy #S.PS.hStdIn
lda (pPS),y
sta hFile
inc bPipe
sty hFile
inc bPipe
.80 >LDYAI 256
>SYSCALL GetMem
bcs .9
>STYA ZPBufPtr
stx hBuf
* clc
.9 rts
.97 lda #E.SYN
.98 pha
>PUSHW L.MSG.USAGE
>PUSHBI 0
@ -215,7 +215,7 @@ CS.RUN.OPEN >PUSHYA
CS.RUN.ISATTY ldy #S.PS.hStdOut
lda (pPS),y
tax
lda hFDs-1,x
lda FILEs.hFD-1,x
>SYSCALL GetMemPtr
>STYA ZPPtr1
lda (ZPPtr1)
@ -254,7 +254,7 @@ CS.RUN.PRINTBYTE
pla Character
pha
sta (ZPBufPtr),y
>PUSHW L.MSG.HEXBYTE
pla
>PUSHA
@ -317,7 +317,7 @@ CS.RUN.FINISHUP
>SYSCALL PutChar
lda #' '
>SYSCALL PutChar
lda #' '
lda #' '
>SYSCALL PutChar
pla
inc

View File

@ -283,7 +283,7 @@ CS.RUN.FILE jsr CS.RUN.BuildFilePath
>PUSHW ZPFullPath
>LDA.G hArcFile
tay
lda hFDs.hName-1,y
lda FILEs.hName-1,y
>SYSCALL GetMemPtr
>PUSHYA
>SYSCALL StrCmp

View File

@ -67,7 +67,7 @@ CS.RUN lda #1
* ldx #0
.11 cmp PS.Table.PID,x
.11 cmp PSs.PID,x
beq .12
inx
@ -78,7 +78,7 @@ CS.RUN lda #1
* sec
rts
.12 lda PS.Table.hPS,x
.12 lda PSs.hPS,x
jsr CS.RUN.DUMP
bcs .9
@ -90,7 +90,7 @@ CS.RUN lda #1
>SYSCALL PutS
ldx Index
.1 lda PS.Table.hPS,x
.1 lda PSs.hPS,x
beq .7
jsr CS.RUN.DUMP
@ -115,7 +115,7 @@ CS.RUN.DUMP >SYSCALL GetMemPtr
>PUSHW L.MSG1
ldx Index
lda PS.Table.hPS,x
lda PSs.hPS,x
>PUSHA
ldy #S.PS.PPID
@ -126,7 +126,7 @@ CS.RUN.DUMP >SYSCALL GetMemPtr
cpy #S.PS.CPID+1
bne .1
lda PS.Table.Stats,x
lda PSs.Stats,x
>PUSHA CPU%
ldy #S.PS.S
@ -141,7 +141,7 @@ CS.RUN.DUMP >SYSCALL GetMemPtr
ldy #S.PS.hSession
lda (ZPPSPtr),y
tax
lda S.Table.hSID-1,x
lda USRs.hSID-1,x
>SYSCALL GetStkObj
bcs .9

View File

@ -145,18 +145,18 @@ CS.RUN.CheckArgs
ldy #S.PS.hStdIn
lda (pPS),y
tax
tay
ldx FILEs.hFD-1,y
lda FDs.pLO-1,x
sta ZPPtr1
lda FDs.pHI-1,x
sta ZPPtr1+1
lda hFDs-1,x
>SYSCALL GetMemPtr
>STYA ZPPtr1
lda (ZPPtr1)
lda (ZPPtr1)
cmp #S.FD.T.PIPE
bne .97
ldy #S.PS.hStdIn
lda (pPS),y
sta hFile
sty hFile
.80 >LDYAI 256
>SYSCALL GetMem

View File

@ -51,7 +51,7 @@ IO.Reset.In sec
.8 clc
rts
*--------------------------------------
IO.Pipe.Out >PUSHEA.G IO.DEVFIFO
IO.Pipe.Out >PUSHEA.G IO.TMPFIFO
>PUSHWZ mode
>SYSCALL MKFIFO
bcs .9
@ -128,8 +128,8 @@ IO.Pipe.OpenR ldx #O.RDONLY+O.TEXT
bra IO.Pipe.Open
IO.Pipe.OpenW ldx #O.WRONLY+O.TEXT
IO.Pipe.Open >LEA.G IO.DEVFIFO
IO.Pipe.Open >LEA.G IO.TMPFIFO
*--------------------------------------
IO.FOpenYAX >PUSHYA
txa

View File

@ -780,7 +780,7 @@ Sleep .BS 4
*M32.BUF .BS 12 -1234567890\0
TimeBuf .EQ *
M32.BUF .EQ *
IO.DEVFIFO .BS 12 /dev/fifoXX\0
IO.TMPFIFO .BS 12 /tmp/fifoXX\0
*--------------------------------------
DS.END .ED
*--------------------------------------

View File

@ -186,7 +186,7 @@ CS.RUN.PS stz Count
ldx #0
stx Index
.1 lda PS.Table.hPS,x
.1 lda PSs.hPS,x
beq .7
>SYSCALL GetMemPtr
@ -257,11 +257,11 @@ CS.RUN.KILL >PUSHW L.MSG.PS
>SYSCALL Kill
rts
*--------------------------------------
CS.RUN.DEV ldx #K.hFD.MAX
CS.RUN.DEV ldx #K.FILE.MAX
.1 dex
stx Index
lda hFDs,x
lda FILEs.hFD,x
beq .7
>SYSCALL GetMemPtr
@ -282,7 +282,7 @@ CS.RUN.DEV ldx #K.hFD.MAX
>SYSCALL PrintF
ldx Index
>PUSHB hFDs,x
>PUSHB FILEs.hFD,x
>PUSHBI IOCTL.CLOSE
>PUSHWZ
>SYSCALL IOCTL
@ -341,7 +341,7 @@ CS.RUN.SYS stz $280
*--------------------------------------
CS.GetPSByID ldx #0
.1 ldy PS.Table.hPS,x
.1 ldy PSs.hPS,x
beq .7
pha

View File

@ -119,10 +119,13 @@ CS.RUN inc ArgIndex
ldy #S.PS.hStdIn
lda (pPS),y
tax
lda hFDs-1,x
>SYSCALL GetMemPtr
>STYA ZPPtr1
tay
ldx FILEs.hFD-1,y
lda FDs.pLO-1,x
sta ZPPtr1
lda FDs.pHI-1,x
sta ZPPtr1+1
lda (ZPPtr1)
cmp #S.FD.T.PIPE
bne .9

View File

@ -52,7 +52,7 @@ CS.RUN >LDYA L.MSG0
ldx #1
stx SessionID
.1 lda S.Table.hSID-1,x
.1 lda USRs.hSID-1,x
beq .7
>SYSCALL GetStkObj
@ -63,7 +63,7 @@ CS.RUN >LDYA L.MSG0
>PUSHB SessionID 1 byte SID
ldx SessionID
lda S.Table.hSID-1,x
lda USRs.hSID-1,x
>PUSHA 1 byte hSession
>PUSHB (ZPSessionPtr) 1 byte PRIVILEGE
@ -101,14 +101,17 @@ CS.RUN >LDYA L.MSG0
.9 rts
*--------------------------------------
CS.RUN.GetDevName
lda S.Table.hFile-1,x
lda USRs.hFile-1,x
>PUSHA
tax
lda hFDs.hName-1,x
lda FILEs.hName-1,x
bne .1
lda hFDs-1,x
>SYSCALL GetMemPtr
lda FILEs.hFD-1,x
tay
ldx FILEs.hFD-1,y
ldy FDs.pLO-1,x
lda FDs.pHI-1,x
>STYA ZPFDPtr
lda ZPFDPtr

View File

@ -133,18 +133,18 @@ CS.RUN.CheckArgs
ldy #S.PS.hStdIn
lda (pPS),y
tax
lda hFDs-1,x
>SYSCALL GetMemPtr
>STYA ZPPtr1
tay
ldx FILEs.hFD-1,y
lda FDs.pLO-1,x
sta ZPPtr1
lda FDs.pHI-1,x
sta ZPPtr1+1
lda (ZPPtr1)
cmp #S.FD.T.PIPE
bne .97
ldy #S.PS.hStdIn
lda (pPS),y
sta hFile
sty hFile
.80 >LDYAI 256
>SYSCALL GetMem

View File

@ -7,6 +7,7 @@ NEW
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/kernel.i
.INB inc/mli.e.i
.INB inc/nic.i
.INB inc/eth.i
@ -485,10 +486,11 @@ DEVSLOTx0 .BS 1
*--------------------------------------
DIB .DA #0
.DA #0,#0,#0 size
.PS "dan2eth/W5500 "
.PS "dan2eth/W5500"
.BS 3
.DA #S.DIB.T.NIC
.BS 1 Subtype
.BS 2 Version
.DA K.VER Version
*--------------------------------------
DCB .DA #S.DCB.T.NIC
.BS 1 FLAGS

View File

@ -197,7 +197,7 @@ OSD.GETTEXTSIZE clc
sta CBX.Cache+S.CB.SrcH
stz CBX.Cache+S.CB.SrcH+1
.3 jsr OSD.TXTPTR.GetNext
.3 jsr OSD.TXTPTRgn
beq .4
jsr OSD.FON.GetChar
@ -237,7 +237,7 @@ OSD.GETTEXTSIZE clc
stz GWORD+1 reset Bit index in Col
OSD.DRAWTEXT.LOOP
jsr OSD.TXTPTR.GetNext
jsr OSD.TXTPTRgn
beq OSD.DRAWTEXT.END
jsr OSD.FON.GetChar
@ -602,8 +602,7 @@ CB.Update sta CLRWRITEAUX
clc
rts
*--------------------------------------
OSD.TXTPTR.GetNext
jmp ($a000)
OSD.TXTPTRgn jmp ($a000)
*--------------------------------------
CBX.CmdLen .DA #S.CB.Y1+1 SETPIXEL
.DA #S.CB.Y1+1 GETPIXEL

View File

@ -7,6 +7,7 @@ NEW
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/kernel.i
.INB inc/mli.i
.INB inc/mli.e.i
.INB inc/io.i
@ -634,7 +635,7 @@ DIB .DA #0
.BS 3
.DA #S.DIB.T.GFX
.DA #0
.DA #00,#94
.DA K.VER
*--------------------------------------
DCB .DA #S.DCB.T.GFX
.BS 1 DEV.ID

View File

@ -7,6 +7,7 @@ NEW
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/kernel.i
.INB inc/io.i
.INB inc/mli.e.i
.INB inc/xy.i
@ -377,8 +378,8 @@ DIB .DA #0
.PS "Apple II Mouse"
.BS 2
.DA #S.DIB.T.XY
.DA #0
.DA #0,#94
.BS 1 Subtype
.DA K.VER Version
*--------------------------------------
DRV.END
*--------------------------------------

16
DRV/UDETH.D.DRV.S.txt Normal file
View File

@ -0,0 +1,16 @@
NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
UDETHDMA .EQ 1
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/mli.e.i
.INB inc/nic.i
.INB inc/eth.i
.INB usr/src/shared/x.udeth.drv.s
*--------------------------------------
MAN
SAVE usr/src/drv/udeth.d.drv.s
ASM

View File

@ -1,540 +1,16 @@
NEW
AUTO 3,1
.LIST OFF
.OP 65C02
.OR $2000
.TF drv/udeth.drv
*--------------------------------------
UDETHDMA .EQ 0
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/mli.e.i
.INB inc/nic.i
.INB inc/eth.i
.INB usr/src/shared/x.udeth.drv.s
*--------------------------------------
UD.ROM.SignOfs .EQ $EC "UltimateDrive"
UD.ROM.VerOfs .EQ $F9 MAX/MIN
UD.IO.Exec .EQ $C080 Write
UD.IO.Status .EQ $C081 Read
UD.IO.Cmd .EQ $C082 Write
UD.IO.Cmd.NetOpen .EQ $70
UD.IO.Cmd.NetClose .EQ $71
UD.IO.Cmd.NetSend .EQ $72
UD.IO.Cmd.NetRcvd .EQ $73
UD.IO.Cmd.NetPeek .EQ $74
UD.IO.Cmd.NetStatus .EQ $75
UD.IO.UnitNum .EQ $C083 Write
UD.IO.MemPtrL .EQ $C084
UD.IO.MemPtrH .EQ $C085
UD.IO.BlockNum .EQ $C086 Write 4 bytes, BE
UD.IO.RData .EQ $C087 Read
UD.IO.WData .EQ $C088 Write
UD.IO.DoDMA .EQ $C089 Write
UD.IO.Mode .EQ $C08D Read NZ = DMA, Write b7
*--------------------------------------
.DUMMY
.OR ZPBIN
ZS.START
ZPPtr1 .BS 2
ZPArgPtr .BS 2
DEVSLOT0x .BS 1
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp Dev.Detect cld,jmp abs=DRV
.DA #$61 6502,Level 1 (65c02)
.DA #1 DRV Layout Version 1
.DA 0
.DA CS.END-CS.START Code Length
.DA 0
.DA 0
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
L.MSG.DETECT .DA MSG.DETECT
L.MSG.DETECT.OK .DA MSG.DETECT.OK
L.MSG.DETECT.KO .DA MSG.DETECT.KO
L.DRV.CS.START .DA DRV.CS.START
L.FD.DEV .DA FD.DEV
L.FD.DEV.NAME .DA FD.DEV.NAME
L.SSCANF.MAC .DA SSCANF.MAC
L.MAC0 .DA DCB+S.DCB.NIC.MAC
.DA DCB+S.DCB.NIC.MAC+1
.DA DCB+S.DCB.NIC.MAC+2
.DA DCB+S.DCB.NIC.MAC+3
.DA DCB+S.DCB.NIC.MAC+4
.DA DCB+S.DCB.NIC.MAC+5
.DA 0 End Of Reloc Table
*--------------------------------------
Dev.Detect >STYA ZPArgPtr
>LDYA L.MSG.DETECT
>SYSCALL PutS
lda #UD.ROM.SignOfs
sta ZPPtr1
lda #$C7
.1 sta ZPPtr1+1
ldy #ROM.SIG.L-1
.10 lda (ZPPtr1),y
cmp ROM.SIG,y
bne .2
dey
bpl .10
lda ZPPtr1+1
and #$0F
sta DEVSLOT0x
asl
asl
asl
asl
sta DEVSLOTx0
bra .3
.2 dec FD.DEV.NAME+3
lda ZPPtr1+1
dec
cmp #$C0
bne .1
>LDYA L.MSG.DETECT.KO
>SYSCALL PutS
lda #MLI.E.NODEV
sec
.99 rts
*--------------------------------------
.3 ldy #UD.ROM.VerOfs
lda (ZPPtr1),y
sta DIB+S.DIB.VERSION+1
iny
lda (ZPPtr1),y
sta DIB+S.DIB.VERSION
jsr Dev.ParseArgs
bcs .99
.8 >PUSHW L.MSG.DETECT.OK
>PUSHW L.FD.DEV.NAME
>PUSHBI 2
>SYSCALL PrintF
>PUSHWI DRV.END
>PUSHWI DRV.CS.END-DRV.CS.START
>PUSHWI DRV.CS.START
>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
>SYSCALL MKDev
bcs .9
ldx DEVSLOT0x
lda #A2osX.S.NIC
sta A2osX.S,x
* clc
.9 rts
*--------------------------------------
Dev.ParseArgs lda (ZPArgPtr)
bne .1
lda A2osX.RANDOM16
eor A2osX.TIMER16
sta DCB+S.DCB.NIC.MAC+3
eor A2osX.RANDOM16+1
sta DCB+S.DCB.NIC.MAC+4
eor A2osX.TIMER16+1
sta DCB+S.DCB.NIC.MAC+5
clc
rts
.1 >PUSHW ZPArgPtr
>PUSHW L.SSCANF.MAC
ldx #0
.2 >PUSHW L.MAC0,x
inx
inx
cpx #12
bne .2
>PUSHBI 12 6 x byte PTRs
>SYSCALL SScanF
bcc .8
lda #E.SYN
* sec
.8 rts
*--------------------------------------
CS.END
MSG.DETECT .CZ "Ultimate Drive ETH/W5500 Driver."
MSG.DETECT.OK .CZ "Ultimate Drive ETH/W5500 Installed As Device : %s\r\n"
MSG.DETECT.KO .CZ "Hardware Not Found."
SSCANF.MAC .CZ "%h:%h:%h:%h:%h:%h"
ROM.SIG .AS "UltimateDrive"
ROM.SIG.L .EQ *-ROM.SIG
*--------------------------------------
FD.DEV .DA #S.FD.T.CDEV
.DA #0 HANDLER
.DA #0 BUSID
.DA #0 DEVID
.DA 0 BUSPTR
.BS 2 DRVPTR
.DA 0 DCBPTR
.DA 0 BUFPTR
FD.DEV.NAME .AZ "eth7"
*--------------------------------------
* Driver Code
*--------------------------------------
* https://github.com/profdc9/ip65/blob/main/drivers/dan2d.s
*--------------------------------------
ZPIOCTL .EQ ZPDRV
ZPBufPtr .EQ ZPDRV+2
Counter .EQ ZPDRV+4
*--------------------------------------
DRV.CS.START cld
jmp (.1,x)
.1 .DA STATUS
.DA A2osX.BADCALL
.DA A2osX.BADCALL
.DA A2osX.BADCALL
.DA A2osX.BADCALL
.DA A2osX.BADCALL
.DA OPEN
.DA CLOSE
.DA READ
.DA WRITE
.DA 0 end or relocation
*--------------------------------------
STATUS >STYA ZPIOCTL
jsr IO.GetStatus
bcs STATUS.99
ldy #S.IOCTL.S
lda (ZPIOCTL),y
beq .1
cmp #S.IOCTL.S.GETDIB
bne STATUS.DCB
ldx #S.DIB-1
.HS 2C bit abs
.1 ldx #3
ldy #S.IOCTL.BUFPTR
lda (ZPIOCTL),y
sta .3+1
iny
lda (ZPIOCTL),y
sta .3+2
.2 lda DIB,x
.3 sta $ffff,x SELF MODIFIED
dex
bpl .2
clc
rts
STATUS.DCB cmp #S.IOCTL.S.GETDCB
bne STATUS.9
stz DCB+S.DCB.NIC.LINK
lda #S.DCB.NIC.LINK.OK
tsb DCB+S.DCB.NIC.LINK
lda #S.DCB.NIC.LINK.FD
tsb DCB+S.DCB.NIC.LINK
.1 ldy #S.IOCTL.BUFPTR
lda (ZPIOCTL),y
sta .3+1
iny
lda (ZPIOCTL),y
sta .3+2
ldx #S.DCB.NIC-1
.2 lda DCB,x
.3 sta $ffff,x SELF MODIFIED
dex
bpl .2
clc
rts
STATUS.9 lda #MLI.E.BADCTL
STATUS.99 sec
rts
*--------------------------------------
OPEN lda #S.DIB.S.OPENED
bit DIB+S.DIB.S
bne .9
jsr CLOSE
* ldx DEVSLOTx0 Done by CLOSE
lda #UD.IO.Cmd.NetOpen
jsr IO.ExecA
bcs .99
ldy #0
.1 lda UD.IO.RData,x
sta DCB+S.DCB.NIC.MAC,y
iny
cpy #6
bcc .1
lda #S.DIB.S.OPENED
tsb DIB+S.DIB.S
clc
rts
.9 lda #MLI.E.OPEN
sec
.99 rts
*--------------------------------------
CLOSE ldx DEVSLOTx0
lda #UD.IO.Cmd.NetClose
jsr IO.ExecA
bcs .9
lda #S.DIB.S.OPENED
trb DIB+S.DIB.S
* clc
.9 rts
*--------------------------------------
READ php
sei
>STYA ZPIOCTL
ldx DEVSLOTx0
lda #UD.IO.Cmd.NetPeek
jsr IO.ExecA
bcs READWRITE.99
lda UD.IO.RData,x
sta Counter
lda UD.IO.RData,x
sta Counter+1
ora Counter
beq READWRITE.9
>LDYA Counter
>SYSCALL2 GetMem
bcs READWRITE.99
>STYA ZPBufPtr
stx .8+1
phy
ldy #S.IOCTL.BUFPTR+1
sta (ZPIOCTL),y
dey
pla
sta (ZPIOCTL),y
ldx DEVSLOTx0
lda #UD.IO.Cmd.NetRcvd
jsr IO.ExecA
bcs READWRITE.99
lda UD.IO.RData,x
ldy #S.IOCTL.BYTECNT
sta (ZPIOCTL),y
eor #$ff
sta Counter
lda UD.IO.RData,x
iny
sta (ZPIOCTL),y
eor #$ff
sta Counter+1
ldy #0
.2 inc Counter
bne .3
inc Counter+1
beq .8
.3 lda UD.IO.RData,x
sta (ZPBufPtr),y
iny
bne .2
inc ZPBufPtr+1
bra .2
.8 lda #$ff SELF MODIFIED
plp
clc
rts
*--------------------------------------
READWRITE.9 lda #E.NODATA
READWRITE.99 plp
sec
rts
*--------------------------------------
WRITE php
sei
>STYA ZPIOCTL
ldx DEVSLOTx0
lda #UD.IO.Cmd.NetSend
sta UD.IO.Cmd,x
ldy #S.IOCTL.BYTECNT
lda (ZPIOCTL),y
sta UD.IO.WData,x
lda (ZPIOCTL),y
eor #$ff
sta Counter
iny
lda (ZPIOCTL),y
sta UD.IO.WData,x
eor #$ff
sta Counter+1
ldy #S.IOCTL.BUFPTR
lda (ZPIOCTL),y
sta ZPBufPtr
iny
lda (ZPIOCTL),y
sta ZPBufPtr+1
ldy #S.ETH.SRCMAC+5
ldx #5
.10 lda DCB+S.DCB.NIC.MAC,x
sta (ZPBufPtr),y
dey
dex
bpl .10
ldx DEVSLOTx0
ldy #0
.1 inc Counter
bne .2
inc Counter+1
beq .8
.2 lda (ZPBufPtr),y
sta UD.IO.WData,x
iny
bne .1
inc ZPBufPtr+1
bra .1
.8 jsr IO.Exec
bcs WRITE.99
plp
clc
rts
WRITE.99 lda #MLI.E.IO
plp
sec
rts
*--------------------------------------
IO.GetStatus stz DCB+S.DCB.NIC.LINK
lda #S.DCB.NIC.SPEED.10
sta DCB+S.DCB.NIC.SPEED
ldx DEVSLOTx0
lda #UD.IO.Cmd.NetStatus
jsr IO.ExecA
bcs .99
lda UD.IO.RData,x PHYCFGR
lsr CS if Link OK
ror DCB+S.DCB.NIC.LINK
lsr CS if 100mb
bcc .1
inc DCB+S.DCB.NIC.SPEED
.1 lsr CS if FD
bcc .2
lda #S.DCB.NIC.LINK.FD
tsb DCB+S.DCB.NIC.LINK
.2 lda UD.IO.RData,x VERSIONR
sta DIB+S.DIB.VERSION
clc
.99 rts
*--------------------------------------
IO.ExecA sta UD.IO.Cmd,x
IO.Exec stz UD.IO.UnitNum,x
lda UD.IO.Exec,x
.1 lda UD.IO.Status,x
bmi .1
lsr CS if error, A = ERROR CODE ?
rts
*--------------------------------------
DRV.CS.END
DEVSLOTx0 .BS 1
*--------------------------------------
DIB .DA #0
.DA #0,#0,#0 size
.PS "udeth/W5500 "
.DA #S.DIB.T.NIC
.BS 1 Subtype
.BS 2 Version
*--------------------------------------
DCB .DA #S.DCB.T.NIC
.BS 1 FLAGS
.BS 1 LINK
.BS 1 SPEED
.HS 000000000000 MAC
.BS 12 IP/MASK/GW
*--------------------------------------
DRV.END
MAN
SAVE usr/src/drv/udeth.drv.s
ASM

View File

@ -99,12 +99,12 @@ Dev.Detect >STYA ZPArgPtr
sta DIB+S.DIB.VERSION
jsr Dev.ParseArgs
bcs .99
.8 >PUSHW L.MSG.DETECT.OK
>PUSHW L.FD.DEV.NAME
>PUSHBI 2
>SYSCALL PrintF
>PUSHWI DRV.END
>PUSHWI DRV.CS.END-DRV.CS.START
>PUSHWI DRV.CS.START
@ -140,7 +140,7 @@ Dev.ParseArgs lda (ZPArgPtr)
.1 >PUSHW ZPArgPtr
>PUSHW L.SSCANF.MAC
ldx #0
.2 >PUSHW L.MAC0,x
@ -152,7 +152,7 @@ Dev.ParseArgs lda (ZPArgPtr)
>PUSHBI 12 6 x byte PTRs
>SYSCALL SScanF
bcc .8
lda #E.SYN
* sec
.8 rts
@ -214,10 +214,13 @@ STATUS >STYA ZPIOCTL
iny
lda (ZPIOCTL),y
sta .3+2
.2 lda DIB,x
.3 sta $ffff,x SELF MODIFIED
dex
bpl .2
clc
rts
@ -238,7 +241,7 @@ STATUS.DCB cmp #S.IOCTL.S.GETDCB
lda #S.DCB.NIC.LINK.OK
tsb DCB+S.DCB.NIC.LINK
lda /PP.TestCTL
sta PacketPagePTR+1,x
lda #PP.TestCTL
@ -272,11 +275,18 @@ STATUS.9 lda #MLI.E.BADCTL
sec
rts
*--------------------------------------
* crc32(090007FFFFFF) = 0ba4eec0 : 0b>>2 = 3 = 00100000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
* crc32(FFFFFFFFFFFF) = 41d9ed00
*--------------------------------------
OPEN lda #S.DIB.S.OPENED
bit DIB+S.DIB.S
bne .9
beq .1
jsr CLOSE
lda #MLI.E.OPEN
sec
rts
.1 jsr CLOSE
* ldx DEVSLOTx0 Done by CLOSE
@ -284,11 +294,51 @@ OPEN lda #S.DIB.S.OPENED
sta PacketPagePTR+1,x
lda #PP.RxCTL
sta PacketPagePTR,x
lda /PP.RxCTL.LID+PP.RxCTL.RxOKA+PP.RxCTL.IA+PP.RxCTL.BroadcastA+PP.RxCTL.RuntA
lda /PP.RxCTL.LID+PP.RxCTL.IAHashA+PP.RxCTL.RxOKA+PP.RxCTL.IA+PP.RxCTL.MulticastA+PP.RxCTL.BroadcastA+PP.RxCTL.RuntA
sta PacketPageDATA+1,x
lda #PP.RxCTL.LID+PP.RxCTL.RxOKA+PP.RxCTL.IA+PP.RxCTL.BroadcastA+PP.RxCTL.RuntA
lda #PP.RxCTL.LID+PP.RxCTL.IAHashA+PP.RxCTL.RxOKA+PP.RxCTL.IA+PP.RxCTL.MulticastA+PP.RxCTL.BroadcastA+PP.RxCTL.RuntA
sta PacketPageDATA,x
* lda /PP.LAF
* sta PacketPagePTR+1,x
* lda #PP.LAF
* sta PacketPagePTR,x
* lda #%00000000
* sta PacketPageDATA+1,x
* lda #%00000000
* sta PacketPageDATA,x
* lda /PP.LAF+2
* sta PacketPagePTR+1,x
* lda #PP.LAF+2
* sta PacketPagePTR,x
* lda #%00000000
* sta PacketPageDATA+1,x
* lda #%00000000
* sta PacketPageDATA,x
* lda /PP.LAF+4
* sta PacketPagePTR+1,x
* lda #PP.LAF+4
* sta PacketPagePTR,x
* lda #%00000000
* sta PacketPageDATA+1,x
* lda #%00000000
* sta PacketPageDATA,x
lda /PP.LAF+6
sta PacketPagePTR+1,x
lda #PP.LAF+6
sta PacketPagePTR,x
lda #%00100000
sta PacketPageDATA+1,x
* lda #%00000000
* sta PacketPageDATA,x
lda /PP.MAC
sta PacketPagePTR+1,x
lda #PP.MAC
@ -328,13 +378,11 @@ OPEN lda #S.DIB.S.OPENED
sta PacketPageDATA+1,x
lda #PP.LineCTL.LID+PP.LineCTL.SerRxOn+PP.LineCTL.SerTxOn+PP.LineCTL.10BaseT
sta PacketPageDATA,x
lda #S.DIB.S.OPENED
tsb DIB+S.DIB.S
clc
rts
.9 lda #MLI.E.OPEN
sec
clc
rts
*--------------------------------------
CLOSE ldx DEVSLOTx0
@ -391,7 +439,7 @@ READ php
pha
eor #$ff
sta Counter+1
dey
lda RTDATA,x
sta (ZPIOCTL),y
@ -432,7 +480,7 @@ READ php
inc Counter+1
beq .8
.3 lda RTDATA+1,x
sta (ZPBufPtr),y
iny
@ -475,9 +523,9 @@ WRITE php
eor #$ff
sta Counter
lda /PP.BusST
lda /PP.BusST
sta PacketPagePTR+1,x
lda #PP.BusST
lda #PP.BusST
sta PacketPagePTR,x
lda PacketPageDATA+1,x
@ -521,7 +569,7 @@ WRITE php
inc Counter+1
beq .8
.4 lda (ZPBufPtr),y
sta RTDATA+1,x

View File

@ -25,7 +25,7 @@ PSCTX.SIZE .EQ $100-pCode
A2osX.ZCALL .EQ $0000
*--------------------------------------
* A2osX GLOBAL PAGE
* $BC00->$BC0F : Public Vectors
* $1000->$1012 : Public Vectors
*--------------------------------------
A2osX.SYSCALL .EQ $1000
A2osX.LIBCALL .EQ $1003
@ -35,7 +35,7 @@ A2osX.BADCALL .EQ $100C
*--------------------------------------
A2osX.SLEEP .EQ $1010
*--------------------------------------
* $1ED0->$1EEF : Public Variables
* $11D0->$11EF : Public Variables
*--------------------------------------
A2osX.SCRNDEVS .EQ $11D0 0=console, 1-8=VT100, 9=GFX
A2osX.ASCREEN .EQ $11DA Active Screen
@ -263,7 +263,7 @@ SYS.StrCmp .EQ $8C
SYS.StrCaseCmp .EQ $8E
* DEV
SYS.GetDevByName .EQ $90
SYS.MKFD .EQ $92
* .EQ $92
SYS.MKDev .EQ $94
SYS.IOCTL .EQ $96
* BIN

View File

@ -12,6 +12,8 @@ S.ETH.EII.TYPE.ARP .EQ $806
S.ETH.EII .EQ 14
*--------------------------------------
S.ETH.802.3.LENGTH .EQ 12
S.ETH.802.2.LLC .EQ 14
S.ETH.802.2.DSTSAP .EQ 14
S.ETH.802.2.SRCSAP .EQ 15
S.ETH.802.2.CTRL .EQ 16
@ -23,4 +25,4 @@ S.ETH.SNAP.PROTO.DDP .EQ $809B
S.ETH.SNAP .EQ 22
*--------------------------------------
MAN
SAVE INC/ETH.I
SAVE inc/eth.i

View File

@ -1,7 +1,7 @@
NEW
AUTO 3,1
*--------------------------------------
K.VER .EQ $5E00 94.0
K.VER .EQ $5F00 95.0
K.ENV.SIZE .EQ 256
*--------------------------------------
K.MEM.ALIGN .EQ 16
@ -9,38 +9,36 @@ K.MEM.nALIGNm1 .EQ $F0
*K.MEM.ALIGN .EQ 64
*K.MEM.nALIGNm1 .EQ $C0
*--------------------------------------
K.hFD.MAX .EQ 32
K.FLT.MAX .EQ 4
K.FD.MAX .EQ 32
K.FILE.MAX .EQ 32
K.USR.MAX .EQ 8
K.PFT.MAX .EQ 4
K.PS.MAX .EQ 32
K.EVT.MAX .EQ 4
K.TTY.MAX .EQ 8
K.IRQDEV.MAX .EQ 4
*--------------------------------------
Mem.Table .EQ $0800 -> $1000
*--------------------------------------
* Z80 .EQ $1000
FDs.pLO .EQ $1BC0 K.FD.MAX
FDs.pHI .EQ $1BE0 K.FD.MAX
*--------------------------------------
* Tables start at $1C00
FILEs.hFD .EQ $1D00 K.FILE.MAX
FILEs.oCnt .EQ $1D20 K.FILE.MAX
FILEs.hName .EQ $1D40 K.FILE.MAX
*--------------------------------------
hFDs .EQ $1D00 K.hFD.MAX
hFDs.hName .EQ $1D20 K.hFD.MAX
hFDs.oCnt .EQ $1D40 K.hFD.MAX
USRs.hSID .EQ $1D60 K.USR.MAX
USRs.hFile .EQ $1D68 K.USR.MAX
*--------------------------------------
Flt.Table.pftLO .EQ $1D60 K.FLT.MAX
Flt.Table.pftHI .EQ $1D64 K.FLT.MAX
Flt.Table.cbLO .EQ $1D68 K.FLT.MAX
Flt.Table.cbHI .EQ $1D6C K.FLT.MAX
PFTs.pLO .EQ $1D70 K.PFT.MAX
PFTs.pHI .EQ $1D74 K.PFT.MAX
PFTs.cbLO .EQ $1D78 K.PFT.MAX
PFTs.cbHI .EQ $1D7C K.PFT.MAX
*--------------------------------------
S.Table.hSID .EQ $1D70 K.USR.MAX
S.Table.hFile .EQ $1D78 K.USR.MAX
*--------------------------------------
PS.Table.PID .EQ $1D80 K.PS.MAX
PS.Table.hPS .EQ $1DA0 K.PS.MAX
PS.Table.Hits .EQ $1DC0 K.PS.MAX
PS.Table.Stats .EQ $1DE0 K.PS.MAX
PSs.PID .EQ $1D80 K.PS.MAX
PSs.hPS .EQ $1DA0 K.PS.MAX
PSs.Hits .EQ $1DC0 K.PS.MAX
PSs.Stats .EQ $1DE0 K.PS.MAX
*--------------------------------------
MAN
SAVE inc/kernel.i

View File

@ -2,10 +2,10 @@ NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
K.AARPCACHE.SIZE .EQ 10
K.AARP.TTL .EQ 600
K.AARP.PENDING.TTL .EQ 10
K.AROUTER.TTL .EQ 500 50 sec
K.AARPCACHE.SIZE .EQ 10
K.AARP.TTL .EQ 600
K.AARP.PENDING.TTL .EQ 10
K.AROUTER.TTL .EQ 500 50 sec
*--------------------------------------
LIBETALK.SETCFG .EQ 4
LIBETALK.GETCFG .EQ 6
@ -15,21 +15,32 @@ LIBETALK.PULSE .EQ 10
LIBETALK.AARP.Clear .EQ 12
LIBETALK.AARP.Query .EQ 14
LIBETALK.AARP.Add .EQ 16
LIBETALK.AARP.Probe .EQ 16
LIBETALK.AARP.GetCache .EQ 18
LIBETALK.NBP.Clear .EQ 20
LIBETALK.NBP.Query .EQ 22
LIBETALK.NBP.Lookop .EQ 24
LIBETALK.NBP.GetCache .EQ 26
*--------------------------------------
ERR.AARP.PENDING .EQ $B5
*--------------------------------------
*S.ETKCFG.STATUS .EQ 0
*S.ETKCFG.DevID .EQ 1
*S.ETKCFG.MAC .EQ 4
S.ETKCFG.ADDR .EQ 10
* ether proto 0x809B or ether proto 0x80F3
*--------------------------------------
S.ETKCFG.STATUS .EQ 0
S.ETKCFG.DevID .EQ 1
S.ETKCFG.MAC .EQ 4
S.ETKCFG.ADDR .EQ 10 to make ADDR 32 bits
S.ETKCFG.NetID .EQ 11
S.ETKCFG.NodID .EQ 13
S.ETKCFG.Router .EQ 14
S.ETKCFG.OBJECT .EQ 15 L+32
S.ETKCFG.MCAddress .EQ 15 L+6
S.ETKCFG.NetStart .EQ 22
S.ETKCFG.NetEnd .EQ 24
S.ETKCFG.Object .EQ 26 L+32
S.ETKCFG.Zone .EQ 59 L+32
*
S.ETKCFG .EQ 48
S.ETKCFG .EQ 92
*--------------------------------------
S.AARP.HTYPE .EQ S.ETH.SNAP+0 $0001
S.AARP.PTYPE .EQ S.ETH.SNAP+2 $809B
@ -71,11 +82,59 @@ S.DDP2.SRC.NOD .EQ S.ETH.SNAP+9
S.DDP2.DST.SKT .EQ S.ETH.SNAP+10
S.DDP2.SRC.SKT .EQ S.ETH.SNAP+11
S.DDP2.TYPE .EQ S.ETH.SNAP+12
S.DDP2.TYPE.RTMPREP .EQ 1
S.DDP2.TYPE.NBP .EQ 2
S.DDP2.TYPE.ATP .EQ 3
S.DDP2.TYPE.AEP .EQ 4
S.DDP2.TYPE.RTMPREQ .EQ 5
S.DDP2.TYPE.ZIP .EQ 6
S.DDP2.TYPE.ADSP .EQ 7
*
S.DDP2 .EQ S.ETH.SNAP+13
*--------------------------------------
S.NBP.F .EQ S.DDP2+0
S.NBP.F.BrRq .EQ $10
S.NBP.F.LkUpReq .EQ $20
S.NBP.F.LkUpRep .EQ $30
S.NBP.F.FwdReq .EQ $40
S.NBP.ID .EQ S.DDP2+1
S.NBP.Tuples .EQ S.DDP2+2
*--------------------------------------
S.NBPTUPLE.NetID .EQ 0
S.NBPTUPLE.NodID .EQ 2
S.NBPTUPLE.SktID .EQ 3
S.NBPTUPLE.Enum .EQ 4
*
S.NBPTUPLE .EQ 5
*--------------------------------------
S.RTMP
*--------------------------------------
S.ZIP.GNI.Cmd .EQ S.DDP2+0
S.ZIP.GNI.Cmd.Req .EQ 5
S.ZIP.GNI.Cmd.Rep .EQ 6
S.ZIP.GNI.Flags .EQ S.DDP2+1
S.ZIP.GNI.NetStart .EQ S.DDP2+2
S.ZIP.GNI.NetEnd .EQ S.DDP2+4
S.ZIP.GNI.Zone0 .EQ S.DDP2+6
S.ZIP.GNI.MCAddress .EQ S.DDP2+7 L+6
S.ZIP.GNI.DefaultZone .EQ S.DDP2+14 L+32
*--------------------------------------
S.SOCKET.AF .EQ S.FD.DSOCK+0
S.SOCKET.T .EQ S.FD.DSOCK+1
S.SOCKET.PROTO .EQ S.FD.DSOCK+2
S.SOCKET.O .EQ S.FD.DSOCK+3
S.SOCKET.LOC.NET .EQ S.FD.DSOCK+4
S.SOCKET.LOC.NOD .EQ S.FD.DSOCK+6
S.SOCKET.LOC.PORT .EQ S.FD.DSOCK+7
S.SOCKET.REM.NET .EQ S.FD.DSOCK+8
S.SOCKET.REM.NOD .EQ S.FD.DSOCK+10
S.SOCKET.REM.PORT .EQ S.FD.DSOCK+11
S.SOCKET .EQ S.SOCKET+38
*--------------------------------------
MAN
SAVE inc/libetalk.i
LOAD usr/src/lib/libetalk.s

View File

@ -4,7 +4,6 @@ NEW
*--------------------------------------
K.ARPCACHE.SIZE .EQ 8
K.DNSCACHE.SIZE .EQ 8
K.SKTTABLE.SIZE .EQ 16
K.FRMQUEUE.SIZE .EQ 16
K.FRMSEND.RETRY .EQ 10
K.ETH.FRAME.LEN .EQ 1514

View File

@ -95,6 +95,7 @@ PP.BusST.LID .EQ %00000000.00011000
PP.BusST.TxBidErr .EQ %00000000.10000000
PP.BusST.Rdy4TxNOW .EQ %00000001.00000000
PP.TDR .EQ $013C
PP.LAF .EQ $0150
PP.MAC .EQ $0158 MAC Address (RW)
PP.RxStatus .EQ $0400
PP.RxLength .EQ $0402
@ -102,4 +103,4 @@ PP.RxFrame .EQ $0404
PP.TxFrame .EQ $0A00
*--------------------------------------
MAN
SAVE INC/NIC.8900A.I
SAVE inc/nic.8900a.i

View File

@ -367,7 +367,7 @@ D2.TrkReadNIB
*/--------------------------------------
* # D2TrkWriteNIB
* Write a track (NIBBLE)
* **In:**
* ## ASM
* PUSHB = DSSS0000
* PUSHW = Ptr to NIBBLE buffer (0 ended)
* ## RETURN VALUE

View File

@ -84,7 +84,6 @@ LIB.UNLOAD clc
* ## C
* int getprodoscatsize (short int options, short int catsize, int devsize );
* ## ASM
* **In:**
* PUSHW = DevSize (in 512b blocks)
* PUSHB = Catalog Size (in blocks)
* PUSHB = Options
@ -124,7 +123,7 @@ GetProDOSCatSize.I
rts
*/--------------------------------------
* # BuildProDOSCat
* **In:**
* ## ASM
* PUSHW = DevSize (in 512b blocks)
* PUSHB = Catalog Size (in blocks)
* PUSHB = Options

View File

@ -3,7 +3,7 @@ NEW
*/--------------------------------------
* # AARP.Clear
* Clear AARP Cache
* **In:**
* ## ASM
* ## RETURN VALUE
*\--------------------------------------
AARP.Clear ldx #K.AARPCACHE.SIZE*S.AARPCACHE
@ -11,12 +11,13 @@ AARP.Clear ldx #K.AARPCACHE.SIZE*S.AARPCACHE
.1 stz AARP.CACHE-1,x
dex
bne .1
clc
rts
*/--------------------------------------
* # AARP.Query
* Query AARP Cache and returns HW address
* **In:**
* ## ASM
* PUSHW PTR to MAC (to fill)
* PUSHW PTR to ADDR
* ## RETURN VALUE
@ -26,23 +27,28 @@ AARP.Clear ldx #K.AARPCACHE.SIZE*S.AARPCACHE
AARP.Query >PULLW ZPPtrADDR ADDR
>PULLW ZPPtrMAC MAC
ldy #3
.1 lda (ZPPtrADDR),y
sta AARP.TmpCache+S.AARPCACHE.ADDR,y
dey
bpl .1
jsr AARP.QUERY.I
bcs .9
ldy #5
.2 lda AARP.TmpCache+S.AARPCACHE.MAC,y
sta (ZPPtrMAC),y
dey
bpl .2
clc
.9 rts
*/--------------------------------------
* # AARP.Add
* Add a static AARP cache record
* **In:**
* ## ASM
* PUSHW PTR to MAC
* PUSHW PTR to IP
*\--------------------------------------
@ -69,19 +75,22 @@ AARP.ADD.I sta AARP.TmpCache
jsr AARP.FIND.BY.ADDR
bcc .1
jsr AARP.FIND.FREE
.1 ldy #S.AARPCACHE-1
.2 lda AARP.TmpCache,y
sta (ZPCachePtr),y
dey
bpl .2
clc
rts
*/--------------------------------------
* # AARP.GetCache
* Return a Ptr to AARP Cache Table
* **In:**
* ## ASM
* ## RETURN VALUE
* Y,A = PTR to AARP.CACHE
*\--------------------------------------
@ -102,13 +111,16 @@ AARP.AddFromFrameInPtr
iny
lda (ZPFrameInPtr),y
sta AARP.TmpCache+S.AARPCACHE.ADDR+3,x
ldy #S.ETH.SRCMAC+5
ldx #5
.2 lda (ZPFrameInPtr),y
sta AARP.TmpCache+S.AARPCACHE.MAC,x
dey
dex
bpl .2
lda #K.AARP.TTL
sta AARP.TmpCache+S.AARPCACHE.TTL
lda /K.AARP.TTL
@ -116,55 +128,77 @@ AARP.AddFromFrameInPtr
lda #S.AARPCACHE.S.RESOLVED
jmp AARP.ADD.I
*--------------------------------------
AARP.IN bra .10
ldy #S.AARP.TPA+3
ldx #3
.1 lda (ZPFrameInPtr),y
cmp ETKCFG+S.ETKCFG.ADDR,x
AARP.IN ldy #S.AARP.TPA+3
lda (ZPFrameInPtr),y
cmp ETKCFG+S.ETKCFG.NodID
bne AARP.IN.EXIT
dey
dex
bpl .1
.10 ldy #S.AARP.OPERATION+1 HI byte
lda (ZPFrameInPtr),y
cmp ETKCFG+S.ETKCFG.NetID
bne AARP.IN.EXIT
dey
lda (ZPFrameInPtr),y
cmp ETKCFG+S.ETKCFG.NetID+1
bne AARP.IN.EXIT
ldy #S.AARP.OPERATION+1 HI byte
lda (ZPFrameInPtr),y
cmp #S.AARP.OPERATION.REQ
beq AARP.IN.REQ
cmp #S.AARP.OPERATION.REP
beq AARP.IN.REP
AARP.IN.EXIT lda hFrameIn
beq .8
stz hFrameIn
>SYSCALL2 FreeMem
.8 clc
rts
*--------------------------------------
AARP.IN.REQ ldy #S.AARP.SPA+3
ldx #3
.1 lda (ZPFrameInPtr),y
sta AARP.REP.TPA,x
dey
dex
bpl .1
ldy #S.AARP.SHA+5
ldx #5
.2 lda (ZPFrameInPtr),y
sta AARP.REP.DSTMAC,x
sta AARP.REP.THA,x
dey
dex
bpl .2
lda ETKCFG+S.ETKCFG.NetID+1
sta AARP.REP.SPA+1
lda ETKCFG+S.ETKCFG.NetID
sta AARP.REP.SPA+2
lda ETKCFG+S.ETKCFG.NodID
sta AARP.REP.SPA+3
>LDYA L.AARP.REP
jsr AARP.Send
bra AARP.IN.EXIT
*--------------------------------------
AARP.IN.REP lda #K.AARP.TTL
sta AARP.TmpCache+S.AARPCACHE.TTL
lda /K.AARP.TTL
sta AARP.TmpCache+S.AARPCACHE.TTL+1
ldy #S.AARP.SPA+3
ldx #3
.1 lda (ZPFrameInPtr),y
sta AARP.TmpCache+S.AARPCACHE.ADDR,x
dey
@ -173,11 +207,13 @@ AARP.IN.REP lda #K.AARP.TTL
ldy #S.AARP.SHA+5
ldx #5
.2 lda (ZPFrameInPtr),y
sta AARP.TmpCache+S.AARPCACHE.MAC,x
dey
dex
bpl .2
lda #S.AARPCACHE.S.RESOLVED
jsr AARP.ADD.I
jmp AARP.IN.EXIT
@ -187,12 +223,15 @@ AARP.QUERY.I jsr AARP.FIND.BY.ADDR
lda (ZPCachePtr) get status...
bpl .9 Pending...
ldy #S.AARPCACHE.MAC
.2 lda (ZPCachePtr),y
sta AARP.TmpCache,y
iny
cpy #S.AARPCACHE.MAC+6
bne .2
ldy #S.AARPCACHE.TTL
lda #K.AARP.TTL
sta (ZPCachePtr),y
@ -208,14 +247,17 @@ AARP.QUERY.I jsr AARP.FIND.BY.ADDR
sta AARP.REQ.TPA,x
dex
bpl .4
>LDYA L.AARP.REQ
jsr AARP.Send
bcs .99
lda #K.AARP.PENDING.TTL
sta AARP.TmpCache+S.AARPCACHE.TTL
stz AARP.TmpCache+S.AARPCACHE.TTL+1
lda #S.AARPCACHE.S.PENDING
jsr AARP.ADD.I
.9 lda #ERR.AARP.PENDING
sec
.99 rts
@ -231,22 +273,29 @@ AARP.FIND.BY.ADDR
ldx #3
ldy #S.AARPCACHE.ADDR+3
.2 lda AARP.TmpCache+S.AARPCACHE.ADDR,x
cmp (ZPCachePtr),y
bne .3
dey
dex
bpl .2
clc
rts
.3 lda ZPCachePtr
clc
adc #S.AARPCACHE
sta ZPCachePtr
bcc .8
inc ZPCachePtr+1
.8 dec TmpOffset
bne .1
sec
rts
*--------------------------------------
@ -260,7 +309,9 @@ AARP.FIND.FREE >LDYA L.AARP.CACHE
ldx #K.AARPCACHE.SIZE
.1 lda (ZPCachePtr)
beq .8
bpl .6
ldy #S.AARPCACHE.TTL
lda (ZPCachePtr),y
sec
@ -269,6 +320,7 @@ AARP.FIND.FREE >LDYA L.AARP.CACHE
lda (ZPCachePtr),y
sbc TmpDWord+1
bcc .6
lda (ZPCachePtr),y
sta TmpDWord+1
dey
@ -282,23 +334,31 @@ AARP.FIND.FREE >LDYA L.AARP.CACHE
adc #S.AARPCACHE
sta ZPCachePtr
bcc .7
inc ZPCachePtr+1
.7 dex
bne .1
>LDYA ZPTmpPtr1
>STYA ZPCachePtr
lda #0
sta (ZPCachePtr)
.8 clc
rts
*--------------------------------------
AARP.EXPIRE >LDYA L.AARP.CACHE
AARP.EXPIRE rts
>LDYA L.AARP.CACHE
>STYA ZPCachePtr
ldx #K.AARPCACHE.SIZE
.1 lda (ZPCachePtr)
beq .2
and #S.AARPCACHE.S.STATIC
bne .2
ldy #S.AARPCACHE.TTL
sec
lda (ZPCachePtr),y
@ -309,16 +369,21 @@ AARP.EXPIRE >LDYA L.AARP.CACHE
sbc #0
sta (ZPCachePtr),y
bcs .2
lda #0
sta (ZPCachePtr)
.2 lda ZPCachePtr
clc
adc #S.AARPCACHE
sta ZPCachePtr
bcc .3
inc ZPCachePtr+1
.3 dex
bne .1
rts
*--------------------------------------
AARP.Send >STYA IOCTL+S.IOCTL.BUFPTR

11
LIB/LIBETALK.S.ADSP.txt Normal file
View File

@ -0,0 +1,11 @@
NEW
AUTO 3,1
*--------------------------------------
ADSP.IN
clc
rts
*--------------------------------------
MAN
SAVE usr/src/lib/libetalk.s.adsp
LOAD usr/src/lib/libetalk.s
ASM

10
LIB/LIBETALK.S.AEP.txt Normal file
View File

@ -0,0 +1,10 @@
NEW
AUTO 3,1
*--------------------------------------
AEP.IN clc
rts
*--------------------------------------
MAN
SAVE usr/src/lib/libetalk.s.aep
LOAD usr/src/lib/libetalk.s
ASM

10
LIB/LIBETALK.S.ATP.txt Normal file
View File

@ -0,0 +1,10 @@
NEW
AUTO 3,1
*--------------------------------------
ATP.IN clc
rts
*--------------------------------------
MAN
SAVE usr/src/lib/libetalk.s.atp
LOAD usr/src/lib/libetalk.s
ASM

View File

@ -1,8 +1,49 @@
NEW
AUTO 3,1
*--------------------------------------
DDP.IN clc
DDP.IN ldy #S.DDP2.DST.NOD
lda (ZPFrameInPtr),y
cmp #$ff
beq .1
cmp ETKCFG+S.ETKCFG.NodID
bne .9
ldy #S.DDP2.DST.NET
lda (ZPFrameInPtr),y
cmp ETKCFG+S.ETKCFG.NetID+1
bne .9
iny
lda (ZPFrameInPtr),y
cmp ETKCFG+S.ETKCFG.NetID
bne .9
.1 ldy #S.DDP2.DST.SKT
lda (ZPFrameInPtr),y
beq .9
* bmi DDP.IN.DYNAMIC
cmp #8
bcs .9
ldy #S.DDP2.SRC.SKT
cmp (ZPFrameInPtr),y
bne .9
asl
tax
jmp (J.DDP.IN-2,x)
clc
rts
.9 lda #MLI.E.EOF
sec
rts
*--------------------------------------
MAN
SAVE usr/src/lib/libetalk.s.ddp

View File

@ -1,7 +1,115 @@
NEW
AUTO 3,1
*--------------------------------------
FRM.NewDDP >STYA ZPDataOutLen
lda ZPDataOutLen
clc
adc #S.DDP2
sta ZPFrameOutLen
tay
lda ZPDataOutLen+1
adc /S.DDP2
sta ZPFrameOutLen+1
bne .10
cpy #60
bcs .10
ldy #60
.10 >SYSCALL2 GetMem
bcs .9
>STYA ZPFrameOutPtr
stx hFrameOut
lda ZPFrameOutLen
sec
sbc #S.ETH.802.2.LLC
ldy #S.ETH.802.3.LENGTH+1
sta (ZPFrameOutPtr),y
lda ZPFrameOutLen+1
sbc /S.ETH.802.2.LLC
dey
sta (ZPFrameOutPtr),y
ldx #DDP.LLC.L-1
ldy #S.ETH.802.2.LLC+DDP.LLC.L-1
.1 lda DDP.LLC,x
sta (ZPFrameOutPtr),y
dey
dex
bpl .1
lda ZPFrameOutLen
sec
sbc #S.ETH.SNAP
ldy #S.DDP2.DATALEN+1
sta (ZPFrameOutPtr),y
lda ZPFrameOutLen+1
sbc /S.ETH.SNAP
dey
sta (ZPFrameOutPtr),y
ldy #S.DDP2.CHECKSUM
lda #0
sta (ZPFrameOutPtr),y
iny
sta (ZPFrameOutPtr),y
lda hFrameOut
clc
.9 rts
*--------------------------------------
FRM.SendDDP ldy #S.DDP2.SRC.NET
lda ETKCFG+S.ETKCFG.NetID+1
sta (ZPFrameOutPtr),y
iny
lda ETKCFG+S.ETKCFG.NetID
sta (ZPFrameOutPtr),y
ldy #S.DDP2.SRC.NOD
lda ETKCFG+S.ETKCFG.NodID
sta (ZPFrameOutPtr),y
ldy #S.DDP2.DST.NOD
lda (ZPFrameOutPtr),y
beq .10 DST.NOD = 0 : any router
cmp #$FF Broadcast
bne FRM.SendAARP
.10 ldy #S.DDP2.DST.NET
lda (ZPFrameOutPtr),y
iny
ora (ZPFrameOutPtr),y
bne .2
ldy #5
.1 lda MAC.BROADCAST,y
sta (ZPFrameOutPtr),y
dey
bpl .1
bra FRM.Send
.2 ldy #5
.3 lda ETKCFG+S.ETKCFG.MCAddress+1,y
sta (ZPFrameOutPtr),y
dey
bpl .3
bra FRM.Send
FRM.SendAARP >DEBUG
*--------------------------------------
FRM.Send ldx #3
@ -9,13 +117,42 @@ FRM.Send ldx #3
sta IOCTL+S.IOCTL.BUFPTR,x
dex
bpl .1
lda IOCTL+S.IOCTL.BYTECNT+1
bne FRM.Send.IOCTL
lda #60
cmp IOCTL+S.IOCTL.BYTECNT
bcc FRM.Send.IOCTL
sta IOCTL+S.IOCTL.BYTECNT
FRM.Send.IOCTL >PUSHB ETKCFG+S.NETCFG.DevID
>PUSHBI IOCTL.WRITE
>PUSHW L.IOCTL
>SYSCALL2 IOCTL
rts
*--------------------------------------
FRM.DiscardIn lda hFrameIn
beq .8
stz hFrameIn
>SYSCALL2 FreeMem
.8 clc
rts
*--------------------------------------
FRM.DiscardOut lda hFrameOut
beq .8
stz hFrameOut
>SYSCALL2 FreeMem
.8 sec
rts
*--------------------------------------
MAN
SAVE usr/src/lib/libetalk.s.frm
LOAD usr/src/lib/libetalk.s

116
LIB/LIBETALK.S.NBP.txt Normal file
View File

@ -0,0 +1,116 @@
NEW
AUTO 3,1
*--------------------------------------
NBP.IN
clc
rts
*--------------------------------------
NBP.Clear
*--------------------------------------
NBP.Query
clc
rts
*--------------------------------------
NBP.Lookup >PULLW ZPDataInPtr PSTR/PSTR/PSTR/0
ldy #$ff
.1 iny
lda (ZPDataInPtr),y
bne .1
tya
clc
adc #S.NBPTUPLE+2 +F+ID
tay
lda #0
adc #0
jsr FRM.NewDDP
bcs .9
lda #S.DDP2.TYPE.NBP
ldy #S.DDP2.DST.SKT
sta (ZPFrameOutPtr),y
iny S.DDP2.SRC.SKT
sta (ZPFrameOutPtr),y
ldy #S.DDP2.TYPE
sta (ZPFrameOutPtr),y
ldy #S.NBP.F
lda #S.NBP.F.LkUpReq+1
sta (ZPFrameOutPtr),y
inc NBP.ID
lda NBP.ID
iny S.NBP.ID
sta (ZPFrameOutPtr),y
iny S.NBP.Tuples
lda ETKCFG+S.ETKCFG.NetID+1
sta (ZPFrameOutPtr),y
iny
lda ETKCFG+S.ETKCFG.NetID
sta (ZPFrameOutPtr),y
iny
lda ETKCFG+S.ETKCFG.NodID
sta (ZPFrameOutPtr),y
iny
lda #S.DDP2.TYPE.NBP
sta (ZPFrameOutPtr),y
iny
lda #0 S.NBPTUPLE.Enum
sta (ZPFrameOutPtr),y
.2 lda (ZPDataInPtr)
beq .4
inc ZPDataInPtr
bne .3
inc ZPDataInPtr+1
.3 iny
sta (ZPFrameOutPtr),y
bra .2
.4 cpy #60
bcs .8
iny
sta (ZPFrameOutPtr),y
bra .4
.8 ldy #S.DDP2.DST.NET
lda #0
* lda ETKCFG+S.ETKCFG.NetID+1
sta (ZPFrameOutPtr),y
iny
* lda ETKCFG+S.ETKCFG.NetID
sta (ZPFrameOutPtr),y
lda #$ff
* lda #0 all routers
ldy #S.DDP2.DST.NOD
sta (ZPFrameOutPtr),y
jmp FRM.SendDDP
.9 rts
*--------------------------------------
NBP.GetCache clc
rts
*--------------------------------------
MAN
SAVE usr/src/lib/libetalk.s.nbp
LOAD usr/src/lib/libetalk.s
ASM

View File

@ -1,7 +1,10 @@
NEW
AUTO 3,1
*--------------------------------------
RTMP.IN.REQ
RTMP.IN.REP
clc
rts
*--------------------------------------
MAN
SAVE usr/src/lib/libetalk.s.rtmp

219
LIB/LIBETALK.S.SKT.txt Normal file
View File

@ -0,0 +1,219 @@
NEW
AUTO 3,1
*/--------------------------------------
* # Socket
* Create a new socket
* ## C
* `hFD socket(short int type, short int protocol);`
* ## ASM
* `>PUSHB type`
* `>PUSHB protocol`
* `>LIBCALL hLIBTCPIP,LIBTCPIP.socket`
* ## RETURN VALUE
* CC: A = hSOCKET
* CS: A = EC
*\--------------------------------------
SKT.Socket clc
rts
*/--------------------------------------
* # Bind
* bind a name to a socket
* ## C
* `int bind(hFD fd, const struct sockaddr *addr);`
* ## ASM
* `>PUSHB fd`
* `>PUSHW addr`
* `>LIBCALL hLIBTCPIP,LIBTCPIP.socket`
* ## RETURN VALUE
* CC: A = hSOCKET
* CS: A = EC
*\--------------------------------------
SKT.bind
*/--------------------------------------
* # Connect
* Initiate a connection on a socket
* ## C
* `int connect(hFD fd, const struct sockaddr *addr);`
* ## ASM
* `>PUSHB fd`
* `>PUSHW addr`
* `>LIBCALL hLIBTCPIP,LIBTCPIP.socket`
* ## RETURN VALUE
* CC: A = hSOCKET
* CS: A = EC
*\--------------------------------------
SKT.connect
*/--------------------------------------
* # Listen
* Listen for connections on a socket
* ## C
* `int listen(hFD fd);`
* ## ASM
* `lda fd`
* `>LIBCALL hLIBTCPIP,LIBTCPIP.listen`
* ## RETURN VALUE
* CS: A = EC
*\--------------------------------------
SKT.listen
*/--------------------------------------
* # Accept
* Accept a connection on a socket
* ## C
* `hFD Accept(hFD fd);`
* ## ASM
* `lda fd`
* `>LIBCALL hLIBTCPIP,LIBTCPIP.accept`
* ## RETURN VALUE
* A = hSocket
*\--------------------------------------
SKT.Accept
*/--------------------------------------
* # Shutdown
* Close socket
* ## C
* `int shutdown(int fd);`
* ## ASM
* `lda fd`
* `>LIBCALL hLIBTCPIP,LIBTCPIP.shutdown`
* ## RETURN VALUE
*\--------------------------------------
SKT.shutdown
*/--------------------------------------
* # Read (STREAM)
* ## C
* `int skt.read(hFD fd, void *buf, int count);`
* ## ASM
* `>PUSHB fd`
* `>PUSHW buf`
* `>PUSHW count`
* `>LIBCALL hLIBTCPIP,LIBTCPIP.read`
* ## RETURN VALUE
* CC: Y,A = bytes read
* CS: A = EC
*\--------------------------------------
SKT.Read
*/--------------------------------------
* # Write (STREAM)
* ## C
* `int skt.write(hFD fd, const void *buf, int count);`
* ## ASM
* `>PUSHB fd`
* `>PUSHW buf`
* `>PUSHW count`
* `>LIBCALL hLIBTCPIP,LIBTCPIP.write`
* ## RETURN VALUE
* CC: Y,A = bytes written
* CS: A = EC
*\--------------------------------------
SKT.Write
*/--------------------------------------
* # RecvFrom (RAW,DGRAM)
* ## C
* `hMem recvfrom(hFD fd, struct sockaddr *addr);`
* ## ASM
* `>PUSHB fd`
* `>PUSHW addr` (RecvFrom)
* `>LIBCALL hLIBTCPIP,LIBTCPIP.Recv`
* ## RETURN VALUE
* CC: A = hMem
* CS: A = EC
*\--------------------------------------
SKT.RecvFrom
*/--------------------------------------
* # Recv (RAW,DGRAM,SEQPKT)
* ## C
* `hMem recv(hFD fd);`
* ## ASM
* `lda fd`
* `>LIBCALL hLIBTCPIP,LIBTCPIP.Recv`
* ## RETURN VALUE
* CC: A = hMem
* CS: A = EC
*\--------------------------------------
SKT.Recv
*/--------------------------------------
* # SendTo (RAW,DGRAM,SEQPKT)
* ## C
* `int skt.sendto(hFD fd, const void *buf, int count, const struct sockaddr *addr);`
* ## ASM
* `>PUSHB fd`
* `>PUSHW buf`
* `>PUSHWI count`
* `>PUSHW addr`
* `>LIBCALL hLIBTCPIP,LIBTCPIP.sendto`
* ## RETURN VALUE
* CC: Y,A = bytes written
* CS: A = EC
*\--------------------------------------
SKT.SendTo
*/--------------------------------------
* # Send (RAW,DGRAM,SEQPKT)
* ## C
* `int skt.send(hFD fd, const void *buf, int count);`
* ## ASM
* `>PUSHB fd`
* `>PUSHW buf`
* `>PUSHWI count`
* `>LIBCALL hLIBTCPIP,LIBTCPIP.send`
* ## RETURN VALUE
* CC: Y,A = bytes written
* CS: A = EC
*\--------------------------------------
SKT.Send
*/--------------------------------------
* # GetSockOpt
* Set Socket Options
* ## C
* `int getsockopt(hFD fd);`
* ## ASM
* `lda fd`
* `>LIBCALL hLIBTCPIP,LIBTCPIP.GetSockOpt`
* ## RETURN VALUE
*\--------------------------------------
SKT.getsockopt
*/--------------------------------------
* # SetSockOpt
* Set Socket Options
* ## C
* `int setsockopt(hFD fd, short int opts);`
* ## ASM
* `>PUSHB fd`
* `>PUSHB opts`
* `>LIBCALL hLIBTCPIP,LIBTCPIP.SetSockOpt`
* ## RETURN VALUE
*\--------------------------------------
SKT.setsockopt
*/--------------------------------------
* # EOF
* End Of File
* ## C
* `int eof(hFD fd);`
* ## ASM
* `lda fd`
* `>LIBCALL hLIBTCPIP,LIBTCPIP.EOF`
* ## RETURN VALUE
* CC : A = 0 if some data, A = $ff if EOF
* CS : A = Socket Error
*\--------------------------------------
SKT.EOF
*--------------------------------------
MAN
SAVE usr/src/lib/libetalk.s.skt
LOAD usr/src/lib/libetalk.s
ASM

75
LIB/LIBETALK.S.ZIP.txt Normal file
View File

@ -0,0 +1,75 @@
NEW
AUTO 3,1
*--------------------------------------
ZIP.IN ldy #S.ZIP.GNI.Cmd
lda (ZPFrameInPtr),y
cmp #S.ZIP.GNI.Cmd.Rep
bne .8
ldy #S.ZIP.GNI.Zone0
lda (ZPFrameInPtr),y
bne .8
ldy #S.DDP2.SRC.NET
lda (ZPFrameInPtr),y
sta ETKCFG+S.ETKCFG.NetID+1
iny
lda (ZPFrameInPtr),y
sta ETKCFG+S.ETKCFG.NetID
ldy #S.DDP2.SRC.NOD
lda (ZPFrameInPtr),y
sta ETKCFG+S.ETKCFG.Router
ldy #S.ZIP.GNI.NetStart
lda (ZPFrameInPtr),y
sta ETKCFG+S.ETKCFG.NetStart+1
iny
lda (ZPFrameInPtr),y
sta ETKCFG+S.ETKCFG.NetStart
iny
lda (ZPFrameInPtr),y
sta ETKCFG+S.ETKCFG.NetEnd+1
iny
lda (ZPFrameInPtr),y
sta ETKCFG+S.ETKCFG.NetEnd
ldy #S.ZIP.GNI.MCAddress
lda (ZPFrameInPtr),y
cmp #6
bne .3
tax
ldy #S.ZIP.GNI.MCAddress+6
.2 lda (ZPFrameInPtr),y
sta ETKCFG+S.ETKCFG.MCAddress,x
dey
dex
bpl .2
.3 ldy #S.ZIP.GNI.DefaultZone
lda (ZPFrameInPtr),y
beq .7
tax
clc
adc #S.ZIP.GNI.DefaultZone
tay
.4 lda (ZPFrameInPtr),y
sta ETKCFG+S.ETKCFG.Zone,x
dey
dex
bpl .4
.7 lda #$80
sta ETKCFG STATUS
.8 clc
rts
*--------------------------------------
MAN
SAVE usr/src/lib/libetalk.s.zip
LOAD usr/src/lib/libetalk.s
ASM

View File

@ -4,9 +4,13 @@ NEW
.OP 65C02
.OR $2000
.TF lib/libetalk
*--------------------------------------
ETLK.Q.SIZE .EQ 8
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/kernel.i
.INB inc/mli.e.i
.INB inc/nic.i
.INB inc/eth.i
.INB inc/lib.net.i
@ -55,7 +59,12 @@ CS.START cld
.DA AARP.CLEAR
.DA AARP.QUERY
.DA AARP.ADD
.DA AARP.GetCACHE
.DA AARP.GetCache
.DA NBP.Clear
.DA NBP.Query
.DA NBP.Lookup
.DA NBP.GetCache
L.IOCTL .DA IOCTL
@ -63,6 +72,14 @@ L.AARP.REQ .DA AARP.REQ
L.AARP.REP .DA AARP.REP
L.AARP.CACHE .DA AARP.CACHE
J.DDP.IN .DA RTMP.IN.REP
.DA NBP.IN
.DA ATP.IN
.DA AEP.IN
.DA RTMP.IN.REQ
.DA ZIP.IN
.DA ADSP.IN
*--------------------------------------
L.ETKCFG .DA ETKCFG
.DA 0
@ -71,6 +88,7 @@ LIB.LOAD ldx RefCount
bne .8
jsr AARP.CLEAR
.8 inc RefCount
clc
@ -84,29 +102,46 @@ INCOMING sta hFrameIn
>PULLW ZPTmpPtr1
ldy #S.IOCTL.BUFPTR+3
.1 lda (ZPTmpPtr1),y Get Frame Ptr & Len
sta ZPFrameInPtr-S.IOCTL.BUFPTR,y
dey
bpl .1
ldy #S.ETH.802.3.LENGTH
lda (ZPFrameInPtr),y
cmp /$800
bcs .9 EII, not for us
lda #$AA SRCSAP=DSTSAP=$AA
ldy #S.ETH.802.2.DSTSAP
cmp (ZPFrameInPtr),y
bne .9
iny S.ETH.802.2.SRCSAP
cmp (ZPFrameInPtr),y
bne .9
ldy #S.ETH.SNAP.PROTO
lda (ZPFrameInPtr),y
tax
cmp /S.ETH.SNAP.PROTO.DDP $80 for both AARP & DDP
bne .9
iny
lda (ZPFrameInPtr),y
cmp #S.ETH.SNAP.PROTO.AARP
cmp #S.ETH.SNAP.PROTO.DDP
bne .2
cpx /S.ETH.SNAP.PROTO.AARP
bne .2
jmp AARP.IN
.2 cmp #S.ETH.SNAP.PROTO.DDP
bne .9
cpx /S.ETH.SNAP.PROTO.DDP
jmp DDP.IN
.2 cmp #S.ETH.SNAP.PROTO.AARP
bne .9
jmp DDP.IN
jmp AARP.IN
.9 sec
.9 lda #MLI.E.EOF
sec
rts
*--------------------------------------
*--------------------------------------
@ -118,14 +153,20 @@ PULSE and #S.EVT.F.T1SEC
.9 rts
*--------------------------------------
.INB usr/src/lib/libetalk.s.aarp
.INB usr/src/lib/libetalk.s.adsp
.INB usr/src/lib/libetalk.s.aep
.INB usr/src/lib/libetalk.s.atp
.INB usr/src/lib/libetalk.s.cfg
.INB usr/src/lib/libetalk.s.ddp
.INB usr/src/lib/libetalk.s.elap
.INB usr/src/lib/libetalk.s.frm
.INB usr/src/lib/libetalk.s.nbp
.INB usr/src/lib/libetalk.s.rtmp
.INB usr/src/lib/libetalk.s.zip
*--------------------------------------
CS.END
*--------------------------------------
MAC.BROADCAST .EQ *
AARP.REQ .HS 090007FFFFFF S.ETH.DSTMAC
AARP.REQ.SRCMAC .BS 6
.DA #0,#36 S.ETH.802.3.LENGTH
@ -133,6 +174,7 @@ AARP.REQ.SRCMAC .BS 6
.HS AA S.ETH.802.2.SRCSAP
.HS 03 S.ETH.802.2.CTRL
.HS 00.00.00.80.F3 S.ETH.SNAP.PROTO
*--------------------------------------
.HS 00.01.80.9B.06.04
.HS 0001 Request
AARP.REQ.SHA .BS 6
@ -150,6 +192,7 @@ AARP.REP.SRCMAC .BS 6
.HS AA S.ETH.802.2.SRCSAP
.HS 03 S.ETH.802.2.CTRL
.HS 00.00.00.80.F3 S.ETH.SNAP.PROTO
*--------------------------------------
.HS 00.01.80.9B.06.04
.HS 0002 Response
AARP.REP.SHA .BS 6
@ -159,9 +202,27 @@ AARP.REP.TPA .BS 4
.BS AARP.REP+60-*
AARP.REP.LEN .EQ 60
*--------------------------------------
DDP.LLC .HS AA
.HS AA
.HS 03
.HS 08.00.07
.HS 80.9B
DDP.LLC.L .EQ *-DDP.LLC
*--------------------------------------
NBP.ID .BS 1
*--------------------------------------
ETLK.Q.Tail .BS 1
ETLK.Q.Head .BS 1
ETLK.Q.hMem .BS ETLK.Q.SIZE
ETLK.Q.State .BS ETLK.Q.SIZE
ETLK.Q.Retry .BS ETLK.Q.SIZE
ETLK.Q.LenL .BS ETLK.Q.SIZE
ETLK.Q.LenH .BS ETLK.Q.SIZE
*--------------------------------------
RefCount .BS 1
IOCTL .BS S.IOCTL
hFrameIn .BS 1
hFrameOut .BS 1
ETKCFG .BS S.ETKCFG
AARP.CACHE .BS K.AARPCACHE.SIZE*S.AARPCACHE
AARP.TmpCache .BS S.AARPCACHE

View File

@ -3,7 +3,7 @@ NEW
*/--------------------------------------
* # ARP.Clear
* Clear ARP Cache
* **In:**
* ## ASM
* ## RETURN VALUE
*\--------------------------------------
ARP.Clear jsr ARP.GetCache
@ -21,7 +21,7 @@ ARP.Clear.I lda #0
*/--------------------------------------
* # ARP.Query
* Query ARP Cache and returns HW address
* **In:**
* ## ASM
* PUSHW PTR to MAC (to fill)
* PUSHW PTR to IP
* ## RETURN VALUE
@ -47,7 +47,7 @@ ARP.Query jsr ARP.GetIP
*/--------------------------------------
* # ARP.Add
* Add a static ARP cache record
* **In:**
* ## ASM
* PUSHW PTR to MAC
* PUSHW PTR to IP
*\--------------------------------------
@ -86,7 +86,7 @@ ARP.ADD.I sta ARP.TmpCache
*/--------------------------------------
* # ARP.GetCache
* Return a Ptr to ARP Cache Table
* **In:**
* ## ASM
* ## RETURN VALUE
* Y,A = PTR to ARP.CACHE
*\--------------------------------------

View File

@ -3,7 +3,7 @@ NEW
*/--------------------------------------
* # DNS.Clear
* Clear DNS Cache
* **In:**
* ## ASM
* ## RETURN VALUE
*\--------------------------------------
DNS.Clear ldx #K.DNSCACHE.SIZE*S.DNSCACHE
@ -17,7 +17,7 @@ DNS.Clear ldx #K.DNSCACHE.SIZE*S.DNSCACHE
*/--------------------------------------
* # DNS.Query
* Query DNS for specified host
* **In:**
* ## ASM
* PUSHW = PTR to IP to fill with cached data
* PUSHW = hostname PTR to PSTR
* ## RETURN VALUE
@ -186,7 +186,7 @@ DNS.CSTR2DNS lda (ZPPtrDNS)
*/--------------------------------------
* # DNS.Add
* Add a static DNS record
* **In:**
* ## ASM
* PUSHW = PTR to IP
* PUSHW = hostname CSTR to Add
*\--------------------------------------
@ -238,7 +238,7 @@ DNS.ADD.I sta DNS.TmpCache
*/--------------------------------------
* # DNS.GetCAche
* Return a Ptr to DNS Cache Table
* **In:**
* ## ASM
* ## RETURN VALUE
* Y,A = PTR to DNS.CACHE
*\--------------------------------------

View File

@ -6,7 +6,6 @@ NEW
* ## C
* `hFD socket(short int type, short int protocol);`
* ## ASM
* **In:**
* `>PUSHB type`
* `>PUSHB protocol`
* `>LIBCALL hLIBTCPIP,LIBTCPIP.socket`
@ -76,14 +75,14 @@ SKT.Socket.RTS rts
SKT.Socket.FindFree
sty TmpDWord Y = socket.size
ldx #0
ldx #1
.1 lda SKT.TABLE,x
.1 lda FDs.pHI-1,x
beq .2
inx
cpx #K.SKTTABLE.SIZE
bne .1
cpx #K.FD.MAX+1
bcc .1
lda #E.OOH
* sec
@ -97,10 +96,10 @@ SKT.Socket.FindFree
>STYA ZPTmpPtr1
txa
.8 ldy #$FF SELF MODIFIED
sta SKT.TABLE,y
.8 ldx #$FF SELF MODIFIED
sta FDs.pHI-1,x
tya
sta FDs.pLO-1,x
* clc
rts
@ -110,7 +109,6 @@ SKT.Socket.FindFree
* ## C
* `int bind(hFD fd, const struct sockaddr *addr);`
* ## ASM
* **In:**
* `>PUSHB fd`
* `>PUSHW addr`
* `>LIBCALL hLIBTCPIP,LIBTCPIP.socket`
@ -130,15 +128,21 @@ SKT.bind jsr SKT.PullLocAddr
sta SKT.LOC.ADDR+S.SOCKADDR.PORT
stx SKT.LOC.ADDR+S.SOCKADDR.PORT+1
.1 ldx #0
.1 ldx #1
.2 lda SKT.TABLE,x
.2 lda FDs.pHI-1,x
beq .7
phx
>SYSCALL2 GetMemPtr
>STYA ZPTmpPtr1
plx
sta ZPTmpPtr1+1
lda FDs.pLO-1,x
sta ZPTmpPtr1
lda (ZPTmpPtr1)
cmp #S.FD.T.DSOCK
beq .4
cmp #S.FD.T.SSOCK
bne .7
ldy #S.SOCKET.AF
lda (ZPTmpPtr1),y
@ -147,19 +151,20 @@ SKT.bind jsr SKT.PullLocAddr
ldy #S.SOCKET.LOC.ADDR
.3 lda (ZPTmpPtr1),y
.4 lda (ZPTmpPtr1),y
cmp SKT.LOC.ADDR+S.SOCKADDR.ADDR-S.SOCKET.LOC.ADDR,y
bne .7
iny
cpy #S.SOCKET.LOC.PORT+2
bne .3
bne .4
lda #ERR.SKT.BUSY
* sec
rts
.7 inx
cpx #K.SKTTABLE.SIZE
cpx #K.FD.MAX+1
bne .2
jmp SKT.SetLocAddr
@ -169,7 +174,6 @@ SKT.bind jsr SKT.PullLocAddr
* ## C
* `int connect(hFD fd, const struct sockaddr *addr);`
* ## ASM
* **In:**
* `>PUSHB fd`
* `>PUSHW addr`
* `>LIBCALL hLIBTCPIP,LIBTCPIP.socket`
@ -232,7 +236,6 @@ SKT.connect.SEQPKT
* ## C
* `int listen(hFD fd);`
* ## ASM
* **In:**
* `lda fd`
* `>LIBCALL hLIBTCPIP,LIBTCPIP.listen`
* ## RETURN VALUE
@ -268,7 +271,6 @@ SKT.listen.RTS rts
* ## C
* `hFD Accept(hFD fd);`
* ## ASM
* **In:**
* `lda fd`
* `>LIBCALL hLIBTCPIP,LIBTCPIP.accept`
* ## RETURN VALUE
@ -313,7 +315,6 @@ SKT.GetFromQueue
* ## C
* `int shutdown(int fd);`
* ## ASM
* **In:**
* `lda fd`
* `>LIBCALL hLIBTCPIP,LIBTCPIP.shutdown`
* ## RETURN VALUE
@ -331,7 +332,15 @@ SKT.shutdown pha
cmp #S.SOCKET.T.SEQPKT
bcc SKT.shutdown.HQ
ldy #S.SOCKET.TCP.S
bne .15
.11 jsr SKT.GetFromQueue
bcs .15
>SYSCALL2 FreeMem
bcc .11
.15 ldy #S.SOCKET.TCP.S
lda (ZPPtrSKT),y
cmp #S.SOCKET.TCP.S.CLWAIT
bne .10
@ -347,10 +356,11 @@ SKT.shutdown pha
jsr SKT.GetTCB
ldy #S.SOCKET.TCP.S
lda (ZPPtrSKT),y
cmp #S.SOCKET.TCP.S.ESTBLSH
bne .1
jsr SKT.OUT.SendFINACK
jsr TCP.OUT.SendFINACK
lda #S.SOCKET.TCP.S.FINWT1
jmp SKT.StoreTCB.S
@ -358,7 +368,7 @@ SKT.shutdown pha
.1 cmp #S.SOCKET.TCP.S.FINWT2
bne .2
jsr SKT.OUT.SendFINACK
jsr TCP.OUT.SendFINACK
lda #S.SOCKET.TCP.S.LASTACK
jmp SKT.StoreTCB.S
@ -370,32 +380,25 @@ SKT.shutdown pha
jmp SKT.StoreTCB.S
*--------------------------------------
SKT.shutdown.HQ jsr SKT.GetFromQueue
bcs .3
bcs .1
>SYSCALL2 FreeMem
bra SKT.shutdown.HQ
.3 pla get hFD...
ldx #0
.4 cmp SKT.TABLE,x
beq .5
inx
cpx #K.SKTTABLE.SIZE
bne .4
.5 stz SKT.TABLE,x
>SYSCALL2 freemem
* clc
.1 pla get hFD...
*--------------------------------------
SKT.FreeFD tax
lda FDs.pHI-1,x
stz FDs.pHI-1,x
ldy FDs.pLO-1,x
>SYSCALL2 Free
rts
*/--------------------------------------
* # Read (STREAM)
* ## C
* `int skt.read(hFD fd, void *buf, int count);`
* ## ASM
* **In:**
* `>PUSHB fd`
* `>PUSHW buf`
* `>PUSHW count`
@ -615,7 +618,6 @@ SKT.AddDataToSktIn
* ## C
* `int skt.write(hFD fd, const void *buf, int count);`
* ## ASM
* **In:**
* `>PUSHB fd`
* `>PUSHW buf`
* `>PUSHW count`
@ -833,7 +835,6 @@ SKT.GetDataFromSktOut
* ## C
* `hMem recvfrom(hFD fd, struct sockaddr *addr);`
* ## ASM
* **In:**
* `>PUSHB fd`
* `>PUSHW addr` (RecvFrom)
* `>LIBCALL hLIBTCPIP,LIBTCPIP.Recv`
@ -850,7 +851,6 @@ SKT.RecvFrom >PULLW ZPTmpPtr1 addr
* ## C
* `hMem recv(hFD fd);`
* ## ASM
* **In:**
* `lda fd`
* `>LIBCALL hLIBTCPIP,LIBTCPIP.Recv`
* ## RETURN VALUE
@ -963,7 +963,6 @@ SKT.Recv clc
* ## C
* `int skt.sendto(hFD fd, const void *buf, int count, const struct sockaddr *addr);`
* ## ASM
* **In:**
* `>PUSHB fd`
* `>PUSHW buf`
* `>PUSHWI count`
@ -979,7 +978,6 @@ SKT.SendTo jsr SKT.PullRemAddr
* ## C
* `int skt.send(hFD fd, const void *buf, int count);`
* ## ASM
* **In:**
* `>PUSHB fd`
* `>PUSHW buf`
* `>PUSHWI count`
@ -1040,7 +1038,6 @@ SKT.Send.9 rts
* ## C
* `int getsockopt(hFD fd);`
* ## ASM
* **In:**
* `lda fd`
* `>LIBCALL hLIBTCPIP,LIBTCPIP.GetSockOpt`
* ## RETURN VALUE
@ -1056,7 +1053,6 @@ SKT.getsockopt jsr SKT.GetFD
* ## C
* `int setsockopt(hFD fd, short int opts);`
* ## ASM
* **In:**
* `>PUSHB fd`
* `>PUSHB opts`
* `>LIBCALL hLIBTCPIP,LIBTCPIP.SetSockOpt`
@ -1078,7 +1074,6 @@ SKT.setsockopt >PULLA
* ## C
* `int eof(hFD fd);`
* ## ASM
* **In:**
* `lda fd`
* `>LIBCALL hLIBTCPIP,LIBTCPIP.EOF`
* ## RETURN VALUE
@ -1138,19 +1133,6 @@ SKT.CheckTCP ldy #S.SOCKET.O
SKT.BAD lda #ERR.SKT.BAD
sec
rts
*/--------------------------------------
* # GetTable
* Get socket table
* ## C
* `void * gettable();`
* ## ASM
* **In:**
* `>LIBCALL hLIBTCPIP,LIBTCPIP.GetTable`
* ## RETURN VALUE
*\--------------------------------------
SKT.GetTable >LDYA L.SKT.Table
clc
rts
*--------------------------------------
SKT.PullhFDDataInPtrLen
>PULLW ZPDataInLen !!!use DataInPtr/Len
@ -1158,7 +1140,10 @@ SKT.PullhFDDataInPtrLen
SKT.PullhFD >PULLA
SKT.GetFD >SYSCALL2 GetMemPtr
SKT.GetFD tax
lda FDs.pHI-1,x
ldy FDs.pLO-1,x
>STYA ZPPtrSKT
rts
*--------------------------------------
@ -1206,14 +1191,14 @@ SKT.SetRemAddr ldy #S.SOCKET.REM.PORT+1
* SKT.LOC.ADDR = Incoming Frame DST
*--------------------------------------
SKT.FindMatchingLocRem
ldx #0
ldx #1
.1 lda SKT.TABLE,x
.1 lda FDs.pHI-1,x
beq .8
phx
jsr SKT.GetFD
plx
ldy FDs.pLO-1,x
>STYA ZPPtrSKT
ldy #S.SOCKET.AF
lda (ZPPtrSKT),y
@ -1282,12 +1267,12 @@ SKT.FindMatchingLocRem
cpy #S.SOCKET.REM.PORT+2
bne .42
.7 clc x = SKT.TABLE index
.7 clc x = hFD
rts
.8 inx
cpx #K.SKTTABLE.SIZE
bne .1
cpx #K.FD.MAX+1
bcc .1
* sec
rts

View File

@ -240,7 +240,7 @@ TCP.IN.JMP.ESTBLSH
jsr TCP.IN.ACKTheFIN
jsr SKT.OUT.SendFINACK
jsr TCP.OUT.SendFINACK
lda #S.SOCKET.TCP.S.LASTACK
jmp SKT.StoreTCB.S
@ -386,13 +386,14 @@ TCP.IN.SetDataInPtrAndLen
stx ZPDataInPtr+1
TCP.IN.RTS rts
*--------------------------------------
TCP.SENDCLOSE ldx #0
TCP.SENDCLOSE ldx #1
.1 phx
lda SKT.TABLE,x
lda FDs.pHI-1,x
beq .8
jsr SKT.GetFD
ldy FDs.pLO-1,x
>STYA ZPPtrSKT
ldy #S.SOCKET.AF
lda (ZPPtrSKT),y
@ -456,18 +457,16 @@ TCP.SENDCLOSE ldx #0
ldy #S.SOCKET.SQ.hOutMem
jsr TCP.SENDCLOSE.PIPE
.7 plx
phx
.7 pla
pha
lda SKT.TABLE,x
stz SKT.TABLE,x
>SYSCALL2 freemem
jsr SKT.FreeFD
.8 plx
inx
cpx #K.SKTTABLE.SIZE
bne .1
cpx #K.FD.MAX+1
bcc .1
clc
rts
@ -531,7 +530,7 @@ TCP.OUT.SEQSEND ldy #S.TCP.WINDOW
jmp SKT.StoreTCB exits with CC
*--------------------------------------
SKT.OUT.SendFINACK
TCP.OUT.SendFINACK
lda #S.TCP.OPTIONS.FIN+S.TCP.OPTIONS.ACK
jsr TCP.OUT.SendOptA Send FIN/ACK
bcs .9
@ -569,8 +568,8 @@ TCP.OUT.SendOpt >LDYAI 0
ldy #S.SOCKET.TCP.O
lda (ZPPtrSKT),y
sec DONT Queue if fail
.HS 90 BCC
* sec DONT Queue if fail
* .HS 90 BCC
TCP.OUT.Send clc Queue if fail

View File

@ -32,6 +32,7 @@ AUXPIPE .EQ 1
.INB inc/io.i
.FIN
.INB inc/a2osx.i
.INB inc/kernel.i
.INB inc/mli.e.i
.INB inc/nic.i
.INB inc/eth.i
@ -115,7 +116,6 @@ CS.START cld
.DA SKT.setsockopt
.DA SKT.EOF
.DA SKT.GetTable
*--------------------------------------
L.IPCFG .DA IPCFG
L.ARP.REQ .DA ARP.REQ
@ -124,7 +124,6 @@ L.SA.LOCAL .DA SA.LOCAL
L.SA.REMOTE .DA SA.REMOTE
L.DNS.MSG .DA DNS.MSG
L.DNS.CACHE .DA DNS.CACHE
L.SKT.Table .DA SKT.Table
L.HST.SScanF .DA HST.SScanF
L.IOCTL .DA IOCTL
L.DCB.NIC .DA DCB.NIC
@ -391,7 +390,6 @@ hDNSSocket .BS 1
DNS.TmpCache .BS S.DNSCACHE
ARP.TmpCache .BS S.ARPCACHE
*--------------------------------------
SKT.TABLE .BS K.SKTTABLE.SIZE
SKT.LOC.ADDR .BS S.SOCKADDR
SKT.REM.ADDR .BS S.SOCKADDR
SKT.Cache .EQ *-S.SOCKET.TCP.INTAIL

View File

@ -91,33 +91,55 @@ IO.R.SetAttr
*--------------------------------------
IO.Q.ChMod
IO.R.ChMod
*--------------------------------------
IO.Q.FStat
*--------------------------------------
IO.R.FStat lda #MLI.E.BADCALL
lda #MLI.E.BADCALL
sec
rts
*--------------------------------------
IO.Q.FStat jsr IO.GetFD
jsr IO.Q.Stat1
jsr IO.WriteSocket
bcs .9
jmp IO.Sleep
.9 >POP 3
jmp IO.Exit
*--------------------------------------
IO.R.FStat jsr IO.ReadSocket
bvs .99
bcs .98
jsr CORE.CheckSMBStatus
lda #MLI.E.INVPATH Return this for stat() match ProDOS Behavior
bcs .98
jsr CORE.GetRespDataPtr1
jsr IO.FileInfo2StatBuf
>PULLW ZPPtr2 Stat Buffer
jsr IO.StatBuf2Ptr2
inc pStack Pop hFILE
clc
jmp IO.Exit
.98 >POP 3
jmp IO.Exit
.99 jmp IO.SleepCont
*--------------------------------------
IO.Q.Stat >STYA pPath resolved path
jsr CORE.ReqT2SetupX
ldx #0
.1 lda SMB.QueryPathInfo,x
sta (ZPReqPtr),y
iny
inx
cpx #SMB.QueryPathInfo.Len
bne .1
jsr CORE.ReqT2SetupPtr2
jsr CORE.AppendPathPtr2
jsr CORE.AddYReqLenPtr2
jsr CORE.SetT2ReqLen
jsr IO.Q.Stat1
jsr IO.WriteSocket
bcs .9
@ -143,11 +165,11 @@ IO.R.Stat jsr IO.ReadSocket
>PULLW ZPPtr2 Stat Buffer
inc pStack Skip Filename
inc pStack
jsr IO.StatBuf2Ptr2
inc pStack Pop Filename
inc pStack
clc
jmp IO.Exit
@ -158,6 +180,25 @@ IO.R.Stat jsr IO.ReadSocket
.99 jmp IO.SleepCont
*--------------------------------------
IO.Q.Stat1 jsr CORE.ReqT2SetupX
ldx #0
.1 lda SMB.QueryPathInfo,x
sta (ZPReqPtr),y
iny
inx
cpx #SMB.QueryPathInfo.Len
bne .1
jsr CORE.ReqT2SetupPtr2
jsr CORE.AppendPathPtr2
jsr CORE.AddYReqLenPtr2
jmp CORE.SetT2ReqLen
*--------------------------------------
IO.Q.MKDir >STYA pPath resolved path
jsr CORE.ReqT2SetupX
@ -203,7 +244,7 @@ IO.R.MKDir jsr IO.ReadSocket
.99 jmp IO.SleepCont
*--------------------------------------
IO.Q.OpenDir >STYA pPath resolved path
>SYSCALL PutS
jsr IO.NewFD
bcs .98
@ -218,10 +259,7 @@ IO.Q.OpenDir >STYA pPath resolved path
iny
sta (pFD),y
>PUSHW pPath
>PUSHWZ
>PUSHB hFD
>SYSCALL2 mknod
jsr IO.NewFILE
bcc .98
pha
@ -665,28 +703,11 @@ IO.R.ReadDir.Type
rts
*--------------------------------------
*--------------------------------------
IO.Q.CloseReg
IO.Q.CloseDir tax
lda hFDs.hName-1,x
beq .1
phx
stz hFDs.hName-1,x
>SYSCALL2 FreeMem
plx
.1 lda hFDs-1,x
stz hFDs-1,x
>SYSCALL2 FreeMem
IO.Q.CloseDir jsr IO.FreeFILE
* clc
jmp IO.Exit
.8 jmp IO.Exit
*--------------------------------------
* IO.R.CloseDir
*--------------------------------------
@ -800,13 +821,12 @@ IO.R.FOpen jsr IO.ReadSocket
ldy #4 path
lda (pStack),y
>PUSHA
sta pPath
iny
lda (pStack),y
>PUSHA
sta pPath+1
>PUSHWZ mod
>PUSHB hFD
>SYSCALL2 mknod
jsr IO.NewFILE
bcc .98
pha
@ -912,8 +932,7 @@ IO.R.FClose sta hFILE
jsr CORE.CheckSMBStatus
bcs .98
lda hFILE
jsr IO.Q.CloseReg
jsr IO.FreeFILE
clc
@ -1372,67 +1391,6 @@ IO.R.Rename jsr IO.ReadSocket
.99 jmp IO.SleepCont
*--------------------------------------
IO.NewFD ldx #1
.1 lda hFDs-1,x
beq .2
inx
cpx #K.hFD.MAX+1
bne .1
lda #E.OOH
* sec
rts
.2 stx hFILE
>LDYAI 16 S.FD.REG = S.FD.DIR = 16
>SYSCALL2 GetMem
bcs .9
>STYA pFD
stx hFD
txa
ldx hFILE
sta hFDs-1,x
stz hFDs.hName-1,x
lda hHandler
ldy #S.FD.PFT
sta (pFD),y
* clc
.9 rts
*--------------------------------------
IO.GetFD sta hFILE
tax
phx
lda hFDs.hName-1,x
>SYSCALL2 GetMemPtr
>STYA pPath
plx
lda hFDs-1,x
>SYSCALL2 GetMemPtr
>STYA pFD
rts
*--------------------------------------
IO.FreeFD pha
lda hFD
>SYSCALL2 FreeMem
ldx hFILE
stz hFDs-1,x
pla
rts
*--------------------------------------
IO.RWGetFidOfs ldx #6
ldy #S.FD.REG.REF
@ -1717,6 +1675,96 @@ IO.IsDigit cmp #'0'
.9 sec
.99 rts
*--------------------------------------
IO.NewFD ldx #1
.1 lda FDs.pHI-1,x
beq .2
inx
cpx #K.FD.MAX+1
bcc .1
lda #E.OOH
* sec
rts
.2 stx hFD
>LDYAI S.FD.REG S.FD.DIR = 16
>SYSCALL2 GetMem
bcs .9
>STYA pFD
ldx hFD
sta FDs.pHI-1,x
tya
sta FDs.pLO-1,x
lda hHandler
ldy #S.FD.PFT
sta (pFD),y
* clc
.9 rts
*--------------------------------------
IO.GetFD sta hFILE
tay
ldx FILEs.hFD-1,y
stx hFD
lda FDs.pLO-1,x
sta pFD
lda FDs.pHI-1,x
sta pFD+1
lda FILEs.hName-1,y
>SYSCALL2 GetMemPtr
>STYA pPath
rts
*--------------------------------------
IO.NewFILE >PUSHW pPath
>PUSHWZ
>PUSHB hFD
>SYSCALL2 mknod
bcs .9
tax
inc FILEs.oCnt-1,x
* clc
.9 rts
*--------------------------------------
IO.FreeFILE ldx hFILE
lda FILEs.hFD-1,x
sta hFD
stz FILEs.hFD-1,x
lda FILEs.hName-1,x
beq IO.FreeFD
stz FILEs.hName-1,x
>SYSCALL2 FreeMem
*--------------------------------------
IO.FreeFD ldx hFD
lda FDs.pHI-1,x
beq .8
stz FDs.pHI-1,x
ldy FDs.pLO-1,x
>SYSCALL2 Free
.8 clc
rts
*--------------------------------------
MAN
SAVE usr/src/sbin/cifsd.s.io
LOAD usr/src/sbin/cifsd.s

View File

@ -108,8 +108,8 @@ CS.RUN ldy #S.PS.ARGC
>PUSHYA
>PUSHBI O.RDWR
>PUSHBI 0 type
>PUSHWZ auxtype
>PUSHA auxtype
>PUSHA
>SYSCALL FOpen
bcs .99

View File

@ -151,7 +151,7 @@ CS.RUN.EXEC >PUSHEA.G Username
ldx #1
.1 lda S.Table.hSID-1,x
.1 lda USRs.hSID-1,x
beq .2
inx
@ -171,11 +171,11 @@ CS.RUN.EXEC >PUSHEA.G Username
sta (pPS),y
lda ZPNewSID
sta S.Table.hSID-1,x
sta USRs.hSID-1,x
ldy #S.PS.hStdIn
lda (pPS),y
sta S.Table.hFile-1,x
sta USRs.hFile-1,x
jsr CS.RUN.EXECPS
@ -186,8 +186,8 @@ CS.RUN.EXEC >PUSHEA.G Username
stz ZPNewSID
.8 ldx ZPNewSession
stz S.Table.hSID-1,x
stz S.Table.hFile-1,x
stz USRs.hSID-1,x
stz USRs.hFile-1,x
ldy #S.PS.hSession
lda ZPOldSession

View File

@ -7,6 +7,7 @@ NEW
*--------------------------------------
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/kernel.i
.INB inc/eth.i
.INB inc/libtcpip.i
.INB inc/net.telnet.i
@ -92,7 +93,9 @@ CS.RUN lda #TIMEOUT.MAX
cmp #$03
bne .1
* sec
rts
.99 pha
@ -114,6 +117,7 @@ CS.RUN.INIT ldx #3
lda #1
>SYSCALL ArgV
bcs CS.RUN.PORTOK
>SYSCALL AToI
>STYA SA.LOCAL+S.SOCKADDR.PORT
@ -147,6 +151,7 @@ CS.RUN.PORTOK >PUSHBI S.SOCKET.T.STREAM
pla
bcc .2
>LIBCALL hLIBTCPIP,LIBTCPIP.Shutdown
bra .2
@ -160,7 +165,10 @@ CS.RUN.PORTOK >PUSHBI S.SOCKET.T.STREAM
CS.RUN.CLIENT >SLEEP give some time for TCPIP SYN/ACK
sta hClientSocket
>SYSCALL GetMemPtr
tax
lda FDs.pHI-1,x
ldy FDs.pLO-1,x
>STYA ZPSktPtr
>PUSHW L.MSG.INCOMING
@ -184,8 +192,8 @@ CS.RUN.CLIENT >SLEEP give some time for TCPIP SYN/ACK
>PUSHBI 1
>SYSCALL SPrintF
CS.RUN.CLIENT1 >PUSHEA.G NodBuf+5
>PUSHW 0
CS.RUN.CLIENT1 >PUSHEA.G NodBuf
>PUSHWZ
>PUSHB hClientSocket
>SYSCALL MKNod
bcs .9
@ -204,9 +212,12 @@ CS.RUN.CLIENT1 >PUSHEA.G NodBuf+5
*--------------------------------------
CS.DOEVENT lda (pEvent)
bpl .9 is it a TIMER event?
lda TimeOut
beq .9
dec TimeOut
.9 sec do not discard TIMER event
rts
*--------------------------------------
@ -233,7 +244,7 @@ MSG.TCPIPERR .AZ "TELNETD:TCP/IP Not initialized properly."
MSG.SKTERR .AZ "TELNETD:Listen Error."
MSG.INCOMING .CZ "TELNETD:Incoming Connection [SKT=%h] From : %d.%d.%d.%d\r\n"
*--------------------------------------
NOD.Template .AZ "/dev/tty%h"
NOD.Template .AZ "/tmp/tty%h"
CMD.Template .AZ "${ROOT}sbin/getty -E %s ${ROOT}sbin/login"
*--------------------------------------
SA.LOCAL .DA #AF.INET S.SOCKADDR.AF

611
SHARED/X.UDETH.DRV.S.txt Normal file
View File

@ -0,0 +1,611 @@
NEW
AUTO 3,1
.OP 65C02
.OR $2000
*--------------------------------------
.DO UDETHDMA=1
.TF drv/udeth.d.drv
.ELSE
.TF drv/udeth.drv
.FIN
*--------------------------------------
UD.ROM.SignOfs .EQ $EC "UltimateDrive"
UD.ROM.VerOfs .EQ $F9 MAX/MIN
UD.IO.Exec .EQ $C080 Write
UD.IO.Status .EQ $C081 Read
UD.IO.Cmd .EQ $C082 Write
UD.IO.Cmd.NetOpen .EQ $70
UD.IO.Cmd.NetClose .EQ $71
UD.IO.Cmd.NetSend .EQ $72
UD.IO.Cmd.NetRcvd .EQ $73
UD.IO.Cmd.NetPeek .EQ $74
UD.IO.Cmd.NetStatus .EQ $75
UD.IO.Cmd.NetSDMA .EQ $76 Send Frame Via DMA
UD.IO.Cmd.NetRDMA .EQ $77 Read Frame via DMA
UD.IO.UnitNum .EQ $C083 Write
UD.IO.MemPtrL .EQ $C084
UD.IO.MemPtrH .EQ $C085
UD.IO.BlockNum .EQ $C086 Write 4 bytes, BE
UD.IO.RData .EQ $C087 Read
UD.IO.WData .EQ $C088 Write
UD.IO.DoDMA .EQ $C089 Write
UD.IO.Mode .EQ $C08D Read NZ = DMA, Write b7
*--------------------------------------
.DUMMY
.OR ZPBIN
ZS.START
ZPPtr1 .BS 2
ZPArgPtr .BS 2
DEVSLOT0x .BS 1
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp Dev.Detect cld,jmp abs=DRV
.DA #$61 6502,Level 1 (65c02)
.DA #1 DRV Layout Version 1
.DA 0
.DA CS.END-CS.START Code Length
.DA 0
.DA 0
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
L.MSG.DETECT .DA MSG.DETECT
L.MSG.DETECT.OK .DA MSG.DETECT.OK
L.MSG.DETECT.KO .DA MSG.DETECT.KO
L.DRV.CS.START .DA DRV.CS.START
L.FD.DEV .DA FD.DEV
L.FD.DEV.NAME .DA FD.DEV.NAME
L.SSCANF.MAC .DA SSCANF.MAC
L.MAC0 .DA DCB+S.DCB.NIC.MAC
.DA DCB+S.DCB.NIC.MAC+1
.DA DCB+S.DCB.NIC.MAC+2
.DA DCB+S.DCB.NIC.MAC+3
.DA DCB+S.DCB.NIC.MAC+4
.DA DCB+S.DCB.NIC.MAC+5
.DA 0 End Of Reloc Table
*--------------------------------------
Dev.Detect >STYA ZPArgPtr
>LDYA L.MSG.DETECT
>SYSCALL PutS
lda #UD.ROM.SignOfs
sta ZPPtr1
lda #$C7
.1 sta ZPPtr1+1
ldy #ROM.SIG.L-1
.10 lda (ZPPtr1),y
cmp ROM.SIG,y
bne .2
dey
bpl .10
lda ZPPtr1+1
and #$0F
sta DEVSLOT0x
asl
asl
asl
asl
sta DEVSLOTx0
bra .3
.2 dec FD.DEV.NAME+3
lda ZPPtr1+1
dec
cmp #$C0
bne .1
>LDYA L.MSG.DETECT.KO
>SYSCALL PutS
lda #MLI.E.NODEV
sec
.99 rts
*--------------------------------------
.3 ldy #UD.ROM.VerOfs
lda (ZPPtr1),y
sta DIB+S.DIB.VERSION+1
iny
lda (ZPPtr1),y
sta DIB+S.DIB.VERSION
jsr Dev.ParseArgs
bcs .99
.8 >PUSHW L.MSG.DETECT.OK
>PUSHW L.FD.DEV.NAME
>PUSHBI 2
>SYSCALL PrintF
>PUSHWI DRV.END
>PUSHWI DRV.CS.END-DRV.CS.START
>PUSHWI DRV.CS.START
>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
>SYSCALL MKDev
bcs .9
ldx DEVSLOT0x
lda #A2osX.S.NIC
sta A2osX.S,x
* clc
.9 rts
*--------------------------------------
Dev.ParseArgs lda (ZPArgPtr)
bne .1
lda A2osX.RANDOM16
eor A2osX.TIMER16
sta DCB+S.DCB.NIC.MAC+3
eor A2osX.RANDOM16+1
sta DCB+S.DCB.NIC.MAC+4
eor A2osX.TIMER16+1
sta DCB+S.DCB.NIC.MAC+5
clc
rts
.1 >PUSHW ZPArgPtr
>PUSHW L.SSCANF.MAC
ldx #0
.2 >PUSHW L.MAC0,x
inx
inx
cpx #12
bne .2
>PUSHBI 12 6 x byte PTRs
>SYSCALL SScanF
bcc .8
lda #E.SYN
* sec
.8 rts
*--------------------------------------
CS.END
MSG.DETECT .CZ "Ultimate Drive ETH/W5500 Driver."
MSG.DETECT.OK .CZ "Ultimate Drive ETH/W5500 Installed As Device : %s\r\n"
MSG.DETECT.KO .CZ "Hardware Not Found."
SSCANF.MAC .CZ "%h:%h:%h:%h:%h:%h"
ROM.SIG .AS "UltimateDrive"
ROM.SIG.L .EQ *-ROM.SIG
*--------------------------------------
FD.DEV .DA #S.FD.T.CDEV
.DA #0 HANDLER
.DA #0 BUSID
.DA #0 DEVID
.DA 0 BUSPTR
.BS 2 DRVPTR
.DA 0 DCBPTR
.DA 0 BUFPTR
FD.DEV.NAME .AZ "eth7"
*--------------------------------------
* Driver Code
*--------------------------------------
* https://github.com/profdc9/ip65/blob/main/drivers/dan2d.s
*--------------------------------------
ZPIOCTL .EQ ZPDRV
ZPBufPtr .EQ ZPDRV+2
Counter .EQ ZPDRV+4
*--------------------------------------
DRV.CS.START cld
jmp (.1,x)
.1 .DA STATUS
.DA A2osX.BADCALL
.DA A2osX.BADCALL
.DA A2osX.BADCALL
.DA A2osX.BADCALL
.DA A2osX.BADCALL
.DA OPEN
.DA CLOSE
.DA READ
.DA WRITE
.DA 0 end or relocation
*--------------------------------------
STATUS >STYA ZPIOCTL
jsr IO.GetStatus
bcs STATUS.99
ldy #S.IOCTL.S
lda (ZPIOCTL),y
beq .1
cmp #S.IOCTL.S.GETDIB
bne STATUS.DCB
ldx #S.DIB-1
.HS 2C bit abs
.1 ldx #3
ldy #S.IOCTL.BUFPTR
lda (ZPIOCTL),y
sta .3+1
iny
lda (ZPIOCTL),y
sta .3+2
.2 lda DIB,x
.3 sta $ffff,x SELF MODIFIED
dex
bpl .2
clc
rts
STATUS.DCB cmp #S.IOCTL.S.GETDCB
bne STATUS.9
stz DCB+S.DCB.NIC.LINK
lda #S.DCB.NIC.LINK.OK
tsb DCB+S.DCB.NIC.LINK
lda #S.DCB.NIC.LINK.FD
tsb DCB+S.DCB.NIC.LINK
.1 ldy #S.IOCTL.BUFPTR
lda (ZPIOCTL),y
sta .3+1
iny
lda (ZPIOCTL),y
sta .3+2
ldx #S.DCB.NIC-1
.2 lda DCB,x
.3 sta $ffff,x SELF MODIFIED
dex
bpl .2
clc
rts
STATUS.9 lda #MLI.E.BADCTL
STATUS.99 sec
rts
*--------------------------------------
OPEN lda #S.DIB.S.OPENED
bit DIB+S.DIB.S
bne .9
jsr CLOSE
* ldx DEVSLOTx0 Done by CLOSE
lda #UD.IO.Cmd.NetOpen
jsr IO.ExecA
bcs .99
ldy #0
.1 lda UD.IO.RData,x
sta DCB+S.DCB.NIC.MAC,y
iny
cpy #6
bcc .1
lda #S.DIB.S.OPENED
tsb DIB+S.DIB.S
clc
rts
.9 lda #MLI.E.OPEN
sec
.99 rts
*--------------------------------------
CLOSE ldx DEVSLOTx0
lda #UD.IO.Cmd.NetClose
jsr IO.ExecA
bcs .9
lda #S.DIB.S.OPENED
trb DIB+S.DIB.S
* clc
.9 rts
*--------------------------------------
READ php
sei
>STYA ZPIOCTL
ldx DEVSLOTx0
lda #UD.IO.Cmd.NetPeek
jsr IO.ExecA
bcs READWRITE.99
lda UD.IO.RData,x
sta Counter
lda UD.IO.RData,x
sta Counter+1
ora Counter
beq READWRITE.9
>LDYA Counter
>SYSCALL2 GetMem
bcs READWRITE.99
>STYA ZPBufPtr
stx .8+1
phy
ldy #S.IOCTL.BUFPTR+1
sta (ZPIOCTL),y
dey
pla
sta (ZPIOCTL),y
ldx DEVSLOTx0
.DO UDETHDMA=0
lda #UD.IO.Cmd.NetRcvd
jsr IO.ExecA
bcs READWRITE.99
lda Counter
ldy #S.IOCTL.BYTECNT
sta (ZPIOCTL),y
eor #$ff
sta Counter
lda Counter+1
iny
sta (ZPIOCTL),y
eor #$ff
sta Counter+1
ldy #0
.1 inc Counter
bne .2
inc Counter+1
beq .8
.2 lda UD.IO.RData,x
sta (ZPBufPtr),y
iny
bne .1
inc ZPBufPtr+1
bra .1
.ELSE
lda UD.IO.Status,x
lda Counter
ldy #S.IOCTL.BYTECNT
sta (ZPIOCTL),y
lda Counter+1
iny
sta (ZPIOCTL),y
lda ZPBufPtr
sta UD.IO.MemPtrL,x
lda ZPBufPtr+1
sta UD.IO.MemPtrH,x
lda #UD.IO.Cmd.NetRDMA
jsr IO.ExecA
bcs READWRITE.99
lda UD.IO.DoDMA,x
.1 lda UD.IO.Status,x
bmi .1
lsr
bcs READWRITE.99
.FIN
.8 lda #$ff SELF MODIFIED
plp
clc
rts
*--------------------------------------
READWRITE.9 lda #E.NODATA
READWRITE.99 plp
sec
rts
*--------------------------------------
WRITE php
sei
>STYA ZPIOCTL
.DO UDETHDMA=0
ldx DEVSLOTx0
lda #UD.IO.Cmd.NetSend
sta UD.IO.Cmd,x
ldy #S.IOCTL.BYTECNT
lda (ZPIOCTL),y
sta UD.IO.WData,x
eor #$ff
sta Counter
iny
lda (ZPIOCTL),y
sta UD.IO.WData,x
eor #$ff
sta Counter+1
.FIN
ldy #S.IOCTL.BUFPTR
lda (ZPIOCTL),y
sta ZPBufPtr
iny
lda (ZPIOCTL),y
sta ZPBufPtr+1
ldy #S.ETH.SRCMAC+5
ldx #5
.10 lda DCB+S.DCB.NIC.MAC,x
sta (ZPBufPtr),y
dey
dex
bpl .10
ldx DEVSLOTx0
.DO UDETHDMA=0
ldy #0
.1 inc Counter
bne .2
inc Counter+1
beq .8
.2 lda (ZPBufPtr),y
sta UD.IO.WData,x
iny
bne .1
inc ZPBufPtr+1
bra .1
.8 jsr IO.Exec
bcs WRITE.99
.ELSE
lda UD.IO.Status,x
ldy #S.IOCTL.BYTECNT
lda (ZPIOCTL),y
sta UD.IO.WData,x
lda Counter+1
iny
lda (ZPIOCTL),y
sta UD.IO.WData,x
lda ZPBufPtr
sta UD.IO.MemPtrL,x
lda ZPBufPtr+1
sta UD.IO.MemPtrH,x
lda #UD.IO.Cmd.NetSDMA
jsr IO.ExecA
bcs READWRITE.99
lda UD.IO.DoDMA,x
.1 lda UD.IO.Status,x
bmi .1
lsr
bcs READWRITE.99
.FIN
plp
clc
rts
WRITE.99 lda #MLI.E.IO
plp
sec
rts
*--------------------------------------
IO.GetStatus stz DCB+S.DCB.NIC.LINK
lda #S.DCB.NIC.SPEED.10
sta DCB+S.DCB.NIC.SPEED
ldx DEVSLOTx0
lda #UD.IO.Cmd.NetStatus
jsr IO.ExecA
bcs .99
lda UD.IO.RData,x PHYCFGR
lsr CS if Link OK
ror DCB+S.DCB.NIC.LINK
lsr CS if 100mb
bcc .1
inc DCB+S.DCB.NIC.SPEED
.1 lsr CS if FD
bcc .2
lda #S.DCB.NIC.LINK.FD
tsb DCB+S.DCB.NIC.LINK
.2 lda UD.IO.RData,x VERSIONR
sta DIB+S.DIB.VERSION
clc
.99 rts
*--------------------------------------
IO.ExecA sta UD.IO.Cmd,x
IO.Exec stz UD.IO.UnitNum,x
lda UD.IO.Exec,x
.1 lda UD.IO.Status,x
bmi .1
lsr CS if error, A = ERROR CODE ?
rts
*--------------------------------------
DRV.CS.END
DEVSLOTx0 .BS 1
*--------------------------------------
DIB .DA #0
.DA #0,#0,#0 size
.PS "udeth/W5500 "
.DA #S.DIB.T.NIC
.BS 1 Subtype
.BS 2 Version
*--------------------------------------
DCB .DA #S.DCB.T.NIC
.BS 1 FLAGS
.BS 1 LINK
.BS 1 SPEED
.HS 000000000000 MAC
.BS 12 IP/MASK/GW
*--------------------------------------
DRV.END
MAN
SAVE usr/src/shared/x.udeth.drv.s
LOAD usr/src/drv/udeth.d.drv.s
ASM

View File

@ -63,7 +63,6 @@ K.UnloadLib pha
*/--------------------------------------
* # LoadDrv
* ## ASM
* **In:**
* Y,A = PTR to "NAME.DRV [PARAM]" C-String
* ## RETURN VALUE
* none
@ -234,7 +233,6 @@ BIN.Load.Free php
* ## C
* `void * insdrv (void * src, void * crvcsstart, void * drvcssize, void * drvend);`
* ## ASM
* **In:**
* `>PUSHW DRV.END`
* `>PUSHW DRV.CS.SIZE`
* `>PUSHW DRV.CS.START`
@ -273,6 +271,7 @@ K.InsDrv >STYA ZPPtr3 SRC PTR for move
eor #$ff
pha
ldy #0
.1 inx
bne .2
@ -281,6 +280,7 @@ K.InsDrv >STYA ZPPtr3 SRC PTR for move
beq .3
pha
.2 lda (ZPPtr3),y
sta (ZPPtr4),y
iny
@ -296,33 +296,6 @@ K.InsDrv >STYA ZPPtr3 SRC PTR for move
.8 lda #$ff SELF MODIFIED
.9 rts
*--------------------------------------
MEM.GetKBuf pha
tya
clc
adc DevMgr.Free
tax
pla
adc DevMgr.Free+1
bcs .99 we crossed $FFFF, out of mem
cpx #DevMgr.HiMem
pha
sbc /DevMgr.HiMem
pla
bcs .99 No More Room...
ldy DevMgr.Free
stx DevMgr.Free
ldx DevMgr.Free+1
sta DevMgr.Free+1
txa
* clc
rts
.99 lda #E.OOM
* sec
rts
*--------------------------------------
BIN.RelExe ldy #H.BIN.T+1
lda (ZPPtr1),y
cmp /H.BIN.T.BIN65

View File

@ -7,7 +7,7 @@ CORE.Run ldx #1
.1 stx CORE.PSIndex
lda PS.Table.hPS,x
lda PSs.hPS,x
beq .8
jsr K.GetMemPtr
@ -80,7 +80,7 @@ CORE.Events jsr CORE.GetEvents
jsr CORE.Dispatch
bcc .4 CC=All Events Dispatched
lda PS.Table.PID Select PS0
lda PSs.PID Select PS0
jsr K.GetMemPtr
>STYA pPs
>LDYAI K.STACKTOP
@ -287,7 +287,7 @@ CORE.Dispatch ldx #1 skip PS0
.1 stx CORE.PSIndex
lda PS.Table.hPS,x
lda PSs.hPS,x
beq .5
jsr K.GetMemPtr
@ -352,7 +352,7 @@ CORE.Dispatch ldx #1 skip PS0
CORE.GetPSByID jsr CORE.GetPS
bcs .9
lda PS.TABLE.hPS,y
lda PSs.hPS,y
jmp K.GetMemPtr
.9 rts
@ -365,7 +365,7 @@ CORE.GetPS tay
ldy #0
bra .2 Skip PS0
.1 cmp PS.Table.PID,y
.1 cmp PSs.PID,y
beq .8
.2 iny
@ -552,23 +552,23 @@ CORE.IRQ.Switch inc IRQ.Tick
sta CORE.CPUStatCnt
ldx #K.PS.MAX-1
.1 lda PS.Table.Hits,x
stz PS.Table.Hits,x
sta PS.Table.Stats,x
.1 lda PSs.Hits,x
stz PSs.Hits,x
sta PSs.Stats,x
dex
bpl .1
.2 lda IRQ.InKernel
bpl .3
inc PS.Table.Hits
inc PSs.Hits
.9 clv
clc
rts
.3 ldx CORE.PSIndex
inc PS.Table.Hits,x
inc PSs.Hits,x
bit A2osX.F A2osX.F.PMODE .EQ %01000000
bvc .8

View File

@ -11,7 +11,7 @@ C4 .EQ D2.S
C5 .EQ E0.S
*--------------------------------------
.LIST OFF
.DO MAIN.S>$C00
.DO MAIN.S>$BC0
.LIST ON
* ERROR:MAIN too big
.LIST OFF

View File

@ -125,7 +125,7 @@ SaveSX .EQ $101 Aux
FOUTBuf .EQ $103 Aux
*--------------------------------------
* Main $200 -> 2FF : (Used By ProDOS,Clock DRV....)
* Main $300 -> 3EF : <free>
* Main $300 -> 3EF : Z80 I/O
* Main $3F0 -> 3FF : SYS Vectors (reset,IRQ...)
* Aux $200 -> 3FD : /RAM Driver
* Aux $3FE -> 3FF : IRQ Vector
@ -143,14 +143,12 @@ Mem.Free .EQ $0802
Mem.HiMem .EQ $0804
Mem.LastSlot .EQ $0806
*--------------------------------------
* free $1000->$1FFF = $1000 (4096) Aux
*--------------------------------------
K.S.STAT .EQ $1C00 S.STAT for internal kernel operations
K.S.EVT .EQ $1C40 K.EVT.MAX*S.EVT=4*8=32b
K.S.IOCTL .EQ $1C60 9 bytes
K.MLI.PATH .EQ $1C69 64+1
K.MLI.PARAMS .EQ $1CAA Main, 18 bytes min for GetFileInfo
* GetFileInfoEx/SetFileInfoEx need 1 + 2 + 48 = 51
* GetFileInfoEx/SetFileInfoEx need 1 + 2 + 48 = 51 ->$1CDD
*--------------------------------------
K.STACKTOP .EQ $1CFF
*--------------------------------------

View File

@ -12,36 +12,27 @@ K.GetDevByName >STYA ZPPtr1 requested dev name
ldx #1
.1 lda hFDs-1,x
.1 ldy FDs.pHI-1,x
beq .7
sta IO.hFD
jsr K.GetMemPtr
>STYA pFD
cpy #$C0
bcc .7
lda hFDs.hName-1,x
bne .2
stx IO.hFD
sty pFD+1
lda FDs.pLO-1,x
sta pFD
jsr DEV.GetPDrv
lda pFD
clc
adc #S.FD.DEV
sta ZPPtr2
lda pFD+1
tya
adc /S.FD.DEV
sta ZPPtr2+1
bra .3
.2 jsr K.GetMemPtr
>STYA ZPPtr2
lda (ZPPtr2)
cmp #'/' REG/DIR
beq .7
.3 ldy #$ff
ldy #$ff
.4 iny
lda (ZPPtr1),y
@ -51,15 +42,14 @@ K.GetDevByName >STYA ZPPtr1 requested dev name
eor #0
bne .4
stx IO.hFILE
>LDYA pFD
ldx IO.hFD
clc
rts
.7 inx no....loop
cpx #K.hFD.MAX+1
bne .1
.7 inx
cpx #K.FD.MAX+1
bcc .1
lda #MLI.E.NODEV
* sec
@ -91,7 +81,12 @@ K.GetDev.9 rts
* ## RETURN VALUE
* A = hDEV
*\--------------------------------------
K.MKDev jsr SHARED.PullP2P1 ptr2=name,ptr1=fd
K.MKDev jsr SHARED.PullP2P1 ptr2=devname,ptr1=fd
jsr DEV.GetFreeFD
bcs .9
stx IO.hFD
ldy #$ff
ldx #S.FD.DEV
@ -103,12 +98,18 @@ K.MKDev jsr SHARED.PullP2P1 ptr2=name,ptr1=fd
txa
tay
lda #S.FD.T.CDEV
lda #0
jsr DEV.MkFDy
jsr MEM.GetKBuf
bcs .9
>STYA pFD
>STYA .4+1
ldx IO.hFD
sta FDs.pHI-1,x
tya
sta FDs.pLO-1,x
ldy #S.FD.DEV-1
@ -123,6 +124,7 @@ K.MKDev jsr SHARED.PullP2P1 ptr2=name,ptr1=fd
.3 iny
inx
lda (ZPPtr2),y
.4 sta $ffff,x
bne .3
@ -156,8 +158,10 @@ K.MKDev jsr SHARED.PullP2P1 ptr2=name,ptr1=fd
inx
inx
cpx #K.IRQDEV.MAX*2+1
bne .6
cpx #K.IRQDEV.MAX*2
bcc .6
lda #E.OOH
* sec
@ -171,7 +175,9 @@ K.MKDev jsr SHARED.PullP2P1 ptr2=name,ptr1=fd
sta IRQ.Vectors+1,x
.8 lda IO.hFD
* clc
rts
*/--------------------------------------
* # IOCTL
@ -238,10 +244,60 @@ DEV.CLOSE ldx #IOCTL.CLOSE
DEV.pDrvJmp >LDYAI K.S.IOCTL
DEV.pDrvJmp.1 jmp (pDrv)
*--------------------------------------
DEV.GetPFD sta IO.hFD
* For REG, DIR, PIPE
*--------------------------------------
DEV.MkFD sta .8+1 A = S.FD.T
jsr DEV.GetFreeFD
bcs .9
stx IO.hFD
ldy #16 Y = Size, MAX=16 for S.FD.DIR
lda #0
ldx #S.MEM.F.INIT0+S.MEM.F.FD
jsr MEM.GetMem.YAX
bcs .9
jsr K.GetMemPtr
>STYA pFD
ldx IO.hFD
sta FDs.pHI-1,x
tya
sta FDs.pLO-1,x
jsr Mem.SetOwnerPS0
.8 lda #$ff SELF MODIFIED
sta (pFD)
* clc
.9 rts
*--------------------------------------
DEV.GetFreeFD ldx #1
clc
.1 lda FDs.pHI-1,x
beq .8
inx
cpx #K.FD.MAX+1
bcc .1
lda #E.OOH
* sec
.8 rts
*--------------------------------------
DEV.GetPFD sta IO.hFD
tay
lda FDs.pLO-1,y
sta pFD
lda FDs.pHI-1,y
sta pFD+1
DEV.GetPDrv ldy #S.FD.DEV.DRVPTR
lda (pFD),y
@ -252,69 +308,6 @@ DEV.GetPDrv ldy #S.FD.DEV.DRVPTR
rts
*--------------------------------------
DEV.MkFD ldy #16 Y = Size, MAX=16 for S.FD.DIR
DEV.MkFDy sta .8+1 A = S.FD.T
jsr DEV.GetFreeFD
bcs .9
.2 stx IO.hFILE
lda #0
ldx #S.MEM.F.INIT0+S.MEM.F.FD
jsr MEM.GetMem.YAX
bcs .9
>STYA pFD
stx IO.hFD
jsr Mem.SetOwnerPS0
txa
.7 ldx IO.hFILE
sta hFDs-1,x
stz hFDs.hName-1,x
.8 lda #$ff SELF MODIFIED
sta (pFD)
>LDYA pFD Y,A = pFD, X = hFILE
* clc
.9 rts
*--------------------------------------
DEV.GetFreeFD lda #0
DEV.GetFD ldx #1
.1 cmp hFDs-1,x
beq DEV.GetFD.8
inx
cpx #K.hFD.MAX+1
bne .1
tax
beq DEV.GetFD.8
lda #E.INVH
.HS 2C BIT ABS
.9 lda #E.OOH
* sec
rts
K.MkFD
DEV.GetFD.8 clc
rts
*--------------------------------------
DEV.hFDFree lda IO.hFD
beq DEV.GetFD.8
jmp K.FreeMem
*--------------------------------------
MAN
SAVE usr/src/sys/kernel.s.dev
LOAD usr/src/sys/kernel.s

View File

@ -14,14 +14,12 @@ NEW
* A = EC
*\--------------------------------------
K.OpenDir jsr PFT.CheckPathYA
bcs .9
bcs DIRENT.RTS
jsr FS.OPEN.DIR
bcs .9
bcs DIRENT.RTS
jmp K.FOpen.REGDIR
.9 rts
*/--------------------------------------
* # ReadDir
* ## C
@ -151,11 +149,11 @@ K.ReadDir.ROOT ldy #S.FD.DIR.FC did we already returned something ?
ldx #0
.6 lda Flt.Table.pftHI,x
.6 lda PFTs.pHI,x
beq .8
sta ZPPtr2+1
lda Flt.Table.pftLO,x
lda PFTs.pLO,x
sta ZPPtr2
ldy #$ff
@ -169,7 +167,7 @@ K.ReadDir.ROOT ldy #S.FD.DIR.FC did we already returned something ?
jsr K.ReadDir.AddStat
.8 inx
cpx #K.FLT.MAX
cpx #K.PFT.MAX
bne .6
* lda #0 done by S.MEM.F.INIT0

View File

@ -40,7 +40,6 @@ K.GetEnv >PULLW FORPNT value
* ## C / CSH
* `int putenv(char *string);`
* ## ASM
* **In:**
* `>PUSHW string`
* `>SYSCALL putenv`
* ## RETURN VALUE
@ -67,7 +66,7 @@ K.GetEnv.I ldy #S.PS.hENV FROM STDLIB:EXPAND
lda (pPS),y
tay
lda S.Table.hSID-1,y
lda USRs.hSID-1,y
tay Y = hSID
pla A = hENV

View File

@ -25,7 +25,7 @@ FS.OPEN.REG >MLICALL MLIGETFILEINFO
bpl .1
lda #S.FI.ST.STD
jsr FS.CREATE
jsr FS.MLICREATE
bcs .9
.2 lda #S.FD.T.REG
@ -71,11 +71,6 @@ FS.OPEN.REG >MLICALL MLIGETFILEINFO
*--------------------------------------
FS.OPEN.ERR pha Save Error Code
jsr FS.MLICLOSE
ldx IO.hFILE Cleanup what MkFD did
lda hFDs-1,x
stz hFDs-1,x
jsr K.FreeMem
pla
sec
@ -129,7 +124,9 @@ FS.WRITE.REG ldx #MLIWRITE
*--------------------------------------
FS.EOF.REG >MLICALL MLIGETMARK
bcs .9
ldy #2
.1 lda K.MLI.PARAMS+2,y
sta ACC32,y
dey
@ -139,11 +136,14 @@ FS.EOF.REG >MLICALL MLIGETMARK
bcs .9
ldy #2
.2 lda K.MLI.PARAMS+2,y
eor ACC32,y
bne .8 FALSE
dey
bpl .2
lda #$ff TRUE
* clc
rts
@ -152,7 +152,12 @@ FS.EOF.REG >MLICALL MLIGETMARK
* clc
.9 rts
*--------------------------------------
FS.CREATE sta K.MLI.PARAMS+7 Storage Type
FS.CLOSE jsr FS.MLICLOSE
bcs FS.RTS
jmp DEV.FreeFD
*--------------------------------------
FS.MLICREATE sta K.MLI.PARAMS+7 Storage Type
ldx #3
.1 lda DATELO,x
@ -168,7 +173,7 @@ FS.CREATE sta K.MLI.PARAMS+7 Storage Type
FS.MLIOPEN >LDYAI 1024 get a ProDOS IOBUF
ldx #S.MEM.F.ALIGN
jsr MEM.GetMem.YAX
bcs .9
bcs FS.RTS
>STYA K.MLI.PARAMS+3 Save Ptr to IOBUF for MLIOPEN call
txa
@ -176,7 +181,7 @@ FS.MLIOPEN >LDYAI 1024 get a ProDOS IOBUF
sta (pFD),y
>MLICALL MLIOPEN
bcs .9
bcs FS.RTS
lda K.MLI.PARAMS+5 get ref_num
ldy #S.FD.REG.REF
@ -186,7 +191,6 @@ FS.MLIOPEN >LDYAI 1024 get a ProDOS IOBUF
* clc
.9
FS.RTS rts
*--------------------------------------
FS.MLICLOSE ldy #S.FD.REG.REF
@ -195,7 +199,7 @@ FS.MLICLOSE ldy #S.FD.REG.REF
sta K.MLI.PARAMS+1
>MLICALL MLICLOSE
* bcs FS.RTS
bcs FS.RTS
.1 ldy #S.FD.REG.IOBUF
lda (pFD),y

View File

@ -195,7 +195,6 @@ GP.AtkCall dec IRQ.InKernel
* # Add32,Sub32,Mul32,IMul32,Div32,IDiv32,Mod32,IMod32,Cmp32,ICmp32
* Return X+Y, X-Y, X*Y, X/Y, X mod Y....
* ## ASM
* **In:**
* `>PUSHL X (long)`
* `>PUSHL Y (long)`
* `>FPU add32`
@ -223,7 +222,6 @@ GP.FpuCall dec IRQ.InKernel
* ## C
* `float pwr ( float x, float y);`
* ## ASM
* **In:**
* `>PUSHF X (float)`
* `>PUSHF Y (float)`
* `>FPU fmul`
@ -254,7 +252,6 @@ GP.FpuCall dec IRQ.InKernel
* `float tan ( float x);`
* `float atan ( float x);`
* ## ASM
* **In:**
* `>PUSHF x (Float)`
* `>FPU log`
* ## RETURN VALUE
@ -293,7 +290,6 @@ GP.SetFAC ldx #FPU.SETFAC
* ## C
* `float f = (float)l;
* ## ASM
* **In:**
* `>PUSHL l` (long)
* `>FPU float`
* ## RETURN VALUE
@ -319,7 +315,6 @@ GP.Float ldy #3
* ## C
* `long int lrintf (float x);`
* ## ASM
* **In:**
* `>PUSHF x`
* `>FPU lrintf`
* ## RETURN VALUE
@ -436,11 +431,11 @@ GP.IRQ.Exit stz IRQ.Skip reset flag
*--------------------------------------
*BrkHandler bra *
*--------------------------------------
* $BED0->$BEEF : Public Variables
* $11D0->$11EF : Public Variables
*--------------------------------------
.BS 32
*--------------------------------------
* $BEF0->$BEFF : Kernel Config Block
* $11F0->$11FF : Kernel Config Block
*--------------------------------------
.DA #6 A2osX.HZ=60hz
.DA #2 A2osX.TTYDEVS=2

View File

@ -137,7 +137,7 @@ Kernel.Init3 sta SETALTZP
>LDYAI S.PS Select Process 0 (Kernel)
jsr K.GetMem0
>STYA pPs
stx PS.Table.hPS
stx PSs.hPS
jsr Mem.SetOwner
lda #1
@ -146,11 +146,7 @@ Kernel.Init3 sta SETALTZP
>STYA pStack
sta pBase+1
>PUSHWI FD.NULL
>PUSHWI FD.NULL.NAME
>SYSCALL2 MKDev
jsr SysScrInit
jsr SysCDEVInit
bcs *
* sta CLRMIXED
@ -169,10 +165,9 @@ Kernel.Init3 sta SETALTZP
iny #S.PS.hStdErr
sta (pPS),y
*--------------------------------------
Kernel.Init3C >PUSHWI MSG.Init3
>PUSHBI 0
>SYSCALL2 printf
Kernel.Init3C >LDYAI MSG.Init3
>SYSCALL2 PutS
jsr HW.Detect
jsr CPU.Init
@ -201,9 +196,8 @@ Kernel.Init3C >PUSHWI MSG.Init3
>SYSCALL2 ExecV
bcs Kernel.Init3.Err
>PUSHWI MSG.Init3.OK
>PUSHBI 0
>SYSCALL2 printf
>LDYAI MSG.Init3.OK
>SYSCALL2 PutS
>DEBUGOA
jmp CORE.Run
@ -285,19 +279,26 @@ MemMgrInit >LDYAI Mem.MHiMem
stz Mem.LastSlot Reserve Slot #0
sta CLRWRITEAUX
ldx #K.hFD.MAX-1
ldx #K.FILE.MAX-1
.1 stz hFDs,x
stz hFDs.hName,x
stz hFDs.oCnt,x
.1 stz FILEs.hFD,x
stz FILEs.hName,x
stz FILEs.oCnt,x
dex
bpl .1
ldx #K.PS.MAX*4-1
.3 stz PS.Table.PID,x
.3 stz PSs.PID,x
dex
bpl .3
ldx #K.FD.MAX-1
.4 stz FDs.pLO,x
stz FDs.pHI,x
dex
bpl .4
ldx #K.EVT.MAX*S.EVT-1
@ -307,26 +308,30 @@ MemMgrInit >LDYAI Mem.MHiMem
ldx #K.USR.MAX*2-1
.6 stz S.Table.hSID,x
.6 stz USRs.hSID,x
dex
bpl .6
ldx #K.FLT.MAX*4-1
ldx #K.PFT.MAX*4-1
.7 stz Flt.Table.pftLO,x
.7 stz PFTs.pLO,x
dex
bpl .7
rts
*--------------------------------------
SysScrInit >LDYAI Mem.XHiMem
SysCDEVInit >PUSHWI FD.NULL
>PUSHWI FD.NULL.NAME
>SYSCALL2 MKDev
bcs .9
>LDYAI Mem.XHiMem
>STYA FD.TTY+S.FD.DEV.DCBPTR
jsr SysScrInit.TTYPtrs
jsr SysCDEVInit.TTYPtrs
>PUSHWI FD.TTY
>PUSHWI FD.CONSOLE.NAME
>SYSCALL2 MKDev
bcs .9
@ -335,11 +340,10 @@ SysScrInit >LDYAI Mem.XHiMem
.1 phx
inc FD.TTY+S.FD.DEV.DEVID
inc FD.TTY.NAME+3
jsr SysScrInit.TTYPtrs
jsr SysCDEVInit.TTYPtrs
>PUSHWI FD.TTY
>PUSHWI FD.TTY.NAME
>SYSCALL2 MKDev
plx
bcs .9
@ -350,7 +354,7 @@ SysScrInit >LDYAI Mem.XHiMem
* clc
.9 rts
*--------------------------------------
SysScrInit.TTYPtrs
SysCDEVInit.TTYPtrs
lda FD.TTY+S.FD.DEV.DCBPTR
sec
sbc #80*24+S.DCB.TTY
@ -570,6 +574,7 @@ CPU.Init.Z80 >PUSHWI MSG.Z80
>SYSCALL2 printf
jsr DetectZ80
bcs .9
sta A2osX.Z80SLOT
tax
lda #A2osX.S.Z80
@ -674,13 +679,12 @@ DetectZ80 ldx #Z80.300.L
dex
bne .90
pla
plp
rts
*--------------------------------------
DevMgrInit >LDYAI MSG.DEV
>SYSCALL2 puts
>SYSCALL2 PutS
jsr DevMgr.VXD
@ -1209,11 +1213,11 @@ TskMgrInit >LDYAI MSG.TSK
>SYSCALL OpenSession
bcs .99
sta S.Table.hSID
sta USRs.hSID
ldy #S.PS.hStdIn
lda (pPS),y
sta S.Table.hFile
sta USRs.hFile
lda #1
ldy #S.PS.hSession
@ -1311,7 +1315,7 @@ MSG.HZ .CZ "Kernel SYS Timer Set For %d0 hz Machine.\r"
MSG.FX .CZ "!!!Running under ProDOS.FX!!! Enabling lowercase mode.\r"
MSG.Init2.OK .CZ "A2osX[Stage2]:Complete."
*--------------------------------------
MSG.Init3 .CZ "A2osX[Stage3]:Init *** Press Ctrl-R for entering ROOT Mode ***\r\n"
MSG.Init3 .CZ "A2osX[Stage3]:Init *** Press Ctrl-R for entering ROOT Mode ***"
MSG.DEV .AZ "Device Manager..."
MSG.BDEV .CZ " Adding Device: /dev/%s, Addr:%H, Type: %s\r\n"
MSG.BDEVs .DA MSG.BDEV.D2
@ -1346,7 +1350,7 @@ MSG.TSK .AZ "Task Manager..."
MSG.PWD .AZ "Password Manager..."
MSG.EXEC .AZ "Executing %s..."
MSG.StartupErr .CZ "Failed : [$%h]\r\n"
MSG.Init3.OK .CZ "OK\r\nA2osX[Stage3]:Complete.\r\n"
MSG.Init3.OK .CZ "OK\r\nA2osX[Stage3]:Complete."
*--------------------------------------
MSG.HW .AZ "Checking Hardware..."
MSG.HW.TypeSubT .CZ "Type=%h,SubT=%h\r\n"
@ -1396,19 +1400,17 @@ pMLICLOSE .DA #1
*--------------------------------------
FD.NULL .DA #S.FD.T.CDEV
.DA #0 HANDLER
.DA #0 BUSID
.DA #0 DEVID
.DA #$F BUSID
.DA #$F DEVID
.DA 0 BUSPTR
.DA DRV.NULL
.DA 0 DCBPTR
.DA 0 BUFPTR
.BS 4
*--------------------------------------
FD.NULL.NAME .AZ "null" NAME
*--------------------------------------
FD.TTY .DA #S.FD.T.CDEV
.DA #0 HANDLER
.DA #0 BUSID
.DA #$F BUSID
.DA #0 DEVID
.DA 0 BUSPTR
.DA DRV.TERM
@ -1416,12 +1418,9 @@ FD.TTY .DA #S.FD.T.CDEV
.BS 2 BUFPTR
.BS 4
*--------------------------------------
FD.CONSOLE.NAME .AZ "console"
FD.TTY.NAME .AZ "tty0"
*--------------------------------------
FD.BDEV .DA #S.FD.T.BDEV
.DA #0 HANDLER
.DA #0 BUSID
.DA #$F BUSID
.DA #0 DEVID
.BS 2 BUSPTR
.BS 2 DRVPTR
@ -1430,6 +1429,9 @@ FD.BDEV .DA #S.FD.T.BDEV
.DA 0 SIZE
.DA 0
*--------------------------------------
FD.NULL.NAME .AZ "null"
FD.CONSOLE.NAME .AZ "console"
FD.TTY.NAME .AZ "tty0"
FD.BDEV.NAME .AZ "s1d1"
*--------------------------------------
* Z80 Reserved
@ -1439,7 +1441,7 @@ FD.BDEV.NAME .AZ "s1d1"
*--------------------------------------
Z80.300 .HS 3200E1 LD (0E100H),A Back to 6502
.HS C300F3 JP 0F300h
Z80.300.L .EQ *-Z80.300
*--------------------------------------
Z80.1000 .HS 31CFF3 START: LD SP,0F3CFh Init Stack

View File

@ -89,7 +89,7 @@ K.SYSCALL .DA 0 $00 : STAT
.DA K.StrCaseCmp
.DA K.GetDevByName $90 : DEV
.DA K.MKFD
.DA 0
.DA K.MKDev
.DA K.IOCTL
.DA K.LoadLib BIN

View File

@ -19,9 +19,11 @@ MEM.BestScore .EQ ZPMemMgrTmp1
* YA = ptr
* X = hMem
*\--------------------------------------
MEM.NewSize .BS 2
*--------------------------------------
K.Realloc >PULLW MEM.NewSize
K.Realloc >PULLA
sta .2+1 New Size HI
>PULLA
sta .1+1 New Size LO
>PULLA Src hMem
tax
@ -40,7 +42,9 @@ K.Realloc >PULLW MEM.NewSize
stx .7+1 Aux hMem
>LDYA MEM.NewSize
.1 ldy #$FF SELF MODIFIED
.2 lda #$FF SELF MODIFIED
>STYA A2L size for MoveSetupA1A2
jsr K.getmem
@ -326,6 +330,18 @@ MEM.Init0 phx
.13 plx
rts
*--------------------------------------
DEV.FreeFD.8 clc
rts
DEV.FreeFD ldx IO.hFD
lda FDs.pHI-1,x
cmp #$C0
bcs DEV.FreeFD.8
stz FDs.pHI-1,x
ldy FDs.pLO-1,x
*/--------------------------------------
* # Free
* Y,A = Ptr To Free
@ -373,7 +389,7 @@ K.FreeMem.ERR >PUSHWI .1
>PUSHBI 2
>SYSCALL2 PrintF
>DEBUG
* >DEBUG
lda #E.INVH
sec
rts
@ -645,6 +661,33 @@ MEM.SetA1A2 jsr K.GetMemPtr
rts
*--------------------------------------
MEM.GetKBuf pha
tya
clc
adc DevMgr.Free
tax
pla
adc DevMgr.Free+1
bcs .99 we crossed $FFFF, out of mem
cpx #DevMgr.HiMem
pha
sbc /DevMgr.HiMem
pla
bcs .99 No More Room...
ldy DevMgr.Free
stx DevMgr.Free
ldx DevMgr.Free+1
sta DevMgr.Free+1
txa
* clc
rts
.99 lda #E.OOM
* sec
rts
*--------------------------------------
MAN
SAVE usr/src/sys/kernel.s.mem
LOAD usr/src/sys/kernel.s

View File

@ -12,11 +12,11 @@ K.Mount jsr SHARED.PullP2P1 callback,mountpoint
ldx #1
.1 lda Flt.Table.pftHI-1,x
.1 lda PFTs.pHI-1,x
beq .2
inx
cpx #K.FLT.MAX+1
cpx #K.PFT.MAX+1
bne .1
lda #E.OOH
@ -24,14 +24,14 @@ K.Mount jsr SHARED.PullP2P1 callback,mountpoint
rts
.2 lda ZPPtr1
sta Flt.Table.pftLO-1,x
sta PFTs.pLO-1,x
lda ZPPtr1+1
sta Flt.Table.pftHI-1,x
sta PFTs.pHI-1,x
lda ZPPtr2
sta Flt.Table.cbLO-1,x
sta PFTs.cbLO-1,x
lda ZPPtr2+1
sta Flt.Table.cbHI-1,x
sta PFTs.cbHI-1,x
txa
@ -44,10 +44,10 @@ K.Mount jsr SHARED.PullP2P1 callback,mountpoint
*--------------------------------------
K.UMount tax
lda Flt.Table.pftHI-1,x
lda PFTs.pHI-1,x
beq .9
stz Flt.Table.pftHI-1,x
stz PFTs.pHI-1,x
clc
rts

View File

@ -24,12 +24,12 @@ PFT.CheckPathYA >PUSHYA
ldx #0
.1 inx
lda Flt.Table.pftHI-1,x
lda PFTs.pHI-1,x
beq .8
sta ZPPtr1+1
lda Flt.Table.pftLO-1,x
lda PFTs.pLO-1,x
sta ZPPtr1
ldy #$ff
@ -51,10 +51,10 @@ PFT.CheckPathYA >PUSHYA
iny
.4 lda Flt.Table.cbLO-1,x
.4 lda PFTs.cbLO-1,x
sta .7+1
lda Flt.Table.cbHI-1,x
lda PFTs.cbHI-1,x
sta .7+2
stx hHandler
@ -68,7 +68,7 @@ PFT.CheckPathYA >PUSHYA
.7 jmp $ffff SELF MODIFIED
.8 cpx #K.FLT.MAX
.8 cpx #K.PFT.MAX
bne .1
>LDYAI K.Buf256
@ -105,24 +105,27 @@ PFT.CheckNodeA stx .80+1 Save SYSCALL #
tax
beq .9
cpx #K.hFD.MAX+1
cpx #K.FILE.MAX+1
bcs .9
lda hFDs-1,x
ldy FILEs.hFD-1,x
sty IO.hFD
lda FDs.pLO-1,y
sta pFD
lda FDs.pHI-1,y
sta pFD+1
beq .9
jsr DEV.GetPFD
ldy #S.FD.PFT
lda (pFD),y
beq .8 Handler is 0, back to kernel....
tax
lda Flt.Table.cbLO-1,x
lda PFTs.cbLO-1,x
sta .7+1
lda Flt.Table.cbHI-1,x
lda PFTs.cbHI-1,x
sta .7+2
stx hHandler
@ -134,7 +137,9 @@ PFT.CheckNodeA stx .80+1 Save SYSCALL #
.7 jmp $ffff SELF MODIFIED
.8 lda (pFD) #S.FD.T
.8 jsr DEV.GetPDrv
lda (pFD) #S.FD.T
cmp #S.FD.T.CDEV
bcs .80

View File

@ -23,6 +23,7 @@ PIPE.CLOSE ldy #S.FD.PIPE.S
lda #$80
sta (pFD),y
clc
rts
.1 ldy #S.FD.PIPE.hMem
@ -31,8 +32,7 @@ PIPE.CLOSE ldy #S.FD.PIPE.S
>SYSCALL2 FreeStkObj
.2 clc
rts
.2 jmp DEV.FreeFD
*--------------------------------------
* (pStack)+2 buf
* (pStack)+0 count

View File

@ -207,7 +207,7 @@ K.Fork jsr PS.CreateChild A=PID,Child S.PS at PS.NewPSPtr,PS.Load.hMem
PS.CreateChild ldx #0
bra .2 Skip PS0
.1 lda PS.Table.PID,x
.1 lda PSs.PID,x
beq .4 Found an empty slot
.2 inx
@ -234,7 +234,7 @@ PS.CreateChild ldx #0
bcc .4 running...loop
lda CORE.LastPSID
sta PS.Table.PID,x
sta PSs.PID,x
phx save PS Index
>LDYAI S.PS
jsr K.GetMem0 Blank Everything in this S.PS
@ -243,7 +243,7 @@ PS.CreateChild ldx #0
>STYA PS.NewPSPtr
txa
plx
sta PS.Table.hPS,x
sta PSs.hPS,x
jsr Mem.SetOwner Set Ownership
lda PS.Flags
@ -258,7 +258,7 @@ PS.CreateChild ldx #0
bit PS.Flags
beq .5
lda PS.Table.hPS Select PS0
lda PSs.hPS Select PS0
jsr K.GetMemPtr
bra .6
@ -309,7 +309,7 @@ PS.CreateChild ldx #0
sta (PS.NewPSPtr),y
* tax
* lda S.Table.hSID-1,x
* lda USRs.hSID-1,x
* jsr MEM.GetMemByID
* jsr MEM.IncRefCnt
@ -729,7 +729,7 @@ K.Kill.0 clc
K.Kill.2 ldy #S.PS.hSession
lda (ZPPtr1),y
tax
* lda S.Table.hSID-1,x
* lda USRs.hSID-1,x
* jsr K.FreeMem
ldy #S.PS.hENV
@ -760,7 +760,7 @@ K.Kill.2 ldy #S.PS.hSession
.1 lda K.Kill.PID
ldx #0
.2 cmp PS.Table.PID,x
.2 cmp PSs.PID,x
beq .3
inx
@ -769,9 +769,9 @@ K.Kill.2 ldy #S.PS.hSession
bra *
.3 stz PS.Table.PID,x
lda PS.TABLE.hPS,x
stz PS.TABLE.hPS,x
.3 stz PSs.PID,x
lda PSs.hPS,x
stz PSs.hPS,x
jmp K.FreeMem
.10 .DA #S.PS.hSS,#S.PS.hDS,#S.PS.hCS
@ -782,7 +782,6 @@ K.Kill.2 ldy #S.PS.hSession
* ## C
* `int loadtxtfile ( const char * filename );`
* ## ASM
* **In:**
* `>LDYA filename`
* `>SYSCALL loadtxtfile`
* ## RETURN VALUE
@ -802,7 +801,6 @@ K.LoadFile0 sec
* ## C
* `int loadfile ( const char * filename, short int flags, short int ftype, int auxtype );`
* ## ASM
* **In:**
* `>PUSHW filename`
* `>PUSHB flags`
* `>PUSHB ftype`
@ -902,7 +900,6 @@ K.LoadFile clc
* ## C
* `int filesearch( char *filename, char *searchpath, char *fullpath, stat *filestat);`
* ## ASM
* **In:**
* `>PUSHW filename`
* `>PUSHW fullpath`
* `>PUSHW searchpath`
@ -1043,7 +1040,6 @@ PS.VARS .DA .1
.3 .AZ "PATH"
*/--------------------------------------
* # GetMemStat
* **In:**
* Y,A = Ptr to 24 bytes buffer
* ## RETURN VALUE
* Buffer filled with memory stats

View File

@ -17,13 +17,13 @@ K.ChMod jsr PFT.CheckPath2
jsr STAT.PM
stz K.MLI.PARAMS+3+S.FIEX.ACL read mode
>MLICALL MLIACL
bcs .9
>LDYA K.S.STAT+S.STAT.MODE
>STYA K.MLI.PARAMS+3+S.FIEX.ACL.MOD
lda #$57 write mode
sta K.MLI.PARAMS+3+S.FIEX.ACL
@ -52,10 +52,10 @@ K.FStat ldy #2
bcs STAT.RET3
>PULLW K.Stat.Store.2+1
>PULLA
tax
lda hFDs.hName-1,x get path
lda FILEs.hName-1,x get path
jsr K.GetMemPtr
jsr PFT.YAToMLIPATH
@ -68,14 +68,14 @@ K.FStat ldy #2
>MLICALL MLIGETEOF
bcs STAT.RTS
ldx #2
.1 lda K.MLI.PARAMS+2,x
sta K.S.STAT+S.STAT.SIZE,x
dex
bpl .1
K.Stat.Store ldy #S.STAT-1
K.Stat.Store.1 lda K.S.STAT,y
@ -126,13 +126,13 @@ K.MKDir jsr PFT.CheckPath2
bcs STAT.RET4
jsr STAT.PM
lda #S.FI.T.DIR
sta K.MLI.PARAMS+4
stz K.MLI.PARAMS+5
stz K.MLI.PARAMS+6
lda #S.FI.ST.DIR
jmp FS.CREATE
jmp FS.MLICREATE
*/--------------------------------------
* # MKFIFO
* return a pathname to a new FIFO
@ -154,7 +154,7 @@ K.MKFIFO jsr STAT.PM
ldy #0
.1 lda UNISTD.DEVFIFO,y
.1 lda STAT.TMPFIFO,y
sta (ZPPtr1),y fill pathname buffer
iny
cpy #9
@ -169,19 +169,11 @@ K.MKFIFO jsr STAT.PM
iny
lda #0
sta (ZPPtr1),y
lda ZPPtr1
clc
adc #5 skip /dev/
sta ZPPtr1
bcc K.MkNod.I
inc ZPPtr1+1
bra K.MkNod.I
*/--------------------------------------
* # MkNod
* Create a special or ordinary file.
* (CDEV, BDEV, DSOCKS, SSOCK, PIPE)
* (CDEV, BDEV, DSOCK, SSOCK, PIPE)
* ## C
* `hFILE mknod(const char *pathname, int mode, hFD fd);`
* ## ASM
@ -193,22 +185,40 @@ K.MKFIFO jsr STAT.PM
* CC = OK, CS = ERROR
* A = hFILE
*\--------------------------------------
K.MkNod >PULLB IO.hFD
K.MkNod >PULLA
jsr DEV.GetPFD
jsr STAT.PM
K.MkNod.I lda IO.hFD
jsr DEV.GetFD
bcc .2
jsr DEV.GetFreeFD
bcs .9
lda IO.hFD
sta hFDs-1,x
K.MkNod.I ldx #1
.1 lda FILEs.hFD-1,x
beq .2
inx
cpx #K.FILE.MAX+1
bcc .1
lda #E.OOH
* sec
rts
.2 stx IO.hFILE
lda IO.hFD
sta FILEs.hFD-1,x
stz FILEs.oCnt-1,x
lda (pFD)
cmp #S.FD.T.CDEV
beq .8
cmp #S.FD.T.BDEV
beq .8
>LDYA ZPPtr1
>SYSCALL2 StrDup
bcs .9
@ -216,10 +226,12 @@ K.MkNod.I lda IO.hFD
txa
ldx IO.hFILE
sta hFDs.hName-1,x store path
sta FILEs.hName-1,x store path
.8 txa hFILE
txa hFILE
clc
.9 rts
*/--------------------------------------
* # pipe
@ -249,9 +261,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
lda IO.hFD
@ -271,6 +283,8 @@ STAT.PM >PULLW K.S.STAT+S.STAT.MODE
>PULLW ZPPtr1 pathname
rts
*--------------------------------------
STAT.TMPFIFO .AS "/tmp/fifo"
*--------------------------------------
MAN
SAVE usr/src/sys/kernel.s.stat
LOAD usr/src/sys/kernel.s

View File

@ -6,7 +6,6 @@ NEW
* ## C
* `int fputc ( hFILE stream , short int character );`
* ## ASM
* **In:**
* `>PUSHB stream`
* `>PUSHB character`
* `>SYSCALL fputc`
@ -35,7 +34,6 @@ K.FPutC lda (pStack) character
* ## C
* `int putchar ( short int character );`
* ## ASM
* **In:**
* `lda character`
* `>SYSCALL putchar`
* ## RETURN VALUE
@ -68,7 +66,6 @@ STDIO.Write jsr K.FWrite.PFT
* Write Str to StdOut, appends '\r\n'
* ## C
* `int puts ( const char * str );`
* **In:**
* ## ASM
* `>LDYAI str`
* `>SYSCALL PutS`
@ -115,7 +112,6 @@ K.PutS >STYA .1+1
* ## C
* `int fputs (hFILE stream, const char * str );`
* ## ASM
* **In:**
* `>PUSHB stream`
* `>PUSHW str`
* `>SYSCALL fputs`
@ -173,7 +169,6 @@ K.FPutS lda (pStack)
* ## C
* `char *fgets(hFILE stream, char * s, int n);`
* ## ASM
* **In:**
* `>PUSHB hFILE`
* `>PUSHW s`
* `>PUSHW n`
@ -272,7 +267,6 @@ K.FGetS ldy #3
* ## C
* `short int getchar ( );`
* ## ASM
* **In:**
* `>SYSCALL getchar`
* ## RETURN VALUE
* CC = success
@ -286,7 +280,6 @@ K.GetChar ldy #S.PS.hStdIn
* ## C
* `short int getc ( short int stream );`
* ## ASM
* **In:**
* `lda stream`
* `>SYSCALL getc`
* ## RETURN VALUE
@ -335,7 +328,6 @@ K.UngetC clc
* Open a file
* ## C
* `short int fopen ( const char *filename, short int flags, short int ftype, int auxtype );`
* **In:**
* ## ASM
* `>PUSHW filename`
* `>PUSHB flags`
@ -373,22 +365,29 @@ K.FOpen jsr PFT.CheckPath4
jsr UNISTD.Open
bcs K.FOpen.99
ldx IO.hFILE
lda (pFD)
bne K.FOpen.8
cmp #S.FD.T.DSOCK
bcc .1
lda IO.hFILE don't create file for SOCK/PIPE
tax
inc FILEs.oCnt-1,x
clc
K.FOpen.REGDIR >LDYAI K.Buf256
>SYSCALL2 StrDup
rts
.1 >LDYAI K.Buf256
>STYA ZPPtr1
K.FOpen.REGDIR jsr K.MkNod.I
bcs K.FOpen.90
* tax
inc FILEs.oCnt-1,x
txa
ldx IO.hFILE
sta hFDs.hName-1,x
K.FOpen.8 inc hFDs.oCnt-1,x
txa
* clc
rts
K.FOpen.90 pha
@ -406,7 +405,6 @@ K.FOpen.99 rts
* ## C
* `int fclose ( short int stream );`
* ## ASM
* **In:**
* `lda stream`
* `>SYSCALL FClose`
* ## RETURN VALUE
@ -415,44 +413,31 @@ K.FClose jsr PFT.CheckNodeA
bcs K.FRead.RTS
jsr UNISTD.Close
bcs K.FRead.RTS
ldx IO.hFILE
dec hFDs.oCnt-1,x
bne .8
dec FILEs.oCnt-1,x
lda hFDs.hName-1,x its a DEV, don't clear FD
beq .8
* clc
stz hFDs.hName-1,x
bne K.FRead.RTS
jsr K.FreeMem
stz FILEs.hFD-1,x
lda (pFD)
tay
lda FILEs.hName-1,x
ldx IO.hFILE
lda hFDs-1,x
beq .8
stz hFDs-1,x
cpy #S.FD.T.DSOCK SOCKS will free FDs
beq .8
cpy #S.FD.T.SSOCK
beq .8
* clc
beq K.FRead.RTS
stz FILEs.hName-1,x
jmp K.FreeMem
.8 clc
rts
*/--------------------------------------
* # FRead (BLOCKING)
* Read bytes from file
* ## C
* `int fread (short int stream, void * ptr, int count );`
* ## ASM
* **In:**
* `>PUSHB stream`
* `>PUSHW ptr`
* `>PUSHW count`
@ -473,7 +458,6 @@ K.FRead.RTS rts
* ## C
* `int fwrite ( short int stream, const void * ptr, int count );`
* ## ASM
* **In:**
* `>PUSHB stream`
* `>PUSHW ptr`
* `>PUSHW count`
@ -509,7 +493,6 @@ K.FWrite.RET5 >RET 5
* ## C
* `int fflush( short int stream );`
* ## ASM
* **In:**
* `lda stream`
* `>SYSCALL fflush`
*\--------------------------------------
@ -531,7 +514,6 @@ STDIO.IOERR lda #MLI.E.IO
* ## C
* `int fseek( short int stream, long offset, short int whence );`
* ## ASM
* **In:**
* `>PUSHB stream`
* `>PUSHL offset`
* `>PUSHB whence`
@ -612,7 +594,6 @@ K.FSeek.RTS rts
* ## C
* `short int feof( short int stream );`
* ## ASM
* **In:**
* `lda stream`
* `>SYSCALL feof`
* ## RETURN VALUE
@ -642,7 +623,6 @@ K.FEOF jsr PFT.CheckNodeA
* ## C
* `long ftell( short int stream );`
* ## ASM
* **In:**
* `lda stream`
* `>SYSCALL ftell`
* ## RETURN VALUE
@ -671,7 +651,6 @@ K.FTell jsr PFT.CheckNodeA
* ## C
* `int remove ( const char *pathname );`
* ## ASM
* **In:**
* `>LDYA pathname`
* `>SYSCALL remove`
* ## RETURN VALUE
@ -687,7 +666,6 @@ K.Remove jsr PFT.CheckPathYA
* ## C
* `int rename ( const char * oldpath, const char * newpath );`
* ## ASM
* **In:**
* `>PUSHW oldpath`
* `>PUSHW newpath`
* `>SYSCALL rename`
@ -729,7 +707,6 @@ K.Rename jsr PFT.CheckPath2
* `int fprintf ( short int stream, const char *format, ... );`
* `int sprintf ( char *str, const char *format, ... );`
* ## ASM
* **In:**
* PrintF : (example is for printing Y,A as integer : format="%I", 2 bytes)
* `>PUSHW format`
* `>PUSHW i`
@ -1145,7 +1122,6 @@ STDIO.RTS rts
* `int fscanf( short int stream, const char *format, ... );`
* `int sscanf ( const char *s, const char *format, ... );`
* ## ASM
* **In:**
* ScanF :
* `>PUSHW format`
* `>PUSHW ptr`

View File

@ -6,7 +6,6 @@ NEW
* ## C
* `float strtof (const char* str, char** endptr );`
* ## ASM
* **In:**
* `>PUSHW str`
* `>PUSHWI EndPtr`
* `>SYSCALL StrToF`
@ -29,7 +28,6 @@ K.StrToF >PULLW ZPPtr1
* ## C
* `float atof ( const char* str );`
* ## ASM
* **In:**
* `>LDYA str`
* `>SYSCALL atof`
* ## RETURN VALUE
@ -51,7 +49,6 @@ K.AToF >STYA TXTPTR Ptr to source string
* `long strtol (const char* str, char** endptr, int base);`
* `unsigned long strtoul (const char* str, char** endptr, int base);`
* ## ASM
* **In:**
* `>PUSHW str`
* `>PUSHW EndPtr`
* `>PUSHB Base`
@ -84,7 +81,6 @@ K.StrToUL.rts rts
* ## C
* `long atol ( const char * str );`
* ## ASM
* **In:**
* `>LDYA str`
* `>SYSCALL atol`
* ## RETURN VALUE
@ -113,7 +109,6 @@ K.AToL.I jsr MATH.Dec2ACC32
* ## C
* `int atoi ( const char * str );`
* ## ASM
* **In:**
* `>LDYAI str`
* `>SYSCALL atoi`
* ## RETURN VALUE
@ -133,7 +128,6 @@ K.atoi >STYA ZPPtr2
* ## C / CSH
* `char *realpath(const char *path, char *resolvedpath);`
* ## ASM
* **In:**
* `>PUSHW path`
* `>PUSHW resolvedpath`
* `>SYSCALL realpath`

View File

@ -34,7 +34,6 @@ K.StrLen >STYA .1+1
* ## C
* `char * strcat ( char * destination, const char * source );`
* ## ASM
* **In:**
* `>PUSHWI destination`
* `>PUSHWI source`
* `>SYSCALL strcat`
@ -49,7 +48,6 @@ K.StrCat sec
* ## C
* `char * strcpy ( char * destination, const char * source );`
* ## ASM
* **In:**
* `>PUSHWI destination`
* `>PUSHWI source`
* `>SYSCALL strcpy`
@ -146,7 +144,6 @@ K.StrDup.RTS rts
* `int strupr ( char * str);`
* `int strlwr ( char * str);`
* ## ASM
* **In:**
* `>LDYAI str`
* `>SYSCALL strupr`
* `>SYSCALL strlwr`
@ -188,7 +185,6 @@ K.StrLwr ldx #2
* ## C
* `int strcmp(const char *s1, const char *s2);`
* ## ASM
* **In:**
* `>PUSHWI s1`
* `>PUSHWI s2`
* `>SYSCALL strcmp`
@ -206,7 +202,6 @@ K.StrCmp sec
* ## C
* `int strcasecmp(const char *s1, const char *s2);`
* ## ASM
* **In:**
* `>PUSHWI s1`
* `>PUSHWI s2`
* `>SYSCALL strcasecmp`

View File

@ -5,7 +5,6 @@ NEW
* ## C
* `hFD open(const char *pathname, short int flags);`
* ## ASM
* **In:**
* `>PUSHW pathname`
* `>PUSHB flags`
* `>SYSCALL open`
@ -23,11 +22,11 @@ K.Open jsr PFT.CheckPath1
*--------------------------------------
UNISTD.Open ldx #5 /dev/
cpx K.MLI.PATH
bcs .8
bcs .2
.1 lda K.MLI.PATH,x
cmp UNISTD.DEVFIFO-1,x
bne .8
cmp UNISTD.DEV-1,x
bne .2
dex
bne .1
@ -37,12 +36,47 @@ UNISTD.Open ldx #5 /dev/
>LDYAI K.MLI.PATH+6 skip $/dev/
jsr K.GetDevByName
bcs .9
bcc .6
lda (pFD) #S.FD.T
.2 ldx #1
.3 lda FILEs.hFD-1,x
beq .5
lda FILEs.hName-1,x
beq .5
jsr K.GetMemPtr
>STYA ZPPtr1
ldy #$ff
.4 iny
lda K.Buf256,y
cmp (ZPPtr1),y
bne .5
cmp #0
bne .4
stx IO.hFILE
lda FILEs.hFD-1,x
jsr DEV.GetPFD
bra .7
.5 inx
cpx #K.FILE.MAX+1
bcc .3
jmp FS.OPEN.REG
.6 jsr DEV.GetPDrv
.7 lda (pFD) #S.FD.T
tax
jmp (.2-2,x)
.2
jmp (.8-2,x)
.8
* .DA STDIO.IOERR REG
.DA STDIO.IOERR DIR
.DA DEV.OPEN
@ -52,15 +86,12 @@ UNISTD.Open ldx #5 /dev/
.DA SOCK.OPEN
.DA PIPE.OPEN
.8 jmp FS.OPEN.REG
.9 rts
*/--------------------------------------
* # close
* ## C
* `int close(hFD fd);`
* ## ASM
* **In:**
* `lda fd`
* `>SYSCALL close`
*\--------------------------------------
@ -70,8 +101,8 @@ UNISTD.Close lda (pFD) #S.FD.T
tax
jmp (.1,x)
.1 .DA FS.MLICLOSE
.DA FS.MLICLOSE
.1 .DA FS.CLOSE
.DA FS.CLOSE
.DA DEV.CLOSE
.DA DEV.CLOSE
.DA STDIO.IOERR LNK
@ -83,7 +114,6 @@ UNISTD.Close lda (pFD) #S.FD.T
* ## C
* `int read(hFD fd, void *buf, int count);`
* ## ASM
* **In:**
* `>PUSHB fd`
* `>PUSHW buf`
* `>PUSHW count`
@ -94,7 +124,7 @@ UNISTD.Close lda (pFD) #S.FD.T
*\--------------------------------------
K.Read ldy #4 hFD
lda (pStack),y
jsr DEV.GetPFD
UNISTD.Read lda (pFD) #S.FD.T
@ -114,7 +144,6 @@ UNISTD.Read lda (pFD) #S.FD.T
* ## C
* `int write(hFD fd, const void *buf, int count);`
* ## ASM
* **In:**
* `>PUSHB fd`
* `>PUSHW buf`
* `>PUSHW count`
@ -146,7 +175,6 @@ UNISTD.Write lda (pFD) #S.FD.T
* ## C
* `int lseek( short int hFD, long offset, short int whence );`
* ## ASM
* **In:**
* `>PUSHB hFD`
* `>PUSHL offset`
* `>PUSHB whence`
@ -159,7 +187,6 @@ UNISTD.Write lda (pFD) #S.FD.T
* ## C
* `short int chown(const char *pathname, short int owner, short int group);`
* ## ASM
* **In:**
* `>PUSHW pathname`
* `>PUSHB owner`
* `>PUSHB group`
@ -168,12 +195,12 @@ UNISTD.Write lda (pFD) #S.FD.T
*\--------------------------------------
K.ChOwn jsr PFT.CheckPath2
bcs .9
stz K.MLI.PARAMS+3+S.FIEX.ACL read mode
>MLICALL MLIACL
bcs .9
lda (pStack)
bmi .1
@ -184,15 +211,15 @@ K.ChOwn jsr PFT.CheckPath2
bmi .2
sta K.MLI.PARAMS+3+S.FIEX.ACL.UID
.2 lda #$57 write mode
sta K.MLI.PARAMS+3+S.FIEX.ACL
>MLICALL MLIACL
.9 >RET 4
.9 >RET 4
*--------------------------------------
UNISTD.DEVFIFO .AS "/dev/fifo"
UNISTD.DEV .AS "/dev/"
*--------------------------------------
MAN
SAVE usr/src/sys/kernel.s.unistd

View File

@ -3,25 +3,26 @@ NEW
.LIST OFF
.OP 65C02
.OR $2000
.TF sys/kernel
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/io.i
.INB inc/io.iic.i
.INB inc/io.iigs.i
.INB inc/mli.i
.INB inc/mli.e.i
.INB inc/net.telnet.i
.INB inc/xy.mouse.i
.TF sys/kernel
.INB inc/kernel.i
.INB usr/src/sys/kernel.s.def
.INB usr/src/sys/kernel.s.init
.INB usr/src/shared/x.printf.s
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/io.i
.INB inc/io.iic.i
.INB inc/io.iigs.i
.INB inc/mli.i
.INB inc/mli.e.i
.INB inc/net.telnet.i
.INB inc/xy.mouse.i
.INB inc/kernel.i
.INB usr/src/sys/kernel.s.def
.INB usr/src/sys/kernel.s.init
.INB usr/src/shared/x.printf.s
A2osX.Unpak >STYA ZPOutBufPtr
.INB usr/src/shared/x.unpak.s
.INB usr/src/shared/x.unpak.s
PAKME.MAIN .DA MAIN
PAKME.AUX .DA AUX
@ -33,12 +34,12 @@ MAIN .DA #0
.DA MAIN.S
MAIN.B .PH $1000
.INB usr/src/sys/kernel.s.gp
.INB usr/src/sys/kernel.s.core
.INB usr/src/sys/kernel.s.drv
.INB usr/src/sys/kernel.s.pft
.INB usr/src/sys/kernel.s.fs
.INB usr/src/sys/kernel.s.mathf
.INB usr/src/sys/kernel.s.gp
.INB usr/src/sys/kernel.s.core
.INB usr/src/sys/kernel.s.drv
.INB usr/src/sys/kernel.s.pft
.INB usr/src/sys/kernel.s.fs
.INB usr/src/sys/kernel.s.mathf
.EP
MAIN.S .EQ *-MAIN.B
@ -47,18 +48,18 @@ AUX .DA #0
AUX.B .PH Mem.XHiMem
.DA SHARED.TXTPTRgn
.DA SHARED.TXTPTRgn OSD.TXTPTRgn
.INB usr/src/sys/kernel.s.jmpx
.INB usr/src/sys/kernel.s.termx
.INB usr/src/sys/kernel.s.strvx
.INB usr/src/sys/kernel.s.envx
.INB usr/src/sys/kernel.s.timex
.INB usr/src/sys/kernel.s.md5x
.INB usr/src/sys/kernel.s.pwdx
.INB usr/src/sys/kernel.s.slistx
.INB usr/src/sys/kernel.s.blistx
.INB usr/src/sys/kernel.s.errorx
.INB usr/src/sys/kernel.s.jmpx
.INB usr/src/sys/kernel.s.termx
.INB usr/src/sys/kernel.s.strvx
.INB usr/src/sys/kernel.s.envx
.INB usr/src/sys/kernel.s.timex
.INB usr/src/sys/kernel.s.md5x
.INB usr/src/sys/kernel.s.pwdx
.INB usr/src/sys/kernel.s.slistx
.INB usr/src/sys/kernel.s.blistx
.INB usr/src/sys/kernel.s.errorx
.EP
AUX.S .EQ *-AUX.B
@ -67,14 +68,14 @@ D1 .DA #0
D1.B .PH $D000
.DA #RRAMWRAMBNK1
.INB usr/src/sys/kernel.s.stat
.INB usr/src/sys/kernel.s.dirent
.INB usr/src/sys/kernel.s.unistd
.INB usr/src/sys/kernel.s.stdio
.INB usr/src/sys/kernel.s.prodos
.INB usr/src/sys/kernel.s.dev
.INB usr/src/sys/kernel.s.sock
.INB usr/src/sys/kernel.s.pipe
.INB usr/src/sys/kernel.s.stat
.INB usr/src/sys/kernel.s.dirent
.INB usr/src/sys/kernel.s.unistd
.INB usr/src/sys/kernel.s.stdio
.INB usr/src/sys/kernel.s.prodos
.INB usr/src/sys/kernel.s.dev
.INB usr/src/sys/kernel.s.sock
.INB usr/src/sys/kernel.s.pipe
.EP
D1.S .EQ *-D1.B
@ -83,14 +84,14 @@ D2 .DA #0
D2.B .PH $D000
.DA #RRAMWRAMBNK2
.INB usr/src/sys/kernel.s.mount
.INB usr/src/sys/kernel.s.stkobj
.INB usr/src/sys/kernel.s.arg
.INB usr/src/sys/kernel.s.error
.INB usr/src/sys/kernel.s.stdlib
.INB usr/src/sys/kernel.s.string
.INB usr/src/sys/kernel.s.bin
.INB usr/src/sys/kernel.s.ps
.INB usr/src/sys/kernel.s.mount
.INB usr/src/sys/kernel.s.stkobj
.INB usr/src/sys/kernel.s.arg
.INB usr/src/sys/kernel.s.error
.INB usr/src/sys/kernel.s.stdlib
.INB usr/src/sys/kernel.s.string
.INB usr/src/sys/kernel.s.bin
.INB usr/src/sys/kernel.s.ps
.EP
D2.S .EQ *-D2.B
@ -98,22 +99,22 @@ E0 .DA #0
.DA E0.S
E0.B .PH $E000
.INB usr/src/sys/kernel.s.jmp
.INB usr/src/sys/kernel.s.irq
.INB usr/src/sys/kernel.s.shared
.INB usr/src/sys/kernel.s.math
.INB usr/src/sys/kernel.s.math16
.INB usr/src/sys/kernel.s.math32
.INB usr/src/sys/kernel.s.term
.INB usr/src/sys/kernel.s.jmp
.INB usr/src/sys/kernel.s.irq
.INB usr/src/sys/kernel.s.shared
.INB usr/src/sys/kernel.s.math
.INB usr/src/sys/kernel.s.math16
.INB usr/src/sys/kernel.s.math32
.INB usr/src/sys/kernel.s.strv
.INB usr/src/sys/kernel.s.env
.INB usr/src/sys/kernel.s.time
.INB usr/src/sys/kernel.s.md5
.INB usr/src/sys/kernel.s.pwd
.INB usr/src/sys/kernel.s.slist
.INB usr/src/sys/kernel.s.term
.INB usr/src/sys/kernel.s.strv
.INB usr/src/sys/kernel.s.env
.INB usr/src/sys/kernel.s.time
.INB usr/src/sys/kernel.s.md5
.INB usr/src/sys/kernel.s.pwd
.INB usr/src/sys/kernel.s.slist
.INB usr/src/sys/kernel.s.mem
.INB usr/src/sys/kernel.s.mem
DevMgr.Timer .BS 1
DevMgr.Stat .DA DevMgr.FreeMem
@ -129,7 +130,7 @@ E0.S .EQ *-E0.B
.DA #5 Chunk Count
.DA PAKME.MAIN Chunks
.INB usr/src/sys/kernel.s.ctrl
.INB usr/src/sys/kernel.s.ctrl
MAN
SAVE usr/src/sys/kernel.s
ASM