Subversion Repositories Kolibri OS

Rev

Rev 502 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 502 Rev 532
Line 3... Line 3...
3
;   Compile with FASM for Menuet
3
;   Compile with FASM for Menuet
4
;
4
;
5
   use32
5
   use32
6
   org    0x0
6
   org    0x0
Line -... Line 7...
-
 
7
 
-
 
8
used_memory = 0x10000
7
 
9
 
8
   db     'MENUET01'     ; 8 byte id
10
   db     'MENUET01'     ; 8 byte id
9
   dd     0x01           ; header version
11
   dd     0x01           ; header version
10
   dd     START          ; start of code
12
   dd     START          ; start of code
11
   dd     I_END          ; size of image
13
   dd     I_END          ; size of image
12
   dd     0x40000        ; memory for app (256 Kb)
14
   dd     used_memory    ; memory for app
13
   dd     0x40000        ; esp
15
   dd     used_memory    ; esp
Line 14... Line 16...
14
   dd     0x0 , 0x0      ; I_Param , I_Icon
16
   dd     0x0 , 0x0      ; I_Param , I_Icon
15
 
17
 
-
 
18
include   'lang.inc'
Line 16... Line 19...
16
include   'lang.inc'
19
include   '..\..\..\macros.inc'
Line 17... Line 20...
17
include   '..\..\..\macros.inc'
20
purge mov       ; decrease kpack'ed size
18
 
-
 
19
;include   'debug.inc'
-
 
20
 
-
 
21
START:
-
 
22
     mov  eax,14
-
 
23
     mcall
21
 
24
     and  eax,0xFFFF0000
22
;include   'debug.inc'
25
     mov  [top_right_corner],eax
23
 
Line -... Line 24...
-
 
24
START:
-
 
25
     mov  eax,40        ; ãáâ ­®¢¨âì ¬ áªã ᮡë⨩
26
 
26
     mov  ebx,110010b   ; ॠ£¨à㥬 ­  ª« ¢¨ âãàã, ¬ëèì, ®âà¨á®¢ªã ä®­ 
27
     mov  eax,40        ; ãáâ ­®¢¨âì ¬ áªã ᮡë⨩
27
     mcall
28
     mov  ebx,110010b   ; ॠ£¨à㥬 ­  ª« ¢¨ âãàã, ¬ëèì, ®âà¨á®¢ªã ä®­ 
28
 
29
     mcall
29
bgr_changed:
30
 
30
 
-
 
31
        mov     eax,14
-
 
32
        mcall
Line 31... Line -...
31
     mov  eax,14        ; ¯®«ã稬 à §¬¥àë íªà ­ 
-
 
-
 
33
        mov     [y_max], ax
32
     mcall
34
        shr     eax, 16
33
     mov  [y_max],ax
35
        mov     [x_max], ax
34
     shr  eax,16
36
        shl     eax, 16
35
     mov  [x_max],ax
37
        mov     [top_right_corner], eax
-
 
38
 
-
 
39
still:
36
 
40
        movzx   ebx, [time]
37
  event:              ; ®¡à ¡®â稪 ᮡë⨩ (¢á¥å)
41
        imul    ebx, 60*100
38
    mov  eax,26
42
        mcall   23              ; ¦¤ñ¬ ᮡëâ¨ï ¢ â¥ç¥­¨¥ [time] ¬¨­ãâ
39
    mov  ebx,9
43
        test    eax, eax
-
 
44
        jz      create_ss_thread
40
    mcall         ; ¯®«ãç¨âì ¢à¥¬ï á¨á⥬ë
45
        cmp     al, 2           ; key in buffer?
41
;    mov  eax,3
46
        jz      key
42
;    mcall
47
        cmp     al, 5           ; background redraw?
43
    mov  [evtime],eax ; § ¯®¬­¨âì ¥£®
48
        jz      bgr_changed
44
    mov  eax,37
-
 
45
    mov  ebx,2
-
 
46
    mcall
49
; mouse event
47
    cmp  eax,3        ; ¯à®¤®«¦¨¬, ¥á«¨ ­ ¦ â  á।­ïï ª­®¯ª  ¬ëè¨
-
 
48
    jne  still
-
 
49
    mov  eax,37       ; ¯à®¢¥à¨¬ ª®®à¤¨­ âë
-
 
50
    mov  ebx,0
-
 
51
    mcall
-
 
52
    cmp  [top_right_corner],eax
-
 
53
    je   create_setup ; ᮧ¤ ñ¬ ®ª­® ­ áâனª¨, ¥á«¨ ¬ëèì ¢ ¢¥àå­¥¬ ¯à ¢®¬
-
 
54
                      ; 㣫ã íªà ­ 
-
 
55
 
-
 
56
 
-
 
57
 
-
 
58
still:                  ; ®á­®¢­®© 横« ¯à®£à ¬¬ë
-
 
59
 
-
 
60
    mov  eax,23         ; ¦¤ñ¬ ᮡëâ¨ï ¢ â¥ç¥­¨¥ 1 ᥪ㭤ë
-
 
61
    mov  ebx,100
-
 
62
    mcall
-
 
63
 
-
 
64
    bt   dword [params],0  ; ssaver works?
50
        mcall   37,2            ; ¯à®¢¥à¨¬ ª­®¯ª¨
65
    jc   event
-
 
66
    bt   dword [params],1  ; setup works?
-
 
67
    jc   event
-
 
68
 
51
        and     al, 3
69
    cmp  eax,2          ; key in buffer ?
-
 
70
    je   event
-
 
71
    cmp  eax,5
-
 
72
    je   event
-
 
73
    cmp  eax,6
52
        cmp     al, 3           ; ­ ¦ âë ®¡¥ ª­®¯ª¨ ¬ëè¨?
74
    je   event
-
 
75
 
53
        jnz     still
76
    mov  eax,26
54
        mcall   37,0            ; ¯à®¢¥à¨¬ ª®®à¤¨­ âë
77
    mov  ebx,9
55
        cmp     [top_right_corner], eax
78
    mcall
56
        jnz     still
79
    sub  eax,[evtime]
-
 
80
    xor  edx,edx
-
 
81
    mov  ebx,60*100     ; ¯®¤¥«¨¬ ­  60*100, ¯®«ã稬 ¢à¥¬ï ¢ ¬¨­ãâ å
57
create_setup:
82
    div  ebx
58
        test    [params], 2
83
    cmp  al,[time]
59
        jnz     still           ; ®ª­® ­ áâ஥ª 㦥 ᮧ¤ ­®
Line 84... Line -...
84
    jb   still
-
 
85
 
-
 
86
; current_time-evtime/100/60 = ¢à¥¬ï ¢ ¬¨­ãâ å á ¯à®è«®£® ᮡëâ¨ï
60
        mcall   51,1,sthread,used_memory-0x1000
87
 
61
        or      [params], 2
88
    call create_ss
62
        jmp     still
89
    jmp  still
-
 
90
 
-
 
91
 
-
 
92
 
-
 
93
  create_setup:
-
 
94
    bt dword [params],1
63
key:
95
    jc   still
64
        mcall                   ; eax = 2
Line 96... Line 65...
96
    mov  eax,51
65
        jmp     still
97
    mov  ebx,1
-
 
98
    mov  ecx,sthread
-
 
99
    mov  edx,0x3F000
66
 
100
    mcall
-
 
101
    bts dword [params],1
-
 
102
    jmp  still
67
create_ss_thread:
103
 
68
        test    [params], 3
Line 104... Line 69...
104
  create_ss:
69
        jnz     still
105
    mov  eax,51
70
        call    create_ss
106
    mov  ebx,1
71
        jmp     still
107
    mov  ecx,thread
72
 
108
    mov  edx,0x3E000
73
create_ss:
109
    mcall
74
        mcall   51,1,thread,used_memory-0x2000
110
    bts dword [params],0
75
        or      [params], 1
