Kernel 0.94

This commit is contained in:
Rémy GIBERT 2020-05-17 19:34:32 +02:00
parent 62cf7343fa
commit 01fbc4c874
23 changed files with 390 additions and 993 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -126,11 +126,8 @@ DLG.Run jsr GetCh
pla
jsr DLG.CTRL.CharIn
bra DLG.Run
rts
.8 clc
.9 rts
*--------------------------------------
@ -768,17 +765,28 @@ DLG.CTRL.CharIn.TB
.8 clc
rts
*--------------------------------------
DLG.CTRL.CharIn.OL
cmp #C.SPACE
bne .8
phy
iny
iny
iny
iny
iny
lda (ZPPTR1),y VALUE
dey
sta (pData),y VAR
pla
jsr DLG.CTRL.Draw
.8 clc
rts
*--------------------------------------
DLG.CTRL.CharIn.BUT
clc

View File

@ -231,22 +231,23 @@ FILE.Load.ASM.Decode
iny
tax
lda (ZPPTR1),y Get Repeat Char
iny
.4 lda (ZPPTR1),y Get Repeat Char
.4 jsr FILE.Load.ASM.2Buf
jsr FILE.Load.ASM.2Buf
bcs .9
dex
bne .4
iny Skip Repeat char
bra .1
.5 and #$3F Compute blank count
tax
lda #C.SPACE
.6 jsr FILE.Load.ASM.2Buf
.6 lda #C.SPACE
jsr FILE.Load.ASM.2Buf
bcs .9
dex

View File

@ -630,11 +630,11 @@ Disk2.X .DA 320 BlkCnt
* .DA #160 QTrkCnt
.BS 3
*--------------------------------------
Disk2.H .DA 384 BlkCnt
.DA #48 TrkCnt
Disk2.H .DA 376 BlkCnt
.DA #47 TrkCnt
.DA #3 Stepping
.DA #126 VolNum
* .DA #144 QTrkCnt
* .DA #141 QTrkCnt
.BS 3
*--------------------------------------
Disk2.HX .DA 432 BlkCnt

View File

@ -248,32 +248,13 @@ IO.PrintBatchErrMsg
>SYSCALL FPrintF
rts
*--------------------------------------
IO.PrintErrMsg ldx L.ERR.Codes
stx ZPPtr1
ldx L.ERR.Codes+1
stx ZPPtr1+1
ldy #S.PS.RC
IO.PrintErrMsg ldy #S.PS.RC
lda (pPS),y
>PUSHA
ldy #0
>PUSHW ZPCLBuf
.1 cmp (ZPPtr1),y
beq .2
iny
cpy #ERR.Count
bne .1
.2 lda L.ERR.Messages
sta ZPPtr1
lda L.ERR.Messages+1
sta ZPPtr1+1
.3 dey
bmi .8
lda (ZPPtr1)
jsr AddAp1Ptr1
bra .3
>SYSCALL GetErrorMessage
.8 ldy #S.PS.hStdErr
lda (pPS),y
@ -282,13 +263,14 @@ IO.PrintErrMsg ldx L.ERR.Codes
ldy #S.PS.RC
lda (pPS),y
>PUSHA
>PUSHW ZPPtr1
>PUSHW ZPCLBuf
>PUSHBI 3
>SYSCALL FPrintF
rts
*--------------------------------------
MAN

View File

@ -46,17 +46,6 @@ C.FI .EQ 60
C.END .EQ 62
*--------------------------------------
C.CLEXEC .EQ 63
*--------------------------------------
E.CSYN .EQ $C0
E.ESYN .EQ $C1
E.STACKERROR .EQ $C2
E.STKOVERFLOW .EQ $C3
E.NOWHILE .EQ $C4
E.NOFOR .EQ $C5
E.NOIF .EQ $C6
E.BADFTYPE .EQ $C7
E.FUNDEF .EQ $C8
E.UNEXPEOF .EQ $C9
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
@ -186,8 +175,6 @@ L.EXP.OP.LOGIC .DA EXP.OP.LOGIC
L.HOME.PROFILE .DA HOME.PROFILE
L.HOME .DA HOME
L.PS1 .DA PS1
L.ERR.Codes .DA ERR.Codes
L.ERR.Messages .DA ERR.Messages
.DA 0
*--------------------------------------
CS.INIT clc
@ -542,7 +529,7 @@ MSG.PROMPTCRLF .AZ "\e[?7l\r\n" Disable Line Wrap
MSG.TRACE .AS ">"
MSG.BATCHLINE .AZ "%s\r\n"
MSG.BATCHERR .AZ "%s^\r\nLine #%D:"
MSG.ERROR .AS "[$%h]:%S."
MSG.ERROR .AS "[$%h]:%s."
MSG.ECHOCRLF .AZ "\r\n"
MSG.PID .AZ "PID=%d\r\n"
FMT.DATE .AZ "%A, %B %d %Y %H:%M:%S"
@ -657,8 +644,6 @@ EXP.OP.MATH.FPU .DA #FPU.ADD32,#FPU.SUB32,#FPU.IMUL32,#FPU.IDIV32,#FPU.IMOD32
*--------------------------------------
SET.FLAGS .AS "CXE"
SET.VARS .DA #bSET.C,#bSET.X,#bSET.E
*--------------------------------------
.INB USR/SRC/SHARED/X.ERRORS.S
*--------------------------------------
.DUMMY
.OR 0

View File

