Subversion Repositories Kolibri OS

Rev

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

Rev 109 Rev 485
Line 1... Line -...
1
lang equ ru ; ru en fr ge fi
-
 
2
 
-
 
3
;
1
;
4
;   Assembler
2
;   Assembler
5
;     SMALL
3
;     SMALL
6
;       CODE
4
;       CODE
7
;         Libary
5
;         Libary
Line 46... Line 44...
46
    db file_name,0
44
    db file_name,0
47
open:
45
open:
48
    mov  dword [fileinfo+8],1 ; how many blocks to read (1)
46
    mov  dword [fileinfo+8],1 ; how many blocks to read (1)
49
    mov  eax,58
47
    mov  eax,58
50
    mov  ebx,fileinfo
48
    mov  ebx,fileinfo
51
    int  0x40
49
    mcall
52
    mov  eax,[file_load_area+2]
50
    mov  eax,[file_load_area+2]
53
    shr  eax,9 ; ¯®¤¥«¨¬ ­  512 ¨ ¯à¨¡ ¢¨¬ 1 - ¯®«ã稬 ç¨á«® ¡«®ª®¢
51
    shr  eax,9 ; ¯®¤¥«¨¬ ­  512 ¨ ¯à¨¡ ¢¨¬ 1 - ¯®«ã稬 ç¨á«® ¡«®ª®¢
54
    inc  eax
52
    inc  eax
55
    mov  dword [fileinfo+8],eax
53
    mov  dword [fileinfo+8],eax
56
    mov  eax,58
54
    mov  eax,58
57
    mov  ebx,fileinfo
55
    mov  ebx,fileinfo
58
    int  0x40
56
    mcall
59
}
57
}
Line 60... Line 58...
60
 
58
 
61
 
59
 
Line 88... Line 86...
88
    wordstoreg ebx,x,xs
86
    wordstoreg ebx,x,xs
89
    wordstoreg ecx,y,ys
87
    wordstoreg ecx,y,ys
90
    mov edx,id
88
    mov edx,id
91
    mov esi,bcolor
89
    mov esi,bcolor
92
    mov eax,8
90
    mov eax,8
93
    int 0x40
91
    mcall
Line 94... Line 92...
94
 
92
 
95
    mov eax,asd-lab          ;calc size
93
    mov eax,asd-lab          ;calc size
96
    mov ebx,6
94
    mov ebx,6
97
    mul ebx
95
    mul ebx
Line 113... Line 111...
113
 
111
 
114
    mov ecx,tcolor             ;arg4 color
112
    mov ecx,tcolor             ;arg4 color
115
    mov edx,lab
113
    mov edx,lab
116
    mov esi,asd-lab          ;calc size
114
    mov esi,asd-lab          ;calc size
117
    mov eax,4
115
    mov eax,4
118
    int 0x40
116
    mcall
Line 119... Line 117...
119
}
117
}
120
 
118
 
Line 142... Line 140...
142
 
140
 
143
; Get my PID in dec format 4 bytes
141
; Get my PID in dec format 4 bytes
144
    mov eax,9
142
    mov eax,9
145
    mov ebx,procinfo
143
    mov ebx,procinfo
146
    mov ecx,-1
144
    mov ecx,-1
Line 147... Line 145...
147
    int 0x40
145
    mcall
148
 
146
 
149
; convert eax bin to param dec
147
; convert eax bin to param dec
150
    mov eax,dword [procinfo+30]  ;offset of myPID
148
    mov eax,dword [procinfo+30]  ;offset of myPID
Line 176... Line 174...
176
; define IPC memory
174
; define IPC memory
177
    mov eax,60
175
    mov eax,60
178
    mov ebx,1        ; define IPC
176
    mov ebx,1        ; define IPC
179
    mov ecx,path     ; offset of area
177
    mov ecx,path     ; offset of area
180
    mov edx,150      ; size 150 bytes
178
    mov edx,150      ; size 150 bytes
181
    int 0x40
179
    mcall
Line 182... Line 180...
182
 
180
 
183
; change wanted events list 7-bit IPC event
181
; change wanted events list 7-bit IPC event
184
    mov eax,40
182
    mov eax,40
185
    mov ebx,01000111b
183
    mov ebx,01000111b
Line 186... Line 184...
186
    int 0x40
184
    mcall
187
 
185
 
188
;
186
;
Line 189... Line 187...
189
; STEP 3 run SYSTEM XTREE with parameters
187
; STEP 3 run SYSTEM XTREE with parameters
190
;
188
;
191
 
189
 
Line 192... Line 190...
192
    mov eax,58
190
    mov eax,58
