-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathdelete
86 lines (86 loc) · 1.76 KB
/
delete
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
.PAG 'DELETE'
;
; DELETE A RANGE OF SOURCE
;
; SYNTAX
; DELETE FROM#,TO#
;
NRANGE JMP SNERR
DELETE BEQ NRANGE ;BAD..NO RANGE PARMS.
JSR RANGE ;GET LINE # RANGE
BEQ NRANGE ;SOME RANGE ERRORS
LDA LOWTR ;SAVE IT
LDX LOWTR+1
STA INDEX2
STX INDEX2+1
JSR FNDLIN ;FIND IT
BCC DEL300 ;SKIP IF NOT FOUND
LDY #1
LDA (LOWTR)Y ;AT END OF SOURCE ?
DEY
TAX ;SAVE IT IN CASE OF SWAP
BNE NOTEOS
LDA (LOWTR)Y
BEQ DEL300 ;BOTH ZERO MEANS END-OF-SOURCE
NOTEOS LDA (LOWTR)Y
STA LOWTR ;INCLUDE TO LINE #
STX LOWTR+1
DEL300 LDA INDEX2 ;CHECK FROM#<TO#
SEC
SBC LOWTR ;GEN NEG DELTA
TAX
LDA INDEX2+1
SBC LOWTR+1
TAY
BCS NOTDEL ;NO GOOD
TXA
CLC
ADC TXTEND ;GEN NEW END OF SOURCE
STA TXTEND
TYA
ADC TXTEND+1
STA TXTEND+1
LDY #0
DEL500 JSR MAPTXT
LDA (LOWTR)Y ;MOVE SOURCE DOWN
STA (INDEX2)Y
INY
BNE DEL500
INC LOWTR+1
INC INDEX2+1
LDA TXTEND+1 ;DONE ONE EXTRA PAGE
CMP INDEX2+1
BCS DEL500 ;NO
NOTDEL JMP FINI ;RELINK AND SAY READY
.SKI 3
;********************************
;*
;* INPUT RANGE PARMS
;* EXIT: Z=1, IF RANGE ERRORS
;*
;********************************
RANGE BCC RNG100 ;FROM CHRGOT A # ?
BEQ RNG100 ;A TERMINATOR
CMP #TKMINU ;A DASH
BEQ RNG100
RNGERR LDA #0 ;Z=1, SYNTAX ERROR
RTS
;
RNG100 JSR MAPTXT
JSR LINGET ;GET #
JSR FNDLIN ;FIND OR SET PTRS
JSR CHRGOT ;GET LAST CHAR
BEQ RNG200 ;SKIP DONE
CMP #TKMINU ;A DASH
BNE RNGERR ;SYNTAX ERROR
JSR CHRGET ;YES - SKIP DASH
JSR LINGET ;GET TO #
BNE RNGERR ;NOT A NUMBER ERR
RNG200 LDA LINNUM
ORA LINNUM+1 ;WAS A # TO INPUT ?
BNE RNGRTS ;YES
LDA #$FF ;NO - MAKE MAX
STA LINNUM
STA LINNUM+1
RNGRTS RTS ;Z=0, NO ERRORS
.END