Kernel 0.93+

This commit is contained in:
Rémy GIBERT 2020-01-06 08:03:37 +01:00
parent e0b8b9dfcc
commit 66ceadb5f2
11 changed files with 179 additions and 83 deletions

1
.Floppies/A2OSX.BLANK.nib generated Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -20,12 +20,15 @@ ZPPtr2 .BS 2
ZPPtrFD .BS 2 ZPPtrFD .BS 2
ZPPtrDevName .BS 2 ZPPtrDevName .BS 2
ArgIndex .BS 1 Index .BS 1
hDevID .BS 1 hDevID .BS 1
hBuf .BS 1 hBuf .BS 1
hMem .BS 1
bLL .BS 1 bLL .BS 1
bCustomBlkSize .BS 1 bCustomBlkSize .BS 1
MediaBlkSize .BS 2 MediaBlkSize .BS 2
CatSize .BS 1 CatSize .BS 1
CatBlkCnt .BS 1 CatBlkCnt .BS 1
@ -58,8 +61,12 @@ L.LIBBLKDEV .DA LIBBLKDEV
L.MSG.USAGE .DA MSG.USAGE L.MSG.USAGE .DA MSG.USAGE
L.MSG.OK .DA MSG.OK L.MSG.OK .DA MSG.OK
L.MSG.ERR .DA MSG.ERR L.MSG.ERR .DA MSG.ERR
L.MSG.CRLF .DA MSG.CRLF
L.MSG.NOSIZE .DA MSG.NOSIZE L.MSG.NOSIZE .DA MSG.NOSIZE
L.MSG.INIT .DA MSG.INIT L.MSG.INIT .DA MSG.INIT
L.MSG.LLDISK2 .DA MSG.LLDISK2
L.MSG.LL .DA MSG.LL
L.MSG.WRITECAT .DA MSG.WRITECAT
L.FMT.BLANK .DA FMT.BLANK L.FMT.BLANK .DA FMT.BLANK
.DA 0 .DA 0
*-------------------------------------- *--------------------------------------
@ -74,8 +81,8 @@ CS.RUN ldy #S.PS.ARGC
lda (pPs),y lda (pPs),y
beq .99 beq .99
.1 inc ArgIndex .1 inc Index
lda ArgIndex lda Index
>SYSCALL ArgV >SYSCALL ArgV
bcc .11 bcc .11
@ -104,8 +111,8 @@ CS.RUN ldy #S.PS.ARGC
cpy #bCustomBlkSize cpy #bCustomBlkSize
bne .1 bne .1
inc ArgIndex inc Index
lda ArgIndex lda Index
>SYSCALL ArgV >SYSCALL ArgV
bcs .99 bcs .99
@ -118,14 +125,14 @@ CS.RUN ldy #S.PS.ARGC
>SYSCALL printf >SYSCALL printf
lda #E.SYN lda #E.SYN
sec sec
rts .9 rts
.4 lda hDevID .4 lda hDevID
bne .5 Already have a dev...go get VolName bne .5 Already have a dev...go get VolName
>LDYA ZPPtr1 >LDYA ZPPtr1
>SYSCALL GetDevByName >SYSCALL GetDevByName
bcs .99 bcs .9
>STYA ZPPtrFD >STYA ZPPtrFD
stx hDevID stx hDevID
@ -147,14 +154,33 @@ CS.RUN ldy #S.PS.ARGC
.8 lda hDevID .8 lda hDevID
beq .99 beq .99
*-------------------------------------- *--------------------------------------
CS.RUN.Format jsr CS.RUN.GetBlockSize CS.RUN.Format jsr CS.RUN.GetDevStatus
bcs .9 bcs .9
jsr CS.RUN.InitCat
>PUSHEA.G VolName
>PUSHW MediaBlkSize
>PUSHW ZPPtrDevName
>PUSHBI 6
>LDYA L.MSG.INIT
>SYSCALL printf
bcs .9 bcs .9
bit bLL
bpl .1
jsr CS.RUN.LL
bcs .9
.1 jsr CS.RUN.InitCat
bcs .9
jsr CS.RUN.BuildCat jsr CS.RUN.BuildCat
bcs .9 bcs .9
jsr CS.RUN.WriteCat jsr CS.RUN.WriteCat
bcs .9 bcs .9
>LDYA L.MSG.OK >LDYA L.MSG.OK
>SYSCALL puts >SYSCALL puts
lda #0 lda #0
@ -170,7 +196,7 @@ CS.RUN.Format jsr CS.RUN.GetBlockSize
sec sec
rts rts
*-------------------------------------- *--------------------------------------
CS.RUN.GetBlockSize CS.RUN.GetDevStatus
lda bCustomBlkSize lda bCustomBlkSize
bmi .8 bmi .8
@ -198,6 +224,51 @@ CS.RUN.GetBlockSize
sec sec
rts rts
*-------------------------------------- *--------------------------------------
CS.RUN.LL >LDA.G DIB+S.DIB.T
cmp #S.DIB.T.DISKII
beq CS.RUN.LL.DISKII
>PUSHBI 0
>LDYA L.MSG.LL
>SYSCALL printf
bcs .9
>PUSHEA.G IOCTL
>PUSHBI IOCTL.FORMAT
lda hDevID
>SYSCALL IOCTL
.9 rts
*--------------------------------------
CS.RUN.LL.DISKII
>LDYAI 4096
>SYSCALL getmem0
bcs .9
>STYA ZPPtr1
stx hMem
stz Index
.1 >PUSHB Index
>PUSHBI 1
>LDYA L.MSG.LLDISK2
>SYSCALL printf
bcs .9
inc Index
lda Index
cmp #35
bne .1
>PUSHBI 0
>LDYA L.MSG.CRLF
>SYSCALL printf
.9 rts
*--------------------------------------
CS.RUN.InitCat lda CatSize CS.RUN.InitCat lda CatSize
bne .1 bne .1
@ -218,16 +289,7 @@ CS.RUN.InitCat lda CatSize
.8 clc .8 clc
rts rts
*-------------------------------------- *--------------------------------------
CS.RUN.BuildCat >PUSHEA.G VolName CS.RUN.BuildCat jsr .7
>PUSHW MediaBlkSize
>PUSHW ZPPtrDevName
>PUSHBI 6
>LDYA L.MSG.INIT
>SYSCALL printf
bcs .9
jsr .7
>LIBCALL hLIBBLKDEV,LIBBLKDEV.GetProDOSCatSize >LIBCALL hLIBBLKDEV,LIBBLKDEV.GetProDOSCatSize
bcs .9 bcs .9
@ -238,7 +300,9 @@ CS.RUN.BuildCat >PUSHEA.G VolName
bcs .9 bcs .9
>STYA.G IOCTL+S.IOCTL.BUFPTR >STYA.G IOCTL+S.IOCTL.BUFPTR
stx hBuf stx hBuf
jsr .7 jsr .7
>PUSHEA.G VolName >PUSHEA.G VolName
>PUSHW.G IOCTL+S.IOCTL.BUFPTR >PUSHW.G IOCTL+S.IOCTL.BUFPTR
>LIBCALL hLIBBLKDEV,LIBBLKDEV.BuildProDOSCat >LIBCALL hLIBBLKDEV,LIBBLKDEV.BuildProDOSCat
@ -249,14 +313,21 @@ CS.RUN.BuildCat >PUSHEA.G VolName
>PUSHB CatOptions >PUSHB CatOptions
rts rts
*-------------------------------------- *--------------------------------------
CS.RUN.WriteCat >PUSHEA.G IOCTL CS.RUN.WriteCat >PUSHBI 0
>LDYA L.MSG.WRITECAT
>SYSCALL printf
.1 >PUSHEA.G IOCTL
>PUSHBI IOCTL.WRITEBLOCK >PUSHBI IOCTL.WRITEBLOCK
lda hDevID lda hDevID
>SYSCALL IOCTL >SYSCALL IOCTL
bcs .9 bcs .9
lda #'.' lda #'.'
>SYSCALL PutChar >SYSCALL PutChar
bcs .9
>LDA.G IOCTL+S.IOCTL.BUFPTR+1 >LDA.G IOCTL+S.IOCTL.BUFPTR+1
inc inc
inc inc
@ -264,7 +335,9 @@ CS.RUN.WriteCat >PUSHEA.G IOCTL
>INC.G IOCTL+S.IOCTL.BLKNUM >INC.G IOCTL+S.IOCTL.BLKNUM
>SLEEP >SLEEP
dec CatBlkCnt dec CatBlkCnt
bne CS.RUN.WriteCat bne .1
clc
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
CS.DOEVENT sec CS.DOEVENT sec
@ -272,9 +345,17 @@ CS.DOEVENT sec
*-------------------------------------- *--------------------------------------
CS.QUIT lda hBuf CS.QUIT lda hBuf
beq .1 beq .1
>SYSCALL FreeMem >SYSCALL FreeMem
.1 lda hLIBBLKDEV
.1 lda hMem
beq .2
>SYSCALL FreeMem
.2 lda hLIBBLKDEV
beq .8 beq .8
>SYSCALL UnloadLib >SYSCALL UnloadLib
.8 clc .8 clc
rts rts
@ -308,9 +389,13 @@ MSG.USAGE .AS "Usage : FORMAT <BLOCKDEV> [VOLUME.NAME]\r\n"
.AS " -B xxxx : override Device block size\r\n" .AS " -B xxxx : override Device block size\r\n"
.AZ " -1-9 : Catalog Size (Blocks)\r\n" .AZ " -1-9 : Catalog Size (Blocks)\r\n"
MSG.OK .AZ "[OK]" MSG.OK .AZ "[OK]"
MSG.ERR .AZ "[%h]\r\n" MSG.ERR .AS "[%h]"
MSG.CRLF .AZ "\r\n"
MSG.NOSIZE .AZ "Unable to get media size." MSG.NOSIZE .AZ "Unable to get media size."
MSG.INIT .AZ "Formatting %s (%D Blks),Volname:%s..." MSG.INIT .AZ "Formatting %s (%D Blks), Volname:%s\r\n"
MSG.LLDISK2 .AZ "\rTrack %02d..."
MSG.LL .AZ "\rLow Level Format..."
MSG.WRITECAT .AZ "Writing Catalog..."
FMT.BLANK .AZ "BLANK%H%H" FMT.BLANK .AZ "BLANK%H%H"
*-------------------------------------- *--------------------------------------
OptionList .AS "LlBb" OptionList .AS "LlBb"

