A2osX/BIN/EDIT.S.BUF.txt

521 lines
8.2 KiB
Plaintext
Raw Normal View History

2016-01-04 07:25:43 +00:00
NEW
2018-11-17 17:17:13 +00:00
PREFIX
2017-12-22 21:24:30 +00:00
AUTO 4,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
2016-01-29 17:05:08 +00:00
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
>LDYA BUF.COffset
>STYA TmpCount
jsr BUF.CopyCount
ldy #ClipboardLen
2016-02-25 17:02:57 +00:00
lda (pData),y
sta TmpCount
2016-01-29 17:05:08 +00:00
iny
2016-02-25 17:02:57 +00:00
lda (pData),y
sta TmpCount+1
jsr BUF.CopyClipboard
2016-01-29 17:05:08 +00:00
jsr BUF.CopyTail
2016-02-25 17:02:57 +00:00
.4 ldy #ClipboardLen+1
2016-01-29 17:05:08 +00:00
lda (pData),y
2016-02-25 17:02:57 +00:00
tax
dey
2016-01-29 17:05:08 +00:00
lda (pData),y
2016-02-25 17:02:57 +00:00
clc
ldy #FileLen
adc (pData),y
sta (pData),y
iny
txa
adc (pData),y
2016-01-29 17:05:08 +00:00
sta (pData),y
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
.10 ldy #FileLen
lda (pData),y
2016-01-29 17:05:08 +00:00
sec
adc #1
2016-01-04 07:25:43 +00:00
pha
iny
lda (pData),y
adc #0
ply
jsr BUF.GetNewYA
bcs .9
>LDYA BUF.COffset
>STYA TmpCount
2016-01-28 17:03:51 +00:00
.1 jsr BUF.CopyCount
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
2018-11-15 15:04:14 +00:00
.4 >INCW.G FileLen
2016-01-09 22:33:47 +00:00
.8 clc
.9 rts
*--------------------------------------
2016-02-25 17:02:57 +00:00
BUF.DelSel jsr BUF.GetSelLen
bcs .8
>STYA SelLen
.10 jsr BUF.ComputeCOffset
ldy #SelStart
lda (pData),y
sta TmpCount
sec
sbc BUF.COffset
iny
lda (pData),y
sta TmpCount+1
sbc BUF.COffset+1
bcs .11
ldy #FileY
lda (pData),y
sec
sbc #1
sta (pData),y
iny
lda (pData),y
sbc #0
sta (pData),y
ldy #FileX
lda #0
sta (pData),y
bra .10
.11 ldy #FileLen
lda (pData),y
sec
sbc SelLen
pha
iny
lda (pData),y
sbc SelLen+1
ply
iny
bne .1
inc
.1 jsr BUF.GetNewYA
bcs .9
jsr BUF.CopyCount
lda BufPtrBackup
clc
adc SelLen
sta BufPtrBackup
lda BufPtrBackup+1
adc SelLen+1
sta BufPtrBackup+1
jsr BUF.CopyTail
ldy #FileLen
lda (pData),y
sec
sbc SelLen
sta (pData),y
ldy #FileLen+1
lda (pData),y
sbc SelLen+1
sta (pData),y
jsr BUF.ResetSel
.8 clc
.9 rts
*--------------------------------------
2016-01-09 22:33:47 +00:00
BUF.Del ldy #FileLen
lda (pData),y
iny
ora (pData),y
bne .10
2016-01-28 17:03:51 +00:00
clc exit with A=0
2016-01-09 22:33:47 +00:00
rts
2016-01-28 17:03:51 +00:00
2016-01-22 16:29:11 +00:00
.10 jsr BUF.ComputeCOffset
lda BUF.COffset
clc
2016-01-28 17:03:51 +00:00
ldy #FileLen
2016-01-22 16:29:11 +00:00
sbc (pData),y
2016-01-28 17:03:51 +00:00
lda BUF.COffset+1
2016-01-22 16:29:11 +00:00
iny
sbc (pData),y
2016-01-28 17:03:51 +00:00
bcc .11
lda #0 exit with A=0
clc
2016-01-22 16:29:11 +00:00
rts
2016-01-28 17:03:51 +00:00
2016-01-22 16:29:11 +00:00
.11 lda (pData),y
2016-01-09 22:33:47 +00:00
pha
dey
lda (pData),y
2016-01-22 16:29:11 +00:00
tay
pla
2016-01-09 22:33:47 +00:00
jsr BUF.GetNewYA
2016-01-28 17:03:51 +00:00
bcs .9
2016-01-09 22:33:47 +00:00
>LDYA BUF.COffset
>STYA TmpCount
2016-01-28 17:03:51 +00:00
jsr BUF.CopyCount
2016-01-09 22:33:47 +00:00
2016-02-25 17:02:57 +00:00
lda (BufPtrBackup)
2016-01-28 17:03:51 +00:00
tax Save deleted char for later
2016-01-22 16:29:11 +00:00
inc BufPtrBackup
2016-01-09 22:33:47 +00:00
bne .3
inc BufPtrBackup+1
2016-01-28 17:03:51 +00:00
.3 jsr BUF.CopyTail
2016-01-09 22:33:47 +00:00
2016-01-28 17:03:51 +00:00
ldy #FileLen
2016-01-09 22:33:47 +00:00
lda (pData),y
sec
sbc #1
sta (pData),y
iny
lda (pData),y
sbc #0
sta (pData),y
2016-02-25 17:02:57 +00:00
jsr BUF.ResetSel
2016-01-28 17:03:51 +00:00
txa Get back deleted char
2016-02-25 17:02:57 +00:00
2016-01-21 07:05:23 +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
>STYA TmpCount
2016-01-29 17:05:08 +00:00
ldy #hClipBoard
lda (pData),y
beq .1
2018-07-18 15:30:42 +00:00
>SYSCALL FreeMem
2016-01-29 17:05:08 +00:00
.1 >LDYA TmpCount
2018-07-18 15:30:42 +00:00
>SYSCALL GetMem
2016-01-29 17:05:08 +00:00
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
2018-07-18 15:30:42 +00:00
>SYSCALL GetMemPtr
2016-01-29 17:05:08 +00:00
>STYA BufPtr
2016-02-25 17:02:57 +00:00
lda BufPtr
clc
ldy #SelStart
adc (pData),y
sta BufPtr
lda BufPtr+1
iny
adc (pData),y
sta BufPtr+1
ldy #0
2016-01-29 17:05:08 +00:00
.2 jsr DecTmpCount
beq .8
lda (BufPtr),y
sta (ClipboardPtr),y
iny
bne .2
inc BufPtr+1
inc ClipboardPtr+1
bra .2
2016-02-25 17:02:57 +00:00
jsr BUF.ResetSel
2016-01-29 17:05:08 +00:00
.8 clc
.9 rts
*--------------------------------------
2016-02-25 17:02:57 +00:00
BUF.CopyClipboard
jsr DecTmpCount
beq .9
lda (ClipboardPtr)
sta (BufPtr)
inc ClipboardPtr
bne .1
inc ClipboardPtr+1
.1 inc BufPtr
bne BUF.CopyClipboard
inc BufPtr+1
bra BUF.CopyClipboard
.9 rts
*--------------------------------------
2016-01-28 17:03:51 +00:00
BUF.CopyCount jsr DecTmpCount
beq .9
2018-11-15 15:04:14 +00:00
2016-02-25 17:02:57 +00:00
lda (BufPtrBackup)
sta (BufPtr)
2018-11-15 15:04:14 +00:00
2016-02-25 17:02:57 +00:00
inc BufPtrBackup
bne .1
2016-01-28 17:03:51 +00:00
inc BufPtrBackup+1
2018-11-15 15:04:14 +00:00
2016-02-25 17:02:57 +00:00
.1 inc BufPtr
bne BUF.CopyCount
2016-01-28 17:03:51 +00:00
inc BufPtr+1
bra BUF.CopyCount
2018-11-15 15:04:14 +00:00
2016-01-28 17:03:51 +00:00
.9 rts
*--------------------------------------
2016-02-25 17:02:57 +00:00
BUF.CopyTail lda (BufPtrBackup)
sta (BufPtr)
2018-11-15 15:04:14 +00:00
beq .9
2016-02-25 17:02:57 +00:00
inc BufPtrBackup
bne .1
2016-01-28 17:03:51 +00:00
inc BufPtrBackup+1
2018-11-15 15:04:14 +00:00
2016-02-25 17:02:57 +00:00
.1 inc BufPtr
bne BUF.CopyTail
2016-01-28 17:03:51 +00:00
inc BufPtr+1
bra BUF.CopyTail
2018-11-15 15:04:14 +00:00
2016-01-28 17:03:51 +00:00
.9 rts
*--------------------------------------
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
cmp #13
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
*--------------------------------------
BUF.GetCharAtY tya
clc
adc BUF.LOffset
sta BUF.COffset
lda #0
adc BUF.LOffset+1
sta BUF.COffset+1
lda (BufPtr),y
clc
2016-01-04 07:25:43 +00:00
rts
*--------------------------------------
BUF.GetNewYA >STYA TmpLen
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
2016-01-04 07:25:43 +00:00
>LDYA TmpLen
2018-07-18 15:30:42 +00:00
>SYSCALL GetMem0
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
*--------------------------------------
2018-11-15 15:04:14 +00:00
BUF.ResetSel >STZW.G SelStart
>STZW.G SelEnd
2016-02-25 17:02:57 +00:00
rts
*--------------------------------------
BUF.CheckSelected
sec
lda BUF.COffset
ldy #SelStart
sbc (pData),y
lda BUF.COffset+1
iny
sbc (pData),y
bcc .9
lda BUF.COffset
ldy #SelEnd
sbc (pData),y
lda BUF.COffset+1
iny
sbc (pData),y
rts CC if in selection
.9 sec
rts
*--------------------------------------
* Out : CC if ok, YA=SelLen
*--------------------------------------
BUF.GetSelLen ldy #SelEnd
lda (pData),y
sec
ldy #SelStart
sbc (pData),y
tax
ldy #SelEnd+1
lda (pData),y
sec
ldy #SelStart+1
sbc (pData),y
bcc .9
phx
ply
bne .8
tax
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