Subversion Repositories Kolibri OS

Rev

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

Rev 111 Rev 122
1
; SYSTEM HAEDER:
1
; SYSTEM HEADER:
2
   use32
2
   use32
3
   org 0x0
3
   org 0x0
4
   db  'MENUET01'  ; identifier
4
   db  'MENUET01'  ; identifier
5
   dd  0x01        ; version
5
   dd  0x01        ; version
6
   dd  START       ; pointer to start
6
   dd  START       ; pointer to start
7
   dd  TINYPAD_END ; size of file
7
   dd  TINYPAD_END ; size of file
8
   dd  0x300f00 ;0x500000; 0x3fff00;0x300000    ; size of memory
8
   dd  0x300f00 ;0x500000; 0x3fff00;0x300000    ; size of memory
9
   dd  0xeff0 ;0x4fffff ;0x3ff000;0xeff0      ; esp
9
   dd  0xeff0 ;0x4fffff ;0x3ff000;0xeff0      ; esp
10
   dd  I_PARAM     ; parameters
10
   dd  I_PARAM     ; parameters
11
   dd  0           ; reserved
11
   dd  0           ; reserved
12
include 'lang.inc'
-
 
13
include 'ascl.inc'
12
include 'ascl.inc'
-
 
13
include 'lang.inc'
14
include 'macros.inc' ; useful stuff
14
include 'macros.inc' ; useful stuff
15
include 'dialogs1.inc'
15
include 'dialogs1.inc'
16
include 'scroll.inc'
16
include 'scroll.inc'
17
;include 'debug.inc'
17
include 'debug.inc'
18
purge mov            ;  SPEED
18
purge mov            ;  SPEED
19
;******************************************************************************
19
;******************************************************************************
20
; INITIALIZING
20
; INITIALIZING
21
START:
21
START:
22
;debug_print_hex TINYPAD_END
22
;debug_print_hex TINYPAD_END
23
call mask_events
23
call mask_events
24
 
24
 
25
    cmp    [I_PARAM],byte 0
25
    cmp    [I_PARAM],byte 0
26
    jz     noparams
26
    jz     noparams
-
 
27
 
-
 
28
;//Willow
-
 
29
    cmp    byte[I_PARAM],'*'
-
 
30
    jne    .noipc
-
 
31
; convert size from decimal representation to dword
-
 
32
        mov     esi, I_PARAM+1
-
 
33
        xor     edx, edx
-
 
34
        xor     eax, eax
-
 
35
@@:
-
 
36
        lodsb
-
 
37
        test    al, al
-
 
38
        jz      @f
-
 
39
        lea     edx, [edx*4+edx]
-
 
40
        lea     edx, [edx*2+eax]
-
 
41
        jmp     @b
-
 
42
@@:
-
 
43
    add    edx,20
-
 
44
    mcall  60,1,0x10000-16
-
 
45
    mov    dword[0x10000+-16+4],8
-
 
46
    mcall  40,1000000b
-
 
47
    mcall  23,200
-
 
48
;    dpd    eax
-
 
49
    cmp    eax,7
-
 
50
    jne    exit_now
-
 
51
    mov    esi,0x10000-16
-
 
52
    mov    byte[esi],1
-
 
53
    call   mask_events
-
 
54
    mov    eax,[esi+12]
-
 
55
    inc    eax
-
 
56
    call   file_found
-
 
57
    jmp    do_load_file.restorecursor
-
 
58
  .noipc:
27
 
59
;//Willow
28
    ; parameters are at I_PARAM
60
    ; parameters are at I_PARAM
29
    mov    esi,I_PARAM
61
    mov    esi,I_PARAM
30
    mov    edi,filename
62
    mov    edi,filename
31
    mov    ecx,50
63
    mov    ecx,50
32
    cld
64
    cld
33
    rep    movsb
65
    rep    movsb
34
 
66
 
35
    mov    edi,filename
67
    mov    edi,filename
36
    mov    ecx,50
68
    mov    ecx,50
37
    xor    eax,eax
69
    xor    eax,eax
38
    repne  scasb
70
    repne  scasb
39
    sub    edi,filename
71
    sub    edi,filename
40
    dec    edi
72
    dec    edi
41
    mov    [filename_len],edi
73
    mov    [filename_len],edi
42
    jmp    do_load_file
74
    jmp    do_load_file
43
  noparams:
75
  noparams:
44
    jmp newfile
76
    jmp newfile
45
;******************************************************************************
77
;******************************************************************************
46
; MAIN LOOP
78
; MAIN LOOP
47
still:
79
still:
48
    call writepos ; write current position & number of strings
80
    call writepos ; write current position & number of strings
49
    call mouse_info
81
    call mouse_info
50
 
82
 
51
    mov  eax,10   ; wait here until event
83
    mov  eax,10   ; wait here until event
52
    int  0x40
84
    int  0x40
53
 
85
 
54
    cmp eax,1
86
    cmp eax,1
55
    je red
87
    je red
56
    cmp eax,2
88
    cmp eax,2
57
    je key
89
    je key
58
    cmp eax,3
90
    cmp eax,3
59
    je button
91
    je button
60
    cmp eax,6
92
    cmp eax,6
61
    je mouse
93
    je mouse
62
    jmp  still
94
    jmp  still
63
;******************************************************************************
95
;******************************************************************************
64
; *********************************
96
; *********************************
65
; *          MOUSE                *
97
; *          MOUSE                *
66
; *********************************
98
; *********************************
67
mouse:
99
mouse:
68
mov eax,37    ;mouse click
100
mov eax,37    ;mouse click
69
mov ebx,2
101
mov ebx,2
70
int 0x40
102
int 0x40
71
cmp eax,0
103
cmp eax,0
72
je .leave_now
104
je .leave_now
73
;if exit window is on
105
;if exit window is on
74
cmp [exit_wnd_on],1
106
cmp [exit_wnd_on],1
75
jne @f
107
jne @f
76
mov [exit_wnd_on],0
108
mov [exit_wnd_on],0
77
jmp red
109
jmp red
78
;else
110
;else
79
@@:
111
@@:
80
cmp eax,1     ;mouse 1
112
cmp eax,1     ;mouse 1
81
jne .leave_now
113
jne .leave_now
82
 
114
 
83
mov eax,37    ;mouse position
115
mov eax,37    ;mouse position
84
mov ebx,1
116
mov ebx,1
85
int 0x40
117
int 0x40
86
 
118
 
87
mov word[mouse_y],ax
119
mov word[mouse_y],ax
88
shr eax,16
120
shr eax,16
89
mov word[mouse_x],ax
121
mov word[mouse_x],ax
90
 
122
 
91
 
123
 
92
cmp [mouse_x],7
124
cmp [mouse_x],7
93
jb .leave_now ;.leave_now       ;if <
125
jb .leave_now ;.leave_now       ;if <
94
cmp [mouse_x],485;487
126
cmp [mouse_x],485;487
95
ja .leave_now ;.leave_now       ;if >
127
ja .leave_now ;.leave_now       ;if >
96
 
128
 
97
cmp [mouse_y],45
129
cmp [mouse_y],45
98
jb .leave_now ;.leave_now ;if <
130
jb .leave_now ;.leave_now ;if <
99
cmp [mouse_y],342 ;345
131
cmp [mouse_y],342 ;345
100
ja .leave_now ;.leave_now       ;if >
132
ja .leave_now ;.leave_now       ;if >
101
 
133
 
102
call main_cursor_move
134
call main_cursor_move
103
 
135
 
104
.leave_now:
136
.leave_now:
105
jmp still
137
jmp still
106
 
138
 
107
; *********************************
139
; *********************************
108
; *         BUTTON HANDLER        *
140
; *         BUTTON HANDLER        *
109
; *********************************
141
; *********************************
110
 
142
 
111
  button:
143
  button:
112
 
144
 
113
    mov  eax,17
145
    mov  eax,17
114
    int  0x40
146
    int  0x40
115
;;;;;;;;;;;;;;;exit dialog box check;;;;;;;;;;;;;
147
;;;;;;;;;;;;;;;exit dialog box check;;;;;;;;;;;;;
116
cmp ah,49
148
cmp ah,49
117
je save_and_exit
149
je save_and_exit
118
cmp ah,48
150
cmp ah,48
119
je exit_now
151
je exit_now
120
cmp ah,47
152
cmp ah,47
121
mov [exit_wnd_on],0
153
mov [exit_wnd_on],0
122
je red
154
je red
123
cmp ah,46
155
cmp ah,46
124
jne @f
156
jne @f
125
 
157
 
126
  call save_file
158
  call save_file
127
  jmp newfile
159
  jmp newfile
128
@@:
160
@@:
129
cmp ah,45
161
cmp ah,45
130
je newfile
162
je newfile
131
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
163
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
132
;;;;;;;;;;;;;;;;MENU CHECK;;;;;;;;;;;;;;;;;;;;;;;
164
;;;;;;;;;;;;;;;;MENU CHECK;;;;;;;;;;;;;;;;;;;;;;;
133
cmp ah,15
165
cmp ah,15
134
jne no_d_w
166
jne no_d_w
135
call draw_window_for_dialogs
167
call draw_window_for_dialogs
136
jmp still
168
jmp still
137
no_d_w:
169
no_d_w:
138
cmp ah,97
170
cmp ah,97
139
je draw_win_menu_file
171
je draw_win_menu_file
140
cmp ah,98
172
cmp ah,98
141
je draw_win_menu_code
173
je draw_win_menu_code
142
cmp ah,96
174
cmp ah,96
143
je draw_win_menu_text
175
je draw_win_menu_text
144
cmp ah,95
176
cmp ah,95
145
je goto_string
177
je goto_string
146
cmp ah,92
178
cmp ah,92
147
je search_window
179
je search_window
148
cmp ah,94
180
cmp ah,94
149
je red
181
je red
150
cmp ah,99
182
cmp ah,99
151
  je help_wnd
183
  je help_wnd
152
cmp ah,100
184
cmp ah,100
153
  je new_pad_wnd
185
  je new_pad_wnd
154
cmp ah,101
186
cmp ah,101
155
  je doyouwannasave
187
  je doyouwannasave
156
cmp ah,102
188
cmp ah,102
157
  jne nosavenow
189
  jne nosavenow
158
   for_key_save:
190
   for_key_save:
159
   savedialog draw_window_for_dialogs,copy_fpath_s,saveerror,mypath
191
   savedialog draw_window_for_dialogs,copy_fpath_s,saveerror,mypath
160
nosavenow:
192
nosavenow:
161
cmp ah,103
193
cmp ah,103
162
  jne noopennow
194
  jne noopennow
163
   for_key_open:
195
   for_key_open:
164
   opendialog draw_window_for_dialogs,copy_fpath,openerror,mypath
196
   opendialog draw_window_for_dialogs,copy_fpath,openerror,mypath
165
noopennow:
197
noopennow:
166
cmp ah,104
198
cmp ah,104
167
je exit
199
je exit
168
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
200
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
169
    shr  eax,8
201
    shr  eax,8
170
 
202
 
171
    cmp  al,50
203
    cmp  al,50
172
    jne  no_search
204
    jne  no_search
173
 
205
 
174
; SEARCH {
206
; SEARCH {
175
  search:
207
  search:
176
 
208
 
177
    cmp [lines],1  ;something like bug fix
209
    cmp [lines],1  ;something like bug fix
178
    je red ;still
210
    je red ;still
179
 
211
 
180
    xor  esi,esi
212
    xor  esi,esi
181
    mov  edi,[post]
213
    mov  edi,[post]
182
    add  edi,80
214
    add  edi,80
183
    imul ecx,[lines],80
215
    imul ecx,[lines],80
184
    sub  ecx,edi         ; ecx (loop counter) = lines*80-(post+80)
216
    sub  ecx,edi         ; ecx (loop counter) = lines*80-(post+80)
185
  news:
217
  news:
186
    push edi
218
    push edi
187
  news2:
219
  news2:
188
 
220
 
189
     ; 1) LOAD BYTES
221
     ; 1) LOAD BYTES
190
     mov  al,[esi+search_string]
222
     mov  al,[esi+search_string]
191
     mov  bl,[edi+0x80000]
223
     mov  bl,[edi+0x80000]
192
 
224
 
193
     ; 2) COMPARE BYTES
225
     ; 2) COMPARE BYTES
194
     cmp  al,bl
226
     cmp  al,bl
195
     je   yes_char
227
     je   yes_char
196
 
228
 
197
     ; 3) LETTER?
229
     ; 3) LETTER?
198
     cmp  al,'A'
230
     cmp  al,'A'
199
     jb   notequal
231
     jb   notequal
200
     cmp  al,'z'
232
     cmp  al,'z'
201
     ja   notequal
233
     ja   notequal
202
 
234
 
203
     ; 4) A->a OR a->A
235
     ; 4) A->a OR a->A
204
     cmp  al,'a'
236
     cmp  al,'a'
205
     jb   @f
237
     jb   @f
206
     add  al,-32
238
     add  al,-32
207
     jmp  compare_bytes
239
     jmp  compare_bytes
208
    @@:
240
    @@:
209
     cmp  al,'Z'
241
     cmp  al,'Z'
210
     ja   notequal
242
     ja   notequal
211
     add  al,32
243
     add  al,32
212
 
244
 
213
    compare_bytes:
245
    compare_bytes:
214
     cmp  al,bl
246
     cmp  al,bl
215
     jne  notequal
247
     jne  notequal
216
 
248
 
217
  yes_char:
249
  yes_char:
218
    inc  edi
250
    inc  edi
219
    inc  esi
251
    inc  esi
220
    cmp  esi,[search_len]
252
    cmp  esi,[search_len]
221
    jge  sfound
253
    jge  sfound
222
    jmp  news2
254
    jmp  news2
223
 
255
 
224
  notequal:
256
  notequal:
225
    pop  edi
257
    pop  edi
226
    xor  esi,esi
258
    xor  esi,esi
227
    inc  edi
259
    inc  edi
228
    loop news
260
    loop news
229
    call string_not_found
261
    call string_not_found
230
    jmp  still
262
    jmp  still
231
 
263
 
232
  sfound:
264
  sfound:
233
    mov  eax,edi
265
    mov  eax,edi
234
    cdq                   ; edx = 0;
266
    cdq                   ; edx = 0;
235
    mov  ebx,80
267
    mov  ebx,80
236
    div  ebx
268
    div  ebx
237
;;;;;   imul eax,80
269
;;;;;   imul eax,80
238
;    lea  eax,[eax+eax*4]  ; eax *= 5;
270
;    lea  eax,[eax+eax*4]  ; eax *= 5;
239
;    shl  eax,4           ; eax *= 16;
271
;    shl  eax,4           ; eax *= 16;
240
 
272
 
241
;    mov  [post],eax
273
;    mov  [post],eax
242
    mov  [posy],0
274
    mov  [posy],0
243
;---------------
275
;---------------
244
;    mov ebx,80
276
;    mov ebx,80
245
;    div ebx
277
;    div ebx
246
    call goto_pos
278
    call goto_pos
247
    call draw_vertical_scroll
279
    call draw_vertical_scroll
248
    jmp  still
280
    jmp  still
249
; SEARCH }
281
; SEARCH }
250
 
282
 
251
  no_search:
283
  no_search:
252
 
284
 
253
; TOOLBAR {
285
; TOOLBAR {
254
   cmp     eax,10000
286
   cmp     eax,10000
255
   jb      no_toolbar
287
   jb      no_toolbar
256
 
288
 
257
   add     eax,-10000
289
   add     eax,-10000
258
   jne     @f
290
   jne     @f
259
lbl_compile_file:
291
lbl_compile_file:
260
   mov     [run_outfile],0
292
   mov     [run_outfile],0
261
   call    start_fasm
293
   call    start_fasm
262
   jmp     still
294
   jmp     still
263
 @@:
295
 @@:
264
   dec     eax
296
   dec     eax
265
   jnz     @f
297
   jnz     @f
266
lbl_run_outfile:
298
lbl_run_outfile:
267
   mov     [run_outfile],1
299
   mov     [run_outfile],1
268
   call    start_fasm
300
   call    start_fasm
269
   jmp     still
301
   jmp     still
270
 @@:
302
 @@:
271
   dec     eax
303
   dec     eax
272
   jnz     @f
304
   jnz     @f
273
   call    open_debug_board
305
   call    open_debug_board
274
   jmp     still
306
   jmp     still
275
 @@:
307
 @@:
276
   dec     eax
308
   dec     eax
277
   jnz     still
309
   jnz     still
278
   call    open_sysfuncs_txt
310
   call    open_sysfuncs_txt
279
   jmp     still
311
   jmp     still
280
; TOOLBAR }
312
; TOOLBAR }
281
 
313
 
282
  no_toolbar:
314
  no_toolbar:
283
 
315
 
284
    cmp  al,4
316
    cmp  al,4
285
    jne  noid4
317
    jne  noid4
286
 
318
 
287
; LOAD_FILE {
319
; LOAD_FILE {
288
  do_load_file:
320
  do_load_file:
289
    mov [modified],0
321
    mov [modified],0
290
 
322
 
291
  call empty_work_space
323
  call empty_work_space
292
 
324
 
293
 
325
 
294
  cmp  [filename],'/'
326
  cmp  [filename],'/'
295
    jne  @f
327
    jne  @f
296
 
328
 
297
    call loadhdfile
329
    call loadhdfile
298
    jmp  .restorecursor
330
    jmp  .restorecursor
299
  @@:
331
  @@:
300
   call loadfile1
332
   call loadfile1
301
  .restorecursor:
333
  .restorecursor:
302
    mov  edi,0x78000
334
    mov  edi,0x78000
303
    mov  ecx,80*80/4
335
    mov  ecx,80*80/4
304
    mov  eax,0x01010101
336
    mov  eax,0x01010101
305
    cld
337
    cld
306
    rep  stosd
338
    rep  stosd
307
    xor  eax,eax
339
    xor  eax,eax
308
    mov  [post],eax
340
    mov  [post],eax
309
    mov  [posx],eax
341
    mov  [posx],eax
310
    mov  [posy],eax
342
    mov  [posy],eax
311
 
343
 
312
; enable color syntax for ASM and INC files:
344
; enable color syntax for ASM and INC files:
313
    mov  [asm_mode], 0
345
    mov  [asm_mode], 0
314
 
346
 
315
    mov  eax, [filename_len]
347
    mov  eax, [filename_len]
316
    add  eax, filename
348
    add  eax, filename
317
    cmp  word [eax-3],'AS'
349
    cmp  word [eax-3],'AS'
318
    jne  @f
350
    jne  @f
319
    cmp  byte [eax-1],'M'
351
    cmp  byte [eax-1],'M'
320
    jne  @f
352
    jne  @f
321
    mov  [asm_mode], 1
353
    mov  [asm_mode], 1
322
    jmp  .nocol
354
    jmp  .nocol
323
  @@:
355
  @@:
324
    cmp  word [eax-3],'IN'
356
    cmp  word [eax-3],'IN'
325
    jne  @f
357
    jne  @f
326
    cmp  byte [eax-1],'C'
358
    cmp  byte [eax-1],'C'
327
    jne  @f
359
    jne  @f
328
    mov  [asm_mode], 1
360
    mov  [asm_mode], 1
329
  @@:
361
  @@:
330
  .nocol:
362
  .nocol:
331
 
363
 
332
; if the header is the same as the previous,
364
; if the header is the same as the previous,
333
; just redraw the text area
365
; just redraw the text area
334
; else redraw the window
366
; else redraw the window
335
 
367
 
336
;------pos00=filename_len
368
;------pos00=filename_len
337
    mov eax,[filename_len]
369
    mov eax,[filename_len]
338
    mov [pos00],eax
370
    mov [pos00],eax
339
;-------------------------
371
;-------------------------
340
    mov  ecx, [filename_len]
372
    mov  ecx, [filename_len]
341
    add  ecx, 10             ; strlen(" - TINYPAD");
373
    add  ecx, 10             ; strlen(" - TINYPAD");
342
    cmp  ecx, [headlen]
374
    cmp  ecx, [headlen]
343
    jne  @f
375
    jne  @f
344
    add  ecx, -10
376
    add  ecx, -10
345
    mov  esi, filename       ; strcmp(filename,header);
377
    mov  esi, filename       ; strcmp(filename,header);
346
    mov  edi, header
378
    mov  edi, header
347
    rep  cmpsb
379
    rep  cmpsb
348
    jne  @f
380
    jne  @f
349
    call drawfile
381
    call drawfile
350
    call draw_window_for_dialogs ;redraw, because it's needed
382
    call draw_window_for_dialogs ;redraw, because it's needed
351
    cmp [to_return],0
383
    cmp [to_return],0
352
    je still
384
    je still
353
    ret
385
    ret
354
    ;jmp  still
386
    ;jmp  still
355
  @@:
387
  @@:
356
call set_title
388
call set_title
357
cmp [to_return],0
389
cmp [to_return],0
358
je still
390
je still
359
ret
391
ret
360
;    jmp  still
392
;    jmp  still
361
; LOAD_FILE }
393
; LOAD_FILE }
362
 
394
 
363
  noid4:
395
  noid4:
364
 
396
 
365
    cmp  al, 2
397
    cmp  al, 2
366
    jz   yessave
398
    jz   yessave
367
 
399
 
368
    dec  al       ; close if butid == 0
400
    dec  al       ; close if butid == 0
369
    jnz  nosave
401
    jnz  nosave
370
; EXIT:
402
; EXIT:
371
exit:
403
exit:
372
cmp [modified],0
404
cmp [modified],0
373
je exit_now
405
je exit_now
374
 
406
 
375
      mov  eax,55           ; beep
407
      mov  eax,55           ; beep
376
      mov  ebx,eax
408
      mov  ebx,eax
377
      mov  esi,save_beep1
409
      mov  esi,save_beep1
378
      int  0x40
410
      int  0x40
379
      delay 4
411
      delay 4
380
      mov  eax,55           ; beep
412
      mov  eax,55           ; beep
381
      mov  ebx,eax
413
      mov  ebx,eax
382
      mov  esi,save_beep2
414
      mov  esi,save_beep2
383
      int  0x40
415
      int  0x40
384
 
416
 
385
 ;---------"EXIT" dialog box
417
 ;---------"EXIT" dialog box
386
 
418
 
387
 mov eax,13
419
 mov eax,13
388
 mov ebx,150*65536+200
420
 mov ebx,150*65536+200
389
 mov ecx,100*65536+70
421
 mov ecx,100*65536+70
390
 mov edx,[sc.work_graph] ;0x00dd9438 ;0x00ff7512
422
 mov edx,[sc.work_graph] ;0x00dd9438 ;0x00ff7512
391
 int 0x40
423
 int 0x40
392
 
424
 
393
 
425
 
394
mov eax,38
426
mov eax,38
395
mov ebx,150*65536+350
427
mov ebx,150*65536+350
396
mov ecx,100*65536+100
428
mov ecx,100*65536+100
397
mov edx,cl_White
429
mov edx,cl_White
398
int 0x40
430
int 0x40
399
mov eax,38
431
mov eax,38
400
mov ebx,150*65536+350
432
mov ebx,150*65536+350
401
mov ecx,170*65536+170
433
mov ecx,170*65536+170
402
mov edx,cl_White
434
mov edx,cl_White
403
int 0x40
435
int 0x40
404
mov eax,38
436
mov eax,38
405
mov ebx,150*65536+150
437
mov ebx,150*65536+150
406
mov ecx,100*65536+170
438
mov ecx,100*65536+170
407
mov edx,cl_White
439
mov edx,cl_White
408
int 0x40
440
int 0x40
409
mov eax,38
441
mov eax,38
410
mov ebx,350*65536+350
442
mov ebx,350*65536+350
411
mov ecx,100*65536+170
443
mov ecx,100*65536+170
412
mov edx,cl_White
444
mov edx,cl_White
413
int 0x40
445
int 0x40
414
 
446
 
415
 
447
 
416
 
448
if lang eq ru
417
 putlabel 190,120,'‘®åà ­¨âì ¤®ªã¬¥­â?',cl_White
449
 putlabel 190,120,'‘®åà ­¨âì ¤®ªã¬¥­â?',cl_White
418
 
450
 
419
 drawlbut 170,140,30,15,'„ ',49,[sc.work_button],cl_White
451
 drawlbut 170,140,30,15,'„ ',49,[sc.work_button],cl_White
420
 drawlbut 230,140,30,15,'¥â',48,[sc.work_button],cl_White
452
 drawlbut 230,140,30,15,'¥â',48,[sc.work_button],cl_White
421
 drawlbut 290,140,45,15,'Žâ¬¥­ ',47,[sc.work_button],cl_White
453
 drawlbut 290,140,45,15,'Žâ¬¥­ ',47,[sc.work_button],cl_White
-
 
454
else
-
 
455
 putlabel 190,120,'Save the document?',cl_White
-
 
456
 
-
 
457
 drawlbut 170,140,30,15,'Yes',49,[sc.work_button],cl_White
-
 
458
 drawlbut 230,140,30,15,'No',48,[sc.work_button],cl_White
-
 
459
 drawlbut 290,140,45,15,'Cancel',47,[sc.work_button],cl_White
-
 
460
end if
422
 
461
 
423
 mov [exit_wnd_on],1
462
 mov [exit_wnd_on],1
424
;----------------
463
;----------------
425
 
464
 
426
jmp still
465
jmp still
427
 
466
 
428
    exit_now:
467
    exit_now:
429
    mov  [MainWndClosed], 1
468
    mov  [MainWndClosed], 1
430
    or   eax, -1
469
    or   eax, -1
431
    int  0x40
470
    int  0x40
432
 
471
 
433
    save_and_exit:
472
    save_and_exit:
434
    call save_file
473
    call save_file
435
    jmp exit_now
474
    jmp exit_now
436
;    mov  [MainWndClosed], 1
475
;    mov  [MainWndClosed], 1
437
;    or   eax, -1
476
;    or   eax, -1
438
;    int  0x40
477
;    int  0x40
439
 
478
 
440
; SAVE_FILE {
479
; SAVE_FILE {
441
  yessave:
480
  yessave:
442
  call clear_screen
481
  call clear_screen
443
  call drawwindow
482
  call drawwindow
444
    call save_file
483
    call save_file
445
;  call clear_screen
484
;  call clear_screen
446
;  call drawwindow
485
;  call drawwindow
447
    mov [modified],0
486
    mov [modified],0
448
 
487
 
449
    jmp  still
488
    jmp  still
450
; SAVE_FILE }
489
; SAVE_FILE }
451
 
490
 
452
  nosave:
491
  nosave:
453
 
492
 
454
    inc  al
493
    inc  al
455
    call read_string
494
    call read_string
456
 
495
 
457
    jmp  still
496
    jmp  still
458
 
497
 
459
;**********************************
498
;**********************************
460
;*         REDRAW HANDLER         *
499
;*         REDRAW HANDLER         *
461
;**********************************
500
;**********************************
462
 
501
 
463
red:
502
red:
464
; ¯¥à¥à¨á®¢ª  ®ª­ 
503
; ¯¥à¥à¨á®¢ª  ®ª­ 
465
   call   clear_screen
504
   call   clear_screen
466
   call   drawwindow
505
   call   drawwindow
467
   jmp    still
506
   jmp    still
468
 
507
 
469
 
508
 
470
 
509
 
471
;**********************************
510
;**********************************
472
;*          KEY HANDLER           *
511
;*          KEY HANDLER           *
473
;**********************************
512
;**********************************
474
 
513
 
475
  key:
514
  key:
476
    mov  eax, 2   ; GET KEY
515
    mov  eax, 2   ; GET KEY
477
    int  0x40
516
    int  0x40
478
 
517
 
479
  cmp [exit_wnd_on],1 ;exit window is ON?
518
  cmp [exit_wnd_on],1 ;exit window is ON?
480
  jne no_exit_wnd     ; no - goto other checks
519
  jne no_exit_wnd     ; no - goto other checks
481
 
520
 
482
;  cmp eax,13          ;enter - save n exit
521
;  cmp eax,13          ;enter - save n exit
483
;  je save_and_exit
522
;  je save_and_exit
484
 
523
 
485
;  cmp eax,173         ;ctrl+enter - exit
524
;  cmp eax,173         ;ctrl+enter - exit
486
;  je exit_now
525
;  je exit_now
487
  mov [exit_wnd_on],0 ;other keys - cancel
526
  mov [exit_wnd_on],0 ;other keys - cancel
488
;  call draw_window_for_dialogs
527
;  call draw_window_for_dialogs
489
 
528
 
490
  jmp red ;redraw and still
529
  jmp red ;redraw and still
491
 
530
 
492
 
531
 
493
  no_exit_wnd:
532
  no_exit_wnd:
494
    shr  eax, 8
533
    shr  eax, 8
495
 
534
 
