Subversion Repositories Kolibri OS

Rev

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

Rev 132 Rev 135
Line 16... Line 16...
16
;    version 0.13   3 de junio 2004
16
;    version 0.13   3 de junio 2004
17
;                   Octavio Vega
17
;                   Octavio Vega
18
;                   unos retoques
18
;                   unos retoques
19
;    version 0.14   10th August 2004
19
;    version 0.14   10th August 2004
20
;                   Mike Hibbett Added setting default colours
20
;                   Mike Hibbett Added setting default colours
-
 
21
;    version 0.15   24th August 2006
-
 
22
;                   diamond (rewritten to function 70)
21
;
23
;
-
 
24
 
22
               memsize=20000h
25
               memsize=20000h
23
               org 0
26
               org 0
24
 PARAMS     =    memsize - 1024
27
 PARAMS     =    memsize - 1024
Line 25... Line 28...
25
 
28
 
Line 31... Line 34...
31
               dd     I_END                   ; size of image
34
               dd     I_END                   ; size of image
32
               dd     memsize                 ; memory for app
35
               dd     memsize                 ; memory for app
33
               dd     memsize - 1024           ; esp
36
               dd     memsize - 1024           ; esp
34
               dd     PARAMS , 0x0               ; I_Param , I_Icon
37
               dd     PARAMS , 0x0               ; I_Param , I_Icon
Line 35... Line -...
35
 
-
 
36
include 'lang.inc'
38
 
Line 37... Line 39...
37
stack_size=4096 + 1024
39
stack_size=4096 + 1024
Line 38... Line 40...
38
 
40
 
Line 48... Line 50...
48
  .l1:
50
  .l1:
49
    mov     ecx,memsize-fin-stack_size
51
    mov     ecx,memsize-fin-stack_size
50
    mov     edi,fin
52
    mov     edi,fin
51
    call    add_mem
53
    call    add_mem
Line 52... Line -...
52
 
-
 
53
    ; Get some memory
-
 
54
    mov     ecx,16384
-
 
55
    call    malloc
-
 
56
    mov     [work_area],edi
54
 
57
    call    colorprecalc ;inicializa tablas usadas para pasar de ybr a bgr
55
    call    colorprecalc ;inicializa tablas usadas para pasar de ybr a bgr
58
    call    draw_window
56
    call    draw_window
Line 59... Line 57...
59
    call    read_string.rs_done
57
    call    read_string.rs_done
Line 146... Line 144...
146
boot_set_background:
144
boot_set_background:
Line 147... Line 145...
147
 
145
 
148
    mov     ecx,memsize-fin-stack_size  ; size
146
    mov     ecx,memsize-fin-stack_size  ; size
149
    mov     edi,fin                     ; pointer
147
    mov     edi,fin                     ; pointer
150
    call    add_mem             ; mark memory from fin to 0x100000-1024 as free
-
 
151
    ; Get some memory
-
 
152
    mov     ecx,16384           ; get 16 Kb of memory
-
 
153
    call    malloc              ; returns pointer in edi
-
 
154
    mov     [work_area],edi     ; save it
148
    call    add_mem             ; mark memory from fin to 0x100000-1024 as free
155
    call    colorprecalc        ; calculate colors
149
    call    colorprecalc        ; calculate colors
156
    mov     esi,name_string
150
    mov     esi,name_string
157
    call    open
151
    call    open
158
    test    eax,eax
152
    test    eax,eax
Line 242... Line 236...
242
    mov  ebx,1
236
    mov  ebx,1
243
    int  0x40
237
    int  0x40
Line 244... Line 238...
244
 
238
 
245
    ; Draw the window to the appropriate size - it may have
239
    ; Draw the window to the appropriate size - it may have
246
    ; been resized by the user
-
 
247
    mov     eax, 0
240
    ; been resized by the user
248
    cmp     [winxs], ax
241
    cmp     [winxs], 0
Line 249... Line 242...
249
    jne     dw_001
242
    jne     dw_001
250
 
-
 
251
    ; Give the screen some inital defaults
243
 
252
    mov     ax, 400
-
 
253
    mov     [winxs], ax
244
    ; Give the screen some inital defaults
