Subversion Repositories Kolibri OS

Rev

Rev 485 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 485 Rev 1247
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;
2
;
3
;    TERMINAL
3
;    TERMINAL
4
  
4
  
5
use32
5
use32
6
 org	0x0
6
 org	0x0
7
 db	'MENUET01'    ; header
7
 db	'MENUET01'    ; header
8
 dd	0x01	      ; header version
8
 dd	0x01	      ; header version
9
 dd	START	      ; entry point
9
 dd	START	      ; entry point
10
 dd	I_END	      ; image size
10
 dd	I_END	      ; image size
11
 dd	I_END+0x10000 ; required memory
11
 dd	I_END+0x10000 ; required memory
12
 dd	I_END+0x10000 ; esp
12
 dd	I_END+0x10000 ; esp
13
 dd	0x0 , 0x0     ; I_Param , I_Path
13
 dd	0x0 , 0x0     ; I_Param , I_Path
14
   
14
   
15
include 'lang.inc'
15
include 'lang.inc'
16
include '..\..\..\macros.inc'
16
include '..\..\..\macros.inc'
17
   
17
   
18
   
18
   
19
START:				; start of execution
19
START:				; start of execution
20
   
20
   
21
    call draw_window
21
    call draw_window
22
   
22
   
23
    call set_variables
23
    call set_variables
24
   
24
   
25
still:
25
still:
26
   
26
   
27
    mov  eax,23 		; wait here for event
27
    mov  eax,23 		; wait here for event
28
    mov  ebx,20
28
    mov  ebx,20
29
    mcall
29
    mcall
30
   
30
   
31
    cmp  eax,1			; redraw request ?
31
    cmp  eax,1			; redraw request ?
32
    je	 red
32
    je	 red
33
    cmp  eax,2			; key in buffer ?
33
    cmp  eax,2			; key in buffer ?
34
    je	 key
34
    je	 key
35
    cmp  eax,3			; button in buffer ?
35
    cmp  eax,3			; button in buffer ?
36
    je	 button
36
    je	 button
37
    cmp  eax,16+4
37
    cmp  eax,16+4
38
    je	 read_input
38
    je	 read_input
39
   
39
   
40
    jmp  still
40
    jmp  still
41
   
41
   
42
   
42
   
43
read_input:
43
read_input:
-
 
44
    mcall 42,4,text+120*80
-
 
45
    test eax, eax
-
 
46
    jle  still
44
   
47
 
45
    push ecx
48
read_input_loop:
46
    mov  eax,42
49
    mov  bl,[ecx]
47
    mov  ebx,4
50
    inc  ecx
48
    mcall
-
 
49
    pop  ecx
51
    push eax ecx
50
   
-
 
51
    cmp  bl,27				; ESCAPE COMMAND
52
    cmp  bl,27				; ESCAPE COMMAND
52
    jne  no_esc
53
    jne  no_esc
53
    call esc_command
54
    call esc_command
54
    jmp  newdata
55
    jmp  newdata
55
  no_esc:
56
  no_esc:
56
   
57
   
57
    cmp  bl,13				; BEGINNING OF LINE
58
    cmp  bl,13				; BEGINNING OF LINE
58
    jne  nobol
59
    jne  nobol
59
    mov  ecx,[pos]
60
    mov  ecx,[pos]
60
    add  ecx,1
61
    add  ecx,1
61
  boll1:
62
  boll1:
62
    sub  ecx,1
63
    sub  ecx,1
63
    mov  eax,ecx
64
    mov  eax,ecx
64
    xor  edx,edx
65
    xor  edx,edx
65
    mov  ebx,80
66
    mov  ebx,80
66
    div  ebx
67
    div  ebx
67
    cmp  edx,0
68
    cmp  edx,0
68
    jne  boll1
69
    jne  boll1
69
    mov  [pos],ecx
70
    mov  [pos],ecx
70
    jmp  newdata
71
    jmp  newdata
71
  nobol:
72
  nobol:
72
   
73
   
73
    cmp  bl,10				  ; LINE DOWN
74
    cmp  bl,10				  ; LINE DOWN
74
    jne  nolf
75
    jne  nolf
75
   addx1:
76
   addx1:
76
    add  [pos],dword 1
77
    add  [pos],dword 1
77
    mov  eax,[pos]
78
    mov  eax,[pos]
78
    xor  edx,edx
79
    xor  edx,edx
79
    mov  ecx,80
80
    mov  ecx,80
80
    div  ecx
81
    div  ecx
81
    cmp  edx,0
82
    cmp  edx,0
82
    jnz  addx1
83
    jnz  addx1
83
    mov  eax,[pos]
84
    mov  eax,[pos]
84
    jmp  cm1
85
    jmp  cm1
85
  nolf:
86
  nolf:
86
   
87
   
87
    cmp  bl,8				 ; BACKSPACE
88
    cmp  bl,8				 ; BACKSPACE
88
    jne  nobasp
89
    jne  nobasp
89
    mov  eax,[pos]
90
    mov  eax,[pos]
90
    dec  eax