Line 193... Line 191...
193
    mov ebx,run_fileinfo
191
    mov ebx,run_fileinfo
194
    int 0x40
192
    mcall
195
 
193
 
196
    call redproc
194
    call redproc
197
 
195
 
Line 198... Line 196...
198
    mov [get_loops],0
196
    mov [get_loops],0
199
getmesloop:
197
getmesloop:
200
    mov eax,23
198
    mov eax,23
201
    mov ebx,50     ;0.5 sec
199
    mov ebx,50     ;0.5 sec
Line 212... Line 210...
212
 
210
 
213
; Get number of procces
211
; Get number of procces
214
    mov ebx,procinfo
212
    mov ebx,procinfo
215
    mov ecx,-1
213
    mov ecx,-1
216
    mov eax,9
214
    mov eax,9
217
    int 0x40
215
    mcall
Line 218... Line 216...
218
    mov ebp,eax
216
    mov ebp,eax
219
 
217
 
220
loox:
218
loox:
221
    mov eax,9
219
    mov eax,9
222
    mov ebx,procinfo
220
    mov ebx,procinfo
223
    mov ecx,ebp
221
    mov ecx,ebp
224
    int 0x40
222
    mcall
225
    mov eax,[DLGPID]
223
    mov eax,[DLGPID]
226
    cmp [procinfo+30],eax    ;IF Dialog find
224
    cmp [procinfo+30],eax    ;IF Dialog find
227
    je  dlg_is_work          ;jmp to dlg_is_work
225
    je  dlg_is_work          ;jmp to dlg_is_work
Line 244... Line 242...
244
mred:
242
mred:
245
    call redproc
243
    call redproc
246
    jmp  getmesloop
244
    jmp  getmesloop
247
mkey:
245
mkey:
248
    mov  eax,2
246
    mov  eax,2
249
    int  0x40                   ; read (eax=2)
247
    mcall                   ; read (eax=2)
250
    jmp  getmesloop
248
    jmp  getmesloop
251
mbutton:
249
mbutton:
252
    mov  eax,17                 ; get id
250
    mov  eax,17                 ; get id
253
    int  0x40
251
    mcall
254
    cmp  ah,1                   ; button id=1 ?
252
    cmp  ah,1                   ; button id=1 ?
255
    jne  getmesloop
253
    jne  getmesloop
256
    mov  eax,-1                 ; close this program
254
    mov  eax,-1                 ; close this program
257
    int  0x40
255
    mcall
258
mgetmes:
256
mgetmes:
Line 259... Line 257...
259
 
257
 
260
; If dlg_pid_get then second message get jmp to still
258
; If dlg_pid_get then second message get jmp to still
261
    cmp  [dlg_pid_get],dword 1
259
    cmp  [dlg_pid_get],dword 1
Line 354... Line 352...
354
 
352
 
355
; Get my PID in dec format 4 bytes
353
; Get my PID in dec format 4 bytes
356
    mov eax,9
354
    mov eax,9
357
    mov ebx,procinfo
355
    mov ebx,procinfo
358
    mov ecx,-1
356
    mov ecx,-1
Line 359... Line 357...
359
    int 0x40
357
    mcall
360
 
358
 
361
; convert eax bin to param dec
359
; convert eax bin to param dec
362
    mov eax,dword [procinfo+30]  ;offset of myPID
360
    mov eax,dword [procinfo+30]  ;offset of myPID
Line 388... Line 386...
388
; define IPC memory
386
; define IPC memory
389
    mov eax,60
387
    mov eax,60
390
    mov ebx,1        ; define IPC
388
    mov ebx,1        ; define IPC
391
    mov ecx,path ; offset of area
389
    mov ecx,path ; offset of area
392
    mov edx,120      ; size 150 bytes
390
    mov edx,120      ; size 150 bytes
393
    int 0x40
391
    mcall
Line 394... Line 392...
394
 
392
 
395
; change wanted events list 7-bit IPC event
393
; change wanted events list 7-bit IPC event
396
    mov eax,40
394
    mov eax,40
397
    mov ebx,01000111b
395
    mov ebx,01000111b
Line 398... Line 396...
398
    int 0x40
396
    mcall
399
 
397
 
400
;
398
;
Line 401... Line 399...
401
; STEP 3 run SYSTEM XTREE with parameters
399
; STEP 3 run SYSTEM XTREE with parameters
402
;
400
;
403
 
401
 
Line 404... Line 402...
404
    mov eax,58
402
    mov eax,58
Line 405... Line 403...
405
    mov ebx,run_fileinfo
403
    mov ebx,run_fileinfo
406
    int 0x40