111
    ret
76
        ret
112
 
77
 
Line 131... Line 96...
131
    mov  [addy1],1
96
    mov  [addy1],1
132
    mov  [addy2],1
97
    mov  [addy2],1
133
    jmp  drawsswin
98
    jmp  drawsswin
134
 asminit:                 ; for "assembler"
99
 asminit:                 ; for "assembler"
135
    mov  dword [delay],25
100
    mov  dword [delay],25
136
    mov  eax,58
101
    mov  eax,70
137
    mov  ebx,fileinfo
102
    mov  ebx,fileinfo
138
    mcall
103
    mcall
-
 
104
    mov  [filesize], ebx
139
 asminit1:
105
 asminit1:
140
    mov  eax,data_from_file
106
    mov  [stringstart],data_from_file
141
    mov  [stringstart],eax
-
 
142
    mov  dword [stringlen],1
107
    mov  dword [stringlen],1
143
 newpage:
108
 newpage:
144
    mov  word [stringpos],10
109
    mov  word [stringpos],10
Line 145... Line 110...
145
 
110
 
146
 drawsswin:
111
 drawsswin:
147
    xor  eax,eax
-
 
148
    mov  ebx,eax
-
 
149
    mov  ecx,eax
112
    xor  eax,eax
150
    mov  bx,[x_max]
113
    movzx ebx,[x_max]
151
    mov  cx,[y_max]
114
    movzx ecx,[y_max]
152
    inc  ebx
115
    inc  ebx
153
    inc  ecx
116
    inc  ecx
154
    mov  edx,0x01000000
117
    mov  edx,0x01000000
155
    mcall
118
    mcall
Line 158... Line 121...
158
    mcall
121
    mcall
159
 tstill:
122
 tstill:
160
    mov  eax,23
123
    mov  eax,23
161
    mov  ebx,[delay]
124
    mov  ebx,[delay]
162
    mcall
125
    mcall
163
    cmp  eax,2
126
    test eax,eax
164
    je   thr_end
127
    jnz  thr_end
165
    cmp  eax,6
-
 
166
    je   thr_end
-
 
167
    cmp  dword [type],0
128
    cmp  dword [type],0
168
    je   tstill
129
    je   tstill
169
    cmp  dword [type],24
130
    cmp  dword [type],24
170
    je   drawssasm
131
    je   drawssasm
171
    call draw_line
132
    call draw_line
172
    jmp  tstill
133
    jmp  tstill
173
 thr_end:
134
 thr_end:
174
    btr  dword [params],0
135
    and  [params], not 1
175
    mov  eax,26
-
 
176
    mov  ebx,9
-
 
177
    mcall
-
 
178
    mov  [evtime],eax
-
 
179
    or   eax,-1
136
    or   eax,-1
180
    mcall
137
    mcall
Line 181... Line 138...
181
 
138
 
182
 drawssasm:
139
 drawssasm:
183
    mov  edi,[stringstart]
140
    mov  edi,[stringstart]
184
    add  edi,[stringlen]
141
    add  edi,[stringlen]
185
    dec  edi
-
 
186
    mov  eax,edi
142
    dec  edi
187
    sub  eax,data_from_file
143
    lea  eax,[edi-data_from_file]
188
    cmp  eax,10450
144
    cmp  eax,[filesize]
189
    ja   asminit1
145
    ja   asminit1
-
 
146
    cmp  word [edi],0x0a0d
-
 
147
    je   addstring
190
    cmp word [edi],0x0a0d
148
    cmp  byte [edi],0x0a
-
 
149
    jne  noaddstring
-
 
150
    dec  edi
191
    jne  noaddstring
151
addstring:
192
    add  word [stringpos],10
152
    add  word [stringpos],10
193
    add  edi,2
153
    add  edi,2
194
    mov  [stringstart],edi
154
    mov  [stringstart],edi
195
    mov dword [stringlen],1
155
    mov dword [stringlen],1
Line 209... Line 169...
209
    cmp byte [edi],byte ' '
