Fix some speed issues with inserting and listing lines
This commit is contained in:
parent
9770df14c4
commit
8da8d780f5
103
gidubba.asm
103
gidubba.asm
|
@ -285,8 +285,21 @@ cmdesc: load r0, #20
|
||||||
|
|
||||||
;Insert a line
|
;Insert a line
|
||||||
|
|
||||||
|
;Reset the line number
|
||||||
|
insln: xor r0, r0
|
||||||
|
store lnnum, r0
|
||||||
|
store lnnum + 1, r0
|
||||||
|
|
||||||
|
;Get the save start address
|
||||||
|
;High byte
|
||||||
|
load r0, svstrt
|
||||||
|
store eoflod + 1, r0
|
||||||
|
;Low byte
|
||||||
|
load r0, svstrt + 1
|
||||||
|
store eoflod + 2, r0
|
||||||
|
|
||||||
;Find the argument line in the save and store its number
|
;Find the argument line in the save and store its number
|
||||||
insln: cleq r0, r0, fend
|
nextln: cleq r0, r0, fend
|
||||||
|
|
||||||
;Print a line number prompt
|
;Print a line number prompt
|
||||||
instrt: cleq r0, r0, prnln
|
instrt: cleq r0, r0, prnln
|
||||||
|
@ -326,7 +339,7 @@ inline: cleq r0, r0, input
|
||||||
cleq r0, r0, eofchk
|
cleq r0, r0, eofchk
|
||||||
|
|
||||||
;Insert the next line
|
;Insert the next line
|
||||||
breq r0, r0, insln
|
breq r0, r0, nextln
|
||||||
|
|
||||||
inesc: load r0, #20
|
inesc: load r0, #20
|
||||||
store ffff, r0
|
store ffff, r0
|
||||||
|
@ -355,6 +368,19 @@ copy: xor r0, r0
|
||||||
load r1, count
|
load r1, count
|
||||||
breq r0, r1, cmdp
|
breq r0, r1, cmdp
|
||||||
|
|
||||||
|
;Reset the line number
|
||||||
|
xor r0, r0
|
||||||
|
store lnnum, r0
|
||||||
|
store lnnum + 1, r0
|
||||||
|
|
||||||
|
;Get the save start address
|
||||||
|
;High byte
|
||||||
|
load r0, svstrt
|
||||||
|
store eoflod + 1, r0
|
||||||
|
;Low byte
|
||||||
|
load r0, svstrt + 1
|
||||||
|
store eoflod + 2, r0
|
||||||
|
|
||||||
;Find the argument line in the save and store its number
|
;Find the argument line in the save and store its number
|
||||||
cleq r0, r0, fend
|
cleq r0, r0, fend
|
||||||
|
|
||||||
|
@ -493,6 +519,19 @@ svtarg: load r0, target
|
||||||
load r0, mark + 1
|
load r0, mark + 1
|
||||||
store target + 1, r0
|
store target + 1, r0
|
||||||
|
|
||||||
|
;Reset the line number
|
||||||
|
xor r0, r0
|
||||||
|
store lnnum, r0
|
||||||
|
store lnnum + 1, r0
|
||||||
|
|
||||||
|
;Get the save start address
|
||||||
|
;High byte
|
||||||
|
load r0, svstrt
|
||||||
|
store eoflod + 1, r0
|
||||||
|
;Low byte
|
||||||
|
load r0, svstrt + 1
|
||||||
|
store eoflod + 2, r0
|
||||||
|
|
||||||
;Find the marked line in the save and store its number
|
;Find the marked line in the save and store its number
|
||||||
cleq r0, r0, fend
|
cleq r0, r0, fend
|
||||||
|
|
||||||
|
@ -582,6 +621,19 @@ delete: xor r0, r0
|
||||||
load r1, count
|
load r1, count
|
||||||
breq r0, r1, cmdp
|
breq r0, r1, cmdp
|
||||||
|
|
||||||
|
;Reset the line number
|
||||||
|
xor r0, r0
|
||||||
|
store lnnum, r0
|
||||||
|
store lnnum + 1, r0
|
||||||
|
|
||||||
|
;Get the save start address
|
||||||
|
;High byte
|
||||||
|
load r0, svstrt
|
||||||
|
store eoflod + 1, r0
|
||||||
|
;Low byte
|
||||||
|
load r0, svstrt + 1
|
||||||
|
store eoflod + 2, r0
|
||||||
|
|
||||||
;Find the argument line in the save and store its number
|
;Find the argument line in the save and store its number
|
||||||
cleq r0, r0, fend
|
cleq r0, r0, fend
|
||||||
|
|
||||||
|
@ -610,6 +662,19 @@ dchend: load r0, 0
|
||||||
store target, r0
|
store target, r0
|
||||||
store target + 1, r1
|
store target + 1, r1
|
||||||
|
|
||||||
|
;Reset the line number
|
||||||
|
xor r0, r0
|
||||||
|
store lnnum, r0
|
||||||
|
store lnnum + 1, r0
|
||||||
|
|
||||||
|
;Get the save start address
|
||||||
|
;High byte
|
||||||
|
load r0, svstrt
|
||||||
|
store eoflod + 1, r0
|
||||||
|
;Low byte
|
||||||
|
load r0, svstrt + 1
|
||||||
|
store eoflod + 2, r0
|
||||||
|
|
||||||
;Find the next line in the save and store its number
|
;Find the next line in the save and store its number
|
||||||
cleq r0, r0, fend
|
cleq r0, r0, fend
|
||||||
|
|
||||||
|
@ -671,8 +736,21 @@ delend: load r0, count
|
||||||
|
|
||||||
;List a line
|
;List a line
|
||||||
|
|
||||||
;Check the counter
|
;Reset the line number
|
||||||
list: xor r0, r0
|
list: xor r0, r0
|
||||||
|
store lnnum, r0
|
||||||
|
store lnnum + 1, r0
|
||||||
|
|
||||||
|
;Get the save start address
|
||||||
|
;High byte
|
||||||
|
load r0, svstrt
|
||||||
|
store eoflod + 1, r0
|
||||||
|
;Low byte
|
||||||
|
load r0, svstrt + 1
|
||||||
|
store eoflod + 2, r0
|
||||||
|
|
||||||
|
;Check the counter
|
||||||
|
lcount: xor r0, r0
|
||||||
load r1, count
|
load r1, count
|
||||||
breq r0, r1, cmdp
|
breq r0, r1, cmdp
|
||||||
|
|
||||||
|
@ -740,7 +818,7 @@ lstend: load r0, count
|
||||||
store target, r0
|
store target, r0
|
||||||
store target + 1, r1
|
store target + 1, r1
|
||||||
;Loop
|
;Loop
|
||||||
breq r0, r0, list
|
breq r0, r0, lcount
|
||||||
|
|
||||||
;***
|
;***
|
||||||
|
|
||||||
|
@ -1517,21 +1595,8 @@ savend: ret
|
||||||
|
|
||||||
;Find the argument line in the save and store its number
|
;Find the argument line in the save and store its number
|
||||||
|
|
||||||
;Reset the line number
|
|
||||||
fend: xor r0, r0
|
|
||||||
store lnnum, r0
|
|
||||||
store lnnum + 1, r0
|
|
||||||
|
|
||||||
;Get the save start address
|
|
||||||
;High byte
|
|
||||||
load r0, svstrt
|
|
||||||
store eoflod + 1, r0
|
|
||||||
;Low byte
|
|
||||||
load r0, svstrt + 1
|
|
||||||
store eoflod + 2, r0
|
|
||||||
|
|
||||||
;Check for the argument
|
;Check for the argument
|
||||||
charg: load r0, target
|
fend: load r0, target
|
||||||
load r1, lnnum
|
load r1, lnnum
|
||||||
brneq r0, r1, feof
|
brneq r0, r1, feof
|
||||||
load r0, target + 1
|
load r0, target + 1
|
||||||
|
@ -1568,7 +1633,7 @@ incsav: load r0, eoflod + 1
|
||||||
store eoflod + 2, r1
|
store eoflod + 2, r1
|
||||||
|
|
||||||
;Check the next character
|
;Check the next character
|
||||||
breq r0, r0, charg
|
breq r0, r0, fend
|
||||||
|
|
||||||
;Return
|
;Return
|
||||||
fendnd: ret
|
fendnd: ret
|
||||||
|
|
Loading…
Reference in New Issue