496
; HELP_TEXT {
535
; HELP_TEXT {
497
    cmp  al, 210  ; Ctrl + F1
536
    cmp  al, 210  ; Ctrl + F1
498
    jne  no_help_text
537
    jne  no_help_text
499
help_wnd:
538
help_wnd:
500
call clear_screen
539
call clear_screen
501
call drawwindow
540
call drawwindow
502
    mov  eax, 51
541
    mov  eax, 51
503
    mov  ebx, 1
542
    mov  ebx, 1
504
    mov  ecx, help_thread_start
543
    mov  ecx, help_thread_start
505
    mov  edx, 0xfff0
544
    mov  edx, 0xfff0
506
    int  0x40
545
    int  0x40
507
    jmp  still
546
    jmp  still
508
 
547
 
509
help_thread_start:
548
help_thread_start:
510
    call draw_help_wnd
549
    call draw_help_wnd
511
 
550
 
512
  still_hw:
551
  still_hw:
513
    cmp  [MainWndClosed], 1
552
    cmp  [MainWndClosed], 1
514
    je   exit_hw
553
    je   exit_hw
515
    mov  eax, 10
554
    mov  eax, 10
516
    int  0x40
555
    int  0x40
517
    cmp  eax, 1
556
    cmp  eax, 1
518
    je   red_hw
557
    je   red_hw
519
    cmp  eax, 2
558
    cmp  eax, 2
520
    je   key_hw
559
    je   key_hw
521
    cmp  eax, 3
560
    cmp  eax, 3
522
    je   button_hw
561
    je   button_hw
523
    jmp  still_hw
562
    jmp  still_hw
524
 
563
 
525
  red_hw:
564
  red_hw:
526
    call draw_help_wnd
565
    call draw_help_wnd
527
    jmp  still_hw
566
    jmp  still_hw
528
 
567
 
529
  key_hw:
568
  key_hw:
530
;   mov  eax, 2
569
;   mov  eax, 2
531
    int  0x40
570
    int  0x40
532
    cmp  ah, 27
571
    cmp  ah, 27
533
    jne  still_hw
572
    jne  still_hw
534
 
573
 
535
  button_hw:
574
  button_hw:
536
    mov  eax, 17
575
    mov  eax, 17
537
    int  0x40
576
    int  0x40
538
  exit_hw:
577
  exit_hw:
539
    or   eax, -1
578
    or   eax, -1
540
    int  0x40
579
    int  0x40
541
 
580
 
542
; draw help window
581
; draw help window
543
 draw_help_wnd:
582
 draw_help_wnd:
544
    mov  eax, 12
583
    mov  eax, 12
545
    mov  ebx, 1
584
    mov  ebx, 1
546
    int  0x40
585
    int  0x40
547
 
586
 
548
    xor  eax, eax
587
    xor  eax, eax
549
    mov  ebx, 200 shl 16 + 320
588
    mov  ebx, 200 shl 16 + 320
550
    mov  ecx, 200 shl 16 + 260
589
    mov  ecx, 200 shl 16 + 260
551
    mov  edx, 0x03e0e0e0   ; work
590
    mov  edx, 0x03e0e0e0   ; work
552
    mov  esi, [sc.grab]
591
    mov  esi, [sc.grab]
553
    or   esi, 0x80000000   ; grab
592
    or   esi, 0x80000000   ; grab
554
    mov  edi, [sc.frame]   ; frame
593
    mov  edi, [sc.frame]   ; frame
555
    int  0x40
594
    int  0x40
556
 
595
 
557
    mov  eax, 4
596
    mov  eax, 4
558
    mov  ebx, 8 shl 16 + 8
597
    mov  ebx, 8 shl 16 + 8
559
    mov  ecx, 0xffffff
598
    mov  ecx, 0xffffff
560
    mov  edx, help_wnd_header
599
    mov  edx, help_wnd_header
561
    mov  esi, hlphead_len
600
    mov  esi, hlphead_len
562
    int  0x40
601
    int  0x40
563
 
602
 
564
    mov  eax, 4
603
    mov  eax, 4
565
    mov  ebx, 8 shl 16 + 34
604
    mov  ebx, 8 shl 16 + 34
566
    xor  ecx, ecx
605
    xor  ecx, ecx
567
    mov  esi, 51
606
    mov  esi, 51
568
    mov  edx, help_text
607
    mov  edx, help_text
569
  .new_help_line:
608
  .new_help_line:
570
    int  0x40
609
    int  0x40
571
    add  ebx, 10
610
    add  ebx, 10
572
    add  edx, esi
611
    add  edx, esi
573
    cmp  [edx], byte 'x'
612
    cmp  [edx], byte 'x'
574
    jne  .new_help_line
613
    jne  .new_help_line
575
 
614
 
576
    mov  eax, 12
615
    mov  eax, 12
577
    mov  ebx, 2
616
    mov  ebx, 2
578
    int  0x40
617
    int  0x40
579
    ret
618
    ret
580
; HELP_TEXT }
619
; HELP_TEXT }
581
 
620
 
582
  no_help_text:
621
  no_help_text:
583
; LOAD_FILE {
622
; LOAD_FILE {
584
    cmp  al, 211       ; Ctrl + F2
623
    cmp  al, 211       ; Ctrl + F2
585
    je   for_key_open ;do_load_file
624
    je   for_key_open ;do_load_file
586
; LOAD_FILE }
625
; LOAD_FILE }
587
 
626
 
588
; SEARCH {
627
; SEARCH {
589
    cmp  al, 212       ; Ctrl + F3
628
    cmp  al, 212       ; Ctrl + F3
590
    je   search
629
    je   search
591
; SEARCH }
630
; SEARCH }
592
 
631
 
593
; SAVE_FILE {
632
; SAVE_FILE {
594
    cmp  al, 213       ; Ctrl + F4
633
    cmp  al, 213       ; Ctrl + F4
595
    je   yessave
634
    je   yessave
596
; SAVE_FILE }
635
; SAVE_FILE }
597
 
636
 
598
; ENTER_FILENAME {
637
; ENTER_FILENAME {
599
    cmp  al, 214       ; Ctrl + F5
638
    cmp  al, 214       ; Ctrl + F5
600
    jne  @f
639
    jne  @f
601
jmp for_key_save
640
jmp for_key_save
602
  @@:
641
  @@:
603
; ENTER_FILENAME }
642
; ENTER_FILENAME }
604
 
643
 
605
; ENTER_SEARCH {
644
; ENTER_SEARCH {
606
    cmp  al, 215       ; Ctrl + F6
645
    cmp  al, 215       ; Ctrl + F6
607
    jne  @f
646
    jne  @f
608
;    mov  al, 51
647
;    mov  al, 51
609
;    call read_string
648
;    call read_string
610
;    jmp  still
649
;    jmp  still
611
    jmp search_window
650
    jmp search_window
612
  @@:
651
  @@:
613
; ENTER_SEARCH }
652
; ENTER_SEARCH }
614
 
653
 
615
; CHANGE_LAYOUT {
654
; CHANGE_LAYOUT {
616
    cmp  al, 217       ; Ctrl + F8
655
    cmp  al, 217       ; Ctrl + F8
617
    jne  @f
656
    jne  @f
618
    call layout
657
    call layout
619
    jmp  still
658
    jmp  still
620
  @@:
659
  @@:
621
; CHANGE_LAYOUT }
660
; CHANGE_LAYOUT }
622
 
661
 
623
; COMPILE_FILE {
662
; COMPILE_FILE {
624
    cmp al, 208
663
    cmp al, 208
625
    je lbl_compile_file
664
    je lbl_compile_file
626
; COMPILE_FILE }
665
; COMPILE_FILE }
627
 
666
 
628
; RUN_OUTFILE {
667
; RUN_OUTFILE {
629
   cmp al, 209
668
   cmp al, 209
630
   je lbl_run_outfile
669
   je lbl_run_outfile
631
 
670
 
632
; RUN_OUTFILE }
671
; RUN_OUTFILE }
633
 
672
 
634
;run debug board {      -----
673
;run debug board {      -----
635
   cmp al,255
674
   cmp al,255
636
   jne @f
675
   jne @f
637
   call open_debug_board
676
   call open_debug_board
638
   call activate_me
677
   call activate_me
639
   jmp still
678
   jmp still
640
;}
679
;}
641
   @@:
680
   @@:
642
;open sysfuncR {        -----
681
;open sysfuncR {        -----
643
;   cmp al,228
682
;   cmp al,228
644
;   jne @f
683
;   jne @f
645
;   call open_sysfuncs_txt
684
;   call open_sysfuncs_txt
646
;   jmp still
685
;   jmp still
647
;   @@:
686
;   @@:
648
 
687
 
649
;fast_save_and_open {
688
;fast_save_and_open {
650
   cmp al,216
689
   cmp al,216
651
   jne @f
690
   jne @f
652
   call make_fast_so
691
   call make_fast_so
653
   jmp still
692
   jmp still
654
;}
693
;}
655
   @@:
694
   @@:
656
; 3 times english -> àãá᪨©
695
; 3 times english -> àãá᪨©
657
; 2 times àãá᪨© -> english
696
; 2 times àãá᪨© -> english
658
 
697
 
659
; COPY START {
698
; COPY START {
660
    cmp  al, 19
699
    cmp  al, 19
661
    jne  no_copy_start
700
    jne  no_copy_start
662
    mov  eax, [post]
701
    mov  eax, [post]
663
    imul ebx, [posy], 80
702
    imul ebx, [posy], 80
664
    add  eax, ebx
703
    add  eax, ebx
665
    mov  [copy_start], eax
704
    mov  [copy_start], eax
666
    jmp  still
705
    jmp  still
667
; COPY START }
706
; COPY START }
668
 
707
 
669
  no_copy_start:
708
  no_copy_start:
670
; COPY END {
709
; COPY END {
671
    cmp  al, 5
710
    cmp  al, 5
672
    jne  no_copy_end
711
    jne  no_copy_end
673
    cmp  [copy_start], 0
712
    cmp  [copy_start], 0
674
    je   still
713
    je   still
675
    mov  ecx, [post]
714
    mov  ecx, [post]
676
    imul ebx, [posy], 80
715
    imul ebx, [posy], 80
677
    add  ecx, ebx
716
    add  ecx, ebx
678
    add  ecx, 80
717
    add  ecx, 80
679
    cmp  ecx, [copy_count]
718
    cmp  ecx, [copy_count]
680
    jb   still
719
    jb   still
681
    sub  ecx, [copy_start]
720
    sub  ecx, [copy_start]
682
    mov  [copy_count], ecx
721
    mov  [copy_count], ecx
683
    mov  esi, [copy_start]
722
    mov  esi, [copy_start]
684
    add  esi, 0x80000
723
    add  esi, 0x80000
685
    mov  edi, 0x2f0000
724
    mov  edi, 0x2f0000
686
    cld
725
    cld
687
    rep  movsb
726
    rep  movsb
688
    jmp  still
727
    jmp  still
689
; COPY END }
728
; COPY END }
690
 
729
 
691
  no_copy_end:
730
  no_copy_end:
692
 
731
 
693
; PASTE {
732
; PASTE {
694
    cmp  al, 16
733
    cmp  al, 16
695
    jne  no_copy_paste
734
    jne  no_copy_paste
696
    cmp  [copy_count], 0
735
    cmp  [copy_count], 0
697
    je   still
736
    je   still
698
    mov  eax,[copy_count]
737
    mov  eax,[copy_count]
699
    cdq
738
    cdq
700
    mov  ebx, 80
739
    mov  ebx, 80
701
    div  ebx
740
    div  ebx
702
    add  [lines], eax
741
    add  [lines], eax
703
    mov  ecx, 0x2e0000
742
    mov  ecx, 0x2e0000
704
    mov  eax, [post]
743
    mov  eax, [post]
705
    imul ebx, [posy], 80
744
    imul ebx, [posy], 80
706
    add  eax, ebx
745
    add  eax, ebx
707
    add  eax, 0x80000
746
    add  eax, 0x80000
708
    sub  ecx, eax
747
    sub  ecx, eax
709
    mov  esi, 0x2e0000
748
    mov  esi, 0x2e0000
710
    sub  esi, [copy_count]
749
    sub  esi, [copy_count]
711
    mov  edi, 0x2e0000
750
    mov  edi, 0x2e0000
712
    std
751
    std
713
    rep  movsb
752
    rep  movsb
714
    mov  esi, 0x2f0000
753
    mov  esi, 0x2f0000
715
    mov  edi, [post]
754
    mov  edi, [post]
716
    imul eax, [posy], 80
755
    imul eax, [posy], 80
717
    add  edi, eax
756
    add  edi, eax
718
    add  edi, 0x80000
757
    add  edi, 0x80000
719
    mov  ecx, [copy_count]
758
    mov  ecx, [copy_count]
720
    cld
759
    cld
721
    rep  movsb
760
    rep  movsb
722
 
761
 
723
    call clear_screen
762
    call clear_screen
724
    call drawfile
763
    call drawfile
725
call draw_vertical_scroll
764
call draw_vertical_scroll
726
    mov [modified],1
765
    mov [modified],1
727
 
766
 
728
    jmp  still
767
    jmp  still
729
; PASTE }
768
; PASTE }
730
 
769
 
731
 
770
 
732
  no_copy_paste:
771
  no_copy_paste:
733
 
772
 
734
 
773
 
735
; INSERT_SEPARATOR {
774
; INSERT_SEPARATOR {
736
    cmp  al,0xc       ; Ctrl+L
775
    cmp  al,0xc       ; Ctrl+L
737
    jne  no_insert_separator
776
    jne  no_insert_separator
738
 
777
 
739
    imul eax,[posy],80
778
    imul eax,[posy],80
740
    add  eax,[post]
779
    add  eax,[post]
741
    add  eax,0x80000
780
    add  eax,0x80000
742
    mov  ebx,eax
781
    mov  ebx,eax
743
 
782
 
744
    imul eax,[lines],80
783
    imul eax,[lines],80
745
    add  eax,0x80000     ; ⥯¥àì 㪠§ë¢ ¥â ­  ª®­¥æ ä ©« 
784
    add  eax,0x80000     ; ⥯¥àì 㪠§ë¢ ¥â ­  ª®­¥æ ä ©« 
746
 
785
 
747
    mov  ecx,eax ; size
786
    mov  ecx,eax ; size
748
    sub  ecx,ebx
787
    sub  ecx,ebx
749
    inc  ecx
788
    inc  ecx
750
 
789
 
751
    mov  esi,eax ; from
790
    mov  esi,eax ; from
752
    mov  edi,eax
791
    mov  edi,eax
753
    add  edi,80  ; to
792
    add  edi,80  ; to
754
 
793
 
755
    std
794
    std
756
    rep  movsb
795
    rep  movsb
757
 
796
 
758
    mov  ecx,80/4
797
    mov  ecx,80/4
759
    mov  esi,comment_string
798
    mov  esi,comment_string
760
    mov  edi,ebx
799
    mov  edi,ebx
761
    cld
800
    cld
762
    rep  movsd
801
    rep  movsd
763
 
802
 
764
    inc  [lines]
803
    inc  [lines]
765
 
804
 
766
    call clear_screen
805
    call clear_screen
767
    call drawfile
806
    call drawfile
768
;call calc_scroll_size_and_pos
807
;call calc_scroll_size_and_pos
769
call draw_vertical_scroll
808
call draw_vertical_scroll
770
    mov [modified],1
809
    mov [modified],1
771
 
810
 
772
    jmp  still
811
    jmp  still
773
; INSERT_SEPARATOR }
812
; INSERT_SEPARATOR }
774
 
813
 
775
 
814
 
776
  no_insert_separator:
815
  no_insert_separator:
777
 
816
 
778
 
817
 
779
; DEL_LINE {
818
; DEL_LINE {
780
    cmp  al,4
819
    cmp  al,4
781
    jne  no_delete_line
820
    jne  no_delete_line
782
    mov  eax,[post]
821
    mov  eax,[post]
783
    cdq
822
    cdq
784
    mov  ebx,80
823
    mov  ebx,80
785
    div  ebx
824
    div  ebx
786
    add  eax,[posy]
825
    add  eax,[posy]
787
    inc  eax
826
    inc  eax
788
    cmp  eax,[lines]
827
    cmp  eax,[lines]
789
    jge  still
828
    jge  still
790
    dec  dword [lines]
829
    dec  dword [lines]
791
    imul edi,[posy],80
830
    imul edi,[posy],80
792
    add  edi,[post]
831
    add  edi,[post]
793
    add  edi,0x80000
832
    add  edi,0x80000
794
    mov  esi,edi
833
    mov  esi,edi
795
    add  esi,80
834
    add  esi,80
796
    mov  ecx,0x2e0000
835
    mov  ecx,0x2e0000
797
    sub  ecx,esi
836
    sub  ecx,esi
798
    shr  ecx,4
837
    shr  ecx,4
799
    cld
838
    cld
800
    rep  movsd
839
    rep  movsd
801
    call clear_screen
840
    call clear_screen
802
    call drawfile
841
    call drawfile
803
;call calc_scroll_size_and_pos
842
;call calc_scroll_size_and_pos
804
call draw_vertical_scroll
843
call draw_vertical_scroll
805
    mov [modified],1
844
    mov [modified],1
806
 
845
 
807
    jmp  still
846
    jmp  still
808
; DEL_LINE }
847
; DEL_LINE }
809
 
848
 
810
  no_delete_line:
849
  no_delete_line:
811
 
850
 
812
; ENTER {
851
; ENTER {
813
    cmp  al,13
852
    cmp  al,13
814
    jnz  noenter
853
    jnz  noenter
815
 
854
 
816
    ; lines down
855
    ; lines down
817
    mov  eax,[posy]
856
    mov  eax,[posy]
818
    inc  eax
857
    inc  eax
819
;   imul eax,80
858
;   imul eax,80
820
    lea  eax,[eax+eax*4]  ; eax *= 5
859
    lea  eax,[eax+eax*4]  ; eax *= 5
821
    shl  eax,4            ; eax *= 16
860
    shl  eax,4            ; eax *= 16
822
    add  eax,0x80000
861
    add  eax,0x80000
823
    add  eax,[post]
862
    add  eax,[post]
824
    mov  ebx,eax
863
    mov  ebx,eax
825
 
864
 
826
    ; ebx = ([posy]+1)*80 + 0x80000 + [post]
865
    ; ebx = ([posy]+1)*80 + 0x80000 + [post]
827
    ; ebx -> first byte of next string
866
    ; ebx -> first byte of next string
828
 
867
 
829
    imul eax,[lines],80
868
    imul eax,[lines],80
830
    add  eax,0x80000
869
    add  eax,0x80000
831
    mov  ecx,eax
870
    mov  ecx,eax
832
 
871
 
833
    ; ecx = [lines]*80 + 0x80000
872
    ; ecx = [lines]*80 + 0x80000
834
    ; ecx -> end of the document
873
    ; ecx -> end of the document
835
 
874
 
836
    cmp  ebx,ecx
875
    cmp  ebx,ecx
837
    jz   .bug_fixed
876
    jz   .bug_fixed
838
 
877
 
839
   @@:
878
   @@:
840
    dec  ecx
879
    dec  ecx
841
    mov  dl,[ecx]
880
    mov  dl,[ecx]
842
    mov  [ecx+80],dl
881
    mov  [ecx+80],dl
843
 
882
 
844
    cmp  ecx,ebx
883
    cmp  ecx,ebx
845
    jnz  @b
884
    jnz  @b
846
 
885
 
847
   .bug_fixed:
886
   .bug_fixed:
848
 
887
 
849
    ; save for later
888
    ; save for later
850
    imul eax,[posy],80
889
    imul eax,[posy],80
851
    add  eax,0x80000
890
    add  eax,0x80000
852
    add  eax,[post]
891
    add  eax,[post]
853
    mov  ebx,eax
892
    mov  ebx,eax
854
    add  eax,[posx]
893
    add  eax,[posx]
855
    ; eax = 0x80000 + [post] + [posy]*80 + [posx]
894
    ; eax = 0x80000 + [post] + [posy]*80 + [posx]
856
 
895
 
857
    push eax
896
    push eax
858
 
897
 
859
    dec  ebx
898
    dec  ebx
860
    xor  ecx,ecx
899
    xor  ecx,ecx
861
  @@:
900
  @@:
862
    cmp  ecx,80
901
    cmp  ecx,80
863
    je   @f
902
    je   @f
864
    inc  ecx
903
    inc  ecx
865
    inc  ebx
904
    inc  ebx
866
    cmp  byte [ebx],' '
905
    cmp  byte [ebx],' '
867
    je   @b
906
    je   @b
868
  @@:
907
  @@:
869
    dec  ecx
908
    dec  ecx
870
 
909
 
871
    cmp  ecx,80-1
910
    cmp  ecx,80-1
872
    jne  @f
911
    jne  @f
873
;   mov  [posx],0
912
;   mov  [posx],0
874
    jmp  .lbl
913
    jmp  .lbl
875
  @@:
914
  @@:
876
 
915
 
877
    cmp  [posx],ecx
916
    cmp  [posx],ecx
878
    jbe  @f
917
    jbe  @f
879
    mov  [posx],ecx
918
    mov  [posx],ecx
880
    jmp  .lbl
919
    jmp  .lbl
881
  @@:
920
  @@:
882
    mov  [posx],0
921
    mov  [posx],0
883
 
922
 
884
  .lbl:
923
  .lbl:
885
    inc  [posy]
924
    inc  [posy]
886
 
925
 
887
    ;clear line
926
    ;clear line
888
    imul eax,[posy],80
927
    imul eax,[posy],80
889
    add  eax,0x80000
928
    add  eax,0x80000
890
    add  eax,[post]
929
    add  eax,[post]
891
 
930
 
892
    mov  edi,eax
931
    mov  edi,eax
893
    mov  eax,'    '
932
    mov  eax,'    '
894
    mov  ecx,80/4
933
    mov  ecx,80/4
895
    cld
934
    cld
896
    rep  stosd
935
    rep  stosd
897
 
936
 
898
 
937
 
899
    ; end of line to next line beginning
938
    ; end of line to next line beginning
900
    imul eax,[posy],80
939
    imul eax,[posy],80
901
    add  eax,0x80000
940
    add  eax,0x80000
902
    add  eax,[post]
941
    add  eax,[post]
903
;   add  eax,[posx]
942
;   add  eax,[posx]
904
    mov  ebx,eax
943
    mov  ebx,eax
905
    ; ebx -> beginning of this line
944
    ; ebx -> beginning of this line
906
 
945
 
907
    pop  esi
946
    pop  esi
908
    mov  edi,eax
947
    mov  edi,eax
909
 
948
 
910
   @@:
949
   @@:
911
    mov  al,[esi]
950
    mov  al,[esi]
912
    mov  [ebx],al
951
    mov  [ebx],al
913
    mov  [esi],byte ' '
952
    mov  [esi],byte ' '
914
 
953
 
915
    inc  esi
954
    inc  esi
916
    inc  ebx
955
    inc  ebx
917
 
956
 
918
    cmp  esi,edi
957
    cmp  esi,edi
919
    jb   @b
958
    jb   @b
920
 
959
 
921
    inc  [lines]
960
    inc  [lines]
922
 
961
 
923
    mov  ecx,[posy]
962
    mov  ecx,[posy]
924
    cmp  ecx,[slines]
963
    cmp  ecx,[slines]
925
    jne  @f
964
    jne  @f
926
 
965
 
927
    dec  [posy]
966
    dec  [posy]
928
    add  [post],80
967
    add  [post],80
929
 
968
 
930
   @@:
969
   @@:
931
    call clear_screen
970
    call clear_screen
932
    call drawfile
971
    call drawfile
933
;call calc_scroll_size_and_pos
972
;call calc_scroll_size_and_pos
934
 
973
 
935
    call draw_vertical_scroll
974
    call draw_vertical_scroll
936
    mov [modified],1
975
    mov [modified],1
937
 
976
 
938
    jmp  still
977
    jmp  still
939
; ENTER }
978
; ENTER }
940
 
979
 
941
 
980
 
942
  noenter:
981
  noenter:
943
 
982
 
944
 
983
 
945
; UP {
984
; UP {
946
    cmp  al,130+48
985
    cmp  al,130+48
947
    jnz  noup
986
    jnz  noup
948
    mov  ecx,[posy]
987
    mov  ecx,[posy]
949
    test ecx,ecx
988
    test ecx,ecx
950
    jnz  .up1
989
    jnz  .up1
951
    mov  ecx,[post]
990
    mov  ecx,[post]
952
    test ecx,ecx
991
    test ecx,ecx
953
    jz   still
992
    jz   still
954
    add  ecx,-80
993
    add  ecx,-80
955
    mov  [post],ecx
994
    mov  [post],ecx
956
    call clear_screen
995
    call clear_screen
957
    jmp  .finish
996
    jmp  .finish
958
  .up1:
997
  .up1:
959
    dec  ecx
998
    dec  ecx
960
    mov  [posy],ecx
999
    mov  [posy],ecx
961
  .finish:
1000
  .finish:
962
    call drawfile
1001
    call drawfile
963
    call draw_vertical_scroll
1002
    call draw_vertical_scroll
964
;call calc_scroll_size_and_pos
1003
;call calc_scroll_size_and_pos
965
 
1004
 
966
    jmp  still
1005
    jmp  still
967
; UP }
1006
; UP }
968
 
1007
 
969
  noup:
1008
  noup:
970
 
1009
 
971
; DOWN {
1010
; DOWN {
972
    cmp  al,129+48
1011
    cmp  al,129+48
973
    jnz  nodown
1012
    jnz  nodown
974
 
1013
 
975
    mov  ecx,[posy]
1014
    mov  ecx,[posy]
976
    mov  eax,[slines]
1015
    mov  eax,[slines]
977
    dec  eax
1016
    dec  eax
978
    cmp  ecx,eax
1017
    cmp  ecx,eax
979
    jb   .do1         ; goto do1 if [posy] < [slines]-1
1018
    jb   .do1         ; goto do1 if [posy] < [slines]-1
980
 
1019
 
981
    mov  eax,[lines]
1020
    mov  eax,[lines]
982
    sub  eax,[slines]
1021
    sub  eax,[slines]
983
    dec  eax
1022
    dec  eax
984
    jb   still        ; goto still if [lines] < [slines]-1
1023
    jb   still        ; goto still if [lines] < [slines]-1
985
;   imul eax,80
1024
;   imul eax,80
986
    lea  eax,[eax+eax*4]
1025
    lea  eax,[eax+eax*4]
987
    shl  eax,4
1026
    shl  eax,4
988
    cmp  [post],eax
1027
    cmp  [post],eax
989
    jg   still        ; goto still if [post] > ([lines]-[slines]-1)*80
1028
    jg   still        ; goto still if [post] > ([lines]-[slines]-1)*80
990
 
1029
 
991
    add  [post],80
1030
    add  [post],80
992
    call clear_screen
1031
    call clear_screen
993
    call drawfile
1032
    call drawfile
994
    call draw_vertical_scroll
1033
    call draw_vertical_scroll
995
;call calc_scroll_size_and_pos
1034
;call calc_scroll_size_and_pos
996
 
1035
 
997
    jmp  still
1036
    jmp  still
998
 
1037
 
999
  .do1:
1038
  .do1:
1000
    pusha
1039
    pusha
1001
    mov  eax,[post]
1040
    mov  eax,[post]
1002
    cdq
1041
    cdq
1003
    mov  ebx,80
1042
    mov  ebx,80
1004
    div  ebx
1043
    div  ebx
1005
    add  eax,[posy]
1044
    add  eax,[posy]
1006
    inc  eax
1045
    inc  eax
1007
    cmp  eax,[lines]
1046
    cmp  eax,[lines]
1008
    jb   .do10
1047
    jb   .do10
1009
    popa
1048
    popa
1010
    jmp  still
1049
    jmp  still
1011
 
1050
 
1012
  .do10:
1051
  .do10:
1013
    popa
1052
    popa
1014
    inc  ecx
1053
    inc  ecx
1015
    mov  [posy],ecx
1054
    mov  [posy],ecx
1016
    call drawfile
1055
    call drawfile
1017
    call draw_vertical_scroll
1056
    call draw_vertical_scroll
1018
;call calc_scroll_size_and_pos
1057
;call calc_scroll_size_and_pos
1019
 
1058
 
1020
    jmp  still
1059
    jmp  still
1021
; DOWN }
1060
; DOWN }
1022
 
1061
 
1023
 
1062
 
1024
  nodown:
1063
  nodown:
1025
 
1064
 
1026
 
1065
 
1027
; LEFT {
1066
; LEFT {
1028
    cmp  al,128+48
1067
    cmp  al,128+48
1029
    jnz  noleft
1068
    jnz  noleft
1030
    cmp  [posx],0
1069
    cmp  [posx],0
1031
    je   still
1070
    je   still
1032
    dec  [posx]
1071
    dec  [posx]
1033
    call drawfile
1072
    call drawfile
1034
    jmp  still
1073
    jmp  still
1035
; LEFT }
1074
; LEFT }
1036
 
1075
 
1037
 
1076
 
1038
  noleft:
1077
  noleft:
1039
 
1078
 
1040
 
1079
 
1041
; RIGHT {
1080
; RIGHT {
1042
    cmp  al,131+48
1081
    cmp  al,131+48
1043
    jnz  noright
1082
    jnz  noright
1044
    cmp  [posx],79
1083
    cmp  [posx],79
1045
    je   still
1084
    je   still
1046
    inc  [posx]
1085
    inc  [posx]
1047
    call drawfile
1086
    call drawfile
1048
    jmp  still
1087
    jmp  still
1049
; RIGHT }
1088
; RIGHT }
1050
 
1089
 
1051
 
1090
 
1052
  noright:
1091
  noright:
1053
 
1092
 
1054
 
1093
 
1055
; PAGE_UP {
1094
; PAGE_UP {
1056
  page_up:
1095
  page_up:
1057
    cmp  al,136+48
1096
    cmp  al,136+48
1058
    jnz  nopu
1097
    jnz  nopu
1059
scrl_up:
1098
scrl_up:
1060
    mov  eax,[slines]
1099
    mov  eax,[slines]
1061
    dec  eax
1100
    dec  eax
1062
;   imul eax,80
1101
;   imul eax,80
1063
    lea  eax,[eax+eax*4]
1102
    lea  eax,[eax+eax*4]
1064
    shl  eax,4
1103
    shl  eax,4
1065
    mov  ecx,[post]
1104
    mov  ecx,[post]
1066
    cmp  eax,ecx
1105
    cmp  eax,ecx
1067
    jbe  pu1
1106
    jbe  pu1
1068
    mov  ecx,eax
1107
    mov  ecx,eax
1069
   pu1:
1108
   pu1:
1070
    sub  ecx,eax
1109
    sub  ecx,eax
1071
    mov  [post],ecx
1110
    mov  [post],ecx
1072
 
1111
 
1073
    call clear_screen
1112
    call clear_screen
1074
    call drawfile
1113
    call drawfile
1075
    call draw_vertical_scroll
1114
    call draw_vertical_scroll
1076
;call calc_scroll_size_and_pos
1115
;call calc_scroll_size_and_pos
1077
    jmp  still
1116
    jmp  still
1078
; PAGE_UP }
1117
; PAGE_UP }
1079
 
1118
 
1080
 
1119
 
1081
  nopu:
1120
  nopu:
1082
 
1121
 
1083
 
1122
 
1084
; PAGE_DOWN {
1123
; PAGE_DOWN {
1085
  page_down:
1124
  page_down:
1086
    cmp  al,135+48
1125
    cmp  al,135+48
1087
    jnz  nopd
1126
    jnz  nopd
1088
scrl_down:
1127
scrl_down:
1089
    mov  eax,[lines]
1128
    mov  eax,[lines]
1090
    cmp  eax,[slines]
1129
    cmp  eax,[slines]
1091
    jb   still
1130
    jb   still
1092
 
1131
 
1093
    mov  eax,[post]   ; eax = offset
1132
    mov  eax,[post]   ; eax = offset
1094
    cdq
1133
    cdq
1095
    mov  ebx,80
1134
    mov  ebx,80
1096
    div  ebx          ; eax /= 80
1135
    div  ebx          ; eax /= 80
1097
    mov  ecx,[lines]  ; ecx = lines in the file
1136
    mov  ecx,[lines]  ; ecx = lines in the file
1098
    cmp  eax,ecx      ; if eax < ecx goto pfok
1137
    cmp  eax,ecx      ; if eax < ecx goto pfok
1099
    jnb  still
1138
    jnb  still
1100
    mov  eax,[slines] ; eax = lines on the screen
1139
    mov  eax,[slines] ; eax = lines on the screen
1101
    dec  eax          ; eax--
1140
    dec  eax          ; eax--
1102
;   imul eax,80       ; eax *= 80
1141
;   imul eax,80       ; eax *= 80
1103
    lea  eax,[eax+eax*4]
1142
    lea  eax,[eax+eax*4]
1104
    shl  eax,4
1143
    shl  eax,4
1105
    add  [post],eax   ; offset += eax
1144
    add  [post],eax   ; offset += eax
1106
 
1145
 
1107
    mov  eax,[lines]  ; eax =  lines in the file
1146
    mov  eax,[lines]  ; eax =  lines in the file
1108
    sub  eax,[slines] ; eax -= lines on the screen
1147
    sub  eax,[slines] ; eax -= lines on the screen
1109
;   imul eax,80       ; eax *= 80
1148
;   imul eax,80       ; eax *= 80
1110
    lea  eax,[eax+eax*4]
1149
    lea  eax,[eax+eax*4]
1111
    shl  eax,4
1150
    shl  eax,4
1112
    cmp  [post],eax
1151
    cmp  [post],eax
1113
    jb   @f
1152
    jb   @f
1114
    mov  [post],eax
1153
    mov  [post],eax
1115
  @@:
1154
  @@:
1116
 
1155
 
1117
    call clear_screen
1156
    call clear_screen
1118
    call drawfile
1157
    call drawfile
1119
    call draw_vertical_scroll
1158
    call draw_vertical_scroll
1120
;call calc_scroll_size_and_pos
1159
;call calc_scroll_size_and_pos
1121
 
1160
 
1122
    jmp  still
1161
    jmp  still
1123
; PAGE_DOWN }
1162
; PAGE_DOWN }
1124
 
1163
 
1125
  nopd:
1164
  nopd:
1126
 
1165
 
1127
; HOME {
1166
; HOME {
1128
    cmp  al,132+48
1167
    cmp  al,132+48
1129
    jnz  nohome
1168
    jnz  nohome
1130
 
1169
 
1131
    push 0
1170
    push 0
1132
    pop  [posx]
1171
    pop  [posx]
1133
 
1172
 
1134
    call drawfile
1173
    call drawfile
1135
    jmp  still
1174
    jmp  still
1136
; HOME }
1175
; HOME }
1137
 
1176
 
1138
 
1177
 
1139
  nohome:
1178
  nohome:
1140
 
1179
 
1141
 
1180
 
1142
; END {
1181
; END {
1143
  end_key:
1182
  end_key:
1144
    cmp    al,133+48
1183
    cmp    al,133+48
1145
    jnz    noend
1184
    jnz    noend
1146
 
1185
 
1147
    imul   eax,[posy],80
1186
    imul   eax,[posy],80
1148
    add    eax,0x80000
1187
    add    eax,0x80000
1149
    add    eax,[post]
1188
    add    eax,[post]
1150
 
1189
 
1151
    mov    esi,eax
1190
    mov    esi,eax
1152
    add    eax,80+1
1191
    add    eax,80+1
1153
 
1192
 
1154
@@: dec    eax
1193
@@: dec    eax
1155
    cmp    eax,esi
1194
    cmp    eax,esi
1156
    je     @f
1195
    je     @f
1157
    cmp    byte [eax-1],' '
1196
    cmp    byte [eax-1],' '
1158
    jbe    @b
1197
    jbe    @b
1159
@@:
1198
@@:
1160
    sub    eax,esi
1199
    sub    eax,esi
1161
    cmp    eax,80-1
1200
    cmp    eax,80-1
1162
    jbe    @f
1201
    jbe    @f
1163
    dec    eax
1202
    dec    eax
1164
@@:
1203
@@:
1165
    mov    [posx],eax
1204
    mov    [posx],eax
1166
 
1205
 
1167
    call drawfile
1206
    call drawfile
1168
    jmp  still
1207
    jmp  still
1169
; END }
1208
; END }
1170
 
1209
 
1171
 
1210
 
1172
  noend:
1211
  noend:
1173
 
1212
 
1174
 
1213
 
1175
; GO_START {
1214
; GO_START {
1176
    cmp  al,251         ; Ctrl + [
1215
    cmp  al,251         ; Ctrl + [
1177
    jnz  no_go_to_start
1216
    jnz  no_go_to_start
1178
 
1217
 
1179
    push 0
1218
    push 0
1180
    pop  [post]         ; offset = 0
1219
    pop  [post]         ; offset = 0
1181
 
1220
 
1182
    call clear_screen
1221
    call clear_screen
1183
    call drawfile       ; draw file
1222
    call drawfile       ; draw file
1184
    call draw_vertical_scroll
1223
    call draw_vertical_scroll
1185
;call calc_scroll_size_and_pos
1224
;call calc_scroll_size_and_pos
1186
    jmp  still          ; go to still
1225
    jmp  still          ; go to still
1187
; GO_START }
1226
; GO_START }
1188
 
1227
 
1189
 
1228
 
1190
  no_go_to_start:
1229
  no_go_to_start:
1191
 
1230
 
1192
 
1231
 
1193
; GO_END {
1232
; GO_END {
1194
    cmp  al,253         ; Ctrl + ]
1233
    cmp  al,253         ; Ctrl + ]
1195
    jnz  no_go_to_end
1234
    jnz  no_go_to_end
1196
    cmp [lines],30   ;to fix ctrl+] bug
1235
    cmp [lines],30   ;to fix ctrl+] bug
1197
    jb @f
1236
    jb @f
1198
    mov  eax,[lines]    ; eax = lines in the file
1237
    mov  eax,[lines]    ; eax = lines in the file
1199
    sub  eax,[slines]   ; eax -= lines on the screen
1238
    sub  eax,[slines]   ; eax -= lines on the screen
1200
;   imul eax,80         ; eax *= 80 (length of line)
1239
;   imul eax,80         ; eax *= 80 (length of line)
1201
    lea  eax,[eax+eax*4]
1240
    lea  eax,[eax+eax*4]
1202
    shl  eax,4
1241
    shl  eax,4
1203
    mov  [post],eax     ; offset in the file
1242
    mov  [post],eax     ; offset in the file
1204
 
1243
 
1205
    call clear_screen
1244
    call clear_screen
1206
    call drawfile       ; draw file
1245
    call drawfile       ; draw file
1207
    call draw_vertical_scroll
1246
    call draw_vertical_scroll
1208
    @@:
1247
    @@:
1209
    jmp  still          ; go to still
1248
    jmp  still          ; go to still
1210
; GO_END }
1249
; GO_END }
1211
 
