Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 135 → Rev 134

/programs/media/jpegview/trunk/macros.inc
File deleted
\ No newline at end of file
/programs/media/jpegview/trunk/jpegview.asm
18,10 → 18,7
; unos retoques
; version 0.14 10th August 2004
; Mike Hibbett Added setting default colours
; version 0.15 24th August 2006
; diamond (rewritten to function 70)
;
 
memsize=20000h
org 0
PARAMS = memsize - 1024
36,6 → 33,7
dd memsize - 1024 ; esp
dd PARAMS , 0x0 ; I_Param , I_Icon
 
include 'lang.inc'
stack_size=4096 + 1024
 
include 'macros.inc'
52,6 → 50,10
mov edi,fin
call add_mem
 
; Get some memory
mov ecx,16384
call malloc
mov [work_area],edi
call colorprecalc ;inicializa tablas usadas para pasar de ybr a bgr
call draw_window
call read_string.rs_done
146,6 → 148,10
mov ecx,memsize-fin-stack_size ; size
mov edi,fin ; pointer
call add_mem ; mark memory from fin to 0x100000-1024 as free
; Get some memory
mov ecx,16384 ; get 16 Kb of memory
call malloc ; returns pointer in edi
mov [work_area],edi ; save it
call colorprecalc ; calculate colors
mov esi,name_string
call open
238,12 → 244,15
 
; Draw the window to the appropriate size - it may have
; been resized by the user
cmp [winxs], 0
mov eax, 0
cmp [winxs], ax
jne dw_001
 
; Give the screen some inital defaults
mov [winxs], 400
mov [winys], 300
mov ax, 400
mov [winxs], ax
mov ax, 300
mov [winys], ax
mov ax, 100
mov [winxo], ax
mov [winyo], ax
264,12 → 273,16
mov [winys], ax
 
dw_002:
mov ebx, dword [winxo-2]
mov bx, [winxo]
shl ebx, 16
mov bx, [winxs]
mov ecx, dword [winyo-2]
 
mov cx, [winyo]
shl ecx, 16
mov cx, [winys]
 
xor eax,eax ; DRAW WINDOW
 
mov eax,0 ; DRAW WINDOW
mov edx,[wcolor]
add edx,0x02000000
mov esi,0x80557799
448,15 → 461,15
ret
 
slideshow:
cmp [file_dir], 0
test dword[file_dir],-1
jnz .exit
cmp [jpeg_st], 0
test dword[jpeg_st],-1
jz .exit
mov esi, name_string
movzx ecx, byte [name_string.cursor]
.l1:
cmp byte [esi+ecx], '/'
jz .l2
je .l2
loop .l1
.exit:
ret
466,41 → 479,66
mov byte [esi+ecx], '/'
test eax, eax
jz .exit
test byte [fileattr], 0x10
jz .exit
 
mov dword[eax+file_handler.size],-1 ;directory size is always 0
mov [file_dir], eax
inc ecx
inc cl
mov [name_string.cursor], cl
 
display_next:
mov ebx, [file_dir]
test ebx, ebx
jnz @f
mov eax,[file_dir]
test eax,eax
jnz .l1
ret
@@:
mov byte [ebx], 1
mov byte [ebx+12], 1
mov dword [ebx+16], dirinfo
mov eax, 70
int 0x40
mov eax, [file_dir]
inc dword [eax+4]
cmp ebx, 1
jz @f
mov eax, [file_dir]
and [file_dir], 0
.l1:
mov ecx,32
sub esp,ecx
mov edi,esp
call read
cmp ecx,32
jnc .l11
.l10:
add esp,32
mov eax,dword[file_dir]
mov dword[file_dir],0
jmp close
@@:
.l11:
mov esi,esp
movzx edi, byte [name_string.cursor]
add edi, name_string
lea esi, [dirinfo+32+40]
@@:
lodsb
cmp al,0
je .l10
cmp al,229
jne .l0
add esp,32
jmp display_next
.l0:
stosb
test al, al
jnz @b
mov ecx, name_string.end
sub ecx, edi
rep stosb
mov cl,7
.l2:
lodsb
cmp al,32
jna .l3
stosb
loop .l2
.l3:
lea esi,[esp+8]
mov al,'.'
stosb
mov cl,3
.l4:
lodsb
cmp al,32
jna .l5
stosb
loop .l4
.l5:
mov al,0
stosb
cmp edi,name_string.end
jc .l5
add esp,32
call print_strings
mov esi,name_string
call open
520,6 → 558,7
jmp jpeg_display
 
 
 