254
    mov     ax, 300
245
    mov     [winxs], 400
255
    mov     [winys], ax
246
    mov     [winys], 300
256
    mov     ax, 100
247
    mov     ax, 100
257
    mov     [winxo], ax
248
    mov     [winxo], ax
Line 271... Line 262...
271
    mov     [winxs], ax
262
    mov     [winxs], ax
272
    mov     eax, [ebx + 46]
263
    mov     eax, [ebx + 46]
273
    mov     [winys], ax
264
    mov     [winys], ax
Line 274... Line 265...
274
 
265
 
275
dw_002:
266
dw_002:
276
    mov     bx, [winxo]
-
 
277
    shl     ebx, 16
267
        mov     ebx, dword [winxo-2]
278
    mov     bx, [winxs]
-
 
279
 
268
        mov     bx, [winxs]
280
    mov     cx, [winyo]
-
 
281
    shl     ecx, 16
269
        mov     ecx, dword [winyo-2]
Line 282... Line -...
282
    mov     cx, [winys]
-
 
283
 
270
        mov     cx, [winys]
284
 
271
 
285
    mov  eax,0                     ; DRAW WINDOW
272
    xor  eax,eax                   ; DRAW WINDOW
286
    mov  edx,[wcolor]
273
    mov  edx,[wcolor]
287
    add  edx,0x02000000
274
    add  edx,0x02000000
288
    mov  esi,0x80557799
275
    mov  esi,0x80557799
Line 459... Line 446...
459
    int     0x40
446
    int     0x40
460
    popa
447
    popa
461
    ret
448
    ret
Line 462... Line 449...
462
 
449
 
463
slideshow:
450
slideshow:
464
    test dword[file_dir],-1
451
        cmp     [file_dir], 0
465
    jnz .exit
452
        jnz     .exit
466
    test dword[jpeg_st],-1
453
        cmp     [jpeg_st], 0
467
    jz .exit
454
        jz      .exit
468
    mov esi,name_string
455
        mov     esi, name_string
469
    movzx ecx,byte[name_string.cursor]
456
        movzx   ecx, byte [name_string.cursor]
470
   .l1:
457
.l1:
471
    cmp byte[esi+ecx],'/'
458
        cmp     byte [esi+ecx], '/'
472
    je .l2
459
        jz      .l2
473
    loop .l1
460
        loop    .l1
474
  .exit:
461
.exit:
475
    ret
462
        ret
476
  .l2:
463
.l2:
477
    mov byte[esi+ecx],0
464
        mov     byte [esi+ecx], 0
478
    call open
465
        call    open
479
    mov byte[esi+ecx],'/'
466
        mov     byte [esi+ecx], '/'
480
    test eax,eax
467
        test    eax, eax
481
    jz .exit
-
 
482
 
468
        jz      .exit
-
 
469
        test    byte [fileattr], 0x10
483
    mov dword[eax+file_handler.size],-1 ;directory size is always 0
470
        jz      .exit
484
    mov [file_dir],eax
471
        mov     [file_dir], eax
485
    inc cl
472
        inc     ecx
486
    mov [name_string.cursor],cl
-
 
487
 
473
        mov     [name_string.cursor], cl
488
display_next:
474
display_next:
489
    mov eax,[file_dir]
475
        mov     ebx, [file_dir]
490
    test eax,eax
476
        test    ebx, ebx
491
    jnz .l1
477
        jnz     @f
492
    ret
478
        ret
493
   .l1:
479
@@:
494
    mov ecx,32
480
        mov     byte [ebx], 1
-
 
481
        mov     byte [ebx+12], 1
495
    sub esp,ecx
482
        mov     dword [ebx+16], dirinfo
496
    mov edi,esp
483
        mov     eax, 70
497
    call read
484
        int     0x40
498
    cmp ecx,32
485
        mov     eax, [file_dir]
499
    jnc .l11
486
        inc     dword [eax+4]
500
   .l10:
487
        cmp     ebx, 1
501
    add esp,32
488
        jz      @f
502
    mov eax,dword[file_dir]
489
        mov     eax, [file_dir]
503
    mov dword[file_dir],0