1250
 
1212
 
1251
 
1213
  no_go_to_end:
1252
  no_go_to_end:
1214
 
1253
 
1215
 
1254
 
1216
; DELETE {
1255
; DELETE {
1217
    cmp  al,134+48
1256
    cmp  al,134+48
1218
    jne  nodel
1257
    jne  nodel
1219
 
1258
 
1220
    imul eax,[posy],80
1259
    imul eax,[posy],80
1221
    add  eax,0x80000
1260
    add  eax,0x80000
1222
    add  eax,[post]
1261
    add  eax,[post]
1223
    add  eax,[posx]
1262
    add  eax,[posx]
1224
    mov  ecx,eax
1263
    mov  ecx,eax
1225
 
1264
 
1226
    imul eax,[posy],80
1265
    imul eax,[posy],80
1227
    add  eax,0x80000+79
1266
    add  eax,0x80000+79
1228
    add  eax,[post]
1267
    add  eax,[post]
1229
    mov  ebx,eax
1268
    mov  ebx,eax
1230
 
1269
 
1231
    push ebx
1270
    push ebx
1232
 
1271
 
1233
    dec  ecx
1272
    dec  ecx
1234
    dec  ebx
1273
    dec  ebx
1235
 
1274
 
1236
 
1275
 
1237
    push ecx ebx
1276
    push ecx ebx
1238
 
1277
 
1239
    push ebx
1278
    push ebx
1240
 
1279
 
1241
    imul eax,[posy],80
1280
    imul eax,[posy],80
1242
    add  eax,0x80000
1281
    add  eax,0x80000
1243
    add  eax,[post]
1282
    add  eax,[post]
1244
    mov  ecx,eax
1283
    mov  ecx,eax
1245
 
1284
 
1246
    xor  eax,eax
1285
    xor  eax,eax
1247
    cdq
1286
    cdq
1248
 
1287
 
1249
    pop  ebx
1288
    pop  ebx
1250
 
1289
 
1251
    dec  ecx
1290
    dec  ecx
1252
   @@:
1291
   @@:
1253
    inc  ecx
1292
    inc  ecx
1254
    mov  dh,[ecx]
1293
    mov  dh,[ecx]
1255
    cmp  dh,33
1294
    cmp  dh,33
1256
    jb   .nok
1295
    jb   .nok
1257
    xor  eax,eax
1296
    xor  eax,eax
1258
    inc  eax
1297
    inc  eax
1259
   .nok:
1298
   .nok:
1260
    cmp  ecx,ebx
1299
    cmp  ecx,ebx
1261
    jb   @b
1300
    jb   @b
1262
 
1301
 
1263
    pop  ebx ecx
1302
    pop  ebx ecx
1264
 
1303
 
1265
   @@:
1304
   @@:
1266
    inc  ecx
1305
    inc  ecx
1267
    mov  dl,[ecx+1]
1306
    mov  dl,[ecx+1]
1268
    mov  [ecx],dl
1307
    mov  [ecx],dl
1269
    cmp  ecx,ebx
1308
    cmp  ecx,ebx
1270
    jb   @b
1309
    jb   @b
1271
 
1310
 
1272
 
1311
 
1273
    pop  ebx
1312
    pop  ebx
1274
    mov  [ebx],byte 32
1313
    mov  [ebx],byte 32
1275
 
1314
 
1276
    test eax,eax
1315
    test eax,eax
1277
    jz   dellinesup
1316
    jz   dellinesup
1278
 
1317
 
1279
    call clear_screen
1318
    call clear_screen
1280
    call drawfile
1319
    call drawfile
1281
    mov [modified],1
1320
    mov [modified],1
1282
 
1321
 
1283
    jmp  still
1322
    jmp  still
1284
 
1323
 
1285
  dellinesup:
1324
  dellinesup:
1286
 
1325
 
1287
    ; lines -1
1326
    ; lines -1
1288
 
1327
 
1289
    pusha
1328
    pusha
1290
 
1329
 
1291
    mov  eax,[post]
1330
    mov  eax,[post]
1292
    cdq
1331
    cdq
1293
    mov  ebx,80
1332
    mov  ebx,80
1294
    div  ebx
1333
    div  ebx
1295
    add  eax,[posy]
1334
    add  eax,[posy]
1296
    inc  eax
1335
    inc  eax
1297
 
1336
 
1298
    cmp  eax,[lines]
1337
    cmp  eax,[lines]
1299
    jb   @f
1338
    jb   @f
1300
 
1339
 
1301
    popa
1340
    popa
1302
    mov [modified],1
1341
    mov [modified],1
1303
 
1342
 
1304
    jmp  still
1343
    jmp  still
1305
 
1344
 
1306
  @@:
1345
  @@:
1307
 
1346
 
1308
    popa
1347
    popa
1309
 
1348
 
1310
    dec  [lines]
1349
    dec  [lines]
1311
 
1350
 
1312
    ; lines up
1351
    ; lines up
1313
 
1352
 
1314
    mov  [posx],dword 0
1353
    mov  [posx],dword 0
1315
 
1354
 
1316
    imul eax,[posy],80
1355
    imul eax,[posy],80
1317
    add  eax,0x80000-1
1356
    add  eax,0x80000-1
1318
    add  eax,[post]
1357
    add  eax,[post]
1319
    mov  ebx,eax
1358
    mov  ebx,eax
1320
 
1359
 
1321
    push ebx
1360
    push ebx
1322
 
1361
 
1323
    imul eax,[lines],80
1362
    imul eax,[lines],80
1324
    add  eax,0x80000-1
1363
    add  eax,0x80000-1
1325
    add  eax,[post]
1364
    add  eax,[post]
1326
    mov  ecx,eax
1365
    mov  ecx,eax
1327
 
1366
 
1328
    pop  ebx
1367
    pop  ebx
1329
 
1368
 
1330
   @@:
1369
   @@:
1331
    mov  dl,[ebx+80]
1370
    mov  dl,[ebx+80]
1332
    mov  [ebx],dl
1371
    mov  [ebx],dl
1333
    inc  ebx
1372
    inc  ebx
1334
 
1373
 
1335
    cmp  ecx,ebx
1374
    cmp  ecx,ebx
1336
    jnz  @b
1375
    jnz  @b
1337
 
1376
 
1338
    call clear_screen
1377
    call clear_screen
1339
    call drawfile
1378
    call drawfile
1340
    mov [modified],1
1379
    mov [modified],1
1341
 
1380
 
1342
    jmp  still
1381
    jmp  still
1343
; DELETE }
1382
; DELETE }
1344
 
1383
 
1345
 
1384
 
1346
  nodel:
1385
  nodel:
1347
 
1386
 
1348
 
1387
 
1349
; INSERT {
1388
; INSERT {
1350
    cmp  al,137+48
1389
    cmp  al,137+48
1351
    jnz  noins
1390
    jnz  noins
1352
 
1391
 
1353
    imul eax,[posy],80
1392
    imul eax,[posy],80
1354
    add  eax,0x80000
1393
    add  eax,0x80000
1355
    add  eax,[post]
1394
    add  eax,[post]
1356
    add  eax,[posx]
1395
    add  eax,[posx]
1357
    mov  ecx,eax
1396
    mov  ecx,eax
1358
    ; ecx = [posy]*80+0x80000+[post]+[posx]
1397
    ; ecx = [posy]*80+0x80000+[post]+[posx]
1359
 
1398
 
1360
    imul eax,[posy],80
1399
    imul eax,[posy],80
1361
    add  eax,0x80000+79
1400
    add  eax,0x80000+79
1362
    add  eax,[post]
1401
    add  eax,[post]
1363
    mov  ebx,eax
1402
    mov  ebx,eax
1364
    ; ebx = [posy]*80+0x80000+79+[post]
1403
    ; ebx = [posy]*80+0x80000+79+[post]
1365
 
1404
 
1366
   .movstr:
1405
   .movstr:
1367
    dec  ebx
1406
    dec  ebx
1368
    mov  dl,[ebx]
1407
    mov  dl,[ebx]
1369
    mov  [ebx+1],dl
1408
    mov  [ebx+1],dl
1370
    cmp  ecx,ebx
1409
    cmp  ecx,ebx
1371
    jb   .movstr
1410
    jb   .movstr
1372
 
1411
 
1373
    mov  [ecx],byte ' '
1412
    mov  [ecx],byte ' '
1374
 
1413
 
1375
    call invalidate_string
1414
    call invalidate_string
1376
    call drawfile
1415
    call drawfile
1377
    mov [modified],1
1416
    mov [modified],1
1378
 
1417
 
1379
    jmp  still
1418
    jmp  still
1380
; INSERT }
1419
; INSERT }
1381
 
1420
 
1382
 
1421
 
1383
  noins:
1422
  noins:
1384
 
1423
 
1385
 
1424
 
1386
; BACKSPACE {
1425
; BACKSPACE {
1387
    cmp  al,8
1426
    cmp  al,8
1388
    jnz  nobs
1427
    jnz  nobs
1389
    mov  ecx,[posx]
1428
    mov  ecx,[posx]
1390
    test ecx,ecx
1429
    test ecx,ecx
1391
    jz   still
1430
    jz   still
1392
    dec  ecx
1431
    dec  ecx
1393
    mov  [posx],ecx
1432
    mov  [posx],ecx
1394
 
1433
 
1395
    imul eax,[posy],80
1434
    imul eax,[posy],80
1396
    add  eax,0x80000
1435
    add  eax,0x80000
1397
    add  eax,[post]
1436
    add  eax,[post]
1398
    add  eax,[posx]
1437
    add  eax,[posx]
1399
    mov  ebx,eax
1438
    mov  ebx,eax
1400
 
1439
 
1401
    push ebx
1440
    push ebx
1402
 
1441
 
1403
    imul eax,[posy],80
1442
    imul eax,[posy],80
1404
    add  eax,0x80000+79
1443
    add  eax,0x80000+79
1405
    add  eax,[post]
1444
    add  eax,[post]
1406
    mov  ebx,eax
1445
    mov  ebx,eax
1407
 
1446
 
1408
    pop  ecx
1447
    pop  ecx
1409
 
1448
 
1410
    push ebx
1449
    push ebx
1411
 
1450
 
1412
    dec  ecx
1451
    dec  ecx
1413
   .movleft:
1452
   .movleft:
1414
    inc  ecx
1453
    inc  ecx
1415
    mov  dl,[ecx+1]
1454
    mov  dl,[ecx+1]
1416
    mov  [ecx],dl
1455
    mov  [ecx],dl
1417
    cmp  ecx,ebx
1456
    cmp  ecx,ebx
1418
    jb   .movleft
1457
    jb   .movleft
1419
 
1458
 
1420
    pop  ebx
1459
    pop  ebx
1421
    mov  [ebx],byte ' '
1460
    mov  [ebx],byte ' '
1422
 
1461
 
1423
    call invalidate_string
1462
    call invalidate_string
1424
    call drawfile
1463
    call drawfile
1425
    mov [modified],1
1464
    mov [modified],1
1426
 
1465
 
1427
    jmp  still
1466
    jmp  still
1428
; BACKSPACE }
1467
; BACKSPACE }
1429
 
1468
 
1430
 
1469
 
1431
  nobs:
1470
  nobs:
1432
 
1471
 
1433
 
1472
 
1434
; TAB {
1473
; TAB {
1435
    cmp  eax,9  ; Tab
1474
    cmp  eax,9  ; Tab
1436
    jne  notab
1475
    jne  notab
1437
 
1476
 
1438
    mov  eax,[posx]
1477
    mov  eax,[posx]
1439
    cmp  eax,80-1
1478
    cmp  eax,80-1
1440
    jae  still
1479
    jae  still
1441
    add  eax,5          ; 9         5        3
1480
    add  eax,5          ; 9         5        3
1442
    and  eax,11111100b  ; ...1000b, ...100b, ...10b
1481
    and  eax,11111100b  ; ...1000b, ...100b, ...10b
1443
    dec  eax
1482
    dec  eax
1444
    mov  [posx], eax
1483
    mov  [posx], eax
1445
 
1484
 
1446
    call drawfile
1485
    call drawfile
1447
    mov [modified],1
1486
    mov [modified],1
1448
 
1487
 
1449
    jmp  still
1488
    jmp  still
1450
; TAB }
1489
; TAB }
1451
 
1490
 
1452
 
1491
 
1453
  notab:
1492
  notab:
1454
 
1493
 
1455
 
1494
 
1456
; ADD_KEY {
1495
; ADD_KEY {
1457
    push eax  ; add key
1496
    push eax  ; add key
1458
 
1497
 
1459
    imul eax,[posy],80
1498
    imul eax,[posy],80
1460
    add  eax,0x80000
1499
    add  eax,0x80000
1461
    add  eax,[post]
1500
    add  eax,[post]
1462
    add  eax,[posx]
1501
    add  eax,[posx]
1463
    mov  ecx,eax
1502
    mov  ecx,eax
1464
 
1503
 
1465
    push ecx
1504
    push ecx
1466
 
1505
 
1467
    imul eax,[posy],80
1506
    imul eax,[posy],80
1468
    add  eax,0x80000+79
1507
    add  eax,0x80000+79
1469
    add  eax,[post]
1508
    add  eax,[post]
1470
    mov  ebx,eax
1509
    mov  ebx,eax
1471
 
1510
 
1472
   .movright:
1511
   .movright:
1473
    dec  ebx
1512
    dec  ebx
1474
    mov  al,[ebx]
1513
    mov  al,[ebx]
1475
    mov  [ebx+1],al
1514
    mov  [ebx+1],al
1476
    cmp  ecx,ebx
1515
    cmp  ecx,ebx
1477
    jbe  .movright
1516
    jbe  .movright
1478
 
1517
 
1479
    pop  ebx
1518
    pop  ebx
1480
 
1519
 
1481
    pop  eax
1520
    pop  eax
1482
 
1521
 
1483
    mov  [ebx],al
1522
    mov  [ebx],al
1484
    mov  edx,78
1523
    mov  edx,78
1485
    mov  ecx,[posx]
1524
    mov  ecx,[posx]
1486
    cmp  edx,ecx
1525
    cmp  edx,ecx
1487
    jb   noxp
1526
    jb   noxp
1488
    inc  ecx
1527
    inc  ecx
1489
    mov  [posx],ecx
1528
    mov  [posx],ecx
1490
  noxp:
1529
  noxp:
1491
 
1530
 
1492
    call invalidate_string
1531
    call invalidate_string
1493
    call drawfile
1532
    call drawfile
1494
    mov [modified],1
1533
    mov [modified],1
1495
;    call draw_vertical_scroll
1534
;    call draw_vertical_scroll
1496
    jmp  still
1535
    jmp  still
1497
; ADD_KEY }
1536
; ADD_KEY }
1498
 
1537
 
1499
 
1538
 
1500
;******************************************************************************
1539
;******************************************************************************
1501
 
1540
 
1502
start_fasm:
1541
start_fasm:
1503
   cmp     [asm_mode],1
1542
   cmp     [asm_mode],1
1504
   je      @f
1543
   je      @f
1505
   ret
1544
   ret
1506
  @@:
1545
  @@:
1507
   mov     esi,filename
1546
   mov     esi,filename
1508
   mov     edi,fasm_parameters
1547
   mov     edi,fasm_parameters
1509
 
1548
 
1510
   cmp     byte [esi],'/'
1549
   cmp     byte [esi],'/'
1511
   je      .yes_systree
1550
   je      .yes_systree
1512
 
1551
 
1513
   mov     ecx,[filename_len]
1552
   mov     ecx,[filename_len]
1514
   rep     movsb
1553
   rep     movsb
1515
 
1554
 
1516
   mov     al,','
1555
   mov     al,','
1517
   stosb
1556
   stosb
1518
 
1557
 
1519
   mov     ecx,[filename_len]
1558
   mov     ecx,[filename_len]
1520
   add     ecx,-4
1559
   add     ecx,-4
1521
   mov     esi,filename
1560
   mov     esi,filename
1522
   rep     movsb
1561
   rep     movsb
1523
 
1562
 
1524
   mov     al,','
1563
   mov     al,','
1525
   stosb
1564
   stosb
1526
 
1565
 
1527
   mov     [edi],dword '/RD/'
1566
   mov     [edi],dword '/RD/'
1528
   add     edi,4
1567
   add     edi,4
1529
   mov     [edi],word '1/'
1568
   mov     [edi],word '1/'
1530
   inc     edi
1569
   inc     edi
1531
   inc     edi
1570
   inc     edi
1532
 
1571
 
1533
   mov     al,0
1572
   mov     al,0
1534
   stosb
1573
   stosb
1535
 
1574
 
1536
   jmp     .run
1575
   jmp     .run
1537
 
1576
 
1538
 .yes_systree:
1577
 .yes_systree:
1539
   add     esi,[filename_len]
1578
   add     esi,[filename_len]
1540
   dec     esi
1579
   dec     esi
1541
 
1580
 
1542
   xor     ecx,ecx
1581
   xor     ecx,ecx
1543
   mov     al,'/'
1582
   mov     al,'/'
1544
 @@:
1583
 @@:
1545
   cmp     [esi],al
1584
   cmp     [esi],al
1546
   je      @f
1585
   je      @f
1547
   dec     esi
1586
   dec     esi
1548
   inc     ecx
1587
   inc     ecx
1549
   jmp     @b
1588
   jmp     @b
1550
 @@:
1589
 @@:
1551
   inc     esi
1590
   inc     esi
1552
 
1591
 
1553
   push    esi
1592
   push    esi
1554
   push    esi
1593
   push    esi
1555
   push    ecx
1594
   push    ecx
1556
 
1595
 
1557
   rep     movsb
1596
   rep     movsb
1558
 
1597
 
1559
   mov     al,','
1598
   mov     al,','
1560
   stosb
1599
   stosb
1561
 
1600
 
1562
   pop     ecx
1601
   pop     ecx
1563
   pop     esi
1602
   pop     esi
1564
 
1603
 
1565
   add     ecx,-4
1604
   add     ecx,-4
1566
   rep     movsb
1605
   rep     movsb
1567
 
1606
 
1568
   mov     al,','
1607
   mov     al,','
1569
   stosb
1608
   stosb
1570
 
1609
 
1571
   pop     ecx
1610
   pop     ecx
1572
   sub     ecx,filename
1611
   sub     ecx,filename
1573
   mov     esi,filename
1612
   mov     esi,filename
1574
 
1613
 
1575
   rep     movsb
1614
   rep     movsb
1576
 
1615
 
1577
   mov     al,0
1616
   mov     al,0
1578
   stosb
1617
   stosb
1579
 
1618
 
1580
 .run:
1619
 .run:
1581
   cmp     [run_outfile],1
1620
   cmp     [run_outfile],1
1582
   jne     @f
1621
   jne     @f
1583
   dec     edi
1622
   dec     edi
1584
   mov     eax,',run'
1623
   mov     eax,',run'
1585
   stosd
1624
   stosd
1586
   mov     al,0
1625
   mov     al,0
1587
   stosb
1626
   stosb
1588
  @@:
1627
  @@:
1589
 
1628
 
1590
   mov     eax,19
1629
   mov     eax,19
1591
   mov     ebx,fasm_filename
1630
   mov     ebx,fasm_filename
1592
   mov     ecx,fasm_parameters
1631
   mov     ecx,fasm_parameters
1593
   int     0x40
1632
   int     0x40
1594
ret
1633
ret
1595
 
1634
 
1596
open_debug_board:
1635
open_debug_board:
1597
   mov     eax,19
1636
   mov     eax,19
1598
   mov     ebx,debug_filename
1637
   mov     ebx,debug_filename
1599
   xor     ecx,ecx
1638
   xor     ecx,ecx
1600
   int     0x40
1639
   int     0x40
1601
ret
1640
ret
1602
 
1641
 
1603
open_sysfuncs_txt:
1642
open_sysfuncs_txt:
1604
   mov     eax,19
1643
   mov     eax,19
1605
   mov     ebx,tinypad_filename
1644
   mov     ebx,tinypad_filename
1606
   mov     ecx,sysfuncs_filename
1645
   mov     ecx,sysfuncs_filename
1607
   int     0x40
1646
   int     0x40
1608
ret
1647
ret
1609
 
1648
 
1610
 
1649
 
1611
empty_work_space:
1650
empty_work_space:
1612
; ®ç¨áâ¨âì ¢á¥
1651
; ®ç¨áâ¨âì ¢á¥
1613
   mov     eax,'    '
1652
   mov     eax,'    '
1614
   mov     edi,0x80000
1653
   mov     edi,0x80000
1615
   mov     ecx,(0x300000-0x90000)/4
1654
   mov     ecx,(0x300000-0x90000)/4
1616
   cld
1655
   cld
1617
   rep     stosd
1656
   rep     stosd
1618
   mov     edi,0x10000
1657
   mov     edi,0x10000
1619
   mov     ecx,0x60000/4
1658
   mov     ecx,0x60000/4
1620
   rep     stosd
1659
   rep     stosd
1621
ret
1660
ret
1622
 
1661
 
1623
 
1662
 
1624
clear_screen:
1663
clear_screen:
1625
; ®ç¨áâ¨âì íªà ­
1664
; ®ç¨áâ¨âì íªà ­
1626
   mov     ecx,80*40
1665
   mov     ecx,80*40
1627
   mov     edi,0x78000
1666
   mov     edi,0x78000
1628
   xor     eax,eax
1667
   xor     eax,eax
1629
 @@:
1668
 @@:
1630
   mov     [edi],eax
1669
   mov     [edi],eax
1631
   add     edi,4
1670
   add     edi,4
1632
   dec     ecx
1671
   dec     ecx
1633
   jnz     @b
1672
   jnz     @b
1634
ret
1673
ret
1635
 
1674
 
1636
invalidate_string:
1675
invalidate_string:
1637
   imul    eax,[posy],80
1676
   imul    eax,[posy],80
1638
   add     eax,0x78000
1677
   add     eax,0x78000
1639
   mov     edi,eax
1678
   mov     edi,eax
1640
   mov     al,1
1679
   mov     al,1
1641
   mov     ecx,80/4
1680
   mov     ecx,80/4
1642
   rep     stosd
1681
   rep     stosd
1643
ret
1682
ret
1644
 
1683
 
1645
layout:
1684
layout:
1646
; ᬥ­¨âì à áª« ¤ªã ª« ¢¨ âãàë
1685
; ᬥ­¨âì à áª« ¤ªã ª« ¢¨ âãàë
1647
   mov     eax,19
1686
   mov     eax,19
1648
   mov     ebx,setup
1687
   mov     ebx,setup
1649
   mov     ecx,param_setup
1688
   mov     ecx,param_setup
1650
   int     0x40
1689
   int     0x40
1651
   mov     eax,5
1690
   mov     eax,5
1652
   mov     ebx,eax
1691
   mov     ebx,eax
1653
   int     0x40
1692
   int     0x40
1654
   call    activate_me
1693
   call    activate_me
1655
ret
1694
ret
1656
 
1695
 
1657
 
1696
 
1658
activate_me:
1697
activate_me:
1659
; 1) get info about me
1698
; 1) get info about me
1660
   mov     eax,9
1699
   mov     eax,9
1661
   mov     ebx,procinfo
1700
   mov     ebx,procinfo
1662
   mov     ecx,-1
1701
   mov     ecx,-1
1663
   int     0x40
1702
   int     0x40
1664
   ; eax = number of processes
1703
   ; eax = number of processes
1665
 
1704
 
