diff --git a/kernel/branches/gfx_kernel/boot/bootcode.inc b/kernel/branches/gfx_kernel/boot/bootcode.inc index 54b6179d2c..42169a74e0 100644 --- a/kernel/branches/gfx_kernel/boot/bootcode.inc +++ b/kernel/branches/gfx_kernel/boot/bootcode.inc @@ -152,6 +152,26 @@ pagetable_set: loop @b ret +boot_read_floppy: + push si + xor si, si + mov ah, 2 ; read +@@: + push ax + int 0x13 + pop ax + jnc @f + inc si + cmp si, 10 + jb @b + mov si, badsect-0x10000 +sayerr_plain: + call printplain + jmp $ +@@: + pop si + ret + org $+0x10000 ; table for move to extended memory (int 15h, ah=87h) @@ -824,73 +844,195 @@ end if xor ax, ax ; reset drive xor dx, dx int 0x13 - mov cx,0x0001 ; startcyl,startsector - xor dx, dx ; starthead,drive - push word 80*2 ; read no of sect - reads: - pusha - xor si,si - newread: - mov bx,0xa000 ; es:bx -> data area - mov ax,0x0200+18 ; read, no of sectors to read - int 0x13 - test ah, ah - jz goodread - inc si - cmp si,10 - jnz newread - mov si,badsect-0x10000 -sayerr_plain: - call printplain - jmp $ - goodread: - ; move -> 1mb - mov si,movedesc-0x10000 +; now load floppy image to memory +; at first load boot sector and first FAT table + mov cx, 0x0001 ; startcyl,startsector + xor dx, dx ; starthead,drive + mov al, 1+9 ; no of sectors to read + mov bx, 0xB000 ; es:bx -> data area + call boot_read_floppy +; and copy them to extended memory + mov si, movedesc-0x10000 + mov [si+8*2+3], bh push es push ds pop es - mov cx,256*18 - mov ah,0x87 + mov cx, 256*10 + mov ah, 0x87 int 0x15 - pop es - - test ah,ah ; was the move successfull ? - je goodmove - mov dx,0x3f2 ; floppy motor off - mov al,0 - out dx,al - mov si,memmovefailed-0x10000 - jmp sayerr_plain - goodmove: - - add dword [movedesc-0x10000+0x18+2], 512*18 - popa - inc dh - cmp dh,2 - jnz bb2 - mov dh,0 - inc ch - pusha ; print prosentage - mov si,pros-0x10000 - shr ch, 2 - mov al, '5' - test ch, 1 - jnz @f - mov al, '0' + test ah, ah + jz @f +sayerr_floppy: + mov dx, 0x3f2 + mov al, 0 + out dx, al + mov si, memmovefailed-0x10000 + jmp sayerr_plain @@: - mov [si+1], al - shr ch, 1 - add ch, '0' - mov [si], ch - call printplain - popa - bb2: - pop ax - dec ax + add dword [si+8*3+2], 512*10 +; copy FAT to second copy + mov byte [si+8*2+3], 0xB2 + mov cx, 256*9 + mov ah, 0x87 + int 0x15 + pop es + test ah, ah + jnz sayerr_floppy + add dword [si+8*3+2], 512*9 +; calculate total number of sectors to read + mov ax, 1+9+14 ; boot+FAT+root + mov di, 0xB203 +.calc_loop: + test word [es:di], 0xFFF + jz @f + inc ax +@@: + test word [es:di+1], 0xFFF0 + jz @f + inc ax +@@: + add di, 3 + cmp di, 0xB200+1440*3 + jb .calc_loop push ax - jnz reads - readdone: + mov bp, 1+9 ; already read sectors +; now read rest + mov byte [si+8*2+3], 0xA0 + mov di, 2-14 ; absolute sector-31 + mov cx, 0x0002 ; cylinder=0, sector=2 + mov dx, 0x0100 ; head=1, disk=0 +.read_loop: +; determine whether sector must be read + cmp di, 2 + jl .read + mov bx, di + shr bx, 1 + jnc .even + test word [es:bx+di+0xB200], 0xFFF0 + jmp @f +.even: + test word [es:bx+di+0xB200], 0xFFF +@@: + jz .skip +.read: + mov bx, 0xA000 + mov al, 1 ; 1 sector + call boot_read_floppy + inc bp + push es + push ds + pop es + pusha + mov cx, 256 + mov ah, 0x87 + int 0x15 + test ah, ah + popa + pop es + jnz sayerr_floppy +.skip: + add dword [si+8*3+2], 512 + inc cx + cmp cl, 19 + jnz @f + mov cl, 1 + inc dh + cmp dh, 2 + jnz @f + mov dh, 0 + inc ch +@@: pop ax + push ax + pusha +; draw percentage +; total sectors: ax +; read sectors: bp + xchg ax, bp + mov cx, 100 + mul cx + div bp + aam + xchg al, ah + add ax, '00' + mov si, pros-0x10000 + cmp [si], ax + jz @f + mov [si], ax + call printplain +@@: + popa + inc di + cmp di, 2880-31 + jnz .read_loop + +; mov cx,0x0001 ; startcyl,startsector +; xor dx, dx ; starthead,drive +; push word 80*2 ; read no of sect +; reads: +; pusha +; xor si,si +; newread: +; mov bx,0xa000 ; es:bx -> data area +; mov ax,0x0200+18 ; read, no of sectors to read +; int 0x13 +; test ah, ah +; jz goodread +; inc si +; cmp si,10 +; jnz newread +; mov si,badsect-0x10000 +;sayerr_plain: +; call printplain +; jmp $ +; goodread: +; ; move -> 1mb +; mov si,movedesc-0x10000 +; push es +; push ds +; pop es +; mov cx,256*18 +; mov ah,0x87 +; int 0x15 +; pop es +; +; test ah,ah ; was the move successfull ? +; je goodmove +; mov dx,0x3f2 ; floppy motor off +; mov al,0 +; out dx,al +; mov si,memmovefailed-0x10000 +; jmp sayerr_plain +; goodmove: +; +; add dword [movedesc-0x10000+0x18+2], 512*18 +; popa +; inc dh +; cmp dh,2 +; jnz bb2 +; mov dh,0 +; inc ch +; pusha ; print prosentage +; mov si,pros-0x10000 +; shr ch, 2 +; mov al, '5' +; test ch, 1 +; jnz @f +; mov al, '0' +;@@: +; mov [si+1], al +; shr ch, 1 +; add ch, '0' +; mov [si], ch +; call printplain +; popa +; bb2: +; pop ax +; dec ax +; push ax +; jnz reads +; readdone: +; pop ax mov si,backspace2-0x10000 call printplain mov si,okt-0x10000 diff --git a/kernel/branches/gfx_kernel/boot/booteng.inc b/kernel/branches/gfx_kernel/boot/booteng.inc index 62176b2257..6fb6437c52 100644 --- a/kernel/branches/gfx_kernel/boot/booteng.inc +++ b/kernel/branches/gfx_kernel/boot/booteng.inc @@ -62,7 +62,8 @@ s_vesa db "VESA version: " .mem db "??? Mbytes)",13,10,0 gr_mode db "Select mode: ",13,10,0 s_bpp db 13,10,186," Bits per pixel: " - .bpp dw "??",13,10,13,10,0 + .bpp dw "??" + db 13,10,0 vrrmprint db "Apply VRR? (picture frequency greater than 60Hz" db " only for transfers:",13,10 db 186," 1024*768->800*600 and 800*600->640*480) [1-yes,2-no]:",0 diff --git a/kernel/branches/gfx_kernel/boot/bootru.inc b/kernel/branches/gfx_kernel/boot/bootru.inc index 584bf169e3..9fc3049b5b 100644 --- a/kernel/branches/gfx_kernel/boot/bootru.inc +++ b/kernel/branches/gfx_kernel/boot/bootru.inc @@ -24,10 +24,10 @@ macro line_space { times 78 db 32 db 186 } + d80x25_top: line_full_top -space_msg: line_space -verstr: +verstr2: ; line_space ; version string db 186,32 @@ -38,12 +38,14 @@ verstr: end if db a end repeat - repeat 78 - ($-verstr) + repeat 78 - ($-verstr2) db ' ' end repeat db 32,186 +verstr: line_half -d80x25_top_num = 4 +space_msg: line_space +d80x25_top_num = 3 d80x25_bottom: db 186,' Kolibri OS основана на Menuet OS и не предоставляет ' db 'никаких гарaнтий. ',186 @@ -52,43 +54,26 @@ d80x25_bottom: line_full_bottom d80x25_bottom_num = 3 +msg_apm db " APM x.x ",0 + novesa db "Видеокарта: EGA/CGA",13,10,0 -vervesa db "Версия VESA: Vesa x.x",13,10,0 -vervesa_off=19 -gr_mode db 186," Vesa 2.0+ 16 M LFB: [1] 640x480, [2] 800x600, " - db "[3] 1024x768, [4] 1280x1024",13,10 - db 186," Vesa 1.2 16 M Bnk: [5] 640x480, [6] 800x600, " - db "[7] 1024x768, [8] 1280x1024",13,10 - db 186," EGA/CGA 256 Цветов: [9] 320x200, " - db "VGA 16 Цветов: [0] 640x480",13,10 - db 186," Выберите видеорежим: ",0 -bt24 db "Глубина цвета: 24",13,10,0 -bt32 db "Глубина цвета: 32",13,10,0 +s_vesa db "Версия VESA: " + .ver db "?.? (" + .mem db "??? Мб)",13,10,0 +gr_mode db "Выберите видеорежим: ",13,10,0 +s_bpp db 13,10,186," Глубина цвета: " + .bpp dw "??" + db 13,10,0 vrrmprint db "Использовать VRR? (частота кадров выше 60 Гц" db " только для переходов:",13,10 db 186," 1024*768>800*600 и 800*600>640*480) [1-да, 2-нет]: ",0 -;askmouse db "Мышь:" ; 186, " " -; db " [1] PS/2 (USB), [2] Com1, [3] Com2." -; db " Выберите порт [1-3]: ",0 -;no_com1 db 13,10,186," No COM1 mouse",0 -;no_com2 db 13,10,186," No COM2 mouse",0 gr_acc db "Vesa 2.0+: Включить MTRR для ускорения графики? " db "[1-да/2-нет]: ",0 -;gr_direct db 186," Использовать линейный видеобуфер? " -; db "[1-да/2-нет]: ",0 -;mem_model db 13,10,186," Объ+м памяти [1-16 Mb / 2-32 Mb / " -; db "3-64Mb / 4-128 Mb / 5-256 Mb]: ",0 -;bootlog db 13,10,186," Просмотреть журнал загрузки? [1-нет/2-да]: ",0 bdev db "Загрузить образ из [1-дискета; 2-C:\menuet.img (FAT32);" db 13,10,186," " db "3-использовать уже загруженный образ]: ",0 probetext db 13,10,13,10,186," Стандартный видеорежим? [1-да, " db "2-проверить другие (Vesa 3.0)]: ",0 -;memokz256 db 13,10,186," RAM 256 Mb",0 -;memokz128 db 13,10,186," RAM 128 Mb",0 -;memokz64 db 13,10,186," RAM 64 Mb",0 -;memokz32 db 13,10,186," RAM 32 Mb",0 -;memokz16 db 13,10,186," RAM 16 Mb",0 prnotfnd db "Ошибка - Видеорежим не найден.",0 ;modena db "Ошибка - Требуется поддержка VBE 0x112+.",0 not386 db "Ошибка - Требуется процессор 386+.",0 @@ -131,3 +116,33 @@ pdm3 db " loading_msg db "Идёт загрузка KolibriOS...",0 save_quest db "Запомнить текущие настройки? [y/n]: ",0 loader_block_error db "Ошибка в данных начального загрузчика, продолжение невозможно.",0 + +_oem db 'oem: ',0 + +db 5 +s_ven_intel db 'Intel' +db 2 +s_ven_s3 db 'S3' +;db 5 +;s_ven_bochs db 'Bochs' +;db 8 +;s_ven_vmware db 'V M ware' + +s_mode db " ????-????-?? (?) ",0 +s_mode1 db " 0640-0480-04 (a) 0320-0200-08 (b) ",13,10,0 + +;_tl db '┌────────────┬─────┬─────┬─────┬─────┬─────┬─────┐',13,10,\ +; '│ разрешение │ 4 │ 8 │ 15 │ 16 │ 24 │ 32 │',13,10,\ +; '├────────────┼─────┼─────┼─────┼─────┼─────┼─────┤',13,10,0 +;_rs db '│ ????x???? │ - │ - │ - │ - │ - │ - │',13,10,0 +;_bt db '└────────────┴─────┴─────┴─────┴─────┴─────┴─────┘',13,10,0 + +_tl db 186,' ┌─────┬─────┬─────┬─────┬─────┬─────┐',13,10,\ + 186,' │ 4 │ 8 │ 15 │ 16 │ 24 │ 32 │',13,10,\ + 186,' ┌───────────┼─────┼─────┼─────┼─────┼─────┼─────┼─┐',13,10,0 +_rs db 186,' │ ????x???? │ ? │ ? │ ? │ ? │ ? │ ? │█│',13,10,0 +_bt db 186,' └───────────┴─────┴─────┴─────┴─────┴─────┴─────┴─┘',13,10,0 + + +_sel1 db 0x1A,0 +_sel2 db 0x1B,0 diff --git a/kernel/trunk/boot/bootcode.inc b/kernel/trunk/boot/bootcode.inc index c54b496199..37d35e9a1b 100644 --- a/kernel/trunk/boot/bootcode.inc +++ b/kernel/trunk/boot/bootcode.inc @@ -150,6 +150,26 @@ pagetable_set: loop @b ret +boot_read_floppy: + push si + xor si, si + mov ah, 2 ; read +@@: + push ax + int 0x13 + pop ax + jnc @f + inc si + cmp si, 10 + jb @b + mov si, badsect-0x10000 +sayerr_plain: + call printplain + jmp $ +@@: + pop si + ret + ; 16-bit data ; videomodes table org $+0x10000 @@ -210,6 +230,7 @@ start_of_code: mov ax, 3 int 0x10 +if lang eq ru ; Load & set russian VGA font (RU.INC) mov bp,RU_FNT1-10000h ; RU_FNT1 - First part mov bx,1000h ; 768 bytes @@ -225,6 +246,7 @@ start_of_code: mov ax,1100h int 10h ; End set VGA russian font +end if ; draw frames push 0xb800 @@ -960,73 +982,195 @@ end if xor ax, ax ; reset drive xor dx, dx int 0x13 - mov cx,0x0001 ; startcyl,startsector - xor dx, dx ; starthead,drive - push word 80*2 ; read no of sect - reads: - pusha - xor si,si - newread: - mov bx,0xa000 ; es:bx -> data area - mov ax,0x0200+18 ; read, no of sectors to read - int 0x13 - test ah, ah - jz goodread - inc si - cmp si,10 - jnz newread - mov si,badsect-0x10000 -sayerr_plain: - call printplain - jmp $ - goodread: - ; move -> 1mb - mov si,movedesc-0x10000 +; now load floppy image to memory +; at first load boot sector and first FAT table + mov cx, 0x0001 ; startcyl,startsector + xor dx, dx ; starthead,drive + mov al, 1+9 ; no of sectors to read + mov bx, 0xB000 ; es:bx -> data area + call boot_read_floppy +; and copy them to extended memory + mov si, movedesc-0x10000 + mov [si+8*2+3], bh push es push ds pop es - mov cx,256*18 - mov ah,0x87 + mov cx, 256*10 + mov ah, 0x87 int 0x15 - pop es - - test ah,ah ; was the move successfull ? - je goodmove - mov dx,0x3f2 ; floppy motor off - mov al,0 - out dx,al - mov si,memmovefailed-0x10000 - jmp sayerr_plain - goodmove: - - add dword [movedesc-0x10000+0x18+2], 512*18 - popa - inc dh - cmp dh,2 - jnz bb2 - mov dh,0 - inc ch - pusha ; print prosentage - mov si,pros-0x10000 - shr ch, 2 - mov al, '5' - test ch, 1 - jnz @f - mov al, '0' + test ah, ah + jz @f +sayerr_floppy: + mov dx, 0x3f2 + mov al, 0 + out dx, al + mov si, memmovefailed-0x10000 + jmp sayerr_plain @@: - mov [si+1], al - shr ch, 1 - add ch, '0' - mov [si], ch - call printplain - popa - bb2: - pop ax - dec ax + add dword [si+8*3+2], 512*10 +; copy FAT to second copy + mov byte [si+8*2+3], 0xB2 + mov cx, 256*9 + mov ah, 0x87 + int 0x15 + pop es + test ah, ah + jnz sayerr_floppy + add dword [si+8*3+2], 512*9 +; calculate total number of sectors to read + mov ax, 1+9+14 ; boot+FAT+root + mov di, 0xB203 +.calc_loop: + test word [es:di], 0xFFF + jz @f + inc ax +@@: + test word [es:di+1], 0xFFF0 + jz @f + inc ax +@@: + add di, 3 + cmp di, 0xB200+1440*3 + jb .calc_loop push ax - jnz reads - readdone: + mov bp, 1+9 ; already read sectors +; now read rest + mov byte [si+8*2+3], 0xA0 + mov di, 2-14 ; absolute sector-31 + mov cx, 0x0002 ; cylinder=0, sector=2 + mov dx, 0x0100 ; head=1, disk=0 +.read_loop: +; determine whether sector must be read + cmp di, 2 + jl .read + mov bx, di + shr bx, 1 + jnc .even + test word [es:bx+di+0xB200], 0xFFF0 + jmp @f +.even: + test word [es:bx+di+0xB200], 0xFFF +@@: + jz .skip +.read: + mov bx, 0xA000 + mov al, 1 ; 1 sector + call boot_read_floppy + inc bp + push es + push ds + pop es + pusha + mov cx, 256 + mov ah, 0x87 + int 0x15 + test ah, ah + popa + pop es + jnz sayerr_floppy +.skip: + add dword [si+8*3+2], 512 + inc cx + cmp cl, 19 + jnz @f + mov cl, 1 + inc dh + cmp dh, 2 + jnz @f + mov dh, 0 + inc ch +@@: pop ax + push ax + pusha +; draw percentage +; total sectors: ax +; read sectors: bp + xchg ax, bp + mov cx, 100 + mul cx + div bp + aam + xchg al, ah + add ax, '00' + mov si, pros-0x10000 + cmp [si], ax + jz @f + mov [si], ax + call printplain +@@: + popa + inc di + cmp di, 2880-31 + jnz .read_loop + +; mov cx, 0x0001 ; startcyl,startsector +; xor dx, dx ; starthead,drive +; push word 80*2 ; read no of sect +; reads: +; pusha +; xor si,si +; newread: +; mov bx,0xa000 ; es:bx -> data area +; mov ax,0x0200+18 ; read, no of sectors to read +; int 0x13 +; test ah, ah +; jz goodread +; inc si +; cmp si,10 +; jnz newread +; mov si,badsect-0x10000 +;sayerr_plain: +; call printplain +; jmp $ +; goodread: +; ; move -> 1mb +; mov si,movedesc-0x10000 +; push es +; push ds +; pop es +; mov cx,256*18 +; mov ah,0x87 +; int 0x15 +; pop es +; +; test ah,ah ; was the move successfull ? +; je goodmove +; mov dx,0x3f2 ; floppy motor off +; mov al,0 +; out dx,al +; mov si,memmovefailed-0x10000 +; jmp sayerr_plain +; goodmove: +; +; add dword [movedesc-0x10000+0x18+2], 512*18 +; popa +; inc dh +; cmp dh,2 +; jnz bb2 +; mov dh,0 +; inc ch +; pusha ; print prosentage +; mov si,pros-0x10000 +; shr ch, 2 +; mov al, '5' +; test ch, 1 +; jnz @f +; mov al, '0' +;@@: +; mov [si+1], al +; shr ch, 1 +; add ch, '0' +; mov [si], ch +; call printplain +; popa +; bb2: +; pop ax +; dec ax +; push ax +; jnz reads +; readdone: +; pop ax mov si,backspace2-0x10000 call printplain mov si,okt-0x10000 diff --git a/programs/fs/copyr/trunk/ascl.inc b/programs/fs/copyr/trunk/ascl.inc index 20a18bf31d..209ac6d0cc 100644 --- a/programs/fs/copyr/trunk/ascl.inc +++ b/programs/fs/copyr/trunk/ascl.inc @@ -1,5 +1,3 @@ -lang equ ru ; ru en fr ge fi - ; ; Assembler ; SMALL diff --git a/programs/fs/copyr/trunk/copyr.asm b/programs/fs/copyr/trunk/copyr.asm index a3bf7ab247..8ba3358bf6 100644 --- a/programs/fs/copyr/trunk/copyr.asm +++ b/programs/fs/copyr/trunk/copyr.asm @@ -19,7 +19,7 @@ dd 0x01 ; header version dd START ; start of code dd I_END ; size of image - dd 0x20000 ; memory for app + dd 0x10000 ; memory for app dd 0x10000 ; esp dd param_area , 0x0 ; I_Param , I_Icon @@ -27,49 +27,30 @@ include 'lang.inc' include 'macros.inc' ; very useful stuff for MeOS include 'ascl.inc' -STRLEN = 48 ; maximal length of filename - - START: ; start of execution ; Параметры: -; от 0 до 100 путь к источнику -; от 100 до 200 путь к приемнику -; +; db n1 = длина пути к источнику +; times n1 db ? = путь к источнику +; db n2 = длина пути к приёмнику +; times n2 db ? = путь к приёмнику +; db 0 + ;get param - mov eax,15 - cmp byte [param_area],0 - je err_exit ;source not found - mov eax,16 - cmp byte [param_area+100],0 - je err_exit ;dest not found - - mov ecx,199 -cdf: - mov al,[param_area+ecx] - cmp al,byte 32 - jne nor - mov al,byte 0 -nor: - mov al,[param_area+ecx] - dec ecx - jns cdf - - mov ecx,STRLEN - 4 -copysp: - mov al,[param_area+ecx] - mov [source+ecx],al - dec ecx - jns copysp - mov [source+42],byte 0 - - mov ecx,STRLEN - 4 -copydp: - mov al,[param_area+ecx+100] - mov [destination+ecx],al - dec ecx - jns copydp - mov [destination+42],byte 0 + mov eax, 15 + lea esi, [param_area+1] + movzx ecx, byte [esi-1] + jecxz err_exit + mov edi, source + rep movsb + mov byte [edi], 0 + inc eax + movzx ecx, byte [esi] + inc esi + jecxz err_exit + mov edi, destination + rep movsb + mov byte [edi], 0 call draw_window call copy_file @@ -90,19 +71,16 @@ err_exit: push eax call draw_window pop eax - jmp copy_error +; jmp copy_error ; print message now copy_error: - mov ebp,43 - mul ebp - mov ebp,eax + imul ebp, eax, 43 mov eax,4 mov ebx,20*65536+70 mov ecx,0x10ff0000 - mov edx,errors ;*8] - add edx,ebp + lea edx,[errors+ebp] mov esi,43 ;[errors+edi*8+4] int 0x40 jmp dexit @@ -122,10 +100,10 @@ copy_error: ;==================================================== copy_file: ; at first we must get the size of the source file - mov [source_info.blocks],1 ; load only 512 bytes - mov eax,58 - mov ebx,source_info - int 0x40 + mov dword [source_attr+32], 0 + mov eax, 70 + mov ebx, source_attr_info + int 0x40 ; now eax contains error code ; and ebx contains file size in bytes @@ -141,9 +119,9 @@ copy_file: .ok_getsize: ; allocate memory + mov ebx,[source_attr+32] push ebx ; save file size - mov ecx,ebx - add ecx,0x20000 ; size of memory needed = 0x20000+filesize + lea ecx,[ebx+0x10000] ; size of memory needed = 0x10000+filesize mov eax,64 ; func 64 mov ebx,1 ; resize application memory int 0x40 @@ -157,18 +135,16 @@ copy_file: .ok_memory: ; save number of blocks to source_info - shr ebx,9 ; divide by 512 - inc ebx ; blocks++ - mov [source_info.blocks],ebx + mov [source_info.bytes], ebx ; read the source file - mov eax,58 + mov eax,70 mov ebx,source_info int 0x40 - ; ebx = file size + ; ebx = number of read bytes = file size ; save loaded file - mov [dest_info.bytes2write],ebx ; file size in bytes - mov eax,58 + mov [dest_info.bytes],ebx ; file size in bytes + mov eax,70 mov ebx,dest_info int 0x40 @@ -185,30 +161,11 @@ copy_file: ; return to the initial amount of memory mov eax,64 mov ebx,1 - mov ecx,0x20000 + mov ecx,0x10000 int 0x40 xor eax,eax ; eax = message number (0-OK) - -; print strings (source & destination) -print_text: - mov eax,13 - mov ebx,107*65536+STRLEN*6 - mov ecx,[ya] - shl ecx,16 - add ecx,9 - mov edx,0xf2f2f2 - int 0x40 - - mov eax,4 - mov ebx,109*65536 - add ebx,[ya] - xor ecx,ecx - mov edx,[addr] - mov esi,STRLEN - int 0x40 - - ret + jmp copy_error ; ********************************************* @@ -251,23 +208,23 @@ draw_window: mov esi,source mov edi,text+14 - mov ecx,STRLEN + mov ecx,47 rep movsb mov esi,destination - mov edi,text+STRLEN+59-45+14 - mov ecx,STRLEN + mov edi,text+62+14 + mov ecx,47 rep movsb mov ebx,25*65536+36 ; print filenames xor ecx,ecx mov edx,text - mov esi,STRLEN+59-45 + mov esi,62 newline: mov eax,4 int 0x40 add ebx,16 - add edx,STRLEN+59-45 + add edx,62 cmp [edx],byte 'x' jnz newline @@ -279,43 +236,20 @@ draw_window: ; DATA AREA -align 4 - -param_area: -times 256 db 0 - -source_info: ; SOURCE FILEINFO - .mode dd 0 ; read file - .start_block dd 0x0 ; block to read - .blocks dd 0x700 ; num of blocks - .address dd 0x20000 - .workarea dd 0x10000 - source: - times (STRLEN) db 32 - db 0 - -dest_info: ; DESTINATION FILEINFO - .mode dd 1 ; write - .notused dd 0x0 ; not used - .bytes2write dd 0 ; bytes to write - .address dd 0x20000 - .workarea dd 0x10000 - destination: - times (STRLEN) db 32 - db 0 align 4 addr dd 0x0 ya dd 0x0 temp dd 0 +if lang eq ru text: db ' ОТКУДА: |Россия, Селятино, МПК Москва , 1 Курс ' db ' КУДА: | Павлюшин Евгений, waptap@mail.ru ' db ' ' db 'x' ; <- END MARKER, DONT DELETE labelt: - db 'КОПИРОВАИЕ ФАЙЛА' + db 'КОПИРОВАНИЕ ФАЙЛА' labellen: errors: @@ -336,6 +270,70 @@ errors: db "(запись) неизвестная ошибка " db "Путь к источнику и приемнику не указаны!!! " db "Путь к приемнику не указан!!! " +else +text: + db 'SOURCE: | ' + db 'DESTINATION: | ' + db ' ' + db 'x' ; <- END MARKER, DONT DELETE +labelt: + db 'SYSTREE FILE COPIER' +labellen: + +errors: + db "Success! " + db "(read) no hd base or partition defined " + db "(read) unsupported file system " + db "(read) unknown file system " + db "(read) hd partition not defined " + db "out of memory " + db "(read) end of file " + db "(read) unknown error " + db "(write) no hd base or partition defined " + db "(write) unsupported file system " + db "(write) unknown file system " + db "(write) hd partition not defined " + db "oh shit! " + db "(write) file not found " + db "(write) unknown error " + db "Path to source is not given!!! " + db "Path to destination is not given!!! " +end if ;0123456789012345678901234567890123456789012 -I_END: \ No newline at end of file + +source_attr_info: + dd 5 + dd 0 + dd 0 + dd 0 + dd source_attr + db 0 + dd source + +source_info: + dd 0 + dd 0 ; start from 1st byte + dd 0 +.bytes dd ? + dd 0x10000 + db 0 + dd source + +dest_info: ; DESTINATION FILEINFO + dd 2 + dd 0 + dd 0 +.bytes dd ? + dd 0x10000 + +I_END: + +destination: + rb 256 +source: + rb 256 +source_attr: + rb 40 + +param_area rb 256 diff --git a/programs/fs/sysxtree/trunk/ascl.inc b/programs/fs/sysxtree/trunk/ascl.inc index 515a4520a8..0350a8cb7a 100644 --- a/programs/fs/sysxtree/trunk/ascl.inc +++ b/programs/fs/sysxtree/trunk/ascl.inc @@ -186,9 +186,9 @@ local dlg_is_work, ready, procinfo cld ;; mov esi,path mov edi,path - mov eax,0 - mov ecx,200 - rep stosb + xor eax,eax + mov ecx,(1024+16)/4 + rep stosd ;mov [get_loops],0 mov [dlg_pid_get],0 @@ -230,7 +230,7 @@ new_d: mov eax,60 mov ebx,1 ; define IPC mov ecx,path ; offset of area - mov edx,150 ; size 150 bytes + mov edx,1024+16 ; size int 0x40 ; change wanted events list 7-bit IPC event @@ -242,7 +242,7 @@ new_d: ; STEP 3 run SYSTEM XTREE with parameters ; - mov eax,58 + mov eax,70 mov ebx,run_fileinfo int 0x40 @@ -253,15 +253,14 @@ getmesloop: mov eax,23 mov ebx,50 ;0.5 sec int 0x40 - - cmp eax,1 - je mred - cmp eax,2 - je mkey - cmp eax,3 - je mbutton - cmp eax,7 - je mgetmes + dec eax + jz mred + dec eax + jz mkey + dec eax + jz mbutton + cmp al, 7-3 + jz mgetmes ; Get number of procces mov ebx,procinfo @@ -348,14 +347,14 @@ mgetmes: ready: ; ; The second message get -; Second message is 100 bytes path to SAVE/OPEN file +; Second message is 1024 bytes path to SAVE/OPEN file ; shl path string on 16 bytes ; cld mov esi,path+16 mov edi,path - mov ecx,200 - rep movsb + mov ecx,1024/4 + rep movsd mov [edi],byte 0 jmp openoff @@ -371,11 +370,11 @@ param: dd 0,0 ; Type of dialog run_fileinfo: - dd 16 + dd 7 dd 0 dd param dd 0 - dd procinfo ; 0x10000 + dd 0 ;run_filepath db '/RD/1/SYSXTREE',0 @@ -398,9 +397,9 @@ local dlg_is_work, ready, procinfo cld ;; mov esi,path mov edi,path - mov eax,0 - mov ecx,200 - rep stosb + xor eax,eax + mov ecx,(1024+16)/4 + rep stosd ;mov [get_loops],0 mov [dlg_pid_get],0 @@ -442,7 +441,7 @@ new_d: mov eax,60 mov ebx,1 ; define IPC mov ecx,path ; offset of area - mov edx,150 ; size 150 bytes + mov edx,1024+16 ; size int 0x40 ; change wanted events list 7-bit IPC event @@ -454,7 +453,7 @@ new_d: ; STEP 3 run SYSTEM XTREE with parameters ; - mov eax,58 + mov eax,70 mov ebx,run_fileinfo int 0x40 @@ -465,15 +464,14 @@ getmesloop: mov eax,23 mov ebx,50 ;0.5 sec int 0x40 - - cmp eax,1 - je mred - cmp eax,2 - je mkey - cmp eax,3 - je mbutton - cmp eax,7 - je mgetmes + dec eax + jz mred + dec eax + jz mkey + dec eax + jz mbutton + cmp al, 7-3 + jz mgetmes ; Get number of procces mov ebx,procinfo @@ -560,14 +558,14 @@ mgetmes: ready: ; ; The second message get -; Second message is 100 bytes path to SAVE/OPEN file +; Second message is 1024 bytes path to SAVE/OPEN file ; shl path string on 16 bytes ; cld mov esi,path+16 mov edi,path - mov ecx,200 - rep movsb + mov ecx,1024/4 + rep movsd mov [edi],byte 0 jmp openoff @@ -583,11 +581,11 @@ param: dd 0,0 ; Type of dialog run_fileinfo: - dd 16 + dd 7 dd 0 dd param dd 0 - dd procinfo + dd 0 ;run_filepath: db '/RD/1/SYSXTREE',0 diff --git a/programs/fs/sysxtree/trunk/sysxtree.asm b/programs/fs/sysxtree/trunk/sysxtree.asm index ad73a4bc23..11e413250c 100644 --- a/programs/fs/sysxtree/trunk/sysxtree.asm +++ b/programs/fs/sysxtree/trunk/sysxtree.asm @@ -27,7 +27,8 @@ ;79Ver Asko Vuori volume label add and "put in command line" bug fix ;80Ver prompt edit fatal bug deleted, antiflick when move list up/down ;81Ver Save Dialog bug deleted -;600000 bytes memory! +;82Ver Rewritten to function 70. Corrected work with scrollbar. +;1560000 bytes memory! ;****************************************************************************** use32 @@ -55,30 +56,21 @@ START: ; start of execution ; int 0x40 ; //// Willow mcall 18,11,1,table_area - mov edi,hdimg+62*2 - cmp [table_area+2],byte 0 + cmp [edx+2],byte 0 je no_hdpartition_on_hd0 - mov esi,hdimg1 - mov ecx,62 - rep movsb + mov [hdimg1], aHD0 no_hdpartition_on_hd0: - cmp [table_area+3],byte 0 + cmp [edx+3],byte 0 je no_hdpartition_on_hd1 - mov esi,hdimg2 - mov ecx,62 - rep movsb + mov [hdimg2], aHD1 no_hdpartition_on_hd1: - cmp [table_area+4],byte 0 + cmp [edx+4],byte 0 je no_hdpartition_on_hd2 - mov esi,hdimg3 - mov ecx,62 - rep movsb + mov [hdimg3], aHD2 no_hdpartition_on_hd2: - cmp [table_area+5],byte 0 + cmp [edx+5],byte 0 je no_hdpartition_on_hd3 - mov esi,hdimg4 - mov ecx,62 - rep movsb + mov [hdimg4], aHD3 no_hdpartition_on_hd3: mov eax,40 @@ -87,12 +79,10 @@ START: ; start of execution cmp byte [param_area],0 ;test parameters line jne no_brow ;it's dialog - mov [browser],dword 1 ;it's browser + mov [browser], 1 ;it's browser + jmp no_dlg no_brow: - cmp [browser],dword 1 - je no_dlg - mov al,byte [param_area+5] mov [dlg_type],al @@ -184,53 +174,6 @@ loogetimg: add eax,12 dec ebp jnz loogetimg - jmp endgip - -getimgproc: - pushad - mov dword [edx],esi ;xs - mov dword [edx+4],edi ;ys - - mov ebp,eax - mov eax,dword [ecx] ;getx size - push edx - push ecx - lea ecx,[eax+2*eax] - - mul ebx - add eax,ebp ;x - mov edx,ecx - lea eax,[eax+2*eax] ;eax=offset on imsrc - - mov ecx,esi ;xs - mov ebx,edi ;ys - - mov ebp,esi - - pop edi - lea esi,[eax+8+edi] - - pop edi - add edi,8 - - cld -cyc: - movsw - movsb - dec ecx - jne cyc - add esi,edx - mov ecx,ebp ;xs - sub esi,ecx - sub esi,ecx - sub esi,ecx - dec ebx - jne cyc - - popad - ret - -endgip: call read_directory ; call convertation @@ -249,95 +192,62 @@ scrolltest: mov eax,37 mov ebx,2 int 0x40 - cmp eax,1 + dec eax jne still scrl: mov eax,37 mov ebx,1 int 0x40 - mov ebx,eax - shr eax,16 ;x - and ebx,0xffff ;y - + movzx ebx, ax ; y + shr eax, 16 ; x mov ebp,eax sub ebp,[listx] ;[procinfo.x_size] sub ebp,[listxsize] add ebp,[scrollsize] cmp ebp,dword [scrollsize] ;8 - ja menu_test ; still + jae menu_test ; still - mov ebp,ebx - sub ebp,[listy] ;76 ;up scroll - sub ebp,[scrollbutsize] - cmp ebp,0 - jl menu_test - mov [mousey],ebp - - push eax ebx edx - mov edx,0 - mov eax,[listysize] - sub eax,2 - mov ebx,dword 10 - div ebx - - mov [filelistsize],eax - mov ebx,eax - cmp ebx,[listsize] ;filelistsize in ebx - ja notusescrl - - mov edx,0 - mov eax,[listysize] - sub eax,[scrollbutsize] - sub eax,[scrollbutsize] - - shl eax,16+6 - div dword [listsize] - mul ebx - shr eax,16+6 - - mov ebp,eax ; in ebp ysize of scroll - - mov edx,0 - mov eax,[listsize] - - mov ebx,[listysize] - sub ebx,[scrollbutsize] - sub ebx,[scrollbutsize] - shl eax,16 - div ebx ;dword [listsize] - mul [mousey] - shr eax,16 - - mov ebx,[listsize] - sub ebx,[filelistsize] - cmp eax,ebx - jnae no_cor - mov eax,[listsize] ;correction for full dirs (1000 files) - sub eax,[filelistsize] -no_cor: - mov [filecursor],eax - - jmp usescrl + lea ebp, [ebx-scrollbutsize] + sub ebp, [listy] ; up scroll + jl menu_test + mov ecx, [listysize] + sub ecx, 2*scrollbutsize + mov eax, [scroll_height] + cmp ebp, ecx + jge menu_test + sub ecx, eax + shr eax, 1 + sub ebp, eax + jge @f + xor ebp, ebp +@@: + cmp ebp, ecx + jl @f + mov ebp, ecx +@@: + xor edx, edx + mov eax, [listysize] + sub eax, 2 + mov ebx, 10 + div ebx + mov ebx, eax + cmp ebx, [listsize] + jae notusescrl + mov eax, [listsize] + sub eax, ebx + mul ebp + div ecx + cmp eax, [filecursor] + jz still + mov [filecursor], eax + jmp usescrl notusescrl: + cmp [filecursor], 0 + jz still mov [filecursor],0 ;ebp usescrl: - pop edx ebx eax - - mov esi,[listy];[procinfo.y_size] - add esi,[listysize] - sub esi,[scrollbutsize] - - cmp ebx,esi - jna oks ;menu_test ;still - - sub esi,ebp - inc esi ;correction - cmp ebx,esi - ja menu_test ;still -oks: - mov [flick],1 jmp anti_flick ;red @@ -379,9 +289,7 @@ no_pgup: jmp down no_pgdown: cmp ah,key_Enter - jne no_k_ent - jmp kfad -no_k_ent: + je kfad cmp ah,key_Bspace je back cmp ah,key_F2 @@ -404,7 +312,7 @@ con_edit: jne no_con_ent not [focus] jmp savetest - jmp update +; jmp update no_con_ent: cmp ah,key_Left jne no_con_left @@ -421,16 +329,14 @@ no_con_right: cmp ah,key_Bspace jne no_con_bspace - mov ecx,[cursor] - cmp ecx,0 - je still - dec ecx - mov ebp,[cursor] + mov ebp, [cursor] + test ebp, ebp + jz still lobsp: mov bl,byte [path+ebp] mov byte [path+ebp-1],bl inc ebp - cmp ebp,100 + cmp ebp,1024 jne lobsp dec [cursor] mov [flick],2 @@ -439,17 +345,17 @@ no_con_bspace: mov ecx,[cursor] dec ecx - mov ebp,100 ;[cursor] + mov ebp,1022 + cmp byte [path+ebp], 0 + jnz still losx: + cmp ebp, ecx + jbe @f mov bl,byte [path+ebp] mov byte [path+ebp+1],bl dec ebp - cmp ebp,ecx ;100 - jne losx - - mov ebp, [cursor] - cmp ebp,100 - ja still + jmp losx +@@: mov byte [path+ebp],ah inc dword [cursor] @@ -504,133 +410,104 @@ file_add: kfad: mov eax,[filecursor] no_kfad: - mov ebx,62 + mov ebx,27 mul ebx - mov ebp,eax + lea ebp,[convinfo+eax] + mov esi,[ebp] + cmp esi,-1 + jz still mov edi,paramtest ;clear param string - mov ecx,256 - mov al,0 - rep stosb + mov ecx,1024/4 + xor eax,eax + rep stosd - - mov esi,0 -lll2: - mov al,byte [path+esi] - cmp al,byte 0 ;' '; '/' - je fis2 - cmp al,byte ' '; '/' - je fis2 - inc esi - cmp esi,100 - jna lll2 - jmp fis2 - -fis2: - mov edi,ebp - cmp [convinfo+edi+26],dword 'FOL ' - jne openf - mov [path+esi],byte '/' - inc esi - mov ebp,8 - -los: ;directory extension bug fix - mov al,[convinfo+edi] - cmp al,' ' - jz skip_name_space - mov [path+esi],al - inc esi - skip_name_space: - inc edi - dec ebp - jnz los - - cmp byte [convinfo+edi],'.' - jnz dir_name_end - cmp byte [convinfo+edi+1],' ' - jz dir_name_end - mov ebp,4 - dir_ext_char: - mov al,[convinfo+edi] - cmp al,' ' - jz dir_name_end - mov [path+esi],al - inc esi - inc edi - dec ebp - jnz dir_ext_char - dir_name_end: + mov edi, path + mov ecx, 1024 + repnz scasb + dec edi + cmp [ebp+15], dword 'FOL ' + jnz openf +; open directory - append its name to path + cmp ecx, 2 + jb still + push edi + mov al, '/' + stosb + dec ecx +@@: + lodsb + stosb + test al, al + jz @f + dec ecx + jnz @b +; name is too long - do not do anything + pop edi + xor eax, eax + mov ecx, path+1024 + sub ecx, edi + rep stosb + jmp still +@@: + pop edi +; name appended, now read new directory mov [filecursor],0 -;los: -; mov al,[convinfo+edi] -; mov [path+esi],al -; inc esi -; inc edi -; dec ebp -; jnz los -; mov [filecursor],0 -; cmp byte [dlg_type],'S' -; je savetest -;no_save: - call read_directory ;; call convertation call draw_window -; jmp still + jmp still ;Savetest savetest: cmp byte [dlg_type],'S' - je savetest_yes - jmp still -savetest_yes: - mov ecx,100 -savetestloop: - cmp [path+ecx],byte 0 - je next_byte - cmp [path+ecx],byte 32 - je next_byte - cmp [path+ecx],byte '.' - je openf ;it's file -; cmp [path+ecx],byte '/' -; je no_save ;it's dir -next_byte: - dec ecx - jnz savetestloop - jmp still + jne still +; always force open file - this is better +; because there exists files without extension and folders with extension + jmp openf +; mov ecx,100 +;savetestloop: +; cmp [path+ecx],byte 0 +; je next_byte +; cmp [path+ecx],byte 32 +; je next_byte +; cmp [path+ecx],byte '.' +; je openf ;it's file +;; cmp [path+ecx],byte '/' +;; je no_save ;it's dir +;next_byte: +; dec ecx +; jnz savetestloop +; jmp still ;Open/Run file openf: - mov ecx,100 -lopt: - mov al,[path+ecx] - mov [paramtest+ecx],al - dec ecx - jns lopt - -; mov ebp,100 -;loow: -; cmp [paramtest+ebp],byte '.' -; je file_set -; dec ebp -; jnz loow ;is file set not file add + push esi edi + mov esi, path + mov edi, paramtest + mov ecx, 1024/4 + rep movsd + pop edi esi + add edi, paramtest-path cmp dword [focus],0 ;if prompt line with focus no add file name from frame jne file_set - mov [paramtest+esi],byte '/' - inc esi - mov ebp,8+4 - mov edx,edi -losf: - mov al,[convinfo+edi] - mov [paramtest+esi],al - inc esi - inc edi - dec ebp - jnz losf + cmp edi, paramtest+1022 + jae still + mov al, '/' + stosb +@@: + lodsb + stosb + test al, al + jz file_set + cmp edi, paramtest+1024 + jb @b + jmp still + file_set: cmp [browser],0 @@ -655,7 +532,7 @@ file_set: mov eax,60 mov ebx,2 mov edx,paramtest - mov esi,100 + mov esi,1024 int 0x40 jmp exit @@ -665,101 +542,79 @@ is_brow: ; cmp [convinfo+edi+26],dword 'Fvol' ; je edit - mov eax,dword [convinfo+edx+8] - cmp eax,'. ' - jne noexecute - mov ebx,0 - jmp execute -noexecute: - - cmp eax,'.JPG' - jne nojv -jpg_jpe: - mov ebx,jpgview - jmp run -nojv: - cmp eax,'.JPE' - je jpg_jpe - cmp eax,'.GIF' - jne nojv1 - mov ebx,gifview - jmp run -nojv1: - cmp eax,'.WAV' - jne nojv12 - mov ebx,ac97wav - jmp run -nojv12: - cmp eax,'.MID' - jne nojv13 - mov ebx,midamp - jmp run -nojv13: - cmp eax,'.BMP' - jne nobv - mov ebx,bmpview - jmp run -nobv: +; find extension + mov eax, paramtest+1023 +@@: + dec eax + cmp byte [eax+1], 0 + jz @b +@@: + cmp byte [eax], '/' + jz .noext + cmp byte [eax], '.' + jz .ext + dec eax + cmp eax, paramtest + jae @b +.noext: +; file has no extension +; xor ebx, ebx + jmp execute +.ext: + inc eax +; eax points to extension + cmp byte [eax], 0 + jz .noext + mov ecx, dword [eax] + and ecx, not 0x20202020 + mov ebx, jpgview + cmp ecx, 'JPG' + jz run + cmp ecx, 'JPEG' ; note that it will select also *.JPEG* + jz run + mov ebx, gifview + cmp ecx, 'GIF' + jz run + mov ebx, ac97wav + cmp ecx, 'WAV' + jz run + mov ebx, midamp + cmp ecx, 'MID' + jz run + mov ebx, bmpview + cmp ecx, 'BMP' + jz run ; //// Willow - cmp eax,'.PNG' - jne nopngv - mov ebx,pngview - jmp run -nopngv: + mov ebx, pngview + cmp ecx, 'PNG' + jz run ; //// Willow - cmp eax,'.RTF' - jne nortf - mov ebx,rtfread - jmp run -nortf: - cmp eax,'.ASM' - je edit - cmp eax,'.TXT' - je edit - cmp eax,'.INC' - je edit - jmp still -edit: - mov ebx,editor - jmp run + mov ebx, rtfread + cmp ecx, 'RTF' + jz run + mov ebx, editor + cmp ecx, 'ASM' + jz run + cmp ecx, 'TXT' + jz run + cmp ecx, 'INC' + jz run + jmp still execute: - mov ecx,0 ;200 -loexe: - mov al,[paramtest+ecx] -; cmp al,0 -; je setzr -; cmp al,' ' -; je setzr -; je badl - cmp al,'.' - je setzr -; je badl -; jmp okl -;badl: -; mov al,0 -okl: - mov [open_path+ecx],al - inc ecx - cmp ecx,200 - jnae loexe - -setzr: -; add ecx,3 -; mov al,0 - mov [open_path+ecx],byte 0 ;al - - mov eax,58 - mov ebx,fileinfo_start - int 0x40 - - jmp still + mov ebx, fileinfo_start + and dword [ebx+8], 0 ; no parameters + mov dword [ebx+21], paramtest ; program name +.do: + mov eax, 70 + int 0x40 + jmp still run: - mov ecx,paramtest - mov eax,19 - int 0x40 - jmp still + mov [fileinfo_name], ebx ; program name + mov ebx, fileinfo_start + mov dword [ebx+8], paramtest ; parameters + jmp execute.do no_filelist: @@ -790,65 +645,48 @@ no_update: cmp ah,9 jne no_textopen textopen: - mov esi,0 -xlll2: - mov al,byte [path+esi] - cmp al,byte '/' - jne xfis2 - inc esi - cmp esi,12*20 - jnae xlll2 - jmp still -xfis2: - mov al,byte [path+esi] - cmp al,byte ' ' - je xaa2 - inc esi - cmp esi,12*20 - jnae xfis2 - jmp still -xaa2: - mov eax,[filecursor] - mov ebx,62 - mul ebx - mov edi,eax - cmp [convinfo+edi+26],dword 'FOL ' - je still - mov ecx,12*20 -xlopt: - mov al,[path+ecx] - mov [paramtest+ecx],al - dec ecx - jns xlopt - mov [paramtest+esi],byte '/' - inc esi - mov ebp,8+4 - mov edx,edi -xlosf: - mov al,[convinfo+edi] - mov [paramtest+esi],al - inc esi - inc edi - dec ebp - jnz xlosf - mov [paramtest+esi],byte 0 - mov ebx,editor - mov ecx,paramtest - mov eax,19 - int 0x40 - jmp red ;still + mov eax, 27 + mul [filecursor] + cmp dword [eax+convinfo+15], 'FOL ' + jz still + push eax + mov esi, path + mov edi, paramtest +@@: + lodsb + test al, al + jz @f + stosb + jmp @b +@@: + mov al, '/' + stosb + pop eax + mov esi, [eax+convinfo] + cmp esi, -1 + jz still +@@: + lodsb + stosb + test al, al + jz @f + cmp edi, paramtest+1024 + jb @b + jmp still +@@: + mov ebx, editor + jmp run no_textopen: cmp ah,11 jne no_view viewset: -; not dword [delflag] - inc dword [viewmode] - cmp dword [viewmode],8 - jnae not_cm - mov [viewmode],0 -not_cm: + inc [viewmode] + cmp [viewmode], 4 + jb @f + mov [viewmode], 0 +@@: call read_directory ; call convertation mov [filecursor],0 @@ -859,26 +697,19 @@ no_view: cmp ah,12 ;move back jne no_back back: - mov esi,12*20 -lll: - mov al,byte [path+esi] - cmp al,byte ' ' - jne findsl - dec esi - jnz lll - jmp still -findsl: - dec esi -fis: - mov al,byte [path+esi] - cmp al,byte '/' - je aa - mov [path+esi],byte 0 ;' ' - dec esi - jnz fis -aa: - mov [path+esi],byte 0 ;' ' - + mov edi, path+1024 + mov ecx, edi +@@: + dec edi + cmp byte [edi], '/' + jz @f + cmp edi, path + ja @b + jmp still +@@: + sub ecx, edi + xor eax, eax + rep stosb mov [filecursor],0 call read_directory ; call convertation @@ -911,183 +742,127 @@ no_dn: cmp ah,15 jne no_copyclip ;copy to clipboard copy_to_clip: - mov ebx,param_area ;clipfilp - mov eax,32 - int 0x40 - mov esi,0 -wlll2: - mov al,byte [path+esi] - cmp al,byte '/' - jne wfis2 - inc esi - cmp esi,12*20 - jnae wlll2 - jmp still -wfis2: - mov al,byte [path+esi] - cmp al,byte ' ' - je waa2 - inc esi - cmp esi,12*20 - jnae wfis2 - jmp still -waa2: - mov eax,[filecursor] - mov ebx,62 - mul ebx - mov edi,eax - cmp [convinfo+edi+26],dword 'FOL ' - je still - mov ecx,12*20 -wlopt: - mov al,[path+ecx] - mov [paramtest+ecx],al - dec ecx - jns wlopt - mov [paramtest+esi],byte '/' - inc esi - mov ebp,8+4 - mov edx,edi -wlosf: - mov al,[convinfo+edi] - mov [paramtest+esi],al - inc esi - inc edi - dec ebp - jnz wlosf - mov [paramtest+esi],byte 0 - mov ebx,param_area ;clipfile - mov ecx,paramtest - mov edx,100 - mov esi,0 - mov eax,33 - int 0x40 - jmp still + mov eax, 27 + mul [filecursor] + cmp dword [convinfo+eax+15], 'FOL ' + jz still + push eax + mov esi, path + mov edi, paramtest +@@: + lodsb + test al, al + jz @f + stosb + jmp @b +@@: + pop eax + mov esi, [convinfo+eax] + cmp esi, -1 + jz still + mov al, '/' + stosb +@@: + lodsb + stosb + test al, al + jz @f + cmp edi, paramtest+1024 + jb @b + jmp still +@@: + sub edi, paramtest+1 + mov ebx, clipfile_info + mov byte [ebx], 2 + mov [ebx+12], edi + mov eax, 70 + int 0x40 + jmp still no_copyclip: cmp ah,16 jne no_clippaste paste_from_clip: - mov ebx,param_area ;clipfile - mov ecx,0 - mov edx,-1 - mov esi,sourcepath - mov eax,6 - int 0x40 - - mov ecx,99 -cdestp: - mov al,[path+ecx] - mov [destpath+ecx],al - dec ecx - jns cdestp - - mov esi,0 -zlll2: - mov al,byte [destpath+esi] - cmp al,byte '/' - jne zfis2 - inc esi - cmp esi,100 - jnae zlll2 - jmp still -zfis2: - mov al,byte [destpath+esi] - cmp al,byte ' ' - je zaa2 - inc esi - cmp esi,100 - jnae zfis2 - jmp still -zaa2: - mov byte [destpath+esi],'/' - inc esi - - mov edi,0 -qlll2: - mov al,byte [sourcepath+edi] - cmp al,byte '.' - je qfis2 - inc edi - cmp edi,100 - jnae qlll2 - jmp still -qfis2: - sub edi,8 ;.-8=start of file name - - mov ecx,11 ;11 sybols -cfname: - mov al,[sourcepath+edi] - cmp al,byte ' ' - je dar - mov [destpath+esi],al - inc esi -dar: - inc edi - dec ecx - jns cfname - -; mov [destpath+esi],byte 0 - - mov ecx,199 -cdestjp: - mov al,[sourcepath+ecx] - cmp al,byte 0 - jne nor - mov al,byte 32 -nor: - mov [sourcepath+ecx],al - dec ecx - jns cdestjp - - cmp [browser],dword 1 + mov ebx, clipfile_info + mov byte [ebx], 0 + mov dword [ebx+12], 1023 + mov eax, 70 + int 0x40 + cmp ebx, 0 + jle still + mov byte [paramtest+ebx], 0 +; OS allows only 256 symbols in command line + cmp ebx, 250 + jae still +; we use Pascal-style strings for /RD/1/COPYR +; source file + mov edi, copyr_param + mov al, bl + stosb + mov ecx, ebx + mov esi, paramtest + rep movsb +; destination path + inc edi + mov ebp, edi + mov esi, path +@@: + cmp edi, copyr_param+255 + jae still + lodsb + test al, al + jz @f + stosb + jmp @b +; destination file name +@@: + dec ebx + jz still + cmp byte [paramtest+ebx], '/' + jnz @b + lea esi, [paramtest+ebx] +@@: + lodsb + test al, al + jz @f + stosb + cmp edi, copyr_param+255 + jae still + jmp @b +@@: + mov byte [edi], 0 + sub edi, ebp + mov eax, edi + mov [ebp-1], al +; display + cmp [browser], 1 jne no_outpath mov eax,4 ; function 4 : write text to window mov ebx,10*65536+67 ; [x start] *65536 + [y start] mov ecx,0x00000000 ;[sc.grab_text] ; color of text RRGGBB - mov edx,sourcepath ; pointer to text beginning - mov esi,100 ;12*20 ; text length + mov edx, copyr_param+1 + movzx esi, byte [edx-1] int 0x40 mov ebx,250*65536+67 ; [x start] *65536 + [y start] mov ecx,0x00000000 ;[sc.grab_text] ; color of text RRGGBB - mov edx,destpath ; pointer to text beginning - mov esi,100 ;12*20 ; text length + mov edx, ebp + mov esi, edi int 0x40 no_outpath: - mov ebx,copyrfile - mov ecx,sourcepath - mov eax,19 - int 0x40 +; run COPYR + mov eax, 70 + mov ebx, copyr_run + int 0x40 delay 50 ;wait recoed file jmp update ;still no_clippaste: cmp ah,19 ;Delete from floppy + jne no_delt delete_file: - jne no_delt - cmp dword [path],'/RD/' - jne no_delt - cmp byte [path+4],'1' - jne no_delt - - mov eax,[filecursor] - mov ebx,62 - mul ebx - mov edi,eax - add edi,convinfo - mov ebp,edi - mov eax,dword [edi] - mov dword [paramtest],eax - mov eax,dword [edi+4] - mov dword [paramtest+4],eax - mov eax,dword [edi+4+4+1] - mov dword [paramtest+4+4],eax - - mov ebx,paramtest - mov eax,32 - int 0x40 - jmp update +; OS now do not support file delete + jmp still no_delt: cmp ah,20 ;I - Help @@ -1140,45 +915,30 @@ no_headinfo: je exit ;VIEW MENU - cmp ah,40 ;Sort by name show del + cmp ah,40 ;Sort by name jne no_sn -; mov dword [viewmode],0 - and dword [viewmode],100b + mov [viewmode], 0 jmp update no_sn: - cmp ah,41 ;Sort by extension show del + cmp ah,41 ;Sort by extension jne no_se - and dword [viewmode],1101b - or dword [viewmode],0001b + mov [viewmode], 1 jmp update no_se: - cmp ah,42 ;Sort by size show del + cmp ah,42 ;Sort by size jne no_ss - and dword [viewmode],1110b - or dword [viewmode],0010b + mov [viewmode], 2 jmp update no_ss: - cmp ah,43 ;Sort by date show del + cmp ah,43 ;Sort by date jne no_sd - or dword [viewmode],0011b + mov [viewmode], 3 jmp update no_sd: - cmp ah,44 ;Show del files - jne no_ds - or dword [viewmode],0100b - jmp update -no_ds: - - cmp ah,45 ;Fade del files - jne no_df - and dword [viewmode],11111011b - jmp update -no_df: - ;HELP MENU cmp ah,50 ;Help? je help_scr @@ -1186,20 +946,6 @@ no_df: cmp ah,51 ;Info? je info_scr - cmp ah,83 - ja no_hd_part - cmp ah,80 - jb no_hd_part - mov ecx,0 - sub ah,80 - inc ah - mov cl,ah - mov eax,21 - mov ebx,8 ;7 - int 0x40 - -no_hd_part: - cmp ah,1 ; test on exit button je exit @@ -1237,7 +983,7 @@ info_scr: jmp screen screen: - cmp [browser],dword 1 ;it's browser? + cmp [browser], 1 ;it's browser? jne dialogscr mov eax,[procinfo.y_size] @@ -1278,6 +1024,44 @@ helploo: jmp still +getimgproc: + pushad + mov dword [edx],esi ;xs + mov dword [edx+4],edi ;ys + + mov ebp,eax + mov eax,dword [ecx] ;getx size + push edx + push ecx + lea ecx,[eax+2*eax] + + mul ebx + add eax,ebp ;x + mov edx,ecx + lea eax,[eax+2*eax] ;eax=offset on imsrc + + mov ebp,esi ;xs + mov ebx,edi ;ys + + pop edi + lea esi,[eax+8+edi] + + pop edi + add edi,8 + + cld +cyc: + push esi + lea ecx, [ebp+ebp*2] + rep movsb + pop esi + add esi,edx + dec ebx + jne cyc + + popad + ret + ;HELP TEXT help_text: ;0123456789012345678901234567890123456789 @@ -1300,10 +1084,10 @@ help_text: info_text: db ' ~~~~~ SYSTEM X-TREE ~~~~~ ' - db ' INFO 81 Ver ' + db ' INFO 82 Ver ' db ' ' db ' Create by Pavlushin Evgeni ' - db ' with ASCL libary special for Menuet OS ' + db 'with ASCL library special for Kolibri OS' db ' www.deck4.narod.ru waptap@mail.ru ' @@ -1341,7 +1125,7 @@ draw_window: xor eax,eax ; function 0 : define and draw window - cmp [browser],dword 1 ;it's browser + cmp [browser], 1 ;it's browser jne nob1 mov ebx,140*65536+400 ; [x start] *65536 + [x size] mov ecx,160*65536+280 ; [y start] *65536 + [y size] @@ -1362,39 +1146,40 @@ isb1: mov eax,[procinfo.x_size] cmp eax,66 - jg temp12345 + jg @f +.ret: ret - temp12345: + @@: + cmp [procinfo.y_size], 0x70 + jl .ret - cmp [browser],dword 1 ;it's browser + cmp [browser], 1 ;it's browser jne nob9 mov [listx],120 - mov eax,[procinfo.x_size] - sub eax,[listx] - sub eax,7 +; mov eax,[procinfo.x_size] + sub eax,127;[listx]+7 + cmp eax,10 + jl .ret mov [listxsize],eax mov [listy],73 mov eax,[procinfo.y_size] - sub eax,[listy] - sub eax,7 + sub eax,73+7;[listy]+7 mov [listysize],eax jmp isb9 nob9: mov [listx],10 - mov eax,[procinfo.x_size] - sub eax,[listx] - sub eax,7 +; mov eax,[procinfo.x_size] + sub eax,17 ;[listx]+7 mov [listxsize],eax mov [listy],54 mov eax,[procinfo.y_size] - sub eax,[listy] - sub eax,34 + sub eax,54+34;[listy]+34 mov [listysize],eax isb9: ;Draw only browser components - cmp [browser],dword 1 ;it's browser + cmp [browser], 1 ;it's browser jne nob2 mov eax,[sc.grab_text] ; color of text RRGGBB @@ -1417,27 +1202,8 @@ nexthbut: dec edi jnz nexthbut -;DRAW PARTITION BUTTONS - mov eax,8 - mov ebx,340*65536+5 ;start pos x - mov ecx,24*65536+8 ;start pos y - mov edx,80;+1000000000000000000000000000000b ;spoke butt - mov edi,4 ;draw 13 button's - mov esi,0x00339933 - int 0x40 - dec edi -nextpbut: - add ebx,6*65536 - inc edx - int 0x40 - dec edi - jnz nextpbut - -;DRAW PARTITON TEXT - glabel 341,25,'1234',cl_White;Black - ;File STRING - glabel 8,25,' FILE VIEW INFO ', ;cl_White ;Black + glabel 8,25,' FILE VIEW INFO ', cl_White ;Black ;BlackLine mov eax,[procinfo.x_size] @@ -1458,12 +1224,12 @@ nextpbut: setimg 34,88,logoinfimg glabel 20,165,'SYSTEM X-TREE',cl_Black add ebx,10 - glabel ,,'FOR MENUETOS', + glabel ,,'FOR KolibriOS', add ebx,9*65536+20 glabel ,,'welcome to',cl_Green add ebx,-15*65536+10 - glabel ,,'www.menuetos.org',cl_Green + glabel ,,'www.kolibrios.org',cl_Green ; glabel ,,'Create by',cl_Green ; add ebx,10 @@ -1489,7 +1255,7 @@ no_drawhf: mov ebx,(8+6*8)*65536+6*12 ;start pos x mov ecx,35*65536+10 ;start pos y mov edx,40 ;spoke butt - mov edi,6 ;draw 4 button's + mov edi,4 ;draw 4 button's mov esi,cl_Grey call menubutton no_drawhv: @@ -1509,7 +1275,7 @@ nob2: ;Draw buttons instruments mov eax,8 - cmp [browser],dword 1 ;it's browser + cmp [browser], 1 ;it's browser jne nob3 mov ebx,10*65536+16+5 ;start pos x mov ecx,37*65536+15 ;start pos y @@ -1531,7 +1297,7 @@ nextbut: jnz nextbut - cmp [browser],dword 1 ;it's browser + cmp [browser], 1 ;it's browser jne nob4 ;But img browser setimg 10,37,butimg @@ -1546,7 +1312,7 @@ nob4: setimg 16,29,butimg isb4: - cmp [browser],dword 1 ;it's browser + cmp [browser], 1 ;it's browser jne nob5 mov [urlx],48 @@ -1559,10 +1325,8 @@ isb4: glabel 20,57,"URL:",cl_Black ;Out view mode info - mov eax,[viewmode] - mov ebx,16 - mul ebx - mov edx,eax + movzx edx, [viewmode] + shl edx, 4 mov eax,4 mov ebx,180*65536+25 mov ecx,cl_Black @@ -1735,11 +1499,10 @@ no_flick_url: shl ebx,16 add ebx,dword [scrollsize] mov ecx,[listy] - add ecx,[scrollbutsize] + add ecx,scrollbutsize shl ecx,16 add ecx,[listysize] - sub ecx,[scrollbutsize] - sub ecx,[scrollbutsize] + sub ecx,scrollbutsize*2 mov edx,[scrollcolor] ;0x00006600 int 0x40 @@ -1750,34 +1513,47 @@ no_flick_url: mov ebx,dword 10 div ebx - mov edx,0 mov ebx,eax cmp ebx,[listsize] ;filelistsize in ebx - ja notusescroll + jae notusescroll ;usescroll - mov eax,[listysize] - sub eax,[scrollbutsize] - sub eax,[scrollbutsize] - shl eax,16 - div dword [listsize] - mul ebx - shr eax,16 - mov esi,[mousey] - shl esi,16 - add esi,eax - - mov eax,13 - mov ebx,[listx] - add ebx,[listxsize] - sub ebx,[scrollsize] - shl ebx,16 - add ebx,dword [scrollsize] - mov ecx,[listy] - add ecx,[scrollbutsize] - shl ecx,16 - add ecx,esi - mov edx,[scrollboxcol] - int 0x40 +; calculate scroll size + mov eax, [listysize] + sub eax, 2*scrollbutsize + push eax + mul ebx + div [listsize] + cmp eax, 5 + jae @f + mov al, 5 +@@: + mov [scroll_height], eax +; calculate scroll pos + sub [esp], eax + mov eax, [listsize] + sub eax, ebx + mov ecx, eax + cmp eax, [filecursor] + jb @f + mov eax, [filecursor] +@@: + mul dword [esp] + div ecx + mov [scroll_pos], eax + pop ecx +; draw + lea ecx, [eax+scrollbutsize] + add ecx, [listy] + shl ecx, 16 + mov cx, word [scroll_height] + mov eax, 13 + mov ebx, [listx] + add ebx, [listxsize] + sub ebx, [scrollsize] + shl ebx, 16 + mov bx, word [scrollsize] + mov edx, [scrollboxcol] + int 0x40 notusescroll: @@ -1808,8 +1584,7 @@ notusescroll: add ebx,[scrollsize] mov ecx,[listy] shl ecx,16 - add ecx,[scrollbutsize] - dec ecx ;correction + add ecx,scrollbutsize-1 mov eax,8 mov edx,6+1000000000000000000000000000000b ;spoke butt int 0x40 @@ -1836,7 +1611,7 @@ notusescroll: dec ecx ;correction mov edx,7+1000000000000000000000000000000b ;spoke butt mov eax,[listysize] - sub eax,[scrollbutsize] + sub eax,scrollbutsize shl eax,16 add ecx,eax @@ -1864,10 +1639,12 @@ notusescroll: ; Draw text in file list - mov eax,[listxsize] - sub eax,40*6 ;leight of string - shr eax,1 - add eax,[listx] +; mov eax,[listxsize] +; sub eax,40*6 ;leight of string +; shr eax,1 +; add eax,[listx] + mov eax, [listx] + add eax, 12+4 ; for icons shl eax,16 add eax,[listy] add eax,2 @@ -1883,7 +1660,7 @@ notusescroll: ; OUT FILE DATA mov eax,[filecursor] ;calc cursor position - mov ebx,62 + mov ebx,27 mul ebx ;OUT TEXT @@ -1893,81 +1670,133 @@ notusescroll: add edx,eax mov ebx,dword [filelistxy] loo: + cmp dword [edx], -1 + jz noout mov ecx,0x00888888 ;for another file's color white - cmp [edx+26],dword 'FOL ' ;folder yellow + cmp [edx+15],dword 'FOL ' ;folder yellow jne nb mov ecx,0x00006666 jmp cset1 nb: - mov eax,[edx+8] + mov eax, [edx] + xor edi, edi +; find extension and set color +@@: + inc eax + cmp byte [eax-1], 0 + jz @f + cmp byte [eax-1], '.' + jnz @b + mov edi, eax + jmp @b +@@: + test edi, edi + jz @f + mov edi, [edi] + and edi, not 0x20202020 ; toupper +@@: ;Color set - cmp eax,dword '.TXT' ;text's blue - je itx - cmp eax,dword '.INC' - je itx - cmp eax,dword '.ASM' - je itx - cmp eax,dword '.RTF' - je itx - jmp nt -itx: - mov ecx,0x00446666 - jmp cset -nt: - cmp eax,dword '.BMP' ;picture's pure - je ipic - cmp eax,dword '.JPG' - je ipic - cmp eax,dword '.JPE' - je ipic - cmp eax,dword '.GIF' - je ipic -; //// Willow - cmp eax,dword '.PNG' - je ipic -; //// Willow - cmp eax,dword '.WAV' - je ipic - cmp eax,dword '.MID' - je ipic - jmp np -ipic: - mov ecx,0x00226688 - jmp cset -np: - cmp eax,dword '. ' ;execute's green - jne nexec - mov ecx,0x00008866 - jmp cset -nexec: +; text's blue + mov ecx, 0x00446666 + cmp edi, 'TXT' + jz cset + cmp edi, 'INC' + jz cset + cmp edi, 'ASM' + jz cset + cmp edi, 'RTF' + jz cset +; picture's pure + mov ecx, 0x00226688 + cmp edi, 'BMP' + jz cset + cmp edi, 'JPG' + jz cset + cmp edi, 'JPEG' + jz cset + cmp edi, 'GIF' + jz cset + cmp edi, 'PNG' + jz cset + cmp edi, 'WAV' + jz cset + cmp edi, 'MID' + jz cset +; execute's green + mov ecx, 0x00008866 + test edi, edi + jz cset +; for another file's color white + mov ecx, 0x00888888 cset: cset1: - mov esi,40 ;symbols out 62 ;32 + push edx + mov edx,[edx] + push ebx edx + mov eax, [listxsize] + sub eax, [scrollsize] + sub eax, 12+4 + xor edx, edx + mov ebx, 6 + div ebx + pop edx ebx + sub eax, 25 + xor esi, esi +@@: + cmp byte [edx+esi], 0 + jz @f + inc esi + cmp esi, eax + jbe @b + dec esi +@@: + push eax mov eax,4 - pushad int 0x40 -; popad + cmp byte [edx+esi], 0 + jz @f + pushad + mov edx, more_char + mov eax, esi + imul eax, 6*65536 + add ebx, eax + mov esi, 1 + mov eax, 4 + int 0x40 + popad +@@: + pop eax + pop edx + push ebx edx + inc eax + imul eax, 6*65536 + add ebx, eax + add edx,4 + mov esi,23 + mov eax,4 + int 0x40 + pop edx ebx -; pushad - cmp [edx+26],dword 'Fvol' ;volume label + pushad + cmp [edx+15],dword 'Fvol' ;volume label jne no_volico push hdico+8 jmp out_ico no_volico: - cmp [edx+26],dword 'FOL ' + cmp [edx+15],dword 'FOL ' jne no_folico - cmp [edx+9],dword 'HARD' + cmp [edx+4],dword 'HARD' jne no_hdico push hdico+8 jmp out_ico no_hdico: - cmp [edx+9],dword 'RAMD' + cmp [edx+4],dword 'RAMD' jne no_rdico push rdico+8 jmp out_ico no_rdico: - cmp [edx+9],dword 'FLOP' + cmp [edx+4],dword 'FLOP' jne no_fdico push rdico+8 jmp out_ico @@ -1975,55 +1804,55 @@ no_fdico: push folico+8 jmp out_ico no_folico: - cmp [edx+8],dword '.BMP' + cmp edi,dword 'BMP' je is_imgico - cmp [edx+8],dword '.JPG' + cmp edi,dword 'JPG' je is_imgico - cmp [edx+8],dword '.JPE' + cmp edi,dword 'JPEG' je is_imgico - cmp [edx+8],dword '.GIF' + cmp edi,dword 'GIF' je is_imgico ; //// Willow - cmp [edx+8],dword '.PNG' + cmp edi,dword 'PNG' je is_imgico ; //// Willow - cmp [edx+8],dword '.WAV' + cmp edi,dword 'WAV' je is_imgico - cmp [edx+8],dword '.MID' + cmp edi,dword 'MID' je is_imgico jmp no_imgico is_imgico: push imgico+8 jmp out_ico no_imgico: - cmp [edx+8],dword '.ASM' + cmp edi,dword 'ASM' je is_asmincico - cmp [edx+8],dword '.INC' + cmp edi,dword 'INC' je is_asmincico jmp no_asmincico is_asmincico: push asmincico+8 jmp out_ico no_asmincico: - cmp [edx+8],dword '.RTF' + cmp edi,dword 'RTF' je @f - cmp [edx+8],dword '.TXT' + cmp edi,dword 'TXT' jne no_txtico @@: push txtico+8 jmp out_ico no_txtico: - cmp [edx+8],dword '. ' + test edi,edi jne no_execico push execico+8 jmp out_ico no_execico: - cmp [edx+26],dword 'DAT ' + cmp [edx+15],dword 'DAT ' jne no_datico push datico+8 jmp out_ico no_datico: - cmp [edx+26],dword 'DEL ' + cmp [edx+15],dword 'DEL ' jne no_out_ico push delico+8 jmp out_ico @@ -2042,11 +1871,10 @@ no_out_ico: add ebx,10 noout: - add edx,62 + add edx,27 dec [filelistsize] - cmp [filelistsize],dword 0 - je extloo + jz extloo dec ebp jnz loo @@ -2055,7 +1883,7 @@ dext: extloo: - cmp [browser],dword 1 ;it's browser + cmp [browser], 1 ;it's browser jne nob8 ;Draw text for head->file buttons @@ -2086,10 +1914,10 @@ no_drawhftext: ;Draw text for head->view buttons cmp [drawhv],1 jne no_drawhvtext - drawfbox (8+6*8),35,(6*12)+1,(11*6),0x00000000 - drawfbox (9+6*8),36,(6*12)-1,(11*6)-2,0x00ffffff + drawfbox (8+6*8),35,(6*12)+1,(11*4),0x00000000 + drawfbox (9+6*8),36,(6*12)-1,(11*4)-2,0x00ffffff - mov edi,6 ;4 + mov edi,4 mov ebx,(9+6*8)*65536+37 mov ecx,cl_Black mov edx,view_text_label @@ -2101,8 +1929,6 @@ view_text_label: db ' Ext. sort ' db ' Size sort ' db ' Date sort ' - db ' Show DEL ' - db ' Fade DEL ' no_drawhvtext: @@ -2153,8 +1979,7 @@ listcolor dd 0xffffff ;0xeeeeee scrollcolor dd 0x778877 scrollboxcol dd 0x335533 scrollbutcol dd 0x224422 -scrollbutsize dd 9 -usescroll dd 1 +scrollbutsize = 9 ;URL LINE PARAMETRS @@ -2191,76 +2016,37 @@ nextmenubut: read_directory: -; STEP 0 SEt TYPE OF SORT - - mov eax,[viewmode] -;with no show del files - and eax,0FFFFFFFBh - cmp eax,0 - jnz no_sort_by_name - mov [start],0 - mov [x0],12 - mov [x1],99 - mov [x2],99 - mov [x3],99 - jmp sortset - -no_sort_by_name: - dec eax - jnz no_sort_by_ext - mov [start],9 - mov [x0],9 - mov [x1],99 - mov [x2],99 - mov [x3],12 - jmp sortset - -no_sort_by_ext: - dec eax - jnz no_sort_by_size - mov [start],30 - mov [x0],12 - mov [x1],99 - mov [x2],99 - mov [x3],38 - jmp sortset - -no_sort_by_size: - dec eax - mov [start],21 - mov [x0],12 - mov [x1],17 - mov [x2],20 - mov [x3],26 - jmp sortset ;sort by date - -;SORT VARILE -start dd 0 -x0 dd 0 -x1 dd 0 -x2 dd 0 -x3 dd 0 - -sortset: - ;STEP 1 CLEAR CONVINFO mov edi,convinfo mov al,255 - mov ecx,4096*62 ;512 + mov ecx,4096*27 cld + push edi rep stosb + pop edi ;STEP 2 TEST ON HD OR PARTITION cmp [path],byte '/' je nstep - mov ecx,61+62*5 -loxhd: - mov al,[hdimg+ecx] - mov [convinfo+ecx],al - dec ecx - jns loxhd - mov [listsize],0 - ret +; copy info on RD and FD + mov esi, hdimg + mov ecx, 2*27 + rep movsb +; hard disks + mov eax, 4 +.1: + mov ecx, 27 + cmp dword [esi], 0 + jz .2 + rep movsb + jmp .3 +.2: + add esi, ecx +.3: + dec eax + jnz .1 + mov [listsize], 0 + ret nstep: cmp [path+3],byte '/' je nstep2 @@ -2268,88 +2054,66 @@ nstep: je nstep2 cmp [path+1],word 'RD' jne nostep_RD - mov ecx,61 + mov ecx,1 jmp loxpt nostep_RD: cmp [path+1],word 'FD' jne nostep_FD - mov ecx,61+62 + mov ecx,2 jmp loxpt nostep_FD: cmp [path+1],dword 'HD0' jne nostep_HD0 - mov cl,[table_area+2] - movzx ecx,cl - imul ecx,62 - dec ecx + movzx ecx,byte [table_area+2] jmp loxpt nostep_HD0: cmp [path+1],dword 'HD1' jne nostep_HD1 - mov cl,[table_area+3] - movzx ecx,cl - imul ecx,62 - dec ecx + movzx ecx,byte [table_area+3] jmp loxpt nostep_HD1: cmp [path+1],dword 'HD2' jne nostep_HD2 - mov cl,[table_area+4] - movzx ecx,cl - imul ecx,62 - dec ecx + movzx ecx,byte [table_area+4] jmp loxpt nostep_HD2: cmp [path+1],dword 'HD3' jne nostep_HD3 - mov cl,[table_area+5] - movzx ecx,cl - imul ecx,62 - dec ecx + movzx ecx,byte [table_area+5] jmp loxpt nostep_HD3: - mov ecx,61+62 ;+496 + mov ecx,2 loxpt: - mov al,[ptimg+ecx] - mov [convinfo+ecx],al - dec ecx - jns loxpt + cmp ecx, 20 + jbe @f + mov ecx, 20 +@@: + mov eax, a1 + mov esi, ptimg +@@: + stosd + add eax, 3 + push ecx esi + mov ecx, 23 + rep movsb + pop esi ecx + loop @b mov [listsize],0 ret nstep2: -;STEP 3 CLEAR OUTINFO - mov edi,outinfo ;0x14000 ;0x20000 - xor eax,eax - mov ecx,4096*32 ;512 - cld - rep stosb +;STEP 3 was deleted ;STEP 4 READ DATA FROM HD - mov dword [farea],outinfo - mov dword [readblock],0 loorhd: - mov eax,[readblock] - mov [fileinfoblock+4],eax - mov eax,58 + mov eax,70 mov ebx,fileinfoblock int 0x40 - cmp eax,0 - jne hd_err - add dword [farea],512 - inc dword [readblock] - cmp dword [readblock],4096/16 - jna loorhd -hd_err: - mov ebx,dword [readblock] - shl ebx,4 - mov dword [blocksread],ebx ; for quick resorting - - cmp eax,5 + cmp eax,6 je end_of_dir ; It's erorr's test is poor code @@ -2361,341 +2125,281 @@ hd_err: no_inv_part: cmp eax,3 jne no_unk_fs - glabel 10,10,'Unknow file system',cl_Red+font_Big + glabel 10,10,'Unknown file system',cl_Red+font_Big jmp end_of_dir no_unk_fs: end_of_dir: +; -1 -> 0 + cmp ebx, -1 + sbb ebx, -1 mov [dirlen],ebx - ; command succesful + ; command successful - mov esi,outinfo ;data_area+1024 -; mov edi,fileinfo+11 - mov edx,0 ;4096 ;16 + mov esi, outinfo+32 + and [listsize], 0 + test ebx, ebx + jz nofiles newlineb: + push ebx - mov edi,fileinfo+11 + mov edi, fileinfo + push edi + mov al, ' ' + mov ecx, 27 + rep stosb + pop edi + push esi + add esi, 40 + mov [edi], esi + pop esi - pushad ; clear - mov al,32 - mov ecx,58 - sub edi,11 - cld - rep stosb - popad + mov eax, 'DAT ' ; data or ... ? + mov cl, [esi] + test cl, 0x10 + jz @f + mov eax, 'FOL ' + mov [edi+15], eax + jmp nosize +@@: + test cl, 8 + jz novol + mov eax, 'Fvol' + mov [edi+15], eax + jmp nosize +novol: + mov [edi+15], eax - mov cl,[esi] ; end of entries ? - cmp cl,6 - jnz noib0 +; size + mov eax, [esi+32] + push esi + lea esi, [edi+26] + mov ebx, 10 + mov ecx, 8 +newnum: + xor edx, edx + div ebx + add dl, '0' + mov [esi], dl + test eax, eax + jz zernum + dec esi + loop newnum +zernum: + pop esi +nosize: - mov [edi+26],dword 'EOE ' - add esi,32 -; add edi,62 - jmp inf - - noib0: - - mov cl,[esi+0] - cmp cl,0xe5 - je yesdelfil - - mov cl,[esi+11] ; long fat32 name ? - cmp cl,0xf - jnz noib1 - - mov [edi+26],dword 'F32 ' - add esi,32 -; add edi,62 - jmp inf - - noib1: - - mov eax,'DAT ' ; data or .. ? - - mov cl,[esi+0] ; deleted file - cmp cl,0xe5 - je yesdelfil - cmp cl,0x0 - je yesdelfil - jmp nodelfil - yesdelfil: - mov eax,'DEL ' - jmp ffile - - nodelfil: - - mov cl,[esi+11] ; folder - and cl,0x10 - jz ffile - mov eax,'FOL ' - mov [edi+26],eax - jmp nosize - ffile: - -; Asko patch for v79 - mov cl,[esi+11] ; fold - and cl,0xf - cmp cl,0xf ; skip long filename - jz novol - test cl,0x8 ; is it fold label? - jz novol ; no - mov eax,'Fvol' - mov [edi+26],eax - jmp nosize - novol: - - mov [edi+26],eax - - pusha ; size - mov eax,[esi+28] - mov esi,edi - add esi,37 - mov ebx,10 - mov ecx,8 - newnum: - xor edx,edx - div ebx - add dl,48 - mov [esi],dl - test eax,eax - jz zernum - dec esi - loop newnum - zernum: - popa - nosize: - - pusha ; date - mov [edi+17],dword '. .' - - movzx eax,word [esi+24] - shr eax,9 ; year - add eax,1980 - mov ecx,4 - newdel1: - dec ecx - xor edx,edx - mov ebx,10 - div ebx - add edx,48 - mov [edi+ecx+21],dl - test ecx,ecx - jnz newdel1 - - movzx eax,word [esi+24] - shr eax,5 ; month - and eax,0x0f - mov ecx,2 - newdel2: - dec ecx - xor edx,edx - mov ebx,10 - div ebx - add edx,48 - mov [edi+ecx+18],dl - test ecx,ecx - jnz newdel2 - - movzx eax,word [esi+24] - and eax,0x1f ; day - mov ecx,2 - newdel3: - dec ecx - xor edx,edx - mov ebx,10 - div ebx - add edx,48 - mov [edi+ecx+15],dl - test ecx,ecx - jnz newdel3 - - popa - - - pusha ; number - mov eax,edx - sub eax,4096 - neg eax - - xor edx,edx - mov ebx,10 - div ebx - add dl,48 - mov [edi+43],dl ;0001 - xor edx,edx - div ebx - add dl,48 - mov [edi+42],dl ;0010 - xor edx,edx - div ebx - add al,48 - add dl,48 - mov [edi+41],dl ;0100 - mov [edi+40],byte 0 ;1000 - popa - - mov ecx,8 ; first 8 - cld - rep movsb - mov [edi],byte '.' - inc edi - mov ecx,3 ; last 3 - cld - rep movsb - - add esi,(32-11) -; add edi,(60-12+2) - - inf: - - pushad +; date + mov dword [edi+6], '. .' +; year + movzx eax, word [esi+28+2] + mov ecx, 4 +newdel1: + xor edx, edx + mov ebx, 10 + div ebx + add edx, '0' + mov [edi+ecx+9], dl + loop newdel1 +; month + movzx eax, byte [esi+28+1] + xor edx, edx + div ebx + add al, '0' + add dl, '0' + mov [edi+7], al + mov [edi+8], dl +; day + movzx eax, byte [esi+28] + xor edx, edx + div ebx + add al, '0' + add dl, '0' + mov [edi+4], al + mov [edi+5], dl ;STEP 5 Test on WRITE OR NOTWRITE - mov edx,fileinfo+11 -looo: + cmp word [esi+40], '.' + jz nextfl + cmp word [esi+40], '..' + jnz @f + cmp byte [esi+42], 0 + jz nextfl +@@: -; Delete del, eoe, f32 and another head-names - cmp [viewmode],3 ;0-3 no outdel - ja del_out - cmp [edx+26],dword 'DEL ' - je nextfl -del_out: - cmp [edx+26],dword 'DEL ' - jne no_del - cmp [edx],dword 0 ;431 ;435 ;484 +10% speed - je nextfl -no_del: - cmp [edx+26],dword 'EOE ' - je nextfl - cmp [edx+26],dword 'F32 ' ;F32 not useles - je nextfl - cmp [edx],dword '. ' - je nextfl - cmp [edx],dword '.. ' - je nextfl - cmp [edx],dword 'FIRS' - je nextfl +; STEP 6 SORT ALGORYTHM -; ---------_______-------_______ --------_________----------- -; SORT by name and del deletet files or f32 headers from list -; _________-------_______ --------_______---------___________ + push esi + xor esi, esi -; STEP 6 UNIVERSAL SORT ALGORYTHM - -xxx: - mov esi,0 ;[tekfilename] ;0 - mov ebx,[start] ; 0 - -; At first Fold after Dat and Del +; At first Fold after Dat ftestname: - cmp byte [fileinfo+11+26],'F' + cmp dword [convinfo+esi], -1 + jz writefile + cmp byte [fileinfo+15],'F' je F - cmp byte [fileinfo+11+26],'D' - je D - jmp add_element -D: cmp byte [convinfo+esi+26],'D' + cmp byte [fileinfo+15],'D' + jne add_element +D: cmp byte [convinfo+esi+15],'D' je add_element - cmp byte [convinfo+esi+26],'F' + cmp byte [convinfo+esi+15],'F' je skipfile jmp add_element -F: cmp byte [convinfo+esi+26],'D' +F: cmp byte [convinfo+esi+15],'D' je writenow -; cmp byte [convinfo+esi+26],'F' +; cmp byte [convinfo+esi+15],'F' ; je add_element ; jmp add_element add_element: - mov al,[fileinfo+ebx+11] - cmp al,[convinfo+esi+ebx] - je equal - jb writenow +; compare items + movzx eax, [viewmode] + call [compare+eax*4] + jb writenow skipfile: - add esi,62 - mov ebx,[start] ;0 + add esi,27 jmp ftestname -equal: - inc ebx - cmp ebx,[x0] - je writefile - cmp ebx,[x1] - je x1p - cmp ebx,[x2] - je x2p - cmp ebx,[x3] - jae x3p - jmp add_element - -x1p: - mov ebx,18 - jmp add_element -x2p: - mov ebx,15 - jmp add_element -x3p: - mov ebx,0 - jmp add_element - writenow: - mov ecx,4096*62 + mov ecx,4096*27-1 sub ecx,esi ldloop: mov al,[convinfo+ecx+esi] - mov [convinfo+ecx+esi+62],al + mov [convinfo+ecx+esi+27],al dec ecx jns ldloop - writefile: - mov ecx,61 + mov ecx,26 wfloop: - mov al,[fileinfo+ecx+11] + mov al,[fileinfo+ecx] mov [convinfo+ecx+esi],al dec ecx jns wfloop - -nextfile: + inc [listsize] + pop esi nextfl: -; popad -; pushad - mov eax,edx - shl eax,26 - cmp eax,0 - jne no_outcnt - push edx - drawfbox 294,25,(4*6),10,cl_White - pop ebp - outcount ebp,294,25,cl_Black,4*65536 -no_outcnt: - popad + add esi, 304 + pop ebx + dec ebx + jnz newlineb - inc edx - cmp edx,4096 - jnae newlineb +nofiles: + ret +toupper: + cmp al, 'a' + jb .ret + cmp al, 'z' + ja @f +.sub20: + sub al, 0x20 +.ret: + ret +@@: + cmp al, 0xA0 + jb .ret + cmp al, 0xB0 + jb .sub20 + cmp al, 0xE0 + jb .ret + cmp al, 0xF0 + jae @f + sub al, 0xE0-0x90 + ret +@@: + cmp al, 0xF1 + jnz .ret + dec eax + ret -;STEP 8 GET SIZE OF RESORTING LIST - mov ecx,0 - mov edi,0 - mov eax,[blocksread] - mov ebx,62 - mul ebx - mov edx,eax -loogs: - mov eax,dword [convinfo+edi+26] - cmp eax,dword 0xffffffff - je endgs - add edi,62 - inc ecx - cmp edi,edx ;4096*62 - jnae loogs -endgs: - mov [listsize],ecx - ret +compare_date: + pushad + mov al, [fileinfo+10] + cmp al, [convinfo+esi+10] + jnz .ret + mov al, [fileinfo+11] + cmp al, [convinfo+esi+11] + jnz .ret + mov al, [fileinfo+12] + cmp al, [convinfo+esi+12] + jnz .ret + mov al, [fileinfo+13] + cmp al, [convinfo+esi+13] + jnz .ret + mov al, [fileinfo+7] + cmp al, [convinfo+esi+7] + jnz .ret + mov al, [fileinfo+8] + cmp al, [convinfo+esi+8] + jnz .ret + mov al, [fileinfo+4] + cmp al, [convinfo+esi+4] + jnz .ret + mov al, [fileinfo+5] + cmp al, [convinfo+esi+5] + jz compare_name.1 +.ret: + popad + ret +compare_name: + pushad +.1: + mov edi, dword [convinfo+esi] + mov esi, dword [fileinfo] + call strcmpi + popad + ret +compare_ext: + pushad + mov esi, dword [convinfo+esi] + mov edi, dword [fileinfo] + call find_ext + xchg esi, edi + call find_ext + call strcmpi + popad + jz compare_name + ret +compare_size: + pushad + lea edi, [convinfo+esi+19] + lea esi, [fileinfo+19] + mov ecx, 8 + repz cmpsb + popad + jz compare_name + ret + +strcmpi: + lodsb + call toupper + push eax + mov al, [edi] + inc edi + call toupper + cmp [esp], al + pop eax + jnz @f + test al, al + jnz strcmpi +@@: + ret + +find_ext: + lodsb + test al, al + jz .noext + cmp al, '.' + jnz find_ext + ret +.noext: + dec esi + ret ;****************************************************************************** @@ -2705,10 +2409,8 @@ flick dd 0 ;anti flick on ? drawhf dd 0 ;draw file menu? drawhv dd 0 ;draw view menu? drawhi dd 0 ;draw info menu? -browser dd 0 ;0-dialog, 1-browser cursor dd 0 ;cursor in prompt line focus dd 0 ;prompt edit or window? -viewmode dd 0 ;folder sort & not del downstop dd 0 filecursor dd 0 mousex dd 0 @@ -2718,40 +2420,55 @@ listsize dd 0 ;num of files in directory temp dd 0 readblock dd 1 dlg_type db 0 ;S-save O-open +browser db 0 ;0-dialog, 1-browser +viewmode db 0 ;folder sort -hdimg1 db 'HD0 HARDDISK FOL ' -hdimg2 db 'HD1 HARDDISK FOL ' -hdimg3 db 'HD2 HARDDISK FOL ' -hdimg4 db 'HD3 HARDDISK FOL ' +compare dd compare_name + dd compare_ext + dd compare_size + dd compare_date - ;01234567890123456789012345678901234567890123456789012345678912 -hdimg db 'RD RAMDISK FOL ' - db 'FD FLOPPYDISK FOL ' - db ' ' - db ' ' - db ' ' - db ' ' +aRD db 'RD',0 +aFD db 'FD',0 +aHD0 db 'HD0',0 +aHD1 db 'HD1',0 +aHD2 db 'HD2',0 +aHD3 db 'HD3',0 +a1 db '1',0,0 +a2 db '2',0,0 +a3 db '3',0,0 +a4 db '4',0,0 +a5 db '5',0,0 +a6 db '6',0,0 +a7 db '7',0,0 +a8 db '8',0,0 +a9 db '9',0,0 +a10 db '10',0 +a11 db '11',0 +a12 db '12',0 +a13 db '13',0 +a14 db '14',0 +a15 db '15',0 +a16 db '16',0 +a17 db '17',0 +a18 db '18',0 +a19 db '19',0 +a20 db '20',0 -ptimg db '1 FIRST PARTITION FOL ' - db '2 SECOND PARTITION FOL ' - db '3 NEXT PARTITION FOL ' - db '4 NEXT PARTITION FOL ' - db '5 NEXT PARTITION FOL ' - db '6 NEXT PARTITION FOL ' - db '7 NEXT PARTITION FOL ' - db '8 NEXT PARTITION FOL ' - db '9 NEXT PARTITION FOL ' - db '10 NEXT PARTITION FOL ' - db '11 NEXT PARTITION FOL ' - db '12 NEXT PARTITION FOL ' - db '13 NEXT PARTITION FOL ' - db '14 NEXT PARTITION FOL ' - db '15 NEXT PARTITION FOL ' - db '16 NEXT PARTITION FOL ' - db '17 NEXT PARTITION FOL ' - db '18 NEXT PARTITION FOL ' - db '19 NEXT PARTITION FOL ' - db '20 NEXT PARTITION FOL ' +hdimg: + dd aRD + db 'RAMDISK FOL ' + dd aFD + db 'FLOPPYDISK FOL ' +hdimg1 dd 0 + db 'HARDDISK FOL ' +hdimg2 dd 0 + db 'HARDDISK FOL ' +hdimg3 dd 0 + db 'HARDDISK FOL ' +hdimg4 dd 0 + db 'HARDDISK FOL ' +ptimg db 'PARTITION FOL ' modetext: ;0123456789012345 @@ -2778,36 +2495,53 @@ b_color dd 0x6677cc ; //// Willow ;Name of programs -editor db 'TINYPAD ' -bmpview db 'MV ' -jpgview db 'JPEGVIEW ' -gifview db 'GIFVIEW ' -ac97wav db 'AC97WAV ' -copyrfile db 'COPYR ' -rtfread db 'RTFREAD ' +editor db '/RD/1/TINYPAD',0 +bmpview db '/RD/1/MV',0 +jpgview db '/RD/1/JPEGVIEW',0 +gifview db '/RD/1/GIFVIEW',0 +ac97wav db '/RD/1/AC97WAV',0 +rtfread db '/RD/1/RTFREAD',0 ; //// Willow -pngview db '@RCHER ' +pngview db '/RD/1/@RCHER',0 ; //// Willow -midamp db 'MIDAMP ' +midamp db '/RD/1/MIDAMP',0 + +more_char db 10h fileinfo_start: -dd 16 -dd 0 -dd 0 ;tempzone+1000; -dd 0 -dd tempzone ;0x10000 -open_path: -times 256 db 0 ;run app path + dd 7 + dd 0 +fileinfo_params: + dd 0 + dd 0 + dd 0 + db 0 +fileinfo_name: + dd 0 + +clipfile_info: + dd ? + dd 0 + dd 0 + dd ? + dd paramtest + db '/RD/1/CLIPFILE.TXT',0 +copyr_run: + dd 7 + dd 0 + dd copyr_param + dd 0 + dd 0 + db '/RD/1/COPYR',0 fileinfoblock: - dd 0x0 ; read + dd 0x1 ; read folder dd 0x0 ; first block - dd 0x1 ; number of blocks to read -farea: + dd 0x0 ; flags (ANSI names) + dd 4095 ; number of blocks to read dd outinfo ; ret offset - dd tempzone ; work size of sytemram path: -times 256 db 0 ;path +times 1024 db 0 ;path table_area: rb 10 @@ -2815,6 +2549,12 @@ rb 10 ;rb 256 but_file: file 'systr12.GIF' + +I_END: + +scroll_height dd ? +scroll_pos dd ? + butimg: rb 400*16*3+8 ;buttons (left pice of picture) logoimg: @@ -2852,23 +2592,16 @@ rb 8000 gif_hash: rd 4096 -tempzone: ;temp zone for 58 function -rb 4000 - -sourcepath rb 100 -destpath rb 100 MYPID: rd 8 -I_END: - param_area: rb 256 paramtest: -rb 256 +rb 1024 filedir: -rb 256 +rb 1024 procinfo process_information sc system_colors @@ -2876,10 +2609,14 @@ sc system_colors fileinfo: rb 200 ;4096*62+1024 +copyr_param rb 256 + outinfo: -rb 4096*34+1024 +rb 32+4096*304 convinfo: -rb 4096*62+1024 - +rb 4096*27 +; stack + align 4 + rb 1024 RAM_END: diff --git a/programs/media/midamp/trunk/MIDAMP.ASM b/programs/media/midamp/trunk/MIDAMP.ASM new file mode 100644 index 0000000000..1970671f2d --- /dev/null +++ b/programs/media/midamp/trunk/MIDAMP.ASM @@ -0,0 +1,398 @@ +; MIDI PLAYER FOR MENUET v1.0 +; Written in pure assembler by Ivushkin Andrey aka Willow +; +; +; Created: December 7, 2004 +; Last changed: July 29, 2005 +; +; COMPILE WITH FASM + +PLAYLIST_PATH equ '/HD/1/MIDI/PLAYLIST.TXT' +APP_MEM equ 150*1024 +DIR_SIZE equ 1024 + +IPC_PLAY equ 0xa1 +IPC_PAUS equ 0xa2 +IPC_TRIG equ 0xa3 +IPC_UPDT equ 0xb1 +IPC_NEXT equ 0xb2 + +LISTITEMS equ 40 +WND_BACK equ 0x24263c +PLY equ 63 +WND_HEIGHT equ (PLY+9*LISTITEMS+10)+25 + +BTNS_XY equ 14 shl 16+42 +BTNS_SIZE equ 222 shl 16+17 + +BROWSE_X equ 10 shl 16+8 +BROWSE_Y equ 26 shl 16+8 +FN_XY equ 12 shl 16+15 +BAR_WIDTH equ 251 +BAR_X equ 10 shl 16 +BAR_Y equ 29 shl 16+5 +TOTALTIME_XY equ 124 shl 16+28 +CURTIME_X equ 225 shl 16+40 +CURTIME_Y equ 15 shl 16+11 +CURTIME_XY equ 236 shl 16+15 + +NONCRITICAL_MSG equ 0 +SOUND equ ON;OFF +OUTDUMP equ 0 +OUTLINE equ 8 +FL_SHUFFLE equ 0x01 +FL_REPEAT equ 0x02 +FL_HIDDEN equ 0x04 +FL_MUTE equ 0x08 +FL_REVERSE equ 0x10 +FL_ADD equ 0x20 +FL_PLAY equ 0x40 +FL_LOCK equ 0x80 +FL_BOTTRED equ 0x100 +FL_MULSEL equ 0x8000 + +use32 + org 0x0 + + db 'MENUET01' + dd 0x01 + dd START + dd I_END + dd APP_MEM + dd APP_MEM-1024 + dd I_PARAM +listsel dd 0 +channel dd 0 +COLOR_ORDER equ MENUETOS +include 'macros.inc' ; decrease code size (optional) +lang fix en +;purge mov +include 'debug.inc' +include 'dlg.inc' +include 'playlist.inc' +include 'gif_lite.inc' +bottom: + file 'bottom.gif' +hdrimg: + file 'hdr.gif' +btns: + file 'buttons.gif' +START: + or [flag],FL_BOTTRED;+FL_MUTE + mov ecx,ipcarea + call init_ipc + mcall 40,1000111b + mov esi,btns + mov edi,btn_raw + mov eax,hash_table + call ReadGIF + mov esi,hdrimg + mov edi,hdr_raw + mov eax,hash_table + call ReadGIF + mov esi,bottom + mov edi,bottom_raw + mov eax,hash_table + call ReadGIF + call respawn + mcall 9,prcinfo,-1 + mov edx,[ebx+30] + mov [parentPID],edx + mov esi,I_PARAM + cmp dword[esi],0 + jnz .yesparam + call PL_load + cmp [list_count],0 + je noparam + mov eax,[pl_ptr] + or word[eax],FL_MULSEL + jmp auto_load + .yesparam: + mov al,byte[esi] + cmp al,'/' + je .defact + mov [param],al + inc esi + .defact: + mov edi,filename;fnbuf + mov ecx,64 + rep movsd + jmp open_file +clearpath: + newline + mov [fname_len],0 + noparam: + mov [param],'W' + or [flag],FL_ADD + call fopen + get_path: + cmp byte[filename],0 + jz still + open_file: + cmp [param],'W' + je .noplay + cmp [param],'H' + jne .nohidd +; or [flag],FL_PLAY + or [flag],FL_HIDDEN + call draw_window + and [flag],not FL_HIDDEN + call Shade +; jmp .noplay + + .nohidd: + or [flag],FL_PLAY + .noplay: + xor eax,eax + mov [play_area],ax + mov [tick_count],eax + mov [delta],eax + inc eax + mov [fsize],eax + mov [curnote],0x80 + mov ecx,64 + mov esi,filename + mov edi,I_PARAM + rep movsd + mov eax,58 + mov ebx,file_info + int 0x40 + mov eax,ebx + shr eax,9 + inc eax + mov [fsize],eax + add ebx,workarea + mov [midi_limit],ebx + mov edi,I_PARAM + call find_slash + mov [fn_ptr],edi + mov edi,filename + call str_len + mov [fname_len],eax + mov eax,58 + mov ebx,file_info + int 0x40 +midi_kill: + call kill +include 'midilite.inc' + +decode_end: +; dpd edi +; dps <13,10,'Notes='> +; sub edi,[midi_limit] +; shr edi,1 +; dpd edi + dps ' Notes: max=' + movzx eax,[max_note] + dpd eax + dps 'min=' + movzx eax,[min_note] + dpd eax + newline +; sub esi,workarea +; jmp _close + .play: + call kill + call respawn + xor edx,edx + mov esi,[midi_limit] + mov [cur_ptr],esi + mov [cur_tick],edx + mov [delta],edx + .count_ticks: + lodsw + test eax,eax + jz .eof + and eax,0x7f + add edx,eax + jmp .count_ticks + .eof: + mov [tick_count],edx + if OUTDUMP eq 1 + mov esi,[midi_limit] + call out_dump + end if + and [flag],not FL_LOCK + test [flag],FL_PLAY + jz .noplay + call draw_window + mcall 5,100 + mov eax,IPC_PLAY + call ipc_send + .noplay: + test [flag],FL_ADD + jz red + mov esi,filename + mov ecx,[fname_len] + movzx eax,[list_count] + mov [play_num],eax + add_song: + call PL_add + and [flag],not FL_ADD +red: + call draw_window +still: + mov ecx,ipcarea + call init_ipc + mov eax,10 + int 0x40 +prc_event: + test eax,eax + jz still + .evt: + cmp eax,1 + je red + cmp eax,2 + je key + cmp eax,3 + je button + cmp eax,7 + jne still + movzx eax,byte[ipcarea+16] + cmp eax,IPC_UPDT + jne .noupdt + call draw_bar + jmp still + .noupdt: + cmp eax,IPC_NEXT + jne still + cmp [param],'H' + je _close + xor edx,edx + test [flag],FL_SHUFFLE + jz .noshuf + mcall 26,9 + movzx ebx,byte[list_count] + div ebx + mov eax,edx + jmp play_ + .noshuf: + test [flag],FL_REPEAT + jnz decode_end.play + mov eax,[play_num] + inc eax + cmp al,[list_count] + jb bList.next + mov eax,IPC_PAUS + call ipc_send + jmp red + +if OUTDUMP eq 1 +out_dump: + mov ecx,OUTLINE + .next_byte: + lodsd + bswap eax + dph eax + dps ' ' + lodsd + bswap eax + dph eax + dps <13,10> + loop .next_byte + ret +end if + +str_len: +; in: edi-str ptr +; out: eax-str length + push ecx edi + xor eax,eax + mov ecx,256 + repne scasb + jecxz .nofn + sub edi,[esp] + mov eax,edi + .nofn: + pop edi ecx + ret + +fopen: + or [flag],FL_LOCK + opendialog draw_window, ret_path, ret_path, filename +ret_path: + and [flag],not FL_LOCK + ret + +include 'event.inc' +include "thread.inc" +include "draw.inc" +; Здесь находятся данные программы: + + dd -2 shl 16+4,251,12 shl 16,29 shl 16+5 + dd 21,16 +main_coo: + dd 14 shl 16, 42 shl 16,23 shl 16 + dd 228 shl 16+38 + dd 14 shl 16+10 + dd 236 shl 16+15 +btncoords: + dd 120 shl 16+20, 1 shl 16+15 + dd 149 shl 16+44, 2 shl 16+12 + dd 195 shl 16+26, 2 shl 16+12 + + dd -2 shl 16+4,54,63 shl 16,6 shl 16+4 + dd 6,6 +main_coo2: + dd 169 shl 16, 4 shl 16,9 shl 16 + dd 121 shl 16+40 + dd 3 shl 16+9 + dd 130 shl 16+4 +btncoords2: + dd 48 shl 16+6, 6 + dd 2000 shl 16+44, 2 shl 16+12 + dd 2000 shl 16+26, 2 shl 16+12 +ipcarea rb 20 +ipcarea2 rb 20 + +dots db ':-' +text db 'tone> chnl> ,0xf0f000 + movsx ecx,[octave] + add ecx,100 + mcall ,0x30000,,<132,15> + pop ebx + mcall 7,,(275 shl 16+14),0 + mov esi,0x80ecce7a + + mov eax,8 + mov ebx,265 shl 16+7 + mov ecx,3 shl 16+7 + mov edx,1+1 shl 30 + int 0x40 ; close button + sub ebx,10 shl 16 + mov edx,100+1 shl 30 + int 0x40 ; shade button-101 + sub ebx,10 shl 16 + add edx,3 + int 0x40 ; minimize button-103 + sub ebx,239 shl 16 + inc edx ; about button-104 + int 0x40 + xor esi,esi + xor edi,edi + mov ecx,3 + pushd [ebp+12] + pushd [ebp+16] + call draw_navigation + add esp,8 + + mov ebx,[ebp-16] + add ebx,[ebp-20] + mov ecx,[ebp-12] + add ecx,[ebp-24] + mov esi,0x2c2b46 + mov edx,2+1 shl 29 + int 0x40 + + shr eax,1 + + mov ecx,12 + mov ebx,FN_XY + mov edx,[fn_ptr];I_PARAM;filename + mov esi,1;[fname_len] + mov edi,0x00e200 + .fnlp: + push ecx + mcall ,,edi + add ebx,1 shl 16 + mcall + add ebx,6 shl 16 + inc edx + pop ecx + loop .fnlp + add ebx,5 shl 16 + mcall ,,0xa0a0a0,text,text_end-text + call draw_bar + call PL_show + test [flag],FL_HIDDEN + jnz .nohide2 + mov eax,7 + mov ebx,btn_raw+12 + mov ecx,BTNS_SIZE + mov edx,BTNS_XY + int 0x40 + .nohide2: + mov esi,FL_SHUFFLE + mov edi,btncoords+8 + mov eax,13 + mov edx,0xd600 + mov ecx,2 + .loo3: + test [flag],esi + je .el + mov ebx,[edi] + add ebx,5 shl 16 + add ebx,[ebp] + mov bx,3 + push ecx + mov ecx,[edi+4] + add ecx,4 shl 16 + add ecx,[ebp+4] + mov cx,2 + int 0x40 + pop ecx + .el: + add edi,8 + inc esi + loop .loo3 + + .enddraw: + mov eax,12 + mov ebx,2 + int 0x40 + ret + +draw_navigation: +; ebp - coordinates + push esi edi ecx + mov eax,8 + + mov ecx,5 + mov ebx,[ebp] + add ebx,[ebp-8] + add ebx,esi + mov edx,3+1 shl 30 + .btnloo: + push ecx + mov ecx,[ebp+4] + add ecx,[ebp-4] + add ecx,edi + int 0x40 + pop ecx + add ebx,[ebp+8] + inc edx + loop .btnloo + pop ecx + + lea edi,[ebp+24] + .btnloo2: + mov ebx,[edi] + add ebx,[ebp] + add ebx,[esp+4] + push ecx + mov ecx,[edi+4] + add ecx,[ebp+4] + add ecx,[esp+4] + int 0x40 + pop ecx + add edi,8 + inc edx + loop .btnloo2 + pop edi esi + ret + +draw_cur_time: + pusha + mcall 13,,,WND_BACK + mcall 8,,,101+1 shl 29+1 shl 30 + mov ebx,[tick_count] + mov eax,[cur_tick] + test [flag],FL_REVERSE + jz .norev + xchg eax,ebx + sub eax,ebx + lea ebx,[esi-6 shl 16] + push eax + mcall 4,,0xf000,dots+1,1 + pop eax + .norev: + mov [esp+28],eax + popa +draw_total_time: ; eax -time to show + pusha + xor edx,edx + mov ebx,100 + div ebx + xor edx,edx + mov ebx,60 + div ebx + push edx + mov ecx,eax + mcall 47,0x20000,,esi,0xf000 + pop ecx + add edx,17 shl 16 + int 0x40 + sub edx,5 shl 16 + mcall 4,edx,esi,dots,1 + popa + ret + +BOTT_BTN equ 25 shl 16+18 +BOTT_SIZEX equ 25 +BOTT_SIZEY equ 18 +BOTT_S equ BOTT_SIZEX*BOTT_SIZEY*3 +BOTT_X equ PL_X +BOTT_Y equ (WND_HEIGHT-27) +BOTT_SPACE equ 30 shl 16 + +popup db -1 + +draw_bottom: + pusha + mcall 13,175,(BOTT_Y-5)shl 16+24,WND_BACK + add ebx,(266-30)shl 16-135 + mcall + mov ecx,5 + mov esi,bot_btn + push esi + mov ebx,bottom_raw+12 + xor eax,eax + .nxt: + push ecx + lodsw + shl eax,16 + lea edx,[eax+BOTT_Y] + mcall 7,,BOTT_BTN + add ebx,BOTT_S*4 + pop ecx + cmp ecx,4 + jne .noadj + add ebx,BOTT_S + .noadj: + loop .nxt + mov esi,[esp] + mov ecx,5 + mov ebp,BOTT_Y shl 16+BOTT_SIZEY + mov edx,20+1 shl 30 + .nxt2: + push ecx + lodsw + shl eax,16 + lea ebx,[eax+BOTT_SIZEX+2 shl 16-3] + mcall 8,,ebp + inc edx + pop ecx + loop .nxt2 + pop esi + call draw_popup + popa + ret + +draw_popup: + movsx eax,[popup] + cmp eax,0 + jge .ok + mov edx,30+1 shl 31 + mov ecx,21 + mov eax,8 + .clr: + mcall + inc edx + loop .clr + jmp .ex + .ok: + push eax + lea edx,[eax+1 shl 31+20] + mcall 8 + pop eax + mov ebx,eax + shl eax,2 + mov ecx,3 + cmp eax,4 + jne .noadj1 + inc ecx + .noadj1: + cmp eax,8 + jb .noadj2 + inc eax + .noadj2: + inc eax + push eax + movzx edx,word[bot_btn+ebx*2] + shl edx,16 + add edx,BOTT_Y + push edx + .noadj3: + imul ebx,eax,BOTT_S + add ebx,bottom_raw+12 + push ecx + .nxt: + push ecx + mcall 7,,BOTT_BTN + add ebx,BOTT_S + sub edx,BOTT_SIZEY + pop ecx + loop .nxt + pop ecx ebx edx + mov ebp,BOTT_Y shl 16+BOTT_SIZEY + mov eax,8 + add edx,1 shl 30+30 + add ebx,2 shl 16 + mov bx,BOTT_SIZEX-3 + .nxt2: + push ecx + mcall ,,ebp + inc edx + sub ebp,BOTT_SIZEY shl 16 + pop ecx + loop .nxt2 + .ex: + ret + +bot_btn: + dw 10,40,70,100,240 + +about1: + db 13,10,'* MIDAMP for MenuetOS v1.0 by Willow, July 2005 *',13,10,0 \ No newline at end of file diff --git a/programs/media/midamp/trunk/event.inc b/programs/media/midamp/trunk/event.inc new file mode 100644 index 0000000000..9686114bcc --- /dev/null +++ b/programs/media/midamp/trunk/event.inc @@ -0,0 +1,449 @@ +key_codes db 27,182,109,115,114,122,98,118,108,120,99,13,8,32,0, 0, 0,0 + db 180,181,93,91 +; bottom actions + db 0, 0, 0, 0, 0,185,0, 0, 0, 0,0,0,92 +btn_codes db 1, 0, 0, 9, 10, 3, 7, 6, 8, 4, 5, 0,0, 0,101,100,11,2 + db 0, 0, 0, 0 +; bottom actions + db 35,49,48,37,31,32,41,42,40,36,103,104,0 +jmps dw _close, kDel,kMute, bList.shuf, bList.repe, bList.prev, bList.next + dw bList.stop, kLoad, Xpress, Rewind.space, auto_load,Rewind, Rewind.space + dw bReverse, bShade, bList, bBar, bOctU, bOctD, bSelTrack, bSelChannel +; bottom actions + dw kDel,bLsave,bLload,bRemAll,bAdd,bAddDir,bSelZero,bInvSel,bSelAll,bRemCrop + dw bMinimize,bAbout,bResetTrk + +jmps_end: + +key: + mov eax,2 + int 0x40 + mov edi,key_codes + cmp ah,48 + jb .jump + cmp ah,57 + ja .jump + sub ah,48 + mov byte[channel],ah + jmp midi_kill + .jump: + mov ecx,(jmps_end-jmps)/2 + mov ebx,edi + shr eax,8 + repne scasb + jne play_.noplsel + sub edi,ebx + jmp word[jmps+edi*2-2] + kDel: + call PL_del + call PL_show + jmp still + kMute: + xor [flag],FL_MUTE + jmp still + kLoad: +; dps 'Load' + cmp [list_count],LISTITEMS + jbe noparam + jmp still + Xpress: + mov eax,IPC_PLAY + call ipc_send + jmp still;Rewind.space + auto_load: + call PL_get1stsel + mov eax,ebx + play_: + mov [play_num],eax + call PL_getbyindex + mov edi,filename;fnbuf + rep movsb + xor eax,eax + mov byte[edi],al + and [flag],not FL_ADD + or [flag],FL_PLAY + jmp open_file + .noplsel: + call PL_get1stsel + test ebx,ebx + jz .noupward + cmp al,178 + jne .noupa + .seldec: + dec ebx;[listsel] + .listdraw: + call PL_clearsel + mov eax,ebx + call PL_getbyindex + or word[esi-2],FL_MULSEL + call PL_show + jmp still + .noupa: + cmp al,184 + jne .noupward + dec [listsel] + .swap: + dec ebx + call PL_swap + jmp .listdraw + .noupward: + inc ebx + cmp bl,[list_count] + jae still + cmp al,177 + je .listdraw + .nodowna: + cmp al,183 + jne still + inc [listsel] + jmp .swap + Rewind: + push [midi_limit] + pop [cur_ptr] + and [cur_tick],0 + jmp red + .space: + cmp [tick_count],0 + jz still + mov eax,IPC_TRIG + call ipc_send + jmp red + + button: + mov eax,17 + int 0x40 + cmp ah,20 + jb .nobott + cmp ah,25 + ja .nobott + sub ah,20 + mov [popup],ah + .sh: + or [flag],FL_BOTTRED + call PL_show + jmp still + .nobott: + cmp ah,31 + jb .nopop + cmp ah,50 + ja .nopop + mov [popup],-1 + or [flag],FL_BOTTRED + call PL_show + +SH_POPUP equ 10 + if SH_POPUP eq 1 + mov ebx,eax + shr ebx,8 + dps 'Popup#=' + dpd ebx + jmp .sh + end if + .nopop: + mov edi,btn_codes + jmp key.jump + bReverse: + xor [flag],FL_REVERSE + call draw_bar + jmp still + _close: + call kill + or eax,-1 + int 0x40 + + bShade: + call Shade + jmp still + Shade: + xor [flag],FL_HIDDEN + test [flag],FL_HIDDEN + jz .open + mov esi,14 + mov [coo],main_coo2 + jmp .op + .open: + mov esi,WND_HEIGHT + mov [coo],main_coo + .op: + mov ebx,-1 + mov ecx,ebx + mov edx,ebx + mov eax,67 + int 0x40 + ret + bMinimize: +; mcall 18,10 + jmp still + bList: + mov [popup],-1 + mov edx,[listsel] + call PL_getitemclick + mov [listsel],eax + mcall 66,3 + mov ebx,eax +; dph ebx + test ebx,1100b + jnz .mul + call PL_clearsel + test ebx,11b + jz .skipor + mov ecx,[listsel] + mov [listsel],edx + cmp ecx,edx + je .skipor + ja .above + xchg ecx,edx + .above: + sub ecx,edx + inc ecx + mov eax,edx + push ecx + call PL_getbyindex + sub esi,2 + pop ecx + call PL_shiftsel + jmp .plsh + .mul: + bts [flag],15 + jc .skipor + mov eax,edx + call PL_getbyindex + or word[esi-2],FL_MULSEL + .skipor: + mov eax,[listsel] + call PL_getbyindex + xor word[esi-2],FL_MULSEL + .plsh: + call PL_show + mcall 40,111b + mcall 23,30 + push eax + mcall 40,1000111b + pop eax + cmp eax,3 + jne still + mcall 17 + cmp ah,11 + jne still + call PL_getitemclick + cmp eax,[listsel] + je auto_load + mov [listsel],eax + call PL_show + jmp still + .repe: + xor [flag],FL_REPEAT + jmp red + .stop: + mov eax,IPC_PAUS + call ipc_send + jmp Rewind + .shuf: + xor [flag],FL_SHUFFLE + jmp red + .prev: + mov eax,[play_num] + test eax,eax + jz still + dec eax + jmp play_ + .next: + mov eax,[play_num] + inc eax + cmp al,[list_count] + jae still + jmp play_ + bBar: + cmp [tick_count],0 + jz still + mov eax,37 + mov ebx,1 + int 0x40 + mov ebp,[coo] + sub eax,[ebp-16] + shr eax,16 + mov ebx,[tick_count] + mul ebx + mov ebx,[ebp-20] + div ebx + mov ebx,eax ; ebx - selected tick + xor ecx,ecx + mov esi,[midi_limit] + .further: + lodsw + and eax,0x7f + add ecx,eax + cmp ecx,ebx + jb .further + sub ecx,eax + mov [cur_tick],ecx + sub esi,2 + mov [cur_ptr],esi + drw: + jmp red + +OCT_CH equ 3 + bOctU: + add [octave],OCT_CH + jmp midi_kill + bOctD: + sub [octave],OCT_CH + jmp midi_kill + bSelChannel: + call get_num + cmp eax,-1 + je still + dps <13,10,'Channel#'> + dpd eax + mov [channel],eax + jmp midi_kill + bSelTrack: + call get_num + cmp eax,-1 + je still + dps <13,10,'Track#'> + dpd eax + mov [sel_track],al + jmp midi_kill + bResetTrk: + xor eax,eax + mov [sel_track],al + mov [channel],eax + dps <13,10,'Both track & channel are 0',13,10> + jmp midi_kill + bLsave: + call PL_save + bLload: + call PL_load + jmp red + bRemAll: + and [list_count],0 + mov [play_limit],playlist-2 + jmp red + bAdd: + movzx eax,[list_count] + dpd eax + call fopen + mov edi,filename + cmp byte[edi],0 + jz still + call str_len + xchg eax,ecx + mov esi,edi + jmp add_song + bAddDir: + call fopen + mov edi,filename + cmp byte[edi],0 + jz still + call find_slash + lea edx,[edi-filename+fnbuf] ; edx -> '/' + and byte[edi],0 + mov esi,filename + mov edi,fnbuf + mov ecx,64 + rep movsb + mov dword[file_info+12],dir_table + mov dword[file_info+8],DIR_SIZE/512 + .nxt2: + mcall 58,file_info + mov ecx,DIR_SIZE/32 + mov esi,dir_table + .nxt: + mov al,[esi] + cmp al,0xe5 + je .no + test al,al + jz .end + test byte[esi+12],11000b + jnz .no + mov eax,[esi+7] + mov al,'.' + cmp eax,'.MID' + je .ok + cmp eax,'.KAR' + jne .no + .ok: + mov [esi+8],eax + pusha + mov edi,edx + mov ecx,12 + rep movsb + and byte[edi],0 + mov ecx,edi + sub ecx,fnbuf + mov esi,fnbuf + call PL_add + popa + .no: + add esi,32 + loop .nxt + add dword[file_info+4],DIR_SIZE/512 + jmp .nxt2 + .end: + mov ebx,file_info + and dword[ebx+4],0 + mov [fsize],1 + mov dword[ebx+12],workarea + jmp red;still + bSelZero: + call PL_clearsel + jmp red + bInvSel: + call PL_invsel + jmp red + bSelAll: + call PL_clearsel + call PL_invsel + jmp red + bRemCrop: + call PL_invsel + call PL_del + jmp bSelAll + bAbout: + mov edx,about1 + call debug_outstr + jmp still + +get_num: ; out: eax-number entered + or [flag],FL_LOCK + mcall 10 + dpd eax + cmp eax,1 + jne .nored + call draw_window + jmp get_num + .nored: + cmp eax,2 + jne .nokey + mcall 2 + movzx eax,ah + sub eax,'0' + jl .none + cmp eax,9 + jbe .ok + .none: + mov eax,-1 + .ok: + and [flag],not FL_LOCK + ret + .nokey: + cmp eax,3 + jne get_num + mcall 17 + jmp get_num + +find_slash: +; in: edi-filename, out: edi-slash ptr-1 + push eax ecx + call str_len + mov ecx,eax + std + add edi,eax + mov al,'/' + repne scasb + cld + add edi,2 + pop ecx eax + ret + diff --git a/programs/media/midamp/trunk/gif_lite.inc b/programs/media/midamp/trunk/gif_lite.inc new file mode 100644 index 0000000000..4086245a33 --- /dev/null +++ b/programs/media/midamp/trunk/gif_lite.inc @@ -0,0 +1,328 @@ +; GIF LITE v2.0 by Willow +; Written in pure assembler by Ivushkin Andrey aka Willow +; +; This include file will contain functions to handle GIF image format +; +; Created: August 15, 2004 +; Last changed: September 9, 2004 + +; Change COLOR_ORDER in your program +; if colors are displayed improperly + +if ~ (COLOR_ORDER in ) +; This message may not appear under MenuetOS, so watch... + display 'Please define COLOR_ORDER: MENUETOS or OTHER',13,10 +end if + +; virtual structure, used internally + +struc GIF_list +{ + .NextImg rd 1 + .Left rw 1 + .Top rw 1 + .Width rw 1 + .Height rw 1 +} + +struc GIF_info +{ + .Left rw 1 + .Top rw 1 + .Width rw 1 + .Height rw 1 +} + +_null fix 0x1000 + +; **************************************** +; FUNCTION GetGIFinfo - retrieve Nth image info +; **************************************** +; in: +; esi - pointer to image list header +; ecx - image_index (0...img_count-1) +; edi - pointer to GIF_info structure to be filled + +; out: +; eax - pointer to RAW data, or 0, if error + +GetGIFinfo: + push esi ecx edi + xor eax,eax + jecxz .eloop + .lp: + mov esi,[esi] + test esi,esi + jz .error + loop .lp + .eloop: + add esi,4 + movsd + movsd + mov eax,esi + .error: + pop edi ecx esi + ret + +; **************************************** +; FUNCTION ReadGIF - unpacks GIF image +; **************************************** +; in: +; esi - pointer to GIF file in memory +; edi - pointer to output image list +; eax - pointer to work area (MIN 16 KB!) + +; out: +; eax - 0, all OK; +; eax - 1, invalid signature; +; eax >=8, unsupported image attributes +; +; ecx - number of images + +ReadGIF: + push esi edi + mov [.table_ptr],eax + mov [.cur_info],edi + xor eax,eax + mov [.globalColor],eax + mov [.img_count],eax + inc eax + cmp dword[esi],'GIF8' + jne .er ; signature + mov ecx,[esi+0xa] + inc eax + add esi,0xd + mov edi,esi + bt ecx,7 + jnc .nextblock + mov [.globalColor],esi + call .Gif_skipmap + .nextblock: + cmp byte[edi],0x21 + jne .noextblock + inc edi + cmp byte[edi],0xf9 ; Graphic Control Ext + jne .no_gc + add edi,7 + jmp .nextblock + .no_gc: + cmp byte[edi],0xfe ; Comment Ext + jne .no_comm + inc edi + .block_skip: + movzx eax,byte[edi] + lea edi,[edi+eax+1] + cmp byte[edi],0 + jnz .block_skip + inc edi + jmp .nextblock + .no_comm: + cmp byte[edi],0xff ; Application Ext + jne .nextblock + add edi,13 + jmp .block_skip + .noextblock: + cmp byte[edi],0x2c ; image beginning + jne .er + inc [.img_count] + inc edi + mov esi,[.cur_info] + add esi,4 + xchg esi,edi + movsd + movsd + push edi + movzx ecx,word[esi] + inc esi + bt ecx,7 + jc .uselocal + push [.globalColor] + mov edi,esi + jmp .setPal + .uselocal: + call .Gif_skipmap + push esi + .setPal: + movzx ecx,byte[edi] + inc ecx + mov [.codesize],ecx + dec ecx + pop [.Palette] + lea esi,[edi+1] + mov edi,[.table_ptr] + xor eax,eax + cld + lodsb ; eax - block_count + add eax,esi + mov [.block_ofs],eax + mov [.bit_count],8 + mov eax,1 + shl eax,cl + mov [.CC],eax + inc eax + mov [.EOI],eax + lea ecx,[eax-1] + mov eax, _null shl 16 + .filltable: + stosd + inc eax + loop .filltable + pop edi + mov [.img_start],edi + .reinit: + mov edx,[.EOI] + inc edx + push [.codesize] + pop [.compsize] + call .Gif_get_sym + cmp eax,[.CC] + je .reinit + call .Gif_output + .cycle: + movzx ebx,ax + call .Gif_get_sym + cmp eax,edx + jae .notintable + cmp eax,[.CC] + je .reinit + cmp eax,[.EOI] + je .end + call .Gif_output + .add: + push eax + mov eax,[.table_ptr] + mov [eax+edx*4],ebx + pop eax + cmp edx,0xFFF + jae .cycle + inc edx + bsr ebx,edx + cmp ebx,[.compsize] + jne .noinc + inc [.compsize] + .noinc: + jmp .cycle + .notintable: + push eax + mov eax,ebx + call .Gif_output + push ebx + movzx eax,bx + call .Gif_output + pop ebx eax + jmp .add + .er: + pop edi + jmp .ex + .end: + mov eax,[.cur_info] + mov [eax],edi + mov [.cur_info],edi + add esi,2 + xchg esi,edi + .nxt: + cmp byte[edi],0 + jnz .continue + inc edi + jmp .nxt + .continue: + cmp byte[edi],0x3b + jne .nextblock + xor eax,eax + stosd + mov ecx,[.img_count] + .ex: + pop edi esi + ret + +.Gif_skipmap: +; in: ecx - image descriptor, esi - pointer to colormap +; out: edi - pointer to area after colormap + + and ecx,111b + inc ecx ; color map size + mov ebx,1 + shl ebx,cl + lea ebx,[ebx*2+ebx] + lea edi,[esi+ebx] + ret + +.Gif_get_sym: + mov ecx,[.compsize] + push ecx + xor eax,eax + .shift: + ror byte[esi],1 + rcr eax,1 + dec [.bit_count] + jnz .loop1 + inc esi + cmp esi,[.block_ofs] + jb .noblock + push eax + xor eax,eax + lodsb + test eax,eax + jnz .nextbl + mov eax,[.EOI] + sub esi,2 + add esp,8 + jmp .exx + .nextbl: + add eax,esi + mov [.block_ofs],eax + pop eax + .noblock: + mov [.bit_count],8 + .loop1: + loop .shift + pop ecx + rol eax,cl + .exx: + xor ecx,ecx + ret + +.Gif_output: + push esi eax edx + mov edx,[.table_ptr] + .next: + push word[edx+eax*4] + mov ax,word[edx+eax*4+2] + inc ecx + cmp ax,_null + jnz .next + shl ebx,16 + mov bx,[esp] + .loop2: + pop ax + + lea esi,[eax+eax*2] + add esi,[.Palette] + + if COLOR_ORDER eq MENUETOS + mov esi,[esi] + bswap esi + shr esi,8 + mov [edi],esi + add edi,3 + else + movsw + movsb + end if + + loop .loop2 + pop edx eax esi + ret + + .globalColor rd 1 + .img_count rd 1 + .cur_info rd 1 ; image table pointer + .img_start rd 1 + .codesize rd 1 + .compsize rd 1 + .bit_count rd 1 + .CC rd 1 + .EOI rd 1 + .Palette rd 1 + .block_ofs rd 1 + .table_ptr rd 1 diff --git a/programs/media/midamp/trunk/hdr.gif b/programs/media/midamp/trunk/hdr.gif new file mode 100644 index 0000000000..d2807f1d98 Binary files /dev/null and b/programs/media/midamp/trunk/hdr.gif differ diff --git a/programs/media/midamp/trunk/macros.inc b/programs/media/midamp/trunk/macros.inc new file mode 100644 index 0000000000..d599dea0e0 --- /dev/null +++ b/programs/media/midamp/trunk/macros.inc @@ -0,0 +1,267 @@ +; new application structure +macro meos_app_start + { + use32 + org 0x0 + + db 'MENUET01' + dd 0x01 + dd __start + dd __end + dd __memory + dd __stack + + if used __params & ~defined __params + dd __params + else + dd 0x0 + end if + + dd 0x0 + } +MEOS_APP_START fix meos_app_start + +macro code + { + __start: + } +CODE fix code + +macro data + { + __data: + } +DATA fix data + +macro udata + { + if used __params & ~defined __params + __params: + db 0 + __end: + rb 255 + else + __end: + end if + __udata: + } +UDATA fix udata + +macro meos_app_end + { + align 32 + rb 2048 + __stack: + __memory: + } +MEOS_APP_END fix meos_app_end + + +; macro for defining multiline text data +struc mstr [sstring] + { + forward + local ssize + virtual at 0 + db sstring + ssize = $ + end virtual + dd ssize + db sstring + common + dd -1 + } + + +; strings +macro sz name,[data] { ; from MFAR [mike.dld] + common + if used name + label name + end if + forward + if used name + db data + end if + common + if used name + .size = $-name + end if +} + +macro lsz name,[lng,data] { ; from MFAR [mike.dld] + common + if used name + label name + end if + forward + if (used name)&(lang eq lng) + db data + end if + common + if used name + .size = $-name + end if +} + + + +; easy system call macro +macro mpack dest, hsrc, lsrc +{ + if (hsrc eqtype 0) & (lsrc eqtype 0) + mov dest, (hsrc) shl 16 + lsrc + else + if (hsrc eqtype 0) & (~lsrc eqtype 0) + mov dest, (hsrc) shl 16 + add dest, lsrc + else + mov dest, hsrc + shl dest, 16 + add dest, lsrc + end if + end if +} + +macro __mov reg,a,b { ; mike.dld + if (~a eq)&(~b eq) + mpack reg,a,b + else if (~a eq)&(b eq) + mov reg,a + end if +} + +macro mcall a,b,c,d,e,f { ; mike.dld + __mov eax,a + __mov ebx,b + __mov ecx,c + __mov edx,d + __mov esi,e + __mov edi,f + int 0x40 +} + + + + + + + +; optimize the code for size +__regs fix + +macro add arg1,arg2 + { + if (arg2 eqtype 0) + if (arg2) = 1 + inc arg1 + else + add arg1,arg2 + end if + else + add arg1,arg2 + end if + } + +macro sub arg1,arg2 + { + if (arg2 eqtype 0) + if (arg2) = 1 + dec arg1 + else + sub arg1,arg2 + end if + else + sub arg1,arg2 + end if + } + +macro mov arg1,arg2 + { + if (arg1 in __regs) & (arg2 eqtype 0) + if (arg2) = 0 + xor arg1,arg1 + else if (arg2) = 1 + xor arg1,arg1 + inc arg1 + else if (arg2) = -1 + or arg1,-1 + else if (arg2) > -128 & (arg2) < 128 + push arg2 + pop arg1 + else + mov arg1,arg2 + end if + else + mov arg1,arg2 + end if + } + + +macro struct name + { + virtual at 0 + name name + sizeof.#name = $ - name + end virtual + } + +; structures used in MeOS +struc process_information + { + .cpu_usage dd ? ; +0 + .window_stack_position dw ? ; +4 + .window_stack_value dw ? ; +6 + .not_used1 dw ? ; +8 + .process_name rb 12 ; +10 + .memory_start dd ? ; +22 + .used_memory dd ? ; +26 + .PID dd ? ; +30 + .x_start dd ? ; +34 + .y_start dd ? ; +38 + .x_size dd ? ; +42 + .y_size dd ? ; +46 + .slot_state dw ? ; +50 + rb (1024-52) + } +struct process_information + +struc system_colors + { + .frame dd ? + .grab dd ? + .grab_button dd ? + .grab_button_text dd ? + .grab_text dd ? + .work dd ? + .work_button dd ? + .work_button_text dd ? + .work_text dd ? + .work_graph dd ? + } +struct system_colors + + +; constants + +; events +EV_IDLE = 0 +EV_TIMER = 0 +EV_REDRAW = 1 +EV_KEY = 2 +EV_BUTTON = 3 +EV_EXIT = 4 +EV_BACKGROUND = 5 +EV_MOUSE = 6 +EV_IPC = 7 +EV_STACK = 8 + +; event mask bits for function 40 +EVM_REDRAW = 1b +EVM_KEY = 10b +EVM_BUTTON = 100b +EVM_EXIT = 1000b +EVM_BACKGROUND = 10000b +EVM_MOUSE = 100000b +EVM_IPC = 1000000b +EVM_STACK = 10000000b \ No newline at end of file diff --git a/programs/media/midamp/trunk/midamp.txt b/programs/media/midamp/trunk/midamp.txt new file mode 100644 index 0000000000..12407dcf51 --- /dev/null +++ b/programs/media/midamp/trunk/midamp.txt @@ -0,0 +1,247 @@ +MIDAMP for Menuet v1.0 July 29, 2005 + Written in pure assembler by Ivushkin Andrey aka Willow + +Monophonic MIDI player + +Vivat assembler et MENUETOS! +MenuetOS still has a poor sound capabilities. Drivers are written for a few +soundcard models. Till recently I considered MEOS to be as voiceless as an +oyster. But then an alternative appeared; dear VaStaNi wrote kernel support of +PC speaker. Old good times of Pascal and MS-DOS came to me again. About 5 years +ago I wrote a Pascal application that parsed and played a note string in QBasic +syntax. + +Now MeOS gets the simplest, speaker-driven sound scheme in Mario79's distro, +but the first melody in Menuet I heard was from the my program MIDAMP in +December, 2004. On technical reasons its release takes place only now. + +So, MIDAMP is the simplest single-voiced MIDI player. It cannot do much though +it resembles the famous WinAmp. All it can do is to beep MIDI files. +There are no equalizer, balance and fader, and they won't appear. Moreover, +I may guarantee the correct sound only for files having a single track, one +instrument channel and within technological range of notes :-( + +######### +System requirements: +1. Kernel having following function implemented: + 55/55 - PC speaker interface (critical!) + 67 - window shading; + 66/3 - for extended mouse selection in playlist. +2. SYSXTREE version not below 52 - opening files and directories (critical!) +3. RAM amount for application - about 150 Kbytes. +######### + +MIDAMP still uses a single playlist - /HD/1/PLAYLIST.TXT by default. Persons +interested can change the PLAYLIST_PATH constant value in MIDAMP.ASM. Playlist +is a simple text file having filenames to be played in each line. It is NOT +RECOMMENDED to edit the playlist by hand - bugs may appear while loading MIDAMP. + +When started, MIDAMP creates a new thread whose job is actually playing. Early +versions had main thread that processed everything, therefore unpleasant sound +delays appeared when managing the playlist. Threads communicate intensively +through IPC, although I think it's an excess in such a case. But it works not +bad. + +MIDAMP is able to shade to window header by pressing the proper button. I tried +to perform complete minimization through mcall 18,10 (new feature of Kolibri4), +but ran into the problem while restoring of window when PANEL button pressed. +That function possibly does not support windows type II ? + +Hotkeys - almost like in WinAmp: + +Del - delete the selected tracks; +z - previous track; +x, Enter, double click - play selected file; +c, Space - pause; +v - stop; +b - next track; + +Esc - close the program; +m - sound on/off; +PgUp, PgDn - swap 2 tracks (not completed!); +BackSpace - rewind track; +Home/End - increase/decrease melody notes offset and play track from beginning + (it is shown near 'tone>' text). + +In the case of polyphonic MIDI, if an intelligent melody isn't heard, you may +try to choose another track 'trk' or instrument channel 'chnl', pressing '[' or +']' accordingly and then a number key from '0' to '9'. The file will be played +from the beginning. To reset track and channel to the default value, press '\' . + +Explaining some interface buttons: +Shuffle toggles random playback on/off. Repeat - current track will loop again +and again. An icon in the top left corner outputs a brief info about the +program to the Debug Board. Clicking the time toggles its view - from beginning +or from the end of file. + +Mouse click on playlist when holding Shift or Ctrl button works like in WinAmp. + +Remarks to bottom buttons: +'Add URL' not implemented, on clear reasons; +'Add Dir' - specify any file in the directory desired. *.MID and *.KAR files of + that directory will be added to the list; +'Misc' submenu is not implemented; +'New List' does nothing. MIDAMP still uses a fixed playlist. + +One of the following flags may precede a filename in the commandline: + +W - to load a file and wait (default); +P - to play a file; +H - to start shaded and close after playback. + +To-Do list: + +1. Increase playlist size (40 items for now). +2. Add dialog to select tracks of polyphonic melodies including analysis on + notes. +3. Reading text in Karaoke files. +4. Playlist select. +5. Note editor, as in Ringtone Editor. +6. Add comments to source. +7. Correct bugs to be found. + +Special thanks to: + + VaStaNi - there would be no need of MIDAMP w/o his code + Standard MIDI Files 0.06 March 1, 1988 + MIDI 1.0 Specification + General MIDI Level Spec + MIDI SAMPLE DUMP STANDARD + Standard MIDI File Format by Dustin Caldwell + Files format of MIDI + The USENET MIDI Primer by Bob McQueer + Pavlushin Evgeny for his splendid SYSXTREE (DLGS.INC is the opendialog macro + of ASCL library edited to meet MIDAMP specific needs) + +Send the wishes and bug reports to wil_low@hotbox.ru or to the meos.sysbin.com +forum. + +See you later! + + +**************************************** +**************************************** + +MIDAMP для Menuet v1.0 29 июля 2005 г. + Написана на чистом ассемблере Ивушкиным Андреем (Willow) + +Монофонический MIDI-плеер + +Vivat assembler et MENUETOS! +Со звуком в MenuetOS туго до сих пор. Драйвера написаны для ограниченного круга +звуковых карт. До недавнего времени MeOS была для меня нема, как рыба. Но потом +появилась альтернатива - уважаемый VaStaNi написал поддержку PC спикера. Мне +сразу вспомнились старые добрые времена Паскаля и MS-DOS. Лет 5 назад написал +на Паскале программку, которая парсила, а потом воспроизводила строку нот в +синтаксисе QBasic. + +Сейчас MeOS в дистрибутиве Mario79 обретает простейшую звуковую схему с помощью +спикера, но первую мелодию в Menuet я услышал все-таки от своей программы - +MIDAMP в декабре 2004 года. По техническим причинам ее релиз происходит только +сейчас. + +Итак, MIDAMP - простейший одноголосый MIDI-проигрыватель. Он не претендует на +многое, хоть и похож на WinAmp. Все, что он умеет, это пиликать MIDI-файлы. +Эквалайзера, баланса и регулятора громкости нет и не предвидится. Более того, +корректное звучание могу гарантировать лишь для файлов с 1 треком, 1 каналом +инструмента и в пределах технологического диапазона нот :-( + +######### +Системные требования: +1. Ядро с реализацией следующих системных функций: + 55/55 - интерфейс PC спикера (необходимо!); + 67 - сворачивание окна в заголовок; + 66/3 - для режимов выделения треков мышью. +2. SYSXTREE версии не ниже 52 - открытие файлов и каталогов (необходимо!) +3. Объем памяти для программы - около 150 Кб. +######### + +Пока что MIDAMP использует единственный плейлист - по умолчанию +/HD/1/PLAYLIST.TXT. Желающие могут изменить значение константы PLAYLIST_PATH в +файле MIDAMP.ASM. Плейлист - обычный текстовый файл, в каждой строке которого +находится имя файла для воспроизведения. Его НЕ РЕКОМЕНДУЕТСЯ править вручную - +возможны баги при последующей загрузке его приложением. + +При запуске MIDAMP создает новый поток, задачей которого является собственно +озвучка. В ранних версиях все делал главный поток, поэтому возникали неприятные +задержки в звучании во время управления плейлистом. Потоки интенсивно общаются +между собой через IPC, хотя я склоняюсь к тому, что в данном случае это +излишество. Но работает неплохо. + +MIDAMP умеет сворачиваться в строку заголовка нажатием соответствующей кнопки. +Я пытался сделать полное сворачивание через mcall 18,10 (новая фича Kolibri4), +но столкнулся с проблемой восстановления окна нажатием кнопки PANEL. Возможно, +функция не поддерживает окна типа II ? + +Горячие клавиши - почти как в WinAmp: + +Del - удалить выделенные треки; +z - предыдущий трек; +x, Enter, двойной щелчок на файле - воспроизведение; +c, Space - пауза; +v - стоп; +b - следующий трек; + +Esc - закрыть программу; +m - включить/выключить звук; +PgUp, PgDn - поменять местами 2 соседних трека (не закончено!); +BackSpace - перемотка трека в начало; +Home/End - увеличить/уменьшить тональность мелодии и проиграть ее с начала + (отображается рядом с надписью 'tone>'). + +В случае полифонических MIDI, если осмысленной мелодии не получается, можно +попробовать выбрать другой трек 'trk' или канал инструмента 'chnl', нажав +соответственно '[' или ']' и затем клавишу с номером от 0 до 9. Файл будет +воспроизведен с самого начала. Сброс дорожки и канала в значение по умолчанию - +нажатием '\' . + +Назначение некоторых кнопок интерфейса: +Shuffle - случайный порядок проигрывания треков. Repeat - текущий трек будет +проигрываться снова и снова. Значок в левом верхнем углу выводит краткую +информацию о программе на доску отладки. Щелчок на временной метке меняет +способ ее отображения - с начала или с конца файла. + +Щелчок мышью на плейлисте с нажатым Shift или Ctrl работает аналогично WinAmp. + +Замечания относительно кнопок внизу: +'Add URL' не реализовано по понятным причинам; +'Add Dir' - укажите любой файл в желаемом каталоге. Файлы *.MID и *.KAR этого + каталога будут добавлены в список; +'Misc' подменю не реализовано; +'New List' ничего не делает. Пока используется фиксированный плейлист. + +В командной строке перед именем файла для воспроизведения может стоять один из +флагов: + +W - просто загрузить файл (по умолчанию); +P - воспроизвести файл; +H - стартовать свернутым в заголовок, закрыться после воспроизведения. + +Что еще нужно сделать: + +1. Увеличить размеры плейлиста (сейчас 40 позиций). +2. Добавить диалог выбора треков полифонических мелодий с их анализом по + наличию нот. +3. Чтение текста в караоке-файлах. +4. Выбор плейлиста. +5. Нотный редактор, как в Ringtone Editor. +6. Откомментировать код (как всегда, лень). +7. Исправить баги, которые, несомненно, найдутся ;-) + +Особые благодарности: + + VaStaNi - без его кода написание MIDAMP не имело бы смысла + Standard MIDI Files 0.06 March 1, 1988 + MIDI 1.0 Specification + General MIDI Level Spec + MIDI SAMPLE DUMP STANDARD + Standard MIDI File Format by Dustin Caldwell + Формат файлов MIDI + The USENET MIDI Primer by Bob McQueer + Павлюшину Евгению за непревзойденный SYSXTREE (DLGS.INC - переработанный с + учетом специфики MIDAMP'a макрос opendialog библиотеки ASCL) + +Пожелания и сообщения об ошибках направляйте на wil_low@hotbox.ru или на форум +meos.sysbin.com. + +До новых встреч! \ No newline at end of file diff --git a/programs/media/midamp/trunk/midilite.inc b/programs/media/midamp/trunk/midilite.inc new file mode 100644 index 0000000000..950521d86e --- /dev/null +++ b/programs/media/midamp/trunk/midilite.inc @@ -0,0 +1,292 @@ +SYS equ meos +midi_parse: + and [max_note],0 + and [cur_track],0 + mov [min_note],0xff + mov edi,[midi_limit] + cmp dword[workarea],'MThd' + je .head_ok + mov edx,sHeadInv + call debug_outstr + jmp clearpath + .head_ok: + cmp dword[workarea+4],0x6000000 + je .heads_ok + mov edx,sHSizeInv + call debug_outstr + jmp clearpath + .heads_ok: + cmp dword[workarea+8],0x1000000 + jmp .headt_ok + mov edx,sTypeUnsup + call debug_outstr + jmp clearpath + .headt_ok: + movzx eax,word[workarea+12] + rol ax,8 + mov [quarter],eax + mov [tempo],50 + mov esi,workarea+0xe +skip_sections: + lodsd + cmp eax,'MTrk' + je track_found +if SYS eq meos +; dps <'What?',13,10> +end if + lodsd + add esi,eax + cmp esi,[midi_limit] + jbe skip_sections + if NONCRITICAL_MSG eq 1 + dps 'No more tracks' + end if + and word[edi],0 +; ud2 + jmp decode_end +track_found: +if SYS eq meos1 + dps <13,10,'Track '> + push esi + sub esi,workarea +; dpd esi + pop esi +end if + lodsd + bswap eax + mov bl,[cur_track] + cmp bl,[sel_track] + je .trk_fnd + add esi,eax + jmp next_event.eot + .trk_fnd: + mov [track_len],eax + dps 'TRK' +next_event: + call readvar +; dpd eax + add [delta],eax + lodsw ; al -event, ah - next byte +if SYS eq meos1 + dph eax + dps <' ',13,10> + newline +end if + test al,0x80 ; check if a valid event + jnz .valid_evt2 + dec esi + shl ax,8 + mov al,[prev_cmd] + jmp .valid_evt + .valid_evt2: + mov [prev_cmd],al + .valid_evt: + cmp al,0xf0 + jne .nosysex + dec esi + call readvar + add esi,eax + jmp next_event + .nosysex: + cmp al,0xff + jne .no_meta + + ; meta events + cmp ah,0x51 + jne .notempo + push eax edx + mov eax,[esi] + xor al,al + bswap eax + xor edx,edx + mov ebx,10000 + div ebx + pop edx eax + jmp .no_eot + .notempo: + cmp ah,0x2f ; end of track + jne .no_eot + inc esi +if SYS eq meos1 + dps <13,10,'EOT'> + push esi + sub esi,workarea + dpd esi + pop esi +; mcall 5,200 +; dph eax +; ud2 +end if + .eot: +; dps 'EOT ' + inc [cur_track] + jmp skip_sections;decode_end + .no_eot: + lodsb + movzx ecx,al ; ecx - length of metadata + add esi,ecx + jmp next_event + .no_meta: + cmp al,0xfa ; system ctl events + jb .no_sys + .dec_esi: + dec esi + jmp next_event + .no_sys: + cmp al,0xf8 + je .dec_esi + movzx ecx,al ; ecx - MIDI Event Command + and ecx,0xf ; cl - channel + and al,0xf0 ; al - event code + + cmp al,0xe0 ; Pitch wheel change + je .inc_esi + cmp al,0xb0 + ja .no_inc + .inc_esi: + inc esi + .no_inc: + cmp ecx,[channel] ; Channel must be 0 !!! + jz .chan_ok + if NONCRITICAL_MSG eq 1 + dps 'C' ; Reference to unsupported channel !!! + dpd ecx + mov ecx,esi + dps '-' + sub ecx,workarea+1 + dpd ecx + end if + jmp next_event + .chan_ok: + cmp al,0x90 ; Note On + jne .no_noon + add al,[octave] + cmp [curnote],0x80 + je .note_ok + if NONCRITICAL_MSG eq 1 + dps 'N!' ; Note On without Off !!! + end if + .note_ok: +; dps 'N+' +; movzx ecx,ah +; dpd ecx + call insert_pause + mov [curnote],ah ; [curnote]=note number + jmp next_event + .no_noon: + cmp al,0x80 ; Note Off + jne .no_nooff + add ah,[octave] + cmp ah,[curnote] + je .off_ok + if NONCRITICAL_MSG eq 1 + dps 'n!' ; Note Off mismatch !!! + end if + .off_ok: +; dps 'N-' + cmp ah,[max_note] + jbe .nomax + mov [max_note],ah + .nomax: + cmp ah,[min_note] + jae .ins + mov [min_note],ah + .ins: + call insert_note + mov [curnote],al + + .no_nooff: ; No more supported events + jmp next_event +prev_cmd db ? +max_note db ? +min_note db ? +; ********************************************* +; ******* READ VARIABLE BYTES **************** +; ********************************************* + +readvar: +; in: esi - pointer; +; out: esi - new pointer; eax - value; + push ebx ecx + movzx ebx,byte[esi] + inc esi + btr ebx,7 + jnc .exit + .next: + shl ebx,7 + lodsb + mov ecx,eax + and eax,0x7f + add ebx,eax + cmp cl,0x7f + ja .next + .exit: + mov eax,ebx + pop ecx ebx + ret + +; ********************************************* +; ******* INSERT PAUSE *********************** +; ********************************************* + +insert_pause: + cmp [delta],0 + jz return + push eax ebx ecx + mov ah,0xff + jmp write_note + +; ********************************************* +; ******* INSERT NOTE ************************ +; ********************************************* + +insert_note: ; ah - note code + push eax ebx ecx + movzx eax,ah + mov ebx,12 + div bl + shl al,4 + add ah,al + sub ah,0x1f +write_note: + push eax + mov eax,[delta] + mov edx,[tempo] + mul edx + mov ecx,[quarter] + div ecx ; ax - note delay + cmp eax,0x7f + jb .ok + mov eax,0x7f + .ok: + movzx ecx,al + or ecx,0x80 + pop eax + mov al,cl + stosw + xor eax,eax + mov [delta],eax + pop ecx ebx eax +return: + ret + +sHeadInv: +if lang eq ru + db "Неверный заголовок",0 +else + db "Header invalid",0 +end if + +sHSizeInv: +if lang eq ru + db 'Неверный размер заголовка',0 +else + db 'Header size invalid',0 +end if + +sTypeUnsup: +if lang eq ru + db 'Тип MIDI не поддерживается',0 +else + db 'MIDI type not supported',0 +end if diff --git a/programs/media/midamp/trunk/playlist.inc b/programs/media/midamp/trunk/playlist.inc new file mode 100644 index 0000000000..427e6206c7 --- /dev/null +++ b/programs/media/midamp/trunk/playlist.inc @@ -0,0 +1,349 @@ +; Playlist support for MIDPLAY +LCOLOR equ 0x00ff00 +PCOLOR equ 0xffffff + +PL_X equ 10 shl 16 +PL_Y equ PLY shl 16 +PL_XY equ 10 shl 16+PLY + +PL_show: + test [flag],FL_HIDDEN + jnz .ex + pusha + and [counter],0 + mov ebx,PL_X+255 + mov eax,13 + mov ecx,PL_Y-1 shl 16+4+9*LISTITEMS + xor edx,edx + int 0x40 + movzx ecx,byte[list_count] + test ecx,ecx + jz .ex2 + push ecx + imul ecx,9 + add ecx,PL_Y-1 shl 16-2 + mov edx,11+1 shl 29+1 shl 30 + mov eax,8 + int 0x40 + pop ecx + mov edi,[pl_ptr] + mov eax,4 + mov ebx,PL_XY+2 shl 16 + .sh_loop: + movzx esi,word[edi] + and esi,not FL_MULSEL + add edi,2 + pusha + mov edx,edi + mov ecx,[counter] + test word[edi-2],FL_MULSEL + jz .nosel + pusha + mov ebx,PL_X+255+1 shl 16-2 + imul ecx,9 + shl ecx,16 + add ecx,PL_Y-1 shl 16+8 + mov edx,0xc6 + mov eax,13 + int 0x40 + popa + .nosel: + pusha + mov edx,ebx + mov esi,0xa0a0a0;0x508cec + mcall 47,0x30000 + popa + cmp ecx,[play_num] + je .high + mov ecx,LCOLOR + jmp .int + .high: + mov ecx,PCOLOR + .int: + add ebx,25 shl 16 + int 0x40 + popa + add edi,esi + add ebx,9 + inc [counter] + loop .sh_loop2 + jmp .ex2 + .sh_loop2: + jmp .sh_loop + .ex2: + popa + test [flag],FL_BOTTRED + jz .nobott + pusha + mcall 7,hdr_raw+12+275*16*3,<275,12>,<10,(WND_HEIGHT-20)> + mov ebp,main_coo2 + mov esi,10 shl 16 + mov edi,(WND_HEIGHT-22)shl 16 + mov ecx,1 + pushd 155 shl 16+5 + pushd (WND_HEIGHT-22) shl 16+5 + call draw_navigation + add esp,8 + popa + call draw_bottom + and [flag],not FL_BOTTRED + .nobott: + .ex: + ret + +PL_add: +; in: esi->filename,ecx->fname_len + jecxz .ex + cmp [list_count],LISTITEMS + jae .ex + pusha + mov edi,[play_limit] + mov [edi],cx + add edi,2 + rep movsb + mov [play_limit],edi + inc [list_count] + popa + .ex: + ret + +PL_del: + movzx ecx,byte[list_count] + jecxz .ex + call PL_get1stsel + mov edx,ebx + .lp: + mov edi,esi + xor eax,eax + lodsw + btr eax,15 + jc .elp2 + add esi,eax + jmp .elp + .elp2: + push esi ecx + add esi,eax + mov ecx,[play_limit] + sub ecx,esi + rep movsb + mov [play_limit],edi + dec [list_count] + cmp edx,[play_num] + ja .no + dec [play_num] + .no: + pop ecx esi + sub esi,2 + .elp: + inc edx + loop .lp + .ex: + ret + +PL_getitemclick: +; out: eax- item # (0..n) + mov ebx,1 + mov eax,37 + int 0x40 + sub eax,PLY-1 + mov ebx,9 + div bl + movzx eax,al + ret + +PL_getbyindex: +; in:eax-index, out: esi-filename, ecx-length + mov esi,[pl_ptr] + mov ecx,eax + .loop: + lodsw + and eax,not FL_MULSEL + jecxz .gbi + add esi,eax + dec ecx + jmp .loop + .gbi: + movzx ecx,ax + ret + +PL_get1stsel: +; out: esi- 1st selected, ebx - index + mov esi,[pl_ptr] + xor ebx,ebx +PL_getnextsel: + push eax ecx + movzx ecx,[list_count] + .lp: + movzx eax,word[esi] + btr eax,15 + jc .ex2 + lea esi,[esi+eax+2] + inc ebx + loop .lp + xor ebx,ebx + .ex2: + pop ecx + .ex: + pop eax + ret + +PL_clearsel: + pusha + mov ebx,not FL_MULSEL + xor eax,eax + mov esi,[pl_ptr] + movzx ecx,[list_count] + jecxz .flg + .loop: + and word[esi],bx + lodsw + add esi,eax + loop .loop + .flg: + and [flag],not FL_MULSEL + popa + ret + +PL_shiftsel: + pusha + xor eax,eax +; mov esi,[pl_ptr] +; movzx ecx,[list_count] + .loop: + lodsw + or word[esi-2],FL_MULSEL + add esi,eax + loop .loop + jmp PL_clearsel.flg + +PL_invsel: + pusha + mov ebx,not FL_MULSEL + xor eax,eax + mov esi,[pl_ptr] + movzx ecx,[list_count] + jecxz .ex + .loop: + xor word[esi],FL_MULSEL + lodsw + and eax,ebx + add esi,eax + loop .loop + .ex: + jmp PL_clearsel.flg + +PL_load: + and [list_count],0 + mov [pl_ptr],playlist + mov ebx,PL_info + mov dword[ebx+12],playlist + mov eax,58 + int 0x40 + test eax,eax + jz .ok1 ; ebx- filesize + cmp eax,6 + jne .ex + .ok1: + mov eax,0x0a0d + cmp word[playlist],ax + je .ok + sub [pl_ptr],2 + .ok: + mov edi,[pl_ptr] + add ebx,edi + mov word[ebx],ax + add edi,2 + .loo: + mov edx,edi + .loo2: + mov ecx,256 + repne scasb + cmp edi,ebx + jb .ok2 + lea edi,[ebx+1] + .ok2: + mov ecx,edi + sub ecx,edx + dec ecx + inc edi + jecxz .shift + mov [edx-2],cx + inc [list_count] + cmp edi,ebx + jb .loo + .ex1: + sub ebx,2 + mov [play_limit],ebx + .ex: + ret + + .shift: + mov ecx,ebx + sub ecx,edi + jecxz .ex1 + sub ebx,2 + mov esi,edi + sub edi,2 + push edi + rep movsb + pop edi + jmp .loo + +PL_save: + movzx ecx,byte[list_count] + jecxz .ex + mov eax,0x0a0d + mov edi,[pl_ptr] + lea edx,[edi+2] + mov [PL_info+12],edx + .savl: + movzx ebx,word[edi] + and bx,not FL_MULSEL + stosw + add edi,ebx + loop .savl + stosw + sub edi,[pl_ptr] + mov ebx,PL_info + mov [ebx+8],edi + mov dword[ebx],1 + mov eax,58 + int 0x40 + .ex: + ret + +PL_swap: ; swap [ebx] with [ebx+1] + mov eax,ebx + call PL_getbyindex + add ecx,2 + sub esi,2 + push ecx esi ; save begin & length of 1st fname + mov edi,fnbuf + rep movsb + movzx ecx,word[esi] + and cx,not FL_MULSEL + add ecx,2 + pop edi + rep movsb + pop ecx + mov esi,fnbuf + rep movsb + cmp ebx,[play_num] + jne .nosel1 + inc [play_num] + ret + .nosel1: + inc ebx + cmp ebx,[play_num] + jne .nosel2 + dec [play_num] + .nosel2: + ret + +PL_info: + .mode dd 0 + dd 0 + .bytes dd 20 + dd 0 + dd hash_table + db PLAYLIST_PATH,0 diff --git a/programs/media/midamp/trunk/playlist.txt b/programs/media/midamp/trunk/playlist.txt new file mode 100644 index 0000000000..10ba6d24da --- /dev/null +++ b/programs/media/midamp/trunk/playlist.txt @@ -0,0 +1,30 @@ +/HD/1/MIDI2/MID/CALIFOR .MID +/HD/1/MIDI2/ZNAYU .MID +/HD/1/MIDI2/MID/WILD_D~1.MID +/HD/1/MIDI/FILES/JACKSON .MID +/HD/1/MIDI/FILES/MOZART .MID +/HD/1/MIDI2/MID/FAVGAME .MID +/HD/1/MIDI/PETERB .MID +/HD/1/MIDI/KVN .MID +/HD/1/MIDI2/911 .MID +/HD/1/MIDI2/HYMN .MID +/HD/1/MIDI2/GEIGU .MID +/HD/1/MIDI2/MID/COMEAS .MID +/HD/1/MIDI/FILES/SAINTS .MID +/HD/1/MIDI/FILES/SNOW .MID +/HD/1/MIDI/FILES/90210 .MID +/HD/1/MIDI/FILES/AMAZING .MID +/HD/1/MIDI/FILES/99LUFT~1.MID +/HD/1/MIDI/FILES/EUROPE .MID +/HD/1/MIDI/FILES/VANESSA .MID +/HD/1/MIDI/FILES/SPICE .MID +/HD/1/MIDI/FILES/NIEMAL~1.MID +/HD/1/MIDI/FILES/SMS .MID +/HD/1/MIDI/FILES/PRIMA .MID +/HD/1/MIDI/FILES/POPCORN .MID +/HD/1/MIDI/FILES/POLKKA .MID +/HD/1/MIDI/FILES/SW_FINAL.MID +/HD/1/MIDI/FILES/MAJORT~1.MID +/HD/1/MIDI/FILES/7DAYS .MID +/HD/1/MIDI/FILES/AADAMS .MID + diff --git a/programs/media/midamp/trunk/playnote.txt b/programs/media/midamp/trunk/playnote.txt new file mode 100644 index 0000000000..c746009b26 --- /dev/null +++ b/programs/media/midamp/trunk/playnote.txt @@ -0,0 +1,293 @@ +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* * +* Copyright 2003 VaStaNi * +* vastani@ukr.net * +* >>>- SIMPLY - QUICKLY - SHORTLY -<<< * +* * +* About Player Notes for Speaker PC. * +* ( PLAYNOTE.INC v.1.1 for MENUET OS ) * +* * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + + --- ATTACH --- + +>>> Insert string: include "PLAYNOTE.INC" in list file KERNEL32.INC +......... +......... ......... ............................. +......... ......... ............................. +......... ......... ............................. + +; sound + +include "SB16.INC" ; playback for Sound Blaster 16 +include "PLAYNOTE.INC" ; player Note for Speaker PC + +......... +......... ......... ............................. +......... ......... ............................. + + + +>>> Insert line --->>> call playNote --->>> in procedure irq0 + + ( listing file SYS32.INC for KERNEL.ASM ) + + .... .... + .... .... + .... .... + + no_error_in_previous_process: + + mov edi,[0x3000] + imul edi,8 + mov [edi+gdts+ tss0 +5], word 01010000b *256 +11101001b + + inc dword [0xfdf0] + + mov eax,[0xfdf0] + + call playNote ; <<<--- INSERT THIS LINE !!!!!!!!!! + + cmp eax,[next_usage_update] + jb nocounter + add eax,100 + mov [next_usage_update],eax + call updatecputimes + + nocounter: + .... .... + .... .... + .... .... + + + +>>> file SB16.INC have this label... + .... .... + .... .... + .... .... + + no_SB16_data_format: + + ret + +>>> I suggest add this code for subfunction #55 function #55 OS (player notes) + .... .... + .... .... + .... .... + + no_SB16_data_format: + cmp eax, edi ; this is subfunction #55 ? + jne retFunc55 ; if no then return. + movzx eax, byte [countDelayNote] + or al, al ; player is busy ? + jnz retFunc55 ; return counter delay Note + mov eax, [0x3010] + mov eax, [eax+0x10] ; address application im memory + add eax, edx ; add offset Delay-Note string + mov [memAdrNote], eax + xor eax, eax ; Ok! EAX = 0 + retFunc55: + mov [esp+36], eax ; return value EAX for application + ret + +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + + --- USE --- + +>>> Example use in your programs: + .... .... + .... .... + .... .... + mov eax, 55 ; OS function #55 + mov ebx, eax ; EBX = 55 for subfunction Play Note + mov esi, MyMusic_1 ; ESI = head string Delay-Note code + int 0x40 ; start play + .... .... + .... .... + .... .... + + +>>> Very simply OS use. Only put dword adress head string in [memAdrNote] + + .... .... + mov [memAdrNote], dword MyMusic_1 ; IRQ0 -> start play!!! + .... .... + +!!! Example OS use for send: error tone, ring signal, disconnect hardware... +!!! Saund Card may be OFF, but Speaker PC always IS ON !!! + + +..... .. .. +..... .. .. +MyMusic_1 db .., .., .., .., .., 0 ; string Delay-Note code for MUSIC +... .. .. +...... .. .. + +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + + --- CODE DELAY & NOTEs --- + +>>> Format Delay-Note string: + + 1. Free style play Tone + + db 1..0x80 ; !!! only (1..0x80) byte for Delay Tone + db 1..0xFF ; lower byte (counter for period oscillate) + db 1..0xFF ; upper byte (counter for period oscillate) + .. .. \ + .. .. > 3 bytes for 1 TONE !!! + .. .. / + db 0 ; THE END Play! + + 2. Musical style play Note + + db 0x81..0xFE ; !!! 0x80 + byte (1..0x7E) for Delay Note + db 1..0xFF ; PACK CODE (number Note & number Octave) + .. .. \ + .. .. / 2 bytes for 1 Note in 1 Octave !!! + db 0 ; THE END Play! + + + + -= DELAY CODE =- + + ┌────────────┬────────────┬───────╔══ 1 ═╗╔══ 2 ═╗ + │длительности│ DELAY NOTE │ DELAY ║ DELAY ║║ DELAY ║ + │ НОТ │ mSec │ IRQ 0 ║ CODE ║║ CODE ║ + ├────────────┼────────────┼───────╠════════╣╠════════╣ + │ целая │ 2000 │ ║ 0xC8 ║║ absent ║ + ├────────────┼────────────┤ ╟────────╢╟────────╢ + │ 1/2 │ 1000 │ ║ 0x64 ║║ 0xE4 ║ + ├────────────┼────────────┤ ╟────────╢╟────────╢ + │ 1/4 │ 500 │ ║ 0x32 ║║ 0xB2 ║ + ├────────────┼────────────┤ 10 ║────────╢║────────╢ + │ 1/8 │ 250 │ mSec ║ 0x19 ║║ 0x99 ║ + ├────────────┼────────────┤ ╟────────╢╟────────╢ + │ 1/16 │ 125 │ ║ 0xC ║║ 0x8C ║ + ├────────────┼────────────┤ ║────────╢║────────╢ + │ 1/32 │ 62.5 │ ║ 6 ║║ 0x86 ║ + ├────────────┼────────────┤ ╟────────╢╟────────╢ + │ 1/64 │ 31.25 │ ║ 3 ║║ 0x83 ║ + └────────────┴────────────┴───────╚════════╝╚════════╝ + + + -= PACK CODE =- + + !!!!! IF PACK CODE = 0xFF THEN PAUSE = DELAY CODE !!!!! + + ┌───────────┬──────┬──────╔══════════╗ ┌───────────┬────┬──────╔══════════╗ + │ ТИПЫ │number│ code ║upper CODE║ │ НОТЫ │type│number║lower CODE║ + │ ОКТАВ │OCTAVE│number║Bit7..Bit4║ │ ОКТАВЫ │NOTE│ NOTE ║Bit3..Bit0║ + ├───────────┼──────┼──────╠══════════╣ ├───────────┼────┼──────╠══════════╣ + │контроктава│ -3 │ 0 ║ 0000 ║ │ ДО │ C │ 1 ║ 0001 ║ + ├───────────┼──────┼──────╠──────────╢ ├───────────┼────┼──────╫──────────╢ + │ большая │ -2 │ 1 ║ 0001 ║ │ ДО бемоль │ C# │ 2 ║ 0010 ║ + ├───────────┼──────┼──────╟──────────╢ ├───────────┼────┼──────╫──────────╢ + │ малая │ -1 │ 2 ║ 0010 ║ │ РЕ │ D │ 3 ║ 0011 ║ + ├───────────┼──────┼──────║──────────╢ ├───────────┼────┼──────╫──────────╢ + │ первая │ 1 │ 3 ║ 0011 ║ │ РЕ бемоль │ D# │ 4 ║ 0100 ║ + ├───────────┼──────┼──────╟──────────╢ ├───────────┼────┼──────╫──────────╢ + │ вторая │ 2 │ 4 ║ 0100 ║ │ МИ │ E │ 5 ║ 0101 ║ + ├───────────┼──────┼──────║──────────╢ ├───────────┼────┼──────╫──────────╢ + │ третья │ 3 │ 5 ║ 0101 ║ │ ФА │ F │ 6 ║ 0110 ║ + ├───────────┼──────┼──────╟──────────╢ ├───────────┼────┼──────╫──────────╢ + │ четвертая │ 4 │ 6 ║ 0110 ║ │ ФА бемоль │ F# │ 7 ║ 0111 ║ + └───────────┴──────┴──────╚══════════╝ ├───────────┼────┼──────╫──────────╢ + │ СОЛЬ │ G │ 8 ║ 1000 ║ + ├───────────┼────┼──────╫──────────╢ + │СОЛЬ бемоль│ G# │ 9 ║ 1001 ║ + ├───────────┼────┼──────╫──────────╢ + │ ЛЯ │ A │ 10 ║ 1010 ║ + ├───────────┼────┼──────╫──────────╢ + │ ЛЯ бемоль │ A# │ 11 ║ 1011 ║ + ├───────────┼────┼──────╫──────────╢ + │ СИ │ B │ 12 ║ 1100 ║ + └───────────┴────┴──────╚══════════╝ + + PACK CODE = (number Note) AND ((code number Octave) SHL 4) + or + PACK CODE = (number Note) AND ((code number Octave) * 16) + + + -= PERIOD OSCILLATE =- + + counter = 1193180 / FREQUENCY; + (WORD) (sound Hz) + +┌───────────┬──────┬──────┬───────────┬────┬──────╔═════════ ══════╗ +│ ТИП │number│ code │ НОТЫ │type│number║frequency PACK ║ +│ ОКТАВЫ │OCTAVE│number│ 1й ОСТАВЫ │NOTE│ NOTE ║sound Hz CODE ║ +├───────────┼──────┼──────┼───────────┼────┼──────╠═════════ ══════╣ +│ │ │ │ ДО │ C │ 1 ║ 523,251 -- 0x31 ║ +│ │ │ ├───────────┼────┼──────╫───────── | ──────╢ +│ │ │ │ ДО бемоль │ C# │ 2 ║ 554,365 --|-- 0x32 ║ +│ │ │ ├───────────┼────┼──────╫───────── | | ──────╢ +│ │ │ │ РЕ │ D │ 3 ║ 587,33 | | 0x33 ║ +│ │ │ ├───────────┼────┼──────╫───────── | | ──────╢ +│ │ │ │ РЕ бемоль │ D# │ 4 ║ 622,254 | | 0x34 ║ +│ │ │ ├───────────┼────┼──────╫───────── | | ──────╢ +│ │ │ │ МИ │ E │ 5 ║ 659,255 | | 0x35 ║ +│ │ │ ├───────────┼────┼──────╫───────── | | ──────╢ +│ │ │ │ ФА │ F │ 6 ║ 698,456 | | 0x36 ║ +│ первая │ 1 │ 3 ├───────────┼────┼──────╫───────── | | ──────╢ +│ ( first │ │ │ ФА бемоль │ F# │ 7 ║ 739,989 | | 0x37 ║ +│ octave ) │ │ ├───────────┼────┼──────╫───────── | | ──────╢ +│ │ │ │ СОЛЬ │ G │ 8 ║ 783,991 0x38 ║ +│ │ │ ├───────────┼────┼──────╫───────── x 2 ──────╢ +│ │ │ │СОЛЬ бемоль│ G# │ 9 ║ 830,609 0x39 ║ +│ │ │ ├───────────┼────┼──────╫───────── | | ──────╢ +│ │ │ │ ЛЯ │ A │ 10 ║ 880 | | 0x3A ║ +│ │ │ ├───────────┼────┼──────╫───────── | | ──────╢ +│ │ │ │ ЛЯ бемоль │ A# │ 11 ║ 932,328 | | 0x3B ║ +│ │ │ ├───────────┼────┼──────╫───────── | | ──────╢ +│ │ │ │ СИ │ B │ 12 ║ 987,767 | | 0x3C ║ +├───────────┼──────┼──────┼───────────┼────┼──────╠═════════ | | ══════╣ +│ вторая │ 2 │ 4 │ ДО │ С │ 1 ║1046,502 <- | 0x41 ║ + ...... .. .. ... .. .. .... ... <---- + +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + + --- EXAMPLE MUSIC --- + +Пример музицирования по нотам мелодии И.Карнелюка "Горит очаг..." + к фильму "Бандитский Петербург" +MyMusic_1: +db 0xe4,0x35, 0x99,0x33, 0x99,0x31, 0x99,0x33, 0xe4,0x35, 0x99,0x35, 0x99,0x36 +db 0x99,0x38, 0x99,0x3a, 0xe4,0x36, 0xe4,0x36, 0xb2,0xff, 0xe4,0x33, 0x99,0x31 +db 0x99,0x2c, 0x99,0x31, 0xe4,0x33, 0xb2,0x33, 0x99,0x35, 0x99,0x36, 0xe4,0x35 +db 0xe4,0x35, 0xb2,0xff, 0x99,0x35, 0x99,0x36, 0xe4,0x33, 0x99,0x35, 0x99,0x36 +db 0xb2,0x33, 0x99,0x35, 0x99,0x36, 0xb2,0x33, 0x99,0x35, 0x99,0x36, 0xe4,0x39 +db 0xe4,0x39, 0xb2,0xff, 0x99,0x35, 0x99,0x36, 0xe4,0x33, 0x99,0x35, 0x99,0x36 +db 0xb2,0x33, 0x99,0x35, 0x99,0x36, 0xb2,0x33, 0x99,0x35, 0x99,0x36, 0xe4,0x35 +db 0xe4,0x35, 0 + + +MyMusic_2: +db 0x90,0x31, 0x90,0x33, 0x90,0x35, 0x90,0x36, 0xA0,0xFF, 0xA0,0x06, 0x90,0xFF +db 0xA0,0x06, 0x90,0xFF, 0x90,0x33, 0x90,0x35, 0x90,0x37, 0x90,0x38, 0xA0,0xFF +db 0xA0,0x18, 0x90,0xFF, 0xA0,0x18, 0x90,0xFF, 0x90,0x33, 0x90,0x35, 0x90,0x37 +db 0x90,0x38, 0xA0,0xFF, 0x90,0x33, 0x90,0x35, 0x90,0x37, 0x90,0x38, 0xA0,0xFF +db 0x90,0x31, 0x90,0x33, 0x90,0x35, 0x90,0x36, 0xA0,0xFF, 0xA0,0x16, 0x90,0xFF +db 0xA0,0x16, 0 + + +MyMusic_3: +db 0x99,0x31, 0xB2,0x36, 0x99,0x3A, 0xB2,0x36, 0x99,0x33, 0xB2,0x28, 0xBC,0x38 +db 0 + + <<<<<<< >>>>>>> +|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> !GOOD LUCK! <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<| + <<<<<<< >>>>>>> + + + + + + + + + + + + + diff --git a/programs/media/midamp/trunk/thread.inc b/programs/media/midamp/trunk/thread.inc new file mode 100644 index 0000000000..9f7ef99cdd --- /dev/null +++ b/programs/media/midamp/trunk/thread.inc @@ -0,0 +1,121 @@ +new_thread: + mov ecx,ipcarea2 + call init_ipc + mcall 40,1000000b + tstill: + mov dword[ipcarea2],0 + mov dword[ipcarea2+4],8 + mcall 10 + .prc: + cmp eax,7 + jne tstill + and [flag],not FL_PLAY + mov eax,dword[ipcarea2+8] + cmp eax,[parentPID] + jne tstill + cmp byte[ipcarea2+16],IPC_PLAY + je .play_next + cmp byte[ipcarea2+16],IPC_TRIG + jne tstill + .play_next: + or [flag],FL_PLAY + mov edi,[cur_ptr] + movzx eax,word[edi] + mov [play_area],ax + add [cur_ptr],2 + if SOUND eq ON + test [flag],FL_MUTE + jnz .nosound + mov esi,play_area + mov eax,55 + mov ebx,eax + int 0x40 + .nosound: + end if + movzx ebx,byte[play_area] + and ebx,0x7f + add [cur_tick],ebx + mov eax,23 + int 0x40 + cmp word[edi],0 + jne .checkevt + mov eax,IPC_NEXT + call ipc_send + jmp tstill + .checkevt: + test eax,eax + jz .upd + cmp eax,7 + jne tstill + cmp byte[ipcarea2+16],IPC_PLAY + jne tstill + .upd: + mov eax,IPC_UPDT + call ipc_send + jmp .play_next + +respawn: + mcall 9,prcinfo,-1 + mov ecx,eax + xor edx,edx + xor esi,esi + .nxt: + mcall 9 + cmp dx,[ebx+4] + jae .less + mov dx,[ebx+4] + mov esi,[ebx+30] + .less: + loop .nxt + push esi + mcall 51,1,new_thread,APP_MEM + pop edx + cmp edx,[childPID] + jne .nochild + mov edx,[parentPID] + .nochild: + mov [childPID],eax + call prc_find + mcall 18,3 + ret + +kill: + mov edx,[childPID] + call prc_find + mcall 18,2 + .nothread: + ret + +prc_find: ;in: edx-PID, out: ecx-number + mcall 9,prcinfo,-1 + mov ecx,eax + .nxt: + mcall 9 + cmp edx,[ebx+30] + je .found + loop .nxt + .found: + ret + +init_ipc: + mcall 60,1,,20 + ret + +ipc_send: ;eax-msg + test [flag],FL_LOCK + jnz .noipc + pusha + mov [ipcmsg],al + mov ebx,ipcarea2 + mov ecx,childPID + cmp eax,0xb0 + jb .noparent + add ecx,4 + sub ebx,20 + .noparent: + mov dword[ebx],0 + mov dword[ebx+4],8 + mcall 60,2,[ecx],ipcmsg,1 + popa + .noipc: + ret diff --git a/programs/other/archer/trunk/@RCHER.ASM b/programs/other/archer/trunk/@RCHER.ASM index 0d255a756e..0840fdd07d 100644 --- a/programs/other/archer/trunk/@RCHER.ASM +++ b/programs/other/archer/trunk/@RCHER.ASM @@ -110,7 +110,7 @@ if SYS eq win else Msg 0 Msg 1 - mcall 40,10000101b + mcall 40,1000101b ; jmp again CmdLine cmdl: diff --git a/programs/other/archer/trunk/arcmacro.inc b/programs/other/archer/trunk/arcmacro.inc index 9ef9237dfb..8347f895aa 100644 --- a/programs/other/archer/trunk/arcmacro.inc +++ b/programs/other/archer/trunk/arcmacro.inc @@ -261,8 +261,8 @@ local dlg_is_work, ready ;; mov esi,path mov edi,path xor eax,eax - mov ecx,200 - rep stosb + mov ecx,(1024+16)/4 + rep stosd ;mov [get_loops],0 mov [dlg_pid_get],0 @@ -301,7 +301,7 @@ new_d: mov eax,60 mov ebx,1 ; define IPC mov ecx,path ; offset of area - mov edx,150 ; size 150 bytes + mov edx,1024+16 ; size int 0x40 mcall 40,1000111b @@ -309,7 +309,7 @@ new_d: ; STEP 3 run SYSTEM XTREE with parameters ; - mcall 58,run_fileinfo + mcall 70,run_fileinfo call redproc @@ -318,15 +318,14 @@ getmesloop: mov eax,23 mov ebx,50 ;0.5 sec int 0x40 - - cmp eax,1 - je mred - cmp eax,2 - je mkey - cmp eax,3 - je mbutton - cmp eax,7 - je mgetmes + dec eax + jz mred + dec eax + jz mkey + dec eax + jz mbutton + cmp al, 7-3 + jz mgetmes ; Get number of procces mcall 9,os_work,-1 @@ -405,14 +404,14 @@ mgetmes: ready: ; ; The second message get -; Second message is 100 bytes path to SAVE/OPEN file +; Second message is 1024 bytes path to SAVE/OPEN file ; shl path string on 16 bytes ; cld mov esi,path+16 mov edi,path - mov ecx,200 - rep movsb + mov ecx,1024/4 + rep movsd mov [edi],byte 0 jmp openoff @@ -428,11 +427,11 @@ param: dd 0,0 ; Type of dialog run_fileinfo: - dd 16 + dd 7 dd 0 dd param dd 0 - dd os_work ; 0x10000 + dd 0 ;run_filepath db '/RD/1/SYSXTREE',0 diff --git a/programs/other/archer/trunk/data.inc b/programs/other/archer/trunk/data.inc index f95041d87b..5f3bcf8c72 100644 --- a/programs/other/archer/trunk/data.inc +++ b/programs/other/archer/trunk/data.inc @@ -68,8 +68,8 @@ else ; db '/hd/1/zip/test2.zip',0 end if db 0 -rb 256-($-filename) I_END: +rb 1024+16-($-filename) if SYS eq win cr_lf db 0xa,0xd diff --git a/programs/other/archer/trunk/macros.inc b/programs/other/archer/trunk/macros.inc index ab45d183d4..d290e9e09b 100644 --- a/programs/other/archer/trunk/macros.inc +++ b/programs/other/archer/trunk/macros.inc @@ -143,6 +143,11 @@ macro mcall a,b,c,d,e,f { ; mike.dld +; language for programs +lang fix ru ; ru en fr ge fi + + + ; optimize the code for size __regs fix @@ -174,7 +179,7 @@ macro sub arg1,arg2 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 diff --git a/programs/other/archer/trunk/sys.inc b/programs/other/archer/trunk/sys.inc index c54cde1c35..c7d783365d 100644 --- a/programs/other/archer/trunk/sys.inc +++ b/programs/other/archer/trunk/sys.inc @@ -385,12 +385,26 @@ get_6ASCII_num: } StartPad: -; mcall 19,editorcmd,dumpfile pusha mov esi,[outfile.size] ; dpd esi - mov [par_fsize],esi - mcall 19,editorcmd,editor_par +; convert number in esi to decimal representation + mov ecx, 10 + push -'0' + mov eax, esi +@@: + xor edx, edx + div ecx + push edx + test eax, eax + jnz @b + mov edi, par_fsize +@@: + pop eax + add al, '0' + stosb + jnz @b + mcall 70,fileinfo mov ecx,eax mcall 5,20 mcall 60,2,,[outfile.out];output @@ -398,7 +412,13 @@ StartPad: popa ret -editorcmd db 'TINYPAD ' +fileinfo: + dd 7 + dd 0 + dd editor_par + dd 0 + dd 0 + db '/RD/1/TINYPAD',0 editor_par db '*' -par_fsize dd ? +par_fsize rb 11 end if \ No newline at end of file diff --git a/programs/other/rtfread/trunk/ascl.inc b/programs/other/rtfread/trunk/ascl.inc index 20a18bf31d..2810598da0 100644 --- a/programs/other/rtfread/trunk/ascl.inc +++ b/programs/other/rtfread/trunk/ascl.inc @@ -133,9 +133,9 @@ local dlg_is_work, ready, procinfo cld ;; mov esi,path mov edi,path - mov eax,0 - mov ecx,200 - rep stosb + xor eax,eax + mov ecx,(1024+16)/4 + rep stosd ;mov [get_loops],0 mov [dlg_pid_get],0 @@ -177,7 +177,7 @@ new_d: mov eax,60 mov ebx,1 ; define IPC mov ecx,path ; offset of area - mov edx,150 ; size 150 bytes + mov edx,1024+16 ; size int 0x40 ; change wanted events list 7-bit IPC event @@ -189,7 +189,7 @@ new_d: ; STEP 3 run SYSTEM XTREE with parameters ; - mov eax,58 + mov eax,70 mov ebx,run_fileinfo int 0x40 @@ -200,15 +200,14 @@ getmesloop: mov eax,23 mov ebx,50 ;0.5 sec int 0x40 - - cmp eax,1 - je mred - cmp eax,2 - je mkey - cmp eax,3 - je mbutton - cmp eax,7 - je mgetmes + dec eax + jz mred + dec eax + jz mkey + dec eax + jz mbutton + cmp al, 7-3 + jz mgetmes ; Get number of procces mov ebx,procinfo @@ -295,14 +294,14 @@ mgetmes: ready: ; ; The second message get -; Second message is 100 bytes path to SAVE/OPEN file +; Second message is 1024 bytes path to SAVE/OPEN file ; shl path string on 16 bytes ; cld mov esi,path+16 mov edi,path - mov ecx,200 - rep movsb + mov ecx,1024/4 + rep movsd mov [edi],byte 0 jmp openoff @@ -318,16 +317,16 @@ param: dd 0,0 ; Type of dialog run_fileinfo: - dd 16 + dd 7 dd 0 dd param dd 0 - dd procinfo ; 0x10000 + dd 0 ;run_filepath db '/RD/1/SYSXTREE',0 procinfo: -times 256 db 0 +times 1024 db 0 } @@ -345,9 +344,9 @@ local dlg_is_work, ready, procinfo cld ;; mov esi,path mov edi,path - mov eax,0 - mov ecx,200 - rep stosb + xor eax,eax + mov ecx,(1024+16)/4 + rep stosd ;mov [get_loops],0 mov [dlg_pid_get],0 @@ -389,7 +388,7 @@ new_d: mov eax,60 mov ebx,1 ; define IPC mov ecx,path ; offset of area - mov edx,120 ; size 150 bytes + mov edx,1024+16 ; size int 0x40 ; change wanted events list 7-bit IPC event @@ -401,7 +400,7 @@ new_d: ; STEP 3 run SYSTEM XTREE with parameters ; - mov eax,58 + mov eax,70 mov ebx,run_fileinfo int 0x40 @@ -412,15 +411,14 @@ getmesloop: mov eax,23 mov ebx,50 ;0.5 sec int 0x40 - - cmp eax,1 - je mred - cmp eax,2 - je mkey - cmp eax,3 - je mbutton - cmp eax,7 - je mgetmes + dec eax + jz mred + dec eax + jz mkey + dec eax + jz mbutton + cmp al, 7-3 + jz mgetmes ; Get number of procces mov ebx,procinfo @@ -457,6 +455,7 @@ mred: call redproc jmp getmesloop mkey: + mov eax,2 int 0x40 ; read (eax=2) jmp getmesloop mbutton: @@ -506,14 +505,14 @@ mgetmes: ready: ; ; The second message get -; Second message is 100 bytes path to SAVE/OPEN file +; Second message is 1024 bytes path to SAVE/OPEN file ; shl path string on 16 bytes ; cld mov esi,path+16 mov edi,path - mov ecx,200 - rep movsb + mov ecx,1024/4 + rep movsd mov [edi],byte 0 jmp openoff @@ -525,25 +524,26 @@ dlg_pid_get dd 0 DLGPID dd 0 param: - rb 4 ; My dec PID - rb 6 ; Type of dialog + dd 0 ; My dec PID + dd 0,0 ; Type of dialog run_fileinfo: - dd 16 + dd 7 dd 0 dd param dd 0 - dd procinfo -run_filepath: + dd 0 +;run_filepath: db '/RD/1/SYSXTREE',0 procinfo: -times 256 db 0 +times 1024 db 0 } + ; RANDOM - generate random count (small) ; (SYNTAX) RANDOM MaxCount,OutArgument ; (SAMPLE) RANDOM 10000,eax diff --git a/programs/other/rtfread/trunk/bgifont.inc b/programs/other/rtfread/trunk/bgifont.inc index 6fbb11cead..7172d95349 100644 --- a/programs/other/rtfread/trunk/bgifont.inc +++ b/programs/other/rtfread/trunk/bgifont.inc @@ -571,6 +571,12 @@ if ~ BGI_LEVEL eq KERNEL jg .nobold end if mov edx,[.color] +; \begin{diamond}[18.08.2006] +; starting from K0530 kernel interprets flag 0x1000000 as +; negate existing pixels colors, disregarding passed color +; we do not want this + and edx, 0xFFFFFF +; \end{diamond}[18.08.2006] mov eax,38 int 0x40 test ebp,BGI_BOLD diff --git a/programs/other/rtfread/trunk/macros.inc b/programs/other/rtfread/trunk/macros.inc index 1d153e8723..d290e9e09b 100644 --- a/programs/other/rtfread/trunk/macros.inc +++ b/programs/other/rtfread/trunk/macros.inc @@ -143,6 +143,8 @@ macro mcall a,b,c,d,e,f { ; mike.dld +; language for programs +lang fix ru ; ru en fr ge fi diff --git a/programs/other/rtfread/trunk/rtfread.asm b/programs/other/rtfread/trunk/rtfread.asm index 37abdfb906..f304977c35 100644 --- a/programs/other/rtfread/trunk/rtfread.asm +++ b/programs/other/rtfread/trunk/rtfread.asm @@ -40,20 +40,19 @@ GUTTER equ 10 BENCH equ 0;1 syms equ 12 - use32 ; включить 32-битный режим ассемблера - org 0x0 ; адресация с нуля + use32 ; включить 32-битный режим ассемблера + org 0x0 ; адресация с нуля - db 'MENUET01' ; 8-байтный идентификатор MenuetOS - dd 0x01 ; версия заголовка (всегда 1) - dd START ; адрес первой команды - dd I_END0 ; размер программы - dd esp_end ; количество памяти - dd sys_mem ; адрес вершины стэка - dd fname_buf ; адрес буфера для параметров (не используется) - dd 0x0 ; зарезервировано + db 'MENUET01' ; 8-байтный идентификатор MenuetOS + dd 0x01 ; версия заголовка (всегда 1) + dd START ; адрес первой команды + dd I_END0 ; размер программы + dd esp_end ; количество памяти + dd sys_mem ; адрес вершины стэка + dd fname_buf ; адрес буфера для параметров (не используется) + dd 0x0 ; зарезервировано -include 'lang.inc' -include 'macros.inc' ; макросы облегчают жизнь ассемблерщиков! +include 'MACROS.INC' ; макросы облегчают жизнь ассемблерщиков! include 'debug.inc' if ~ RENDER eq PIX TOP=TOP+4 @@ -77,7 +76,7 @@ START: end if start2: cmp byte[fname_buf],0 - je load_file;top_red + je load_file;top_red jmp noactivate prep_load: ; mcall 18,3,dword[prcinfo+30] @@ -103,9 +102,9 @@ START: mov [HClick],-100 load_help: test eax,eax - jz .sizok + jz .sizok cmp eax,5 - je .sizok + je .sizok .nosizok: mov dword[fileinfo.name],N_A .sizok: @@ -124,38 +123,38 @@ START: mov [fname_size],edi top_red: mov [top],TOP -red: ; перерисовать окно +red: ; перерисовать окно - call draw_window ; вызываем процедуру отрисовки окна + call draw_window ; вызываем процедуру отрисовки окна ;--------------------------------------------------------------------- ;--- ЦИКЛ ОБРАБОТКИ СОБЫТИЙ ---------------------------------------- ;--------------------------------------------------------------------- still: - mcall 10 ; функция 10 - ждать события + mcall 10 ; функция 10 - ждать события - cmp eax,1 ; перерисовать окно ? - je red ; если да - на метку red - cmp eax,3 ; нажата кнопка ? - je button ; если да - на button - cmp eax,2 ; нажата клавиша ? - je key ; если да - на key + cmp eax,1 ; перерисовать окно ? + je red ; если да - на метку red + cmp eax,3 ; нажата кнопка ? + je button ; если да - на button + cmp eax,2 ; нажата клавиша ? + je key ; если да - на key - jmp still ; если другое событие - в начало цикла + jmp still ; если другое событие - в начало цикла ;--------------------------------------------------------------------- - key: ; нажата клавиша на клавиатуре - mcall 2 ; функция 2 - считать код символа (в ah) - cmp ah,104 ; HELP + key: ; нажата клавиша на клавиатуре + mcall 2 ; функция 2 - считать код символа (в ah) + cmp ah,104 ; HELP jne .nohelp .help: xor [mode],RTF_HELP test [mode],RTF_HELP - jz load_file + jz load_file mov ecx,help_end-help_file mov [block_end],ecx add [block_end],I_END @@ -176,34 +175,34 @@ still: ; je still ; jmp prep_load .nohelp2: - cmp ah,114 ; R - redraw - je red - cmp ah,99 ; C - color + cmp ah,114 ; R - redraw + je red + cmp ah,99 ; C - color jne .nocolor .color: xor [mode],RTF_COLORLESS jmp red .nocolor: - cmp ah,97 ; A - alignment + cmp ah,97 ; A - alignment jne .noalign .alignment: xor [mode],RTF_ALIGNLESS jmp red .noalign: - cmp ah,44 ; < - pitch dec + cmp ah,44 ; < - pitch dec jne .nopd .decp: dec [pitch] jmp red .nopd: - cmp ah,46 ; < - pitch inc + cmp ah,46 ; < - pitch inc jne .nopi .incp: inc [pitch] jmp red .nopi: - cmp ah,180 ; Home - je top_red + cmp ah,180 ; Home + je top_red mov ebx,dword[prcinfo+46] sub ebx,TOP+15 cmp ah,183 ;PgDn @@ -221,20 +220,20 @@ still: jne .nopgup add [top],bx cmp [top],TOP - jl red + jl red mov [top],TOP cmp cx,[top] - je still + je still jmp red .nopgup: cmp ah,178 ;arrUp jne .noarup add [top],CHARH cmp [top],TOP - jl red + jl red mov [top],TOP cmp cx,[top] - je still + je still jmp red .noarup: if RENDER eq FREE @@ -255,10 +254,10 @@ still: jmp .zoom .nominus: end if - cmp ah,108 ; L - load + cmp ah,108 ; L - load jne stilld .file_open: - or [mode],RTF_OPENING + or [mode],RTF_OPENING opendialog draw_window, prep_load, st_1, fname_buf st_1: and [mode],not RTF_OPENING @@ -269,37 +268,37 @@ still: ;--------------------------------------------------------------------- button: - mcall 17 ; 17 - получить идентификатор нажатой кнопки + mcall 17 ; 17 - получить идентификатор нажатой кнопки cmp ah,2 - je key.help + je key.help cmp ah,3 - je key.color + je key.color cmp ah,4 - je key.alignment + je key.alignment cmp ah,5 - je key.file_open + je key.file_open cmp ah,6 - je key.incp + je key.incp cmp ah,7 - je key.decp + je key.decp if RENDER eq FREE cmp ah,8 - je key.zminus + je key.zminus cmp ah,9 - je key.zplus + je key.zplus end if - cmp ah, 1 ; если НЕ нажата кнопка с номером 1, - jne .noexit ; вернуться + cmp ah, 1 ; если НЕ нажата кнопка с номером 1, + jne .noexit ; вернуться .exit: - mcall -1 ; иначе конец программы + mcall -1 ; иначе конец программы .noexit: cmp ah,20 jne still mcall 37,1 and eax,0xffff cmp eax,[HClick] - je still + je still mov [HClick],eax sub eax,25 mul [HDoc] @@ -317,13 +316,14 @@ still: draw_window: - mcall 12, 1 ; функция 12: сообщить ОС об отрисовке окна - ; 1 - начинаем рисовать + mcall 12, 1 ; функция 12: сообщить ОС об отрисовке окна + ; 1 - начинаем рисовать + mcall 0, <10,WINW>, <100,WINH>, WIN_COLOR,0x805080D0, 0x005080D0 mcall 9,procinfo,-1 mov eax,[procinfo.x_size] cmp eax,1 - ja .temp12345 + ja .temp12345 ret .temp12345: @@ -344,10 +344,10 @@ draw_window: and [mode],not RTF_TOEOF mov ebx,[edi+42] cmp ebx,[wSave] - je .nochg + je .nochg .chg: mov [wSave],ebx - or [mode],RTF_TOEOF + or [mode],RTF_TOEOF and [HDoc],0 and [line_count],0 mov [HClick],-100 @@ -359,29 +359,29 @@ draw_window: mov esi,0xb810e7 mov edx,2 BTN_SPACE equ 14 shl 16 - mcall 8 ;2 + mcall 8 ;2 sub ebx,BTN_SPACE inc edx - mcall 8,,,,0x459a ;3 + mcall 8,,,,0x459a ;3 sub ebx,BTN_SPACE inc edx - mcall ,,,,0x107a30 ;4 + mcall ,,,,0x107a30 ;4 sub ebx,BTN_SPACE inc edx - mcall ,,,,0xcc0000 ;5 + mcall ,,,,0xcc0000 ;5 sub ebx,BTN_SPACE inc edx - mcall ,,,,0x575f8c ;6 + mcall ,,,,0x575f8c ;6 sub ebx,BTN_SPACE inc edx - mcall ,,,,0x575f8c ;7 + mcall ,,,,0x575f8c ;7 if RENDER eq FREE sub ebx,BTN_SPACE inc edx - mcall ,,,,0x6a73d0 ;8 + mcall ,,,,0x6a73d0 ;8 sub ebx,BTN_SPACE inc edx - mcall ,,,,0xd048c8 ;9 + mcall ,,,,0xd048c8 ;9 end if shr ecx,16 mov bx,cx @@ -476,9 +476,9 @@ end if loop .l0 end if .ex: - mcall 12, 2 ; функция 12: сообщить ОС об отрисовке окна - ; 2, закончили рисовать - ret ; выходим из процедуры + mcall 12, 2 ; функция 12: сообщить ОС об отрисовке окна + ; 2, закончили рисовать + ret ; выходим из процедуры if GUTTER eq 1 arrow db 0x19 @@ -547,6 +547,8 @@ end if Free BGIfree FONT_NAME,0,0,1.0,1.0,char,1,0x44000000,0 end if I_END0: +fname_buf: + rb 1024+16 if BENCH eq 1 bench dd ? end if @@ -594,16 +596,15 @@ save_stack: rb RTFSTACKSIZE save_limit: rb BGIFONTSIZE -fname_buf rd 16 listptr dd ? szKeyword rb 31 szParameter rb 21 block_end dd ? -I_END: ; метка конца программы +I_END: ; метка конца программы rb RTFSIZE esp1: rb ESPSIZE sys_mem: rb ESPSIZE -esp_end: \ No newline at end of file +esp_end: