diff --git a/BIN/EDIT.S.BUF.txt b/BIN/EDIT.S.BUF.txt index df4da618..df8eaf98 100644 --- a/BIN/EDIT.S.BUF.txt +++ b/BIN/EDIT.S.BUF.txt @@ -26,6 +26,58 @@ BUF.CheckSelected .9 sec rts *-------------------------------------- +BUF.InsertClipboard + ldy #FileLen + lda (pData),y + sec + ldy #ClipboardLen + adc (pData),y + pha + ldy #FileLen+1 + lda (pData),y + ldy #ClipboardLen+1 + adc (pData),y + ply + jsr BUF.GetNewYA + bcs .9 + + jsr BUF.ComputeCOffset + >LDYA BUF.COffset + >STYA TmpCount + + ldy #0 + + jsr BUF.CopyCount + phy + + + + clc + lda BufPtr + ldy #ClipboardLen + adc (pData),y + sta BufPtr + iny + lda BufPtr+1 + adc (pData),y + sta BufPtr+1 + + ply + jsr BUF.CopyTail + +.4 ldy #FileLen + lda (pData),y + inc + sta (pData),y + bne .8 + iny + lda (pData),y + inc + sta (pData),y + +.8 clc +.9 rts +*-------------------------------------- BUF.InsertA sta TmpByte jsr BUF.ComputeCOffset cpy #255 @@ -35,8 +87,8 @@ BUF.InsertA sta TmpByte .10 ldy #FileLen lda (pData),y - clc - adc #2 + sec + adc #1 pha iny lda (pData),y @@ -132,6 +184,66 @@ BUF.Del ldy #FileLen clc .9 rts *-------------------------------------- +BUF.SelToClipboard + ldy #SelEnd+1 + lda (pData),y + tax + dey + lda (pData),y + + sec + ldy #SelStart + sbc (pData),y + sta TmpCount + iny + txa + sbc (pData),y + bcc .8 + sta TmpCount+1 + ora TmpCount + beq .8 + + ldy #hClipBoard + lda (pData),y + beq .1 + + >SYSCALL SYS.FreeMemA + +.1 >PUSHW TmpCount + >PUSHB 0 + >SYSCALL SYS.GetMem + bcs .9 + + >STYA ClipboardPtr + txa + ldy #hClipBoard + sta (pData),y + + ldy #ClipBoardLen + lda TmpCount + sta (pData),y + iny + lda TmpCount+1 + sta (pData),y + + ldy #hBuffer + lda (pData),y + >SYSCALL SYS.GetMemPtrA + >STYA BufPtr + +.2 jsr DecTmpCount + beq .8 + lda (BufPtr),y + sta (ClipboardPtr),y + iny + bne .2 + inc BufPtr+1 + inc ClipboardPtr+1 + bra .2 + +.8 clc +.9 rts +*-------------------------------------- BUF.CopyCount jsr DecTmpCount beq .9 lda (BufPtrBackup),y diff --git a/BIN/EDIT.S.CTRL.txt b/BIN/EDIT.S.CTRL.txt index b52f8503..3e26c595 100644 --- a/BIN/EDIT.S.CTRL.txt +++ b/BIN/EDIT.S.CTRL.txt @@ -85,30 +85,8 @@ Ctrl.B jsr BUF.ComputeCOffset rts .9 jmp Ctrl.Q *-------------------------------------- -Ctrl.C ldy #SelEnd+1 - lda (pData),y - tax - dey - lda (pData),y - - sec - ldy #SelStart - sbc (pData),y - sta TmpLen - iny - txa - sbc (pData),y - bcs .8 - sta TmpLen+1 - - ldy #hClipBoard - lda (pData),y - beq .1 - - >SYSCALL SYS.FreeMemA - -.1 - +Ctrl.C jsr BUF.SelToClipboard + bcs .9 .8 clc rts .9 jmp Ctrl.Q @@ -404,9 +382,14 @@ Ctrl.FS ldy #FileY+1 rts .9 jmp Ctrl.Q *-------------------------------------- -Ctrl.V - clc +Ctrl.V jsr BUF.InsertClipboard + bcs .9 + jsr SCRN.UpdateMain + bcs .9 + jsr SCRN.UpdateStatusBar + bcs .9 rts +.9 jmp Ctrl.Q *-------------------------------------- Ctrl.W clc diff --git a/BIN/EDIT.S.txt b/BIN/EDIT.S.txt index bba361a9..a2c6452c 100644 --- a/BIN/EDIT.S.txt +++ b/BIN/EDIT.S.txt @@ -15,6 +15,7 @@ ZPPTR1 .EQ ZPBIN ZPPTR2 .EQ ZPBIN+2 BufPtr .EQ ZPBIN+4 BufPtrBackup .EQ ZPBIN+6 +ClipboardPtr .EQ ZPBIN+8 *-------------------------------------- PromptBufferMax .EQ 64 PromptModeHelp .EQ 2 @@ -527,8 +528,9 @@ hFind .BS 1 hReplace .BS 1 hBuffer .BS 1 hBufferBackup .BS 1 -hClipBoard .BS 1 FileLen .BS 2 +hClipBoard .BS 1 +ClipBoardLen .BS 2 ScreenW .BS 1 ScreenH .BS 1 ScreenX .BS 1