1666
; save process counter
1705
; save process counter
1667
   inc     eax
1706
   inc     eax
1668
   inc     eax
1707
   inc     eax
1669
   mov     [proccount],eax
1708
   mov     [proccount],eax
1670
 
1709
 
1671
   mov     eax,[procinfo.PID]
1710
   mov     eax,[procinfo.PID]
1672
   mov     [PID],eax
1711
   mov     [PID],eax
1673
 
1712
 
1674
; 2) get my process number
1713
; 2) get my process number
1675
   mov     eax,9
1714
   mov     eax,9
1676
   mov     ebx,procinfo
1715
   mov     ebx,procinfo
1677
   mov     ecx,[proccount]
1716
   mov     ecx,[proccount]
1678
 @@:
1717
 @@:
1679
   dec     ecx
1718
   dec     ecx
1680
   jz      @f    ; counter=0 => not found? => return
1719
   jz      @f    ; counter=0 => not found? => return
1681
   mov     eax,9
1720
   mov     eax,9
1682
   int     0x40
1721
   int     0x40
1683
   mov     edx,[procinfo.PID]
1722
   mov     edx,[procinfo.PID]
1684
   cmp     edx,[PID]
1723
   cmp     edx,[PID]
1685
   jne     @b
1724
   jne     @b
1686
 
1725
 
1687
   ;found: ecx = process_number
1726
   ;found: ecx = process_number
1688
   mov     eax,18
1727
   mov     eax,18
1689
   mov     ebx,3
1728
   mov     ebx,3
1690
   int     0x40
1729
   int     0x40
1691
 
1730
 
1692
   mov     eax,5
1731
   mov     eax,5
1693
   mov     ebx,eax
1732
   mov     ebx,eax
1694
   int     0x40
1733
   int     0x40
1695
 
1734
 
1696
 @@:
1735
 @@:
1697
ret
1736
ret
1698
 
1737
 
1699
 
1738
 
1700
 
1739
 
1701
 
1740
 
1702
; *******************************************************************
1741
; *******************************************************************
1703
; **************************  DRAW WINDOW  **************************
1742
; **************************  DRAW WINDOW  **************************
1704
; *******************************************************************
1743
; *******************************************************************
1705
 
1744
 
1706
align 4
1745
align 4
1707
drawwindow:
1746
drawwindow:
1708
 
1747
 
1709
    mov  eax,12                   ; WINDOW DRAW START
1748
    mov  eax,12                   ; WINDOW DRAW START
1710
    mov  ebx,1
1749
    mov  ebx,1
1711
    int  0x40
1750
    int  0x40
1712
  mov [menu_is_on],0
1751
  mov [menu_is_on],0
1713
    mov  eax,48  ; get system colors
1752
    mov  eax,48  ; get system colors
1714
    mov  ebx,3
1753
    mov  ebx,3
1715
    mov  ecx,sc
1754
    mov  ecx,sc
1716
    mov  edx,sizeof.system_colors
1755
    mov  edx,sizeof.system_colors
1717
    int  0x40
1756
    int  0x40
1718
 
1757
 
1719
    mov  [sc.work],0xe0e0e0
1758
    mov  [sc.work],0xe0e0e0
1720
 
1759
 
1721
    xor  eax,eax                  ; DEFINE WINDOW
1760
    xor  eax,eax                  ; DEFINE WINDOW
1722
    mov  ebx,100*65536+506 ; 496
1761
    mov  ebx,100*65536+506 ; 496
1723
    mov  ecx,75*65536+400 ;385;400  ; sum < 480 for 640x480
1762
    mov  ecx,75*65536+400 ;385;400  ; sum < 480 for 640x480
1724
    mov  edx,[sc.work]
1763
    mov  edx,[sc.work]
1725
    add  edx,0x03000000
1764
    add  edx,0x03000000
1726
    mov  esi,[sc.grab]
1765
    mov  esi,[sc.grab]
1727
    or   esi,0x80000000
1766
    or   esi,0x80000000
1728
    mov  edi,[sc.frame]
1767
    mov  edi,[sc.frame]
1729
    int  0x40
1768
    int  0x40
1730
 
1769
 
1731
; header string
1770
; header string
1732
    mov  eax,4
1771
    mov  eax,4
1733
    mov  ebx,10*65536+8
1772
    mov  ebx,10*65536+8
1734
    mov  ecx,[sc.grab_text]
1773
    mov  ecx,[sc.grab_text]
1735
    mov  edx,header
1774
    mov  edx,header
1736
    mov  esi,[headlen]
1775
    mov  esi,[headlen]
1737
    int  0x40
1776
    int  0x40
1738
 
1777
 
1739
    mov  eax,9    ; get info about me
1778
    mov  eax,9    ; get info about me
1740
    mov  ebx,procinfo
1779
    mov  ebx,procinfo
1741
    or   ecx,-1
1780
    or   ecx,-1
1742
    int  0x40
1781
    int  0x40
1743
 
1782
 
1744
    mov  eax,[procinfo.y_size]
1783
    mov  eax,[procinfo.y_size]
1745
 
1784
 
1746
    mov  [do_not_draw],1 ; do_not_draw = true
1785
    mov  [do_not_draw],1 ; do_not_draw = true
1747
    cmp  eax,100
1786
    cmp  eax,100
1748
    jb   .no_draw        ; do not draw text & buttons if height < 100
1787
    jb   .no_draw        ; do not draw text & buttons if height < 100
1749
    mov  [do_not_draw],0 ; do_not_draw = false
1788
    mov  [do_not_draw],0 ; do_not_draw = false
1750
    add  eax,-(46+47) ;  46 = y offs
1789
    add  eax,-(46+47) ;  46 = y offs
1751
    cdq
1790
    cdq
1752
    mov  ebx,10
1791
    mov  ebx,10
1753
    div  ebx
1792
    div  ebx
1754
    mov  [slines],eax
1793
    mov  [slines],eax
1755
 
1794
 
1756
    cmp  eax,[posy]
1795
    cmp  eax,[posy]
1757
    jnb  @f
1796
    jnb  @f
1758
    dec  eax
1797
    dec  eax
1759
    mov  [posy],eax
1798
    mov  [posy],eax
1760
  @@:
1799
  @@:
1761
 
1800
 
1762
    mov  eax,[procinfo.y_size] ; calculate buttons position
1801
    mov  eax,[procinfo.y_size] ; calculate buttons position
1763
    add  eax,-47
1802
    add  eax,-47
1764
    mov  [dstart],eax
1803
    mov  [dstart],eax
1765
 
1804
 
1766
;    mov  eax,8                   ; STRING BUTTON
1805
;    mov  eax,8                   ; STRING BUTTON
1767
;    mov  ebx,5*65536+57
1806
;    mov  ebx,5*65536+57
1768
;    mov  ecx,[dstart]
1807
;    mov  ecx,[dstart]
1769
;    add  ecx,29
1808
;    add  ecx,29
1770
;    shl  ecx,16
1809
;    shl  ecx,16
1771
;    add  ecx,13
1810
;    add  ecx,13
1772
;    mov  edx,51              ;;;;;-----string button ID=51
1811
;    mov  edx,51              ;;;;;-----string button ID=51
1773
;    mov  esi,[sc.work_button]
1812
;    mov  esi,[sc.work_button]
1774
;    int  0x40
1813
;    int  0x40
1775
                                  ; SEARCH BUTTON
1814
                                  ; SEARCH BUTTON
1776
;    mov  ebx,(505-129)*65536+125
1815
;    mov  ebx,(505-129)*65536+125
1777
;    mov  edx,50
1816
;    mov  edx,50
1778
;    mov  esi,[sc.work_button]
1817
;    mov  esi,[sc.work_button]
1779
;    int  0x40
1818
;    int  0x40
1780
 
1819
 
1781
;    mov  eax,4                   ; SEARCH TEXT
1820
;    mov  eax,4                   ; SEARCH TEXT
1782
;    mov  ebx,[dstart]
1821
;    mov  ebx,[dstart]
1783
;    add  ebx,7*65536+32
1822
;    add  ebx,7*65536+32
1784
;    mov  ecx,[sc.work_button_text]
1823
;    mov  ecx,[sc.work_button_text]
1785
;    mov  edx,searcht
1824
;    mov  edx,searcht
1786
;    mov  esi,searchtl-searcht
1825
;    mov  esi,searchtl-searcht
1787
;    int  0x40
1826
;    int  0x40
1788
 
1827
 
1789
 
1828
 
1790
    mov  eax,13                   ; BAR STRIPE
1829
    mov  eax,13                   ; BAR STRIPE
1791
    mov  ebx,5*65536+497
1830
    mov  ebx,5*65536+497
1792
    mov  ecx,[dstart]
1831
    mov  ecx,[dstart]
1793
    shl  ecx,16
1832
    shl  ecx,16
1794
    add  ecx,30 ;15
1833
    add  ecx,30 ;15
1795
 
1834
 
1796
    mov  edx,0x00aaaaaa
1835
    mov  edx,0x00aaaaaa
1797
    int  0x40
1836
    int  0x40
1798
 
1837
 
1799
;    mov  eax,4                   ; FIRST TEXT LINE (POSITION...)
1838
;    mov  eax,4                   ; FIRST TEXT LINE (POSITION...)
1800
;    mov  ebx,12*65536
1839
;    mov  ebx,12*65536
1801
;    add  ebx,[dstart]
1840
;    add  ebx,[dstart]
1802
;    add  ebx,38 ;18
1841
;    add  ebx,38 ;18
1803
;    mov  ecx,[sc.work_button_text]
1842
;    mov  ecx,[sc.work_button_text]
1804
;    mov  edx,htext2
1843
;    mov  edx,htext2
1805
;    mov  esi,htextlen2-htext2
1844
;    mov  esi,htextlen2-htext2
1806
;    int  0x40
1845
;    int  0x40
1807
 
1846
 
1808
 
1847
 
1809
    call drawfile
1848
    call drawfile
1810
 
1849
 
1811
;    mov  eax,[dstart]
1850
;    mov  eax,[dstart]
1812
 
1851
 
1813
;    add  eax,31
1852
;    add  eax,31
1814
;    mov  [ya],eax
1853
;    mov  [ya],eax
1815
;    mov  [addr],search_string
1854
;    mov  [addr],search_string
1816
;    call print_text
1855
;    call print_text
1817
 
1856
 
1818
  .no_draw:
1857
  .no_draw:
1819
  call draw_win_menu
1858
  call draw_win_menu
1820
 
1859
 
1821
  call draw_vertical_scroll
1860
  call draw_vertical_scroll
1822
 
1861
 
1823
    mov  eax,12                   ; WINDOW DRAW END
1862
    mov  eax,12                   ; WINDOW DRAW END
1824
    mov  ebx,2
1863
    mov  ebx,2
1825
    int  0x40
1864
    int  0x40
1826
 
1865
 
1827
    ret
1866
    ret
1828
 
1867
 
1829
 
1868
 
1830
 
1869
 
1831
 
1870
 
1832
; **********************************
1871
; **********************************
1833
; ***********  DRAWFILE  ***********
1872
; ***********  DRAWFILE  ***********
1834
; **********************************
1873
; **********************************
1835
 
1874
 
1836
drawfile:
1875
drawfile:
1837
;---------------
1876
;---------------
1838
cmp [menu_is_on],1
1877
cmp [menu_is_on],1
1839
jne .ff
1878
jne .ff
1840
call drawwindow
1879
call drawwindow
1841
.ff:
1880
.ff:
1842
;---------------
1881
;---------------
1843
    mov  [next_not_quote],1
1882
    mov  [next_not_quote],1
1844
    mov  [next_not_quote2],1
1883
    mov  [next_not_quote2],1
1845
 
1884
 
1846
    mov  eax,[post]        ; print from position
1885
    mov  eax,[post]        ; print from position
1847
 
1886
 
1848
    pusha
1887
    pusha
1849
 
1888
 
1850
    mov  edi,[post]
1889
    mov  edi,[post]
1851
    mov  [posl],edi
1890
    mov  [posl],edi
1852
 
1891
 
1853
    mov  ebx,8*65536+46    ; letters (46 = y offs)
1892
    mov  ebx,8*65536+46    ; letters (46 = y offs)
1854
    xor  ecx,ecx
1893
    xor  ecx,ecx
1855
 
1894
 
1856
    mov  edx,0x80000
1895
    mov  edx,0x80000
1857
    add  edx,eax
1896
    add  edx,eax
1858
    mov  edi,edx
1897
    mov  edi,edx
1859
 
1898
 
1860
    imul esi,[slines],80
1899
    imul esi,[slines],80
1861
    add  edi,esi
1900
    add  edi,esi
1862
 
1901
 
1863
 
1902
 
1864
  nd:
1903
  nd:
1865
 
1904
 
1866
    pusha
1905
    pusha
1867
 
1906
 
1868
    mov       edx,ebx
1907
    mov       edx,ebx
1869
    mov       edi,ebx
1908
    mov       edi,ebx
1870
    add       edi,(6*65536)*80
1909
    add       edi,(6*65536)*80
1871
 
1910
 
1872
  wi1:
1911
  wi1:
1873
 
1912
 
1874
 
1913
 
1875
    ; draw ?
1914
    ; draw ?
1876
 
1915
 
1877
 
1916
 
1878
    pusha
1917
    pusha
1879
 
1918
 
1880
    push      ecx
1919
    push      ecx
1881
 
1920
 
1882
    imul      eax,[posx],6
1921
    imul      eax,[posx],6
1883
    add       eax,8
1922
    add       eax,8
1884
    shl       eax,16
1923
    shl       eax,16
1885
    mov       ecx,eax
1924
    mov       ecx,eax
1886
 
1925
 
1887
;    ecx = ([posx]*6+8)<<16
1926
;    ecx = ([posx]*6+8)<<16
1888
 
1927
 
1889
    imul      eax,[posy],10
1928
    imul      eax,[posy],10
1890
    add       eax,46  ; y offs
1929
    add       eax,46  ; y offs
1891
    add       eax,ecx
1930
    add       eax,ecx
1892
 
1931
 
1893
;    eax = [posy]*10+46+ecx
1932
;    eax = [posy]*10+46+ecx
1894
 
1933
 
1895
    pop       ecx
1934
    pop       ecx
1896
 
1935
 
1897
    cmp       edx,eax
1936
    cmp       edx,eax
1898
    jnz       drwa
1937
    jnz       drwa
1899
 
1938
 
1900
    mov       eax,0x7ffff
1939
    mov       eax,0x7ffff
1901
    call      check_pos
1940
    call      check_pos
1902
    jmp       drlet
1941
    jmp       drlet
1903
 
1942
 
1904
  drwa:
1943
  drwa:
1905
 
1944
 
1906
    popa
1945
    popa
1907
 
1946
 
1908
 
1947
 
1909
    pusha
1948
    pusha
1910
 
1949
 
1911
    imul      eax,[posxm],6
1950
    imul      eax,[posxm],6
1912
    add       eax,8
1951
    add       eax,8
1913
    shl       eax,16
1952
    shl       eax,16
1914
    mov       ecx,eax
1953
    mov       ecx,eax
1915
 
1954
 
1916
    imul      eax,[posym],10
1955
    imul      eax,[posym],10
1917
    add       eax,46     ; y offs
1956
    add       eax,46     ; y offs
1918
    add       eax,ecx
1957
    add       eax,ecx
1919
 
1958
 
1920
    cmp       edx,eax
1959
    cmp       edx,eax
1921
    jnz       drwa2
1960
    jnz       drwa2
1922
 
1961
 
1923
    mov       eax,0x7ffff
1962
    mov       eax,0x7ffff
1924
    call      check_pos
1963
    call      check_pos
1925
    jmp       drlet
1964
    jmp       drlet
1926
 
1965
 
1927
  drwa2:
1966
  drwa2:
1928
 
1967
 
1929
    popa
1968
    popa
1930
 
1969
 
1931
    pusha
1970
    pusha
1932
 
1971
 
1933
    mov       eax,0x78000  ; screen
1972
    mov       eax,0x78000  ; screen
1934
    add       eax,[posl]   ; screen+abs
1973
    add       eax,[posl]   ; screen+abs
1935
    sub       eax,[post]   ; eax = screen+abs-base = y*80+x + screen
1974
    sub       eax,[post]   ; eax = screen+abs-base = y*80+x + screen
1936
 
1975
 
1937
    mov       edx,0x80000 ; file
1976
    mov       edx,0x80000 ; file
1938
    add       edx,[posl]  ; edx = absolute
1977
    add       edx,[posl]  ; edx = absolute
1939
    mov       bl,[edx]    ; in the file
1978
    mov       bl,[edx]    ; in the file
1940
 
1979
 
1941
    call      check_pos
1980
    call      check_pos
1942
 
1981
 
1943
    mov       cl,[eax]   ; on the screen
1982
    mov       cl,[eax]   ; on the screen
1944
    cmp       bl,cl
1983
    cmp       bl,cl
1945
    jnz       drlet
1984
    jnz       drlet
1946
 
1985
 
1947
    popa
1986
    popa
1948
 
1987
 
1949
    jmp       nodraw
1988
    jmp       nodraw
1950
 
1989
 
1951
 
1990
 
1952
    ; draw letter
1991
    ; draw letter
1953
 
1992
 
1954
 
1993
 
1955
  drlet:
1994
  drlet:
1956
 
1995
 
1957
    mov       [eax],bl ; mov byte to the screen
1996
    mov       [eax],bl ; mov byte to the screen
1958
    mov       [tmpabc],bl
1997
    mov       [tmpabc],bl
1959
    popa      ; restore regs
1998
    popa      ; restore regs
1960
 
1999
 
1961
;!!!!!!!!!!!!
2000
;!!!!!!!!!!!!
1962
 
2001
 
1963
    cmp       [tmpabc],' '
2002
    cmp       [tmpabc],' '
1964
    je        @f
2003
    je        @f
1965
    call      draw_letter
2004
    call      draw_letter
1966
    jmp       nodraw
2005
    jmp       nodraw
1967
   @@:
2006
   @@:
1968
    call      clear_char
2007
    call      clear_char
1969
 
2008
 
1970
    nodraw:
2009
    nodraw:
1971
 
2010
 
1972
    inc       [posl]
2011
    inc       [posl]
1973
 
2012
 
1974
    add       edx,6*65536
2013
    add       edx,6*65536
1975
    cmp       edx,edi
2014
    cmp       edx,edi
1976
    jz        wi3
2015
    jz        wi3
1977
    jmp       wi1
2016
    jmp       wi1
1978
 
2017
 
1979
  wi3:
2018
  wi3:
1980
 
2019
 
1981
    popa
2020
    popa
1982
 
2021
 
1983
    add       ebx,10
2022
    add       ebx,10
1984
    add       edx,80
2023
    add       edx,80
1985
    cmp       edi,edx
2024
    cmp       edi,edx
1986
    jbe       nde
2025
    jbe       nde
1987
    jmp       nd
2026
    jmp       nd
1988
 
2027
 
1989
  nde:
2028
  nde:
1990
 
2029
 
1991
    mov       eax,[posx]
2030
    mov       eax,[posx]
1992
    mov       ebx,[posy]
2031
    mov       ebx,[posy]
1993
 
2032
 
1994
    mov       [posxm],eax
2033
    mov       [posxm],eax
1995
    mov       [posym],ebx
2034
    mov       [posym],ebx
1996
 
2035
 
1997
    popa
2036
    popa
1998
 
2037
 
1999
    ret
2038
    ret
2000
 
2039
 
2001
 stText    = 0
2040
 stText    = 0
2002
 stInstr   = 1
2041
 stInstr   = 1
2003
 stReg     = 2
2042
 stReg     = 2
2004
 stNum     = 3
2043
 stNum     = 3
2005
 stQuote   = 4
2044
 stQuote   = 4
2006
 stComment = 5
2045
 stComment = 5
2007
 stSymbol  = 6
2046
 stSymbol  = 6
2008
 
2047
 
2009
align 4
2048
align 4
2010
 
2049
 
2011
clear_char:
2050
clear_char:
2012
 
2051
 
2013
    pusha
2052
    pusha
2014
    mov       ebx,[sc.work]
2053
    mov       ebx,[sc.work]
2015
 
2054
 
2016
    push      ecx
2055
    push      ecx
2017
 
2056
 
2018
    imul      eax,[posx],6
2057
    imul      eax,[posx],6
2019
    add       eax,8
2058
    add       eax,8
2020
    shl       eax,16
2059
    shl       eax,16
2021
    mov       ecx,eax
2060
    mov       ecx,eax
2022
 
2061
 
2023
    imul      eax,[posy],10
2062
    imul      eax,[posy],10
2024
    add       eax,46 ; 26
2063
    add       eax,46 ; 26
2025
    add       eax,ecx
2064
    add       eax,ecx
2026
 
2065
 
2027
    pop       ecx
2066
    pop       ecx
2028
    cmp       edx,eax
2067
    cmp       edx,eax
2029
    jnz       @f
2068
    jnz       @f
2030
    mov       ebx,0xffffff   ; light blue 0x00ffff
2069
    mov       ebx,0xffffff   ; light blue 0x00ffff
2031
  @@:
2070
  @@:
2032
 
2071
 
2033
                     ; draw bar
2072
                     ; draw bar
2034
    push      ebx
2073
    push      ebx
2035
    mov       eax,13
2074
    mov       eax,13
2036
    mov       ebx,edx
2075
    mov       ebx,edx
2037
    mov       bx,6
2076
    mov       bx,6
2038
    mov       ecx,edx
2077
    mov       ecx,edx
2039
    shl       ecx,16
2078
    shl       ecx,16
2040
    add       ecx,10
2079
    add       ecx,10
2041
    pop       edx
2080
    pop       edx
2042
    int       0x40
2081
    int       0x40
2043
    popa
2082
    popa
2044
    ret
2083
    ret
2045
 
2084
 
2046
align 4
2085
align 4
2047
 
2086
 
2048
; CHECK_POSITION {
2087
; CHECK_POSITION {
2049
check_pos:
2088
check_pos:
2050
  cmp  [asm_mode],1
2089
  cmp  [asm_mode],1
2051
  je   @f
2090
  je   @f
2052
 
2091
 
2053
  mov  [d_status],stText
2092
  mov  [d_status],stText
2054
  ret
2093
  ret
2055
 
2094
 
2056
 @@:
2095
 @@:
2057
  pushad
2096
  pushad
2058
 
2097
 
2059
; COMMENT TERMINATOR
2098
; COMMENT TERMINATOR
2060
  cmp  [d_status],stComment
2099
  cmp  [d_status],stComment
2061
  jnz  @f
2100
  jnz  @f
2062
  mov  eax,[posl]
2101
  mov  eax,[posl]
2063
  sub  eax,[post]
2102
  sub  eax,[post]
2064
  cdq
2103
  cdq
2065
  mov  ebx,80
2104
  mov  ebx,80
2066
  div  ebx
2105
  div  ebx
2067
  test edx,edx
2106
  test edx,edx
2068
  jnz  end_check_pos
2107
  jnz  end_check_pos
2069
  mov  [d_status],stText
2108
  mov  [d_status],stText
2070
 @@:
2109
 @@:
2071
 
2110
 
2072
; QUOTE TERMINATOR B
2111
; QUOTE TERMINATOR B
2073
  cmp  [next_not_quote],1
2112
  cmp  [next_not_quote],1
2074
  jne  @f
2113
  jne  @f
2075
  mov  [d_status],stText
2114
  mov  [d_status],stText
2076
 @@:
2115
 @@:
2077
 
2116
 
2078
  mov  eax,[posl]
2117
  mov  eax,[posl]
2079
  add  eax,0x80000
2118
  add  eax,0x80000
2080
  mov  edx,eax
2119
  mov  edx,eax
2081
  mov  al,[eax]
2120
  mov  al,[eax]
2082
 
2121
 
2083
; QUOTE TERMINATOR A
2122
; QUOTE TERMINATOR A
2084
  cmp  [d_status],stQuote
2123
  cmp  [d_status],stQuote
2085
  jnz  @f
2124
  jnz  @f
2086
  cmp  al,[quote]
2125
  cmp  al,[quote]
2087
  jne  end_check_pos
2126
  jne  end_check_pos
2088
  mov  [next_not_quote],1
2127
  mov  [next_not_quote],1
2089
  jmp  end_check_pos
2128
  jmp  end_check_pos
2090
 @@:
2129
 @@:
2091
  mov  [next_not_quote],0
2130
  mov  [next_not_quote],0
2092
 
2131
 
2093
; START QUOTE 1
2132
; START QUOTE 1
2094
  cmp  al,"'"
2133
  cmp  al,"'"
2095
  jne  @f
2134
  jne  @f
2096
  mov  [d_status],stQuote
2135
  mov  [d_status],stQuote
2097
  mov  [quote],al
2136
  mov  [quote],al
2098
  jmp  end_check_pos
2137
  jmp  end_check_pos
2099
 @@:
2138
 @@:
2100
 
2139
 
2101
; START QUOTE 2
2140
; START QUOTE 2
2102
  cmp  al,'"'
2141
  cmp  al,'"'
2103
  jne  @f
2142
  jne  @f
2104
  mov  [d_status],stQuote
2143
  mov  [d_status],stQuote
2105
  mov  [quote],al
2144
  mov  [quote],al
2106
  jmp  end_check_pos
2145
  jmp  end_check_pos
2107
 @@:
2146
 @@:
2108
 
2147
 
2109
; START COMMENT
2148
; START COMMENT
2110
  cmp  al,';'
2149
  cmp  al,';'
2111
  jne  @f
2150
  jne  @f
2112
  mov  [d_status],stComment
2151
  mov  [d_status],stComment
2113
  jmp  end_check_pos
2152
  jmp  end_check_pos
2114
 @@:
2153
 @@:
2115
 
2154
 
2116
; NUMBER TERMINATOR
2155
; NUMBER TERMINATOR
2117
  cmp  [d_status],stNum
2156
  cmp  [d_status],stNum
2118
  jne  nonumt
2157
  jne  nonumt
2119
  mov  ecx,23
2158
  mov  ecx,23
2120
 @@:
2159
 @@:
2121
  dec  ecx
2160
  dec  ecx
2122
  jz   nonumt
2161
  jz   nonumt
2123
  cmp  al,[symbols+ecx]
2162
  cmp  al,[symbols+ecx]
2124
  jne  @b
2163
  jne  @b
2125
 
2164
 
2126
 nonumt1:
2165
 nonumt1:
2127
  mov  [d_status],stText
2166
  mov  [d_status],stText
2128
 nonumt:
2167
 nonumt:
2129
 
2168
 
2130
; START NUMBER
2169
; START NUMBER
2131
  cmp  [d_status],stNum
2170
  cmp  [d_status],stNum
2132
  je   end_check_pos
2171
  je   end_check_pos
2133
  cmp  al,'0'
2172
  cmp  al,'0'
2134
  jb   nonum
2173
  jb   nonum
2135
  cmp  al,'9'
2174
  cmp  al,'9'
2136
  ja   nonum
2175
  ja   nonum
2137
  mov  bl,[edx-1]
2176
  mov  bl,[edx-1]
2138
  mov  ecx,23
2177
  mov  ecx,23
2139
 @@:
2178
 @@:
2140
  dec  ecx
2179
  dec  ecx
2141
  jz   nonum
2180
  jz   nonum
2142
  cmp  bl,[symbols+ecx]
2181
  cmp  bl,[symbols+ecx]
2143
  jne  @b
2182
  jne  @b
2144
 @@:
2183
 @@:
2145
  mov  [d_status],stNum
2184
  mov  [d_status],stNum
2146
  jmp  end_check_pos
2185
  jmp  end_check_pos
2147
 nonum:
2186
 nonum:
2148
 
2187
 
2149
; SYMBOL
2188
; SYMBOL
2150
  mov   esi,symbols
2189
  mov   esi,symbols
2151
  mov   ecx,21
2190
  mov   ecx,21
2152
 @@:
2191
 @@:
2153
  cmp   byte [esi],al
2192
  cmp   byte [esi],al
2154
  je    @f
2193
  je    @f
2155
  dec   ecx
2194
  dec   ecx
2156
  jz    nosymbol
2195
  jz    nosymbol
2157
  inc   esi
2196
  inc   esi
2158
  jmp   @b
2197
  jmp   @b
2159
 @@:
2198
 @@:
2160
  mov   [d_status],stSymbol
2199
  mov   [d_status],stSymbol
2161
  jmp   end_check_pos
2200
  jmp   end_check_pos
2162
 
2201
 
2163
 nosymbol:
2202
 nosymbol:
2164
  mov   [d_status],stText
2203
  mov   [d_status],stText
2165
 
2204
 
2166
 end_check_pos:
2205
 end_check_pos:
2167
  popad
2206
  popad
2168
  ret
2207
  ret
2169
; CHECK_POSITION }
2208
; CHECK_POSITION }
2170
 
2209
 
2171
 
2210
 
2172
;;;;;;;;;;;;;;;;;
2211
;;;;;;;;;;;;;;;;;
2173
;; DRAW LETTER ;;
2212
;; DRAW LETTER ;;
2174
;;;;;;;;;;;;;;;;;
2213
;;;;;;;;;;;;;;;;;
2175
draw_letter:
2214
draw_letter:
2176
 
2215
 
2177
    call      clear_char
2216
    call      clear_char
2178
 
2217
 
2179
    pusha
2218
    pusha
2180
 
2219
 
2181
    mov       ebx,edx  ; x & y
2220
    mov       ebx,edx  ; x & y
2182
 
2221
 
2183
    mov       eax,[d_status]
2222
    mov       eax,[d_status]
2184
    mov       ecx,[eax*4+color_tbl]
2223
    mov       ecx,[eax*4+color_tbl]
2185
    mov       eax,4
2224
    mov       eax,4
2186
 
2225
 
2187
    xor       esi,esi
2226
    xor       esi,esi
2188
    inc       esi
2227
    inc       esi
2189
    mov       edx,0x80000
2228
    mov       edx,0x80000
2190
    mov       edi,[posl]
2229
    mov       edi,[posl]
2191
    add       edx,edi
2230
    add       edx,edi
2192
    int       0x40
2231
    int       0x40
2193
 
2232
 
2194
    popa
2233
    popa
2195
 
2234
 
2196
    ret
2235
    ret
2197
 
2236
 
2198
 
2237
 
