Subversion Repositories Kolibri OS

Rev

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

Rev 4462 Rev 7548
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                                 ;;
2
;;                                                                 ;;
3
;; Copyright (C) KolibriOS team 2014. All rights reserved.         ;;
3
;; Copyright (C) KolibriOS team 2014. All rights reserved.         ;;
4
;; Distributed under terms of the GNU General Public License       ;;
4
;; Distributed under terms of the GNU General Public License       ;;
5
;;                                                                 ;;
5
;;                                                                 ;;
6
;;  terminal for KolibriOS                                         ;;
6
;;  terminal for KolibriOS                                         ;;
7
;;                                                                 ;;
7
;;                                                                 ;;
8
;;  Written by hidnplayr@kolibrios.org                             ;;
8
;;  Written by hidnplayr@kolibrios.org                             ;;
9
;;                                                                 ;;
9
;;                                                                 ;;
10
;;          GNU GENERAL PUBLIC LICENSE                             ;;
10
;;          GNU GENERAL PUBLIC LICENSE                             ;;
11
;;             Version 2, June 1991                                ;;
11
;;             Version 2, June 1991                                ;;
12
;;                                                                 ;;
12
;;                                                                 ;;
13
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
13
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
14
 
14
 
15
format binary as ""
15
format binary as ""
16
 
16
 
17
use32
17
use32
18
        org     0x0
18
        org     0x0
19
 
19
 
20
        db      'MENUET01'
20
        db      'MENUET01'
21
        dd      0x1
21
        dd      0x1
22
        dd      START
22
        dd      START
23
        dd      I_END
23
        dd      I_END
24
        dd      IM_END+0x1000
24
        dd      IM_END+0x1000
25
        dd      IM_END+0x1000
25
        dd      IM_END+0x1000
26
        dd      0, 0
26
        dd      0, 0
27
 
27
 
28
include '../../proc32.inc'
28
include '../../proc32.inc'
29
include '../../macros.inc'
29
include '../../macros.inc'
30
include '../../dll.inc'
30
include '../../dll.inc'
31
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
31
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
32
 
32
 
33
 
33
 
34
START:
34
START:
35
 
35
 
36
        mcall   68, 11
36
        mcall   68, 11
37
 
37
 
38
        stdcall dll.Load, @IMPORT
38
        stdcall dll.Load, @IMPORT
39
        or      eax, eax
39
        or      eax, eax
40
        jnz     exit
40
        jnz     exit
41
 
41
 
42
        mcall   40, EVM_MOUSE + EVM_MOUSE_FILTER + EVM_REDRAW + EVM_BUTTON + EVM_KEY
42
        mcall   40, EVM_MOUSE + EVM_MOUSE_FILTER + EVM_REDRAW + EVM_BUTTON + EVM_KEY
43
 
43
 
44
        invoke  init_checkbox, ch1
44
        invoke  init_checkbox, ch1
45
 
45
 
46
red_win:
46
red_win:
47
        call draw_window
47
        call draw_window
48
 
48
 
49
mainloop:
49
mainloop:
50
        mcall   10
50
        mcall   10
51
 
51
 
52
        dec     eax
52
        dec     eax
53
        jz      red_win
53
        jz      red_win
54
 
54
 
55
        dec     eax
55
        dec     eax
56
        jz      key
56
        jz      key
57
 
57
 
58
        dec     eax
58
        dec     eax
59
        jz      button
59
        jz      button
60
 
60
 
61
        invoke  edit_box_mouse, edit1
61
        invoke  edit_box_mouse, edit1
62
        invoke  edit_box_mouse, edit2
62
        invoke  edit_box_mouse, edit2
63
        invoke  edit_box_mouse, edit3
63
        invoke  edit_box_mouse, edit3
64
        invoke  edit_box_mouse, edit4
64
        invoke  edit_box_mouse, edit4
65
 
65
 
66
        invoke  option_box_mouse, Option_boxs1
66
        invoke  option_box_mouse, Option_boxs1
67
        invoke  option_box_mouse, Option_boxs2
67
        invoke  option_box_mouse, Option_boxs2
68
 
68
 
69
        invoke  check_box_mouse, ch1
69
        invoke  check_box_mouse, ch1
70
 
70
 
71
        jmp     mainloop
71
        jmp     mainloop
72
 
72
 