include 'filelib.asm'
include 'memlib.asm'
include 'jpeglib.asm'
528,7 → 567,7
; DATA AREA
 
wcolor dd 0x000000
labelt db 'Jpegview v0.15'
labelt db 'Jpegview v0.14'
labellen:
setname db 'SLIDESHOW'
setnamelen:
541,16 → 580,18
x_numofbytes dd 0
x_numofb2 dd 0
x_counter dd 0
winxo dw 0
winyo dw 0
winxs dw 0
winys dw 0
jpeg_st dd 0
file_dir dd 0
winxo: dw 0
winyo: dw 0
winxs: dw 0
winys: dw 0
jpeg_st: dd 0
file_dir: dd 0
work_area: dd 0
tcolor dd 0x000000
btcolor dd 0x224466+0x808080
name_string: db '/rd/1/jpegview.jpg',0
rb 256
 
rb 100
.end:
.cursor: db 19
.cursor2: db 0
571,5 → 612,5
fin:
I_END:
 
fileattr: rb 40
dirinfo: rb 32+304
 
 
/programs/media/jpegview/trunk/filelib.asm
1,46 → 1,52
file_handler:
.operation=0
.position=4
.reserved=8
.n_bytes=12
.bufer=16
.name=20
.st_size=20+1024
.position=0
.size=4
.bufer_block=8
.operation=12
.first_block=16
.n_blocks=20
.bufer=24
.work_area=28
.name=32
.st_size=32+128
 
open: ;esi=name_string
;retorna eax
pushad
push dword [work_area]
mov ecx,512 ;bufer
call malloc
push edi
mov ecx,file_handler.st_size
call mallocz
pop dword[edi+file_handler.bufer]
pop dword[edi+file_handler.work_area]
mov [esp+28],edi
push edi
mov ecx,1024
mov ecx,100
add edi,file_handler.name
call movedata
pop edi
; test if file exists
mov edi,[esp+28]
mov byte[edi+file_handler.n_blocks],1
mov eax,58
lea ebx,[edi+file_handler.operation]
mov byte[ebx],5
mov dword[ebx+16],fileattr
mov eax,70
push edi
int 0x40
cmp eax,2
jz .virtual
pop edi
test eax,eax
jnz close.b
@@:
mov [edi+file_handler.size],ebx
clc
popad
ret
.virtual:
mov byte [fileattr], 0x10
jmp @b
 
close:
pushad
.b:
mov edi,[esp+28]
mov eax,[esp+28]
mov edi,[eax+file_handler.bufer]
call free
mov edi,eax
call free
popad
xor eax,eax
ret
49,20 → 55,88
read: ;(f,bufer,nbytes) eax,edi,ecx ncr
;retorna bytes leidos en ecx
pushad
mov edx,[eax+file_handler.size]
sub edx,[eax+file_handler.position]
cmp edx,ecx
jnc .nb_ok
mov ecx,edx
mov [esp+24],edx
.nb_ok:
jecxz .final
mov byte[eax+file_handler.operation],0
test dword[eax+file_handler.position],511
jz .l1
call .bufer
.l1:
mov edx,ecx
shr edx,9
jz .l2
mov [eax+file_handler.n_blocks],edx
mov edx,[eax+file_handler.position]
shr edx,9
mov [eax+file_handler.first_block],edx
xchg edi,[eax+file_handler.bufer]
pushad
lea ebx, [eax+file_handler.operation]
mov byte [ebx], 0
mov [ebx+12], ecx
mov [ebx+16], edi
mov eax, 70
int 0x40
cmp ebx, -1
sbb ebx, -1
mov eax,58
int 40h
cmp eax,0ffffff00h
jnc .error
popad
xchg edi,[eax+file_handler.bufer]
mov edx,ecx
and edx,0fffffe00h
add [eax+file_handler.position],edx
add edi,edx
.l2:
and ecx,511
jz .final
call .bufer
.final:
popad
ret
 