@ -190,7 +190,10 @@ Offset .EQ ZPDRV+6
RXTX.Size .EQ ZPDRV+8
BUF.Size .EQ ZPDRV+10
RX.IP .EQ ZPDRV+12
Sn .EQ ZPDRV+14
*Sn .EQ ZPDRV+16
Sn.IO .EQ ZPDRV+17
Sn.BASE .EQ ZPDRV+18
Sn.MASK .EQ ZPDRV+19
*--------------------------------------
DRV.CS.START cld
jmp (.1,x)
@ -319,70 +322,49 @@ OPEN.I jsr CLOSE
iny
cpy #4
bne .4
*--------------------------------------
>AR.SELECT S0.MR
lda #W5100.AR.Sn.MR.IPRAW+W5100.AR.Sn.MR.MF
sta W5100.DR,x
>AR.SELECT S0.PROTO
lda #S.IP.PROTOCOL.ICMP
sta W5100.DR,x
lda /W5100.AR.S0.MR
sta Sn.IO
* >AR.SELECT S0.TOS
stz W5100.DR,x
ldy #S.IP.PROTOCOL.ICMP
jsr OPEN.SnY
* >AR.SELECT S0.TTL
lda #K.IP.TTL
sta W5100.DR,x
inc Sn.IO
>AR.SELECT S0.CR
lda #W5100.AR.Sn.CR.OPEN
sta W5100.DR,x
*--------------------------------------
>AR.SELECT S1.MR
lda #W5100.AR.Sn.MR.IPRAW+W5100.AR.Sn.MR.MF
sta W5100.DR,x
ldy #S.IP.PROTOCOL.UDP
jsr OPEN.SnY
>AR.SELECT S1.PROTO
lda #S.IP.PROTOCOL.UDP
sta W5100.DR,x
inc Sn.IO
* >AR.SELECT S1.TOS
stz W5100.DR,x
ldy #S.IP.PROTOCOL.TCP
jsr OPEN.SnY
* >AR.SELECT S1.TTL
lda #K.IP.TTL
sta W5100.DR,x
>AR.SELECT S1.CR
lda #W5100.AR.Sn.CR.OPEN
sta W5100.DR,x
*--------------------------------------
>AR.SELECT S2.MR
lda #W5100.AR.Sn.MR.IPRAW+W5100.AR.Sn.MR.MF
sta W5100.DR,x
>AR.SELECT S2.PROTO
lda #S.IP.PROTOCOL.TCP
sta W5100.DR,x
* >AR.SELECT S2.TOS
stz W5100.DR,x
* >AR.SELECT S2.TTL
lda #K.IP.TTL
sta W5100.DR,x
>AR.SELECT S2.CR
lda #W5100.AR.Sn.CR.OPEN
sta W5100.DR,x
*--------------------------------------
lda #S.DIB.S.OPENED
tsb DIB+S.DIB.S
clc
rts
*--------------------------------------
OPEN.SnY >AR.Sn.SELECT S0.MR
lda #W5100.AR.Sn.MR.IPRAW+W5100.AR.Sn.MR.MF
sta W5100.DR,x
>AR.Sn.SELECT S0.PROTO
tya
sta W5100.DR,x
* >AR.Sn.SELECT Sn.TOS
stz W5100.DR,x
* >AR.Sn.SELECT Sn.TTL
lda #K.IP.TTL
sta W5100.DR,x
>AR.Sn.SELECT S0.CR
lda #W5100.AR.Sn.CR.OPEN
sta W5100.DR,x
rts
*--------------------------------------
CLOSE ldx DEVSLOTx0
lda #W5100.MR.RST
@ -409,31 +391,37 @@ READ php
>STYA ZPIOCTL
lda /W5100.AR.S0.MR
sta Sn
ldy #Sn.cnt-1
ldx DEVSLOTx0
.20 lda Sn.IO.BASE,y
sta Sn.IO
sta W5100.AR,x
lda #W5100.AR.S0.RX.RSR
sta W5100.AR+1,x
.20 >AR.Sn.SELECT S0.RX.RSR
lda W5100.DR,x get the received size HI
ora W5100.DR,x LO
bne .1
inc Sn
lda Sn
cmp /W5100.AR.S3.MR
bne .20
dey
bpl .20
jmp READWRITE.NODATA
.1 >AR.Sn.SELECT Sn.RX.RD
.1 lda Sn.RX.BASE,y
sta Sn.BASE
lda Sn.RXTX.MASK,y
sta Sn.MASK
>AR.Sn.SELECT S0.RX.RD
lda W5100.DR,x get the received ptr HI
sta offset+1
ldy W5100.DR,x get the received ptr LO
sty offset
and /RXTX.MASK
ora /RX.BASE
and Sn.MASK
ora Sn.BASE
sta W5100.AR,x
tya
sta W5100.AR+1,x
@ -450,6 +438,7 @@ READ php
sta RXTX.Size+1
eor #$ff
sta Counter+1
lda W5100.DR,x get RX.Size LO
sta RXTX.Size
eor #$ff
@ -589,8 +578,25 @@ WRITE php
ldy #S.IP.PROTOCOL
lda (ZPBufPtr),y
cmp #S.IP.PROTOCOL.ICMP
bne
ldx #Sn.cnt-1
.10 cmp Sn.IP.PROTOCOL,x
beq .11
dex
bpl .10
plp
lda #MLI.E.IO
sec
rts
.11 lda Sn.IO.BASE,x
sta Sn.IO
lda Sn.TX.BASE,x
sta Sn.BASE
lda Sn.RXTX.MASK,x
sta Sn.MASK
ldx DEVSLOTx0
@ -611,17 +617,11 @@ WRITE php
cpy #S.IP.DST+4
bne .1
>AR.Sn.SELECT S0.PROTO
ldy #S.IP.PROTOCOL
lda (ZPBufPtr),y
sta W5100.DR,x
>AR.Sn.SELECT S0.TX.WR
lda W5100.DR,x Get HI
ldy W5100.DR,x Get LO
and /RXTX.MASK
ora /TX.BASE
and Sn.MASK
ora Sn.BASE
sta W5100.AR,x Write HI
sta Offset+1
tya
@ -673,6 +673,12 @@ GET.IOCTLBUFPTR >STYA ZPIOCTL
rts
*--------------------------------------
DRV.CS.END
Sn.cnt .EQ 3
Sn.IP.PROTOCOL .DA #S.IP.PROTOCOL.ICMP,#S.IP.PROTOCOL.UDP,#S.IP.PROTOCOL.TCP
Sn.IO.BASE .DA /W5100.AR.S0.MR,/W5100.AR.S1.MR,/W5100.AR.S2.MR
Sn.TX.BASE .DA /TX.BASE,/TX.BASE+$800,/TX.BASE+$1000
Sn.RX.BASE .DA /RX.BASE,/RX.BASE+$800,/RX.BASE+$1000
Sn.RXTX.MASK .DA /$7FF,/$FFF,/$1FFF 2k,2k,4k
DEVSLOTx0 .BS 1
*--------------------------------------
DIB .DA #0