91
    dec  eax
91
    mov  [pos],eax
92
    mov  [pos],eax
92
    mov  [eax+text],byte 32
93
    mov  [eax+text],byte 32
93
    mov  [eax+text+60*80],byte 0
94
    mov  [eax+text+60*80],byte 0
94
    jmp  newdata
95
    jmp  newdata
95
   nobasp:
96
   nobasp:
96
   
97
   
97
    cmp  bl,15				 ; CHARACTER
98
    cmp  bl,15				 ; CHARACTER
98
    jbe  newdata
99
    jbe  newdata
99
    mov  eax,[pos]
100
    mov  eax,[pos]
100
    call draw_data
101
    call draw_data
101
    mov  eax,[pos]
102
    mov  eax,[pos]
102
    add  eax,1
103
    add  eax,1
103
  cm1:
104
  cm1:
104
    mov  ebx,[scroll+4]
105
    mov  ebx,[scroll+4]
105
    imul ebx,80
106
    imul ebx,80
106
    cmp  eax,ebx
107
    cmp  eax,ebx
107
    jb	 noeaxz
108
    jb	 noeaxz
108
    mov  esi,text+80
109
    mov  esi,text+80
109
    mov  edi,text
110
    mov  edi,text
110
    mov  ecx,ebx
111
    mov  ecx,ebx
111
    cld
112
    cld
112
    rep  movsb
113
    rep  movsb
113
    mov  esi,text+80+60*80
114
    mov  esi,text+80+60*80
114
    mov  edi,text+60*80
115
    mov  edi,text+60*80
115
    mov  ecx,ebx
116
    mov  ecx,ebx
116
    cld
117
    cld
117
    rep  movsb
118
    rep  movsb
118
    mov  eax,ebx
119
    mov  eax,ebx
119
    sub  eax,80
120
    sub  eax,80
120
  noeaxz:
121
  noeaxz:
121
    mov  [pos],eax
122
    mov  [pos],eax
122
  newdata:
123
  newdata:
123
    mov  eax,11
124
    pop  ecx eax
124
    mcall
-
 
125
    cmp  eax,16+4
125
    dec  eax
126
    je	 read_input
126
    jnz  read_input_loop
127
    call draw_text
127
    call draw_text
128
    jmp  still
128
    jmp  still
129
   
129
   
130
   
130
   
131
  red:				; REDRAW WINDOW
131
  red:				; REDRAW WINDOW
132
    call draw_window
132
    call draw_window
133
    jmp  still
133
    jmp  still
134
   
134
   
135
  key:				; KEY
135
  key:				; KEY
136
    mov  eax,2			; send to modem
136
    mov  eax,2			; send to modem
137
    mcall
137
    mcall
138
    shr  eax,8
138
    shr  eax,8
139
    cmp  eax,178		; ARROW KEYS
139
    cmp  eax,178		; ARROW KEYS
140
    jne  noaup
140
    jne  noaup
141
    mov  al,'A'
141
    mov  al,'A'
142
    call arrow
142
    call arrow
143
    jmp  still
143
    jmp  still
144
  noaup:
144
  noaup:
145
    cmp  eax,177
145
    cmp  eax,177
146
    jne  noadown
146
    jne  noadown
147
    mov  al,'B'
147
    mov  al,'B'
148
    call arrow
148
    call arrow
149
    jmp  still
149
    jmp  still
150
  noadown:
150
  noadown:
151
    cmp  eax,179
151
    cmp  eax,179
152
    jne  noaright
152
    jne  noaright
153
    mov  al,'C'
153
    mov  al,'C'
154
    call arrow
154
    call arrow
155
    jmp  still
155
    jmp  still
156
  noaright:
156
  noaright:
157
    cmp  eax,176
157
    cmp  eax,176
158
    jne  noaleft
158
    jne  noaleft
159
    mov  al,'D'
159
    mov  al,'D'
160
    call arrow
160
    call arrow
161
    jmp  still
161
    jmp  still
162
  noaleft:
162
  noaleft:
163
  modem_out:
163
  modem_out:
164
    mov  ecx,0x3f8
164
    mov  dx,0x3f8
165
    mov  bl,al
165
    out  dx,al
166
    mov  eax,43
-
 
167
    mcall
-
 
168
    jmp  still
166
    jmp  still
169
   
167
   
170
  button:			; BUTTON
168
  button:			; BUTTON
171
    mov  eax,17
169
    mov  eax,17
172
    mcall
170
    mcall
173
    cmp  ah,1			; CLOSE PROGRAM
171
    cmp  ah,1			; CLOSE PROGRAM
174
    jne  noclose
172
    jne  noclose
175
    mov  eax,45 		; FREE IRQ
173
    mov  eax,45 		; FREE IRQ
176
    mov  ebx,1
174
    mov  ebx,1
177
    mov  ecx,4
175
    mov  ecx,4
178
    mcall
176
    mcall
179
    mov  eax,46
177
    mov  eax,46
180
    mov  ebx,1
178
    mov  ebx,1
181
    mov  ecx,0x3f0