404
    mcall
407
 
405
 
408
    call redproc
406
    call redproc
409
 
407
 
Line 410... Line 408...
410
    mov [get_loops],0
408
    mov [get_loops],0
411
getmesloop:
409
getmesloop:
412
    mov eax,23
410
    mov eax,23
413
    mov ebx,50     ;0.5 sec
411
    mov ebx,50     ;0.5 sec
Line 424... Line 422...
424
 
422
 
425
; Get number of procces
423
; Get number of procces
426
    mov ebx,procinfo
424
    mov ebx,procinfo
427
    mov ecx,-1
425
    mov ecx,-1
428
    mov eax,9
426
    mov eax,9
429
    int 0x40
427
    mcall
Line 430... Line 428...
430
    mov ebp,eax
428
    mov ebp,eax
431
 
429
 
432
loox:
430
loox:
433
    mov eax,9
431
    mov eax,9
434
    mov ebx,procinfo
432
    mov ebx,procinfo
435
    mov ecx,ebp
433
    mov ecx,ebp
436
    int 0x40
434
    mcall
437
    mov eax,[DLGPID]
435
    mov eax,[DLGPID]
438
    cmp [procinfo+30],eax    ;IF Dialog find
436
    cmp [procinfo+30],eax    ;IF Dialog find
439
    je  dlg_is_work          ;jmp to dlg_is_work
437
    je  dlg_is_work          ;jmp to dlg_is_work
Line 455... Line 453...
455
 
453
 
456
mred:
454
mred:
457
    call redproc
455
    call redproc
458
    jmp  getmesloop
456
    jmp  getmesloop
459
mkey:
457
mkey:
460
    int  0x40                   ; read (eax=2)
458
    mcall                   ; read (eax=2)
461
    jmp  getmesloop
459
    jmp  getmesloop
462
mbutton:
460
mbutton:
463
    mov  eax,17                 ; get id
461
    mov  eax,17                 ; get id
464
    int  0x40
462
    mcall
465
    cmp  ah,1                   ; button id=1 ?
463
    cmp  ah,1                   ; button id=1 ?
466
    jne  getmesloop
464
    jne  getmesloop
467
    mov  eax,-1                 ; close this program
465
    mov  eax,-1                 ; close this program
468
    int  0x40
466
    mcall
Line 469... Line 467...
469
mgetmes:
467
mgetmes:
470
 
468
 
471
; If dlg_pid_get then second message get jmp to still
469
; If dlg_pid_get then second message get jmp to still
Line 615... Line 613...
615
}
613
}
Line 616... Line 614...
616
 
614
 
617
macro scank
615
macro scank
618
{
616
{
619
    mov eax,10
617
    mov eax,10
620
    int 0x40
618
    mcall
Line 621... Line 619...
621
}
619
}
622
 
620
 
623
macro putpix x,y,color
621
macro putpix x,y,color
624
{
622
{
625
    mov ebx,x
623
    mov ebx,x
626
    mov ecx,y
624
    mov ecx,y
627
    mov edx,color
625
    mov edx,color
628
    mov eax,1
626
    mov eax,1
Line 629... Line 627...
629
    int 0x40
627
    mcall
630
}
628
}
631
 
629
 
Line 637... Line 635...
637
    wordstoreg ebx,x,y
635
    wordstoreg ebx,x,y
638
    mov ecx,color
636
    mov ecx,color
639
    mov edx,offs
637
    mov edx,offs
640
    mov esi,size
638
    mov esi,size
641
    mov eax,4
639
    mov eax,4
642
    int 0x40
640
    mcall
643
}
641
}
Line 644... Line 642...
644
 
642
 
645
macro outcount data, x, y, color, numtype
643
macro outcount data, x, y, color, numtype
646
{
644
{
Line 649... Line 647...
649
    mov bl,0
647
    mov bl,0
650
;    mov edx,x*65536+y
648
;    mov edx,x*65536+y
651
    wordstoreg edx,x,y
649
    wordstoreg edx,x,y
652
    mov esi,color
650
    mov esi,color
653
    mov eax,47
651
    mov eax,47
654
    int 0x40
652
    mcall
655
}
653
}
Line 656... Line 654...
656
 
654
 
Line 657... Line 655...
657
; SCEVENT - Scan event
655
; SCEVENT - Scan event
658
 
656
 