View File

@ -1,703 +0,0 @@
NEW
AUTO 3,1
.OP 65C02
.OR $2000
*--------------------------------------
.DO U2AI=1
.TF DRV/UTHER2.AI.DRV
.ELSE
.TF DRV/UTHERNET2.DRV
.FIN
*--------------------------------------
ZPArgPtr .EQ ZPBIN
DEVSLOT0x .EQ ZPBIN+2
*--------------------------------------
* 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
L.MAC1 .DA DCB+S.DCB.NIC.MAC+1
L.MAC2 .DA DCB+S.DCB.NIC.MAC+2
L.MAC3 .DA DCB+S.DCB.NIC.MAC+3
L.MAC4 .DA DCB+S.DCB.NIC.MAC+4
L.MAC5 .DA DCB+S.DCB.NIC.MAC+5
.DA 0 End Of Reloc Table
*--------------------------------------
Dev.Detect >STYA ARGS
>LDYA L.MSG.DETECT
>SYSCALL PutS
ldx #$70+$88
ldy #7
.1 lda A2osX.S,y IO based detection, avoid scanning in Disk Controller IO!!!!
bne .2
lda #W5100.MR.RST
sta W5100.MR,x
lda #0
.10 dec give some time....
bne .10
lda #W5100.MR.PB+W5100.MR.AI+W5100.MR.IND
sta W5100.MR,x
pha
pla
lda W5100.MR,x
cmp #W5100.MR.PB+W5100.MR.AI+W5100.MR.IND
bne .2
>AR.SELECT RTR
lda W5100.DR,x Get RTR HI
cmp /2000
bne .2
lda W5100.DR,x Get RTR LO
cmp #2000
beq .3
.2 dec FD.DEV.NAME+3
txa
sec
sbc #$10
tax
dey
bne .1
>LDYA L.MSG.DETECT.KO
>SYSCALL PutS
lda #MLI.E.NODEV
sec
rts
.3 stx DEVSLOTx0
sty DEVSLOT0x
jsr Dev.ParseArgs
bcs .99
>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
.99 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 >LDYA ARGS
>STYA ZPArgPTR
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
ARGS .BS 2
.DO U2AI=1
MSG.DETECT .AZ "UtherNet2/W5100 Driver (ARP/IP Offload)."
.ELSE
MSG.DETECT .AZ "UtherNet2/W5100 Driver."
.FIN
MSG.DETECT.OK .AZ "UtherNet2/W5100 Installed As Device : %s\r\n"
MSG.DETECT.KO .AZ "Hardware Not Found."
SSCANF.MAC .AZ "%h:%h:%h:%h:%h:%h"
*--------------------------------------
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
*--------------------------------------
ZPIOCTL .EQ ZPDRV
ZPBufPtr .EQ ZPDRV+2
Counter .EQ ZPDRV+4
Offset .EQ ZPDRV+6
RXTX.Size .EQ ZPDRV+8
BUF.Size .EQ ZPDRV+10
.DO U2AI=1
RX.IP .EQ ZPDRV+12
.FIN
*--------------------------------------
DRV.CS.START cld
jmp (.1,x)
.1 .DA STATUS
.DA A2osX.BADCALL
.DA A2osX.BADCALL
.DA A2osX.BADCALL
.DO U2AI=1
.DA CONTROL
.ELSE
.DA A2osX.BADCALL
.FIN
.DA A2osX.BADCALL
.DA OPEN
.DA CLOSE
.DA READ
.DA WRITE
.DA 0 end or relocation
*--------------------------------------
STATUS jsr GET.IOCTLBUFPTR
ldy #S.IOCTL.STATCODE
lda (ZPIOCTL),y
beq .1
cmp #S.IOCTL.STATCODE.GETDIB
bne STATUS.DCB
ldy #S.DIB-1
.HS 2C bit abs
.1 ldy #3
.2 lda DIB,y
sta (ZPBufPtr),y
dey
bpl .2
clc
rts
STATUS.DCB cmp #S.IOCTL.STATCODE.GETDCB
bne STATUS.9
ldy #S.DCB.NIC-1
.1 lda DCB,y
sta (ZPBufPtr),y
dey
bpl .1
clc
rts
STATUS.9 lda #MLI.E.BADCTL
sec
rts
*--------------------------------------
.DO U2AI=1
CONTROL jsr GET.IOCTLBUFPTR
ldy #S.IOCTL.CTRLCODE
lda (ZPIOCTL),y
cmp #S.IOCTL.CTRLCODE.SETDCB
bne STATUS.9
ldy #S.DCB.NIC-1
.2 lda (ZPBufPtr),y
sta DCB,y
dey
bpl .2
bra OPEN.I
.FIN
*--------------------------------------
OPEN lda #S.DIB.S.OPENED
bit DIB+S.DIB.S
beq OPEN.I
lda #MLI.E.OPEN
sec
rts
OPEN.I jsr CLOSE
* ldx DEVSLOTx0 Done by CLOSE
lda #W5100.MR.PB+W5100.MR.AI+W5100.MR.IND
sta W5100.MR,x
>AR.SELECT SHAR
ldy #0
.1 lda DCB+S.DCB.NIC.MAC,y
sta W5100.DR,x
iny
cpy #6
bne .1
>AR.SELECT RMSR
lda #3 8k,0k,0k,0k
sta W5100.DR,x ...for Socket RX Buffers
sta W5100.DR,x ...for Socket TX Buffers
>AR.SELECT S0.MR
.DO U2AI=1
lda #W5100.AR.S0.MR.IPRAW+W5100.AR.S0.MR.MF
.ELSE
lda #W5100.AR.S0.MR.MACRAW+W5100.AR.S0.MR.MF
.FIN
sta W5100.DR,x
.DO U2AI=1
>AR.SELECT S0.PROTO
lda #S.IP.PROTOCOL.UDP For initial DHCP request
sta W5100.DR,x
* >AR.SELECT S0.TOS
stz W5100.DR,x
* >AR.SELECT S0.TTL
lda #K.IP.TTL
sta W5100.DR,x
>AR.SELECT GAR
ldy #0
.2 lda DCB+S.DCB.NIC.GW,y
sta W5100.DR,x
iny
cpy #4
bne .2
* >AR.SELECT SUBR Implicit, next to GAR
ldy #0
.3 lda DCB+S.DCB.NIC.MASK,y
sta W5100.DR,x
iny
cpy #4
bne .3
>AR.SELECT SIPR
ldy #0
.4 lda DCB+S.DCB.NIC.IP,y
sta W5100.DR,x
iny
cpy #4
bne .4
.FIN
>AR.SELECT S0.CR
lda #W5100.AR.S0.CR.OPEN
sta W5100.DR,x
lda #S.DIB.S.OPENED
tsb DIB+S.DIB.S
clc
rts
*--------------------------------------
CLOSE ldx DEVSLOTx0
lda #W5100.MR.RST
sta W5100.MR,x
lda $C019 we can use VBL as we are not on //c
.1 eor $C019
bpl .1
lda $C019
.2 eor $C019
bpl .2
lda #S.DIB.S.OPENED
trb DIB+S.DIB.S
clc
rts
*--------------------------------------
READ php
sei
>STYA ZPIOCTL
ldx DEVSLOTx0
>AR.SELECT S0.RX.RSR
lda W5100.DR,x get the received size HI
ora W5100.DR,x LO
bne .1
jmp READWRITE.NODATA
.1 >AR.SELECT S0.RX.RD
lda W5100.DR,x get the received ptr HI
sta offset+1
ldy W5100.DR,x get the received ptr LO
sty offset
and /RXTX.MASK
ora /RX.BASE
sta W5100.AR,x
tya
sta W5100.AR+1,x
.DO U2AI=1
ldy #0
.10 lda W5100.DR,x IPRAW:Get Source IP
sta RX.IP,y
iny
cpy #4
bne .10
lda W5100.DR,x get RX.Size HI (not including 6 bytes Header)
sta RXTX.Size+1
eor #$ff
sta Counter+1
lda W5100.DR,x get RX.Size LO
sta RXTX.Size
eor #$ff
sta Counter
eor #$ff
clc
adc #S.IP
sta BUF.Size
ldy #S.IOCTL.BYTECNT
sta (ZPIOCTL),y
iny
lda RXTX.Size+1
adc /S.IP
sta BUF.Size+1
lda RXTX.Size
clc
adc #6 IPRAW: Add 6 bytes to Total Size
sta RXTX.Size
bcc .11
inc RXTX.Size+1
.11
.ELSE
lda W5100.DR,x get RX.Size HI (Frame size + 2)
sta RXTX.Size+1
lda W5100.DR,x get RX.Size LO
sta RXTX.Size
ldy #S.IOCTL.BYTECNT
sec
sbc #2 MACRAW:strip 2 bytes Header from Size
sta (ZPIOCTL),y
sta BUF.Size
eor #$ff
sta Counter
iny
lda RXTX.Size+1
sbc #0
sta (ZPIOCTL),y
sta BUF.Size+1
eor #$ff
sta Counter+1
.FIN
>LDYA BUF.Size
>SYSCALL2 getmem
bcc .14
jmp READWRITE.9
.14 >STYA ZPBufPtr
phx
phy
ldy #S.IOCTL.BUFPTR+1
sta (ZPIOCTL),y
dey
pla
sta (ZPIOCTL),y
.DO U2AI=1
ldx #3
ldy #S.IP.SRC+3
.12 lda RX.IP,x
sta (ZPBufPtr),y
dey
dex
bpl .12
ldx #3
ldy #S.IP.DST+3
.13 lda DCB+S.DCB.NIC.IP,x
sta (ZPBufPtr),y
dey
dex
bpl .13
ldy #S.IP
.ELSE
ldy #0
.FIN
ldx DEVSLOTx0
.2 inc Counter
bne .3
inc Counter+1
beq .4
.3 lda W5100.DR,x
sta (ZPBufPtr),y
iny
bne .2
inc ZPBufPtr+1
bra .2
.4 >AR.SELECT S0.RX.RD
lda Offset
clc
adc RXTX.Size
pha save LO
lda Offset+1
adc RXTX.Size+1
sta W5100.DR,x write HI
pla
sta W5100.DR,x write LO
.DO U2AI=1
>AR.SELECT S0.PROTO
lda W5100.DR,x
ldy #S.IP.PROTOCOL
sta (ZPBufPtr),y
.FIN
>AR.SELECT S0.CR
lda #W5100.AR.S0.CR.RCVD
sta W5100.DR,x
pla hMem
plp
clc
rts
*--------------------------------------
READWRITE.NODATA
lda #E.NODATA
READWRITE.9 plp
sec
rts
*--------------------------------------
WRITE php
sei
jsr GET.IOCTLBUFPTR
ldy #S.IOCTL.BYTECNT
lda (ZPIOCTL),y
.DO U2AI=1
sec
sbc #S.IP
.FIN
sta RXTX.Size
eor #$ff
sta Counter
iny
lda (ZPIOCTL),y
.DO U2AI=1
sbc /S.IP
.FIN
sta RXTX.Size+1
eor #$ff
sta Counter+1
ldx DEVSLOTx0
>AR.SELECT S0.TX.FSR
lda W5100.DR,x get send size HI
ldy W5100.DR,x LO
cpy RXTX.Size
sbc RXTX.Size+1
bcc READWRITE.NODATA
.DO U2AI=1
>AR.SELECT S0.DIPR
ldy #S.IP.DST
.1 lda (ZPBufPtr),y
sta W5100.DR,x
iny
cpy #S.IP.DST+4
bne .1
>AR.SELECT S0.PROTO
ldy #S.IP.PROTOCOL
lda (ZPBufPtr),y
sta W5100.DR,x
.ELSE
ldy #S.ETH.SRCMAC+5
ldx #5
.1 lda DCB+S.DCB.NIC.MAC,x
sta (ZPBufPtr),y
dey
dex
bpl .1
ldx DEVSLOTx0
.FIN
>AR.SELECT S0.TX.WR
lda W5100.DR,x Get HI
ldy W5100.DR,x Get LO
and /RXTX.MASK
ora /TX.BASE
sta W5100.AR,x Write HI
sta Offset+1
tya
sta W5100.AR+1,x Write LO
sta Offset
.DO U2AI=1
ldy #S.IP
.ELSE
ldy #0
.FIN
.2 inc Counter
bne .3
inc Counter+1
beq .8
.3 lda (ZPBufPtr),y
sta W5100.DR,x
iny
bne .2
inc ZPBufPtr+1
bra .2
.8 >AR.SELECT S0.TX.WR
lda Offset
clc
adc RXTX.Size
pha save LO
lda Offset+1
adc RXTX.Size+1
sta W5100.DR,x write HI
pla
sta W5100.DR,x write LO
>AR.SELECT S0.CR
lda #W5100.AR.S0.CR.SEND
sta W5100.DR,x
plp
clc
rts
*--------------------------------------
GET.IOCTLBUFPTR >STYA ZPIOCTL
ldy #S.IOCTL.BUFPTR
lda (ZPIOCTL),y
sta ZPBufPtr
iny
lda (ZPIOCTL),y
sta ZPBufPtr+1
rts
*--------------------------------------
DRV.CS.END
DEVSLOTx0 .BS 1
*--------------------------------------
DIB .DA #0
.DA #0,#0,#0 size
>PSTR "UtherNetII/W5100"
.DA #S.DIB.T.NIC
.BS 1 Subtype
.DA K.VER Version
*--------------------------------------
DCB .DA #S.DCB.T.NIC
.DO U2AI=1
.DA #S.DCB.NIC.FLAGS.ARPOFFLOAD+S.DCB.NIC.FLAGS.IPOFFLOAD
.ELSE
.DA #0 FLAGS
.FIN
.DA #S.DCB.NIC.LINK.OK+S.DCB.NIC.LINK.FD
.DA #S.DCB.NIC.SPEED.100
.HS 0008DC123456 MAC
.DA #0,#0,#0,#0 IP
.DA #255,#255,#255,#255 MASK
.DA #0,#0,#0,#0 GW
*--------------------------------------
DRV.END
MAN
SAVE USR/SRC/DRV/X.U2.DRV.S
LOAD USR/SRC/DRV/UTHERNET2.DRV.S
ASM