2199
; ********************************************
2238
; ********************************************
2200
; ****************  SAVEFILE  ****************
2239
; ****************  SAVEFILE  ****************
2201
; ********************************************
2240
; ********************************************
2202
save_file:
2241
save_file:
2203
   mov     esi,0x80000
2242
   mov     esi,0x80000
2204
   mov     edi,0x10000
2243
   mov     edi,0x10000
2205
   or      ecx,-1
2244
   or      ecx,-1
2206
 .new_string:
2245
 .new_string:
2207
   inc     ecx
2246
   inc     ecx
2208
   call    save_string
2247
   call    save_string
2209
   cmp     ecx,[lines]
2248
   cmp     ecx,[lines]
2210
   jb      .new_string
2249
   jb      .new_string
2211
 
2250
 
2212
   sub     edi,0x10004  ; why???
2251
   sub     edi,0x10004  ; why???
2213
   mov     [filelen],edi
2252
   mov     [filelen],edi
2214
 
2253
 
2215
   cmp     byte [filename],'/'
2254
   cmp     byte [filename],'/'
2216
   je      .systree_save
2255
   je      .systree_save
2217
 
2256
 
2218
   mov     eax,33
2257
   mov     eax,33
2219
   mov     ebx,filename
2258
   mov     ebx,filename
2220
   mov     ecx,0x10000
2259
   mov     ecx,0x10000
2221
   mov     edx,[filelen]
2260
   mov     edx,[filelen]
2222
   xor     esi,esi
2261
   xor     esi,esi
2223
   int     0x40
2262
   int     0x40
2224
 
2263
 
2225
   test    eax,eax
2264
   test    eax,eax
2226
   je      .finish
2265
   je      .finish
2227
;   call    file_not_found
2266
;   call    file_not_found
2228
   call disk_is_full
2267
   call disk_is_full
2229
;==============================
2268
;==============================
2230
   jmp     .finish
2269
   jmp     .finish
2231
 
2270
 
2232
 .systree_save:
2271
 .systree_save:
2233
   mov     eax,[filelen]
2272
   mov     eax,[filelen]
2234
   mov     [fileinfo_write+8],eax
2273
   mov     [fileinfo_write+8],eax
2235
 
2274
 
2236
   mov     esi,filename
2275
   mov     esi,filename
2237
   mov     edi,pathfile_write
2276
   mov     edi,pathfile_write
2238
   mov     ecx,50
2277
   mov     ecx,50
2239
   cld
2278
   cld
2240
   rep     movsb
2279
   rep     movsb
2241
 
2280
 
2242
   mov     eax,58
2281
   mov     eax,58
2243
   mov     ebx,fileinfo_write
2282
   mov     ebx,fileinfo_write
2244
   int     0x40
2283
   int     0x40
2245
   cmp eax,0
2284
   cmp eax,0
2246
   je .finish
2285
   je .finish
2247
   call disk_is_full
2286
   call disk_is_full
2248
 .finish:
2287
 .finish:
2249
call draw_window_for_dialogs
2288
call draw_window_for_dialogs
2250
    mov [modified],0
2289
    mov [modified],0
2251
ret
2290
ret
2252
 
2291
 
2253
save_string:
2292
save_string:
2254
   push    ecx
2293
   push    ecx
2255
   push    esi
2294
   push    esi
2256
   mov     eax,esi
2295
   mov     eax,esi
2257
   mov     ebx,eax
2296
   mov     ebx,eax
2258
   add     ebx,79
2297
   add     ebx,79
2259
 .countlen:
2298
 .countlen:
2260
   cmp     ebx,eax
2299
   cmp     ebx,eax
2261
   jb      .endcount
2300
   jb      .endcount
2262
   cmp     byte [ebx],' '
2301
   cmp     byte [ebx],' '
2263
   jne     .endcount
2302
   jne     .endcount
2264
   dec     ebx
2303
   dec     ebx
2265
   jmp     .countlen
2304
   jmp     .countlen
2266
 .endcount:
2305
 .endcount:
2267
   inc     ebx
2306
   inc     ebx
2268
   sub     ebx,eax
2307
   sub     ebx,eax
2269
 
2308
 
2270
   mov     ecx,ebx
2309
   mov     ecx,ebx
2271
   jecxz   .endcopy
2310
   jecxz   .endcopy
2272
 .copystr:
2311
 .copystr:
2273
   mov     al,[esi]
2312
   mov     al,[esi]
2274
   mov     [edi],al
2313
   mov     [edi],al
2275
   inc     esi
2314
   inc     esi
2276
   inc     edi
2315
   inc     edi
2277
   dec     ecx
2316
   dec     ecx
2278
   jnz     .copystr
2317
   jnz     .copystr
2279
 .endcopy:
2318
 .endcopy:
2280
 
2319
 
2281
   mov     eax,0x0a0d
2320
   mov     eax,0x0a0d
2282
   stosw
2321
   stosw
2283
 
2322
 
2284
   pop     esi
2323
   pop     esi
2285
   add     esi,80
2324
   add     esi,80
2286
   pop     ecx
2325
   pop     ecx
2287
ret
2326
ret
2288
 
2327
 
2289
 
2328
 
2290
 
2329
 
2291
; ********************************************
2330
; ********************************************
2292
; ****************  LOADFILE  ****************
2331
; ****************  LOADFILE  ****************
2293
; ********************************************
2332
; ********************************************
2294
 
2333
 
2295
loadhdfile:
2334
loadhdfile:
2296
 
2335
 
2297
     mov  esi,filename
2336
     mov  esi,filename
2298
     mov  edi,pathfile_read
2337
     mov  edi,pathfile_read
2299
     mov  ecx,250 ;50
2338
     mov  ecx,250 ;50
2300
     cld
2339
     cld
2301
     rep  movsb
2340
     rep  movsb
2302
 
2341
 
2303
     mov  eax,58
2342
     mov  eax,58
2304
     mov  ebx,fileinfo_read
2343
     mov  ebx,fileinfo_read
2305
     int  0x40
2344
     int  0x40
2306
 
2345
 
2307
     xchg eax,ebx
2346
     xchg eax,ebx
2308
     inc  eax
2347
     inc  eax
2309
     test ebx,ebx   ;errorcode=0 - ok
2348
     test ebx,ebx   ;errorcode=0 - ok
2310
     je   file_found
2349
     je   file_found
2311
     cmp  ebx,6     ;errorcode=5 - ok
2350
     cmp  ebx,6     ;errorcode=5 - ok
2312
     je   file_found
2351
     je   file_found
2313
     call file_not_found
2352
     call file_not_found
2314
     ret
2353
     ret
2315
 
2354
 
2316
 
2355
 
2317
loadfile1:
2356
loadfile1:
2318
 
2357
 
2319
    mov  eax,6        ; 6 = open file
2358
    mov  eax,6        ; 6 = open file
2320
    mov  ebx,filename
2359
    mov  ebx,filename
2321
    xor  ecx,ecx
2360
    xor  ecx,ecx
2322
    mov  edx,16800
2361
    mov  edx,16800
2323
    mov  esi,0x10000
2362
    mov  esi,0x10000
2324
    int  0x40
2363
    int  0x40
2325
 
2364
 
2326
    inc  eax          ; eax = -1 -> file not found
2365
    inc  eax          ; eax = -1 -> file not found
2327
    jnz  file_found   ;strannaya proverka (Ed)
2366
    jnz  file_found   ;strannaya proverka (Ed)
2328
 
2367
 
2329
    call file_not_found
2368
    call file_not_found
2330
    ret
2369
    ret
2331
 
2370
 
2332
 
2371
 
2333
  file_found:
2372
  file_found:
2334
    dec  eax
2373
    dec  eax
2335
;   eax = file size
2374
;   eax = file size
2336
    jz   .finish
2375
    jz   .finish
2337
    mov  [filesize],eax
2376
    mov  [filesize],eax
2338
 
2377
 
2339
    mov  edi,0x80000     ; clear all
2378
    mov  edi,0x80000     ; clear all
2340
  @@:
2379
  @@:
2341
    mov  [edi],byte ' '
2380
    mov  [edi],byte ' '
2342
    inc  edi
2381
    inc  edi
2343
    cmp  edi,0x2effff
2382
    cmp  edi,0x2effff
2344
    jnz  @b
2383
    jnz  @b
2345
 
2384
 
2346
    mov  [lines],0
2385
    mov  [lines],0
2347
    mov  edi,0x10000
2386
    mov  edi,0x10000
2348
    mov  ebx,0x80000
2387
    mov  ebx,0x80000
2349
 
2388
 
2350
; edi = from
2389
; edi = from
2351
; ebx = to
2390
; ebx = to
2352
; eax = filesize
2391
; eax = filesize
2353
 
2392
 
2354
  .new_char:
2393
  .new_char:
2355
    mov  cl,[edi]     ; get_char();
2394
    mov  cl,[edi]     ; get_char();
2356
    cmp  cl,13        ; if (char==13)
2395
    cmp  cl,13        ; if (char==13)
2357
    je   .new_str1    ;   goto .new_str1;
2396
    je   .new_str1    ;   goto .new_str1;
2358
    cmp  cl,10        ; if (char==10)
2397
    cmp  cl,10        ; if (char==10)
2359
    je   .new_str2    ;   goto .new_str2;
2398
    je   .new_str2    ;   goto .new_str2;
2360
    mov  [ebx],cl     ; store_char();
2399
    mov  [ebx],cl     ; store_char();
2361
    inc  ebx          ; dest++;
2400
    inc  ebx          ; dest++;
2362
  .back:
2401
  .back:
2363
    inc  edi          ; src++;
2402
    inc  edi          ; src++;
2364
    dec  eax          ; counter--;
2403
    dec  eax          ; counter--;
2365
    jnz  .new_char    ; if (counter!=0) goto .new_char;
2404
    jnz  .new_char    ; if (counter!=0) goto .new_char;
2366
 
2405
 
2367
  .finish:
2406
  .finish:
2368
    inc  [lines]      ;   [lines]++;
2407
    inc  [lines]      ;   [lines]++;
2369
    ret
2408
    ret
2370
 
2409
 
2371
  .new_str1:
2410
  .new_str1:
2372
    pusha
2411
    pusha
2373
    mov  eax,ebx        ; eax = destination
2412
    mov  eax,ebx        ; eax = destination
2374
    add  eax,-0x80000   ; eax = offset
2413
    add  eax,-0x80000   ; eax = offset
2375
    cdq
2414
    cdq
2376
    mov  ecx,80
2415
    mov  ecx,80
2377
    div  ecx            ; offset /= 80;
2416
    div  ecx            ; offset /= 80;
2378
    test edx,edx        ; if not the first char in the string
2417
    test edx,edx        ; if not the first char in the string
2379
    jne  @f             ;   go forward
2418
    jne  @f             ;   go forward
2380
    test eax,eax        ; if first line
2419
    test eax,eax        ; if first line
2381
    je   @f             ;   go forward
2420
    je   @f             ;   go forward
2382
    cmp  [edi-1],byte 10; if previous char != 10 continue without line feed
2421
    cmp  [edi-1],byte 10; if previous char != 10 continue without line feed
2383
    jne  .contin
2422
    jne  .contin
2384
   @@:
2423
   @@:
2385
    inc  eax            ; offset++;
2424
    inc  eax            ; offset++;
2386
    imul eax,80         ; offset *= 80;
2425
    imul eax,80         ; offset *= 80;
2387
    add  eax,0x80000
2426
    add  eax,0x80000
2388
    mov  [esp+4*4],eax  ; to ebx
2427
    mov  [esp+4*4],eax  ; to ebx
2389
   .contin:
2428
   .contin:
2390
    popa
2429
    popa
2391
    inc  edi     ; do not look on the next char (10)
2430
    inc  edi     ; do not look on the next char (10)
2392
    dec  eax     ; counter--;
2431
    dec  eax     ; counter--;
2393
    inc  [lines] ; [lines]++;
2432
    inc  [lines] ; [lines]++;
2394
    jmp  .back
2433
    jmp  .back
2395
 
2434
 
2396
 
2435
 
2397
  .new_str2:
2436
  .new_str2:
2398
    pusha
2437
    pusha
2399
    mov  eax,ebx
2438
    mov  eax,ebx
2400
    add  eax,-0x80000
2439
    add  eax,-0x80000
2401
    cdq
2440
    cdq
2402
    mov  ecx,80
2441
    mov  ecx,80
2403
    div  ecx
2442
    div  ecx
2404
    inc  eax
2443
    inc  eax
2405
    imul eax,80
2444
    imul eax,80
2406
    add  eax,0x80000
2445
    add  eax,0x80000
2407
    mov  [esp+4*4],eax ; to ebx
2446
    mov  [esp+4*4],eax ; to ebx
2408
    popa
2447
    popa
2409
    inc  [lines]
2448
    inc  [lines]
2410
    jmp  .back
2449
    jmp  .back
2411
 
2450
 
2412
 
2451
 
2413
file_not_found:
2452
file_not_found:
2414
   mov  eax,55           ; beep
2453
   mov  eax,55           ; beep
2415
   mov  ebx,eax
2454
   mov  ebx,eax
2416
   mov  esi,error_beep
2455
   mov  esi,error_beep
2417
   int  0x40
2456
   int  0x40
2418
   mov  [lines],1        ; open empty document
2457
   mov  [lines],1        ; open empty document
2419
 
2458
 
2420
   mov [to_return2],1
2459
   mov [to_return2],1
2421
   call openerror
2460
   call openerror
2422
 
2461
 
2423
   ret
2462
   ret
2424
 
2463
 
2425
disk_is_full:
2464
disk_is_full:
2426
   mov  eax,55           ; beep
2465
   mov  eax,55           ; beep
2427
   mov  ebx,eax
2466
   mov  ebx,eax
2428
   mov  esi,error_beep
2467
   mov  esi,error_beep
2429
   int  0x40
2468
   int  0x40
2430
   mov [to_return2],1
2469
   mov [to_return2],1
2431
   call saveerror
2470
   call saveerror
2432
   mov [error2_found],1
2471
   mov [error2_found],1
2433
ret
2472
ret
2434
 
2473
 
2435
 
2474
 
2436
; *****************************
2475
; *****************************
2437
; ******  WRITE POSITION ******
2476
; ******  WRITE POSITION ******
2438
; *****************************
2477
; *****************************
2439
 
2478
 
2440
writepos:
2479
writepos:
2441
 
2480
 
2442
    cmp [do_not_draw],1  ; return if drawing is not permitted
2481
    cmp [do_not_draw],1  ; return if drawing is not permitted
2443
    jne @f
2482
    jne @f
2444
    ret
2483
    ret
2445
   @@:
2484
   @@:
2446
 
2485
 
2447
    pusha
2486
    pusha
2448
 
2487
 
2449
    mov  eax,[posx]
2488
    mov  eax,[posx]
2450
    inc  eax
2489
    inc  eax
2451
    cdq
2490
    cdq
2452
    mov  ebx,10
2491
    mov  ebx,10
2453
    div  ebx
2492
    div  ebx
2454
    add  al,'0'
2493
    add  al,'0'
2455
    add  dl,'0'
2494
    add  dl,'0'
2456
    mov  [htext2+ 9],al
2495
    mov  [htext2+ 9],al
2457
    mov  [htext2+10],dl
2496
    mov  [htext2+10],dl
2458
 
2497
 
2459
    mov  eax,[post]
2498
    mov  eax,[post]
2460
    cdq
2499
    cdq
2461
    mov  ebx,80
2500
    mov  ebx,80
2462
    div  ebx
2501
    div  ebx
2463
    mov [real_posy],eax ;=====!!!!!!!!!
2502
    mov [real_posy],eax ;=====!!!!!!!!!
2464
 
2503
 
2465
    add  eax,[posy]
2504
    add  eax,[posy]
2466
    inc  eax
2505
    inc  eax
2467
    mov  ebx,10
2506
    mov  ebx,10
2468
    cdq
2507
    cdq
2469
    div  ebx
2508
    div  ebx
2470
    add  dl,'0'
2509
    add  dl,'0'
2471
    mov  [htext2+16],dl  ; 00001
2510
    mov  [htext2+16],dl  ; 00001
2472
    cdq
2511
    cdq
2473
    div  ebx
2512
    div  ebx
2474
    add  dl,'0'
2513
    add  dl,'0'
2475
    mov  [htext2+15],dl  ; 00010
2514
    mov  [htext2+15],dl  ; 00010
2476
    cdq
2515
    cdq
2477
    div  ebx
2516
    div  ebx
2478
    add  dl,'0'
2517
    add  dl,'0'
2479
    mov  [htext2+14],dl  ; 00100
2518
    mov  [htext2+14],dl  ; 00100
2480
    cdq
2519
    cdq
2481
    div  ebx
2520
    div  ebx
2482
    add  dl,'0'
2521
    add  dl,'0'
2483
    add  al,'0'
2522
    add  al,'0'
2484
    mov  [htext2+13],dl  ; 01000
2523
    mov  [htext2+13],dl  ; 01000
2485
    mov  [htext2+12],al  ; 10000
2524
    mov  [htext2+12],al  ; 10000
2486
 
2525
 
2487
 
2526
 
2488
    mov  eax,[lines]     ; number of lines
2527
    mov  eax,[lines]     ; number of lines
2489
    cdq
2528
    cdq
2490
    mov  ebx,10
2529
    mov  ebx,10
2491
    div  ebx
2530
    div  ebx
2492
    add  dl,'0'
2531
    add  dl,'0'
2493
    mov  [htext2+31],dl  ; 0001
2532
    mov  [htext2+31],dl  ; 0001
2494
    cdq
2533
    cdq
2495
    div  ebx
2534
    div  ebx
2496
    add  dl,'0'
2535
    add  dl,'0'
2497
    mov  [htext2+30],dl  ; 0010
2536
    mov  [htext2+30],dl  ; 0010
2498
    cdq
2537
    cdq
2499
    div  ebx
2538
    div  ebx
2500
    add  dl,'0'
2539
    add  dl,'0'
2501
    mov  [htext2+29],dl  ; 0100
2540
    mov  [htext2+29],dl  ; 0100
2502
    cdq
2541
    cdq
2503
    div  ebx
2542
    div  ebx
2504
    add  dl,'0'
2543
    add  dl,'0'
2505
    add  al,'0'
2544
    add  al,'0'
2506
    mov  [htext2+28],dl
2545
    mov  [htext2+28],dl
2507
    mov  [htext2+27],al  ; 10000
2546
    mov  [htext2+27],al  ; 10000
2508
 
2547
 
2509
;   €„Ž › Ž’Ž€†€’œ €‘Š‹€„Š“ Š‹€‚ˆ€’“›!
2548
;   €„Ž › Ž’Ž€†€’œ €‘Š‹€„Š“ Š‹€‚ˆ€’“›!
2510
;    mov  [htext2+42], word 'RU'
2549
;    mov  [htext2+42], word 'RU'
2511
 
2550
 
2512
;    mov  eax,13      ; draw bar
2551
;    mov  eax,13      ; draw bar
2513
;    mov  ebx,5*65536+38*6
2552
;    mov  ebx,5*65536+38*6
2514
;    mov  ecx,[dstart]
2553
;    mov  ecx,[dstart]
2515
;    shl  ecx,16
2554
;    shl  ecx,16
2516
;    add  ecx,15
2555
;    add  ecx,15
2517
;    mov  edx,[sc.work_graph]
2556
;    mov  edx,[sc.work_graph]
2518
;    int  0x40
2557
;    int  0x40
2519
 
2558
 
2520
    mov  eax,13                   ; BAR STRIPE
2559
    mov  eax,13                   ; BAR STRIPE
2521
    mov  ebx,5*65536+497
2560
    mov  ebx,5*65536+497
2522
    mov  ecx,[dstart]
2561
    mov  ecx,[dstart]
2523
    add  ecx,29;30 ;15
2562
    add  ecx,29;30 ;15
2524
    shl  ecx,16
2563
    shl  ecx,16
2525
    add  ecx,14
2564
    add  ecx,14
2526
    mov  edx,[sc.work_graph]
2565
    mov  edx,[sc.work_graph]
2527
    int  0x40
2566
    int  0x40
2528
 
2567
 
2529
    mov  eax,4       ; write position
2568
    mov  eax,4       ; write position
2530
    mov  ebx,12*65536
2569
    mov  ebx,12*65536
2531
    mov  bx,word [dstart]
2570
    mov  bx,word [dstart]
2532
    add  ebx,33 ;18
2571
    add  ebx,33 ;18
2533
    mov  ecx,[sc.work_button_text]
2572
    mov  ecx,[sc.work_button_text]
2534
    mov  edx,htext2
2573
    mov  edx,htext2
2535
    mov  esi,38
2574
    mov  esi,38
2536
    int  0x40
2575
    int  0x40
2537
 
2576
 
2538
    cmp [modified],1
2577
    cmp [modified],1
2539
    jne no_mod
2578
    jne no_mod
-
 
2579
if lang eq ru
2540
     putlabel 270,386,'ˆ‡Œ……',[sc.work_button_text]
2580
     putlabel 270,386,'ˆ‡Œ……',[sc.work_button_text]
-
 
2581
else
-
 
2582
     putlabel 270,386,'MODIFIED',[sc.work_button_text]
-
 
2583
end if
2541
    no_mod:
2584
    no_mod:
2542
    popa
2585
    popa
2543
 
2586
 
2544
    ret
2587
    ret
2545
 
2588
 
2546
;-----------------------------
2589
;-----------------------------
2547
;   search window
2590
;   search window
2548
;-----------------------------
2591
;-----------------------------
2549
search_window:
2592
search_window:
2550
 
2593
 
2551
mov eax,13
2594
mov eax,13
2552
mov ebx,55*65536+380
2595
mov ebx,55*65536+380
2553
mov ecx,100*65536+60
2596
mov ecx,100*65536+60
2554
mov edx,[sc.work_graph]
2597
mov edx,[sc.work_graph]
2555
int 0x40
2598
int 0x40
2556
 
2599
 
2557
mov eax,38
2600
mov eax,38
2558
mov ebx,55*65536+435
2601
mov ebx,55*65536+435
2559
mov ecx,100*65536+100
2602
mov ecx,100*65536+100
2560
mov edx,cl_White
2603
mov edx,cl_White
2561
int 0x40
2604
int 0x40
2562
mov eax,38
2605
mov eax,38
2563
mov ebx,55*65536+55
2606
mov ebx,55*65536+55
2564
mov ecx,100*65536+160
2607
mov ecx,100*65536+160
2565
mov edx,cl_White
2608
mov edx,cl_White
2566
int 0x40
2609
int 0x40
2567
mov eax,38
2610
mov eax,38
2568
mov ebx,435*65536+435
2611
mov ebx,435*65536+435
2569
mov ecx,100*65536+160
2612
mov ecx,100*65536+160
2570
mov edx,cl_White
2613
mov edx,cl_White
2571
int 0x40
2614
int 0x40
2572
mov eax,38
2615
mov eax,38
2573
mov ebx,55*65536+435
2616
mov ebx,55*65536+435
2574
mov ecx,160*65536+160
2617
mov ecx,160*65536+160
2575
mov edx,cl_White
2618
mov edx,cl_White
2576
int 0x40
2619
int 0x40
2577
 
2620
 
2578
 
2621
if lang eq ru
2579
drawlbut 375,110,50,15,'®¨áª',50,[sc.work_button],[sc.work_button_text]
2622
drawlbut 375,110,50,15,'®¨áª',50,[sc.work_button],[sc.work_button_text]
-
 
2623
drawlbut 375,130,50,15,'Žâ¬¥­ ',94,[sc.work_button],[sc.work_button_text]
-
 
2624
else
-
 
2625
drawlbut 375,110,50,15,'Search',50,[sc.work_button],[sc.work_button_text]
-
 
2626
drawlbut 375,130,50,15,'Cancel',94,[sc.work_button],[sc.work_button_text]
2580
drawlbut 375,130,50,15,'Žâ¬¥­ ',94,[sc.work_button],[sc.work_button_text]
2627
end if
2581
 
2628
 
2582
call read_string
2629
call read_string
2583
 
2630
 
2584
;    add  eax,31
2631
;    add  eax,31
2585
;    mov  [ya],eax
2632
;    mov  [ya],eax
2586
;    mov  [addr],search_string
2633
;    mov  [addr],search_string
2587
;    call print_text
2634
;    call print_text
2588
 
2635
 
2589
 
2636
 
2590
 
2637
 
2591
jmp search
2638
jmp search
2592
 
2639
 
2593
string_not_found:
2640
string_not_found:
2594
 mov eax,13
2641
 mov eax,13
2595
 mov ebx,150*65536+200
2642
 mov ebx,150*65536+200
2596
 mov ecx,100*65536+70
2643
 mov ecx,100*65536+70
2597
 mov edx,[sc.work_graph] ;0x00dd9438 ;0x00ff7512
2644
 mov edx,[sc.work_graph] ;0x00dd9438 ;0x00ff7512
2598
 int 0x40
2645
 int 0x40
2599
 
2646
 
2600
mov eax,38
2647
mov eax,38
2601
mov ebx,150*65536+350
2648
mov ebx,150*65536+350
2602
mov ecx,100*65536+100
2649
mov ecx,100*65536+100
2603
mov edx,cl_White
2650
mov edx,cl_White
2604
int 0x40
2651
int 0x40
2605
mov eax,38
2652
mov eax,38
2606
mov ebx,150*65536+350
2653
mov ebx,150*65536+350
2607
mov ecx,170*65536+170
2654
mov ecx,170*65536+170
2608
mov edx,cl_White
2655
mov edx,cl_White
2609
int 0x40
2656
int 0x40
2610
mov eax,38
2657
mov eax,38
2611
mov ebx,150*65536+150
2658
mov ebx,150*65536+150
2612
mov ecx,100*65536+170
2659
mov ecx,100*65536+170
2613
mov edx,cl_White
2660
mov edx,cl_White
2614
int 0x40
2661
int 0x40
2615
mov eax,38
2662
mov eax,38
2616
mov ebx,350*65536+350
2663
mov ebx,350*65536+350
2617
mov ecx,100*65536+170
2664
mov ecx,100*65536+170
2618
mov edx,cl_White
2665
mov edx,cl_White
2619
int 0x40
2666
int 0x40
2620
 
2667
 
2621
 
2668
if lang eq ru
-
 
2669
 putlabel 195,120,'‘âப  ­¥ ­ ©¤¥­ !',cl_White
-
 
2670
else
-
 
2671
 putlabel 195,120,'String not found!',cl_White
2622
 putlabel 195,120,'‘âப  ­¥ ­ ©¤¥­­ !',cl_White
2672
end if
2623
 
2673
 
2624
 drawlbut 235,140,30,15,'Žª',94,[sc.work_button],cl_White
2674
 drawlbut 235,140,30,15,'Žª',94,[sc.work_button],cl_White
2625
 
2675
 
2626
ret
2676
ret
2627
 
2677
 
2628
read_string:
2678
read_string:
2629
 
2679
 
2630
push eax
2680
push eax
2631
;----------------
2681
;----------------
2632
mov eax,40
2682
mov eax,40
2633
mov ebx,00000000000000000000000000000111b
2683
mov ebx,00000000000000000000000000000111b
2634
int 0x40
2684
int 0x40
2635
;----------------
2685
;----------------
2636
pop eax
2686
pop eax
2637
 
2687
 
2638
;    cmp  al,51
2688
;    cmp  al,51
2639
;    jz  .f2
2689
;    jz  .f2
2640
;    ret
2690
;    ret
2641
 
2691
 
2642
  .f2:
2692
  .f2:
2643
    mov  [addr],dword search_string
2693
    mov  [addr],dword search_string
2644
    mov  eax,[dstart]
2694
    mov  eax,[dstart]
2645
    add  eax,17+14
2695
    add  eax,17+14
2646
    mov  [ya],eax
2696
    mov  [ya],eax
2647
    mov  [case_sens],1
2697
    mov  [case_sens],1
2648
 
2698
 
2649
  .rk:
2699
  .rk:
2650
 
2700
 
2651
    mov  edi,[addr]
2701
    mov  edi,[addr]
2652
 
2702
 
2653
    mov  eax,[addr]
2703
    mov  eax,[addr]
2654
    mov  eax,[eax-4]
2704
    mov  eax,[eax-4]
2655
    mov  [temp],eax
2705
    mov  [temp],eax
2656
 
2706
 
2657
    add  edi,eax
2707
    add  edi,eax
2658
 
2708
 
2659
    call print_text
2709
    call print_text
2660
 
2710
 
2661
  .waitev:
2711
  .waitev:
2662
    mov  eax, 10
2712
    mov  eax, 10
2663
    int  0x40
2713
    int  0x40
2664
    cmp  eax, 2
2714
    cmp  eax, 2
2665
    jne  .read_done
2715
    jne  .read_done
2666
    int  0x40
2716
    int  0x40
2667
    shr  eax, 8
2717
    shr  eax, 8
2668
 
2718
 
2669
    cmp  al, 13     ; enter
2719
    cmp  al, 13     ; enter
2670
    je   .read_done
2720
    je   .read_done
2671
 
2721
 
2672
    cmp al,27
2722
    cmp al,27
2673
    jne ._f
2723
    jne ._f
2674
    jmp red
2724
    jmp red
2675
    ._f:
2725
    ._f:
2676
    cmp  al, 192    ; Ctrl + space
2726
    cmp  al, 192    ; Ctrl + space
2677
    jne  .noclear
2727
    jne  .noclear
2678
 
2728
 
2679
    xor  eax, eax
2729
    xor  eax, eax
2680
    mov  [temp], eax
2730
    mov  [temp], eax
2681
    mov  edi, [addr]
2731
    mov  edi, [addr]
2682
    mov  [edi-4], eax
2732
    mov  [edi-4], eax
2683
    mov  ecx, 49
2733
    mov  ecx, 49
2684
    cld
2734
    cld
2685
    rep  stosb
2735
    rep  stosb
2686
    mov  edi, [addr]
2736
    mov  edi, [addr]
2687
    call print_text
2737
    call print_text
2688
    jmp  .waitev
2738
    jmp  .waitev
2689
 
2739
 
2690
  .noclear:
2740
  .noclear:
2691
 
2741
 
2692
    cmp  al, 8      ; backspace
2742
    cmp  al, 8      ; backspace
2693
    jnz  .nobsl
2743
    jnz  .nobsl
2694
    cmp  [temp], 0
2744
    cmp  [temp], 0
2695
    jz   .waitev
2745
    jz   .waitev
2696
    dec  [temp]
2746
    dec  [temp]
2697
    mov  edi, [addr]
2747
    mov  edi, [addr]
2698
    add  edi, [temp]
2748
    add  edi, [temp]
2699
    mov  [edi], byte 0
2749
    mov  [edi], byte 0
2700
 
2750
 
2701
    mov  eax,[addr]
2751
    mov  eax,[addr]
2702
    dec  dword [eax-4]
2752
    dec  dword [eax-4]
2703
 
2753
 
2704
    call print_text
2754
    call print_text
2705
    jmp  .waitev
2755
    jmp  .waitev
2706
 
2756
 
2707
  .nobsl:
2757
  .nobsl:
2708
    cmp  [temp],50
2758
    cmp  [temp],50
2709
    jae  .read_done
2759
    jae  .read_done
2710
 
2760
 
2711
; CONVERT CHAR TO UPPER CASE:
2761
; CONVERT CHAR TO UPPER CASE:
2712
    cmp  al, ' '        ; below "space" - ignore
2762
    cmp  al, ' '        ; below "space" - ignore
2713
    jb   .waitev
2763
    jb   .waitev
2714
    cmp  [case_sens], 1 ; case sensitive?
2764
    cmp  [case_sens], 1 ; case sensitive?
2715
    je   .keyok
2765
    je   .keyok
2716
    cmp  al, 'a'
2766
    cmp  al, 'a'
2717
    jb   .keyok
2767
    jb   .keyok
2718
    cmp  al, 'z'
2768
    cmp  al, 'z'
2719
    ja   .keyok
2769
    ja   .keyok
2720
    sub  al, 32
2770
    sub  al, 32
2721
   .keyok:
2771
   .keyok:
2722
 
2772
 
2723
    mov  edi,[addr]
2773
    mov  edi,[addr]
2724
    add  edi,[temp]
2774
    add  edi,[temp]
2725
    mov  [edi],al
2775
    mov  [edi],al
2726
 
2776
 
2727
    inc  [temp]
2777
    inc  [temp]
2728
 
2778
 
2729
    mov  eax,[addr]
2779
    mov  eax,[addr]
2730
    inc  dword [eax-4]
2780
    inc  dword [eax-4]
2731
    call print_text
2781
    call print_text
2732
 
2782
 
2733
    cmp  [temp],50
2783
    cmp  [temp],50
2734
    jbe  .waitev
2784
    jbe  .waitev
2735
 
2785
 
2736
  .read_done:
2786
  .read_done:
2737
    mov ecx,50
2787
    mov ecx,50
2738
    sub ecx,[temp]
2788
    sub ecx,[temp]
2739
    mov edi,[addr]
2789
    mov edi,[addr]
2740
    add edi,[temp]
2790
    add edi,[temp]
2741
    xor eax,eax
2791
    xor eax,eax
2742
    cld
2792
    cld
2743
    rep stosb
2793
    rep stosb
2744
 
2794
 
2745
    mov [temp],987
2795
    mov [temp],987
2746
 
2796
 
2747
    call print_text
2797
    call print_text
2748
    call mask_events
2798
    call mask_events
2749
    ret
2799
    ret
2750
 
2800
 
2751
 
2801
 
2752
print_text:
2802
print_text:
2753
 
2803
 
2754
    pusha
2804
    pusha
2755
 
2805
 
2756
    mov  eax,13
2806
    mov  eax,13
2757
    mov  ebx,64*65536+50*6+2
2807
    mov  ebx,64*65536+50*6+2
2758
;    mov  ecx,[ya]
2808
;    mov  ecx,[ya]
2759
;    shl  ecx,16
2809
;    shl  ecx,16
2760
;    add  ecx,12
2810
;    add  ecx,12
2761
    mov ecx,110*65536+12
2811
    mov ecx,110*65536+12
2762
    mov  edx,[sc.work]
2812
    mov  edx,[sc.work]
2763
    int  0x40
2813
    int  0x40
2764
 
2814
 
2765
    mov  edx,[addr]
2815
    mov  edx,[addr]
2766
    mov  esi,[edx-4]
2816
    mov  esi,[edx-4]
2767
    mov  eax,4
2817
    mov  eax,4
2768
    mov  ebx,65*65536+112 ;2
2818
    mov  ebx,65*65536+112 ;2
2769
;    add  ebx,[ya]
2819
;    add  ebx,[ya]
2770
    mov  ecx,[color_tbl+0]
2820
    mov  ecx,[color_tbl+0]
2771
    int  0x40
2821
    int  0x40
2772
 
2822
 
2773
    cmp  [temp],50
2823
    cmp  [temp],50
2774
    ja   @f
2824
    ja   @f
2775
 
2825
 
2776
; draw cursor
2826
; draw cursor
2777
; {
2827
; {
2778
;    mov  eax,[ya]
2828
;    mov  eax,[ya]
2779
    mov eax,18*65536+102 ;65
2829
    mov eax,18*65536+102 ;65
2780
    mov  ebx,eax
2830
    mov  ebx,eax
2781
    shl  eax,16
2831
    shl  eax,16
2782
    add  eax,ebx
2832
    add  eax,ebx
2783
    add  eax,10
2833
    add  eax,10
2784
    mov  ecx,eax
2834
    mov  ecx,eax
2785
 
2835
 
2786
    mov  eax,[temp]
2836
    mov  eax,[temp]
2787
;   imul eax,6
2837
;   imul eax,6
2788
    lea  eax,[eax+eax*2]
2838
    lea  eax,[eax+eax*2]
2789
    shl  eax,1
2839
    shl  eax,1
2790
    add  eax,65
2840
    add  eax,65
2791
    mov  ebx,eax
2841
    mov  ebx,eax
2792
    shl  eax,16
2842
    shl  eax,16
2793
    add  ebx,eax
2843
    add  ebx,eax
2794
 
2844
 
2795
    mov  eax,38
2845
    mov  eax,38
2796
    mov  edx,[color_tbl+0]
2846
    mov  edx,[color_tbl+0]
2797
    int  0x40
2847
    int  0x40
2798
; }
2848
; }
2799
 
2849
 
2800
@@:
2850
@@:
2801
    popa
2851
    popa
2802
 
2852
 
2803
    ret
2853
    ret
2804
 
2854
 
2805
 
2855
 
2806
 
2856
 
2807
;    mov  eax,8                   ; STRING BUTTON
2857
;    mov  eax,8                   ; STRING BUTTON
2808
;    mov  ebx,5*65536+57
2858
;    mov  ebx,5*65536+57
2809
;    mov  ecx,[dstart]
2859
;    mov  ecx,[dstart]
2810
;    add  ecx,29
2860
;    add  ecx,29
2811
;    shl  ecx,16
2861
;    shl  ecx,16
2812
;    add  ecx,13
2862
;    add  ecx,13
2813
;    mov  edx,51              ;;;;;-----string button ID=51
2863
;    mov  edx,51              ;;;;;-----string button ID=51
2814
;    mov  esi,[sc.work_button]
2864
;    mov  esi,[sc.work_button]
2815
;    int  0x40
2865
;    int  0x40
2816
                                  ; SEARCH BUTTON
2866
                                  ; SEARCH BUTTON
2817
;    mov  ebx,(505-129)*65536+125
2867
;    mov  ebx,(505-129)*65536+125
2818
;    mov  edx,50
2868
;    mov  edx,50
2819
;    mov  esi,[sc.work_button]
2869
;    mov  esi,[sc.work_button]
2820
;    int  0x40
2870
;    int  0x40
2821
 
2871
 
2822
;    mov  eax,4                   ; SEARCH TEXT
2872
;    mov  eax,4                   ; SEARCH TEXT
2823
;    mov  ebx,[dstart]
2873
;    mov  ebx,[dstart]
2824
;    add  ebx,7*65536+32
2874
;    add  ebx,7*65536+32
2825
;    mov  ecx,[sc.work_button_text]
2875
;    mov  ecx,[sc.work_button_text]
2826
;    mov  edx,searcht
2876
;    mov  edx,searcht
2827
;    mov  esi,searchtl-searcht
2877
;    mov  esi,searchtl-searcht
2828
;    int  0x40
2878
;    int  0x40
2829
 
2879
 
2830
 
2880
 
2831
 
2881
 
2832
; ****************************
2882
; ****************************
2833
; ******* READ STRING ********
2883
; ******* READ STRING ********
2834
; ****************************
2884
; ****************************
2835
goto_string:
2885
goto_string:
2836
 
2886
 
2837
mov [num_goto_string],0
2887
mov [num_goto_string],0
2838
call read_str_num
2888
call read_str_num
2839
mov eax,[num_goto_string]
2889
mov eax,[num_goto_string]
2840
cmp eax,[lines]
2890
cmp eax,[lines]
2841
ja .leave
2891
ja .leave
2842
 
2892
 
2843
;---------------
2893
;---------------
2844
mov [posy],0
2894
mov [posy],0
2845
call goto_pos
2895
call goto_pos
2846
 
2896
 
2847
.leave:
2897
.leave:
2848
call draw_window_for_dialogs
2898
call draw_window_for_dialogs
2849
call mask_events
2899
call mask_events
2850
 
2900
 
2851
jmp still
2901
jmp still
2852
 
2902
 
2853
 
2903
 
2854
read_str_num:
2904
read_str_num:
2855
push eax
2905
push eax
2856
;----------------
2906
;----------------
2857
mov eax,40
2907
mov eax,40
2858
mov ebx,00000000000000000000000000000111b
2908
mov ebx,00000000000000000000000000000111b
2859
int 0x40
2909
int 0x40
2860
;----------------
2910
;----------------
2861
pop eax
2911
pop eax
2862
 
2912
 
2863
mov eax,13
2913
mov eax,13
2864
mov ebx,100*65536+100
2914
mov ebx,100*65536+100
2865
mov ecx,70*65536+60
2915
mov ecx,70*65536+60
2866
mov edx,[sc.work_button]
2916
mov edx,[sc.work_button]
2867
int 0x40
2917
int 0x40
2868
 
2918
 
2869
 
2919
 
2870
mov eax,38
2920
mov eax,38
2871
mov ebx,100*65536+200
2921
mov ebx,100*65536+200
2872
mov ecx,70*65536+70
2922
mov ecx,70*65536+70
2873
mov edx,cl_White
2923
mov edx,cl_White
2874
int 0x40
2924
int 0x40
2875
mov eax,38
2925
mov eax,38
2876
mov ebx,100*65536+200
2926
mov ebx,100*65536+200
2877
mov ecx,130*65536+130
2927
mov ecx,130*65536+130
2878
mov edx,cl_White
2928
mov edx,cl_White
2879
int 0x40
2929
int 0x40
2880
mov eax,38
2930
mov eax,38
2881
mov ebx,100*65536+100
2931
mov ebx,100*65536+100
2882
mov ecx,70*65536+130
2932
mov ecx,70*65536+130
2883
mov edx,cl_White
2933
mov edx,cl_White
2884
int 0x40
2934
int 0x40
2885
mov eax,38
2935
mov eax,38
2886
mov ebx,200*65536+200
2936
mov ebx,200*65536+200
2887
mov ecx,70*65536+130
2937
mov ecx,70*65536+130
2888
mov edx,cl_White
2938
mov edx,cl_White
2889
int 0x40
2939
int 0x40
2890
 
2940
 
2891
 
2941
 
2892
 
2942
 
2893
putlabel 105,75,'GoTo Line #',cl_White
2943
putlabel 105,75,'GoTo Line #',cl_White
2894
    mov  eax,13
2944
    mov  eax,13
2895
    mov  ebx,110*65536+40
2945
    mov  ebx,110*65536+40
2896
    mov  ecx,90*65536+12;[ya]
2946
    mov  ecx,90*65536+12;[ya]
2897
    mov  edx,[sc.work]
2947
    mov  edx,[sc.work]
2898
    int  0x40
2948
    int  0x40
2899
 
2949
 
2900
outcount [num_goto_string],112,92,cl_Black,6*65536
2950
outcount [num_goto_string],112,92,cl_Black,6*65536
2901
drawlbut 110,105,40,15,'GoTo',93,cl_Grey,cl_Black
2951
drawlbut 110,105,40,15,'GoTo',93,cl_Grey,cl_Black
2902
drawlbut 153,105,40,15,'Cancel',94,cl_Grey,cl_Black
2952
drawlbut 153,105,40,15,'Cancel',94,cl_Grey,cl_Black
2903
  .waitev:
2953
  .waitev:
2904
    mov  eax, 10
2954
    mov  eax, 10
2905
    int  0x40
2955
    int  0x40
2906
;    cmp eax,6
2956
;    cmp eax,6
2907
;    je .mouse
2957
;    je .mouse
2908
    cmp eax,3
2958
    cmp eax,3
2909
    je .but
2959
    je .but
2910
    cmp  eax, 2
2960
    cmp  eax, 2
2911
;    jne  .read_done
2961
;    jne  .read_done
2912
    jne .waitev
2962
    jne .waitev
2913
    int  0x40
2963
    int  0x40
2914
    shr  eax, 8
2964
    shr  eax, 8
2915
 
2965
 
2916
    cmp  al, 13     ; enter
2966
    cmp  al, 13     ; enter
2917
    je   .read_done
2967
    je   .read_done
2918
    cmp al,27
2968
    cmp al,27
2919
    je goto_string.leave
2969
    je goto_string.leave
2920
    cmp  al, 8      ; backspace
2970
    cmp  al, 8      ; backspace
2921
    jnz  .nobsl
2971
    jnz  .nobsl
2922
 
2972
 
2923
xor edx,edx
2973
xor edx,edx
2924
 
2974
 
2925
mov eax,[num_goto_string]
2975
mov eax,[num_goto_string]
2926
mov ebx,dword 10
2976
mov ebx,dword 10
2927
div ebx
2977
div ebx
2928
mov [num_goto_string],eax
2978
mov [num_goto_string],eax
2929
call print_text2
2979
call print_text2
2930
jmp .waitev
2980
jmp .waitev
2931
 
2981
 
2932
;.mouse:
2982
;.mouse:
2933
;mov eax,37
2983
;mov eax,37
2934
;mov ebx,2
2984
;mov ebx,2
2935
;int 0x40
2985
;int 0x40
2936
;cmp eax,2
2986
;cmp eax,2
2937
;je goto_string.leave
2987
;je goto_string.leave
2938
;jmp .waitev
2988
;jmp .waitev
2939
 
2989
 
2940
.but:
2990
.but:
2941
mov eax,17
2991
mov eax,17
2942
int 0x40
2992
int 0x40
2943
cmp ah,94
2993
cmp ah,94
2944
je goto_string.leave
2994
je goto_string.leave
2945
cmp ah,93
2995
cmp ah,93
2946
je .read_done
2996
je .read_done
2947
jmp .waitev
2997
jmp .waitev
2948
 
2998
 
2949
 
2999
 
2950
  .nobsl:
3000
  .nobsl:
2951
xor ecx,ecx
3001
xor ecx,ecx
2952
xor edx,edx
3002
xor edx,edx
2953
 
3003
 
2954
sub al,48
3004
sub al,48
2955
mov cl,al
3005
mov cl,al
2956
 
3006
 
2957
mov eax,[num_goto_string]
3007
mov eax,[num_goto_string]
2958
cmp eax,99999
3008
cmp eax,99999
2959
ja .read_done
3009
ja .read_done
2960
mov ebx,10
3010
mov ebx,10
2961
mul ebx
3011
mul ebx
2962
add eax,ecx
3012
add eax,ecx
2963
mov [num_goto_string],eax
3013
mov [num_goto_string],eax
2964
 
3014
 
2965
call print_text2
3015
call print_text2
2966
jmp .waitev
3016
jmp .waitev
2967
 
3017
 
2968
  .read_done:
3018
  .read_done:
2969
mov eax,[num_goto_string]
3019
mov eax,[num_goto_string]
2970
dec eax
3020
dec eax
2971
mov [num_goto_string],eax
3021
mov [num_goto_string],eax
2972
    call print_text2
3022
    call print_text2
2973
    ret
3023
    ret
2974
 
3024
 
2975
 
3025
 
2976
print_text2:
3026
print_text2:
2977
 
3027
 
2978
    pusha
3028
    pusha
2979
 
3029
 
2980
    mov  eax,13
3030
    mov  eax,13
2981
    mov  ebx,110*65536+40
3031
    mov  ebx,110*65536+40
2982
    mov  ecx,90*65536+12;[ya]
3032
    mov  ecx,90*65536+12;[ya]
2983
    mov  edx,[sc.work]
3033
    mov  edx,[sc.work]
2984
    int  0x40
3034
    int  0x40
2985
 
3035
 
2986
outcount [num_goto_string],112,92,cl_Black,6*65536
3036
outcount [num_goto_string],112,92,cl_Black,6*65536
2987
    popa
3037
    popa
2988
 
3038
 
2989
    ret
3039
    ret
2990
 
3040
 
2991
;******************************************************************************
3041
;******************************************************************************
2992
calc_scroll_size_and_pos:
3042
calc_scroll_size_and_pos:
2993
 
3043
 
2994
;cmp [menu_is_on],0
3044
;cmp [menu_is_on],0
2995
;je ._ff
3045
;je ._ff
2996
;call drawwindow
3046
;call drawwindow
2997
;mov [menu_is_on],0
3047
;mov [menu_is_on],0
2998
;._ff:
3048
;._ff:
2999
 
3049
 
3000
cmp [lines],30
3050
cmp [lines],30
3001
jbe .lines_less_30
3051
jbe .lines_less_30
3002
 
3052
 
3003
xor edx,edx
3053
xor edx,edx
3004
mov eax,[post]
3054
mov eax,[post]
3005
mov ebx,80
3055
mov ebx,80
3006
div ebx
3056
div ebx
3007
add eax,[posy]
3057
add eax,[posy]
3008
;add eax,[slines]
3058
;add eax,[slines]
3009
 
3059
 
3010
;checking for bug
3060
;checking for bug
3011
mov ebx,[lines]
3061
mov ebx,[lines]
3012
sub ebx,30
3062
sub ebx,30
3013
 
3063
 
3014
cmp eax,ebx
3064
cmp eax,ebx
3015
ja .f
3065
ja .f
3016
mov [VScroll_1+16],eax
3066
mov [VScroll_1+16],eax
3017
jmp .ff
3067
jmp .ff
3018
.f:
3068
.f:
3019
mov [VScroll_1+16],ebx
3069
mov [VScroll_1+16],ebx
3020
 
3070
 
3021
.ff:
3071
.ff:
3022
;---------------------
3072
;---------------------
3023
mov eax,[lines]
3073
mov eax,[lines]
3024
sub eax,30       ;---max=lines-30
3074
sub eax,30       ;---max=lines-30
3025
mov [VScroll_1+12],eax
3075
mov [VScroll_1+12],eax
3026
jmp .leave
3076
jmp .leave
3027
 
3077
 
3028
.lines_less_30:
3078
.lines_less_30:
3029
 
3079
 
3030
mov [VScroll_1+16],dword 0
3080
mov [VScroll_1+16],dword 0
3031
mov [VScroll_1+12],dword 1
3081
mov [VScroll_1+12],dword 1
3032
 
3082
 
3033
.leave:
3083
.leave:
3034
 
3084
 
3035
ret
3085
ret
3036
;============Draw vertical scroll bar=========
3086
;============Draw vertical scroll bar=========
3037
draw_vertical_scroll:
3087
draw_vertical_scroll:
3038
call calc_scroll_size_and_pos
3088
call calc_scroll_size_and_pos
3039
;========================
3089
;========================
3040
    xor  ecx,ecx                    ;start at top of controls list
3090
    xor  ecx,ecx                    ;start at top of controls list
3041
Draw_Controls_Loop:                 ;Redraw Controls Loop
3091
Draw_Controls_Loop:                 ;Redraw Controls Loop
3042
    mov  ebp, [App_Controls+ecx]    ;get controls data location
3092
    mov  ebp, [App_Controls+ecx]    ;get controls data location
3043
    or   ebp,ebp                    ;is this the last control?
3093
    or   ebp,ebp                    ;is this the last control?
3044
    jz   Draw_Controls_Done         ;
3094
    jz   Draw_Controls_Done         ;
3045
    call dword [App_Controls+ecx+4] ;call controls draw function
3095
    call dword [App_Controls+ecx+4] ;call controls draw function
3046
    add  ecx, 12                    ;get next control
3096
    add  ecx, 12                    ;get next control
3047
    jmp  Draw_Controls_Loop         ;loop till done
3097
    jmp  Draw_Controls_Loop         ;loop till done
3048
Draw_Controls_Done:                 ;all done
3098
Draw_Controls_Done:                 ;all done
3049
;========================
3099
;========================
3050
 
3100
 
3051
mov eax,38
3101
mov eax,38
3052
mov ebx,488*65536+488
3102
mov ebx,488*65536+488
3053
mov ecx,43*65536+388
3103
mov ecx,43*65536+388
3054
mov edx,0x00000000
3104
mov edx,0x00000000
3055
int 0x40
3105
int 0x40
3056
ret
3106
ret
3057
 
3107
 
3058
mouse_info:
3108
mouse_info:
3059
;call
3109
;call
3060
   mov eax, 37            ;get mouse cordinates
3110
   mov eax, 37            ;get mouse cordinates
3061
   mov ebx, 1             ;
3111
   mov ebx, 1             ;
3062
   int 0x40               ;
3112
   int 0x40               ;
3063
   mov ecx, eax           ;
3113
   mov ecx, eax           ;
3064
   push ecx               ;
3114
   push ecx               ;
3065
   mov eax, 37            ;get mouse buttons
3115
   mov eax, 37            ;get mouse buttons
3066
   mov ebx, 2             ;
3116
   mov ebx, 2             ;
3067
   int 0x40               ;
3117
   int 0x40               ;
3068
;------------------
3118
;------------------
3069
; if menu is on - then we need to redraw window before continue
3119
; if menu is on - then we need to redraw window before continue
3070
cmp eax,1
3120
cmp eax,1
3071
jne ._f1
3121
jne ._f1
3072
 
3122
 
3073
pusha
3123
pusha
3074
cmp [menu_is_on],0
3124
cmp [menu_is_on],0
3075
je ._ff
3125
je ._ff
3076
call drawwindow
3126
call drawwindow
3077
mov [menu_is_on],0
3127
mov [menu_is_on],0
3078
._ff:
3128
._ff:
3079
popa
3129
popa
3080
 
3130
 
3081
._f1:
3131
._f1:
3082
;------------------
3132
;------------------
3083
   cmp [mouseb], eax      ;compare old mouse states to new states
3133
   cmp [mouseb], eax      ;compare old mouse states to new states
3084
   jne redraw_mouse_info  ;
3134
   jne redraw_mouse_info  ;
3085
   cmp [mousey], cx       ;
3135
   cmp [mousey], cx       ;
3086
   jne redraw_mouse_info  ;
3136
   jne redraw_mouse_info  ;
3087
   shr ecx, 16            ;
3137
   shr ecx, 16            ;
3088
   cmp [mousex], cx       ;
3138
   cmp [mousex], cx       ;
3089
   jne redraw_mouse_info  ;
3139
   jne redraw_mouse_info  ;
3090
   pop ecx                ;
3140
   pop ecx                ;
3091
ret                       ;return if no change in states
3141
ret                       ;return if no change in states
3092
redraw_mouse_info:
3142
redraw_mouse_info:
3093
   pop   ecx
3143
   pop   ecx
3094
   mov   [mouseb], eax         ;save new mouse states
3144
   mov   [mouseb], eax         ;save new mouse states
3095
   mov   dword [mousey], ecx
3145
   mov   dword [mousey], ecx
3096
   xor   ecx, ecx
3146
   xor   ecx, ecx
3097
Check_Mouse_Over_Controls_Loop:
3147
Check_Mouse_Over_Controls_Loop:
3098
   mov   ebp, [App_Controls+ecx]
3148
   mov   ebp, [App_Controls+ecx]
3099
   or    ebp, ebp
3149
   or    ebp, ebp
3100
   jz    Check_Mouse_Over_Controls_Loop_done
3150
   jz    Check_Mouse_Over_Controls_Loop_done
3101
 
3151
 
3102
   movzx eax,word [ebp+2]
3152
   movzx eax,word [ebp+2]
3103
   cmp    ax, [mousex]
3153
   cmp    ax, [mousex]
3104
   ja    mouse_not_on_control
3154
   ja    mouse_not_on_control
3105
   movzx eax,word [ebp+6]
3155
   movzx eax,word [ebp+6]
3106
   cmp    ax, [mousey]
3156
   cmp    ax, [mousey]
3107
   ja    mouse_not_on_control
3157
   ja    mouse_not_on_control
3108
   movzx eax,word [ebp]
3158
   movzx eax,word [ebp]
3109
   add    ax, [ebp+2]
3159
   add    ax, [ebp+2]
3110
   cmp    ax, [mousex]
3160
   cmp    ax, [mousex]
3111
   jb    mouse_not_on_control
3161
   jb    mouse_not_on_control
3112
   movzx eax,word [ebp+4]
3162
   movzx eax,word [ebp+4]
3113
   add    ax, [ebp+6]
3163
   add    ax, [ebp+6]
3114
   cmp    ax, [mousey]
3164
   cmp    ax, [mousey]
3115
   jb    mouse_not_on_control
3165
   jb    mouse_not_on_control
3116
   call  dword [App_Controls+ecx+8]
3166
   call  dword [App_Controls+ecx+8]
3117
   ;------------------------------
3167
   ;------------------------------
3118
   cmp [mouseb],1
3168
   cmp [mouseb],1
3119
   jne mouse_not_on_control
3169
   jne mouse_not_on_control
3120
   mov eax,[VScroll_1+16]
3170
   mov eax,[VScroll_1+16]
3121
   call goto_pos
3171
   call goto_pos
3122
   ;------------------------------
3172
   ;------------------------------
3123
 
3173
 
3124
mouse_not_on_control:
3174
mouse_not_on_control:
3125
   add ecx, 12
3175
   add ecx, 12
3126
   jmp Check_Mouse_Over_Controls_Loop
3176
   jmp Check_Mouse_Over_Controls_Loop
3127
Check_Mouse_Over_Controls_Loop_done:
3177
Check_Mouse_Over_Controls_Loop_done:
3128
 
3178
 
3129
ret
3179
ret
3130
;******************************************************************************
3180
;******************************************************************************
3131
goto_pos:
3181
goto_pos:
3132
;pusha
3182
;pusha
3133
 
3183
 
3134
mov ecx,eax   ;save new position number in ecx for future
3184
mov ecx,eax   ;save new position number in ecx for future
3135
 
3185
 
3136
cmp [lines],30    ;check for 'cursor' bug
3186
cmp [lines],30    ;check for 'cursor' bug
3137
jbe .lines_less_30
3187
jbe .lines_less_30
3138
;---------------
3188
;---------------
3139
 
3189
 
3140
mov edx,[lines]   ;if new pos is > than (lines-30)
3190
mov edx,[lines]   ;if new pos is > than (lines-30)
3141
sub edx,30
3191
sub edx,30
3142
 
3192
 
3143
cmp eax,edx
3193
cmp eax,edx
3144
ja .f1
3194
ja .f1
3145
jmp .ff
3195
jmp .ff
3146
 
3196
 
3147
.f1:
3197
.f1:
3148
mov eax,edx       ;than newpos is = (lines-30)
3198
mov eax,edx       ;than newpos is = (lines-30)
3149
 
3199
 
3150
sub ecx,edx       ;and posY=newpos-(lines-30)
3200
sub ecx,edx       ;and posY=newpos-(lines-30)
3151
mov [posy],ecx
3201
mov [posy],ecx
3152
 
3202
 
3153
.ff:
3203
.ff:
3154
 
3204
 
3155
;-----------------------
3205
;-----------------------
3156
   ;in eax must be string number
3206
   ;in eax must be string number
3157
   mov ecx,80
3207
   mov ecx,80
3158
   mul ecx
3208
   mul ecx
3159
 
3209
 
3160
;   add eax,[slines]
3210
;   add eax,[slines]
3161
;   sub
3211
;   sub
3162
;------------------------
3212
;------------------------
3163
   mov [post],eax
3213
   mov [post],eax
3164
 
3214
 
3165
.lines_less_30:
3215
.lines_less_30:
3166
    call clear_screen
3216
    call clear_screen
3167
    call drawfile
3217
    call drawfile
3168
;popa
3218
;popa
3169
ret
3219
ret
3170
;******************************************************************************
3220
;******************************************************************************
3171
mask_events:
3221
mask_events:
3172
mov eax,40
3222
mov eax,40
3173
mov ebx,00100111b
3223
mov ebx,00100111b
3174
int 0x40
3224
int 0x40
3175
ret
3225
ret
3176
;******************************************************************************
3226
;******************************************************************************
3177
main_cursor_move:
3227
main_cursor_move:
3178
;call drawwindow
3228
;call drawwindow
3179
sub [mouse_x],7
3229
sub [mouse_x],7
3180
sub [mouse_y],45
3230
sub [mouse_y],45
3181
 
3231
 
3182
xor edx,edx
3232
xor edx,edx
3183
mov eax,[mouse_x]
3233
mov eax,[mouse_x]
3184
mov ebx,6
3234
mov ebx,6
3185
div ebx ;eax=result
3235
div ebx ;eax=result
3186
mov [posx],eax
3236
mov [posx],eax
3187
 
3237
 
3188
xor edx,edx
3238
xor edx,edx
3189
mov eax,dword [mouse_y]
3239
mov eax,dword [mouse_y]
3190
mov ebx,dword 10
3240
mov ebx,dword 10
3191
div ebx ;eax=result=new posY
3241
div ebx ;eax=result=new posY
3192
 
3242
 
3193
;error checking ------
3243
;error checking ------
3194
cmp [lines],dword 1 ;for "1st line" bug
3244
cmp [lines],dword 1 ;for "1st line" bug
3195
je ._do_nothing
3245
je ._do_nothing
3196
 
3246
 
3197
mov ebx,[lines]
3247
mov ebx,[lines]
3198
sub ebx,dword 1
3248
sub ebx,dword 1
3199
 
3249
 
3200
cmp eax,ebx ;[lines]
3250
cmp eax,ebx ;[lines]
3201
ja ._do_nothing
3251
ja ._do_nothing
3202
 
3252
 
3203
;----------------------
3253
;----------------------
3204
mov [posy],eax
3254
mov [posy],eax
3205
 
3255
 
