mirror of
https://github.com/A2osX/A2osX.git
synced 2024-09-10 07:54:37 +00:00
240 lines
3.7 KiB
Plaintext
240 lines
3.7 KiB
Plaintext
PR#3
|
||
PREFIX /A2OSX.SRC
|
||
NEW
|
||
INC 1
|
||
AUTO 6
|
||
.LIST OFF
|
||
*--------------------------------------
|
||
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
|
||
*--------------------------------------
|
||
BUF.InsertA sta TmpByte
|
||
jsr BUF.ComputeCOffset
|
||
cpy #255
|
||
bne .10
|
||
clc
|
||
rts
|
||
|
||
.10 ldy #FileLen
|
||
lda (pData),y
|
||
clc
|
||
adc #2
|
||
pha
|
||
iny
|
||
lda (pData),y
|
||
adc #0
|
||
ply
|
||
jsr BUF.GetNewYA
|
||
bcs .9
|
||
>STYA BufPtr
|
||
|
||
>LDYA BUF.COffset
|
||
>STYA TmpCount
|
||
|
||
ldy #hBufferBackup
|
||
lda (pData),y
|
||
>SYSCALL SYS.GetMemPtrA
|
||
>STYA BufPtrBackup
|
||
|
||
ldy #0
|
||
.1 jsr DecTmpCount
|
||
beq .2
|
||
lda (BufPtrBackup),y
|
||
sta (BufPtr),y
|
||
iny
|
||
bne .1
|
||
inc BufPtrBackup+1
|
||
inc BufPtr+1
|
||
bra .1
|
||
|
||
.2 lda TmpByte
|
||
sta (BufPtr),y
|
||
inc BufPtr
|
||
bne .3
|
||
inc BufPtr+1
|
||
|
||
.3 lda (BufPtrBackup),y
|
||
beq .4
|
||
sta (BufPtr),y
|
||
iny
|
||
bne .3
|
||
inc BufPtrBackup+1
|
||
inc BufPtr+1
|
||
bra .3
|
||
|
||
.4 ldy #FileLen
|
||
lda (pData),y
|
||
inc
|
||
sta (pData),y
|
||
bne .5
|
||
iny
|
||
lda (pData),y
|
||
inc
|
||
sta (pData),y
|
||
|
||
.5 clc
|
||
|
||
|
||
.9 rts
|
||
*--------------------------------------
|
||
* Out : Y = Line Length
|
||
*--------------------------------------
|
||
BUF.ComputeCOffset
|
||
ldy #FileY+1
|
||
lda (pData),y
|
||
tax
|
||
dey
|
||
lda (pData),y
|
||
jsr BUF.GetLineAX
|
||
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.GetCharAtY tya
|
||
clc
|
||
adc BUF.LOffset
|
||
sta BUF.COffset
|
||
lda #0
|
||
adc BUF.LOffset+1
|
||
sta BUF.COffset+1
|
||
|
||
lda (BufPtr),y
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
BUF.GetLineAX >STAX BUF.TmpLine1
|
||
|
||
stz BUF.LOffset
|
||
stz BUF.LOffset+1
|
||
|
||
ldy #hBuffer
|
||
lda (pData),y
|
||
>SYSCALL SYS.GetMemPtrA
|
||
>STYA BufPtr
|
||
|
||
lda (BufPtr)
|
||
beq .99
|
||
|
||
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
|
||
bne .99
|
||
lda BUF.TmpLine1+1
|
||
cmp BUF.TmpLine2+1
|
||
bne .99
|
||
|
||
.8 lda BUF.LOffset
|
||
sta BUF.COffset
|
||
lda BUF.LOffset+1
|
||
sta BUF.COffset+1
|
||
clc Y = Line length
|
||
rts
|
||
|
||
.99 sec
|
||
rts
|
||
*--------------------------------------
|
||
BUF.GetNewYA >STYA TmpLen
|
||
ldy #hBufferBackup
|
||
lda (pData),y
|
||
beq .1
|
||
>SYSCALL SYS.FreeMemA
|
||
ldy #hBufferBackup
|
||
lda #0
|
||
sta (pData),y
|
||
|
||
.1 >PUSHW TmpLen
|
||
>PUSHBI S.MEM.F.INIT0
|
||
>SYSCALL SYS.GetMem
|
||
bcs .9
|
||
|
||
phy
|
||
pha
|
||
|
||
ldy #hBuffer
|
||
lda (pData),y
|
||
ldy #hBufferBackup
|
||
sta (pData),y
|
||
|
||
txa
|
||
ldy #hBuffer
|
||
sta (pData),y
|
||
|
||
pla
|
||
ply
|
||
clc
|
||
rts
|
||
|
||
.9 sec
|
||
rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE BIN/EDIT.S.BUF
|
||
LOAD BIN/EDIT.S
|
||
ASM
|