View File

@ -105,6 +105,17 @@ A2osX.SYSCALL2 .EQ $E200
*--------------------------------------
E.NODATA .EQ $FF No Data
*--------------------------------------
E.CSYN .EQ $C0
E.ESYN .EQ $C1
E.STACKERROR .EQ $C2
E.STKOVERFLOW .EQ $C3
E.NOWHILE .EQ $C4
E.NOFOR .EQ $C5
E.NOIF .EQ $C6
E.BADFTYPE .EQ $C7
E.FUNDEF .EQ $C8
E.UNEXPEOF .EQ $C9
*--------------------------------------
E.OOM .EQ $7F Out Of Memory Error
E.OOH .EQ $7E Out Of Handle Error
E.INVH .EQ $7D Invalid Handle
@ -224,10 +235,12 @@ SYS.SScanF .EQ $52
* .EQ $5C
* .EQ $5E
*--------------------------------------D2
* .EQ $60
* .EQ $62
* MOUNT
SYS.Mount .EQ $60
SYS.UMount .EQ $62
* .EQ $64
* .EQ $66
* ERROR
SYS.GetErrorMessage .EQ $66
* ARG
SYS.Shift .EQ $68
SYS.ArgV .EQ $6A

View File

@ -13,7 +13,7 @@ AUTO 4,1
.EM
*--------------------------------------
.MA AR.Sn.SELECT
lda Sn
lda Sn.IO
sta W5100.AR,x
lda #W5100.AR.]1
sta W5100.AR+1,x
@ -52,7 +52,7 @@ W5100.AR.Sn.MR.TCP .EQ $01
W5100.AR.Sn.MR.UDP .EQ $02
W5100.AR.Sn.MR.IPRAW .EQ $03
W5100.AR.Sn.MR.MACRAW .EQ $04
W5100.AR.Sn.MR.PPPOE .EQ $05
*W5100.AR.Sn.MR.PPPOE .EQ $05
W5100.AR.S0.CR .EQ $0401
W5100.AR.Sn.CR.OPEN .EQ $01
*W5100.AR.Sn.CR.LISTEN .EQ $02
@ -73,9 +73,6 @@ W5100.AR.S0.MSSR .EQ $0412
W5100.AR.S0.PROTO .EQ $0414
*W5100.AR.S0.TOS .EQ $0415
*W5100.AR.S0.TTL .EQ $0416
W5100.AR.S1.PROTO .EQ $0514
W5100.AR.S2.PROTO .EQ $0614
W5100.AR.S3.PROTO .EQ $0714
W5100.AR.S0.TX.FSR .EQ $0420
W5100.AR.S0.TX.RD .EQ $0422
W5100.AR.S0.TX.WR .EQ $0424