.bufer:
pushad
mov ebx,[eax+file_handler.position]
shr ebx,9
cmp ebx,[eax+file_handler.bufer_block]
je .l3
mov [eax+file_handler.first_block],ebx
mov [eax+file_handler.bufer_block],ebx
mov dword[eax+file_handler.n_blocks],1
lea ebx,[eax+file_handler.operation]
mov eax,58
int 40h
cmp eax,0ffffff00h
jnc .error
.l3:
mov eax, [esp+28]
add [eax+file_handler.position], ebx
mov [esp+24], ebx
mov edx,[eax+file_handler.position]
mov esi,[eax+file_handler.bufer]
and edx,511
add esi,edx
neg edx
add edx,512
cmp ecx,edx
jc .l4
mov ecx,edx
.l4:
add [eax+file_handler.position],ecx
sub [esp+24],ecx
pop edi
call movedata
push edi
popad
ret
.error:
popad
popad
xor ecx,ecx
stc
ret
 
 
ftell: mov edx,[eax+file_handler.position]
ret
lseek: ;eax=file edx=pos
/programs/media/jpegview/trunk/jpeglib.asm
99,8 → 99,6
 
eoi:
mov esp,[ebp]
; do not close file - this will be done by caller
and dword [ebp+fichero], 0
call jpeg_close
popad
xor ebp,ebp
/programs/media/mv/trunk/mv.asm
32,16 → 32,20
cmp byte [temp_area],0
jz .no_param
mov edi,string ; clear string
mov ecx,256/4 ; length of a string
mov ecx,43*3 ; length of a string
xor eax,eax ; symbol <0>
rep stosd
add al,14h
cld
rep stosb
 
mov edi,temp_area ; look for <0> in temp_area
mov esi,edi
mov ecx,257 ; strlen
mov ecx,43*3+1 ; strlen
repne scasb
lea ecx, [edi-temp_area]
add edi,-temp_area ; get length of the string
dec edi
 
mov ecx,edi
mov esi,temp_area
mov edi,string
rep movsb ; copy string from temp_area to "string" (filename)
 
68,7 → 72,6
; ⥯¥àì ¢ ecx ­®¬¥à ¯à®æ¥áá 
mov [process],ecx
 
draw_still:
call draw_window
 
still:
76,35 → 79,40
mov eax,10 ; wait here for event
int 0x40
 
dec eax
jz red
dec eax
jnz button
cmp eax,1 ; redraw request ?
je red
cmp eax,2 ; key in buffer ?
je key
cmp eax,3 ; button in buffer ?
je button
 
jmp still
 
red:
bt [status],2
jnc @f
mov eax,18
mov ebx,3
mov ecx,[process]
int 0x40
btr [status],2
jmp still
@@:
call draw_window
jmp still
 
key: ; key
mov al,2
int 0x40
mov al,ah
cmp al,6
cmp ah,6
je kfile
cmp al,15
cmp ah,15
je kopen
cmp al,9
cmp ah,9
je kinfo
cmp al,2
cmp ah,2
je kbgrd
jmp still
 
red:
test byte [status], 4
jz draw_still
mov al, 18
mov ebx, 3
mov ecx, [process]
int 0x40
and byte [status], not 4
jmp still
 
button: ; button
mov eax,17 ; get id
int 0x40
118,9 → 126,9
cmp ah,2
jne nofile
kfile:
test byte [status], 1
jnz still
or byte [status], 1
bt dword [status],0
jc still
bts dword [status],0
mov eax,51
mov ebx,1
mov ecx,thread1
155,9 → 163,9
cmp ah,4
jne noinfo
kinfo:
test byte [status], 2
jnz still
or byte [status], 2
bt dword [status],1
jc still
bts dword [status],1
mov eax,51
mov ebx,1
mov ecx,thread2
170,9 → 178,9
cmp ah,5
jne still
kbgrd:
test byte [status], 8
jnz still
or byte [status], 8
bt dword [status],3
jc still
bts dword [status],3
mov eax,51
mov ebx,1
mov ecx,thread3
189,9 → 197,21
 
 
load_image:
mov eax, 70
mov dword [fileinfo+8],1 ; how many blocks to read (1)
mov eax,58
mov ebx, fileinfo
int 0x40
cmp [I_END+2],dword 512 ; à §¬¥à ä ©«  (file size)
jbe @f
mov eax,[I_END+2]
shr eax,9 ; ¯®¤¥«¨¬ ­  512 ¨ ¯à¨¡ ¢¨¬ 1 - ¯®«ã稬 ç¨á«® ¡«®ª®¢
inc eax
 