73
button:
73
button:
74
        mcall   17
74
        mcall   17
75
 
75
 
76
        cmp     ah, 0x10        ; connect button
76
        cmp     ah, 0x10        ; connect button
77
        je      open_connection
77
        je      open_connection
78
 
78
 
79
        test    ah , ah
79
        test    ah , ah
80
        jz      mainloop
80
        jz      mainloop
81
exit:
81
exit:
82
        mcall   -1
82
        mcall   -1
83
 
83
 
84
key:
84
key:
85
        mcall   2
85
        mcall   2
86
 
86
 
87
        cmp     ah, 13          ; enter key
87
        cmp     ah, 13          ; enter key
88
        je      open_connection
88
        je      open_connection
89
 
89
 
90
        invoke  edit_box_key, edit1
90
        invoke  edit_box_key, edit1
91
        invoke  edit_box_key, edit2
91
        invoke  edit_box_key, edit2
92
        invoke  edit_box_key, edit3
92
        invoke  edit_box_key, edit3
93
        invoke  edit_box_key, edit4
93
        invoke  edit_box_key, edit4
94
 
94
 
95
        jmp     mainloop
95
        jmp     mainloop
96
 
96
 
97
 
97
 
98
 
98
 
99
draw_window:
99
draw_window:
100
; get system colors
100
; get system colors
101
        mcall   48, 3, sc, 40
101
        mcall   48, 3, sc, 40
102
 
102
 
103
        mcall   12,1
103
        mcall   12,1
104
        mov     edx, [sc.work]
104
        mov     edx, [sc.work]
105
        or      edx, 0x34000000
105
        or      edx, 0x34000000
106
        xor     esi, esi
106
        xor     esi, esi
107
        mov     edi, str_title
107
        mov     edi, str_title
108
        mcall   0, 50 shl 16 + 400, 30 shl 16 + 180
108
        mcall   0, 50 shl 16 + 415, 30 shl 16 + 195
109
 
109
 
110
        mov     ebx, 5 shl 16 + 15
110
        mov     ebx, 5 shl 16 + 12
111
        mov     ecx, 0x80000000
111
        mov     ecx, 0x90000000
112
        or      ecx, [sc.work_text]
112
        or      ecx, [sc.work_text]
113
        mov     edx, str_port
113
        mov     edx, str_port
114
        mcall   4
114
        mcall   4
115
        mov     ebx, 5 shl 16 + 35
115
        add     ebx, 25
116
        mov     edx, str_speed
116
        mov     edx, str_speed
117
        mcall
117
        mcall
118
        mov     ebx, 5 shl 16 + 55
118
        add     ebx, 25
119
        mov     edx, str_data
119
        mov     edx, str_data
120
        mcall
120
        mcall
121
        mov     ebx, 5 shl 16 + 75
121
        add     ebx, 25
122
        mov     edx, str_stop
122
        mov     edx, str_stop
123
        mcall
123
        mcall
124
 
124
 
125
        mov     ebx, 180 shl 16 + 10
125
        mov     ebx, 195 shl 16 + 12
126
        mov     edx, str_parity
126
        mov     edx, str_parity
127
        mcall
127
        mcall
128
        mov     ebx, 270 shl 16 + 10
128
        mov     ebx, 280 shl 16 + 12
129
        mov     edx, str_flow
129
        mov     edx, str_flow
130
        mcall
130
        mcall
-
 
131
 
131
 
132
		edit_boxes_set_sys_color edit1,editboxes_end,sc
132
        invoke  edit_box_draw, edit1
133
        invoke  edit_box_draw, edit1
133
        invoke  edit_box_draw, edit2
134
        invoke  edit_box_draw, edit2
134
        invoke  edit_box_draw, edit3
135
        invoke  edit_box_draw, edit3
135
        invoke  edit_box_draw, edit4
136
        invoke  edit_box_draw, edit4
-
 
137
 
-
 
138
		option_boxes_set_sys_color sc, Option_boxs1
136
 
139
		option_boxes_set_sys_color sc, Option_boxs2
137
        invoke  option_box_draw, Option_boxs1
140
        invoke  option_box_draw, Option_boxs1
138
        invoke  option_box_draw, Option_boxs2
141
        invoke  option_box_draw, Option_boxs2
-
 
142
 
139
 
143
		check_boxes_set_sys_color2 ch1,ch1_end,sc ;set color