View File

@ -323,19 +323,21 @@ seek lda BB.HdrTrk get track we're on
jsr BB.PhaseOn
lda #48
lda #40
jsr BB.MSWait Trash X
ldx slotz
lda IO.D2.Ph0Off,x
nop
lda IO.D2.Ph1Off,x
nop
lda IO.D2.Ph2Off,x
nop
lda IO.D2.Ph3Off,x
lda #48
lda #60
jsr BB.MSWait Trash X
beq .1 (always taken)
bcs .1 CS from MSWAIT
*--------------------------------------
BB.PhaseOn pha
jsr .7
@ -344,7 +346,7 @@ BB.PhaseOn pha
bit #1 1,3,5,7 ?
beq .8
inc
inc 2,4,6,0
.7 and #6 mask for 0,2,4,6
ora slotz Slot $n0

View File

@ -28,9 +28,13 @@ D2MoveHead >PULLB MoveTo
jsr CheckDiskII
bcs .9
ldy #0
.1 lda MoveFrom
cmp MoveTo
beq .8
beq .3
iny
bcs .2
@ -41,18 +45,23 @@ D2MoveHead >PULLB MoveTo
.2 dec MoveFrom<MoveTo, must move out
sta MoveFrom
jsr D2.PhaseOn
lda #48
lda #40
jsr D2.Wait100msA Trash X
jsr D2.AllPhaseOff
lda #48
jsr D2.Wait100msA Trash X
* lda #10
* jsr D2.Wait100msA Trash X
bra .1
.3 tya
beq .8
lda #0
jsr D2.Wait100msA Trash X
.8 clc
.9 rts
*--------------------------------------
@ -63,7 +72,7 @@ D2.PhaseOn pha
bit #1 1,3,5,7 ?
beq .8
inc
inc 2,4,6,0
.7 and #6 mask for 0,2,4,6
ora Slotn0
@ -73,8 +82,11 @@ D2.PhaseOn pha
*--------------------------------------
D2.AllPhaseOff ldx Slotn0
lda IO.D2.Ph0Off,x make sure all motor phases are off.
nop
lda IO.D2.Ph1Off,x
nop
lda IO.D2.Ph2Off,x
nop
lda IO.D2.Ph3Off,x
rts
*--------------------------------------