mov dword [fileinfo+8],eax
mov eax,58
mov ebx,fileinfo
int 0x40
@@:
mov eax,[I_END+18]
mov ebx,[I_END+22]
add eax,20
243,7 → 263,7
 
mov esi, ecx
imul esi, edx
lea esi, [esi+esi*2]
imul esi, 3
mov ebx,5
mov ecx,[soi]
xor edx,edx
262,14 → 282,12
convert:
movzx eax,word [I_END+28]
mul dword [I_END+18]
; mov ebx,32
; div ebx
; test edx,edx
; je noaddword
; inc eax
; noaddword:
add eax, 31
shr eax, 5
mov ebx,32
div ebx
test edx,edx
je noaddword
inc eax
noaddword:
mov [dwps],eax ;dwps-doublewords per string
shl eax,2
mov [bps],eax ;bps-bytes per string
444,8 → 462,7
 
lsz buttext,\
en, ' FILE OPEN INFO BGRD',\
ru, ' ”€‰‹ Ž’Š ˆ”Ž ”Ž ',\
de, 'DATEI OEFNEN INFO HGRD'
ru, ' ”€‰‹ Ž’Š ˆ”Ž ”Ž '
 
status dd 0 ;bit0=1 if file thread is created
bps dd 0
617,7 → 634,7
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
mov ecx,0x10ddeeff ; font 1 & color ( 0xF0RRGGBB )
mov edx,labelt1 ; pointer to text beginning
mov esi,labelt1.size ; text length
mov esi,4 ; text length
int 0x40
 
call drawstring
662,9 → 679,22
 
lsz labelt1,\
en, 'File',\
ru, '” ©«',\
de, 'Datei'
ru, '” ©«'
 
pos: dd 6
fileinfo:
dd 0
dd 0
dd 1 ;number of blocks of 512 bytes
dd I_END
dd temp_area
string:
; db '/HARDDISK/FIRST/1/DICK.BMP '
; db '/hd/1/menuet/pics/new.bmp '
db '/rd/1/bgr.bmp '
db ' '
db ' '
 
thread2: ; start of info thread
 
call draw_window2
793,8 → 823,7
 
lsz labelt2,\
en, 'File info',\
ru, 'ˆ­ä®à¬ æ¨ï ® ä ©«¥',\
de, 'Dateiinfo'
ru, 'ˆ­ä®à¬ æ¨ï ® ä ©«¥'
 
lsz fitext,\
en, 'FILE SIZE ',\
805,12 → 834,7
ru, ' §¬¥à ä ©«  ',\
ru, '˜¨à¨­  ',\
ru, '‚ëá®â  ',\
ru, '¨â ­  ¯¨ªá¥« ',\
\
de, 'FATEIGROESSE ',\
de, 'X GROESSE ',\
de, 'Y GROESSE ',\
de, 'BITS PER PIXEL'
ru, '¨â ­  ¯¨ªá¥« '
 
thread3: ; start of bgrd thread
 
915,7 → 939,7
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
mov ecx,0x10ddeeff ; font 1 & color ( 0xF0RRGGBB )
mov edx,labelt3 ; pointer to text beginning
mov esi,labelt3.size ; text length
mov esi,14 ; text length
int 0x40
add ebx,38*65536+20
mov ecx,0xddeeff
975,42 → 999,27
 
lsz labelt3,\
en, 'Background set',\
ru, "“áâ ­®¢ª  ä®­ ",\
de, 'Hintergrund gesetzt'
ru, "“áâ ­®¢ª  ä®­ "
 
lsz bgrdtext,\
en, 'SET AS BACKGROUND:',\
ru, '’¨¯ ®¡®¥¢:',\
de, 'ALS HINTERGRUND'
ru, '’¨¯ ®¡®¥¢:'
 
lsz tiled,\
en, 'TILED',\
ru, '§ ¬®áâ¨âì',\
de, 'GEKACHELT'
ru, '§ ¬®áâ¨âì'
 