179
    mov  ecx,0x3f0
182
    mov  edx,0x3ff
180
    mov  edx,0x3ff
183
    mcall
181
    mcall
184
     or  eax,-1
182
     or  eax,-1
185
     mcall
183
     mcall
186
  noclose:
184
  noclose:
187
   
185
   
188
    jmp  still
186
    jmp  still
189
   
187
   
190
   
188
   
191
arrow:
189
arrow:
192
   
190
   
193
    push eax
191
    push eax
194
    mov  al,27
192
    mov  al,27
195
    call to_modem
193
    call to_modem
196
    mov  al,'['
194
    mov  al,'['
197
    call to_modem
195
    call to_modem
198
    pop  eax
196
    pop  eax
199
    call to_modem
197
    call to_modem
200
   
198
   
201
    ret
199
    ret
202
   
200
   
203
   
201
   
204
to_modem:
202
to_modem:
205
   
203
   
206
    pusha
204
    pusha
207
   
205
   
208
    mov  ecx,0x3f8
206
    mov  dx,0x3f8
209
    mov  ebx,eax
-
 
210
    mov  eax,43
-
 
211
    mcall
207
    out  dx,al
212
    mov  eax,5
208
    mov  eax,5
213
    mov  ebx,5
209
    mov  ebx,5
214
    mcall
210
    mcall
215
   
211
   
216
    popa
212
    popa
217
    ret
213
    ret
218
   
214
   
219
   
215
   
220
draw_data:
216
draw_data:
221
   
217
   
222
    pusha
218
    pusha
223
   
219
   
224
    cmp  bl,0xe4   ; Á
220
    cmp  bl,0xe4   ; Á
225
    jne  noe4
221
    jne  noe4
226
    mov  bl,0xc1
222
    mov  bl,0xc1
227
  noe4:
223
  noe4:
228
    cmp  bl,0xc4   ; É
224
    cmp  bl,0xc4   ; É
229
    jne  noc4
225
    jne  noc4
230
    mov  bl,0xc9
226
    mov  bl,0xc9
231
  noc4:
227
  noc4:
232
    mov  [eax+text],bl
228
    mov  [eax+text],bl
233
    mov  bl,byte [attribute]
229
    mov  bl,byte [attribute]
234
    mov  [eax+text+60*80],bl
230
    mov  [eax+text+60*80],bl
235
   
231
   
236
    popa
232
    popa
237
    ret
233
    ret
238
   
234
   
239
   
235
   
240
irqtable:
236
irqtable:
241
   
237
   
242
    dd	0x3f8  + 0x01000000  ; read port 0x3f8, byte
238
    dd	0x3f8  + 0x01000000  ; read port 0x3f8, byte
243
    dd	0
239
    dd	0
244
    dd	0
240
    dd	0
245
    dd	0
241
    dd	0
246
    dd	0
242
    dd	0
247
    dd	0
243
    dd	0
248
    dd	0
244
    dd	0
249
    dd	0
245
    dd	0
250
    dd	0
246
    dd	0
251
    dd	0
247
    dd	0
252
    dd	0
248
    dd	0
253
    dd	0
249
    dd	0
254
    dd	0
250
    dd	0
255
    dd	0
251
    dd	0
256
    dd	0
252
    dd	0
257
    dd	0
253
    dd	0
258
   
254
   
259
   
255
   
260
   
256
   
261
   
257
   
262
set_variables:
258
set_variables:
263
   
259
   
264
    pusha
260
    pusha
265
   
261
   
266
    mov  eax,46
262
    mov  eax,46
267
    mov  ebx,0
263
    mov  ebx,0
268
    mov  ecx,0x3f0
264
    mov  ecx,0x3f0
269
    mov  edx,0x3ff
265
    mov  edx,0x3ff
270
    mcall
266
    mcall
271
   
267
   
272
    mov  eax,45 	 ; reserve irq 4
268
    mov  eax,45 	 ; reserve irq 4
273
    mov  ebx,0
269
    mov  ebx,0
274
    mov  ecx,4
270
    mov  ecx,4
275
    mcall
271
    mcall
276
   
272
   
277
    mov  eax,44
273
    mov  eax,44
278
    mov  ebx,irqtable
274
    mov  ebx,irqtable
279
    mov  ecx,4
275
    mov  ecx,4
280
    mcall
276
    mcall
281
   
277
   
282
;    jmp  noportint
278
;    jmp  noportint
283
   
279
   
284
    mov  cx,0x3f8+3
280
    mov  dx,0x3f8+3
285
    mov  bl,0x80
281
    mov  al,0x80
286
    mov  eax,43
-
 
287
    mcall
282
    out  dx,al
288
   
283
   
289
    mov  cx,0x3f8+1
284
    mov  dx,0x3f8+1
290
    mov  bl,0
285
    mov  al,0
291
    mov  eax,43
-
 
292
    mcall
286
    out  dx,al
293
   
287
   
294
    mov  cx,0x3f8+0
288
    mov  dx,0x3f8+0
295
    mov  bl,0x30 / 16