3206
._do_nothing:
3256
._do_nothing:
3207
call clear_screen
3257
call clear_screen
3208
call drawfile
3258
call drawfile
3209
call draw_vertical_scroll
3259
call draw_vertical_scroll
3210
ret
3260
ret
3211
 
3261
 
3212
;******************************************************************************
3262
;******************************************************************************
3213
make_fast_so:
3263
make_fast_so:
3214
;===========================
3264
;===========================
3215
; 1) get info about me
3265
; 1) get info about me
3216
   mov     eax,9
3266
   mov     eax,9
3217
   mov     ebx,procinfo
3267
   mov     ebx,procinfo
3218
   mov     ecx,-1
3268
   mov     ecx,-1
3219
   int     0x40
3269
   int     0x40
3220
   ; eax = number of processes
3270
   ; eax = number of processes
3221
 
3271
 
3222
; save process counter
3272
; save process counter
3223
   inc     eax
3273
   inc     eax
3224
   inc     eax
3274
   inc     eax
3225
   mov     [proccount],eax
3275
   mov     [proccount],eax
3226
 
3276
 
3227
   mov     eax,[procinfo.PID]
3277
   mov     eax,[procinfo.PID]
3228
   mov     [PID],eax
3278
   mov     [PID],eax
3229
;==========================
3279
;==========================
3230
 
3280
 
3231
 
3281
 
3232
mov eax,51
3282
mov eax,51
3233
mov ebx,1
3283
mov ebx,1
3234
mov ecx,fast_so_thread_start
3284
mov ecx,fast_so_thread_start
3235
mov edx,so_stack
3285
mov edx,so_stack
3236
int 0x40
3286
int 0x40
3237
ret
3287
ret
3238
;******************************************************************************
3288
;******************************************************************************
3239
 
3289
 
3240
;fast save & fast open
3290
;fast save & fast open
3241
draw_fastso_window:
3291
draw_fastso_window:
3242
startwd
3292
startwd
3243
colorwindow 120,100,454,70,window_Type1+0x00cccccc,0x00cccccc,cl_Black
3293
colorwindow 120,100,454,70,window_Type1+0x00cccccc,0x00cccccc,cl_Black
3244
 
3294
 
3245
call draw_string00
3295
call draw_string00
3246
drawlbut 10,40,30,20,'Save',17,cl_Grey,cl_Black
3296
drawlbut 10,40,30,20,'Save',17,cl_Grey,cl_Black
3247
 
3297
 
3248
drawlbut 50,40,30,20,'Open',18,cl_Grey,cl_Black
3298
drawlbut 50,40,30,20,'Open',18,cl_Grey,cl_Black
3249
 
3299
 
3250
drawlbut 90,40,37,20,'Close',19,cl_Grey,cl_Black
3300
drawlbut 90,40,37,20,'Close',19,cl_Grey,cl_Black
3251
endwd
3301
endwd
3252
ret
3302
ret
3253
 
3303
 
3254
draw_string00:
3304
draw_string00:
3255
mov ebx,10*65536+433
3305
mov ebx,10*65536+433
3256
mov ecx,10*65536+20
3306
mov ecx,10*65536+20
3257
mov edx,0x00ffffff
3307
mov edx,0x00ffffff
3258
mov eax,13
3308
mov eax,13
3259
int 0x40
3309
int 0x40
3260
 
3310
 
3261
push eax
3311
push eax
3262
mov eax,6*65536
3312
mov eax,6*65536
3263
mul dword [pos00]
3313
mul dword [pos00]
3264
add eax,10*65536+6
3314
add eax,10*65536+6
3265
mov ebx,eax
3315
mov ebx,eax
3266
pop eax
3316
pop eax
3267
mov edx,0x6a73d0
3317
mov edx,0x6a73d0
3268
int 0x40
3318
int 0x40
3269
 
3319
 
3270
mov eax,4
3320
mov eax,4
3271
mov ebx,12*65536+17
3321
mov ebx,12*65536+17
3272
mov ecx,cl_Black ;0x00000000
3322
mov ecx,cl_Black ;0x00000000
3273
mov edx,mypath ;filename    ;path
3323
mov edx,mypath ;filename    ;path
3274
mov esi,71 ;200
3324
mov esi,71 ;200
3275
int 0x40
3325
int 0x40
3276
ret
3326
ret
3277
 
3327
 
3278
fast_so_thread_start:
3328
fast_so_thread_start:
3279
;copy filename to mypath
3329
;copy filename to mypath
3280
    cld
3330
    cld
3281
    mov esi,filename
3331
    mov esi,filename
3282
    mov edi,mypath
3332
    mov edi,mypath
3283
    mov ecx,71 ;200
3333
    mov ecx,71 ;200
3284
    rep movsb
3334
    rep movsb
3285
    mov    edi,mypath
3335
    mov    edi,mypath
3286
    mov    ecx,71 ;200
3336
    mov    ecx,71 ;200
3287
    xor    eax,eax
3337
    xor    eax,eax
3288
    repne  scasb
3338
    repne  scasb
3289
;end copy
3339
;end copy
3290
call draw_fastso_window
3340
call draw_fastso_window
3291
 
3341
 
3292
fastso_still:
3342
fastso_still:
3293
  wtevent fred,fkey,fbut
3343
  wtevent fred,fkey,fbut
3294
jmp fastso_still
3344
jmp fastso_still
3295
 
3345
 
3296
fred:
3346
fred:
3297
call draw_fastso_window
3347
call draw_fastso_window
3298
jmp fastso_still
3348
jmp fastso_still
3299
 
3349
 
3300
;====KEY
3350
;====KEY
3301
fkey:
3351
fkey:
3302
 
3352
 
3303
mov eax,2
3353
mov eax,2
3304
int 0x40
3354
int 0x40
3305
 
3355
 
3306
cmp ah,179
3356
cmp ah,179
3307
jne noright00
3357
jne noright00
3308
mov eax,[pos00]
3358
mov eax,[pos00]
3309
cmp eax,70 ;41
3359
cmp eax,70 ;41
3310
ja fastso_still
3360
ja fastso_still
3311
inc eax
3361
inc eax
3312
mov [pos00],eax
3362
mov [pos00],eax
3313
call draw_string00
3363
call draw_string00
3314
jmp fastso_still
3364
jmp fastso_still
3315
noright00:
3365
noright00:
3316
cmp ah,176
3366
cmp ah,176
3317
jne noleft00
3367
jne noleft00
3318
mov eax,[pos00]
3368
mov eax,[pos00]
3319
test eax,eax
3369
test eax,eax
3320
je fastso_still
3370
je fastso_still
3321
dec eax
3371
dec eax
3322
mov [pos00],eax
3372
mov [pos00],eax
3323
call draw_string00
3373
call draw_string00
3324
jmp fastso_still
3374
jmp fastso_still
3325
noleft00:
3375
noleft00:
3326
cmp ah,182
3376
cmp ah,182
3327
jne nodelete00
3377
jne nodelete00
3328
call shiftback00
3378
call shiftback00
3329
call draw_string00
3379
call draw_string00
3330
jmp fastso_still
3380
jmp fastso_still
3331
nodelete00:
3381
nodelete00:
3332
cmp ah,8
3382
cmp ah,8
3333
jne noback00
3383
jne noback00
3334
mov eax,[pos00]
3384
mov eax,[pos00]
3335
test eax,eax
3385
test eax,eax
3336
je fastso_still
3386
je fastso_still
3337
dec eax
3387
dec eax
3338
mov [pos00],eax
3388
mov [pos00],eax
3339
call shiftback00
3389
call shiftback00
3340
call draw_string00
3390
call draw_string00
3341
jmp fastso_still
3391
jmp fastso_still
3342
noback00:
3392
noback00:
3343
enter00:
3393
enter00:
3344
 
3394
 
3345
cmp ah,19 ;ctrl+s
3395
cmp ah,19 ;ctrl+s
3346
je fast_save
3396
je fast_save
3347
cmp ah,15 ;ctrl+o
3397
cmp ah,15 ;ctrl+o
3348
je fast_open
3398
je fast_open
3349
 
3399
 
3350
cmp ah,27  ;esli escape
3400
cmp ah,27  ;esli escape
3351
jne noesc00
3401
jne noesc00
3352
jmp closethis      ;to zakrivaem okno i nifiga ne delayem
3402
jmp closethis      ;to zakrivaem okno i nifiga ne delayem
3353
 
3403
 
3354
noesc00:
3404
noesc00:
3355
cmp dword [pos00],71 ;200 ;42
3405
cmp dword [pos00],71 ;200 ;42
3356
jae fastso_still ;if pos>71 then jump to still
3406
jae fastso_still ;if pos>71 then jump to still
3357
 
3407
 
3358
;============letters==================
3408
;============letters==================
3359
;~~~~~~~TEST CODE~~~~~~~~~
3409
;~~~~~~~TEST CODE~~~~~~~~~
3360
; upper case
3410
; upper case
3361
shr eax,8
3411
shr eax,8
3362
 cmp eax,dword 31
3412
 cmp eax,dword 31
3363
 jbe no_lit
3413
 jbe no_lit
3364
 cmp eax,dword 95
3414
 cmp eax,dword 95
3365
 jb  capital
3415
 jb  capital
3366
 sub eax,32
3416
 sub eax,32
3367
 capital:
3417
 capital:
3368
;~~~~~~~~~~~~~~~~~~~~~~~~~
3418
;~~~~~~~~~~~~~~~~~~~~~~~~~
3369
mov edi,mypath ;filename ;mypath   ;**************PATHNAME
3419
mov edi,mypath ;filename ;mypath   ;**************PATHNAME
3370
add edi,71 ;200    ;count of letters
3420
add edi,71 ;200    ;count of letters
3371
mov esi,edi
3421
mov esi,edi
3372
dec esi
3422
dec esi
3373
mov ecx,71 ;200    ;again???
3423
mov ecx,71 ;200    ;again???
3374
sub ecx,[pos00]
3424
sub ecx,[pos00]
3375
std
3425
std
3376
rep movsb
3426
rep movsb
3377
 
3427
 
3378
;shr eax,8
3428
;shr eax,8
3379
mov esi,mypath ;filename  ;*************PATH AGAIN
3429
mov esi,mypath ;filename  ;*************PATH AGAIN
3380
add esi,[pos00]
3430
add esi,[pos00]
3381
mov byte [esi],al
3431
mov byte [esi],al
3382
inc dword [pos00]
3432
inc dword [pos00]
3383
call draw_string00
3433
call draw_string00
3384
 
3434
 
3385
no_lit:
3435
no_lit:
3386
jmp fastso_still
3436
jmp fastso_still
3387
;===============================
3437
;===============================
3388
shiftback00:
3438
shiftback00:
3389
mov edi,mypath ;filename ;******PATH
3439
mov edi,mypath ;filename ;******PATH
3390
add edi,[pos00]
3440
add edi,[pos00]
3391
mov esi,edi
3441
mov esi,edi
3392
inc esi
3442
inc esi
3393
mov ecx,71 ;200  ; count???
3443
mov ecx,71 ;200  ; count???
3394
sub ecx,[pos00]
3444
sub ecx,[pos00]
3395
cld
3445
cld
3396
rep movsb
3446
rep movsb
3397
ret
3447
ret
3398
 
3448
 
3399
;******************************************************************************
3449
;******************************************************************************
3400
 
3450
 
3401
;====button
3451
;====button
3402
fbut:
3452
fbut:
3403
mov eax,17
3453
mov eax,17
3404
int 0x40
3454
int 0x40
3405
cmp ah,17
3455
cmp ah,17
3406
je fast_save
3456
je fast_save
3407
cmp ah,18
3457
cmp ah,18
3408
je fast_open
3458
je fast_open
3409
cmp ah,19
3459
cmp ah,19
3410
je closethis
3460
je closethis
3411
jmp fastso_still
3461
jmp fastso_still
3412
;******************************************************************************
3462
;******************************************************************************
3413
;******************************************************************************
3463
;******************************************************************************
3414
 
3464
 
3415
fast_open:
3465
fast_open:
3416
call path_copy
3466
call path_copy
3417
call set_title
3467
call set_title
3418
mov [to_return],1
3468
mov [to_return],1
3419
call do_load_file
3469
call do_load_file
3420
jmp closethis
3470
jmp closethis
3421
fast_save:
3471
fast_save:
3422
call path_copy
3472
call path_copy
3423
call save_file
3473
call save_file
3424
call set_title
3474
call set_title
3425
;call copy_fpath_s
3475
;call copy_fpath_s
3426
closethis:
3476
closethis:
3427
mov [to_return],0
3477
mov [to_return],0
3428
cmp [error_found],1
3478
cmp [error_found],1
3429
je @f
3479
je @f
3430
call activate_main
3480
call activate_main
3431
@@:
3481
@@:
3432
mov [error_found],0
3482
mov [error_found],0
3433
close
3483
close
3434
 
3484
 
3435
 
3485
 
3436
activate_main:
3486
activate_main:
3437
   mov     eax,9
3487
   mov     eax,9
3438
   mov     ebx,procinfo
3488
   mov     ebx,procinfo
3439
   mov     ecx,[proccount]
3489
   mov     ecx,[proccount]
3440
 @@:
3490
 @@:
3441
   dec     ecx
3491
   dec     ecx
3442
   jz      @f    ; counter=0 => not found? => return
3492
   jz      @f    ; counter=0 => not found? => return
3443
   mov     eax,9
3493
   mov     eax,9
3444
   int     0x40
3494
   int     0x40
3445
   mov     edx,[procinfo.PID]
3495
   mov     edx,[procinfo.PID]
3446
   cmp     edx,[PID]
3496
   cmp     edx,[PID]
3447
   jne     @b
3497
   jne     @b
3448
 
3498
 
3449
   ;found: ecx = process_number
3499
   ;found: ecx = process_number
3450
   mov     eax,18
3500
   mov     eax,18
3451
   mov     ebx,3
3501
   mov     ebx,3
3452
   int     0x40
3502
   int     0x40
3453
 
3503
 
3454
   mov     eax,5
3504
   mov     eax,5
3455
   mov     ebx,eax
3505
   mov     ebx,eax
3456
   int     0x40
3506
   int     0x40
3457
 
3507
 
3458
 @@:
3508
 @@:
3459
ret
3509
ret
3460
 
3510
 
3461
 
3511
 
3462
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3512
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3463
doyouwannasave:
3513
doyouwannasave:
3464
;******************************************************************************
3514
;******************************************************************************
3465
cmp [modified],0
3515
cmp [modified],0
3466
je newfile
3516
je newfile
3467
      mov  eax,55           ; beep
3517
      mov  eax,55           ; beep
3468
      mov  ebx,eax
3518
      mov  ebx,eax
3469
      mov  esi,save_beep1
3519
      mov  esi,save_beep1
3470
      int  0x40
3520
      int  0x40
3471
      delay 4
3521
      delay 4
3472
      mov  eax,55           ; beep
3522
      mov  eax,55           ; beep
3473
      mov  ebx,eax
3523
      mov  ebx,eax
3474
      mov  esi,save_beep2
3524
      mov  esi,save_beep2
3475
      int  0x40
3525
      int  0x40
3476
 
3526
 
3477
 mov eax,13
3527
 mov eax,13
3478
 mov ebx,150*65536+200
3528
 mov ebx,150*65536+200
3479
 mov ecx,100*65536+70
3529
 mov ecx,100*65536+70
3480
 mov edx,[sc.work_graph] ;0x00dd9438 ;0x00ff7512
3530
 mov edx,[sc.work_graph] ;0x00dd9438 ;0x00ff7512
3481
 int 0x40
3531
 int 0x40
3482
 
3532
 
3483
mov eax,38
3533
mov eax,38
3484
mov ebx,150*65536+350
3534
mov ebx,150*65536+350
3485
mov ecx,100*65536+100
3535
mov ecx,100*65536+100
3486
mov edx,cl_White
3536
mov edx,cl_White
3487
int 0x40
3537
int 0x40
3488
mov eax,38
3538
mov eax,38
3489
mov ebx,150*65536+350
3539
mov ebx,150*65536+350
3490
mov ecx,170*65536+170
3540
mov ecx,170*65536+170
3491
mov edx,cl_White
3541
mov edx,cl_White
3492
int 0x40
3542
int 0x40
3493
mov eax,38
3543
mov eax,38
3494
mov ebx,150*65536+150
3544
mov ebx,150*65536+150
3495
mov ecx,100*65536+170
3545
mov ecx,100*65536+170
3496
mov edx,cl_White
3546
mov edx,cl_White
3497
int 0x40
3547
int 0x40
3498
mov eax,38
3548
mov eax,38
3499
mov ebx,350*65536+350
3549
mov ebx,350*65536+350
3500
mov ecx,100*65536+170
3550
mov ecx,100*65536+170
3501
mov edx,cl_White
3551
mov edx,cl_White
3502
int 0x40
3552
int 0x40
3503
 
3553
 
3504
 
3554
if lang eq ru
3505
 putlabel 190,120,'‘®åà ­¨âì ¤®ªã¬¥­â?',cl_White
3555
 putlabel 190,120,'‘®åà ­¨âì ¤®ªã¬¥­â?',cl_White
3506
 
3556
 
3507
 drawlbut 170,140,30,15,'„ ',46,[sc.work_button],cl_White
3557
 drawlbut 170,140,30,15,'„ ',46,[sc.work_button],cl_White
3508
 drawlbut 230,140,30,15,'¥â',45,[sc.work_button],cl_White
3558
 drawlbut 230,140,30,15,'¥â',45,[sc.work_button],cl_White
3509
 drawlbut 290,140,45,15,'Žâ¬¥­ ',47,[sc.work_button],cl_White
3559
 drawlbut 290,140,45,15,'Žâ¬¥­ ',47,[sc.work_button],cl_White
-
 
3560
else
-
 
3561
 putlabel 190,120,'Save document?',cl_White
-
 
3562
 
-
 
3563
 drawlbut 170,140,30,15,'Yes',46,[sc.work_button],cl_White
-
 
3564
 drawlbut 230,140,30,15,'No',45,[sc.work_button],cl_White
-
 
3565
 drawlbut 290,140,45,15,'Cancel',47,[sc.work_button],cl_White
-
 
3566
end if
3510
 
3567
 
3511
 mov [exit_wnd_on],1
3568
 mov [exit_wnd_on],1
3512
 jmp still
3569
 jmp still
3513
;-------------
3570
;-------------
3514
newfile:
3571
newfile:
3515
;if filename is not NEWDOC## than change it to it!
3572
;if filename is not NEWDOC## than change it to it!
3516
mov eax,dword [orig_filename]
3573
mov eax,dword [orig_filename]
3517
cmp dword [filename],eax ;[orig_filename]
3574
cmp dword [filename],eax ;[orig_filename]
3518
je @f
3575
je @f
3519
    cld
3576
    cld
3520
    mov esi,orig_filename
3577
    mov esi,orig_filename
3521
    mov edi,filename
3578
    mov edi,filename
3522
    mov ecx,71 ;50
3579
    mov ecx,71 ;50
3523
    rep movsb
3580
    rep movsb
3524
    mov    edi,filename
3581
    mov    edi,filename
3525
    mov    ecx,71 ;50
3582
    mov    ecx,71 ;50
3526
    xor    eax,eax
3583
    xor    eax,eax
3527
    repne  scasb
3584
    repne  scasb
3528
    sub    edi,filename
3585
    sub    edi,filename
3529
    dec    edi
3586
    dec    edi
3530
    mov    [filename_len],edi
3587
    mov    [filename_len],edi
3531
 
3588
 
3532
@@:
3589
@@:
3533
 
3590
 
3534
call change_fname
3591
call change_fname
3535
call set_title
3592
call set_title
3536
call draw_window_for_dialogs
3593
call draw_window_for_dialogs
3537
call empty_work_space
3594
call empty_work_space
3538
mov [lines],1
3595
mov [lines],1
3539
jmp do_load_file.restorecursor
3596
jmp do_load_file.restorecursor
3540
 
3597
 
3541
change_fname:
3598
change_fname:
3542
cmp [filename+7],'9'
3599
cmp [filename+7],'9'
3543
jne addfname
3600
jne addfname
3544
cmp [filename+6],'9'
3601
cmp [filename+6],'9'
3545
je error_creating_new_file
3602
je error_creating_new_file
3546
mov [filename+7],'0'
3603
mov [filename+7],'0'
3547
add [filename+6],0x1
3604
add [filename+6],0x1
3548
jmp leavenow
3605
jmp leavenow
3549
addfname:
3606
addfname:
3550
add [filename+7],0x1
3607
add [filename+7],0x1
3551
leavenow:
3608
leavenow:
3552
ret
3609
ret
3553
 
3610
 
3554
set_title:
3611
set_title:
3555
    cmp [error2_found],1
3612
    cmp [error2_found],1
3556
    je  no_set_title
3613
    je  no_set_title
3557
    mov  esi, filename
3614
    mov  esi, filename
3558
    mov  edi, header
3615
    mov  edi, header
3559
    mov  ecx, [filename_len]
3616
    mov  ecx, [filename_len]
3560
    mov  eax, ecx
3617
    mov  eax, ecx
3561
    add  eax, 10
3618
    add  eax, 10
3562
    mov  [headlen], eax
3619
    mov  [headlen], eax
3563
    cld
3620
    cld
3564
    rep  movsb
3621
    rep  movsb
3565
 
3622
 
3566
    mov  [edi], dword ' -  '
3623
    mov  [edi], dword ' -  '
3567
    add  edi, 3
3624
    add  edi, 3
3568
    mov  esi, htext
3625
    mov  esi, htext
3569
    mov  ecx, htext.size
3626
    mov  ecx, htext.size
3570
    rep  movsb
3627
    rep  movsb
3571
 
3628
 
3572
    call drawwindow
3629
    call drawwindow
3573
no_set_title:
3630
no_set_title:
3574
mov [error2_found],0
3631
mov [error2_found],0
3575
ret
3632
ret
3576
 
3633
 
3577
draw_window_for_dialogs:
3634
draw_window_for_dialogs:
3578
call clear_screen
3635
call clear_screen
3579
call drawwindow
3636
call drawwindow
3580
ret
3637
ret
3581
 
3638
 
3582
copy_fpath:
3639
copy_fpath:
3583
call mask_events
3640
call mask_events
3584
call path_copy
3641
call path_copy
3585
call set_title
3642
call set_title
3586
call draw_window_for_dialogs
3643
call draw_window_for_dialogs
3587
jmp do_load_file
3644
jmp do_load_file
3588
 
3645
 
3589
copy_fpath_s:
3646
copy_fpath_s:
3590
call mask_events
3647
call mask_events
3591
call path_copy
3648
call path_copy
3592
call save_file
3649
call save_file
3593
call set_title
3650
call set_title
3594
call draw_window_for_dialogs
3651
call draw_window_for_dialogs
3595
jmp still
3652
jmp still
3596
 
3653
 
3597
path_copy:
3654
path_copy:
3598
    cld
3655
    cld
3599
    mov esi,mypath
3656
    mov esi,mypath
3600
    mov edi,filename
3657
    mov edi,filename
3601
    mov ecx,250 ;71 ;50
3658
    mov ecx,250 ;71 ;50
3602
    rep movsb
3659
    rep movsb
3603
    mov    edi,filename
3660
    mov    edi,filename
3604
    mov    ecx,250 ;71 ;50
3661
    mov    ecx,250 ;71 ;50
3605
    xor    eax,eax
3662
    xor    eax,eax
3606
    repne  scasb
3663
    repne  scasb
3607
    sub    edi,filename
3664
    sub    edi,filename
3608
    dec    edi
3665
    dec    edi
3609
    mov    [filename_len],edi
3666
    mov    [filename_len],edi
3610
ret
3667
ret
3611
 
3668
 
3612
openerror:
3669
openerror:
3613
mov eax,360
3670
mov eax,360
3614
mov ebx,openerrtext
3671
mov ebx,openerrtext
3615
mov ecx,1
3672
mov ecx,1
3616
call alert_box
3673
call alert_box
3617
 
3674
 
3618
cmp [to_return2],1
3675
cmp [to_return2],1
3619
jne jmp_to_still
3676
jne jmp_to_still
3620
mov [to_return2],0
3677
mov [to_return2],0
3621
mov [error_found],1
3678
mov [error_found],1
3622
call mask_events
3679
call mask_events
3623
 
3680
 
3624
ret
3681
ret
3625
 
3682
 
3626
saveerror:
3683
saveerror:
3627
mov eax,390
3684
mov eax,390
3628
mov ebx,saveerrtext
3685
mov ebx,saveerrtext
3629
mov ecx,1
3686
mov ecx,1
3630
call alert_box
3687
call alert_box
3631
cmp [to_return2],0
3688
cmp [to_return2],0
3632
je jmp_to_still
3689
je jmp_to_still
3633
mov [to_return2],0
3690
mov [to_return2],0
3634
mov [error_found],1
3691
mov [error_found],1
3635
call mask_events
3692
call mask_events
3636
ret
3693
ret
3637
;jmp still
3694
;jmp still
3638
jmp_to_still:
3695
jmp_to_still:
3639
call mask_events
3696
call mask_events
3640
jmp still
3697
jmp still
3641
 
3698
 
3642
error_creating_new_file:
3699
error_creating_new_file:
3643
mov eax,200
3700
mov eax,200
3644
mov ebx,newfileerror
3701
mov ebx,newfileerror
3645
mov ecx,1
3702
mov ecx,1
3646
call alert_box
3703
call alert_box
3647
jmp still
3704
jmp still
3648
 
3705
 
3649
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3706
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3650
;;;;;;;;;;;;;;MENU;;;;;;;;;;;;;;;;;;;;;;
3707
;;;;;;;;;;;;;;MENU;;;;;;;;;;;;;;;;;;;;;;
3651
draw_win_menu:
3708
draw_win_menu:
3652
 
3709
 
3653
;mov eax,8
3710
;mov eax,8
3654
;mov ebx,145*65536+276
3711
;mov ebx,145*65536+276
3655
;mov ecx,22*65536+15
3712
;mov ecx,22*65536+15
3656
;mov edx,00100000000000000000000000001111b
3713
;mov edx,00100000000000000000000000001111b
3657
;mov esi,0x00aaaaaa
3714
;mov esi,0x00aaaaaa
3658
;int 0x40
3715
;int 0x40
3659
 
3716
 
3660
mov eax,13
3717
mov eax,13
3661
mov ebx,5*65536+497
3718
mov ebx,5*65536+497
3662
mov ecx,22*65536+17
3719
mov ecx,22*65536+17
3663
mov edx,[sc.work_graph] ;0x00999999
3720
mov edx,[sc.work_graph] ;0x00999999
3664
int 0x40
3721
int 0x40
3665
mov ecx,39*65536+5
3722
mov ecx,39*65536+5
3666
mov edx,0x00aaaaaa
3723
mov edx,0x00aaaaaa
3667
int 0x40
3724
int 0x40
-
 
3725
 
3668
 
3726
if lang eq ru
3669
drawlbut 5,22,70,15,'” ©«',97,[sc.work_button],[sc.work_button_text]
3727
drawlbut 5,22,70,15,'” ©«',97,[sc.work_button],[sc.work_button_text]
3670
drawlbut 75,22,70,15,'Š®¤',98,[sc.work_button],[sc.work_button_text]
3728
drawlbut 75,22,70,15,'Š®¤',98,[sc.work_button],[sc.work_button_text]
3671
drawlbut 145,22,70,15,'’¥ªáâ',96,[sc.work_button],[sc.work_button_text]
3729
drawlbut 145,22,70,15,'’¥ªáâ',96,[sc.work_button],[sc.work_button_text]
3672
drawlbut 431,22,70,15,'‘¯à ¢ª ',99,[sc.work_button],[sc.work_button_text]
3730
drawlbut 431,22,70,15,'‘¯à ¢ª ',99,[sc.work_button],[sc.work_button_text]
-
 
3731
else
-
 
3732
drawlbut 5,22,70,15,'File',97,[sc.work_button],[sc.work_button_text]
-
 
3733
drawlbut 75,22,70,15,'Code',98,[sc.work_button],[sc.work_button_text]
-
 
3734
drawlbut 145,22,70,15,'Text',96,[sc.work_button],[sc.work_button_text]
-
 
3735
drawlbut 431,22,70,15,'Help',99,[sc.work_button],[sc.work_button_text]
-
 
3736
end if
3673
 
3737
 
3674
ret
3738
ret
3675
 
3739
 
3676
draw_win_menu_file:
3740
draw_win_menu_file:
3677
call clear_screen
3741
call clear_screen
3678
call drawwindow
3742
call drawwindow
3679
;mov eax,13
3743
;mov eax,13
3680
;mov ebx,5*65536+71
3744
;mov ebx,5*65536+71
3681
;mov ecx,35*65536+90
3745
;mov ecx,35*65536+90
3682
;mov edx,[sc.grab_button];0x00999999
3746
;mov edx,[sc.grab_button];0x00999999
3683
;int 0x40
3747
;int 0x40
3684
;mov eax,38
3748
;mov eax,38
3685
;mov ebx,5*65536+35
3749
;mov ebx,5*65536+35
3686
;mov ecx,40*65536+47
3750
;mov ecx,40*65536+47
3687
;mov edx,0x00ff0000
3751
;mov edx,0x00ff0000
3688
;int 0x40
3752
;int 0x40
3689
mov [menu_is_on],1
3753
mov [menu_is_on],1
-
 
3754
 
3690
 
3755
if lang eq ru
3691
drawlbut 5,38,70,15,'®¢®¥ ®ª­®',100,[sc.grab_button],[sc.grab_button_text]
3756
drawlbut 5,38,70,15,'®¢®¥ ®ª­®',100,[sc.grab_button],[sc.grab_button_text]
3692
drawlbut 5,53,70,15,'®¢ë©',101,[sc.grab_button],[sc.grab_button_text]
3757
drawlbut 5,53,70,15,'®¢ë©',101,[sc.grab_button],[sc.grab_button_text]
3693
drawlbut 5,68,70,15,'‘®åà ­¨âì',2,[sc.grab_button],[sc.grab_button_text]
3758
drawlbut 5,68,70,15,'‘®åà ­¨âì',2,[sc.grab_button],[sc.grab_button_text]
3694
drawlbut 5,83,70,15,'‘®åà. ª ª',102,[sc.grab_button],[sc.grab_button_text]
3759
drawlbut 5,83,70,15,'‘®åà. ª ª',102,[sc.grab_button],[sc.grab_button_text]
3695
drawlbut 5,98,70,15,'Žâªàëâì',103,[sc.grab_button],[sc.grab_button_text]
3760
drawlbut 5,98,70,15,'Žâªàëâì',103,[sc.grab_button],[sc.grab_button_text]
3696
drawlbut 5,113,70,15,'‚ë室',104,[sc.grab_button],[sc.grab_button_text]
3761
drawlbut 5,113,70,15,'‚ë室',104,[sc.grab_button],[sc.grab_button_text]
-
 