View File

@ -564,7 +564,7 @@ XRW.Wait100msA sec (2)
inc montimeh (6)
.3 sbc #$01
.3 sbc #1
bne .1
rts
@ -740,9 +740,13 @@ XRW.Seek ldx XRW.UnitIndex
sta XRW.CurrentTrack will be current track at the end
sta XRW.D2Trk-1,x
ldy #0
.1 lda XRW.CurrentQTrack
cmp XRW.TargetQTrack
beq .8
beq .3
iny
bcs .2
@ -756,15 +760,21 @@ XRW.Seek ldx XRW.UnitIndex
jsr XRW.PhaseOn
lda #48
lda #40
jsr XRW.Wait100msA Trash X
jsr XRW.AllPhaseOff
lda #48
jsr XRW.Wait100msA Trash X
* lda #10
* jsr XRW.Wait100msA Trash X
bra .1
.3 tya
beq .8
lda #0
jmp XRW.Wait100msA Trash X
.8 rts
*--------------------------------------
XRW.PhaseOn pha
@ -774,7 +784,7 @@ XRW.PhaseOn pha
bit #1 1,3,5,7 ?
beq .8
inc
inc 2,4,6,0
.7 and #6 mask for 0,2,4,6
ora A2L Slot $n0
@ -785,8 +795,11 @@ XRW.PhaseOn pha
XRW.AllPhaseOff ldx A2L
lda IO.D2.Ph0Off,x
nop
lda IO.D2.Ph1Off,x
nop
lda IO.D2.Ph2Off,x
nop
lda IO.D2.Ph3Off,x
rts
*--------------------------------------

View File