289
    mov  al,0x30 / 16
296
    mov  eax,43
-
 
297
    mcall
290
    out  dx,al
298
   
291
   
299
    mov  cx,0x3f8+3
292
    mov  dx,0x3f8+3
300
    mov  bl,3
293
    mov  al,3
301
    mov  eax,43
-
 
302
    mcall
294
    out  dx,al
303
   
295
   
304
    mov  cx,0x3f8+4
296
    mov  dx,0x3f8+4
305
    mov  bl,0xB
297
    mov  al,0xB
306
    mov  eax,43
-
 
307
    mcall
298
    out  dx,al
308
   
299
   
309
    mov  cx,0x3f8+1
300
    mov  dx,0x3f8+1
310
    mov  bl,1
301
    mov  al,1
311
    mov  eax,43
-
 
312
    mcall
302
    out  dx,al
313
   
303
   
314
  noportint:
304
  noportint:
315
   
305
   
316
     mov  eax,40
306
     mov  eax,40
317
     mov  ebx,0000000000010000b shl 16 + 111b
307
     mov  ebx,0000000000010000b shl 16 + 111b
318
    mcall
308
    mcall
319
   
309
   
320
    popa
310
    popa
321
   
311
   
322
    ret
312
    ret
323
   
313
   
324
   
314
   
325
   
315
   
326
;   *********************************************
316
;   *********************************************
327
;   *******  WINDOW DEFINITIONS AND DRAW ********
317
;   *******  WINDOW DEFINITIONS AND DRAW ********
328
;   *********************************************
318
;   *********************************************
329
   
319
   
330
   
320
   
331
draw_window:
321
draw_window:
332
   
322
   
333
    pusha
323
    pusha
334
   
324
   
335
    mov  eax,12
325
    mov  eax,12
336
    mov  ebx,1
326
    mov  ebx,1
337
    mcall
327
    mcall
338
   
328
   
339
    mov  eax,0			   ; DRAW WINDOW
329
    mov  eax,0			   ; DRAW WINDOW
340
    mov  ebx,100*65536+491
330
    mov  ebx,100*65536+491
341
    mov  ecx,100*65536+270
331
    mov  ecx,100*65536+270
342
    mov  edx,0x13000000
332
    mov  edx,0x13000000
343
    mov  edi,title
333
    mov  edi,title
344
    mcall
334
    mcall
345
   
335
   
346
    xor  eax,eax
336
    xor  eax,eax
347
    mov  edi,text+80*30
337
    mov  edi,text+80*30
348
    mov  ecx,80*30 /4
338
    mov  ecx,80*30 /4
349
    cld
339
    cld
350
    rep  stosd
340
    rep  stosd
351
   
341
   
352
    call draw_text
342
    call draw_text
353
   
343
   
354
    mov  eax,12
344
    mov  eax,12
355
    mov  ebx,2
345
    mov  ebx,2
356
    mcall
346
    mcall
357
   
347
   
358
    popa
348
    popa
359
   
349
   
360
    ret
350
    ret
361
   
351
   
362
   
352
   
363
bgc  dd  0x000000
353
bgc  dd  0x000000
364
     dd  0x000000
354
     dd  0x000000
365
     dd  0x00ff00
355
     dd  0x00ff00
366
     dd  0x0000ff
356
     dd  0x0000ff
367
     dd  0x005500
357
     dd  0x005500
368
     dd  0xff00ff
358
     dd  0xff00ff
369
     dd  0x00ffff
359
     dd  0x00ffff
370
     dd  0x770077
360
     dd  0x770077
371
   
361
   
372
tc   dd  0xffffff
362
tc   dd  0xffffff
373
     dd  0xff00ff
363
     dd  0xff00ff
374
     dd  0xffffff
364
     dd  0xffffff
375
     dd  0xffffff
365
     dd  0xffffff
376
     dd  0xffffff
366
     dd  0xffffff
377
     dd  0xffffff
367
     dd  0xffffff
378
     dd  0xffffff
368
     dd  0xffffff
379
     dd  0xffffff
369
     dd  0xffffff
380
   
370
   
381
   
371
   
382
draw_text:
372
draw_text:
383
   
373
   
384
    pusha
374
    pusha
385
   
375
   
386
    mov  esi,text
376
    mov  esi,text
387
    mov  eax,0
377
    mov  eax,0
388
    mov  ebx,0
378
    mov  ebx,0
389
  newletter:
379
  newletter:
390
    mov  cl,[esi]
380
    mov  cl,[esi]
391
    mov  dl,[esi+60*80]
381
    mov  dl,[esi+60*80]
392
    cmp  cl,[esi+30*80]
382
    cmp  cl,[esi+30*80]
393
    jne  yesletter
383
    jne  yesletter
394
    cmp  dl,[esi+90*80]
384
    cmp  dl,[esi+90*80]
395
    jne  yesletter
385
    jne  yesletter
396
    jmp  noletter
386
    jmp  noletter
397
  yesletter:
387
  yesletter:
398
    mov  [esi+30*80],cl