3762
else
-
 
3763
drawlbut 5,38,70,15,'New window',100,[sc.grab_button],[sc.grab_button_text]
-
 
3764
drawlbut 5,53,70,15,'New',101,[sc.grab_button],[sc.grab_button_text]
-
 
3765
drawlbut 5,68,70,15,'Save',2,[sc.grab_button],[sc.grab_button_text]
-
 
3766
drawlbut 5,83,70,15,'Save as',102,[sc.grab_button],[sc.grab_button_text]
-
 
3767
drawlbut 5,98,70,15,'Open',103,[sc.grab_button],[sc.grab_button_text]
-
 
3768
drawlbut 5,113,70,15,'Exit',104,[sc.grab_button],[sc.grab_button_text]
-
 
3769
end if
3697
jmp still
3770
jmp still
3698
 
3771
 
3699
draw_win_menu_code:
3772
draw_win_menu_code:
3700
call clear_screen
3773
call clear_screen
3701
call drawwindow
3774
call drawwindow
-
 
3775
if lang eq ru
3702
drawlbut 75,38,70,15,'Š®¬¯¨«.',10000,[sc.grab_button],[sc.grab_button_text]
3776
drawlbut 75,38,70,15,'Š®¬¯¨«.',10000,[sc.grab_button],[sc.grab_button_text]
3703
drawlbut 75,53,70,15,'‡ ¯ãáâ¨âì',10001,[sc.grab_button],[sc.grab_button_text]
3777
drawlbut 75,53,70,15,'‡ ¯ãáâ¨âì',10001,[sc.grab_button],[sc.grab_button_text]
3704
drawlbut 75,68,70,15,'„®áª  ®â«.',10002,[sc.grab_button],[sc.grab_button_text]
3778
drawlbut 75,68,70,15,'„®áª  ®â«.',10002,[sc.grab_button],[sc.grab_button_text]
3705
drawlbut 75,83,70,15,'SysFunc',10003,[sc.grab_button],[sc.grab_button_text]
3779
drawlbut 75,83,70,15,'SysFunc',10003,[sc.grab_button],[sc.grab_button_text]
-
 
3780
else
-
 
3781
drawlbut 75,38,70,15,'Compile',10000,[sc.grab_button],[sc.grab_button_text]
-
 
3782
drawlbut 75,53,70,15,'Run',10001,[sc.grab_button],[sc.grab_button_text]
-
 
3783
drawlbut 75,68,70,15,'Debug board',10002,[sc.grab_button],[sc.grab_button_text]
-
 
3784
drawlbut 75,83,70,15,'SysFunc',10003,[sc.grab_button],[sc.grab_button_text]
-
 
3785
end if
3706
mov [menu_is_on],1
3786
mov [menu_is_on],1
3707
jmp still
3787
jmp still
3708
 
3788
 
3709
draw_win_menu_text:
3789
draw_win_menu_text:
3710
call clear_screen
3790
call clear_screen
3711
call drawwindow
3791
call drawwindow
-
 
3792
if lang eq ru
3712
drawlbut 145,38,70,15,'GoTo Line#',95,[sc.grab_button],[sc.grab_button_text]
3793
drawlbut 145,38,70,15,'GoTo Line#',95,[sc.grab_button],[sc.grab_button_text]
3713
drawlbut 145,53,70,15,' ©â¨',92,[sc.grab_button],[sc.grab_button_text]
3794
drawlbut 145,53,70,15,' ©â¨',92,[sc.grab_button],[sc.grab_button_text]
3714
drawlbut 145,68,70,15,' ©â¨ ¤ «¥¥',50,[sc.grab_button],[sc.grab_button_text]
3795
drawlbut 145,68,70,15,' ©â¨ ¤ «¥¥',50,[sc.grab_button],[sc.grab_button_text]
-
 
3796
else
-
 
3797
drawlbut 145,38,70,15,'GoTo Line#',95,[sc.grab_button],[sc.grab_button_text]
-
 
3798
drawlbut 145,53,70,15,'Find',92,[sc.grab_button],[sc.grab_button_text]
-
 
3799
drawlbut 145,68,70,15,'Find next',50,[sc.grab_button],[sc.grab_button_text]
-
 
3800
end if
3715
mov [menu_is_on],1
3801
mov [menu_is_on],1
3716
jmp still
3802
jmp still
3717
 
3803
 
3718
new_pad_wnd:
3804
new_pad_wnd:
3719
mov eax,19
3805
mov eax,19
3720
mov ebx,tinypad_filename
3806
mov ebx,tinypad_filename
3721
mov ecx,0
3807
mov ecx,0
3722
int 0x40
3808
int 0x40
3723
jmp still
3809
jmp still
3724
 
3810
 
3725
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3811
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3726
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3812
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
3813
if lang eq ru
3727
openerrtext db 'Žè¨¡ª  ®âªàëâ¨ï ä ©«  ¨«¨ ®âªàë⨥ ®â¬¥­¥­®!',0
3814
openerrtext db 'Žè¨¡ª  ®âªàëâ¨ï ä ©«  ¨«¨ ®âªàë⨥ ®â¬¥­¥­®!',0
3728
saveerrtext db 'Žè¨¡ª  á®åà ­¥­¨ï ä ©«  ¨«¨ á®åà ­¥­¨¥ ®â¬¥­¥­®!',0
3815
saveerrtext db 'Žè¨¡ª  á®åà ­¥­¨ï ä ©«  ¨«¨ á®åà ­¥­¨¥ ®â¬¥­¥­®!',0
3729
newfileerror db '¥¢®§¬®¦­® á®å¤ âì ­®¢ë© ä ©«',0
3816
newfileerror db '¥¢®§¬®¦­® ᮧ¤ âì ­®¢ë© ä ©«',0
-
 
3817
else
-
 
3818
openerrtext db 'Error while opening file or opening canceled!',0
-
 
3819
saveerrtext db 'Error while saving file or saving canceled!',0
-
 
3820
newfileerror db 'Cannot create new file',0
-
 
3821
end if
3730
; ********************
3822
; ********************
3731
; ******  DATA  ******
3823
; ******  DATA  ******
3732
; ********************
3824
; ********************
3733
sz fasm_filename,    'FASM        '
3825
sz fasm_filename,    'FASM        '
3734
sz debug_filename,   'BOARD       '
3826
sz debug_filename,   'BOARD       '
3735
sz tinypad_filename, 'TINYPAD     '
3827
sz tinypad_filename, 'TINYPAD     '
3736
 
3828
 
3737
lsz sysfuncs_filename,\
3829
lsz sysfuncs_filename,\
3738
  ru, <'SYSFUNCR.TXT',0>,\
3830
  ru, <'SYSFUNCR.TXT',0>,\
3739
  en, <'SYSFUNCS.TXT',0>
3831
  en, <'SYSFUNCS.TXT',0>
3740
 
3832
 
3741
sz setup, 'SETUP      '   ; we need to run SETUP to change keyboard layout
3833
sz setup, 'SETUP      '   ; we need to run SETUP to change keyboard layout
3742
param_setup db 'LANG',0   ; parameter for SETUP
3834
param_setup db 'LANG',0   ; parameter for SETUP
3743
 
3835
 
3744
 
3836
 
3745
addr            dd   filename  ; address of input string
3837
addr            dd   filename  ; address of input string
3746
 
3838
 
3747
filename_len    dd   12
3839
filename_len    dd   12
3748
filename        db   'NEWDOC00.TXT'
3840
filename        db   'NEWDOC00.TXT'
3749
times 256 db 0;51-12    db   0
3841
times 256 db 0;51-12    db   0
3750
;times  db 0   ; ï ­¥ §­ î ¯®ç¥¬ã ‚¨«« ­¥ ¯®áâ ¢¨« íâã áâà®çªã
3842
;times  db 0   ; ï ­¥ §­ î ¯®ç¥¬ã ‚¨«« ­¥ ¯®áâ ¢¨« íâã áâà®çªã
3751
orig_filename   db   'NEWDOC00.TXT'
3843
orig_filename   db   'NEWDOC00.TXT'
3752
rb 256
3844
rb 256
3753
search_len      dd   5
3845
search_len      dd   5
3754
search_string   db   'still'
3846
search_string   db   'still'
3755
times 51-5      db   0
3847
times 51-5      db   0
3756
 
3848
 
3757
case_sens       db   0    ; for search function
3849
case_sens       db   0    ; for search function
3758
 
3850
 
3759
align 4
3851
align 4
3760
comment_string:
3852
comment_string:
3761
db ';***************************************'
3853
db ';***************************************'
3762
db '*************************************** '
3854
db '*************************************** '
3763
 
3855
 
3764
 
3856
 
3765
 
3857
 
3766
; INTERFACE DATA:
3858
; INTERFACE DATA:
3767
 
3859
 
3768
 
3860
 
3769
sz htext, 'TINYPAD'
3861
sz htext, 'TINYPAD'
3770
;sz toolbar_btn_text,  'COMPILE    RUN     BOARD   SYSFUNC'
3862
;sz toolbar_btn_text,  'COMPILE    RUN     BOARD   SYSFUNC'
3771
 
3863
 
3772
 
3864
 
3773
searcht:
3865
searcht:
3774
if lang eq ru
3866
if lang eq ru
3775
    db  ' ‘’ŽŠ€ >                              '
3867
    db  ' ‘’ŽŠ€ >                              '
3776
    db  '                               Žˆ‘Š   '
3868
    db  '                               Žˆ‘Š   '
3777
else
3869
else
3778
    db  ' STRING >                              '
3870
    db  ' STRING >                              '
3779
    db  '                             SEARCH    '
3871
    db  '                             SEARCH    '
3780
end if
3872
end if
3781
searchtl:
3873
searchtl:
3782
 
3874
 
3783
 
3875
 
3784
htext2:
3876
htext2:
3785
if lang eq ru
3877
if lang eq ru
3786
    db  ' Ž‡ˆ–ˆŸ 00:00000    „‹ˆ€ 00000 ‘’ŽŠ '
3878
    db  ' Ž‡ˆ–ˆŸ 00:00000    „‹ˆ€ 00000 ‘’ŽŠ '
3787
else
3879
else
3788
    db  'POSITION 00:00000   LENGTH 00000 LINES '
3880
    db  'POSITION 00:00000   LENGTH 00000 LINES '
3789
end if
3881
end if
3790
htextlen2:
3882
htextlen2:
3791
 
3883
 
3792
help_text:
3884
help_text:
3793
if lang eq ru
3885
if lang eq ru
3794
    db  '                 ŠŽŒ€„›:                          '
3886
    db  '                 ŠŽŒ€„›:                          '
3795
    db  '                                                   '
3887
    db  '                                                   '
3796
    db  '  CTRL+F1  : â® ®ª­®                              '
3888
    db  '  CTRL+F1  : â® ®ª­®                              '
3797
    db  '  CTRL+S   : ¥à¢ ï áâப  ¤«ï ª®¯¨à®¢ ­¨ï         '
3889
    db  '  CTRL+S   : ¥à¢ ï áâப  ¤«ï ª®¯¨à®¢ ­¨ï         '
3798
    db  '  CTRL+E   : ®á«¥¤­ïï áâப  ¤«ï ª®¯¨à®¢ ­¨ï      '
3890
    db  '  CTRL+E   : ®á«¥¤­ïï áâப  ¤«ï ª®¯¨à®¢ ­¨ï      '
3799
    db  '  CTRL+P   : ‚áâ ¢¨âì ¢ë¡à ­­®¥ ­  ⥪ãéãî ¯®§¨æ¨î '
3891
    db  '  CTRL+P   : ‚áâ ¢¨âì ¢ë¡à ­­®¥ ­  ⥪ãéãî ¯®§¨æ¨î '
3800
    db  '  CTRL+D   : “¤ «¨âì áâà®ªã                        '
3892
    db  '  CTRL+D   : “¤ «¨âì áâà®ªã                        '
3801
    db  '  CTRL+L   : ‚áâ ¢¨âì áâபã-à §¤¥«¨â¥«ì           '
3893
    db  '  CTRL+L   : ‚áâ ¢¨âì áâபã-à §¤¥«¨â¥«ì           '
3802
    db  '  CTRL+[   : ¥à¥©â¨ ¢ ­ ç «® ä ©«                 '
3894
    db  '  CTRL+[   : ¥à¥©â¨ ¢ ­ ç «® ä ©«                 '
3803
    db  '  CTRL+]   : ¥à¥©â¨ ¢ ª®­¥æ ä ©«                  '
3895
    db  '  CTRL+]   : ¥à¥©â¨ ¢ ª®­¥æ ä ©«                  '
3804
    db  '  CTRL+F2  : ‡ £à㧨âì ä ©«                        '
3896
    db  '  CTRL+F2  : ‡ £à㧨âì ä ©«                        '
3805
    db  '  CTRL+F3  : ®¨áª                                 '
3897
    db  '  CTRL+F3  : ®¨áª                                 '
3806
    db  '  CTRL+F4  : ‘®åà ­¨âì ä ©«                        '
3898
    db  '  CTRL+F4  : ‘®åà ­¨âì ä ©«                        '
3807
    db  '  CTRL+F5  : ‘®åà ­¨âì ä ©« ª ª...                 '
3899
    db  '  CTRL+F5  : ‘®åà ­¨âì ä ©« ª ª...                 '
3808
    db  '  CTRL+F6  : ‚¢¥á⨠áâப㠤«ï ¯®¨áª               '
3900
    db  '  CTRL+F6  : ‚¢¥á⨠áâப㠤«ï ¯®¨áª               '
3809
    db  '  CTRL+F7  : "Žª­® ¡ëáâண® á®åà ­¥­¨ï ¨ § £à㧪¨" '
3901
    db  '  CTRL+F7  : "Žª­® ¡ëáâண® á®åà ­¥­¨ï ¨ § £à㧪¨" '
3810
    db  '  CTRL+F8  : ‘¬¥­¨âì à áª« ¤ªã ª« ¢¨ âãàë          '
3902
    db  '  CTRL+F8  : ‘¬¥­¨âì à áª« ¤ªã ª« ¢¨ âãàë          '
3811
    db  '  CTRL+F9  : Š®¬¯¨«¨à®¢ âì ä ©«                    '
3903
    db  '  CTRL+F9  : Š®¬¯¨«¨à®¢ âì ä ©«                    '
3812
    db  '  CTRL+F10 : Š®¬¯¨«¨à®¢ âì ¨ § ¯ãáâ¨âì             '
3904
    db  '  CTRL+F10 : Š®¬¯¨«¨à®¢ âì ¨ § ¯ãáâ¨âì             '
3813
    db  '  F12      : ‡ ¯ãáâ¨âì ¤®áªã ®â« ¤ª¨               '
3905
    db  '  F12      : ‡ ¯ãáâ¨âì ¤®áªã ®â« ¤ª¨               '
3814
    db  'x'
3906
    db  'x'
3815
else
3907
else
3816
    db  '                COMMANDS:                          '
3908
    db  '                COMMANDS:                          '
3817
    db  '                                                   '
3909
    db  '                                                   '
3818
    db  '  CTRL+F1  : SHOW THIS WINDOW                      '
3910
    db  '  CTRL+F1  : SHOW THIS WINDOW                      '
3819
    db  '  CTRL+S   : SELECT FIRST STRING TO COPY           '
3911
    db  '  CTRL+S   : SELECT FIRST STRING TO COPY           '
3820
    db  '  CTRL+E   : SELECT LAST STRING TO COPY            '
3912
    db  '  CTRL+E   : SELECT LAST STRING TO COPY            '
3821
    db  '  CTRL+P   : PASTE SELECTED TO CURRENT POSITION    '
3913
    db  '  CTRL+P   : PASTE SELECTED TO CURRENT POSITION    '
3822
    db  '  CTRL+D   : DELETE CURRENT LINE                   '
3914
    db  '  CTRL+D   : DELETE CURRENT LINE                   '
3823
    db  '  CTRL+L   : INSERT SEPARATOR LINE                 '
3915
    db  '  CTRL+L   : INSERT SEPARATOR LINE                 '
3824
    db  '  CTRL+[   : GO TO THE BEGINNING OF FILE           '
3916
    db  '  CTRL+[   : GO TO THE BEGINNING OF FILE           '
3825
    db  '  CTRL+]   : GO TO THE END OF FILE                 '
3917
    db  '  CTRL+]   : GO TO THE END OF FILE                 '
3826
    db  '  CTRL+F2  : LOAD FILE                             '
3918
    db  '  CTRL+F2  : LOAD FILE                             '
3827
    db  '  CTRL+F3  : SEARCH                                '
3919
    db  '  CTRL+F3  : SEARCH                                '
3828
    db  '  CTRL+F4  : SAVE FILE                             '
3920
    db  '  CTRL+F4  : SAVE FILE                             '
3829
    db  '  CTRL+F5  : SAVE FILE AS...                       '
3921
    db  '  CTRL+F5  : SAVE FILE AS...                       '
3830
    db  '  CTRL+F6  : ENTER SEARCH STRING                   '
3922
    db  '  CTRL+F6  : ENTER SEARCH STRING                   '
3831
    db  '  CTRL+F7  : DRAW "FAST SAVE AND OPEN" WINDOW      '
3923
    db  '  CTRL+F7  : DRAW "FAST SAVE AND OPEN" WINDOW      '
3832
    db  '  CTRL+F8  : CHANGE KEYBOARD LAYOUT                '
3924
    db  '  CTRL+F8  : CHANGE KEYBOARD LAYOUT                '
3833
    db  '  CTRL+F9  : COMPILE FILE                          '
3925
    db  '  CTRL+F9  : COMPILE FILE                          '
3834
    db  '  CTRL+F10 : RUN OUTFILE                           '
3926
    db  '  CTRL+F10 : RUN OUTFILE                           '
3835
    db  '  F12      : OPEN DEBUG BOARD                      '
3927
    db  '  F12      : OPEN DEBUG BOARD                      '
3836
    db  'x'
3928
    db  'x'
3837
end if
3929
end if
3838
 
3930
 
3839
help_wnd_header:
3931
help_wnd_header:
3840
if lang eq ru
3932
if lang eq ru
3841
    db  'ŽŒŽ™œ',0
3933
    db  'ŽŒŽ™œ',0
3842
else
3934
else
3843
    db  'TINYPAD HELP',0
3935
    db  'TINYPAD HELP',0
3844
end if
3936
end if
3845
 
3937
 
3846
hlphead_len = $ - help_wnd_header
3938
hlphead_len = $ - help_wnd_header
3847
 
3939
 
3848
save_yes_no:
3940
save_yes_no:
3849
if lang eq ru
3941
if lang eq ru
3850
    db '‘®åà ­¨âì ä ©« ¯¥à¥¤ ¢ë室®¬?',0
3942
    db '‘®åà ­¨âì ä ©« ¯¥à¥¤ ¢ë室®¬?',0
3851
else
3943
else
3852
    db 'Save file before exit?',0
3944
    db 'Save file before exit?',0
3853
end if
3945
end if
3854
 
3946
 
3855
VScroll_1:
3947
VScroll_1:
3856
   dw  13    ;width         +0
3948
   dw  13    ;width         +0
3857
   dw  489   ;x             +2
3949
   dw  489   ;x             +2
3858
   dw  341 ;326   ;height        +4
3950
   dw  341 ;326   ;height        +4
3859
   dw  43    ;y             +6
3951
   dw  43    ;y             +6
3860
   dd  0     ;min           +8
3952
   dd  0     ;min           +8
3861
   dd  100 ;scrl_max ;lines   ;max           +12
3953
   dd  100 ;scrl_max ;lines   ;max           +12
3862
   dd  0 ;cur_pos          ;current       +16
3954
   dd  0 ;cur_pos          ;current       +16
3863
   dd  1     ;small change  +20
3955
   dd  1     ;small change  +20
3864
   dd  10    ;big change    +24
3956
   dd  10    ;big change    +24
3865
 
3957
 
3866
App_Controls:
3958
App_Controls:
3867
     dd VScroll_1 , drawvscroll, VScroll_mouse_over   ;
3959
     dd VScroll_1 , drawvscroll, VScroll_mouse_over   ;
3868
     dd 0,0,0                                       ;last control do not delete
3960
     dd 0,0,0                                       ;last control do not delete
3869
 
3961
 
3870
; END OF INTERFACE DATA
3962
; END OF INTERFACE DATA
3871
 
3963
 
3872
symbols db '%#&*\:/<>|{}()[]=+-,. '
3964
symbols db '%#&*\:/<>|{}()[]=+-,. '
3873
 
3965
 
3874
error_beep:
3966
error_beep:
3875
    db  0xA0,0x30,0
3967
    db  0xA0,0x30,0
3876
save_beep1:
3968
save_beep1:
3877
    db  0x84,0x43,0
3969
    db  0x84,0x43,0
3878
save_beep2:
3970
save_beep2:
3879
    db  0x84,0x48,0
3971
    db  0x84,0x48,0
3880
 
3972
 
3881
 
3973
 
3882
align 4
3974
align 4
3883
fileinfo_read:
3975
fileinfo_read:
3884
    dd  0
3976
    dd  0
3885
    dd  0
3977
    dd  0
3886
    dd  300000/512
3978
    dd  300000/512
3887
    dd  0x10000
3979
    dd  0x10000
3888
    dd  0x70000
3980
    dd  0x70000
3889
pathfile_read:
3981
pathfile_read:
3890
    times 250 db 0 ;51 db 0
3982
    times 250 db 0 ;51 db 0
3891
 
3983
 
3892
align 4
3984
align 4
3893
fileinfo_write:
3985
fileinfo_write:
3894
    dd  1
3986
    dd  1
3895
    dd  0
3987
    dd  0
3896
    dd  0
3988
    dd  0
3897
    dd  0x10000
3989
    dd  0x10000
3898
    dd  0x70000
3990
    dd  0x70000
3899
pathfile_write:
3991
pathfile_write:
3900
    times 250 db 0 ; 51 db 0
3992
    times 250 db 0 ; 51 db 0
3901
 
3993
 
3902
align 4
3994
align 4
3903
 
3995
 
3904
temp     dd 0xabc ; used in read_string
3996
temp     dd 0xabc ; used in read_string
3905
d_status dd 0
3997
d_status dd 0
3906
 
3998
 
3907
color_tbl:
3999
color_tbl:
3908
   dd 0x00000000 ; text
4000
   dd 0x00000000 ; text
3909
   dd 0x00000000 ; instruction
4001
   dd 0x00000000 ; instruction
3910
   dd 0x00000000 ; register
4002
   dd 0x00000000 ; register
3911
   dd 0x00009000 ; number
4003
   dd 0x00009000 ; number
3912
   dd 0x00a00000 ; quote
4004
   dd 0x00a00000 ; quote
3913
   dd 0x00909090 ; comment
4005
   dd 0x00909090 ; comment
3914
   dd 0x003030f0 ; symbol
4006
   dd 0x003030f0 ; symbol
3915
 
4007
 
3916
 
4008
 
3917
next_not_quote2 db 0  ; "
4009
next_not_quote2 db 0  ; "
3918
next_not_quote  db 0  ; '
4010
next_not_quote  db 0  ; '
3919
quote           db 0
4011
quote           db 0
3920
asm_mode        db 0  ; ASM highlight?
4012
asm_mode        db 0  ; ASM highlight?
3921
tmpabc          db 0
4013
tmpabc          db 0
3922
 
4014
 
3923
 
4015
 
3924
I_PARAM  db 0    ; parameters are HERE - ¯ à ¬¥âàë ¡ã¤ãâ ­ ç¨­ âìáï ‡„…‘œ!
4016
I_PARAM  db 0    ; parameters are HERE - ¯ à ¬¥âàë ¡ã¤ãâ ­ ç¨­ âìáï ‡„…‘œ!
3925
TINYPAD_END:     ; end of file
4017
TINYPAD_END:     ; end of file
3926
 
4018
 
3927
 
4019
 
3928
; Uninitialised data
4020
; Uninitialised data
3929
; ¥¨­¨æ¨ «¨§¨à®¢ ­­ë¥ ¤ ­­ë¥
4021
; ¥¨­¨æ¨ «¨§¨à®¢ ­­ë¥ ¤ ­­ë¥
3930
align 4
4022
align 4
3931
 
4023
 
3932
posx   dd ?      ; x ­  íªà ­¥ (on the screen)
4024
posx   dd ?      ; x ­  íªà ­¥ (on the screen)
3933
posy   dd ?      ; y ­  íªà ­¥
4025
posy   dd ?      ; y ­  íªà ­¥
3934
post   dd ?      ; ᬥ饭¨¥ ®â ­ ç «  - offset
4026
post   dd ?      ; ᬥ饭¨¥ ®â ­ ç «  - offset
3935
posl   dd ?
4027
posl   dd ?
3936
lines  dd ?      ; ª®«¨ç¥á⢮ áâப ¢ ¤®ªã¬¥­â¥
4028
lines  dd ?      ; ª®«¨ç¥á⢮ áâப ¢ ¤®ªã¬¥­â¥
3937
posxm  dd ?
4029
posxm  dd ?
3938
posym  dd ?
4030
posym  dd ?
3939
 
4031
 
3940
dstart dd ?      ; ᬥ饭¨¥ ¯® ®á¨ y ¤«ï ®âà¨á®¢ª¨ ª­®¯®ª ¨ ¤à.
4032
dstart dd ?      ; ᬥ饭¨¥ ¯® ®á¨ y ¤«ï ®âà¨á®¢ª¨ ª­®¯®ª ¨ ¤à.
3941
 
4033
 
3942
filelen     dd ? ; ¤«¨­  ä ©« 
4034
filelen     dd ? ; ¤«¨­  ä ©« 
3943
 
4035
 
3944
PID         dd ? ; ¨¤¥­â¨ä¨ª â®à ¯à®æ¥áá 
4036
PID         dd ? ; ¨¤¥­â¨ä¨ª â®à ¯à®æ¥áá 
3945
proccount   dd ? ; ª®«¨ç¥á⢮ ¯à®æ¥áᮢ
4037
proccount   dd ? ; ª®«¨ç¥á⢮ ¯à®æ¥áᮢ
3946
 
4038
 
3947
filesize dd ?    ; à §¬¥à ä ©« 
4039
filesize dd ?    ; à §¬¥à ä ©« 
3948
ya       dd ?    ; ¤«ï read_string
4040
ya       dd ?    ; ¤«ï read_string
3949
slines   dd ?    ; number of strings on the screen - ª®«¨ç¥á⢮ áâப ­  íªà ­¥
4041
slines   dd ?    ; number of strings on the screen - ª®«¨ç¥á⢮ áâப ­  íªà ­¥
3950
 
4042
 
3951
run_outfile dd ? ; for FASM
4043
run_outfile dd ? ; for FASM
3952
copy_start  dd ? ; Ctrl+S
4044
copy_start  dd ? ; Ctrl+S
3953
copy_count  dd ? ; Ctrl+E
4045
copy_count  dd ? ; Ctrl+E
3954
headlen     dd ? ; header length
4046
headlen     dd ? ; header length
3955
do_not_draw dd ? ; to draw or not to draw - this is a serious question ;)
4047
do_not_draw dd ? ; to draw or not to draw - this is a serious question ;)
3956
 
4048
 
3957
MainWndClosed dd ?
4049
MainWndClosed dd ?
3958
sc  system_colors
4050
sc  system_colors
3959
 
4051
 
3960
to_return db 0
4052
to_return db 0
3961
to_return2 db 0
4053
to_return2 db 0
3962
error_found db 0
4054
error_found db 0
3963
error2_found db 0
4055
error2_found db 0
3964
 
4056
 
3965
header:          ; window header - § £®«®¢®ª ®ª­ 
4057
header:          ; window header - § £®«®¢®ª ®ª­ 
3966
rb 256
4058
rb 256
3967
 
4059
 
3968
; ¨­ä®à¬ æ¨ï ® ¯à®æ¥áᥠ§ ¯¨á뢠¥âáï ¢ íâã áâàãªâãàã
4060
; ¨­ä®à¬ æ¨ï ® ¯à®æ¥áᥠ§ ¯¨á뢠¥âáï ¢ íâã áâàãªâãàã
3969
procinfo process_information
4061
procinfo process_information
3970
 
4062
 
3971
virtual at procinfo
4063
virtual at procinfo
3972
fasm_parameters rb 256
4064
fasm_parameters rb 256
3973
end virtual
4065
end virtual
3974
pos00 dd 0
4066
pos00 dd 0
3975
newdoc db ?
4067
newdoc db ?
3976
mypath:
4068
mypath:
3977
times 258 db 0
4069
times 258 db 0
3978
real_posy dd 0
4070
real_posy dd 0
3979
vscroll_size dd 0
4071
vscroll_size dd 0
3980
vscroll_pos dd 0
4072
vscroll_pos dd 0
3981
cur_pos dd 0
4073
cur_pos dd 0
3982
scrl_max dd 100
4074
scrl_max dd 100
3983
 
4075
 
3984
mouse_x dd 0
4076
mouse_x dd 0
3985
mouse_y dd 0
4077
mouse_y dd 0
3986
mousey dw 0
4078
mousey dw 0
3987
mousex dw 0
4079
mousex dw 0
3988
mouseb dd 0
4080
mouseb dd 0
3989
 
4081
 
3990
num_goto_string dd 0
4082
num_goto_string dd 0
3991
 
4083
 
3992
menu_is_on db 0
4084
menu_is_on db 0
3993
exit_wnd_on db 0
4085
exit_wnd_on db 0
3994
modified db 0
4086
modified db 0
3995
;fast save n open stack
4087
;fast save n open stack
3996
rb 1024
4088
rb 1024
3997
so_stack:
4089
so_stack:
3998
;growing down
4090
;growing down
3999
; the end!
4091
; the end!
4000
 
4092
 
4001
>
4093
>
4002
 
4094
 
4003
>
4095
>
4004
cmp>
4096
cmp>
4005
cmp>
4097
cmp>