140
        invoke  check_box_draw, ch1
144
        invoke  check_box_draw, ch1
141
 
145
 
142
        mov     esi, [sc.work_button]
146
        mov     esi, [sc.work_button]
143
        mcall   8, 270 shl 16 + 100, 105 shl 16 + 16, 0x10
147
        mcall   8, 280 shl 16 + 100, 115 shl 16 + 22, 0x10
144
 
148
 
145
        mov     ecx, 0x80000000
149
        mov     ecx, 0x90000000
146
        or      ecx, [sc.work_button_text]
150
        or      ecx, [sc.work_button_text]
147
        mcall   4, 300 shl 16 + 110, , str_open
151
        mcall   4, 315 shl 16 + 119, , str_open
148
 
152
 
149
 
153
 
150
        mov     edx, [sc.work_graph]
154
        mov     edx, [sc.work_graph]
151
        mcall   38, 0 shl 16 + 390, 135 shl 16 + 135
155
        mcall   38, 0 shl 16 + 405, 145 shl 16 + 145
152
 
156
 
153
        mov     ecx, 0x80000000
157
        mov     ecx, 0x90000000
154
        or      ecx, [sc.work_text]
158
        or      ecx, [sc.work_text]
155
        mcall   4, 5 shl 16 + 142, , [errormsg]
159
        mcall   4, 5 shl 16 + 150, , [errormsg]
156
 
160
 
157
        mcall   12, 2
161
        mcall   12, 2
158
        ret
162
        ret
159
 
163
 
160
 
164
 
161
open_connection:
165
open_connection:
162
 
166
 
163
        mov     [errormsg], err_none    ; clear previous error message
167
        mov     [errormsg], err_none    ; clear previous error message
164
 
168
 
165
; Read the serial port name, and convert it to a port number
169
; Read the serial port name, and convert it to a port number
166
        cmp     byte[ed_port+4], 0
170
        cmp     byte[ed_port+4], 0
167
        jne     .port_error
171
        jne     .port_error
168
        mov     eax, dword[ed_port]
172
        mov     eax, dword[ed_port]
169
        or      eax, 0x20202020         ; convert to lowercase
173
        or      eax, 0x20202020         ; convert to lowercase
170
        cmp     eax, 'com1'
174
        cmp     eax, 'com1'
171
        je      .com1
175
        je      .com1
172
        cmp     eax, 'com2'
176
        cmp     eax, 'com2'
173
        je      .com2
177
        je      .com2
174
        cmp     eax, 'com3'
178
        cmp     eax, 'com3'
175
        je      .com3
179
        je      .com3
176
        cmp     eax, 'com4'
180
        cmp     eax, 'com4'
177
        je      .com4
181
        je      .com4
178
  .port_error:
182
  .port_error:
179
        mov     [errormsg], err_port
183
        mov     [errormsg], err_port
180
        jmp     red_win
184
        jmp     red_win
181
 
185
 
182
  .com1:
186
  .com1:
183
        mov     [port], 0x3f8
187
        mov     [port], 0x3f8
184
        jmp     .port_ok
188
        jmp     .port_ok
185
  .com2:
189
  .com2:
186
        mov     [port], 0x2f8
190
        mov     [port], 0x2f8
187
        jmp     .port_ok
191
        jmp     .port_ok
188
  .com3:
192
  .com3:
189
        mov     [port], 0x3e8
193
        mov     [port], 0x3e8
190
        jmp     .port_ok
194
        jmp     .port_ok
191
  .com4:
195
  .com4:
192
        mov     [port], 0x2e8
196
        mov     [port], 0x2e8
193
  .port_ok:
197
  .port_ok:
194
 
198
 
195
; reserve the com port so we can work with it
199
; reserve the com port so we can work with it
196
        xor     ebx, ebx
200
        xor     ebx, ebx
197
        movzx   ecx, [port]
201
        movzx   ecx, [port]
198
        mov     edx, ecx
202
        mov     edx, ecx
199
        add     edx, 7
203
        add     edx, 7
200
        mcall   46
204
        mcall   46
201
        test    eax, eax
205
        test    eax, eax
202
        jz      .port_reserved
206
        jz      .port_reserved
203
        mov     [errormsg], err_reserve
207
        mov     [errormsg], err_reserve
204
        jmp     red_win