388
    mov  [esi+30*80],cl
399
    mov  [esi+90*80],dl
389
    mov  [esi+90*80],dl
400
   
390
   
401
    pusha
391
    pusha
402
    and  edx,0xff
392
    and  edx,0xff
403
    shl  edx,2
393
    shl  edx,2
404
    add  edx,bgc
394
    add  edx,bgc
405
    mov  edx,[edx]
395
    mov  edx,[edx]
406
    mov  ecx,ebx
396
    mov  ecx,ebx
407
    add  ecx,26
397
    add  ecx,26
408
    shl  ecx,16
398
    shl  ecx,16
409
    mov  cx,9
399
    mov  cx,9
410
    mov  ebx,eax
400
    mov  ebx,eax
411
    add  ebx,6
401
    add  ebx,6
412
    shl  ebx,16
402
    shl  ebx,16
413
    mov  bx,6
403
    mov  bx,6
414
    mov  eax,13
404
    mov  eax,13
415
    mcall
405
    mcall
416
    popa
406
    popa
417
   
407
   
418
    pusha
408
    pusha
419
    and  edx,0xff
409
    and  edx,0xff
420
    shl  edx,2
410
    shl  edx,2
421
    add  edx,tc
411
    add  edx,tc
422
    mov  ecx,[edx]
412
    mov  ecx,[edx]
423
    push bx
413
    push bx
424
    mov  ebx,eax
414
    mov  ebx,eax
425
    add  ebx,6
415
    add  ebx,6
426
    shl  ebx,16
416
    shl  ebx,16
427
    pop  bx
417
    pop  bx
428
    add  bx,26
418
    add  bx,26
429
    mov  eax,4
419
    mov  eax,4
430
    mov  edx,esi
420
    mov  edx,esi
431
    mov  esi,1
421
    mov  esi,1
432
    mcall
422
    mcall
433
    popa
423
    popa
434
   
424
   
435
  noletter:
425
  noletter:
436
   
426
   
437
    add  esi,1
427
    add  esi,1
438
    add  eax,6
428
    add  eax,6
439
    cmp  eax,80*6
429
    cmp  eax,80*6
440
    jb	 newletter
430
    jb	 newletter
441
    mov  eax,0
431
    mov  eax,0
442
    add  ebx,10
432
    add  ebx,10
443
    cmp  ebx,24*10
433
    cmp  ebx,24*10
444
    jb	 newletter
434
    jb	 newletter
445
   
435
   
446
    popa
436
    popa
447
    ret
437
    ret
448
   
438
   
449
   
439
   
450
esc_command:
440
esc_command:
451
   
441
   
452
     mov   eax,32
442
     mov   eax,32
453
     mov   edi,esccmd
443
     mov   edi,esccmd
454
     mov   ecx,10
444
     mov   ecx,10
455
     cld
445
     cld
456
     rep   stosb
446
     rep   stosb
457
     mov   edi,esccmd
447
     mov   edi,esccmd
458
   newescc:
448
   newescc:
459
     mov   eax,42
449
     mov   eax,42
460
     mov   ebx,4
450
     mov   ebx,4
461
     mcall
451
     mcall
462
     cmp   ecx,0
452
     cmp   ecx,0
463
     je    escok
453
     je    escok
464
     mov   eax,5
454
     mov   eax,5
465
     mov   ebx,1
455
     mov   ebx,1
466
     mcall
456
     mcall
467
     jmp   newescc
457
     jmp   newescc
468
   escok:
458
   escok:
469
     mov   [edi],bl
459
     mov   [edi],bl
470
     add   edi,1
460
     add   edi,1
471
     cmp   edi,esccmd+20
461
     cmp   edi,esccmd+20
472
     je    dontunderstand
462
     je    dontunderstand
473
     mov   esi,escend
463
     mov   esi,escend
474
   nec:
464
   nec:
475
     cmp   bl,[esi]
465
     cmp   bl,[esi]
476
     jz    com_ok
466
     jz    com_ok
477
     add   esi,1
467
     add   esi,1
478
     cmp   [esi],byte 0
468
     cmp   [esi],byte 0
479
     je    newescc
469
     je    newescc
480
     jmp   nec
470
     jmp   nec
481
   com_ok:
471
   com_ok:
482
   
472
   
483
     call  get_numbers
473
     call  get_numbers
484
   
474
   
485
     cmp   bl,'H'		      ; SET CURSOR POSITION
475
     cmp   bl,'H'		      ; SET CURSOR POSITION
486
     jne   no_cursor_position
476
     jne   no_cursor_position
487
     cmp   [escnumbers],0
477
     cmp   [escnumbers],0
488
     jne   ncp1
478
     jne   ncp1
489
     mov   [pos],dword 0
479
     mov   [pos],dword 0
490
     jmp   cmd_done
480
     jmp   cmd_done
491
    ncp1:
481
    ncp1:
492
     mov    eax,[escnumbers]
482
     mov    eax,[escnumbers]
493
     dec    eax
483
     dec    eax
494
     imul   eax,80