View File

@ -286,8 +286,8 @@ CL.PrintEOL >LDA.G CL.Ptr
CL.PrintEOL.8 clc CL.PrintEOL.8 clc
rts rts
*-------------------------------------- *--------------------------------------
CL.PrintCLBuf >LDYA ZPCLBuf CL.PrintCLBuf >PUSHW ZPCLBuf
>PUSHYA
ldy #S.PS.hStdOut ldy #S.PS.hStdOut
lda (pPs),y lda (pPs),y
>SYSCALL fputs >SYSCALL fputs

View File

@ -167,36 +167,21 @@ CMD.SET lda (ZPArgVBufPtr)
>STYA ZPPTR1 >STYA ZPPTR1
.1 lda (ZPPTR1) .1 lda (ZPPTR1)
beq .8 Ending 0 ? beq .9 Ending 0 ?
jsr GetPtr1LenY >PUSHW L.MSG.PRINTENV
tya
sec
adc ZPPTR1
sta ZPPTR2
lda #0
adc ZPPTR1+1
sta ZPPTR2+1
>PUSHW ZPPTR2 Push value
>PUSHW ZPPTR1 Push name >PUSHW ZPPTR1 Push name
jsr CMD.SET.PRINT jsr GetPtr1NextString
bcs .9 >PUSHW ZPPTR1 Push value
jsr GetPtr1NextString
>PUSHBI 4
>SYSCALL printf2
bcc .1
ldy #$ff
.3 iny
lda (ZPPTR2),y
bne .3
tya
sec
adc ZPPTR2
sta ZPPTR1
lda #0
adc ZPPTR2+1
sta ZPPTR1+1
bra .1
.8 clc
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
* SET +X VAR = VALUE1 op VALUE2 op VALUE3 ... * SET +X VAR = VALUE1 op VALUE2 op VALUE3 ...
@ -263,6 +248,7 @@ CMD.SET.1
.8 clc .8 clc
.9 rts .9 rts
.99 jmp CMD.E.CSYN .99 jmp CMD.E.CSYN
CMD.SET.YA >PUSHYA CMD.SET.YA >PUSHYA
@ -280,13 +266,15 @@ CMD.SET.GET >LDYA ZPVarNamePtr
clc clc
rts rts
.1 >PUSHYA push value .1 pha
>LDYA ZPVarNamePtr >PUSHW L.MSG.PRINTENV
>PUSHYA push name >PUSHW ZPVarNamePtr push name
*--------------------------------------
CMD.SET.PRINT >PUSHBI 4 pla
>LDYA L.MSG.PRINTENV >PUSHYA push value
>SYSCALL printf
>PUSHBI 4
>SYSCALL printf2
rts rts
*-------------------------------------- *--------------------------------------
CMD.SET.EXEC jsr CORE.ArgV.NextChar skip "`" CMD.SET.EXEC jsr CORE.ArgV.NextChar skip "`"
@ -347,13 +335,15 @@ CMD.ECHO stz ZPPtr1 echo -N
beq .3 beq .3
lda #C.SPACE lda #C.SPACE
>SYSCALL putchar >SYSCALL putchar
.3 >PUSHBI 0
>LDYA ZPArgVBufPtr .3 jsr CMD.PrintArgVBufPtr
>SYSCALL printf
bcs .9 bcs .9
inc ZPPtr1+1 inc ZPPtr1+1
.4 jsr CORE.ArgV.Next .4 jsr CORE.ArgV.Next
bne .1 bne .1
.7 bit ZPPtr1 .7 bit ZPPtr1
bmi .8 bmi .8
@ -371,7 +361,7 @@ CMD.ECHO.CSYN lda #E.CSYN
CMD.ECHO.RTS rts CMD.ECHO.RTS rts
*-------------------------------------- *--------------------------------------
CMD.READ lda (ZPArgVBufPtr) CMD.READ lda (ZPArgVBufPtr)
beq .9 beq CMD.ECHO.CSYN
stz ZPVarNamePtr+1 stz ZPVarNamePtr+1
>STZ.G bREAD.S >STZ.G bREAD.S
@ -392,21 +382,17 @@ CMD.READ lda (ZPArgVBufPtr)
bne .3 bne .3
jsr CORE.ArgV.Next jsr CORE.ArgV.Next
beq .9 beq CMD.ECHO.CSYN
>PUSHBI 0 jsr CMD.PrintArgVBufPtr
>LDYA ZPArgVBufPtr
>SYSCALL printf
bcs CMD.ECHO.RTS bcs CMD.ECHO.RTS
bra .5 bra .5
.9 jmp CMD.E.CSYN
.3 cmp #'N' .3 cmp #'N'
bne .9 bne CMD.ECHO.CSYN
jsr CORE.ArgV.Next jsr CORE.ArgV.Next
beq .9 beq CMD.ECHO.CSYN
jsr EXP.GetInt8Arg jsr EXP.GetInt8Arg
bcs CMD.ECHO.RTS bcs CMD.ECHO.RTS
@ -421,7 +407,7 @@ CMD.READ lda (ZPArgVBufPtr)
bne .1 bne .1
lda ZPVarNamePtr+1 lda ZPVarNamePtr+1
beq .9 beq CMD.ECHO.CSYN
CMD.READ.VAR jsr CL.Reset CMD.READ.VAR jsr CL.Reset
@ -1033,13 +1019,13 @@ CMD.NEXT.LIST.TOKEN
lda (pData),y lda (pData),y
sta ZPPtr1+1 sta ZPPtr1+1
ldy #0 ldy #0
.10 jsr GetPtr1Next .10 jsr GetPtr1NextChar
beq .3 beq .3
cmp #C.SPACE cmp #C.SPACE
beq .10 beq .10
sta (ZPCLBuf),y sta (ZPCLBuf),y
iny iny
.1 jsr GetPtr1Next .1 jsr GetPtr1NextChar
beq .3 beq .3
cmp #C.SPACE cmp #C.SPACE
@ -1248,6 +1234,12 @@ CMD.IsSwitch lda (ZPArgVBufPtr)
CMD.IsSwitch.RTS CMD.IsSwitch.RTS
rts rts
*-------------------------------------- *--------------------------------------
CMD.PrintArgVBufPtr
>PUSHBI 0
>LDYA ZPArgVBufPtr
>SYSCALL printf
rts
*--------------------------------------
MAN MAN
SAVE USR/SRC/BIN/SH.S.CMD SAVE USR/SRC/BIN/SH.S.CMD
LOAD USR/SRC/BIN/SH.S LOAD USR/SRC/BIN/SH.S