659
macro scevent red,key,but
657
macro scevent red,key,but
660
{
658
{
661
    mov eax,11
659
    mov eax,11
662
    int 0x40
660
    mcall
663
    dec eax
661
    dec eax
664
    jz  red
662
    jz  red
665
    dec eax
663
    dec eax
Line 671... Line 669...
671
; WTEVENT - Wait event
669
; WTEVENT - Wait event
Line 672... Line 670...
672
 
670
 
673
macro wtevent red,key,but
671
macro wtevent red,key,but
674
{
672
{
675
    mov eax,10
673
    mov eax,10
676
    int 0x40
674
    mcall
677
    dec eax
675
    dec eax
678
    jz  red
676
    jz  red
679
    dec eax
677
    dec eax
680
    jz  key
678
    jz  key
Line 686... Line 684...
686
 
684
 
687
macro timeevent xfps,noevent,red,key,but
685
macro timeevent xfps,noevent,red,key,but
688
{
686
{
689
    mov eax,23
687
    mov eax,23
690
    mov ebx,xfps
688
    mov ebx,xfps
691
    int 0x40
689
    mcall
692
    cmp eax,0
690
    cmp eax,0
693
    je  noevent
691
    je  noevent
694
    dec eax
692
    dec eax
695
    jz  red
693
    jz  red
Line 703... Line 701...
703
; CLOSE - Close program
701
; CLOSE - Close program
Line 704... Line 702...
704
 
702
 
705
macro close
703
macro close
706
{
704
{
707
    mov eax,-1
705
    mov eax,-1
708
    int 0x40
706
    mcall
Line 709... Line 707...
709
}
707
}
710
 
708
 
711
; DELAY - Create delay 1/100 sec
709
; DELAY - Create delay 1/100 sec
Line 712... Line 710...
712
; (SYNTAX)  Delay time
710
; (SYNTAX)  Delay time
713
; (SAMPLE)  Delay 100   ;delay 2 sec 1/100*200=2 sec
711
; (SAMPLE)  Delay 100   ;delay 2 sec 1/100*200=2 sec
714
 
712
 
715
macro delay arg1
713
macro delay arg1
716
{
714
{
717
    mov eax,5
715
    mov eax,5
Line 718... Line 716...
718
    mov ebx,arg1
716
    mov ebx,arg1
719
    int 0x40
717
    mcall
720
}
718
}
Line 729... Line 727...
729
;    mov ecx,arg2*65536+arg4
727
;    mov ecx,arg2*65536+arg4
730
    wordstoreg ebx,arg1,arg3
728
    wordstoreg ebx,arg1,arg3
731
    wordstoreg ecx,arg2,arg4
729
    wordstoreg ecx,arg2,arg4
732
    mov edx,arg5
730
    mov edx,arg5
733
    mov eax,0
731
    mov eax,0
734
    int 0x40
732
    mcall
735
}
733
}
Line 736... Line 734...
736
 
734
 
737
macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7
735
macro colorwindow arg1,arg2,arg3,arg4,arg5,arg6,arg7
738
{
736
{
739
    mov ebx,arg1*65536+arg3
737
    mov ebx,arg1*65536+arg3
740
    mov ecx,arg2*65536+arg4
738
    mov ecx,arg2*65536+arg4
741
    mov edx,arg5
739
    mov edx,arg5
742
    mov esi,arg6
740
    mov esi,arg6
743
    mov edi,arg7
741
    mov edi,arg7
744
    mov eax,0
742
    mov eax,0
745
    int 0x40
743
    mcall
Line 746... Line 744...
746
}
744
}
Line 747... Line 745...
747
 
745
 
748
 
746
 
749
; STARTWD - Start of window draw
747
; STARTWD - Start of window draw
750
 
748
 
751
macro startwd
749
macro startwd
752
{
750
{
Line 753... Line 751...
753
    mov eax,12
751
    mov eax,12
Line 754... Line 752...
754
    mov ebx,1
752
    mov ebx,1
755
    int 0x40
753
    mcall
756
}
754
}
757
 
755
 
758
; ENDWD - End window draw
756
; ENDWD - End window draw
759
 
757
 
Line 760... Line 758...
760
macro endwd
758
macro endwd
761
{
759
{
762
    mov eax,12
760
    mov eax,12
Line 780... Line 778...
780
    wordstoreg ebx,arg1,arg2
778
    wordstoreg ebx,arg1,arg2
781
    mov ecx,arg4             ;arg4 color
779
    mov ecx,arg4             ;arg4 color
782
    mov edx,lab
780
    mov edx,lab
783
    mov esi,asd-lab          ;calc size
781
    mov esi,asd-lab          ;calc size
784
    mov eax,4
782
    mov eax,4
785
    int 0x40
783
    mcall
786
}
784
}
Line 787... Line 785...
787
 
785
 
788
;Key's
786
;Key's
789
key_Up     equ 178
787
key_Up     equ 178