484
     imul   eax,80
495
     add    eax,[escnumbers+4]
485
     add    eax,[escnumbers+4]
496
     dec    eax
486
     dec    eax
497
     mov    [pos],eax
487
     mov    [pos],eax
498
     jmp    cmd_done
488
     jmp    cmd_done
499
   no_cursor_position:
489
   no_cursor_position:
500
   
490
   
501
     cmp    bl,'K'			; ERASE LINE
491
     cmp    bl,'K'			; ERASE LINE
502
     jne    no_erase_end_of_line
492
     jne    no_erase_end_of_line
503
     cmp    [escnumbers],0
493
     cmp    [escnumbers],0
504
     jne    no_end_line
494
     jne    no_end_line
505
     mov    ecx,[pos]
495
     mov    ecx,[pos]
506
   eeol:
496
   eeol:
507
     mov    [ecx+text],byte ' '
497
     mov    [ecx+text],byte ' '
508
     mov    [ecx+text+60*80],byte 0
498
     mov    [ecx+text+60*80],byte 0
509
     add    ecx,1
499
     add    ecx,1
510
     xor    edx,edx
500
     xor    edx,edx
511
     mov    eax,ecx
501
     mov    eax,ecx
512
     mov    ebx,80
502
     mov    ebx,80
513
     div    ebx
503
     div    ebx
514
     cmp    edx,0
504
     cmp    edx,0
515
     jne    eeol
505
     jne    eeol
516
     jmp    cmd_done
506
     jmp    cmd_done
517
    no_end_line:
507
    no_end_line:
518
     cmp    [escnumbers],1		; BEGINNING OF LINE
508
     cmp    [escnumbers],1		; BEGINNING OF LINE
519
     jne    no_beg_line
509
     jne    no_beg_line
520
     mov    ecx,[pos]
510
     mov    ecx,[pos]
521
   ebol:
511
   ebol:
522
     mov    [ecx+text],byte ' '
512
     mov    [ecx+text],byte ' '
523
     mov    [ecx+text+60*80],byte 0
513
     mov    [ecx+text+60*80],byte 0
524
     sub    ecx,1
514
     sub    ecx,1
525
     xor    edx,edx
515
     xor    edx,edx
526
     mov    eax,ecx
516
     mov    eax,ecx
527
     mov    ebx,80
517
     mov    ebx,80
528
     div    ebx
518
     div    ebx
529
     cmp    edx,0
519
     cmp    edx,0
530
     jne    ebol
520
     jne    ebol
531
     mov    [pos],ecx
521
     mov    [pos],ecx
532
     jmp    cmd_done
522
     jmp    cmd_done
533
    no_beg_line:
523
    no_beg_line:
534
   no_erase_end_of_line:
524
   no_erase_end_of_line:
535
   
525
   
536
     cmp    bl,'J'			    ; ERASE TO END OF SCREEN
526
     cmp    bl,'J'			    ; ERASE TO END OF SCREEN
537
     jne    no_erase_to_end_of_screen
527
     jne    no_erase_to_end_of_screen
538
     cmp    [escnumbers],dword 0
528
     cmp    [escnumbers],dword 0
539
     jne    no_erase_to_end_of_screen
529
     jne    no_erase_to_end_of_screen
540
     mov    ecx,[pos]
530
     mov    ecx,[pos]
541
   eteos:
531
   eteos:
542
     mov    [ecx+text],byte ' '
532
     mov    [ecx+text],byte ' '
543
     mov    [ecx+text+60*80],byte 0
533
     mov    [ecx+text+60*80],byte 0
544
     add    ecx,1
534
     add    ecx,1
545
     cmp    ecx,80*24+1
535
     cmp    ecx,80*24+1
546
     jb     eteos
536
     jb     eteos
547
     jmp    cmd_done
537
     jmp    cmd_done
548
   no_erase_to_end_of_screen:
538
   no_erase_to_end_of_screen:
549
   
539
   
550
     cmp    bl,'r'			     ; SET SCROLL REGION
540
     cmp    bl,'r'			     ; SET SCROLL REGION
551
     jne    no_scroll_region
541
     jne    no_scroll_region
552
     mov    eax,[escnumbers]
542
     mov    eax,[escnumbers]
553
     dec    eax
543
     dec    eax
554
     mov    [scroll+0],eax
544
     mov    [scroll+0],eax
555
     mov    eax,[escnumbers+4]
545
     mov    eax,[escnumbers+4]
556
     mov    [scroll+4],eax
546
     mov    [scroll+4],eax
557
     jmp    cmd_done
547
     jmp    cmd_done
558
   no_scroll_region:
548
   no_scroll_region:
559
   
549
   
560
     cmp    bl,'A'			      ; CURSOR UP
550
     cmp    bl,'A'			      ; CURSOR UP
561
     jne    no_cursor_up
551
     jne    no_cursor_up
562
     mov    eax,[pos]
552
     mov    eax,[pos]
563
     sub    eax,80
553
     sub    eax,80
564
     mov    [pos],eax
554
     mov    [pos],eax