@ -1,92 +0,0 @@
NEW
AUTO 3,1
.LIST OFF
*--------------------------------------
ERR.Codes .DA #MLI.E.IO
.DA #MLI.E.NODEV
.DA #MLI.E.WRTPROT
.DA #MLI.E.DSKSWIT
.DA #MLI.E.OFFLINE
.DA #MLI.E.INVPATH
.DA #MLI.E.PNOTFND
.DA #MLI.E.VNOTFND
.DA #MLI.E.FNOTFND
.DA #MLI.E.DUPFILE
.DA #MLI.E.VOLFULL
.DA #MLI.E.DIRFULL
.DA #MLI.E.UNSUPST
.DA #MLI.E.EOF
.DA #MLI.E.LOCKED
.DA #MLI.E.OPEN
*--------------------------------------
.DA #E.OOM
.DA #E.OOH
.DA #E.INVH
.DA #E.BUF
.DA #E.BADPATH
.DA #E.BADARG
.DA #E.NSP
.DA #E.SYN
.DA #E.ENVF
.DA #E.IBIN
.DA #E.FTB
.DA #3 Ctrl-C
*--------------------------------------
.DA #E.CSYN
.DA #E.ESYN
.DA #E.STACKERROR
.DA #E.STKOVERFLOW
.DA #E.NOWHILE
.DA #E.NOFOR
.DA #E.NOIF
.DA #E.BADFTYPE
.DA #E.FUNDEF
.DA #E.UNEXPEOF
*--------------------------------------
ERR.Count .EQ *-ERR.Codes
*--------------------------------------
ERR.Messages >PSTR "I/O Error"
>PSTR "No Device"
>PSTR "Disk Write-Prot."
>PSTR "Disk Switched"
>PSTR "Offline Device"
>PSTR "Invalid Path"
>PSTR "Path Not Found"
>PSTR "Vol Not Found"
>PSTR "File Not Found"
>PSTR "Dup. Filename"
>PSTR "Vol Is Full"
>PSTR "Dir Is Full"
>PSTR "Unsupp. Storage"
>PSTR "End Of File"
>PSTR "File Locked"
>PSTR "File Opened"
*--------------------------------------
>PSTR "Out Of Memory"
>PSTR "Out Of Handle"
>PSTR "Invalid Handle"
>PSTR "Buffer Overflow"
>PSTR "Bad Path"
>PSTR "Bad API Argument"
>PSTR "No Such Process"
>PSTR "Syntax Error"
>PSTR "Env Is Full"
>PSTR "Invalid BIN"
>PSTR "File Too Big"
>PSTR "User Interrupt"
*--------------------------------------
>PSTR "Cmd Syntax Error"
>PSTR "Exp. Syntax Error"
>PSTR "Stack Error"
>PSTR "Stack Overflow"
>PSTR "LOOP Without WHILE"
>PSTR "NEXT Without FOR"
>PSTR "FI/ELSE Without IF"
>PSTR "Bad File Type"
>PSTR "Undef. Function"
>PSTR "Unexp. EOF"
*--------------------------------------
>PSTR "Unknown Error"
*--------------------------------------
MAN
SAVE USR/SRC/SHARED/X.ERRORS.S

23
SYS/KERNEL.S.ERROR.txt Normal file
View File

@ -0,0 +1,23 @@
NEW
AUTO 3,1
*--------------------------------------
* GetErrorMessage
* In :
* Out :
*--------------------------------------
K.GetErrorMessage
>PULLW ZPPtr2 Dst Buf
>PULLA Err Code
sta SETREADAUX
sta SETWRITEAUX
jsr ERRORX.GetErrorMessage
sta CLRREADAUX
rts
*--------------------------------------
MAN
SAVE USR/SRC/SYS/KERNEL.S.ERROR
LOAD USR/SRC/SYS/KERNEL.S
ASM

147
SYS/KERNEL.S.ERRORX.txt Normal file
View File

@ -0,0 +1,147 @@
NEW
AUTO 3,1
*--------------------------------------
ERRORX.GetErrorMessage
ldx #ERRORX.Messages
stx ZPPtr1
ldx /ERRORX.Messages
stx ZPPtr1+1
ldx #0
pha
.1 pla
cmp ERRORX.Codes,x
beq .4
pha
ldy #0
.2 iny
lda (ZPPtr1),y
bpl .2
tya
sec
adc ZPPtr1
sta ZPPtr1
bcc .3
inc ZPPtr1+1
.3 inx
cpx #ERRORX.Count
bne .1
pla
.4 ldy #$ff
sta CLRWRITEAUX
.5 iny
lda (ZPPtr1),y
pha
and #$7F
sta (ZPPtr2),y
pla
bpl .5
iny
lda #0
sta (ZPPtr2),y
clc
rts
*--------------------------------------MLI
ERRORX.Codes .DA #MLI.E.IO
.DA #MLI.E.NODEV
.DA #MLI.E.WRTPROT
.DA #MLI.E.DSKSWIT
.DA #MLI.E.OFFLINE
.DA #MLI.E.INVPATH
.DA #MLI.E.PNOTFND
.DA #MLI.E.VNOTFND
.DA #MLI.E.FNOTFND
.DA #MLI.E.DUPFILE
.DA #MLI.E.VOLFULL
.DA #MLI.E.DIRFULL
.DA #MLI.E.UNSUPST
.DA #MLI.E.EOF
.DA #MLI.E.LOCKED
.DA #MLI.E.OPEN
*--------------------------------------KERNEL
.DA #E.OOM
.DA #E.OOH
.DA #E.INVH
.DA #E.BUF
.DA #E.BADPATH
.DA #E.BADARG
.DA #E.NSP
.DA #E.SYN
.DA #E.ENVF
.DA #E.IBIN
.DA #E.FTB
.DA #3 Ctrl-C
*--------------------------------------PARSER
.DA #E.CSYN
.DA #E.ESYN
.DA #E.STACKERROR
.DA #E.STKOVERFLOW
.DA #E.NOWHILE
.DA #E.NOFOR
.DA #E.NOIF
.DA #E.BADFTYPE
.DA #E.FUNDEF
.DA #E.UNEXPEOF
*--------------------------------------
ERRORX.Count .EQ *-ERRORX.Codes
*--------------------------------------
ERRORX.Messages .AT "I/O Error"
.AT "No Device"
.AT "Disk Write-Prot."
.AT "Disk Switched"
.AT "Offline Device"
.AT "Invalid Path"
.AT "Path Not Found"
.AT "Vol Not Found"
.AT "File Not Found"
.AT "Dup. Filename"
.AT "Vol Is Full"
.AT "Dir Is Full"
.AT "Unsupp. Storage"
.AT "End Of File"
.AT "File Locked"
.AT "File Opened"
*--------------------------------------
.AT "Out Of Memory"
.AT "Out Of Handle"
.AT "Invalid Handle"
.AT "Buffer Overflow"
.AT "Bad Path"
.AT "Bad API Argument"
.AT "No Such Process"
.AT "Syntax Error"
.AT "Env Is Full"
.AT "Invalid BIN"
.AT "File Too Big"
.AT "User Interrupt"
*--------------------------------------
.AT "Cmd Syntax Error"
.AT "Exp. Syntax Error"
.AT "Stack Error"
.AT "Stack Overflow"
.AT "LOOP Without WHILE"
.AT "NEXT Without FOR"
.AT "FI/ELSE Without IF"
.AT "Bad File Type"
.AT "Undef. Function"
.AT "Unexp. EOF"
*--------------------------------------
.AT "Unknown Error"
*--------------------------------------
MAN
SAVE USR/SRC/SYS/KERNEL.S.ERRORX
LOAD USR/SRC/SYS/KERNEL.S
ASM

