A2osX/BIN/EDIT.S.BUF.txt

516 lines
7.5 KiB
Plaintext
Raw Normal View History

2016-01-04 07:25:43 +00:00
NEW
2019-05-27 06:01:59 +00:00
AUTO 3,1
2016-01-04 07:25:43 +00:00
.LIST OFF
*--------------------------------------
2016-02-25 17:02:57 +00:00
BUF.InsertClipboard
ldy #hClipBoard
lda (pData),y
beq .8
2016-01-04 07:25:43 +00:00
2018-07-18 15:30:42 +00:00
>SYSCALL GetMemPtr
2016-02-25 17:02:57 +00:00
>STYA ClipboardPtr
2016-01-04 07:25:43 +00:00
2016-02-25 17:02:57 +00:00
jsr BUF.ComputeCOffset
2019-05-27 15:37:31 +00:00
lda BufLen
2016-01-29 17:05:08 +00:00
sec
ldy #ClipboardLen
adc (pData),y
pha
2019-05-27 15:37:31 +00:00
lda BufLen+1
iny
2016-01-29 17:05:08 +00:00
adc (pData),y
2019-05-27 15:37:31 +00:00
2016-01-29 17:05:08 +00:00
ply
jsr BUF.GetNewYA
bcs .9
>LDYA BUF.COffset
2019-06-03 15:50:41 +00:00
jsr BUF.Start2YA
2016-01-29 17:05:08 +00:00
2016-02-25 17:02:57 +00:00
jsr BUF.CopyClipboard
2016-01-29 17:05:08 +00:00
jsr BUF.CopyTail
2019-05-27 15:37:31 +00:00
.4 ldy #ClipboardLen
2016-01-29 17:05:08 +00:00
lda (pData),y
2016-02-25 17:02:57 +00:00
clc
2019-05-27 15:37:31 +00:00
adc BufLen
2019-06-02 08:58:46 +00:00
sta BufLen
2019-05-27 15:37:31 +00:00
2016-02-25 17:02:57 +00:00
iny
2019-05-27 15:37:31 +00:00
lda (pData),y
adc BufLen+1
2019-06-02 08:58:46 +00:00
sta BufLen+1
2016-02-25 17:02:57 +00:00
2016-01-29 17:05:08 +00:00
.8 clc
.9 rts
*--------------------------------------
BUF.InsertA sta TmpByte
2016-01-04 07:25:43 +00:00
jsr BUF.ComputeCOffset
cpy #255
bne .10
clc
rts
2019-05-27 15:37:31 +00:00
.10 lda BufLen
clc
adc #2
2016-01-04 07:25:43 +00:00
pha
2019-05-27 15:37:31 +00:00
lda BufLen+1
2016-01-04 07:25:43 +00:00
adc #0
ply
jsr BUF.GetNewYA
bcs .9
>LDYA BUF.COffset
2019-06-03 15:50:41 +00:00
jsr BUF.Start2YA
2016-01-04 07:25:43 +00:00
.2 lda TmpByte
2016-02-25 17:02:57 +00:00
sta (BufPtr)
2016-01-04 07:25:43 +00:00
inc BufPtr
bne .3
inc BufPtr+1
2016-01-28 17:03:51 +00:00
.3 jsr BUF.CopyTail
2016-01-04 07:25:43 +00:00
2019-05-27 15:37:31 +00:00
.4 lda BufLen
clc
adc #1
sta BufLen
2019-06-03 15:50:41 +00:00
bcc .9
2019-05-27 15:37:31 +00:00
inc BufLen+1
2018-11-15 15:04:14 +00:00
2019-06-03 15:50:41 +00:00
clc
2016-01-09 22:33:47 +00:00
.9 rts
*--------------------------------------
2016-02-25 17:02:57 +00:00
BUF.DelSel jsr BUF.GetSelLen
bcs .8
2019-05-29 15:21:14 +00:00
lda BufLen
2016-02-25 17:02:57 +00:00
sec
sbc SelLen
2019-05-29 15:21:14 +00:00
tay
2019-05-27 15:37:31 +00:00
lda BufLen+1
2016-02-25 17:02:57 +00:00
sbc SelLen+1
2019-05-27 15:37:31 +00:00
2016-02-25 17:02:57 +00:00
iny
bne .1
inc
2019-05-27 15:37:31 +00:00
2016-02-25 17:02:57 +00:00
.1 jsr BUF.GetNewYA
bcs .9
2019-05-27 15:37:31 +00:00
>LDYA.G SelStart
2019-06-03 15:50:41 +00:00
jsr BUF.Start2YA
2016-02-25 17:02:57 +00:00
lda BufPtrBackup
clc
adc SelLen
sta BufPtrBackup
lda BufPtrBackup+1
adc SelLen+1
sta BufPtrBackup+1
jsr BUF.CopyTail
2019-05-27 15:37:31 +00:00
lda BufLen
2016-02-25 17:02:57 +00:00
sec
sbc SelLen
2019-05-27 15:37:31 +00:00
sta BufLen
lda BufLen+1
2016-02-25 17:02:57 +00:00
sbc SelLen+1
2019-05-27 15:37:31 +00:00
sta BufLen+1
2016-02-25 17:02:57 +00:00
jsr BUF.ResetSel
.8 clc
.9 rts
*--------------------------------------
2019-05-25 19:24:07 +00:00
* Erase char at CurXY
*--------------------------------------
2019-05-27 15:37:31 +00:00
BUF.DelCharAtCursor
>LDYA BufLen
2019-05-24 15:26:07 +00:00
jsr BUF.GetNewYA BufferLen-1
2016-01-28 17:03:51 +00:00
bcs .9
2019-05-24 15:26:07 +00:00
2019-05-27 15:37:31 +00:00
>LDYA BUF.COffset
2019-06-03 15:50:41 +00:00
jsr BUF.Start2YA
2016-01-09 22:33:47 +00:00
2019-05-24 15:26:07 +00:00
.3 lda (BufPtrBackup)
pha Save deleted char for later
2016-01-22 16:29:11 +00:00
inc BufPtrBackup
2019-05-24 15:26:07 +00:00
bne .4
2016-01-09 22:33:47 +00:00
inc BufPtrBackup+1
2019-05-24 15:26:07 +00:00
.4 jsr BUF.CopyTail
2016-01-09 22:33:47 +00:00
2019-05-27 15:37:31 +00:00
lda BufLen
bne .5
dec BufLen+1
.5 dec BufLen
2016-02-25 17:02:57 +00:00
jsr BUF.ResetSel
2019-05-24 15:26:07 +00:00
pla Get back deleted char
2019-05-27 15:37:31 +00:00
clc
2016-01-04 07:25:43 +00:00
.9 rts
*--------------------------------------
2016-01-29 17:05:08 +00:00
BUF.SelToClipboard
2016-02-25 17:02:57 +00:00
jsr BUF.GetSelLen
bcs .8
2016-01-29 17:05:08 +00:00
2019-05-27 15:37:31 +00:00
>LDA.G hClipBoard
2016-01-29 17:05:08 +00:00
beq .1
2018-07-18 15:30:42 +00:00
>SYSCALL FreeMem
2019-05-29 15:21:14 +00:00
>STZ.G hClipBoard
2016-01-29 17:05:08 +00:00
2019-05-27 15:37:31 +00:00
.1 >LDYA SelLen
2018-07-18 15:30:42 +00:00
>SYSCALL GetMem
2016-01-29 17:05:08 +00:00
bcs .9
>STYA ClipboardPtr
txa
2019-05-27 15:37:31 +00:00
>STA.G hClipBoard
2016-01-29 17:05:08 +00:00
ldy #hBuffer
lda (pData),y
2018-07-18 15:30:42 +00:00
>SYSCALL GetMemPtr
2016-01-29 17:05:08 +00:00
2019-05-27 15:37:31 +00:00
pha
tya
* clc
>ADC.G SelStart
2016-02-25 17:02:57 +00:00
sta BufPtr
2019-05-27 15:37:31 +00:00
pla
>ADC.G SelStart+1
2016-02-25 17:02:57 +00:00
sta BufPtr+1
2019-05-27 15:37:31 +00:00
lda SelLen
2019-05-29 15:21:14 +00:00
ldy #ClipBoardLen
2019-05-27 15:37:31 +00:00
sta (pData),y
eor #$ff
tax
iny
2019-05-29 15:21:14 +00:00
lda SelLen+1
2019-05-27 15:37:31 +00:00
sta (pData),y
eor #$ff
pha
2016-02-25 17:02:57 +00:00
ldy #0
2019-05-27 15:37:31 +00:00
.2 inx
bne .3
2019-05-29 15:21:14 +00:00
2019-05-27 15:37:31 +00:00
pla
inc
2019-05-29 15:21:14 +00:00
beq .8
2019-05-27 15:37:31 +00:00
pha
.3 lda (BufPtr),y
2016-01-29 17:05:08 +00:00
sta (ClipboardPtr),y
iny
bne .2
2019-05-27 15:37:31 +00:00
2016-01-29 17:05:08 +00:00
inc BufPtr+1
inc ClipboardPtr+1
bra .2
2016-02-25 17:02:57 +00:00
2016-01-29 17:05:08 +00:00
.8 clc
.9 rts
*--------------------------------------
2016-02-25 17:02:57 +00:00
BUF.CopyClipboard
2019-05-27 15:37:31 +00:00
>LDA.G ClipboardLen
2019-05-24 15:26:07 +00:00
eor #$ff
tax
2019-05-27 15:37:31 +00:00
iny
2019-05-24 15:26:07 +00:00
lda (pData),y
eor #$ff
2019-05-27 15:37:31 +00:00
pha
2019-05-24 15:26:07 +00:00
2019-05-27 15:37:31 +00:00
ldy #0
.1 inx
2019-05-24 15:26:07 +00:00
bne .2
2019-05-27 15:37:31 +00:00
pla
inc
beq .3
pha
2019-05-24 15:26:07 +00:00
2019-05-27 15:37:31 +00:00
.2 lda (ClipboardPtr),y
sta (BufPtr),y
iny
2019-05-24 15:26:07 +00:00
bne .1
2019-05-27 15:37:31 +00:00
inc ClipboardPtr+1
2016-02-25 17:02:57 +00:00
inc BufPtr+1
2019-05-24 15:26:07 +00:00
bra .1
2019-05-27 15:37:31 +00:00
.3 tya
clc
adc ClipboardPtr
sta ClipboardPtr
2019-06-03 15:50:41 +00:00
bcc BUF.CopyAddY
2019-05-27 15:37:31 +00:00
inc ClipboardPtr+1
2019-06-03 15:50:41 +00:00
BUF.CopyAddY tya
2019-05-27 15:37:31 +00:00
clc
adc BufPtr
sta BufPtr
2019-06-03 15:50:41 +00:00
bcc .2
2019-05-27 15:37:31 +00:00
inc BufPtr+1
2019-06-03 15:50:41 +00:00
.2 rts
2016-02-25 17:02:57 +00:00
*--------------------------------------
2019-06-03 15:50:41 +00:00
BUF.Start2YA eor #$ff
2019-05-27 15:37:31 +00:00
pha
2019-05-24 15:26:07 +00:00
2019-05-27 15:37:31 +00:00
tya
2019-05-24 15:26:07 +00:00
eor #$ff
tax
2019-05-27 15:37:31 +00:00
ldy #0
.1 inx
2019-05-24 15:26:07 +00:00
bne .2
2019-05-27 15:37:31 +00:00
pla
inc
beq .3
pha
.2 lda (BufPtrBackup),y
sta (BufPtr),y
iny
bne .1
2018-11-15 15:04:14 +00:00
2016-01-28 17:03:51 +00:00
inc BufPtrBackup+1
inc BufPtr+1
2019-05-24 15:26:07 +00:00
bra .1
2019-06-03 15:50:41 +00:00
2019-05-27 15:37:31 +00:00
.3 tya
clc
adc BufPtrBackup
sta BufPtrBackup
2019-06-03 15:50:41 +00:00
bcc BUF.CopyAddY
2019-05-27 15:37:31 +00:00
inc BufPtrBackup+1
2019-06-03 15:50:41 +00:00
bra BUF.CopyAddY
2016-01-28 17:03:51 +00:00
*--------------------------------------
2019-06-03 15:50:41 +00:00
BUF.CopyTail ldy #0
.1 lda (BufPtrBackup),y
sta (BufPtr),y
beq .8
2018-11-15 15:04:14 +00:00
2019-06-03 15:50:41 +00:00
iny
2016-02-25 17:02:57 +00:00
bne .1
2019-06-03 15:50:41 +00:00
2016-01-28 17:03:51 +00:00
inc BufPtrBackup+1
inc BufPtr+1
2019-06-03 15:50:41 +00:00
bra .1
2018-11-15 15:04:14 +00:00
2019-06-03 15:50:41 +00:00
.8 rts
2016-01-28 17:03:51 +00:00
*--------------------------------------
2016-01-04 07:25:43 +00:00
* Out : Y = Line Length
*--------------------------------------
BUF.ComputeCOffset
jsr BUF.GetLine
2016-01-04 07:25:43 +00:00
bcs .9
phy save line length
ldy #FileX
lda (pData),y
clc
adc BUF.LOffset
sta BUF.COffset
lda #0
adc BUF.LOffset+1
sta BUF.COffset+1
ply
clc
.9 rts
*--------------------------------------
BUF.GetLine ldy #FileY+1
lda (pData),y
tax
dey
lda (pData),y
BUF.GetLineAX sta BUF.TmpLine1
stx BUF.TmpLine1+1
2016-01-04 07:25:43 +00:00
stz BUF.LOffset
stz BUF.LOffset+1
ldy #hBuffer
lda (pData),y
2018-07-18 15:30:42 +00:00
>SYSCALL GetMemPtr
2016-01-04 07:25:43 +00:00
>STYA BufPtr
stz BUF.TmpLine2
stz BUF.TmpLine2+1
.1 ldy #0
.2 lda (BufPtr),y
beq .7
2019-05-25 19:24:07 +00:00
cmp #C.CR
2016-01-04 07:25:43 +00:00
beq .3
iny
bne .2
.3 lda BUF.TmpLine1
cmp BUF.TmpLine2
bne .4
lda BUF.TmpLine1+1
cmp BUF.TmpLine2+1
beq .8
.4 tya
sec
adc BufPtr
sta BufPtr
bcc .5
inc BufPtr+1
.5 tya
sec
adc BUF.LOffset
sta BUF.LOffset
bcc .6
inc BUF.LOffset+1
.6 inc BUF.TmpLine2
bne .1
inc BUF.TmpLine2+1
bra .1
.7 lda BUF.TmpLine1
cmp BUF.TmpLine2
2016-01-28 17:03:51 +00:00
bne .9
2016-01-04 07:25:43 +00:00
lda BUF.TmpLine1+1
cmp BUF.TmpLine2+1
2016-01-28 17:03:51 +00:00
bne .9
2016-01-04 07:25:43 +00:00
2016-01-28 17:03:51 +00:00
.8 clc Y = Line length
2016-01-04 07:25:43 +00:00
rts
2016-01-28 17:03:51 +00:00
.9 sec
rts
*--------------------------------------
2019-05-27 15:37:31 +00:00
BUF.GetNewYA phy
pha
2018-11-15 15:04:14 +00:00
>LDA.G hBufferBackup
2016-01-04 07:25:43 +00:00
beq .1
2018-11-15 15:04:14 +00:00
2018-07-18 15:30:42 +00:00
>SYSCALL FreeMem
2016-01-22 16:29:11 +00:00
2018-11-15 15:04:14 +00:00
.1 >LDA.G hBuffer
>STA.G hBufferBackup
2018-07-18 15:30:42 +00:00
>SYSCALL GetMemPtr
2016-01-22 16:29:11 +00:00
>STYA BufPtrBackup
2019-05-29 15:21:14 +00:00
>STZ.G hBuffer
2019-05-27 15:37:31 +00:00
pla
ply
2019-05-24 15:26:07 +00:00
>SYSCALL GetMem
2016-01-04 07:25:43 +00:00
bcs .9
2016-01-22 16:29:11 +00:00
>STYA BufPtr
2016-01-04 07:25:43 +00:00
txa
2018-11-15 15:04:14 +00:00
>STA.G hBuffer
2016-01-22 16:29:11 +00:00
.9 rts
2016-01-04 07:25:43 +00:00
*--------------------------------------
2019-05-29 15:21:14 +00:00
BUF.ResetSel lda #$ff
ldy #SelStart
2019-05-28 16:00:53 +00:00
2019-05-29 15:21:14 +00:00
sta (pData),y
2019-05-28 16:00:53 +00:00
iny
2019-05-29 15:21:14 +00:00
sta (pData),y
2019-05-28 16:00:53 +00:00
2019-05-29 15:21:14 +00:00
iny #SelEnd
inc
sta (pData),y
iny
sta (pData),y
2016-02-25 17:02:57 +00:00
rts
*--------------------------------------
BUF.CheckSelected
2019-05-28 16:00:53 +00:00
lda BUF.COffset
2019-05-29 15:21:14 +00:00
ldy #SelStart
2019-05-24 15:26:07 +00:00
cmp (pData),y
2019-05-28 16:00:53 +00:00
lda BUF.COffset+1
2019-05-29 15:21:14 +00:00
iny
2016-02-25 17:02:57 +00:00
sbc (pData),y
2019-05-29 15:21:14 +00:00
bcc .9 CC:COffset < SelStart
2016-02-25 17:02:57 +00:00
2019-05-28 16:00:53 +00:00
iny #SelEnd
2019-05-29 15:21:14 +00:00
lda (pData),y
clc
sbc BUF.COffset
2019-05-28 16:00:53 +00:00
2016-02-25 17:02:57 +00:00
iny
2019-05-29 15:21:14 +00:00
lda (pData),y
sbc BUF.COffset+1
* CC:SelEnd < COffset
.9 lda #0
ror $80 = selected
2016-02-25 17:02:57 +00:00
rts
*--------------------------------------
BUF.GetSelLen ldy #SelEnd
lda (pData),y
sec
ldy #SelStart
sbc (pData),y
2019-05-29 15:21:14 +00:00
sta SelLen
2016-02-25 17:02:57 +00:00
tax
ldy #SelEnd+1
lda (pData),y
2019-05-29 15:21:14 +00:00
2016-02-25 17:02:57 +00:00
ldy #SelStart+1
sbc (pData),y
2019-05-29 15:21:14 +00:00
sta SelLen+1
2016-02-25 17:02:57 +00:00
bcc .9
bne .8
2019-05-29 15:21:14 +00:00
txa
2016-02-25 17:02:57 +00:00
beq .9
.8 clc
rts
.9 sec
rts
*--------------------------------------
2016-01-04 07:25:43 +00:00
MAN
2019-02-01 16:32:29 +00:00
SAVE USR/SRC/BIN/EDIT.S.BUF
LOAD USR/SRC/BIN/EDIT.S
2016-01-04 07:25:43 +00:00
ASM