565
     jmp    cmd_done
555
     jmp    cmd_done
566
   no_cursor_up:
556
   no_cursor_up:
567
   
557
   
568
     cmp    bl,'C'			      ; CURSOR LEFT
558
     cmp    bl,'C'			      ; CURSOR LEFT
569
     jne    no_cursor_left
559
     jne    no_cursor_left
570
     mov    eax,[pos]
560
     mov    eax,[pos]
571
     mov    ebx,[escnumbers]
561
     mov    ebx,[escnumbers]
572
     sub    eax,ebx
562
     sub    eax,ebx
573
     mov    [pos],eax
563
     mov    [pos],eax
574
     call   cmd_done
564
     call   cmd_done
575
   no_cursor_left:
565
   no_cursor_left:
576
   
566
   
577
     cmp    bl,'m'			     ; CHARACTER ATTRIBUTE
567
     cmp    bl,'m'			     ; CHARACTER ATTRIBUTE
578
     jne    no_char_attribute
568
     jne    no_char_attribute
579
     mov    eax,[escnumbers]
569
     mov    eax,[escnumbers]
580
     mov    [attribute],eax
570
     mov    [attribute],eax
581
     jmp    cmd_done
571
     jmp    cmd_done
582
   no_char_attribute:
572
   no_char_attribute:
583
   
573
   
584
     cmp    bl,'Z'			      ; TERMINAL TYPE
574
     cmp    bl,'Z'			      ; TERMINAL TYPE
585
     jne    no_terminal_type
575
     jne    no_terminal_type
586
     mov    al,27
576
     mov    al,27
587
     call   to_modem
577
     call   to_modem
588
     mov    al,'?'
578
     mov    al,'?'
589
     call   to_modem
579
     call   to_modem
590
     mov    al,'1'
580
     mov    al,'1'
591
     call   to_modem
581
     call   to_modem
592
     mov    al,';'
582
     mov    al,';'
593
     call   to_modem
583
     call   to_modem
594
     mov    al,'0'
584
     mov    al,'0'
595
     call   to_modem
585
     call   to_modem
596
     mov    al,'c'
586
     mov    al,'c'
597
     call   to_modem
587
     call   to_modem
598
     jmp    cmd_done
588
     jmp    cmd_done
599
   no_terminal_type:
589
   no_terminal_type:
600
   
590
   
601
   dontunderstand:
591
   dontunderstand:
602
   
592
   
603
   cmd_done:
593
   cmd_done:
604
   
594
   
605
     ret
595
     ret
606
   
596
   
607
   
597
   
608
draw_numbers:
598
draw_numbers:
609
   
599
   
610
     pusha
600
     pusha
611
   
601
   
612
     mov  eax,13
602
     mov  eax,13
613
     mov  ebx,250*65536+100
603
     mov  ebx,250*65536+100
614
     mov  ecx,8*65536+8
604
     mov  ecx,8*65536+8
615
     mov  edx,0x000000
605
     mov  edx,0x000000
616
     mcall
606
     mcall
617
   
607
   
618
     mov  eax,[escnumbers]
608
     mov  eax,[escnumbers]
619
     xor  edx,edx
609
     xor  edx,edx
620
     mov  ebx,10
610
     mov  ebx,10
621
     div  ebx
611
     div  ebx
622
     add  eax,48
612
     add  eax,48
623
     add  edx,48
613
     add  edx,48
624
     mov  byte [numtext+0],al
614
     mov  byte [numtext+0],al
625
     mov  byte [numtext+1],dl
615
     mov  byte [numtext+1],dl
626
   
616
   
627
     mov  eax,[escnumbers+4]
617
     mov  eax,[escnumbers+4]
628
     xor  edx,edx
618
     xor  edx,edx
629
     mov  ebx,10
619
     mov  ebx,10
630
     div  ebx
620
     div  ebx
631
     add  eax,48
621
     add  eax,48
632
     add  edx,48
622
     add  edx,48
633
     mov  [numtext+3],al
623
     mov  [numtext+3],al
634
     mov  [numtext+4],dl
624
     mov  [numtext+4],dl
635
   
625
   
636
     mov  eax,4
626
     mov  eax,4
637
     mov  ebx,250*65536+8
627
     mov  ebx,250*65536+8
638
     mov  ecx,0xffffff
628
     mov  ecx,0xffffff
639
     mov  edx,numtext
629
     mov  edx,numtext
640
     mov  esi,10
630
     mov  esi,10
641
     mcall
631
     mcall
642
   
632
   
643
     popa
633
     popa
644
   
634
   
645
     ret
635
     ret
646
   
636
   
647
draw_event:
637
draw_event:
648
   
638
   
649
     pusha
639
     pusha
650
   
640
   
651
     mov  eax,13
641
     mov  eax,13
652
     mov  ebx,150*65536+100
642
     mov  ebx,150*65536+100
653
     mov  ecx,8*65536+8
643
     mov  ecx,8*65536+8
654
     mov  edx,0xffffff
644
     mov  edx,0xffffff
655
     mcall