169
    cmp byte [edi],byte ' '
210
    je   drawssasm
170
    je   drawssasm
211
    jmp  tstill
171
    jmp  tstill
Line 212... Line 172...
212
 
172
 
213
draw_line:
-
 
214
 
-
 
215
    xor  esi,esi
-
 
216
    xor  edi,edi
173
draw_line:
217
    mov  si,[x_max]
174
    movzx esi,[x_max]
Line 218... Line 175...
218
    mov  di,[y_max]
175
    movzx edi,[y_max]
219
 
176
 
220
    mov  eax,[addx1]
177
    mov  eax,[addx1]
221
    add  [lx1],eax
178
    add  [lx1],eax
Line 292... Line 249...
292
sstill:
249
sstill:
Line 293... Line 250...
293
 
250
 
294
    mov  eax,10                 ; wait here for event
251
    mov  eax,10                 ; wait here for event
Line 295... Line 252...
295
    mcall
252
    mcall
296
 
253
 
297
    cmp  eax,1                  ; redraw request ?
254
    dec  eax                    ; redraw request ?
298
    je   sthread
255
    je   sthread
299
    cmp  eax,2                  ; key in buffer ?
-
 
300
    je   sstill
256
    dec  eax                    ; key in buffer ?
301
    cmp  eax,3                  ; button in buffer ?
257
    jne  sbutton
302
    je   sbutton
258
    mov  al,2
Line 303... Line 259...
303
 
259
    mcall
304
    jmp  sstill
260
    jmp  sstill
305
 
261
 
Line 306... Line 262...
306
  sbutton:                       ; button
262
  sbutton:                       ; button
307
    mov  eax,17                 ; get id
263
    mov  eax,17                 ; get id
Line 308... Line 264...
308
    mcall
264
    mcall
309
 
265
 
310
    cmp  ah,1                   ; button id=1 ?
266
    cmp  ah,1                   ; button id=1 ?
311
    jne  snoclose
267
    jne  snoclose
312
 
268
 
313
    btr dword [params],1
269
    and  [params], not 2
314
    mov  eax,-1                 ; close this program
270
    mov  eax,-1                 ; close this program
315
    mcall
271
    mcall
316
  snoclose:
272
  snoclose:
317
    cmp  ah,7
273
    cmp  ah,7
318
    jne  nosetfl
274
    jne  nosetfl
319
    btc dword [params],0
275
    xor  [params], 1
320
    call drawflag
276
    call drawflag
321
    call drawtype
277
    call drawtype
322
    call drawtime
278
    call drawtime
323
    jmp  sstill
279
    jmp  sstill
324
  nosetfl:
280
  nosetfl:
325
    bt dword [params],0
281
    test [params], 1
326
    jc   sstill
282
    jnz  sstill
Line 343... Line 299...
343
    cmp  ah,4
299
    cmp  ah,4
344
    jne  notimedown
300
    jne  notimedown
345
    mov  al,[time]
301
    mov  al,[time]
346
    cmp  al,1
302
    cmp  al,1
347
    jbe  sstill
303
    jbe  sstill
348
    dec  al
304
    dec  eax
349
;    das
305
;    das
350
    jmp  timeupdn
306
    jmp  timeupdn
351
  notimedown:
307
  notimedown:
352
    cmp  ah,5
308
    cmp  ah,5
353
    jne  notimeup
309
    jne  notimeup
354
    mov  al,[time]
310
    mov  al,[time]
355
    cmp  al,59 ; 0x59
311
    cmp  al,59 ; 0x59
356
    jae  sstill
312
    jae  sstill
357
    inc  al
313
    inc  eax
358
;    daa
314
;    daa
359
    jmp  timeupdn
315
    jmp  timeupdn
360
  notimeup:
316
  notimeup:
361
    cmp  ah,6
317
    cmp  ah,6
362
    jne  noshow
318
    jne  noshow
363
    mov  eax,5
319
    mov  eax,5
364
    mov  ebx,150
320
    mov  ebx,10;150
