diff --git a/.Floppies/A2OSX.BLANK.woz b/.Floppies/A2OSX.BLANK.woz index f4bf4cc0..3a156874 100644 Binary files a/.Floppies/A2OSX.BLANK.woz and b/.Floppies/A2OSX.BLANK.woz differ diff --git a/.Floppies/A2OSX.BOOT.woz b/.Floppies/A2OSX.BOOT.woz index ec2987ab..50c1d1a3 100644 Binary files a/.Floppies/A2OSX.BOOT.woz and b/.Floppies/A2OSX.BOOT.woz differ diff --git a/.Floppies/A2OSX.BUILD.po b/.Floppies/A2OSX.BUILD.po index dc5276ed..81fbe186 100644 Binary files a/.Floppies/A2OSX.BUILD.po and b/.Floppies/A2OSX.BUILD.po differ diff --git a/.Floppies/A2OSX.TEST.po b/.Floppies/A2OSX.TEST.po index f5000d60..621a5d03 100644 Binary files a/.Floppies/A2OSX.TEST.po and b/.Floppies/A2OSX.TEST.po differ diff --git a/BIN/FORMAT.S.txt b/BIN/FORMAT.S.txt index 033a1338..903a7872 100644 --- a/BIN/FORMAT.S.txt +++ b/BIN/FORMAT.S.txt @@ -195,7 +195,14 @@ CS.RUN.Format jsr CS.RUN.GetDevStatus >LDYA L.MSG.OK >SYSCALL PutS - lda #0 + + bit bVerify + bpl .8 + + jsr CS.RUN.LL.DISKII.V + bcs .9 + +.8 lda #0 sec rts @@ -322,6 +329,7 @@ CS.RUN.LL.DISKII bcs .9 stz CurTrack + stz CurQTrack lda TrkCnt sta Counter diff --git a/BIN/IRC.S.txt b/BIN/IRC.S.txt index 6fbbf941..0a85c326 100644 --- a/BIN/IRC.S.txt +++ b/BIN/IRC.S.txt @@ -11,9 +11,7 @@ NEW .INB inc/libtcpip.i *-------------------------------------- TIMEOUT.MAX .EQ 200 20 sec. -BUFSIZE .EQ 1024 -MSGSIZE .EQ 240 -USRSIZE .EQ 128 +MSGSIZE .EQ 1024 *-------------------------------------- * https://tools.ietf.org/html/rfc2812#section-3.3 *-------------------------------------- @@ -21,23 +19,27 @@ USRSIZE .EQ 128 .OR ZPBIN ZS.START ZPIPCfgPtr .BS 2 -ZPReqPtr .BS 2 -ZPReqLen .BS 2 -hReq .BS 1 + hSocket .BS 1 ZPUsrBufPtr .BS 2 hUsrBuf .BS 1 -ZPMsgBufPtr .BS 2 -hMsgBuf .BS 1 +ZPLineBufPtr .BS 2 +hLineBuf .BS 1 TextPtr .BS 1 TextLen .BS 1 bEscMode .BS 1 -ZPRepPtr .BS 2 +ZPMsgPtr .BS 2 +hMsg .BS 1 + +hReq .BS 1 +ZPReqPtr .BS 2 + hRep .BS 1 +ZPRepPtr .BS 2 TimeOut .BS 1 ZS.END @@ -72,9 +74,12 @@ L.MSG.HOSTOK .DA MSG.HOSTOK L.MSG.SKTKO .DA MSG.SKTKO L.MSG.SKTOK .DA MSG.SKTOK L.MSG.SKTERR .DA MSG.SKTERR +L.MSG.NICK .DA MSG.NICK L.MSG.USER .DA MSG.USER +L.MSG.JOIN .DA MSG.JOIN L.MSG.TOPBAR .DA MSG.TOPBAR L.MSG.STATUSBAR .DA MSG.STATUSBAR +L.IRC.NICK .DA IRC.NICK L.IRC.USER .DA IRC.USER L.IRC.JOIN .DA IRC.JOIN L.IRC.JOINKEY .DA IRC.JOINKEY @@ -96,20 +101,7 @@ CS.INIT >LDYA L.LIBTCPIP .9 rts *-------------------------------------- -CS.RUN jsr CS.RUN.GETBUF - bcs .99 - - jsr CS.RUN.SCRSETUP - bcs .99 - - jsr CS.RUN.PRINTMSG - - lda #0 - sec -.99 rts - - - >LIBCALL hLIBTCPIP,LIBTCPIP.GETCFG is TCPIP loaded ? +CS.RUN >LIBCALL hLIBTCPIP,LIBTCPIP.GETCFG is TCPIP loaded ? >STYA ZPIPCfgPtr lda (ZPIPCfgPtr) Configured ? bmi CS.RUN.IPOK @@ -185,7 +177,7 @@ CS.RUN.HOSTOK lda #2 >SYSCALL PrintF CS.RUN.OPENSKT >PUSHBI 0 no protocol - lda #S.SOCKET.T.SEQPKT + lda #S.SOCKET.T.STREAM >LIBCALL hLIBTCPIP,LIBTCPIP.Socket bcs .9 @@ -226,19 +218,31 @@ CS.RUN.OPENSKT >PUSHBI 0 no protocol >PUSHBI 0 >SYSCALL PrintF + jsr CS.RUN.GETBUF + bcs .99 + + jsr CS.RUN.NICK + bcs .99 + + >SLEEP + jsr CS.RUN.USER bcs .99 + >SLEEP + jsr CS.RUN.JOIN bcs .99 CS.RUN.LOOP >SLEEP + >PUSHW MSGSIZE + >PUSHW ZPMsgPtr lda hSocket - >LIBCALL hLIBTCPIP,LIBTCPIP.Recv + >SYSCALL fgets bcc .1 tay - beq .2 No Frame + beq .2 NO DATA bra .9 @@ -257,9 +261,7 @@ CS.RUN.LOOP >SLEEP bcs .9 jsr CS.RUN.CHARIN - bcs .9 - - jmp CS.RUN.LOOP + bcc CS.RUN.LOOP .9 CS.RUN.ERR php @@ -271,27 +273,24 @@ CS.RUN.ERR php plp rts *-------------------------------------- -CS.RUN.GETBUF >LDYAI BUFSIZE +CS.RUN.GETBUF >LDYAI MSGSIZE >SYSCALL GetMem bcs .9 - stx hRep - >STYA ZPRepPtr + stx hMsg + >STYA ZPMsgPtr - >LDYAI USRSIZE + >LDYAI 256 >SYSCALL GetMem bcs .9 stx hUsrBuf >STYA ZPUsrBufPtr - lda #0 - sta (ZPUsrBufPtr) - - >LDYAI MSGSIZE + >LDYAI 256 >SYSCALL GetMem bcs .9 - stx hMsgBuf - >STYA ZPMsgBufPtr + stx hLineBuf + >STYA ZPLineBufPtr .9 rts *-------------------------------------- CS.RUN.SCRSETUP >PUSHW L.SEQ.INIT @@ -301,17 +300,17 @@ CS.RUN.SCRSETUP >PUSHW L.SEQ.INIT jsr CS.RUN.TOPUPDATE bcs .9 - >DEBUG + jsr CS.RUN.STATUSPDATE bcs .9 - >DEBUG + jsr CS.RUN.TXTCLR - >DEBUG + .9 rts *-------------------------------------- CS.RUN.TOPUPDATE - >PUSHW ZPMsgBufPtr + >PUSHW ZPLineBufPtr >PUSHW L.MSG.TOPBAR >PUSHB #K.VER >PUSHB /K.VER @@ -332,7 +331,7 @@ CS.RUN.TOPUPDATE >SYSCALL SPrintF >PUSHW L.SEQ.BAR - >PUSHW ZPMsgBufPtr + >PUSHW ZPLineBufPtr >PUSHBI 2 >SYSCALL PrintF @@ -352,7 +351,7 @@ CS.RUN.PRINTMSG >PUSHW L.SEQ.PRINTMSG rts *-------------------------------------- CS.RUN.STATUSPDATE - >PUSHW ZPMsgBufPtr + >PUSHW ZPLineBufPtr >PUSHW L.MSG.STATUSBAR lda #4 @@ -363,7 +362,7 @@ CS.RUN.STATUSPDATE >SYSCALL SPrintF >PUSHW L.SEQ.BAR - >PUSHW ZPMsgBufPtr + >PUSHW ZPLineBufPtr >PUSHBI 2 >SYSCALL PrintF rts @@ -379,7 +378,62 @@ CS.RUN.TXTCLR lda #0 >SYSCALL PrintF rts *-------------------------------------- -CS.RUN.USER >PUSHW ZPRepPtr +CS.RUN.NICK >LDYA L.MSG.NICK + >SYSCALL PutS + + >PUSHW ZPMsgPtr + >PUSHW L.IRC.NICK + + lda #3 nickname + >SYSCALL ArgV + >PUSHYA + >PUSHBI 2 + >SYSCALL SPrintF + bcs .9 + + >PUSHW ZPMsgPtr + lda hSocket + >SYSCALL fputs + >DEBUG + bcs .9 + +.1 >SLEEP + + >PUSHW MSGSIZE + >PUSHW ZPMsgPtr + lda hSocket + >SYSCALL fgets + bcc .2 + tay + beq .1 No Data + +.9 rts + +.2 jsr CS.RUN.SKIPPFX + + ldx #$ff + dey + +.3 inx + iny + lda IRC.REP.NOIDENT,x + beq .8 + + cmp (ZPRepPtr),y + beq .3 + + jsr .8 + + bra .1 + +.8 +* clc + rts +*-------------------------------------- +CS.RUN.USER >LDYA L.MSG.USER + >SYSCALL PutS + + >PUSHW ZPMsgPtr >PUSHW L.IRC.USER lda #3 nickname @@ -392,29 +446,49 @@ CS.RUN.USER >PUSHW ZPRepPtr >SYSCALL SPrintF bcs .9 - jsr CS.RUN.SEND + >PUSHW ZPMsgPtr + lda hSocket + >SYSCALL fgets bcs .9 .1 >SLEEP + >PUSHW MSGSIZE + >PUSHW ZPMsgPtr lda hSocket - >LIBCALL hLIBTCPIP,LIBTCPIP.Recv + >SYSCALL fgets bcc .2 tay beq .1 No Frame - bra .9 - -.2 sta hReq - >SYSCALL GetMemPtr - >STYA ZPReqPtr - - - - clc .9 rts + +.2 jsr CS.RUN.SKIPPFX + + ldx #$ff + dey + +.3 inx + iny + lda IRC.REP.001,x + beq .8 + + cmp (ZPRepPtr),y + beq .3 + + jsr .8 + + bra .1 + +.8 lda hRep + >SYSCALL FreeMem +* clc + rts *-------------------------------------- -CS.RUN.JOIN >PUSHW ZPRepPtr +CS.RUN.JOIN >LDYA L.MSG.JOIN + >SYSCALL PutS + + >PUSHW ZPMsgPtr lda #5 key >SYSCALL ArgV @@ -430,7 +504,7 @@ CS.RUN.JOIN >PUSHW ZPRepPtr >SYSCALL ArgV >PUSHYA >PUSHBI 4 - bra .8 + bra .2 .1 >PUSHW L.IRC.JOIN @@ -439,27 +513,73 @@ CS.RUN.JOIN >PUSHW ZPRepPtr >PUSHYA >PUSHBI 2 -.8 >SYSCALL SPrintF +.2 >SYSCALL SPrintF bcs .9 - jmp CS.RUN.SEND + >PUSHW ZPMsgPtr + lda hSocket + >SYSCALL fputs + bcs .9 + +.3 >SLEEP + + >PUSHW ZPMsgPtr + lda hSocket + >SYSCALL fgets + bcc .4 + tay + beq .3 No Frame + .9 rts + +.4 + + + bra .8 + + + jsr CS.RUN.SKIPPFX + + ldx #$ff + dey + +.5 inx + iny + lda IRC.REP.JOIN,x + beq .8 + + cmp (ZPRepPtr),y + beq .5 + + jsr .8 + + bra .4 + +.8 lda hRep + >SYSCALL FreeMem +* clc + rts *-------------------------------------- -CS.RUN.REQ sta hReq - >SYSCALL GetMemPtr - >STYA ZPReqPtr - - - +CS.RUN.REQ clc rts *-------------------------------------- -CS.RUN.SEND >PUSHYA - >PUSHW ZPRepPtr - lda hSocket - >LIBCALL hLIBTCPIP,LIBTCPIP.Send - rts +CS.RUN.SKIPPFX ldy #S.TCP + + lda (ZPRepPtr),y + cmp #':' + bne .8 + +.1 iny + lda (ZPRepPtr),y + cmp #C.SPACE + bne .1 + + iny + +.8 clc + rts *-------------------------------------- CS.RUN.CHARIN bit bEscMode bpl .4 @@ -556,7 +676,7 @@ CS.QUIT lda hSocket >LIBCALL hLIBTCPIP,LIBTCPIP.Shutdown -.1 lda hReq +.1 lda hMsg beq .2 >SYSCALL FreeMem @@ -579,7 +699,9 @@ MSG.HOSTOK .AZ "Connecting to %d.%d.%d.%d:%D (%s)..." MSG.SKTKO .AZ "Failed to Open Socket." MSG.SKTOK .AZ "Connected\r\n(Exit key is Ctrl-T)\r\n" MSG.SKTERR .AZ "Socket Error : $%h\r\n" -MSG.USER .AZ "User interrupt." +MSG.NICK .AZ "Registering User..." +MSG.USER .AZ "Connecting User..." +MSG.JOIN .AZ "Joining Channel..." MSG.TOPBAR .AZ "A2osX IRC %d.%d %s:%s %s" MSG.STATUSBAR .AZ "\e[19;1H%s:%s" *-------------------------------------- @@ -588,12 +710,15 @@ EscChars.Cnt .EQ *-EscChars EscChars.Remap .DA #C.BS,#C.VT,#C.LF,#C.FS *-------------------------------------- IRC.MSG .AZ "PING" -IRC.NOIDENT .AZ "No Ident response" +IRC.REP.NOIDENT .AZ "NOTICE * :*** No Ident response" +IRC.REP.001 .AZ "001" +IRC.REP.JOIN .AZ "JOIN" *-------------------------------------- -IRC.USER .AZ "USER %s 0 * :%s" -IRC.JOIN .AZ "JOIN %s" -IRC.JOINKEY .AZ "JOIN %s %s" -IRC.PRIVMSG .AZ "PRIVMSG %s :%s" +IRC.NICK .AZ "NICK %s\r\n" +IRC.USER .AZ "USER %s 0 * :%s\r\n" +IRC.JOIN .AZ "JOIN %s\r\n" +IRC.JOINKEY .AZ "JOIN %s %s\r\n" +IRC.PRIVMSG .AZ "PRIVMSG %s :%s\r\n" *-------------------------------------- SEQ.INIT .AZ "\ec\e(B\e)0\e[?7l\e[2;19r" SEQ.BAR .AZ "\e7\e[7m\e[37;40m%80s\e[0m\e8" @@ -614,7 +739,7 @@ SA.REMOTE .DA #AF.INET S.SOCKADDR.AF .DUMMY .OR 0 DS.START -TextBuf .BS 240 +TxtBuf .BS 240 DS.END .ED *-------------------------------------- diff --git a/INC/IO.D2.I.txt b/INC/IO.D2.I.txt index 9b0fd0d2..52627e53 100644 --- a/INC/IO.D2.I.txt +++ b/INC/IO.D2.I.txt @@ -2,7 +2,7 @@ NEW AUTO 3,1 .LIST OFF *-------------------------------------- -IO.D2.SeekTime .EQ 200 +IO.D2.SeekTime .EQ 250 *-------------------------------------- IO.D2.Ph0Off .EQ $C080 IO.D2.Ph0On .EQ $C081 diff --git a/LIB/LIBBLKDEV.S.BB.txt b/LIB/LIBBLKDEV.S.BB.txt index 13475255..1849e002 100644 --- a/LIB/LIBBLKDEV.S.BB.txt +++ b/LIB/LIBBLKDEV.S.BB.txt @@ -1,6 +1,6 @@ NEW AUTO 3,1 - .LIST OFF + .LIST OFF *-------------------------------------- dcmd .EQ $42 disk command (=1 for read) unit .EQ $43 (16*slot)+(128*(drive-1)) @@ -30,7 +30,7 @@ BB.Hdr .EQ $54 BB.HdrTrk .EQ $55 BB.HdrVol .EQ $56 BB.Hdr96 .EQ $57 - + nbuf1 .EQ $300 dnib .EQ $2d6 @@ -53,9 +53,9 @@ xboot .DA #1 * inc * tax ldx #0 - + * inc lda #1 (read block 1) - + * jmp $f479 *-------------------------------------- BB.AppleII stx unit save unit number @@ -71,7 +71,7 @@ BB.AppleII stx unit save unit number sta dent+1 ldy #$ff look at last byte sty dent - + plp restore carry (if disk ii & sect 0&2 read) iny make y=0 @@ -90,19 +90,19 @@ BB.AppleII stx unit save unit number pha rts go read sector 2 into $900 *-------------------------------------- -isdsk2 sta BB.HdrTrk A=0, make sure previous track =0 - sta dent and dent points at beginning of slot +isdsk2 sta BB.HdrTrk A=0, make sure previous track =0 + sta dent and dent points at beginning of slot - ldy #$63 move code from card to ram + ldy #$63 move code from card to ram -mvboot lda (dent),y +mvboot lda (dent),y sta zzstart-$5e,y - iny - cpy #$eb have we moved enough? + iny + cpy #$eb have we moved enough? bne mvboot - + ldx #mods.cnt now modify code to handle errors. - + modboot ldy mods-1,x lda chgs-1,x sta zzstart,y @@ -115,289 +115,293 @@ modboot ldy mods-1,x .1 dex bne modboot - + lda #BB.Hdr sta BB.HdrPtr stx BB.HdrPtr+1 X=0 - - lda /BB.ReadBlock reset device entry - sta dent+1 to point at disk ii routines. - lda #BB.ReadBlock get low addr (must be <$80) -*-------------------------------------- -ndsk2 ldy #0 make sure y=0 again. - cmp #$f9 - bcs bterr1 branch if not bootable device. - sta dent save low adr of device call entry. - sty iobuff - sty idxl + lda /BB.ReadBlock reset device entry + sta dent+1 to point at disk ii routines. + lda #BB.ReadBlock get low addr (must be <$80) +*-------------------------------------- +ndsk2 ldy #0 make sure y=0 again. + cmp #$f9 + bcs bterr1 branch if not bootable device. + + sta dent save low adr of device call entry. + sty iobuff + sty idxl sty idxh y=0 - sty idxp - sty blok+1 - iny - sty dcmd set read command. - iny - sty blok to read directory blocks - lda #$c 2-5 at $c00 - sta iobuff+1 - sta idxl+1 + sty idxp + sty blok+1 + iny + sty dcmd set read command. + iny + sty blok to read directory blocks + lda #$c 2-5 at $c00 + sta iobuff+1 + sta idxl+1 -rddir jsr goread call read block routine. - bcs bterr2 give up on error. +rddir jsr goread call read block routine. + bcs bterr2 give up on error. - inc iobuff+1 - inc iobuff+1 - inc blok - lda blok have all directory blocks been read? - cmp #6 - bcc rddir loop if not. + inc iobuff+1 + inc iobuff+1 + inc blok + lda blok have all directory blocks been read? + cmp #6 + bcc rddir loop if not. - lda sosid is it a prodos (sos) directory? - ora sosid+1 -bterr1 bne booterr branch if not. + lda sosid is it a prodos (sos) directory? + ora sosid+1 +bterr1 bne booterr branch if not. *-------------------------------------- - lda #4 begin look-up with first entry past header. -* bne nxdent1 branch always + lda #4 begin look-up with first entry past header. +* bne nxdent1 branch always .HS 2C BIT ABS -nxdent lda idxl +nxdent lda idxl -nxdent1 clc - adc entlen bump to next directory entry. - tay save in y for now. - bcc nxdent2 branch if not a page cross. +nxdent1 clc + adc entlen bump to next directory entry. + tay save in y for now. + bcc nxdent2 branch if not a page cross. - inc idxl+1 - lda idxl+1 check for new block. - lsr if even then new block. - bcs nxdent2 - - cmp #$a have all file names been compared? + inc idxl+1 + lda idxl+1 check for new block. + lsr if even then new block. + bcs nxdent2 + + cmp #$a have all file names been compared? beq booterr branch if no pro.kernel. - - ldy #4 else, begin at block beginning. - + + ldy #4 else, begin at block beginning. + nxdent2 sty idxl ldy #6 - -lookpro lda (idxl),y look for matching name. - cmp BB.ProDOS,y - bne nxdent branch if no match. - + +lookpro lda (idxl),y look for matching name. + cmp BB.ProDOS,y + bne nxdent branch if no match. + dey bpl lookpro - -* ldy #$10 get file type & index block addr. -* lda (idxl),y -* cmp #S.FI.T.SYS is it a system file? -* bne booterr -* iny + +* ldy #$10 get file type & index block addr. +* lda (idxl),y +* cmp #S.FI.T.SYS is it a system file? +* bne booterr +* iny ldy #$11 - lda (idxl),y - sta blok - iny - lda (idxl),y - sta blok+1 + lda (idxl),y + sta blok + iny + lda (idxl),y + sta blok+1 - lda #0 now set up to read kernel. - sta idxl + lda #0 now set up to read kernel. + sta idxl - ldy #$1e read index block at $1e00 and - sty idxl+1 kernel at $2000 - sty iobuff+1 - iny - sty idxh+1 + ldy #$1e read index block at $1e00 and + sty idxl+1 kernel at $2000 + sty iobuff+1 + iny + sty idxh+1 -rdkernl jsr goread read index block. -bterr2 bcs booterr +rdkernl jsr goread read index block. +bterr2 bcs booterr - inc iobuff+1 - inc iobuff+1 + inc iobuff+1 + inc iobuff+1 - ldy idxp get index pointer - inc idxp bump for next time. - lda (idxl),y - sta blok - lda (idxh),y high disk addr. - sta blok+1 - ora (idxl),y if both=0 then done. - bne rdkernl branch if more to read. + ldy idxp get index pointer + inc idxp bump for next time. + lda (idxl),y + sta blok + lda (idxh),y high disk addr. + sta blok+1 + ora (idxl),y if both=0 then done. + bne rdkernl branch if more to read. - jmp kernel go execute kernel code. + jmp kernel go execute kernel code. *-------------------------------------- -booterr +booterr * jsr clrscrn clear video * ldy #BB.MSG.ERR.Len-1 *.1 lda BB.MSG.ERR,y -* sta scrn,y -* dey +* sta scrn,y +* dey * bpl .1 - + jmp $ff69 *-------------------------------------- -goread lda iobuff - sta buff - lda iobuff+1 - sta buff+1 - jmp (dent) +goread lda iobuff + sta buff + lda iobuff+1 + sta buff+1 + jmp (dent) *-------------------------------------- mods .DA #mod1,#mod2,#mod3,#mod4,#mod5,#mod6,#mod7,#mod8,#mod8+1,#mod9 mods.cnt .EQ *-mods chgs .DA #chg1,#chg2,#chg3,#chg4,#chg5,#chg6,#chg7,#$91,#BB.HdrPtr,#BB.HdrTrk -endcode ldx BB.Slotn0 - clc - rts +endcode ldx BB.Slotn0 + clc + rts - jmp BB.Seek + jmp BB.Seek *-------------------------------------- *BB.MSG.ERR .AS -"ERR" *BB.MSG.ERR.Len .EQ *-BB.MSG.ERR BB.ProDOS .DA #$26 $20 = storage type + 6 = "PRODOS" len .AS "PRODOS" *-------------------------------------- -BB.ReadBlock lda blok figure out track & sector. - and #7 strip track for now. - cmp #4 - and #3 - php +BB.ReadBlock lda blok figure out track & sector. + and #7 strip track for now. + cmp #4 + and #3 + php asl - plp - rol now we have the first sector of block. - sta sector + plp + rol now we have the first sector of block. + sta sector - lda blok+1 get high block # - lsr shift hi addr to carry. - lda blok now figure track # - ror - lsr - lsr + lda blok+1 get high block # + lsr shift hi addr to carry. + lda blok now figure track # + ror + lsr + lsr sta BB.TargetTrk - lda buff+1 + lda buff+1 sta dbuf+1 - - ldx BB.Slotn0 - lda IO.D2.DrvOn,x + + ldx BB.Slotn0 + lda IO.D2.DrvOn,x lda IO.D2.Ph0Off,x - jsr BB.Seek go read sector. + jsr BB.Seek go read sector. - inc dbuf+1 bump address - inc sector - inc sector and sector # - bcs .9 branch if error. + inc dbuf+1 bump address + inc sector + inc sector and sector # + bcs .9 branch if error. jsr BB.Seek - -.9 ldy IO.D2.DrvOff,x - rts return error status in carry. + +.9 ldy IO.D2.DrvOff,x + rts return error status in carry. *-------------------------------------- BB.Seek lda BB.HdrTrk get track we're on jsr BB.Trk2Qtrk - sta BB.CurrentQTrack - + sta BB.CurrentQTrack + lda BB.TargetTrk jsr BB.Trk2Qtrk sta BB.TargetQTrack ldy #0 - + .1 lda BB.TargetQTrack sec sbc BB.CurrentQTrack beq .8 - + bcc .2 * Current < Target, must move in cmp #2 - bcc .6 one QT remaining + bcc .5 one QT remaining lda BB.CurrentQTrack - and #$FE from QT1 or QT3 inc inc - bra .4 + bra .3 * Current > Target, must move out .2 cmp #$FF - bcs .60 one QT remaining - + bcs .6 one QT remaining + lda BB.CurrentQTrack - and #$FE from QT1 or QT3 - - dec dec -.4 sta BB.CurrentQTrack +.3 and #$FE + + sta BB.CurrentQTrack and #6 ora BB.Slotn0 tax - pha tya - beq .5 - + beq .4 + lda IO.D2.Ph0Off,y -.5 lda IO.D2.Ph0On,x - ply - - jsr BB.Wait25600usec + + jsr BB.WaitSeekTime + +.4 lda IO.D2.Ph0On,x + txa + tay + + + jsr BB.WaitSeekTime bra .1 * Last QTrack -.6 tya +.5 tya inc inc - and #$f6 - tax - lda IO.D2.Ph0On,x bra .7 - -.60 tya - tax + +.6 tya + * sec adc #5 - - and #$f6 - tay - lda IO.D2.Ph0On,y -.7 jsr BB.Wait25600usec - +.7 and #$f6 + tax + + + jsr BB.WaitSeekTime lda IO.D2.Ph0On,x + + lda IO.D2.Ph0On,x + + + jsr BB.WaitSeekTime + .80 jsr BB.Wait25600usec - + lda IO.D2.Ph0Off,y lda IO.D2.Ph0Off,x bra BB.Read - + .8 tya beq BB.Read - + tax bra .80 *-------------------------------------- -BB.WaitPh lda #IO.D2.SeekTime +BB.WaitSeekTime lda #IO.D2.SeekTime .HS 2C BIT ABS BB.Wait25600usec lda #0 phx .1 ldx #19 (2) -.2 dex (2) delay 86 usec. +.2 dex (2) delay 86 usec. bne .2 (2+) 2 + 5x16 + 2 + 2 - -* ldx BB.Slotn0 (3) -* bit IO.D2.DrvOn,x (4) Slow down ACC boards + + ldx BB.Slotn0 (3) + bit IO.D2.DrvOn,x (4) Slow down ACC boards sec (6) sbc #1 (2) @@ -410,165 +414,165 @@ BB.Trk2Qtrk asl x2 bit BB.HdrVol bpl .1 x4 - + lsr x3 - + .1 adc #$ff SELF MODIFIED BB.Trk2Qtrk.RTS rts *-------------------------------------- BB.Read ldx BB.Slotn0 - ldy #$7f allow 127 mistakes. - sty BB.RetryCnt - php + ldy #$7f allow 127 mistakes. + sty BB.RetryCnt + php -tryread plp fix stack. +tryread plp fix stack. -rdhead sec anticipate error. - dec BB.RetryCnt if = 0 then give up! - beq BB.Trk2Qtrk.RTS branch if can't fine/read sector. +rdhead sec anticipate error. + dec BB.RetryCnt if = 0 then give up! + beq BB.Trk2Qtrk.RTS branch if can't fine/read sector. - clc indicate reading header. -rddata php carry set if reading sector. + clc indicate reading header. +rddata php carry set if reading sector. -rd0 dey every time y=0 decrement find count. - beq tryread +rd0 dey every time y=0 decrement find count. + beq tryread *-------------------------------------- -* from zzstart to zzend code is moved from rom and modified to match this code... +* from zzstart to zzend code is moved from rom and modified to match this code... *-------------------------------------- zzstart .EQ * -rd1 lda IO.D2.RData,x read a byte from the state machine. +rd1 lda IO.D2.RData,x read a byte from the state machine. bpl rd1 loop until ready. - + .DUMMY -rd1a eor #$d5 mark 1? -mod1 .EQ *-zzstart+1 - bne rd0 branch if not. +rd1a eor #$d5 mark 1? +mod1 .EQ *-zzstart+1 + bne rd0 branch if not. -chg1 .EQ rd0-* -rd2 lda IO.D2.RData,x - bpl rd2 - - cmp #$aa mark 2? - bne rd1a - nop waste a little time. +chg1 .EQ rd0-* +rd2 lda IO.D2.RData,x + bpl rd2 -rd3 lda IO.D2.RData,x - bpl rd3 - - cmp #$96 header mark 3? - beq rdhd1 branch if it is. - - plp were we looking for data mark 3? -mod2 .EQ *-zzstart+1 - bcc rdhead branch if not. + cmp #$aa mark 2? + bne rd1a + nop waste a little time. -chg2 .EQ rdhead-* - eor #$ad data mark 3? - beq rddt1 go read data field if true... - -mod3 .EQ *-zzstart+1 -rdhd0 bne rdhead otherwise, start over. +rd3 lda IO.D2.RData,x + bpl rd3 + + cmp #$96 header mark 3? + beq rdhd1 branch if it is. + + plp were we looking for data mark 3? +mod2 .EQ *-zzstart+1 + bcc rdhead branch if not. + +chg2 .EQ rdhead-* + eor #$ad data mark 3? + beq rddt1 go read data field if true... + +mod3 .EQ *-zzstart+1 +rdhd0 bne rdhead otherwise, start over. chg3 .EQ rdhead-* - -rdhd1 ldy #3 read in trk,sect,&volume #. + +rdhd1 ldy #3 read in trk,sect,&volume #. mod8 .EQ *-zzstart rdhd2 sta (BB.HdrPtr),y save last result in .. , BB.HdrTrk , BB.HdrVol , .. rdhd3 lda IO.D2.RData,x - bpl rdhd3 + bpl rdhd3 rol - sta oddbits save odd bits (7,5,3,1) + sta oddbits save odd bits (7,5,3,1) rdhd4 lda IO.D2.RData,x - bpl rdhd4 + bpl rdhd4 - and oddbits combine even and odd to form value. - dey - bne rdhd2 read in next pair. + and oddbits combine even and odd to form value. + dey + bne rdhd2 read in next pair. - plp - cmp sector last byte formed is sector# + plp + cmp sector last byte formed is sector# -mod4 .EQ *-zzstart+1 - bne rdhead branch if target sector not found. +mod4 .EQ *-zzstart+1 + bne rdhead branch if target sector not found. -chg4 .EQ rdhead-* +chg4 .EQ rdhead-* mod9 .EQ *-zzstart+1 - lda BB.HdrTrk previous result is track # - cmp BB.TargetTrk is desired track found? + lda BB.HdrTrk previous result is track # + cmp BB.TargetTrk is desired track found? -mod5 .EQ *-zzstart+1 - bne goseek re-seek if mismatch. +mod5 .EQ *-zzstart+1 + bne goseek re-seek if mismatch. -chg5a .EQ * -mod6 .EQ *-zzstart+1 - bcs rddata branch if proper track always. -chg6 .EQ rddata-* +chg5a .EQ * +mod6 .EQ *-zzstart+1 + bcs rddata branch if proper track always. +chg6 .EQ rddata-* *-------------------------------------- -rddt1 ldy #$56 read 2 bit groupings first. -rddt1a sty oddbits +rddt1 ldy #$56 read 2 bit groupings first. +rddt1a sty oddbits -rddt2 ldy IO.D2.RData,x - bpl rddt2 +rddt2 ldy IO.D2.RData,x + bpl rddt2 - eor dnib,y denibblize using table left from boot rom. - ldy oddbits save in nbuf1 - dey - sta nbuf1,y - bne rddt1a loop until all 86 groups are read. + eor dnib,y denibblize using table left from boot rom. + ldy oddbits save in nbuf1 + dey + sta nbuf1,y + bne rddt1a loop until all 86 groups are read. -rddt3 sty oddbits now count up for 6-bit groups. +rddt3 sty oddbits now count up for 6-bit groups. -rddt4 ldy IO.D2.RData,x - bpl rddt4 +rddt4 ldy IO.D2.RData,x + bpl rddt4 - eor dnib,y - ldy oddbits save result to specified buffer. - sta (dbuf),y - iny - bne rddt3 loop for 256 bytes. + eor dnib,y + ldy oddbits save result to specified buffer. + sta (dbuf),y + iny + bne rddt3 loop for 256 bytes. -rdchk ldy IO.D2.RData,x now verify checksum... - bpl rdchk +rdchk ldy IO.D2.RData,x now verify checksum... + bpl rdchk - eor dnib,y must be equal... -mod7 .EQ *-zzstart+1 - bne rdhd0 branch if error. + eor dnib,y must be equal... +mod7 .EQ *-zzstart+1 + bne rdhd0 branch if error. -chg7 .EQ rdhd0-* - ldy #0 make y=0 +chg7 .EQ rdhd0-* + ldy #0 make y=0 -nxttwo ldx #$56 now combine 2-bit group with 6 bit group +nxttwo ldx #$56 now combine 2-bit group with 6 bit group -twobit dex all done with this group? - bmi nxttwo branch if so. +twobit dex all done with this group? + bmi nxttwo branch if so. lda (dbuf),y - lsr nbuf1,x - rol - lsr nbuf1,x - rol + lsr nbuf1,x + rol + lsr nbuf1,x + rol sta (dbuf),y - iny - bne twobit + iny + bne twobit *-------------------------------------- zzzend ldx BB.Slotn0 - clc indicate good read. - rts + clc indicate good read. + rts chg5 .EQ *-chg5a goseek jmp BB.Seek .ED *-------------------------------------- .LIST ON -BB.End .EQ * +BB.End .EQ * BB.Free .EQ $a00-* .BS BB.Free .LIST OFF diff --git a/LIB/LIBBLKDEV.S.D2.txt b/LIB/LIBBLKDEV.S.D2.txt index 974081e1..61fde8b8 100644 --- a/LIB/LIBBLKDEV.S.D2.txt +++ b/LIB/LIBBLKDEV.S.D2.txt @@ -27,10 +27,23 @@ D2Recalibrate >PULLB DrvSlt ldx Slotn0 + lda IO.D2.DrvOn,x + + ldy #30 + +.10 jsr D2.Wait25600usec + dey + bne .10 + ldy #168 + ldx Slotn0 + .1 lda IO.D2.Ph0Off,x +* lda #IO.D2.SeekTime +* jsr D2.Wait100usecA + dey dey @@ -41,16 +54,12 @@ D2Recalibrate >PULLB DrvSlt tax lda IO.D2.Ph0On,x -* lda #IO.D2.SeekTime - lda #0 + lda #IO.D2.SeekTime jsr D2.Wait100usecA cpy #0 bne .1 - jsr D2.Wait25600usec - jsr D2.Wait25600usec - jsr D2.Wait25600usec jsr D2.Wait25600usec jsr D2.Wait25600usec @@ -59,15 +68,7 @@ D2Recalibrate >PULLB DrvSlt jsr D2.Wait25600usec jsr D2.Wait25600usec - jsr D2.Wait25600usec - jsr D2.Wait25600usec - jsr D2.Wait25600usec - jsr D2.Wait25600usec - jsr D2.Wait25600usec - jsr D2.Wait25600usec - jsr D2.Wait25600usec - jsr D2.Wait25600usec - + clc .9 rts */-------------------------------------- @@ -116,22 +117,19 @@ D2MoveHead.1 ldy #0 and #6 ora Slotn0 tax - pha tya beq .4 lda IO.D2.Ph0Off,y -* nop -* nop - -* lda #1 -* jsr D2.Wait100usecA + lda #IO.D2.SeekTime + jsr D2.Wait100usecA + .4 lda IO.D2.Ph0On,x - ply + txa + tay -* lda #IO.D2.SeekTime - lda #0 + lda #IO.D2.SeekTime jsr D2.Wait100usecA bra .1 @@ -140,36 +138,35 @@ D2MoveHead.1 ldy #0 .5 tya inc inc - and #$f6 - tax - lda IO.D2.Ph0On,x bra .7 .6 tya - tax + * sec adc #5 - and #$f6 - tay - lda IO.D2.Ph0On,y +.7 and #$f6 + tax -.7 -* lda #IO.D2.SeekTime - lda #0 + lda IO.D2.Ph0Off,y + + lda #IO.D2.SeekTime + jsr D2.Wait100usecA + + lda IO.D2.Ph0On,y + nop + nop + lda IO.D2.Ph0On,x + + lda #IO.D2.SeekTime jsr D2.Wait100usecA jsr D2.Wait25600usec lda IO.D2.Ph0Off,y -* nop -* nop -* lda #1 -* jsr D2.Wait100usecA - + nop + nop lda IO.D2.Ph0Off,x - - jsr D2.Wait25600usec rts .8 tya @@ -178,8 +175,6 @@ D2MoveHead.1 ldy #0 jsr D2.Wait25600usec lda IO.D2.Ph0Off,y - - jsr D2.Wait25600usec .9 rts *-------------------------------------- D2.Wait25600usec diff --git a/ProDOS.FX/ProDOS.S.XRW.txt b/ProDOS.FX/ProDOS.S.XRW.txt index b893e957..49cb1f3b 100644 --- a/ProDOS.FX/ProDOS.S.XRW.txt +++ b/ProDOS.FX/ProDOS.S.XRW.txt @@ -191,12 +191,12 @@ XRW.Recalibrate lda #MLI.E.IO anticipate a bad drive error. jsr XRW.Seek bra L5398 -L53BE lda XRW.AddrField.T - cmp XRW.ReqTrack +L53BE lda XRW.ReqTrack + cmp XRW.AddrField.T beq L53D5 jsr XRW.DEBUG - + >DEBUG ldy XRW.UnitIndex lda XRW.AddrField.V @@ -561,6 +561,9 @@ wnibl sta IO.D2.WLoad,x (5) nibl write * montimel, montimeh are incremented once per 100 usec interval * for motor on timing. *-------------------------------------- +XRW.Wait25600usec + lda #0 + XRW.Wait100usecA phx (3) @@ -740,13 +743,15 @@ XRW.Seek pha save target track jsr XRW.Trk2Qtrk sta XRW.TargetQTrack - jsr XRW.DEBUG2 + jsr XRW.DEBUG3 lda XRW.D2Trk-1,x jsr XRW.Trk2Qtrk sta XRW.CurrentQTrack + jsr XRW.DEBUG2 + pla sta XRW.D2Trk-1,x will be current track at the end @@ -784,72 +789,60 @@ XRW.Seek pha save target track and #6 ora A2L tax - pha tya beq .4 lda IO.D2.Ph0Off,y -* nop -* nop - -* lda #1 -* jsr XRW.Wait100usecA + + lda #IO.D2.SeekTime + jsr XRW.Wait100usecA .4 lda IO.D2.Ph0On,x - ply + txa + tay -* lda #IO.D2.SeekTime - lda #0 + lda #IO.D2.SeekTime jsr XRW.Wait100usecA bra .1 +* Last QTrack + .5 tya inc inc - and #$f6 - tax - lda IO.D2.Ph0On,x bra .7 .6 tya - tax + * sec adc #5 - and #$f6 - tay - lda IO.D2.Ph0On,y +.7 and #$f6 + tax -.7 -* lda #IO.D2.SeekTime - lda #0 +* lda IO.D2.Ph0Off,y + + lda #IO.D2.SeekTime + jsr XRW.Wait100usecA + +* lda IO.D2.Ph0On,y + lda IO.D2.Ph0On,x + + lda #IO.D2.SeekTime jsr XRW.Wait100usecA - lda #0 wait 25.6 ms - jsr XRW.Wait100usecA + jsr XRW.Wait25600usec lda IO.D2.Ph0Off,y -* nop -* nop -* lda #1 -* jsr XRW.Wait100usecA - lda IO.D2.Ph0Off,x - - lda #0 wait 25.6 ms - jsr XRW.Wait100usecA rts .8 tya beq .9 - lda #0 wait 25.6 ms - jsr XRW.Wait100usecA + jsr XRW.Wait25600usec lda IO.D2.Ph0Off,y - - lda #0 wait 25.6 ms - jsr XRW.Wait100usecA .9 rts *-------------------------------------- XRW.Trk2Qtrk asl x2 @@ -944,13 +937,16 @@ rderr sec *-------------------------------------- XRW.DEBUG phx - ldx #$1c + ldx #26 lda XRW.AddrField.V jsr XRW.DEBUG.PRINT lda XRW.AddrField.T jsr XRW.DEBUG.PRINT + lda XRW.AddrField.S + jsr XRW.DEBUG.PRINT + inx lda XRW.ReqTrack @@ -960,10 +956,12 @@ XRW.DEBUG phx rts XRW.DEBUG2 phx - pha - ldx #$26 - jsr XRW.DEBUG.PRINT - pla + ldx #36 + bra XRW.DEBUG31 + +XRW.DEBUG3 phx + ldx #38 +XRW.DEBUG31 jsr XRW.DEBUG.PRINT plx rts diff --git a/SYS/KERNEL.S.INIT.txt b/SYS/KERNEL.S.INIT.txt index 1fe5a179..eec1c8e6 100644 --- a/SYS/KERNEL.S.INIT.txt +++ b/SYS/KERNEL.S.INIT.txt @@ -470,6 +470,7 @@ CPU.Init.6502 >PUSHWI MSG.CPU sta ZPPtr1+1 Save VBLIRQ enable sta IO.IIC.ENVBL + lda IO.IIC.CLRVBLIRQ .11 bit VBL bpl .11 @@ -478,19 +479,15 @@ CPU.Init.6502 >PUSHWI MSG.CPU bpl .2 lda IO.IIC.CLRVBLIRQ yes, clear IRQ + lda #0 + bra .21 .2 lda VBL bmi .2 - ldx #2 - -.20 bit ZPPtr1 //c ? - bpl .3 - - lda IO.IIC.CLRVBLIRQ yes, clear IRQ - lda #0 wait for UP again - -.3 pha (3) +.21 ldx #2 A = LOW +*-------------------------------------- +.20 pha (3) pla (4) pha (3) pla (4) @@ -513,11 +510,17 @@ CPU.Init.6502 >PUSHWI MSG.CPU bra .6 (3) .6 eor VBL (4) - bpl .3 (2*) + bpl .20 (2*) - dex + bit ZPPtr1 //c ? + bpl .3 + + lda IO.IIC.CLRVBLIRQ yes, clear IRQ + lda #0 wait for UP again + +.3 dex bne .20 - +*-------------------------------------- bit ZPPtr1 //c ? bpl .60