View File

@ -357,6 +357,7 @@ CORE.Lookup >STYA ZPPtr2
lda #E.SYN lda #E.SYN
sec sec
rts rts
.7 iny .7 iny
lda (ZPPtr2),y Get Src text char... lda (ZPPtr2),y Get Src text char...
beq .9 end of text beq .9 end of text

View File

@ -353,9 +353,12 @@ CS.RUN.BATCH >LDA.G bSET.X
lda (ZPInputBufPtr),y lda (ZPInputBufPtr),y
sta (ZPArgVBuf),y sta (ZPArgVBuf),y
beq .4 beq .4
eor #C.CR eor #C.CR
bne .3 bne .3
sta (ZPArgVBuf),y sta (ZPArgVBuf),y
.4 >PUSHW ZPArgVBuf .4 >PUSHW ZPArgVBuf
>PUSHBI 2 >PUSHBI 2
>LDYA L.MSG.TRACE >LDYA L.MSG.TRACE
@ -488,11 +491,12 @@ RemoveStrFromArgV
jsr StrCpyPtr1Ptr2 jsr StrCpyPtr1Ptr2
tya tya
beq .8 beq .8
jsr AddAp1Ptr2 jsr AddAp1Ptr2
bra .2 bra .2
.8 rts .8 rts
*-------------------------------------- *--------------------------------------
GetPtr1Next lda (ZPPtr1) GetPtr1NextChar lda (ZPPtr1)
beq IncPtr1.8 beq IncPtr1.8
IncPtr1 inc ZPPtr1 IncPtr1 inc ZPPtr1
@ -506,6 +510,9 @@ GetPtr1LenY ldy #$ff
bne .1 bne .1
rts rts
*-------------------------------------- *--------------------------------------
GetPtr1NextString
jsr GetPtr1LenY
*--------------------------------------
AddYp1Ptr1 tya AddYp1Ptr1 tya
AddAp1Ptr1 sec AddAp1Ptr1 sec
.HS 90 BCC .HS 90 BCC