View File

@ -61,10 +61,10 @@ K.SYSCALL .DA K.ChTyp $00 : STAT
*--------------------------------------
* Bank 2
*--------------------------------------
.DA 0 $60
.DA 0
.DA 0
.DA K.Mount $60
.DA K.UMount
.DA 0
.DA K.GetErrorMessage
.DA K.Shift $68 : ARG
.DA K.ArgV
.DA K.ArgVDup
@ -264,7 +264,7 @@ K.SYSCALL.BANK .DA #RRAMWRAMBNK1 $00
.DA #RRAMWRAMBNK1
.DA #0
*--------------------------------------
.DA #RRAMWRAMBNK2 $60
.DA #RRAMWRAMBNK2 $60 : MOUNT
.DA #0
.DA #RRAMWRAMBNK2
.DA #0

View File

@ -4,10 +4,8 @@ NEW
ZPMemMgrSPtr .EQ ZPMEMMGR Pointer To Slot selected
ZPMemMgrTmp1 .EQ ZPMEMMGR+2
ZPMemMgrSize .EQ ZPMEMMGR+4
*--------------------------------------
MEM.ReqFlags .BS 1 store requested Flags
MEM.BestSlot .BS 1
*MEM.BestScore .BS 2
MEM.ReqFlags .EQ ZPMEMMGR+6 store requested Flags
MEM.BestSlot .EQ ZPMEMMGR+7
MEM.BestScore .EQ ZPMemMgrTmp1
*/--------------------------------------
* # Realloc
@ -347,7 +345,6 @@ K.FreeMem.ERR >PUSHWI K.FreeMem.MSG
.1 >SYSCALL2 printf
lda #E.INVH
>DEBUG
sec
rts
*--------------------------------------

21
SYS/KERNEL.S.MOUNT.txt Normal file
View File

@ -0,0 +1,21 @@
NEW
AUTO 3,1
*--------------------------------------
* K.Mount
* In :
* Out :
*--------------------------------------
K.Mount
*--------------------------------------
* K.UMount
* In :
* Out :
*--------------------------------------
K.UMount
clc
rts
*--------------------------------------
MAN
SAVE USR/SRC/SYS/KERNEL.S.MOUNT
LOAD USR/SRC/SYS/KERNEL.S
ASM

View File

@ -1,25 +1,6 @@
NEW
AUTO 3,1
*--------------------------------------
* K.PFTAdd
* In :
* Out :
*--------------------------------------
K.PFTAdd
*--------------------------------------
* K.PFTRemove
* In :
* Out :
*--------------------------------------
K.PFTRemove
clc
K.PFTRemove.RTS rts
*--------------------------------------
* PFT.CheckPath
* In :
* (pStack),y = PATH (C-String)
* Out :
*--------------------------------------
PFT.CheckPath0 ldy #0
.HS 2C BIT ABS
PFT.CheckPath1 ldy #1
@ -40,7 +21,7 @@ PFT.CheckPathYA >PUSHYA
>PUSHWI K.Buf256
>SYSCALL2 realpath
bcs K.PFTRemove.RTS
bcs PFT.YAToMLIPATH.RTS
ldx #0
@ -101,6 +82,7 @@ PFT.YAToMLIPATH >STYA .1+1
>STYA K.MLI.PARAMS+1
clc
PFT.YAToMLIPATH.RTS
rts
*--------------------------------------
* PFT.CheckNodeA

View File

@ -38,6 +38,7 @@ A2osX.MAIN .DA #0
A2osX.MAIN.B .PH A2osX.EndTables
.INB USR/SRC/SYS/KERNEL.S.CORE
.INB USR/SRC/SYS/KERNEL.S.DRV
.INB USR/SRC/SYS/KERNEL.S.PFT
Mem.MLoMem .EQ *
.EP
A2osX.MAIN.S .EQ *-A2osX.MAIN.B
@ -53,6 +54,7 @@ A2osX.AUX.B .PH Mem.XHiMem
.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.ERRORX
.EP
A2osX.AUX.S .EQ *-A2osX.AUX.B
@ -84,6 +86,8 @@ A2osX.D2 .DA #0
A2osX.D2.B .PH $D000
.DA #RRAMWRAMBNK2
.INB USR/SRC/SYS/KERNEL.S.MOUNT
.INB USR/SRC/SYS/KERNEL.S.ERROR
.INB USR/SRC/SYS/KERNEL.S.ARG
.INB USR/SRC/SYS/KERNEL.S.STDLIB
.INB USR/SRC/SYS/KERNEL.S.STRING
@ -113,7 +117,6 @@ A2osX.E0.B .PH $E000
.INB USR/SRC/SYS/KERNEL.S.MEM
* go to A2osX.D1
.INB USR/SRC/SYS/KERNEL.S.PIPE
.INB USR/SRC/SYS/KERNEL.S.PFT
DevMgr.Timer .BS 1
DevMgr.Stat .DA DevMgr.FreeMem