lsz stretch,\
en, 'STRETCH',\
ru, 'à áâï­ãâì',\
de, 'GESTRECKT'
ru, 'à áâï­ãâì'
 
lsz ok_btn,\
en, 'Ok',\
ru, 'Ok',\
de, 'Ok'
ru, 'Ok'
 
pos: dd 6
fileinfo:
dd 0
dd 0
dd 0
dd 0x290000-I_END
dd I_END
string:
db '/rd/1/bgr.bmp',0
 
 
IM_END:
rb string+257-$
 
process_info:
temp_area:
rb 0x10000
/programs/media/gifview/trunk/gif_lite.inc
4,7 → 4,7
; This include file will contain functions to handle GIF image format
;
; Created: August 15, 2004
; Last changed: August 25, 2006
; Last changed: September 9, 2004
 
; Change COLOR_ORDER in your program
; if colors are displayed improperly
88,7 → 88,7
mov [.img_count],eax
inc eax
cmp dword[esi],'GIF8'
jne .ex ; signature
jne .er ; signature
mov ecx,[esi+0xa]
inc eax
add esi,0xd
123,7 → 123,7
jmp .block_skip
.noextblock:
cmp byte[edi],0x2c ; image beginning
jne .ex
jne .er
inc [.img_count]
inc edi
mov esi,[.cur_info]
211,6 → 211,9
call .Gif_output
pop ebx eax
jmp .add
.er:
pop edi
jmp .ex
.end:
mov eax,[.cur_info]
mov [eax],edi
/programs/media/gifview/trunk/gifview.asm
4,7 → 4,7
; Uses GIF_LITE 2.0
;
; Created: August 31, 2004
; Last changed: August 25, 2006
; Last changed: September 9, 2004
;
; COMPILE WITH FASM
 
50,9 → 50,9
mov edi,filename
mov ecx,[inp_pos]
rep movsb
stosb
mov byte[edi],al
openfile2:
mov eax,70
mov eax,58
mov ebx,file_info
int 0x40
cmp eax,6
60,8 → 60,8
test eax,eax
jnz ok2
temp:
; cmp ebx,64
; jbe ok2
cmp ebx,64
jbe ok2
 
and [entered],0
xor eax,eax
68,11 → 68,11
mov [imgcount],eax
mov esi,filename
mov edi,fn_input
mov ecx,256/4 ;[filename_len]
rep movsd
mov ecx,256 ;[filename_len]
rep movsb
 
mov edi,fn_input
mov ecx,256
mov ecx,50
xor eax,eax
repne scasb
sub edi,fn_input
101,22 → 101,16
call draw_window
 
still:
cmp [imgcount], 1
jnz .delay
mov eax, 10
int 0x40
jmp @f
.delay:
mov ebx,DELAY
mov eax,23
int 0x40
@@:
dec eax
jz red
dec eax
jz key
dec eax
jz button
 
cmp eax,1
je red
cmp eax,2
je key
cmp eax,3
je button
mov eax,[imgcount]
cmp eax,1
je still
173,7 → 167,7
jz wait_input
dec [inp_pos]
jmp wait_input
; jmp still
jmp still
 
;****************************************
;******* DRAW CONTENTS OF INPUT LINE ****
296,9 → 290,9
file_info:
dd 0
dd 0
dd 0
dd 0x100000;0x200000
dd workarea;0x100000
dd 0x100000/512;0x200000
dd workarea
dd Image;0x100000
I_END: ; ª®­¥æ ¯à®£à ¬¬ë
filename:
; db '/hd/1/gif/smileys/sm112000.gif',0
306,7 → 300,7
; db '/hd/1/gif/explode1.gif',0
; db '/hd/1/gif/tapeta.gif',0
; db '/hd/1/gif/meos.gif',0
rb 257
rb 256
;filename_len dd 0
entered rd 1
 
/programs/media/gifview/trunk/macros.inc
123,10 → 123,8
end if
}
 
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
macro __mov reg,a { ; mike.dld
if ~a eq
mov reg,a
end if
}
143,6 → 141,10
 
 
 
 
 
 
 
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
 
174,7 → 176,7
 
macro mov arg1,arg2
{
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
if (arg1 in __regs) & (arg2 eqtype 0)
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1