208
        jmp     red_win
205
  .port_reserved:
209
  .port_reserved:
206
 
210
 
207
; disable com interrupts
211
; disable com interrupts
208
; (We cannot receive them on the application level :( )
212
; (We cannot receive them on the application level :( )
209
        mov     dx, [port]
213
        mov     dx, [port]
210
        inc     dx
214
        inc     dx
211
        mov     al, 0
215
        mov     al, 0
212
        out     dx, al
216
        out     dx, al
213
 
217
 
214
; Set speed:
218
; Set speed:
215
; Convert the ascii decimal number that user entered
219
; Convert the ascii decimal number that user entered
216
; So we can do some math with it
220
; So we can do some math with it
217
        mov     esi, ed_speed
221
        mov     esi, ed_speed
218
        xor     eax, eax
222
        xor     eax, eax
219
        xor     ebx, ebx
223
        xor     ebx, ebx
220
  .convert_loop:
224
  .convert_loop:
221
        lodsb
225
        lodsb
222
        test    al, al
226
        test    al, al
223
        jz      .convert_done
227
        jz      .convert_done
224
        sub     al, '0'
228
        sub     al, '0'
225
        jb      .invalid_speed
229
        jb      .invalid_speed
226
        cmp     al, 9
230
        cmp     al, 9
227
        ja      .invalid_speed
231
        ja      .invalid_speed
228
        lea     ebx, [ebx + 4*ebx]
232
        lea     ebx, [ebx + 4*ebx]
229
        shl     ebx, 1
233
        shl     ebx, 1
230
        add     ebx, eax
234
        add     ebx, eax
231
        jmp     .convert_loop
235
        jmp     .convert_loop
232
  .invalid_speed:
236
  .invalid_speed:
233
        call    free_port
237
        call    free_port
234
        mov     [errormsg], err_speed
238
        mov     [errormsg], err_speed
235
        jmp     red_win
239
        jmp     red_win
236
  .convert_done:
240
  .convert_done:
237
        test    ebx, ebx
241
        test    ebx, ebx
238
        jz      .invalid_speed
242
        jz      .invalid_speed
239
 
243
 
240
; We now have the speed setting in ebx
244
; We now have the speed setting in ebx
241
; calculate the divisor latch value as 115200/ebx
245
; calculate the divisor latch value as 115200/ebx
242
        xor     edx, edx
246
        xor     edx, edx
243
        mov     eax, 115200
247
        mov     eax, 115200
244
        div     ebx
248
        div     ebx
245
        test    edx, edx
249
        test    edx, edx
246
        jnz     .invalid_speed
250
        jnz     .invalid_speed
247
        cmp     eax, 0xffff
251
        cmp     eax, 0xffff
248
        ja      .invalid_speed
252
        ja      .invalid_speed
249
        mov     bx, ax
253
        mov     bx, ax
250
 
254
 
251
; enable Divisor latch
255
; enable Divisor latch
252
        mov     dx, [port]
256
        mov     dx, [port]
253
        add     dx, 3
257
        add     dx, 3
254
        mov     al, 1 shl 7     ; dlab bit
258
        mov     al, 1 shl 7     ; dlab bit
255
        out     dx, al
259
        out     dx, al
256
 
260
 
257
; Set divisor latch value
261
; Set divisor latch value
258
        mov     dx, [port]
262
        mov     dx, [port]
259
        mov     al, bl
263
        mov     al, bl
260
        out     dx, al
264
        out     dx, al
261
        inc     dx
265
        inc     dx
262
        mov     al, bh
266
        mov     al, bh
263
        out     dx, al
267
        out     dx, al
264
 
268
 
265
; Check the parity type
269
; Check the parity type
266
        xor     bl, bl
270
        xor     bl, bl
267
        cmp     [option_group1], op1    ; none
271
        cmp     [option_group1], op1    ; none
268
        je      .parity_ok
272
        je      .parity_ok
269
 
273
 
270
        mov     bl, 001b shl 3
274
        mov     bl, 001b shl 3
271
        cmp     [option_group1], op2    ; odd
275
        cmp     [option_group1], op2    ; odd
272
        je      .parity_ok
276
        je      .parity_ok
273
 
277
 
274
        mov     bl, 011b shl 3
278
        mov     bl, 011b shl 3
275
        cmp     [option_group1], op3    ; even
279
        cmp     [option_group1], op3    ; even
276
        je      .parity_ok
280
        je      .parity_ok
277
 
281
 
278
        mov     bl, 101b shl 3
282
        mov     bl, 101b shl 3
279
        cmp     [option_group1], op4    ; mark
283
        cmp     [option_group1], op4    ; mark
280
        je      .parity_ok
284
        je      .parity_ok
281
 
285
 
282
        mov     bl, 111b shl 3
286
        mov     bl, 111b shl 3
283
        cmp     [option_group1], op5    ; space
287
        cmp     [option_group1], op5    ; space
284
        je      .parity_ok
288
        je      .parity_ok
285
        jmp     exit2                   ; something went terribly wrong
289
        jmp     exit2                   ; something went terribly wrong
286
  .parity_ok:
290
  .parity_ok:
287
 
291
 
288
; Check number of stop bits
292
; Check number of stop bits
289
        cmp     [ed_stop], '1'
293
        cmp     [ed_stop], '1'
290
        je      .stop_ok
294
        je      .stop_ok
291
        cmp     [ed_stop], '2'
295
        cmp     [ed_stop], '2'
292
        jne     .invalid_stop
296
        jne     .invalid_stop
293
        or      bl, 1 shl 2     ; number of stop bits
297
        or      bl, 1 shl 2     ; number of stop bits
294
        jmp     .stop_ok
298
        jmp     .stop_ok
295
  .invalid_stop:
299
  .invalid_stop:
296
        call    free_port
300
        call    free_port
297
        mov     [errormsg], err_stopbits
301
        mov     [errormsg], err_stopbits
298
        jmp     red_win
302
        jmp     red_win
299
  .stop_ok:
303
  .stop_ok:
300
 
304
 
301
; Check number of data bits
305
; Check number of data bits
302
        mov     al, [ed_data]
306
        mov     al, [ed_data]
303
        cmp     al, '8'
307
        cmp     al, '8'
304
        ja      .invalid_data
308
        ja      .invalid_data
305
        sub     al, '5'
309
        sub     al, '5'
306
        jae     .data_ok
310
        jae     .data_ok
307
  .invalid_data:
311
  .invalid_data:
308
        call    free_port
312
        call    free_port
309
        mov     [errormsg], err_databits
313
        mov     [errormsg], err_databits
310
        jmp     red_win
314
        jmp     red_win
311
  .data_ok:
315
  .data_ok:
312
        or      al, bl
316
        or      al, bl
313
; Program data bits, stop bits and parity in the UART
317
; Program data bits, stop bits and parity in the UART
314
        mov     dx, [port]
318
        mov     dx, [port]
315
        add     dx, 3           ; Line Control Register
319
        add     dx, 3           ; Line Control Register
316
        out     dx, al
320
        out     dx, al
317
 
321
 
318
; clear +  enable fifo (64 bytes), 1 byte trigger level
322
; clear +  enable fifo (64 bytes), 1 byte trigger level
319
        mov     dx, [port]
323
        mov     dx, [port]
320
        inc     dx
324
        inc     dx
321
        inc     dx
325
        inc     dx
322
        mov     al, 0x7 + 1 shl 5
326
        mov     al, 0x7 + 1 shl 5
323
        out     dx, al
327
        out     dx, al
324
 
328
 
325
; flow control
329
; flow control
326
        mov     dx, [port]
330
        mov     dx, [port]
327
        add     dx, 4
331
        add     dx, 4
328
        mov     al, 0xb
332
        mov     al, 0xb
329
        out     dx, al
333
        out     dx, al
330
 
334
 
331
; Hide our GUI window and open the console
335
; Hide our GUI window and open the console
332
        mcall   40, 0           ; disable all events
336
        mcall   40, 0           ; disable all events
333
        mcall   67, 0, 0, 0, 0  ; hide window
337
        mcall   67, 0, 0, 0, 0  ; hide window
334
        mcall   12, 1
338
        mcall   12, 1
335
        mcall   12, 2
339
        mcall   12, 2
336
 
340
 
337
        invoke  con_start, 1
341
        invoke  con_start, 1
338
        invoke  con_init, 80, 25, 80, 25, str_title
342
        invoke  con_init, 80, 25, 80, 25, str_title
339
 
343
 
340
console_loop:
344
console_loop:
341
        mcall   5, 1            ; wait 10 ms
345
        mcall   5, 1            ; wait 10 ms
342
 
346
 
343
        invoke  con_get_flags
347
        invoke  con_get_flags
344
        test    eax, 0x200      ; con window closed?
348
        test    eax, 0x200      ; con window closed?
345
        jnz     exit2
349
        jnz     exit2
346
 
350
 
347
  .tx_loop:
351
  .tx_loop:
348
        invoke  con_kbhit
352
        invoke  con_kbhit
349
        test    eax, eax        ; did user press a key?
353
        test    eax, eax        ; did user press a key?
350
        jz      .rx_loop
354
        jz      .rx_loop
351
 
355
 
352
        invoke  con_getch2      ; get the pressed key from buffer
356
        invoke  con_getch2      ; get the pressed key from buffer
353
        mov     dx, [port]
357
        mov     dx, [port]
354
        out     dx, al
358
        out     dx, al
355
 
359
 
356
        test    [ch1.flags], ch_flag_en ; does user want us to echo locally?
360
        test    [ch1.flags], ch_flag_en ; does user want us to echo locally?
357
        je      .tx_loop
361
        je      .tx_loop
358
 
362
 
359
        and     eax, 0xff
363
        and     eax, 0xff
360
        push    eax
364
        push    eax
361
        invoke  con_write_asciiz, esp   ; print the character
365
        invoke  con_write_asciiz, esp   ; print the character
362
        pop     eax
366
        pop     eax
363
        jmp     .tx_loop
367
        jmp     .tx_loop
364
 
368
 
365
  .rx_loop:
369
  .rx_loop:
366
        mov     dx, [port]
370
        mov     dx, [port]
367
        add     dx, 5           ; Line status register
371
        add     dx, 5           ; Line status register
368
        in      al, dx
372
        in      al, dx
369
        test    al, 1           ; Data ready?
373
        test    al, 1           ; Data ready?
370
        jz      console_loop
374
        jz      console_loop
371
 
375
 
372
        mov     dx, [port]      ; Read character from buffer
376
        mov     dx, [port]      ; Read character from buffer
373
        in      al, dx
377
        in      al, dx
374
 
378
 
375
        and     eax, 0xff
379
        and     eax, 0xff
376
        push    eax
380
        push    eax
377
        invoke  con_write_asciiz, esp   ; print the character
381
        invoke  con_write_asciiz, esp   ; print the character
378
        pop     eax
382
        pop     eax
379
 
383
 
380
        jmp     .rx_loop
384
        jmp     .rx_loop
381
 
385
 
382
 
386
 
383
exit2:
387
exit2:
384
 
388
 
385
        call    free_port
389
        call    free_port
386
        mcall   -1      ; exit
390
        mcall   -1      ; exit
387
 
391
 
388
free_port:
392
free_port:
389
 
393
 
390
        xor     ebx, ebx
394
        xor     ebx, ebx
391
        inc     ebx
395
        inc     ebx
392
        movzx   ecx, [port]
396
        movzx   ecx, [port]
393
        mov     edx, ecx
397
        mov     edx, ecx
394
        add     edx, 7
398
        add     edx, 7
395
        mcall   46
399
        mcall   46
396
 
400
 
397
        ret
401
        ret
398
 
402
 
399
;-------------------------
403
;-------------------------
400
; DATA
404
; DATA
401
 
405
 
402
align 16
406
align 16
403
@IMPORT:
407
@IMPORT:
404
 
408
 
405
library box_lib, 'box_lib.obj',\
409
library box_lib, 'box_lib.obj',\
406
        console, 'console.obj'
410
        console, 'console.obj'
407
 
411
 
408
import  box_lib,\
412
import  box_lib,\
409
        edit_box_draw,          'edit_box',\
413
        edit_box_draw,          'edit_box',\
410
        edit_box_key,           'edit_box_key',\
414
        edit_box_key,           'edit_box_key',\
411
        edit_box_mouse,         'edit_box_mouse',\
415
        edit_box_mouse,         'edit_box_mouse',\
412
        init_checkbox,          'init_checkbox2',\
416
        init_checkbox,          'init_checkbox2',\
413
        check_box_draw,         'check_box_draw2',\
417
        check_box_draw,         'check_box_draw2',\
414
        check_box_mouse,        'check_box_mouse2',\
418
        check_box_mouse,        'check_box_mouse2',\
415
        option_box_draw,        'option_box_draw',\
419
        option_box_draw,        'option_box_draw',\
416
        option_box_mouse,       'option_box_mouse'
420
        option_box_mouse,       'option_box_mouse'
417
 
421
 
418
import  console,\
422
import  console,\
419
        con_start,              'START',\
423
        con_start,              'START',\
420
        con_init,               'con_init',\
424
        con_init,               'con_init',\
421
        con_exit,               'con_exit',\
425
        con_exit,               'con_exit',\
422
        con_getch2,             'con_getch2',\
426
        con_getch2,             'con_getch2',\
423
        con_write_asciiz,       'con_write_asciiz',\
427
        con_write_asciiz,       'con_write_asciiz',\
424
        con_get_flags,          'con_get_flags',\
428
        con_get_flags,          'con_get_flags',\
425
        con_kbhit,              'con_kbhit'
429
        con_kbhit,              'con_kbhit'
426
 
430
 
427
edit1   edit_box 60, 90, 10, 0xffffff, 0x6f9480, 0, 0, 0, 8, ed_port, mouse_dd, ed_focus, 4, 4
431
edit1   edit_box 60, 112, 10, 0xffffff, 0x6f9480, 0, 0, 0x10000000, 8, ed_port, mouse_dd, ed_focus, 4, 4
428
edit2   edit_box 60, 90, 30, 0xffffff, 0x6a9480, 0, 0, 0, 7, ed_speed, mouse_dd, ed_figure_only, 4, 4
432
edit2   edit_box 60, 112, 35, 0xffffff, 0x6a9480, 0, 0, 0x10000000, 7, ed_speed, mouse_dd, ed_figure_only, 4, 4
429
edit3   edit_box 60, 90, 50, 0xffffff, 0x6a9480, 0, 0, 0, 1, ed_data, mouse_dd, ed_figure_only, 1, 1
433
edit3   edit_box 60, 112, 60, 0xffffff, 0x6a9480, 0, 0, 0x10000000, 1, ed_data, mouse_dd, ed_figure_only, 1, 1
-
 
434
edit4   edit_box 60, 112, 85, 0xffffff, 0x6a9480, 0, 0, 0x10000000, 1, ed_stop, mouse_dd, ed_figure_only, 1, 1
430
edit4   edit_box 60, 90, 70, 0xffffff, 0x6a9480, 0, 0, 0, 1, ed_stop, mouse_dd, ed_figure_only, 1, 1
435
editboxes_end:
431
 
436
 
432
ed_port         db "COM1",0,0,0,0,0,0
437
ed_port         db "COM1",0,0,0,0,0,0
433
ed_speed        db "9600",0,0,0
438
ed_speed        db "9600",0,0,0
434
ed_data         db "8",0
439
ed_data         db "8",0
435
ed_stop         db "1",0
440
ed_stop         db "1",0
436
 
441
 
437
option_group1   dd op1
442
option_group1   dd op1
438
op1     option_box option_group1, 180, 27, 6, 12, 0xffffff, 0, 0, str_none, 4
443
op1     option_box option_group1, 195, 30, 6, 12, 0xffffff, 0, 0, str_none, 4
439
op2     option_box option_group1, 180, 44, 6, 12, 0xffffff, 0, 0, str_odd, 3
444
op2     option_box option_group1, 195, 47, 6, 12, 0xffffff, 0, 0, str_odd, 3
440
op3     option_box option_group1, 180, 61, 6, 12, 0xffffff, 0, 0, str_even, 4
445
op3     option_box option_group1, 195, 64, 6, 12, 0xffffff, 0, 0, str_even, 4
441
op4     option_box option_group1, 180, 78, 6, 12, 0xffffff, 0, 0, str_mark, 4
446
op4     option_box option_group1, 195, 81, 6, 12, 0xffffff, 0, 0, str_mark, 4
442
op5     option_box option_group1, 180, 95, 6, 12, 0xffffff, 0, 0, str_space, 5
447
op5     option_box option_group1, 195, 98, 6, 12, 0xffffff, 0, 0, str_space, 5
443
 
448
 
444
option_group2   dd op6
449
option_group2   dd op6
445
op6     option_box option_group2, 270, 27, 6, 12, 0xffffff, 0, 0, str_none, 4
450
op6     option_box option_group2, 280, 30, 6, 12, 0xffffff, 0, 0, str_none, 4
446
;op7     option_box option_group2, 270, 44, 6, 12, 0xffffff, 0, 0, str_xon, 8, 10b
451
;op7     option_box option_group2, 270, 44, 6, 12, 0xffffff, 0, 0, str_xon, 8, 10b
447
;op8     option_box option_group2, 270, 61, 6, 12, 0xffffff, 0, 0, str_rts, 7, 1b
452
;op8     option_box option_group2, 270, 61, 6, 12, 0xffffff, 0, 0, str_rts, 7, 1b
448
;op9     option_box option_group2, 270, 78, 6, 12, 0xffffff, 0, 0, str_dsr, 7
453
;op9     option_box option_group2, 270, 78, 6, 12, 0xffffff, 0, 0, str_dsr, 7
449
 
454
 
-
 
455
ch1     check_box2 5 shl 16 + 12, 119 shl 16 + 12, 5, 0xffffff, 0x000000, 0, str_echo, ch_flag_middle
450
ch1     check_box2 5 shl 16 + 12, 105 shl 16 + 12, 5, 0xffffff, 0x000000, 0x000000, str_echo, ch_flag_middle
456
ch1_end:
451
 
457
 
452
Option_boxs1    dd op1, op2, op3, op4, op5, 0
458
Option_boxs1    dd op1, op2, op3, op4, op5, 0
453
Option_boxs2    dd op6, 0 ;op7, op8, op9, 0
459
Option_boxs2    dd op6, 0 ;op7, op8, op9, 0
454
 
460
 
455
str_title       db 'Terminal', 0
461
str_title       db 'Terminal', 0
456
str_port        db 'Serial port:', 0
462
str_port        db 'Serial port:', 0
457
str_speed       db 'Speed (baud):', 0
463
str_speed       db 'Speed (baud):', 0
458
str_data        db 'Data bits:', 0
464
str_data        db 'Data bits:', 0
459
str_parity      db 'Parity:', 0
465
str_parity      db 'Parity:', 0
460
str_flow        db 'Flow control:', 0
466
str_flow        db 'Flow control:', 0
461
str_stop        db 'Stop bits:', 0
467
str_stop        db 'Stop bits:', 0
462
 
468
 
463
str_open        db 'Open', 0
469
str_open        db 'Open', 0
464
 
470
 
465
str_none        db 'None'
471
str_none        db 'None'
466
str_odd         db 'Odd'
472
str_odd         db 'Odd'
467
str_even        db 'Even'
473
str_even        db 'Even'
468
str_mark        db 'Mark'
474
str_mark        db 'Mark'
469
str_space       db 'Space'
475
str_space       db 'Space'
470
;str_xon         db 'XON/XOFF'
476
;str_xon         db 'XON/XOFF'
471
;str_rts         db 'RTS/CTS'
477
;str_rts         db 'RTS/CTS'
472
;str_dsr         db 'DSR/DTR'
478
;str_dsr         db 'DSR/DTR'
473
 
479
 
474
str_echo        db 'Local echo', 0
480
str_echo        db 'Local echo', 0
475
 
481
 
476
errormsg        dd err_none
482
errormsg        dd err_none
477
err_none        db 0
483
err_none        db 0
478
err_port        db 'Invalid serial port.', 0
484
err_port        db 'Invalid serial port.', 0
479
err_reserve     db 'The port is already in use.', 0
485
err_reserve     db 'The port is already in use.', 0
480
err_speed       db 'Incorrect speed setting.', 0
486
err_speed       db 'Incorrect speed setting.', 0
481
err_stopbits    db 'Invalid number of stop bits. Must be 1 or 2.', 0
487
err_stopbits    db 'Invalid number of stop bits. Must be 1 or 2.', 0
482
err_databits    db 'Invalid number of data bits. Must be between 5 and 8.', 0
488
err_databits    db 'Invalid number of data bits. Must be between 5 and 8.', 0
483
 
489
 
484
I_END:
490
I_END:
485
 
491
 
486
mouse_dd        dd ?
492
mouse_dd        dd ?
487
echo            db ?
493
echo            db ?
488
port            dw ?
494
port            dw ?
489
sc              system_colors
495
sc              system_colors
490
 
496
 
491
IM_END:
497
IM_END: