mirror of
https://github.com/A2osX/A2osX.git
synced 2024-10-30 16:25:38 +00:00
177 lines
3.4 KiB
Plaintext
177 lines
3.4 KiB
Plaintext
NEW
|
||
PREFIX
|
||
AUTO 4,1
|
||
.LIST OFF
|
||
.OP 65C02
|
||
.OR $2000
|
||
.TF SBIN/NETWORKD
|
||
*--------------------------------------
|
||
.INB INC/MACROS.I
|
||
.INB INC/A2OSX.I
|
||
.INB INC/MLI.E.I
|
||
.INB INC/ETH.I
|
||
.INB INC/LIBTCPIP.I
|
||
.INB INC/LIBETALK.I
|
||
*--------------------------------------
|
||
* Zero Page Segment, up to 32 bytes
|
||
*--------------------------------------
|
||
.DUMMY
|
||
.OR ZPBIN
|
||
ZS.START
|
||
* MyPtr .BS 2
|
||
ZS.END
|
||
.ED
|
||
*--------------------------------------
|
||
* File Header (16 Bytes)
|
||
*--------------------------------------
|
||
CS.START cld
|
||
jmp (.1,x)
|
||
.DA #$61 6502,Level 1 (65c02)
|
||
.DA #1 BIN Layout Version 1
|
||
.DA #S.PS.F.EVENT
|
||
.DA #0
|
||
.DA CS.END-CS.START Code Size (without Constants)
|
||
.DA DS.END-DS.START Data SegmentSize
|
||
.DA #16 Stack Size
|
||
.DA #ZS.END-ZS.START Zero Page Size
|
||
.DA 0
|
||
*--------------------------------------
|
||
* Relocation Table
|
||
*--------------------------------------
|
||
.1 .DA CS.INIT
|
||
.DA CS.RUN
|
||
.DA CS.DOEVENT
|
||
.DA CS.QUIT
|
||
L.DEVNAME .DA DEVNAME
|
||
L.MSG.DEV.OK .DA MSG.DEV.OK
|
||
L.MSG.DEV.KO .DA MSG.DEV.KO
|
||
L.LIBTCPIP .DA LIBTCPIP
|
||
L.LIBETALK .DA LIBETALK
|
||
L.IOCTL .DA IOCTL
|
||
.DA 0
|
||
*--------------------------------------
|
||
CS.INIT clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.RUN >PUSHBI 0
|
||
>LDYA L.DEVNAME
|
||
>SYSCALL open
|
||
bcc .1
|
||
|
||
inc DEVNAME+8
|
||
lda DEVNAME+8
|
||
cmp #'8'
|
||
bne CS.RUN
|
||
|
||
>LDYA L.MSG.DEV.KO
|
||
>SYSCALL puts
|
||
|
||
lda #MLI.E.NODEV
|
||
sec
|
||
rts
|
||
|
||
.1 sta hFD
|
||
|
||
>PUSHW L.DEVNAME
|
||
>PUSHBI 2
|
||
>LDYA L.MSG.DEV.OK
|
||
>SYSCALL printf
|
||
|
||
* >LDYA L.LIBTCPIP
|
||
* >SYSCALL LoadLib
|
||
* bcs .2
|
||
* sta hLIBTCPIP
|
||
|
||
.2 >LDYA L.LIBETALK
|
||
>SYSCALL LoadLib
|
||
bcs .3
|
||
sta hLIBETALK
|
||
|
||
.3
|
||
CS.RUN.LOOP >SLEEP
|
||
|
||
>PUSHW L.IOCTL
|
||
>PUSHBI IOCTL.READ
|
||
lda hFD
|
||
>SYSCALL IOCTL
|
||
bcs CS.RUN.LOOP No Frame
|
||
|
||
sta hFrameIn
|
||
|
||
ldx hLIBTCPIP
|
||
beq .1
|
||
|
||
* >PUSHW L.IOCTL
|
||
* lda hFrameIn
|
||
|
||
* >LIBCALL hLIBTCPIP,LIBTCPIP.INCOMING
|
||
* bcc CS.RUN.LOOP
|
||
|
||
.1 ldx hLIBETALK
|
||
beq .9
|
||
|
||
>PUSHW L.IOCTL
|
||
lda hFrameIn
|
||
>LIBCALL hLIBETALK,LIBETALK.INCOMING
|
||
bcc CS.RUN.LOOP
|
||
|
||
.9 lda hFrameIn
|
||
>SYSCALL freemem
|
||
|
||
bra CS.RUN.LOOP
|
||
*--------------------------------------
|
||
CS.DOEVENT lda (pEvent)
|
||
bpl .9
|
||
|
||
ldx hLIBTCPIP
|
||
beq .1
|
||
* >LIBCALL hLIBTCPIP,LIBTCPIP.PULSE
|
||
|
||
.1 ldx hLIBETALK
|
||
beq .9
|
||
lda (pEvent)
|
||
>LIBCALL hLIBETALK,LIBETALK.PULSE
|
||
|
||
.9 sec never discard TIME event
|
||
rts
|
||
*--------------------------------------
|
||
CS.QUIT lda hLIBTCPIP
|
||
beq .1
|
||
|
||
>SYSCALL UnloadLib
|
||
|
||
.1 lda hLIBETALK
|
||
beq .2
|
||
|
||
>SYSCALL UnloadLib
|
||
|
||
.2 >PUSHWI 0
|
||
>PUSHBI IOCTL.CLOSE
|
||
lda hFD
|
||
>SYSCALL IOCTL
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
CS.END
|
||
*--------------------------------------
|
||
DEVNAME .AZ "/DEV/ETH1"
|
||
MSG.DEV.KO .AZ "No Device Found, exiting."
|
||
MSG.DEV.OK .AZ "Bound To Device : %s\r\n"
|
||
LIBTCPIP .AZ "libtcpip"
|
||
LIBETALK .AZ "libetalk"
|
||
hFD .BS 1
|
||
hLIBTCPIP .BS 1
|
||
hLIBETALK .BS 1
|
||
IOCTL .BS S.IOCTL
|
||
hFrameIn .BS 1
|
||
*--------------------------------------
|
||
.DUMMY
|
||
.OR 0
|
||
DS.START
|
||
DS.END .ED
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE USR/SRC/SBIN/NETWORKD.S
|
||
ASM
|