mirror of
https://github.com/A2osX/A2osX.git
synced 2025-01-12 01:30:36 +00:00
NETWORK:fix in TCPIP,new UDETH.DRV, fix in U1.DRV
ProDOS.FX:improved TOOLBOK for selectors
This commit is contained in:
parent
5c26012b7f
commit
f12295ec7c
Binary file not shown.
494
DRV/UDETH.DRV.S.txt
Normal file
494
DRV/UDETH.DRV.S.txt
Normal file
@ -0,0 +1,494 @@
|
||||
NEW
|
||||
AUTO 3,1
|
||||
.LIST OFF
|
||||
.OP 65C02
|
||||
.OR $2000
|
||||
.TF drv/udeth.drv
|
||||
*--------------------------------------
|
||||
.INB inc/macros.i
|
||||
.INB inc/a2osx.i
|
||||
.INB inc/mli.e.i
|
||||
.INB inc/nic.i
|
||||
.INB inc/eth.i
|
||||
*--------------------------------------
|
||||
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.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
|
||||
|
||||
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
|
||||
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
|
||||
sta UD.IO.Cmd,x
|
||||
jsr IO.Exec
|
||||
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
|
||||
sta UD.IO.Cmd,x
|
||||
jsr IO.Exec
|
||||
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.NetRcvd
|
||||
sta UD.IO.Cmd,x
|
||||
jsr IO.Exec
|
||||
bcs READWRITE.99
|
||||
|
||||
lda UD.IO.RData,x
|
||||
ldy #S.IOCTL.BYTECNT
|
||||
sta (ZPIOCTL),y
|
||||
pha
|
||||
eor #$ff
|
||||
sta Counter
|
||||
|
||||
lda UD.IO.RData,x
|
||||
iny
|
||||
sta (ZPIOCTL),y
|
||||
pha
|
||||
eor #$ff
|
||||
sta Counter+1
|
||||
|
||||
pla
|
||||
ply
|
||||
bne .1
|
||||
|
||||
tax
|
||||
beq READWRITE.9
|
||||
|
||||
.1 >SYSCALL2 GetMem
|
||||
bcs READWRITE.99
|
||||
|
||||
>STYA ZPBufPtr
|
||||
phx
|
||||
phy
|
||||
ldy #S.IOCTL.BUFPTR+1
|
||||
sta (ZPIOCTL),y
|
||||
dey
|
||||
pla
|
||||
sta (ZPIOCTL),y
|
||||
|
||||
ldx DEVSLOTx0
|
||||
|
||||
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 pla hMem
|
||||
|
||||
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
|
||||
lda (ZPIOCTL),y
|
||||
eor #$ff
|
||||
sta Counter+1
|
||||
|
||||
ldy #S.IOCTL.BUFPTR
|
||||
lda (ZPIOCTL),y
|
||||
sta ZPBufPtr
|
||||
iny
|
||||
lda (ZPIOCTL),y
|
||||
sta ZPBufPtr+1
|
||||
|
||||
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.Exec lda #0
|
||||
sta 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
|
||||
.DA #S.DCB.NIC.SPEED.10
|
||||
.HS 000000000000 MAC
|
||||
.BS 12 IP/MASK/GW
|
||||
*--------------------------------------
|
||||
DRV.END
|
||||
MAN
|
||||
SAVE usr/src/drv/udeth.drv.s
|
||||
ASM
|
@ -389,23 +389,17 @@ READ php
|
||||
ldy #S.IOCTL.BYTECNT+1
|
||||
sta (ZPIOCTL),y
|
||||
pha
|
||||
lsr
|
||||
pha
|
||||
lda RTDATA,x
|
||||
eor #$ff
|
||||
sta Counter+1
|
||||
|
||||
dey
|
||||
lda RTDATA,x
|
||||
sta (ZPIOCTL),y
|
||||
tay
|
||||
|
||||
ror
|
||||
adc #0
|
||||
eor #$ff
|
||||
sta Counter
|
||||
|
||||
pla
|
||||
adc #0
|
||||
eor #$ff
|
||||
sta Counter+1
|
||||
|
||||
pla
|
||||
>SYSCALL2 GetMem
|
||||
bcs READWRITE.99
|
||||
@ -422,22 +416,30 @@ READ php
|
||||
|
||||
ldy #0
|
||||
|
||||
.2 inc Counter
|
||||
bne .3
|
||||
.1 inc Counter
|
||||
bne .2
|
||||
|
||||
inc Counter+1
|
||||
beq .8
|
||||
|
||||
.3 lda RTDATA,x
|
||||
.2 lda RTDATA,x
|
||||
sta (ZPBufPtr),y
|
||||
|
||||
iny
|
||||
|
||||
inc Counter
|
||||
bne .3
|
||||
|
||||
inc Counter+1
|
||||
beq .8
|
||||
|
||||
.3 lda RTDATA+1,x
|
||||
sta (ZPBufPtr),y
|
||||
iny
|
||||
lda RTDATA+1,x
|
||||
sta (ZPBufPtr),y
|
||||
iny
|
||||
bne .2
|
||||
bne .1
|
||||
|
||||
inc ZPBufPtr+1
|
||||
bra .2
|
||||
bra .1
|
||||
|
||||
.8 pla hMem
|
||||
|
||||
@ -464,22 +466,15 @@ WRITE php
|
||||
ldy #S.IOCTL.BYTECNT+1
|
||||
lda (ZPIOCTL),y
|
||||
sta TxLength+1,x
|
||||
lsr
|
||||
pha
|
||||
eor #$ff
|
||||
sta Counter+1
|
||||
|
||||
dey
|
||||
lda (ZPIOCTL),y
|
||||
sta TxLength,x
|
||||
ror
|
||||
adc #0
|
||||
eor #$ff
|
||||
sta Counter
|
||||
|
||||
pla
|
||||
adc #0
|
||||
eor #$ff
|
||||
sta Counter+1
|
||||
|
||||
lda /PP.BusST
|
||||
sta PacketPagePTR+1,x
|
||||
lda #PP.BusST
|
||||
@ -500,36 +495,41 @@ WRITE php
|
||||
ldx #5
|
||||
ldy #S.ETH.SRCMAC+5
|
||||
|
||||
.10 lda DCB+S.DCB.NIC.MAC,x
|
||||
.1 lda DCB+S.DCB.NIC.MAC,x
|
||||
sta (ZPBufPtr),y
|
||||
dey
|
||||
dex
|
||||
bpl .10
|
||||
bpl .1
|
||||
|
||||
ldx DEVSLOTx0
|
||||
|
||||
ldy #0
|
||||
|
||||
.1 inc Counter
|
||||
bne .2
|
||||
.2 inc Counter
|
||||
bne .3
|
||||
|
||||
inc Counter+1
|
||||
beq .8
|
||||
|
||||
.2 lda (ZPBufPtr),y
|
||||
sta RTDATA,x
|
||||
iny
|
||||
bne .3
|
||||
|
||||
inc ZPBufPtr+1
|
||||
|
||||
.3 lda (ZPBufPtr),y
|
||||
sta RTDATA+1,x
|
||||
sta RTDATA,x
|
||||
|
||||
iny
|
||||
bne .1
|
||||
|
||||
inc Counter
|
||||
bne .4
|
||||
|
||||
inc Counter+1
|
||||
beq .8
|
||||
|
||||
.4 lda (ZPBufPtr),y
|
||||
sta RTDATA+1,x
|
||||
|
||||
iny
|
||||
bne .2
|
||||
|
||||
inc ZPBufPtr+1
|
||||
bne .1
|
||||
bne .2
|
||||
|
||||
.8 plp
|
||||
clc
|
||||
|
@ -578,8 +578,8 @@ TCP.OUT.Send clc Queue if fail
|
||||
|
||||
ldy #S.TCP.OPTIONS
|
||||
sta (ZPFrameOutPtr),y
|
||||
* bit #S.TCP.OPTIONS.ACK
|
||||
* beq .2
|
||||
bit #S.TCP.OPTIONS.ACK
|
||||
beq .2
|
||||
|
||||
ldx #3
|
||||
ldy #S.TCP.ACKNUM+3
|
||||
|
@ -25,6 +25,7 @@ SEL1.Filenames .EQ $2000
|
||||
SEL1.START cld
|
||||
bit RROMBNK2 read ROM
|
||||
|
||||
* Already done before jmp $1000
|
||||
* stz softev
|
||||
* lda #$10 set reset vector to 'dispadr'
|
||||
* sta softev+1
|
||||
|
@ -786,23 +786,20 @@ clrdir stz gbuf+2,x
|
||||
jsr XDOS.ReadGBufAX read in parent directory block
|
||||
.FIN
|
||||
|
||||
ldx own_ent and calc entry address.
|
||||
lda /gbuf
|
||||
sta zpt+1
|
||||
lda #$04
|
||||
jsr XDOS.ZPT.InitGBuf
|
||||
|
||||
ocalc clc
|
||||
dex has entry address been calculated?
|
||||
ldx own_ent and calc entry address.
|
||||
|
||||
ocalc dex has entry address been calculated?
|
||||
beq H3584 if yes.
|
||||
|
||||
adc own_len next entry address
|
||||
bcc ocalc
|
||||
lda own_len next entry address
|
||||
jsr XDOS.ZPT.NextA
|
||||
bra ocalc
|
||||
|
||||
H3584 ldy #$13 index to block count
|
||||
clc
|
||||
|
||||
inc zpt+1 entry must be in 2nd 256 bytes of block
|
||||
bcs ocalc always taken.
|
||||
|
||||
H3584 sta zpt
|
||||
ldy #$13 index to block count
|
||||
H3588 lda (zpt),y
|
||||
adc dinctbl-$13,y add 1 to block count and
|
||||
sta (zpt),y
|
||||
@ -977,23 +974,18 @@ credone jsr drevise go revise directories with new file
|
||||
|
||||
jmp upbmap lastly, update volume bitmap
|
||||
*--------------------------------------
|
||||
entcalc lda /gbuf set high address of dir entry
|
||||
sta zpt+1 index pointer.
|
||||
lda #$04 calc address of entry based
|
||||
entcalc jsr XDOS.ZPT.InitGBuf
|
||||
|
||||
ldx d_entnum on the entry #.
|
||||
|
||||
H3689 clc
|
||||
clc
|
||||
|
||||
H368A dex addr = gbuf + ((d_entnum-1) * h_entln)
|
||||
beq H3696 branch with carry clear = no errors.
|
||||
.1 dex addr = gbuf + ((d_entnum-1) * h_entln)
|
||||
beq crerr3 branch with carry clear = no errors.
|
||||
|
||||
adc h_entln
|
||||
bcc H368A
|
||||
jsr XDOS.ZPT.Next
|
||||
bcc .1
|
||||
|
||||
inc zpt+1 inc hi address.
|
||||
bcs H3689 always.
|
||||
|
||||
H3696 sta zpt newly calculated low address.
|
||||
crerr3 rts carry set if error.
|
||||
*--------------------------------------
|
||||
drevise lda p8date
|
||||
|
@ -44,10 +44,7 @@ XDOS.CheckPath jsr XDOS.FindVol
|
||||
|
||||
bne lookfil0 branch if more than root
|
||||
|
||||
lda /gbuf otherwise, report a bad path error
|
||||
sta zpt+1 (but 1st create a phantom entry
|
||||
lda #$04 for open)
|
||||
sta zpt
|
||||
jsr XDOS.ZPT.InitGBuf
|
||||
|
||||
ldy #$1F move in id and date info
|
||||
|
||||
@ -247,68 +244,63 @@ filfound lda h_maxent figure out which entry # this is
|
||||
sbc cntent max entries - count entries + 1
|
||||
adc #$00 = entry # (carry was set)
|
||||
sta d_entnum
|
||||
|
||||
lda bloknml and indicate block # of this directory
|
||||
sta d_entblk
|
||||
lda bloknml+1
|
||||
sta d_entblk+1
|
||||
clc
|
||||
|
||||
* clc done by ADC #$00
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
XDOS.LookupNameInDirBlk
|
||||
lda h_maxent reset count of files per block
|
||||
sta cntent
|
||||
|
||||
lda /gbuf
|
||||
sta zpt+1
|
||||
lda #$04
|
||||
jsr XDOS.ZPT.InitGBuf reset indirect pointer to gbuf
|
||||
|
||||
L38C1 sta zpt reset indirect pointer to gbuf
|
||||
bcs L38F8 branch if this block contains a header
|
||||
bcs .4 branch if this block contains a header
|
||||
|
||||
ldy #$00
|
||||
.1 ldy #$00
|
||||
lda (zpt),y get length of name in directory.
|
||||
bne isname branch if there is a name.
|
||||
bne .2 branch if there is a name.
|
||||
|
||||
lda nofree test if a free entry has been declared.
|
||||
bne L38F8 yes, inc to next entry.
|
||||
bne .4 yes, inc to next entry.
|
||||
|
||||
jsr filfound set address for current entry.
|
||||
|
||||
inc nofree indicate a free spot has been found.
|
||||
bra L38F8
|
||||
bra .4
|
||||
|
||||
isname and #$0F strip byte (is checked by 'filfound')
|
||||
.2 and #$0F strip byte (is checked by 'filfound')
|
||||
inc totent inc count of valid files found.
|
||||
sta namcnt save name length as counter.
|
||||
|
||||
ldx namptr get index to current path.
|
||||
cmp pathbuf,x are both names the same length?
|
||||
bne L38F8 no, inc to next entry.
|
||||
bne .4 no, inc to next entry.
|
||||
|
||||
cmpname inx (first) next letter index
|
||||
.3 inx (first) next letter index
|
||||
iny
|
||||
|
||||
lda (zpt),y compare names letter by letter
|
||||
cmp pathbuf,x
|
||||
bne L38F8
|
||||
bne .4
|
||||
|
||||
dec namcnt all letters compared?
|
||||
bne cmpname no, continue.
|
||||
bne .3 no, continue.
|
||||
|
||||
clc a match is found.
|
||||
noname rts
|
||||
.9 rts
|
||||
|
||||
L38F8 dec cntent checked all entries in this block?
|
||||
.4 dec cntent checked all entries in this block?
|
||||
sec
|
||||
beq noname yes, no name match.
|
||||
lda h_entln add entry length to current pointer
|
||||
clc
|
||||
adc zpt
|
||||
bcc L38C1 branch if still in 1st page.
|
||||
beq .9 yes, no name match.
|
||||
|
||||
inc zpt+1 look on 2nd page.
|
||||
clc carry should always be clear before
|
||||
bra L38C1 looking at next.
|
||||
jsr XDOS.ZPT.Next
|
||||
bra .1
|
||||
*--------------------------------------
|
||||
XDOS.FindVol jsr XDOS.FindVolInVCBOrDev
|
||||
bcs novolume
|
||||
|
@ -292,7 +292,9 @@ XDOS.CheckAndUnpackGBuf
|
||||
sec
|
||||
rts
|
||||
|
||||
XDOS.UnpackGBuf jsr XDOS.Pack.Init
|
||||
XDOS.UnpackGBuf jsr XDOS.ZPT.InitGBuf
|
||||
|
||||
ldx h_maxent
|
||||
|
||||
XDOS.UnpackZPT .EQ *
|
||||
|
||||
@ -336,17 +338,21 @@ XDOS.UnpackZPT .EQ *
|
||||
.5 dey
|
||||
bne .2
|
||||
|
||||
.6 jsr XDOS.Pack.Next
|
||||
dex
|
||||
bne .1
|
||||
.6 dex
|
||||
beq .8
|
||||
|
||||
clc make sure CC
|
||||
jsr XDOS.ZPT.Next
|
||||
bra .1
|
||||
|
||||
.8 clc make sure CC
|
||||
rts
|
||||
*--------------------------------------
|
||||
*XDOS.PackGBuf.Bitmap .BS 2
|
||||
XDOS.PackGBuf.Bitmap .EQ sos
|
||||
*--------------------------------------
|
||||
XDOS.PackGBuf jsr XDOS.Pack.Init
|
||||
XDOS.PackGBuf jsr XDOS.ZPT.InitGBuf
|
||||
|
||||
ldx h_maxent
|
||||
|
||||
.1 lda (zpt)
|
||||
and #$0F
|
||||
@ -392,28 +398,30 @@ XDOS.PackGBuf jsr XDOS.Pack.Init
|
||||
lda XDOS.PackGBuf.Bitmap+1
|
||||
sta (zpt),y
|
||||
|
||||
.6 jsr XDOS.Pack.Next
|
||||
.6 jsr XDOS.ZPT.Next
|
||||
dex
|
||||
bne .1
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
XDOS.Pack.Init lda #4
|
||||
sta zpt
|
||||
XDOS.ZPT.InitGBuf
|
||||
lda /gbuf
|
||||
sta zpt+1
|
||||
|
||||
ldx h_maxent
|
||||
* beq * DEBUG : should never happends
|
||||
XDOS.ZPT.InitA sta zpt+1
|
||||
lda #4
|
||||
sta zpt
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
XDOS.Pack.Next lda h_entln
|
||||
clc
|
||||
XDOS.ZPT.Next lda h_entln
|
||||
|
||||
XDOS.ZPT.NextA clc
|
||||
adc zpt
|
||||
sta zpt
|
||||
bcc .8
|
||||
|
||||
inc zpt+1
|
||||
clc
|
||||
|
||||
.8 rts
|
||||
.FIN
|
||||
@ -553,11 +561,8 @@ L3EA9 ldx levels be sure there is a top index
|
||||
jsr rfcbfst go get only index block.
|
||||
bcs L3ED4 if error.
|
||||
|
||||
ldy fcbptr save newly loaded index block's address.
|
||||
lda bloknml
|
||||
sta FCBs+FCB.IBLK,y
|
||||
lda bloknml+1
|
||||
sta FCBs+FCB.IBLK+1,y
|
||||
jsr XDOS.UpdateFCBIBlk save newly loaded index block's address.
|
||||
|
||||
datlevel1 bra datlevel branch always
|
||||
|
||||
L3ED4 rts
|
||||
@ -597,17 +602,10 @@ saplevel sta bloknml read in next lower index block.
|
||||
jsr fileio1 go read index block.
|
||||
bcs L3ED4 error
|
||||
|
||||
ldy fcbptr
|
||||
lda bloknml
|
||||
sta FCBs+FCB.IBLK,y save block address of this index in fcb
|
||||
lda bloknml+1
|
||||
sta FCBs+FCB.IBLK+1,y
|
||||
jsr XDOS.UpdateFCBIBlk save block address of this index in fcb
|
||||
|
||||
datlevel jsr XDOS.Tpos2Y get block address of data block
|
||||
|
||||
datlevel lda tposhi get block address of data block
|
||||
lsr
|
||||
lda tposlh ( if there is one )
|
||||
ror
|
||||
tay
|
||||
lda (zpt),y data block address low
|
||||
inc zpt+1
|
||||
cmp (zpt),y
|
||||
@ -1018,6 +1016,14 @@ L41C1 tya calc position of next fcb.
|
||||
clc report no conflicts.
|
||||
rts
|
||||
*--------------------------------------
|
||||
XDOS.UpdateFCBIBlk
|
||||
ldy fcbptr
|
||||
lda bloknml
|
||||
sta FCBs+FCB.IBLK,y save block address of this index in fcb
|
||||
lda bloknml+1
|
||||
sta FCBs+FCB.IBLK+1,y
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE usr/src/prodos.fx/prodos.s.xdos.c
|
||||
LOAD usr/src/prodos.fx/prodos.s
|
||||
|
@ -93,11 +93,8 @@ L4269 dec cmdtemp has all been read fast ?
|
||||
|
||||
L427B bcs L4249
|
||||
|
||||
lda tposhi get index to next block address
|
||||
lsr
|
||||
lda tposlh
|
||||
ror
|
||||
tay index to address = int(pos/512)
|
||||
jsr XDOS.Tpos2Y get index to next block address
|
||||
|
||||
lda (zpt),y get low address
|
||||
sta bloknml
|
||||
inc zpt+1
|
||||
@ -456,11 +453,8 @@ L44B8 jsr alcwblk go allocate for data block.
|
||||
lda #FCB.F.IBLKMOD indicate index block is dirty.
|
||||
jsr XDOS.SetFCBStatus
|
||||
|
||||
lda tposhi calculate position within index block.
|
||||
lsr
|
||||
lda tposlh
|
||||
ror
|
||||
tay now put block address into index block.
|
||||
jsr XDOS.Tpos2Y now put block address into index block.
|
||||
|
||||
inc zpt+1 high byte first.
|
||||
lda scrtch+1
|
||||
tax
|
||||
@ -593,15 +587,15 @@ L457A jsr alcwblk get another block address for the sap
|
||||
*--------------------------------------
|
||||
zeroindex lda #$00
|
||||
tay
|
||||
L3F30 sta (zpt),y zero out the index half of the user's
|
||||
.1 sta (zpt),y zero out the index half of the user's
|
||||
iny i/o buffer
|
||||
bne L3F30
|
||||
bne .1
|
||||
|
||||
inc zpt+1
|
||||
|
||||
L3F37 sta (zpt),y
|
||||
.2 sta (zpt),y
|
||||
iny
|
||||
bne L3F37
|
||||
bne .2
|
||||
|
||||
dec zpt+1 restore proper address
|
||||
rts
|
||||
@ -663,7 +657,8 @@ alcwblk jsr alc1blk
|
||||
*--------------------------------------
|
||||
tstwprot jsr XDOS.GetFCBStatus check for 'never been modified' condition
|
||||
and #$F0
|
||||
bne tstwprot.8 ordinary rts if known write ok.
|
||||
clc
|
||||
bne tstwprot.RTS ordinary rts if known write ok.
|
||||
|
||||
jsr XDOS.FCBDevIDSelect
|
||||
|
||||
@ -687,9 +682,13 @@ twrprot1 sta unitnum make the device status call
|
||||
plx
|
||||
stx bloknml+1
|
||||
|
||||
rts
|
||||
|
||||
tstwprot.8 clc
|
||||
tstwprot.RTS rts
|
||||
*--------------------------------------
|
||||
XDOS.Tpos2Y lda tposhi get index to next block address
|
||||
lsr
|
||||
lda tposlh
|
||||
ror
|
||||
tay index to address = int(pos/512)
|
||||
rts
|
||||
*--------------------------------------
|
||||
MAN
|
||||
|
@ -741,58 +741,13 @@ XDOS.SPParams .HS 03 # of parms (always 3 except format)
|
||||
XDOS.SPParams.U .HS 00 unit number
|
||||
XDOS.SPParams.B .HS 0000 data buffer
|
||||
.HS 000000 block number (3 bytes)
|
||||
*--------------------------------------
|
||||
.DO XRWDBG=1
|
||||
|
||||
XRW.DEBUG.BASE .EQ $750
|
||||
|
||||
XRW.DEBUG sta CLRPAGE2
|
||||
|
||||
lda #" "
|
||||
sta XRW.DEBUG.BASE+$22
|
||||
|
||||
lda #"R"
|
||||
bit XRW.bWrite
|
||||
bpl .1
|
||||
|
||||
lda #"W"
|
||||
|
||||
.1 sta XRW.DEBUG.BASE+$23
|
||||
|
||||
ldx #$24
|
||||
|
||||
lda XRW.ReqTrack
|
||||
jsr XRW.DEBUG.PBYTEx
|
||||
|
||||
lda XRW.ReqSector
|
||||
|
||||
XRW.DEBUG.PBYTEx
|
||||
pha
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
jsr .7
|
||||
|
||||
pla
|
||||
|
||||
.7 and #$0F
|
||||
ora #$B0
|
||||
cmp #"9"+1
|
||||
bcc .8
|
||||
|
||||
adc #6
|
||||
|
||||
.8 sta XRW.DEBUG.BASE,x
|
||||
inx
|
||||
rts
|
||||
|
||||
.FIN
|
||||
*--------------------------------------
|
||||
XDOS.TOOLBOX jmp (.1,x)
|
||||
|
||||
.1 .DA XDOS.TOOLBOX.MEMRESET
|
||||
.DA XDOS.TOOLBOX.UnpackYA
|
||||
.DA XDOS.TOOLBOX.EnumBlk
|
||||
.DA XDOS.TOOLBOX.EnumNext
|
||||
|
||||
XDOS.TOOLBOX.MEMRESET
|
||||
ldx #$17
|
||||
@ -812,6 +767,74 @@ XDOS.TOOLBOX.UnpackYA
|
||||
|
||||
ldx #1
|
||||
jmp XDOS.UnpackZPT
|
||||
|
||||
XDOS.TOOLBOX.EnumBlk
|
||||
jsr XDOS.ZPT.InitA
|
||||
|
||||
lda (zpt)
|
||||
and #$F0
|
||||
cmp #$E0
|
||||
bcs .8
|
||||
|
||||
ldy #$1F
|
||||
ldx #3
|
||||
|
||||
.1 lda (zpt),y
|
||||
sta h_entln,x
|
||||
dey
|
||||
dex
|
||||
bpl .1
|
||||
|
||||
jsr XDOS.ZPT.Next
|
||||
|
||||
lda h_maxent
|
||||
dec skip header
|
||||
sta cntent
|
||||
|
||||
* ldy h_fcnt
|
||||
* lda h_fcnt+1
|
||||
|
||||
.8 clc
|
||||
rts
|
||||
|
||||
XDOS.TOOLBOX.EnumNext
|
||||
sty sos
|
||||
sta sos+1
|
||||
|
||||
lda cntent
|
||||
beq .9
|
||||
|
||||
.1 lda (zpt)
|
||||
and #$0F
|
||||
beq .7
|
||||
|
||||
sta (sos)
|
||||
|
||||
pha
|
||||
|
||||
ldx #1
|
||||
jsr XDOS.UnpackZPT
|
||||
|
||||
ply
|
||||
|
||||
.2 lda (zpt),y
|
||||
sta (sos),y
|
||||
dey
|
||||
bne .2
|
||||
|
||||
ldy #16 FileType
|
||||
lda (zpt),y
|
||||
|
||||
clc
|
||||
rts
|
||||
|
||||
.7 jsr XDOS.ZPT.Next
|
||||
|
||||
dec cntent
|
||||
bne .1
|
||||
|
||||
.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
* data tables
|
||||
*--------------------------------------
|
||||
@ -901,10 +924,12 @@ h_credt .HS 0000 directory creation date
|
||||
.HS 00 version under which this dir created
|
||||
.HS 00 earliest version that it's compatible
|
||||
h_attr .HS 00 attributes (protect bit, etc.)
|
||||
|
||||
*--------------------------------------
|
||||
h_entln .HS 00 length of each entry in this directory
|
||||
h_maxent .HS 00 maximum number of entries per block
|
||||
*--------------------------------------
|
||||
h_fcnt .HS 0000 current # of files in this directory
|
||||
*--------------------------------------
|
||||
h_bmap .HS 0000 address of first allocation bitmap
|
||||
h_tblk .HS 0000 total number of blocks on this unit
|
||||
*--------------------------------------
|
||||
|
@ -150,10 +150,6 @@ XRW.Cmd lda A4L get command #
|
||||
*--------------------------------------
|
||||
.2 sei DISABLE IRQ
|
||||
|
||||
.DO XRWDBG=1
|
||||
jsr XRW.DEBUG
|
||||
.FIN
|
||||
|
||||
lda #2
|
||||
sta XRW.RecalibrateCnt
|
||||
|
||||
@ -173,10 +169,6 @@ XRW.Cmd lda A4L get command #
|
||||
inc XRW.ReqSector
|
||||
inc XRW.ReqSector
|
||||
|
||||
.DO XRWDBG=1
|
||||
jsr XRW.DEBUG
|
||||
.FIN
|
||||
|
||||
jsr XRW.SectorIO get 2nd half of block
|
||||
dec buf+1
|
||||
|
||||
|
@ -12,8 +12,6 @@ ACL .EQ 1
|
||||
LOGO .EQ 1
|
||||
PM .EQ 1
|
||||
*--------------------------------------
|
||||
XRWDBG .EQ 0
|
||||
*--------------------------------------
|
||||
NSC.IOBASE .EQ $C300
|
||||
*--------------------------------------
|
||||
.INB inc/zp.i
|
||||
|
Loading…
x
Reference in New Issue
Block a user