View File

@ -16,7 +16,7 @@ GAP1 .EQ 48
GAP2 .EQ 6 GAP2 .EQ 6
GAP3 .EQ 27 GAP3 .EQ 27
*-------------------------------------- *--------------------------------------
Status.PrvDrvOff .EQ $80 Waiting old drive stop spining Status.PrvDrvOff .EQ $80 Waiting old drive stop spinning
Status.DrvOn .EQ $81 Waiting target drive spin Status.DrvOn .EQ $81 Waiting target drive spin
Status.seek .EQ $82 target drive seeking Status.seek .EQ $82 target drive seeking
*-------------------------------------- *--------------------------------------
@ -304,7 +304,7 @@ D2TrkRNIB
*\-------------------------------------- *\--------------------------------------
D2TrkR16s D2TrkR16s
*/-------------------------------------- */--------------------------------------
* # TrkW16s * # D2TrkW16s
* Write a track (16 sectors) * Write a track (16 sectors)
* **In:** * **In:**
* PUSHW = Ptr to 16*256 buffer * PUSHW = Ptr to 16*256 buffer
@ -315,12 +315,14 @@ D2TrkR16s
* CS : A = Error * CS : A = Error
* A=0, currently starting/seeking... * A=0, currently starting/seeking...
*\-------------------------------------- *\--------------------------------------
D2TrkW16s D2TrkW16s >PULLB DrvSlt
>PULLB TrkNum
>PULLW ZPPtr1
clc clc
rts rts
*/-------------------------------------- */--------------------------------------
* # TrkWNIB * # D2TrkWNIB
* Write a track (NIBBLE) * Write a track (NIBBLE)
* **In:** * **In:**
* PUSHW = Ptr to NIBBLE buffer (0 ended) * PUSHW = Ptr to NIBBLE buffer (0 ended)
@ -337,21 +339,26 @@ D2TrkWNIB >PULLB DrvSlt
lda Status Lib is busy....? lda Status Lib is busy....?
beq .10 beq .10
lda DrvSlt lda DrvSlt
cmp DrvSltInUse resume previous access ? cmp DrvSltInUse resume previous access ?
.10 lda DEVNUM last drive accessed by ProDOS .10 lda DEVNUM last drive accessed by ProDOS
and #$F0 only DSSS and #$F0 only DSSS
pha pha
jsr CheckDiskII was it a DISK II ? jsr CheckDiskII was it a DISK II ?
bcs .1 no, no need to check if spinning bcs .1 no, no need to check if spinning
pla pla
pha pha
jsr DrvSpinCheck jsr DrvSpinCheck
bcc .1 not spinning....continue bcc .1 not spinning....continue
pla pla
sta D2DrvOff,x sta D2DrvOff,x
lda #Status.PrvDrvOff lda #Status.PrvDrvOff
jmp SetStatusAndExit jmp SetStatusAndExit
.1 pla .1 pla
cmp DrvSlt cmp DrvSlt
* beq * beq
@ -362,7 +369,6 @@ D2TrkWNIB >PULLB DrvSlt
clc clc
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
SetStatusAndExit SetStatusAndExit
sta Status sta Status
@ -445,7 +451,7 @@ TrkWriter.Start lda D2ReadMode,x
ldy #0 ldy #0
.1 lda (ZPPtr1),y (5) as NibbleBuf is page alligned, no page crossing .1 lda (ZPPtr1),y (5) as NibbleBuf is page aligned, no page crossing
beq .8 (2)(3 if Z) END OF TRACK beq .8 (2)(3 if Z) END OF TRACK
* nobody will never try to write 00000000, right? * nobody will never try to write 00000000, right?
cmp #$80 (2) if CC, it is a sync byte cmp #$80 (2) if CC, it is a sync byte
@ -486,9 +492,11 @@ TrkWriter.Start lda D2ReadMode,x
plp plp
clc clc
rts rts
.9 lda #$2B Write Protected .9 lda #$2B Write Protected
sec sec
rts rts
TrkWriter.Size .EQ *-TrkWriter.Start TrkWriter.Size .EQ *-TrkWriter.Start
.EP .EP
*-------------------------------------- *--------------------------------------

View File

@ -413,12 +413,14 @@ LDR.ClkDevScan php
.9 lda DS1216E.DATA1,x .9 lda DS1216E.DATA1,x
cmp DS1216E.DATA2,x cmp DS1216E.DATA2,x
bne LDR.ClkDevTCLK bne .90
dex dex
bpl .9 bpl .9
bra LDR.ClkDevTCLK
lda #'N' .90 lda #'N'
ldx PAKME.NCLK ldx PAKME.NCLK
ldy PAKME.NCLK+1 ldy PAKME.NCLK+1
bra LDR.SetupCLK bra LDR.SetupCLK