-
Notifications
You must be signed in to change notification settings - Fork 1
/
SE_DELT.INC
executable file
·359 lines (350 loc) · 11.4 KB
/
SE_DELT.INC
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
; ┏━━━━━━━━━━━━━━━━┓
; ┃ 文件名 : SE_DELT.INC ┃
; ┃ 版本号 : 2.0 ┃
; ┃ 作 者 : 简晶 ┃
; ┃ 日 期 : 1991 年 12 月 ┃
; ┃ ┃
; ┃ 版权所有 (★)Starsoft Corp,. ┃
; ┃ Allright reserved in ShenZhen ┃
; ┗━━━━━━━━━━━━━━━━┛
;
; 本文件包括关于删除操作的子程序, 有以下几个:
; -------------------------------------------
; Delete - 删除光标位字符
; DelLine - 删除光标所在当前文件行
; StoreDelChr - 将删除字符存入删除缓冲区
; -------------------------------------------
DELETE:
Call Calps1
DELETE_REP:
Mov Chang,1
Mov Es,Siseg
Mov Al,Es:[Si]
Cmp Al,1ah ; 删除文件结束符吗? 是则返回
Jnz Dnr8
Ret
Dnr8: Cmp Al,0dh ; 删除回车, 转
Jz Unx1
Jmp Delnext
UNX1: PuSh_si
Xor Si,Si
Mov Ax,FileRow
Inc Ax
Call Calps
Pop_di
Mov Ll,0
UNX: Mov Es,Siseg
Mov Al,Es:[Si]
Mov Es,Diseg
Mov Es:[Di],Al ; 搬入新行
Cmp Al,1ah
Jnz Dnr4
Dec FileRowt ; 文件结束, 总行减一
Mov Ll,1
Jmp SHORT dnr6
DNR4: Cmp Al,0dh
Jz Dnr6
Call Si_inc
Call Di_inc
Jmp SHORT Unx
DNR6: PuSh_si
PuSh_di
Call Mov_di_to_si
Call Si_inc
PuSh_si
Call Caline
Mov Cx,Si
Xor Ch,Ch
Pop_si
Call Jdnx
Pop_si
Call Caline
Mov Bx,Ax ; 新行行数 -> BX
Pop_si
Call Caline
Cmp Ax,Bx ; 老行行数 -> AX
Jnz Need
Cmp Ll,0
Jz Nneed
Inc FileRowt
NNEED: Ret
NEED: Mov Bx,FileRow
PuSh Bx
Mov FileRow,Ax
Call Delline
Pop Ax
Mov FileRow,Ax
Ret
DELNEXT: Call Si_inc
Mov Es,Siseg
Mov Al,Es:[Si]
Call Si_dec
Mov Es,Siseg
Mov Es:[Si],Al
Call Si_inc
Cmp Al,0dh
Jz Dnr5
Cmp Al,1ah
Jnz Delnext
DNR5: PuSh_si
PuSh Ax
Call Caline
Pop Bx ; AX 返回行数, 不可破坏
Cmp Si,0
Jnz Dnr ; 在第一列的情况下
Cmp Bl,1ah ; 又是结束符
Jnz Nolastline
Dec FileRowt ; 直接删除最底行
Mov Crif,1
Mov Chang,1
Jmp SHORT Lastokr
NOLASTLINE: Call Need
LASTOKR: Pop_si
Ret
DNR: Pop_si
Mov Es,Siseg
Mov BYTE PTR Es:[Si],0
Ret
DELLINE:
Mov Crif,1
Mov Chang,1
Cmp Block,2
Jnz Ncok
Mov Ax,FileRow
Cmp Ax,Blockh
Jae Nc1
Dec Blockh
Dec Blocke
Jmp SHORT Ncok
NC1: Cmp Ax,Blocke
Ja Ncok
Mov Ax,Blocke
Cmp Ax,Blockh
Ja Dbok
Mov Block,0
Jmp SHORT Ncok
DBOK: Dec Blocke
NCOK: Cmp Pian,2
Jnz Ncok1
Mov Ax,FileRow
Cmp Ax,Pianhr
Jae Nc2
Dec Pianhr
Dec Pianer
Jmp SHORT Ncok1
NC2: Cmp Ax,Pianer
Ja Ncok1
Mov Ax,Pianer
Cmp Ax,Pianhr
Ja Dbok1
Mov Pian,0
Jmp SHORT Ncok1
DBOK1: Dec Pianer
NCOK1: Mov Ax,FileRow
Inc Ax
Cmp Ax,FileRowt
Jb Dllok
Call Calps1 ; 文件末行处理
Push_si
Xor Ch,Ch
Call Fullz
Pop_si
Mov Es,Siseg
Mov BYTE PTR Es:[Si],1ah
Ret
DLLOK: Dec Ax
Xor Si,Si
Call Calps
NEXTLINE: Mov Cl,EditWide
Inc Cl
NEXTDEL: Call EW_TO_BP
Call Addsi
Mov Es,Siseg
Mov Al,Es:[Si]
Call EW_TO_BP
Call Subsi
Mov Es,Siseg
Mov BYTE PTR Es:[Si],Al
Cmp Al,1ah
Jz Delr
Call Si_inc
Dec Cl
Or Cl,Cl
Jnz Nextdel
Jmp SHORT Nextline
DELR: Or Cl,Cl
Jz Delr1
Call Si_inc
Dec Cl
Mov Es,Siseg
Mov BYTE PTR Es:[Si],0
Jmp SHORT Delr
DELR1: Dec FileRowt
Ret
StorDelChr:
Cmp Al,1ah
Jz Nostrt
Push_si
Push Es
Mov Es,Fileseg
Mov Si,Undelete
Mov Es:[Si],Al
Inc Undelete
Pop Es
Pop_si
Nostrt: Ret
BlockSTD:
Mov Blockd,1
Mov HanZi,1
Mov Ax,FileRow
Push Ax
Mov Al,Col
Push Ax
Mov Ax,Blockh
Mov FileRow,Ax
StNBL: Mov Col,0
Call StorLine
Inc FileRow
Mov Ax,FileRow
Cmp Ax,Blocke
Jbe StNBL
Pop Ax
Mov Col,Al
Pop Ax
Mov FileRow,Ax
Mov Blockd,0
Xor Al,Al
Jmp StorDelChr
StorLine:
Push_si
Mov Al,Col
Push Ax
Call Calps1
StorLNC: Mov Es,Siseg
Mov Al,Es:[Si]
Or Al,Al
Jz StorLret
Cmp Al,0dh
Jnz DirStor
Cmp HanZi,0 ; Ctrl \ 不删除回车 ( HanZi = 0 )
Jz Nostcr
DirStor: Call StorDelChr
Nostcr: Inc Col
Mov Al,Col
Cmp Al,EditWide
Ja StorLret
Call Si_inc
Jmp SHORT StorLNC
StorLret: Cmp Blockd,0
Jnz SL1
Xor Al,Al
Call StorDelChr
SL1: Pop Ax
Mov Col,Al
Pop_si
Ret
DelCurChr:
Call Calps1
DelCur: Mov Es,Siseg
Mov Al,BYTE PTR Es:[Si]
Cmp PaiBan,0
Jnz Nost1aor0
Cmp Al,1ah
Jz Nost1aor0
Call StorDelChr
Nost1aor0: Push Ax ; 保存当前字符
Push_si
Call Delete_rep
Pop_si
Pop Ax
Cmp Iffast,0
Jnz Engdok
Cmp Al,0a1h ; 当前字符非汉字, 转
Jb Engdok
cmp al,0FFh
Jz Engdok
Mov Es,Siseg
Cmp BYTE PTR Es:[Si],0a1h
Jb Engdok ; 不属中文, 转
Cmp BYTE PTR Es:[Si],0FFh
Jz Engdok ; 不属中文, 转
Mov Al,BYTE PTR Es:[Si]
Call StorDelChr
Call Delete_rep
Engdok:
Cmp DLif,0 ; DLIF <> 0 不存 0
Jnz Engokret
Xor Al,Al
Call StorDelChr
Engokret: Retn
UndeltCall:
Mov Al,Inswp
Push Ax
Mov Inswp,1
Cmp Undelete,0
Jz NodecUD
Dec Undelete
UndelNext: Cmp Undelete,0
Jz Undelok
Dec Undelete
Mov Di,Undelete
Push Ds
Mov Ds,FileSeg
Mov Al,[Di]
Pop Ds
Or Al,Al
Jz UnDelok
Mov Inschr,Al
Cmp Al,0dh
Jnz IsAscChr
Mov Al,Col
Push Ax
Call InsEnter
Pop Ax
Mov Col,Al
Jmp SHORT UndelNext
IsAscChr: Call Insert
Jmp SHORT UndelNext
Undelok: Cmp Undelete,0
Jz NodecUD
Inc Undelete
NodecUD: Pop Ax
Mov Inswp,Al
Ret
DelWordAx: Push Ax ; Ax = 计数
Call Calps1
Pop Ax
CBnext: Or Ax,Ax
Jz CBok
Push Ax
Mov Es,Siseg
Mov Al,Es:[Si]
Call StorDelChr
Push_si
Call Delete_Rep
Pop_Si
Pop Ax
Dec Ax
Jmp SHORT CBnext
CBok: Cmp DLif,1
Jz CBrt
Xor Al,Al
Call StorDelChr
CBrt: Ret
DelLeftPart:
Mov Ax,FileRow
Push Ax
Call GotoLineBegin ; 返回本行首的 Siseg:Si 及计数 Cx
Or Cx,Cx
Jz OLORT
Push Cx
Call StFileRow&Col
Pop Ax
Mov DLif,1
Call DelWordAx
Xor Al,Al
Call StorDelChr
OLORT: Mov DLif,0
Pop Bx ; 原 FileRow 文件行
Jmp RowBackUp