365
    mcall
321
    mcall
366
    call create_ss
322
    call create_ss
367
    jmp  sstill
-
 
368
  noshow:
323
  noshow:
369
    jmp  sstill
324
    jmp  sstill
Line 370... Line 325...
370
 
325
 
371
  timeupdn:
326
  timeupdn:
Line 395... Line 350...
395
    mov  ecx,100*65536+70          ; [y start] *65536 + [y size]
350
    mov  ecx,100*65536+70          ; [y start] *65536 + [y size]
396
    mov  edx,0x13400088            ; color of work area RRGGBB,8->color gl
351
    mov  edx,0x13400088            ; color of work area RRGGBB,8->color gl
397
    mov  edi,title
352
    mov  edi,title
398
    mcall
353
    mcall
Line 399... Line 354...
399
 
354
 
400
    mov  eax,8
355
    mov  al,8
401
    mov  ebx,47*65536+10
356
    mov  ebx,47*65536+10
402
    mov  ecx,31*65536+10
357
    mov  ecx,31*65536+10
403
    mov  edx,2
358
    mov  edx,2
404
    mov  esi,0x702050
359
    mov  esi,0x702050
Line 418... Line 373...
418
    mov  ebx,160*65536+40
373
    mov  ebx,160*65536+40
419
    mov  ecx,28*65536+14
374
    mov  ecx,28*65536+14
420
    inc  edx
375
    inc  edx
421
    mcall
376
    mcall
Line 422... Line 377...
422
 
377
 
423
    mov  eax,4                     ; function 4 : write text to window
378
    mov  al,4                        ; function 4 : write text to window
424
    mov  ebx,15*65536+33             ; [x start] *65536 + [y start]
379
    mov  ebx,15*65536+33             ; [x start] *65536 + [y start]
425
    mov  ecx,0xffffff
380
    mov  ecx,0x80ffffff
426
    mov  edx,setuptext
-
 
427
    mov  esi,9
381
    mov  edx,setuptext
428
    mcall
382
    mcall
429
    add  ebx,15
383
    add  ebx,15
430
    add  edx,esi
-
 
431
    mov  esi,30
384
    add  edx,10
432
    mcall
385
    mcall
433
    mov  ebx,169*65536+32
386
    mov  ebx,169*65536+32
434
    mov  edx,buttext
-
 
435
    mov  esi,4
387
    mov  edx,buttext
Line 436... Line 388...
436
    mcall
388
    mcall
437
 
389
 
438
    call drawtype
390
    call drawtype
Line 448... Line 400...
448
drawtype:
400
drawtype:
449
    mov  eax,13
401
    mov  eax,13
450
    mov  ebx,80*65536+75
402
    mov  ebx,80*65536+75
451
    mov  ecx,30*65536+12
403
    mov  ecx,30*65536+12
452
    mov  edx,0xffffff
404
    mov  edx,0xffffff
453
    bt   dword [params],0
405
    test [params], 1
454
    jnc  noblue
406
    jz   noblue
455
    mov  edx,0x4e00e7
407
    mov  edx,0x4e00e7
456
 noblue:
408
 noblue:
457
    mcall
409
    mcall
458
    mov  eax,4
410
    mov  al,4
459
    mov  ebx,82*65536+32
411
    mov  ebx,82*65536+32
460
    xor  ecx,ecx
412
    xor  ecx,ecx
461
    mov  edx,typetext
413
    mov  edx,typetext
462
    add  edx,[type]
414
    add  edx,[type]
463
    mov  esi,12
415
    mov  esi,12
Line 467... Line 419...
467
drawtime:
419
drawtime:
468
    mov  eax,13
420
    mov  eax,13
469
    mov  ebx,80*65536+15
421
    mov  ebx,80*65536+15
470
    mov  ecx,45*65536+12
422
    mov  ecx,45*65536+12
471
    mov  edx,0xffffff
423
    mov  edx,0xffffff
472
    bt   dword [params],0
424
    test [params], 1
