Subversion Repositories Kolibri OS

Rev

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

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