645
     mcall
656
   
646
   
657
     mov  eax,4
647
     mov  eax,4
658
     mov  ebx,150*65536+8
648
     mov  ebx,150*65536+8
659
     mov  ecx,0x000000
649
     mov  ecx,0x000000
660
     mov  edx,esccmd
650
     mov  edx,esccmd
661
     mov  esi,20
651
     mov  esi,20
662
     mcall
652
     mcall
663
   
653
   
664
     popa
654
     popa
665
     ret
655
     ret
666
   
656
   
667
   
657
   
668
get_numbers:
658
get_numbers:
669
   
659
   
670
     pusha
660
     pusha
671
   
661
   
672
     mov   [escnumbers+0],0
662
     mov   [escnumbers+0],0
673
     mov   [escnumbers+4],0
663
     mov   [escnumbers+4],0
674
     mov   [escnumbers+8],0
664
     mov   [escnumbers+8],0
675
     mov   ecx,esccmd
665
     mov   ecx,esccmd
676
     cmp   [ecx+1],byte '0'
666
     cmp   [ecx+1],byte '0'
677
     jb    gn_over
667
     jb    gn_over
678
     cmp   [ecx+1],byte '9'
668
     cmp   [ecx+1],byte '9'
679
     jg    gn_over
669
     jg    gn_over
680
     mov   edi,escnumbers
670
     mov   edi,escnumbers
681
   gn_new:
671
   gn_new:
682
     add   ecx,1
672
     add   ecx,1
683
     movzx eax,byte [ecx]
673
     movzx eax,byte [ecx]
684
     sub   eax,48
674
     sub   eax,48
685
     add   ecx,1
675
     add   ecx,1
686
     cmp   [ecx],byte '0'
676
     cmp   [ecx],byte '0'
687
     jb    gnl1
677
     jb    gnl1
688
     cmp   [ecx],byte '9'
678
     cmp   [ecx],byte '9'
689
     jg    gnl1
679
     jg    gnl1
690
     mov   ebx,10
680
     mov   ebx,10
691
     xor   edx,edx
681
     xor   edx,edx
692
     mul   ebx
682
     mul   ebx
693
     movzx ebx,byte[ecx]
683
     movzx ebx,byte[ecx]
694
     add   eax,ebx
684
     add   eax,ebx
695
     sub   eax,48
685
     sub   eax,48
696
     add   ecx,1
686
     add   ecx,1
697
   gnl1:
687
   gnl1:
698
     mov   [edi],eax
688
     mov   [edi],eax
699
     add   edi,4
689
     add   edi,4
700
     cmp   [ecx],byte ';'
690
     cmp   [ecx],byte ';'
701
     je    gn_new
691
     je    gn_new
702
  gn_over:
692
  gn_over:
703
     popa
693
     popa
704
     ret
694
     ret
705
   
695
   
706
   
696
   
707
   
697
   
708
   
698
   
709
; DATA AREA
699
; DATA AREA
710
   
700
   
711
   
701
   
712
pos	    dd	80*10
702
pos	    dd	80*10
713
irc_data    dd	0x0
703
irc_data    dd	0x0
714
print	    db	0x0
704
print	    db	0x0
715
attribute   dd	0
705
attribute   dd	0
716
scroll	    dd	1
706
scroll	    dd	1
717
	    dd	24
707
	    dd	24
718
numtext     db	'                     '
708
numtext     db	'                     '
719
esccmd	    dd	0,0,0,0,0,0,0,0,0,0,0,0,0
709
esccmd	    dd	0,0,0,0,0,0,0,0,0,0,0,0,0
720
escend	    db	'ZrhlABCDHfDME=>NmKJgincoyq',0
710
escend	    db	'ZrhlABCDHfDME=>NmKJgincoyq',0
721
escnumbers  dd	0,0,0,0,0
711
escnumbers  dd	0,0,0,0,0
722
wcolor	    dd	0x000000
712
wcolor	    dd	0x000000
723
title	    db	'TERMINAL FOR MODEM IN COM1  0.03',0
713
title	    db	'TERMINAL FOR MODEM IN COM1  0.03',0
724
   
714
   
725
text:
715
text:
726
db '                                                                   '
716
db '                                                                   '
727
db '             '
717
db '             '
728
db '*** A TELNET APPLICATION FOR HAYES COMPATIBLE MODEMS IN COM1       '
718
db '*** A TELNET APPLICATION FOR HAYES COMPATIBLE MODEMS IN COM1       '
729
db '             '
719
db '             '
730
db '*** USE HAYES COMMANDS TO CONNECT TO A SERVER                      '
720
db '*** USE HAYES COMMANDS TO CONNECT TO A SERVER                      '
731
db '             '
721
db '             '
732
db '*** ATDT (PHONENUMBER)                                             '
722
db '*** ATDT (PHONENUMBER)                                             '
733
db '             '
723
db '             '
734
db '                                                                   '
724
db '                                                                   '
735
db '             '
725
db '             '
736
   
726
   
737
I_END:
727
I_END:
738
-
 
739
728