473
    jnc  noblue1
425
    jz   noblue1
474
    mov  edx,0x4e00e7
426
    mov  edx,0x4e00e7
475
 noblue1:
427
 noblue1:
476
    mcall
428
    mcall
477
    mov  eax,47
429
    mov  al,47
478
    mov  edx,82*65536+47
430
    mov  edx,82*65536+47
479
    xor  esi,esi
431
    xor  esi,esi
480
    movzx ecx,byte [time]
432
    movzx ecx,byte [time]
481
    mov  ebx,0x00020000
433
    mov  ebx,0x00020000
482
    mcall
434
    mcall
Line 487... Line 439...
487
    mov  ebx,150*65536+10
439
    mov  ebx,150*65536+10
488
    mov  ecx,45*65536+10
440
    mov  ecx,45*65536+10
489
    mov  edx,7
441
    mov  edx,7
490
    mov  esi,0xe0e0e0
442
    mov  esi,0xe0e0e0
491
    mcall
443
    mcall
492
    mov  eax,4
444
    mov  al,4
493
    mov  ebx,153*65536+47
445
    mov  ebx,153*65536+47
494
    xor  ecx,ecx
446
    xor  ecx,ecx
495
    mov  esi,1
447
    mov  esi,1
496
    mov  edx,flag
448
    mov  edx,flag
497
    bt   dword [params],0
449
    bt   dword [params],0
Line 500... Line 452...
500
  setf:
452
  setf:
501
    mcall
453
    mcall
502
    ret
454
    ret
Line 503... Line 455...
503
 
455
 
504
; DATA AREA
456
; DATA AREA
505
buttext    db 'SHOW'
457
buttext    db 'SHOW',0
506
flag       db 'V '
458
flag       db 'V '
-
 
459
title      db 'SCREENSAVER SETUP',0
507
title      db 'SCREENSAVER SETUP',0
460
setuptext  db 'TYPE: < >',0
508
setuptext  db 'TYPE: < >TIME: < >     MINUTES    NEVER'
461
           db 'TIME: < >     MINUTES    NEVER',0
509
typetext   db 'BLACK SCREENCOLOR LINES ASSEMBLER   '
462
typetext   db 'BLACK SCREENCOLOR LINES ASSEMBLER   '
510
type       dd 12
463
type       dd 12
511
time       db 15     ; ¢à¥¬ï ¤® § ¯ã᪠ § áâ ¢ª¨ ¢ ¬¨­ãâ å
464
time       db 15     ; ¢à¥¬ï ¤® § ¯ã᪠ § áâ ¢ª¨ ¢ ¬¨­ãâ å
Line 525... Line 478...
525
 
478
 
526
stringlen   dd 1
479
stringlen   dd 1
527
stringstart dd 0
480
stringstart dd 0
Line 528... Line 481...
528
stringpos   dw 10
481
stringpos   dw 10
Line 529... Line 482...
529
 
482
 
-
 
483
params  db 0     ;if bit 0 set-ssaver works if bit 1 set-setup works
530
params  dd 0     ;if bit 0 set-ssaver works if bit 1 set-setup works
484
 
531
 
485
fileinfo:
Line 532... Line 486...
532
fileinfo:
486
; used_memory-0x3000-data_from_file = ~50 Kb with current settings
Line 533... Line 487...
533
  dd 0,0,21,data_from_file,work_area
487
  dd 0,0,0,used_memory-0x3000-data_from_file,data_from_file
Line 534... Line 488...
534
  db '/RD/1/SS.ASM',0
488
  db '/RD/1/NETWORK/PPP.ASM',0
535
 
-
 
536
I_END:
489
 
537
 
490
I_END:
Line 538... Line 491...
538
 
491
 
539
; UNINITIALIZED DATA:
-
 
540
 
492
 
541
lcolor           dd ?
493
; UNINITIALIZED DATA:
542
evtime           dd ?     ; ¢à¥¬ï ¯à¥¤ë¤ã饣® ᮡëâ¨ï
494