diff --git a/BIN/EDIT.S.BUF.txt b/BIN/EDIT.S.BUF.txt index b4353602..1b60a902 100644 --- a/BIN/EDIT.S.BUF.txt +++ b/BIN/EDIT.S.BUF.txt @@ -32,13 +32,6 @@ BUF.InsertClipboard jsr BUF.CopyCount - ldy #ClipboardLen - lda (pData),y - sta TmpCount - iny - lda (pData),y - sta TmpCount+1 - jsr BUF.CopyClipboard jsr BUF.CopyTail @@ -177,45 +170,41 @@ BUF.Del ldy #FileLen lda (pData),y iny ora (pData),y - bne .10 - clc exit with A=0 - rts - -.10 jsr BUF.ComputeCOffset - lda BUF.COffset - clc - ldy #FileLen - sbc (pData),y - lda BUF.COffset+1 - iny - sbc (pData),y - bcc .11 - lda #0 exit with A=0 - clc - rts - -.11 lda (pData),y + beq .8 exit with A=0 + + jsr BUF.ComputeCOffset + + ldy #FileLen+1 + lda (pData),y pha dey lda (pData),y tay pla - jsr BUF.GetNewYA + jsr BUF.GetNewYA BufferLen-1 bcs .9 - >LDYA BUF.COffset - >STYA TmpCount + lda BUF.COffset + sec + sbc #1 + tay + lda BUF.COffset+1 + sbc #0 + bcc .3 deleting char #0 + sty TmpCount + sta TmpCount+1 + jsr BUF.CopyCount - lda (BufPtrBackup) - tax Save deleted char for later +.3 lda (BufPtrBackup) + pha Save deleted char for later inc BufPtrBackup - bne .3 + bne .4 inc BufPtrBackup+1 -.3 jsr BUF.CopyTail +.4 jsr BUF.CopyTail ldy #FileLen lda (pData),y @@ -228,9 +217,9 @@ BUF.Del ldy #FileLen sta (pData),y jsr BUF.ResetSel - txa Get back deleted char + pla Get back deleted char - clc +.8 clc .9 rts *-------------------------------------- BUF.SelToClipboard @@ -294,33 +283,57 @@ BUF.SelToClipboard .9 rts *-------------------------------------- BUF.CopyClipboard - jsr DecTmpCount + >LDA.G ClipboardLen+1 + eor #$ff + tax + + dey + lda (pData),y + eor #$ff + tax + +.1 iny + bne .2 + inx beq .9 - lda (ClipboardPtr) + +.2 lda (ClipboardPtr) sta (BufPtr) inc ClipboardPtr - bne .1 + bne .3 inc ClipboardPtr+1 -.1 inc BufPtr - bne BUF.CopyClipboard + +.3 inc BufPtr + bne .1 inc BufPtr+1 - bra BUF.CopyClipboard + bra .1 + .9 rts *-------------------------------------- -BUF.CopyCount jsr DecTmpCount +BUF.CopyCount lda TmpCount + eor #$ff + tay + + lda TmpCount+1 + eor #$ff + tax + +.1 iny + bne .2 + inx beq .9 - - lda (BufPtrBackup) + +.2 lda (BufPtrBackup) sta (BufPtr) inc BufPtrBackup - bne .1 + bne .3 inc BufPtrBackup+1 -.1 inc BufPtr - bne BUF.CopyCount +.3 inc BufPtr + bne .1 inc BufPtr+1 - bra BUF.CopyCount + bra .1 .9 rts *-------------------------------------- @@ -451,7 +464,7 @@ BUF.GetNewYA >STYA TmpLen >STYA BufPtrBackup >LDYA TmpLen - >SYSCALL GetMem0 + >SYSCALL GetMem bcs .9 >STYA BufPtr @@ -465,10 +478,9 @@ BUF.ResetSel >STZW.G SelStart rts *-------------------------------------- BUF.CheckSelected - sec lda BUF.COffset ldy #SelStart - sbc (pData),y + cmp (pData),y lda BUF.COffset+1 iny sbc (pData),y @@ -476,7 +488,7 @@ BUF.CheckSelected lda BUF.COffset ldy #SelEnd - sbc (pData),y + cmp (pData),y lda BUF.COffset+1 iny sbc (pData),y diff --git a/BIN/EDIT.S.CTRL.txt b/BIN/EDIT.S.CTRL.txt index 09b233e9..343cebce 100644 --- a/BIN/EDIT.S.CTRL.txt +++ b/BIN/EDIT.S.CTRL.txt @@ -374,8 +374,7 @@ Ctrl.S lda #PromptModeSave jsr SCRN.UpdateStatusBar bcs .9 - - clc + rts .9 jmp Ctrl.Q *-------------------------------------- @@ -471,6 +470,9 @@ Ctrl.D jsr BUF.DelSel jsr SCRN.UpdateMain bcs .9 jmp SCRN.UpdateStatusBar + bcs .9 + rts + .9 jmp Ctrl.Q Ctrl.X.RTS rts diff --git a/BIN/EDIT.S.txt b/BIN/EDIT.S.txt index 6b7a1c79..fd7e2711 100644 --- a/BIN/EDIT.S.txt +++ b/BIN/EDIT.S.txt @@ -22,6 +22,7 @@ hMem .BS 1 TmpByte .BS 1 TmpLen .BS 2 TmpCount .BS 2 + TmpIndex .BS 2 SelLen .BS 2 BUF.LOffset .BS 2 @@ -48,7 +49,7 @@ CS.START cld .DA #0 .DA CS.END-CS.START CS .DA DS.END-DS.START DS - .DA #16 SS + .DA #64 SS .DA #ZS.END-ZS.START Zero Page Size .DA 0 *--------------------------------------