DEL bug Fixed! (i hope)

This commit is contained in:
Rémy GIBERT 2016-01-28 18:03:51 +01:00
parent 442cba1760
commit 25fee276af
2 changed files with 62 additions and 73 deletions

View File

@ -50,15 +50,7 @@ BUF.InsertA sta TmpByte
ldy #0
.1 jsr DecTmpCount
beq .2
lda (BufPtrBackup),y
sta (BufPtr),y
iny
bne .1
inc BufPtrBackup+1
inc BufPtr+1
bra .1
.1 jsr BUF.CopyCount
.2 lda TmpByte
sta (BufPtr),y
@ -66,14 +58,7 @@ BUF.InsertA sta TmpByte
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
.3 jsr BUF.CopyTail
.4 ldy #FileLen
lda (pData),y
@ -93,20 +78,22 @@ BUF.Del ldy #FileLen
iny
ora (pData),y
bne .10
clc
clc exit with A=0
rts
.10 jsr BUF.ComputeCOffset
ldy #FileLen
lda BUF.COffset
clc
ldy #FileLen
sbc (pData),y
lda BUF.COffset
lda BUF.COffset+1
iny
sbc (pData),y
bcs .11
bcc .11
lda #0 exit with A=0
clc
rts
.11 lda (pData),y
pha
dey
@ -114,42 +101,25 @@ BUF.Del ldy #FileLen
tay
pla
jsr BUF.GetNewYA
* bcs .9
bcs *
bcs .9
>LDYA BUF.COffset
>STYA TmpCount
ldy #0
.1 jsr DecTmpCount
beq .2
lda (BufPtrBackup),y
sta (BufPtr),y
iny
bne .1
inc BufPtrBackup+1
inc BufPtr+1
bra .1
jsr BUF.CopyCount
.2 lda (BufPtrBackup)
cmp #13
beq *
lda (BufPtrBackup),y
tax Save deleted char for later
inc BufPtrBackup
bne .3
inc BufPtrBackup+1
.3 lda (BufPtrBackup),y
beq .4
sta (BufPtr),y
iny
bne .3
inc BufPtrBackup+1
inc BufPtr+1
bra .3
.3 jsr BUF.CopyTail
.4 ldy #FileLen
ldy #FileLen
lda (pData),y
sec
sbc #1
@ -158,10 +128,31 @@ BUF.Del ldy #FileLen
lda (pData),y
sbc #0
sta (pData),y
txa Get back deleted char
clc
.9 rts
*--------------------------------------
BUF.CopyCount jsr DecTmpCount
beq .9
lda (BufPtrBackup),y
sta (BufPtr),y
iny
bne BUF.CopyCount
inc BufPtrBackup+1
inc BufPtr+1
bra BUF.CopyCount
.9 rts
*--------------------------------------
BUF.CopyTail lda (BufPtrBackup),y
beq .9
sta (BufPtr),y
iny
bne BUF.CopyTail
inc BufPtrBackup+1
inc BufPtr+1
bra BUF.CopyTail
.9 rts
*--------------------------------------
* Out : Y = Line Length
*--------------------------------------
BUF.ComputeCOffset
@ -185,18 +176,6 @@ BUF.ComputeCOffset
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
@ -207,9 +186,6 @@ BUF.GetLineAX >STAX BUF.TmpLine1
>SYSCALL SYS.GetMemPtrA
>STYA BufPtr
lda (BufPtr)
beq .99
stz BUF.TmpLine2
stz BUF.TmpLine2+1
@ -251,20 +227,27 @@ BUF.GetLineAX >STAX BUF.TmpLine1
.7 lda BUF.TmpLine1
cmp BUF.TmpLine2
bne .99
bne .9
lda BUF.TmpLine1+1
cmp BUF.TmpLine2+1
bne .99
bne .9
.8
* lda BUF.LOffset
* sta BUF.COffset
* lda BUF.LOffset+1
* sta BUF.COffset+1
clc Y = Line length
.8 clc Y = Line length
rts
.99 sec
.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
rts
*--------------------------------------
BUF.GetNewYA >STYA TmpLen

View File

@ -461,9 +461,15 @@ Prompt.Editor pha
.4 jsr BUF.Del
bcs .9
jsr SCRN.UpdateCurrentLine
cmp #13
bne .5
jsr SCRN.UpdateMain
bcs .9
jsr SCRN.UpdateStatusBar
bra .6
.5 jsr SCRN.UpdateCurrentLine
bcs .9
.6 jsr SCRN.UpdateStatusBar
bcs .9
rts