490
        and     [file_dir], 0
504
    jmp close
491
        jmp     close
505
   .l11:
-
 
506
    mov esi,esp
492
@@:
507
    movzx edi,byte[name_string.cursor]
493
        movzx   edi, byte [name_string.cursor]
-
 
494
        add     edi, name_string
-
 
495
        lea     esi, [dirinfo+32+40]
508
    add edi,name_string
496
@@:
509
    lodsb
-
 
510
    cmp al,0
-
 
511
    je .l10
-
 
512
    cmp al,229
-
 
513
    jne .l0
-
 
514
    add esp,32
-
 
515
    jmp display_next
-
 
516
   .l0:
-
 
517
    stosb
-
 
518
    mov cl,7
-
 
519
   .l2:
-
 
520
    lodsb
-
 
521
    cmp al,32
-
 
522
    jna .l3
497
        lodsb
523
    stosb
-
 
524
    loop .l2
-
 
525
   .l3:
498
        stosb
526
    lea esi,[esp+8]
-
 
527
    mov al,'.'
-
 
528
    stosb
-
 
529
    mov cl,3
-
 
530
   .l4:
-
 
531
    lodsb
-
 
532
    cmp al,32
499
        test    al, al
533
    jna .l5
-
 
534
    stosb
-
 
535
    loop .l4
-
 
536
   .l5:
-
 
537
    mov al,0
-
 
538
    stosb
500
        jnz     @b
539
    cmp edi,name_string.end
501
        mov     ecx, name_string.end
540
    jc .l5
502
        sub     ecx, edi
541
    add esp,32
503
        rep     stosb
542
    call   print_strings
504
    call   print_strings
543
    mov     esi,name_string
505
    mov     esi,name_string
544
    call    open
506
    call    open
545
    test    eax,eax
507
    test    eax,eax
Line 556... Line 518...
556
    call jpeg_close
518
    call jpeg_close
557
    pop ebp
519
    pop ebp
558
    jmp jpeg_display
520
    jmp jpeg_display
Line 559... Line -...
559
 
-
 
560
 
521
 
561
 
522
 
562
include 'filelib.asm'
523
include 'filelib.asm'
Line 563... Line 524...
563
include 'memlib.asm'
524
include 'memlib.asm'
Line 564... Line 525...
564
include 'jpeglib.asm'
525
include 'jpeglib.asm'
565
 
526
 
566
 
527
 
567
; DATA AREA
528
; DATA AREA
568
 
529
 
Line 569... Line 530...
569
wcolor          dd  0x000000
530
wcolor          dd  0x000000
Line 578... Line 539...
578
x_pointer       dd  0
539
x_pointer       dd  0
579
x_offset        dd  0
540
x_offset        dd  0
580
x_numofbytes    dd  0
541
x_numofbytes    dd  0
581
x_numofb2       dd  0
542
x_numofb2       dd  0
582
x_counter       dd  0
543
x_counter       dd  0
583
winxo:          dw  0
544
winxo           dw  0
584
winyo:          dw  0
545
winyo           dw  0
585
winxs:          dw  0
546
winxs           dw  0
586
winys:          dw  0
547
winys           dw  0
587
jpeg_st:        dd  0
548
jpeg_st         dd  0
588
file_dir:       dd  0
549
file_dir        dd  0
589
work_area:      dd  0
-
 
590
tcolor          dd  0x000000
550
tcolor          dd  0x000000
591
btcolor         dd  0x224466+0x808080
551
btcolor         dd  0x224466+0x808080
592
name_string:    db '/rd/1/jpegview.jpg',0
552
name_string:    db '/rd/1/jpegview.jpg',0
593
 
-
 
594
rb 100
553
rb 256
595
    .end:
554
    .end:
596
    .cursor: db 19
555
    .cursor: db 19
597
    .cursor2: db 0
556
    .cursor2: db 0
Line 598... Line 557...
598
 
557
 
Line 610... Line 569...
610
.l1           dd 0
569
.l1           dd 0
Line 611... Line 570...
611
 
570
 
612
fin:
571
fin:
Line 613... Line -...
613
I_END:
-
 
614
572
I_END:
-
 
573