diff --git a/programs/emulator/e80/utils/keyZXtst/keyZXtst.asm b/programs/emulator/e80/utils/keyZXtst/keyZXtst.asm index 2d86a55b5..a506b2c07 100644 --- a/programs/emulator/e80/utils/keyZXtst/keyZXtst.asm +++ b/programs/emulator/e80/utils/keyZXtst/keyZXtst.asm @@ -1,176 +1,177 @@ -; Text CodePage = cp1251 - -; <--- include all MeOS stuff ---> - -include "../../../../../macros.inc" - - -; <--- start of MenuetOS application ---> -MEOS_APP_START - -include "key_read.inc" - -; <--- start of code ---> -CODE - - mov eax,48 ; get system colors - mov ebx,3 - mov ecx,sc - mov edx,sizeof.system_colors - mcall - - xor ecx, ecx - inc ecx - mcall 66,1 ; єёЄрэютър Ёхцшьр ттюфр ёърэъюфют - - - - redraw: ; redraw event handler - call draw_window ; at first create and draw the window - - wait_event: ; main cycle - - mcall 10 ; юцшфрЄ№ ёюс√Єшх - -; mcall 23, 2 ; трЁшрэЄ яюёЄю ээ√щ юяЁюё -; or eax, eax -; jz key.1 - - dec eax ; if event = 1 - jz redraw ; jump to redraw handler - dec eax ; else if event = 2 - jz key ; jump to key handler - - - button: ; button event handler - mov al, 17 ; get button identifier - mcall - - cmp ah, 1 - jne wait_event ; return if button id != 1 - - or eax, -1 ; exit application - mcall - - key: ; key event handler - ; get key code - call load_keys - ; яЁхюсЁрчютрэшх -.1: - mov ah, 0xfe - mov edx, txt_data.fe - call load_ports - - mov ah, 0xfd - mov edx, txt_data.fd - call load_ports - - mov ah, 0xfb - mov edx, txt_data.fb - call load_ports - - mov ah, 0xf7 - mov edx, txt_data.f7 - call load_ports - - mov ah, 0xef - mov edx, txt_data.ef - call load_ports - - mov ah, 0xdf - mov edx, txt_data.df - call load_ports - - mov ah, 0xbf - mov edx, txt_data.bf - call load_ports - - mov ah, 0x7f - mov edx, txt_data.7f - call load_ports - - mov ah, 0x00 - mov edx, txt_data.00 - call load_ports - - - - jmp redraw - - draw_window: - mov eax, 12 ; start drawing - mov ebx, 1 - mcall - - xor eax, eax ; create and draw the window - mov ebx, 40*65536+560 ; (window_cx)*65536+(window_sx) - mov ecx, 40*65536+240 ; (window_cy)*65536+(window_sy) - mov edx, [sc.work] ; work area color - or edx, 0x33000000 ; & window type 3 - mov edi, title ; window title - int 0x40 - - mov ecx, [sc.work_text] - or ecx, 0x80000000 - mov edx, txt_data - mcall 4, 10*65536+40 - mov edx, txt_data.2s - mcall 4, 10*65536+60 - mov edx, txt_data.3s - mcall 4, 10*65536+80 - - - mov eax, 12 ; finish drawing - mov ebx, 2 - mcall - - ret - - -load_ports: ; тїюф ah - ёЄрЁ°шщ срщЄ яюЁЄр - ; edx - рфЁхё ЄхъёЄр - mov al, 0xFE - call load_port_FE - -rept 8 -{ - mov bl, '1' - shl al,1 - jc @f - mov bl, '0' -@@: - mov byte [edx], bl - inc edx -} - - ret - - - - -; <--- initialised data ---> -DATA - - -title db 'Key ZX-Spectrum TEST',0 - -txt_data db '#FE: ' -.fe db '******** #FD: ' -.fd db '******** #FB: ' -.fb db '******** #F7: ' -.f7 db '******** ', 0 -.2s db '#EF: ' -.ef db '******** #DF: ' -.df db '******** #BF: ' -.bf db '******** #7F: ' -.7f db '******** ', 0 -.3s db '#00: ' -.00 db '******** ', 0 - - -; <--- uninitialised data ---> -UDATA -sc system_colors - -MEOS_APP_END -; <--- end of MenuetOS application ---> \ No newline at end of file +; SPDX-License-Identifier: NOASSERTION +; + +; <--- include all MeOS stuff ---> + +include "../../../../macros.inc" + + +; <--- start of MenuetOS application ---> +MEOS_APP_START + +include "key_read.inc" + +; <--- start of code ---> +CODE + + mov eax,48 ; get system colors + mov ebx,3 + mov ecx,sc + mov edx,sizeof.system_colors + mcall + + xor ecx, ecx + inc ecx + mcall 66,1 ; setting scancode input mode + + + + redraw: ; redraw event handler + call draw_window ; at first create and draw the window + + wait_event: ; main cycle + + mcall 10 ; expect an event + +; mcall 23, 2 ; option constant poll +; or eax, eax +; jz key.1 + + dec eax ; if event = 1 + jz redraw ; jump to redraw handler + dec eax ; else if event = 2 + jz key ; jump to key handler + + + button: ; button event handler + mov al, 17 ; get button identifier + mcall + + cmp ah, 1 + jne wait_event ; return if button id != 1 + + or eax, -1 ; exit application + mcall + + key: ; key event handler + ; get key code + call load_keys + ; transformation +.1: + mov ah, 0xfe + mov edx, txt_data.fe + call load_ports + + mov ah, 0xfd + mov edx, txt_data.fd + call load_ports + + mov ah, 0xfb + mov edx, txt_data.fb + call load_ports + + mov ah, 0xf7 + mov edx, txt_data.f7 + call load_ports + + mov ah, 0xef + mov edx, txt_data.ef + call load_ports + + mov ah, 0xdf + mov edx, txt_data.df + call load_ports + + mov ah, 0xbf + mov edx, txt_data.bf + call load_ports + + mov ah, 0x7f + mov edx, txt_data.7f + call load_ports + + mov ah, 0x00 + mov edx, txt_data.00 + call load_ports + + + + jmp redraw + + draw_window: + mov eax, 12 ; start drawing + mov ebx, 1 + mcall + + xor eax, eax ; create and draw the window + mov ebx, 40*65536+560 ; (window_cx)*65536+(window_sx) + mov ecx, 40*65536+240 ; (window_cy)*65536+(window_sy) + mov edx, [sc.work] ; work area color + or edx, 0x33000000 ; & window type 3 + mov edi, title ; window title + int 0x40 + + mov ecx, [sc.work_text] + or ecx, 0x80000000 + mov edx, txt_data + mcall 4, 10*65536+40 + mov edx, txt_data.2s + mcall 4, 10*65536+60 + mov edx, txt_data.3s + mcall 4, 10*65536+80 + + + mov eax, 12 ; finish drawing + mov ebx, 2 + mcall + + ret + + +load_ports: ; input ah - port high byte + ; edx - text address + mov al, 0xFE + call load_port_FE + +rept 8 +{ + mov bl, '1' + shl al,1 + jc @f + mov bl, '0' +@@: + mov byte [edx], bl + inc edx +} + + ret + + + + +; <--- initialised data ---> +DATA + + +title db 'Key ZX-Spectrum TEST',0 + +txt_data db '#FE: ' +.fe db '******** #FD: ' +.fd db '******** #FB: ' +.fb db '******** #F7: ' +.f7 db '******** ', 0 +.2s db '#EF: ' +.ef db '******** #DF: ' +.df db '******** #BF: ' +.bf db '******** #7F: ' +.7f db '******** ', 0 +.3s db '#00: ' +.00 db '******** ', 0 + + +; <--- uninitialised data ---> +UDATA +sc system_colors + +MEOS_APP_END +; <--- end of MenuetOS application ---> diff --git a/programs/media/animage/animage.asm b/programs/media/animage/animage.asm index d0c634837..b9ebbdaca 100644 --- a/programs/media/animage/animage.asm +++ b/programs/media/animage/animage.asm @@ -1,376 +1,378 @@ -;******************************************************* -;**************GRAPHICS EDITOR ANIMAGE ***************** -;******************************************************* -; version: 1.52 -; last update: 23.11.2016 -; changes: Can save *.png files -; autors: IgorA -;-------------------------------------------------------- -; version: 1.51 -; last update: 23.03.2016 -; changes: Use library 'kmenu.obj', update GUI -; autors: IgorA, Veliant, Leency -;-------------------------------------------------------- -; version: 1.4 -; last update: 12.03.2016 -; changes: Use library 'libimg.obj' -; autors: IgorA -;-------------------------------------------------------- -; version: 1.3 -; last update: 05.10.2010 -; written by: Marat Zakiyanov aka Mario79, aka Mario -; changes: Fixed window flicker when redrawing, -; Fixed memory leak for stack -;-------------------------------------------------------- -; version: 1.2 -; last update: 30.09.2010 -; written by: Marat Zakiyanov aka Mario79, aka Mario -; changes: Program used function 68 instead 64 is now, -; select path with OpenDialog -;-------------------------------------------------------- -; version: 1.1 -; last update: 09.12.2006 -; autors: -; programming by andrew_programmer -; design by golus - -use32 -org 0 - db 'MENUET01' - dd 1, START, IM_END, I_END - dd stacktop, file_path, cur_dir_path - -include '../../../config.inc' ;for nightbuild -include '../../../macros.inc' -include '../../../proc32.inc' -include '../../../KOSfuncs.inc' -include '../../../load_lib.mac' -include '../../../dll.inc' -include '../../../develop/libraries/libs-dev/libio/libio.inc' -include '../../../develop/libraries/libs-dev/libimg/libimg.inc' -;include '../../../debug.inc' - -@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load - -;--------------------------------------------------------- -; *** константы для интерфейса *** -; *** constants for interface *** - -; корректировки на скин -ci_offs_skin_w equ 5 ;корректировка на ширину рамки скина -ci_offs_skin_h equ 24 ;корректировка на высоту скина - -; главное окно -ci_wnd_min_siz_x equ 585 ;minimum size x -ci_wnd_min_siz_y equ 400 ;minimum size y - -; панель инструментов -ci_panel_x_pos equ 0 ;коорд. x для панели -ci_panel_y_pos equ 20 ;коорд. y для панели -ci_panel_but_y1 equ ci_panel_y_pos +5 ;коорд. y для 1-го ряда кнопок -ci_panel_but_y2 equ ci_panel_y_pos+30 ;коорд. y для 2-го ряда кнопок -ci_palete_y_pos equ ci_panel_y_pos+51 ;коорд. y для палитры цветов -ci_panel_zoom_x equ 178 ;коорд. x для кнопок панели масштаба - -; окно редактора -ci_edit_wnd_x_pos equ 0 ;коорд. x для окна редактора -ci_edit_wnd_y_pos equ 71 ;коорд. y для окна редактора -ci_edit_wnd_border equ 3 ;рамка вокруг окна редактора - -; скроллинги -ci_scroll_dim equ 22 ;размеры скроллингов -ci_scrollh_coord_x_min equ (ci_edit_wnd_x_pos+3) ;минимальная позиция ползунка - ;горизонтального скроллинга -ci_scrollv_coord_y_min equ (ci_edit_wnd_y_pos+3) ;минимальная позиция ползунка - ;вертикального скроллинга -;--------------------------------------------------------- - -include 'bmplib.inc' -include 'dialog2.inc' -include 'design.inc' -include 'graphlib.inc' - -include 'cursors.inc' -include 'memory.inc' -include 'load_from_parameters.inc' - -START: - mcall SF_SYS_MISC,SSF_HEAP_INIT - mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, syscolors, syscolors_end-syscolors - -load_libraries l_libs_start,end_l_libs - - cmp eax,-1 - jz close - - mcall SF_SET_EVENTS_MASK,0x80000067 ; 1100111b -;--------------------------------------------------------- -;-----------------------init data------------------------- -;--------------------------------------------------------- -include 'init_data.inc' - -;---------------------------------------------------------- -;--------get memory and draw window of program------------- -;---------------------------------------------------------- - call GetMemory - mov [Current_instrument],10 ;pencil - call TakeButtonInstruments ;set startup instrument - call cleare_work_arrea - call load_icons - call init_main_menu - -;load cursors - mov eax,CursorsID - call load_cursors - -;--------------------------------------------------------- -;---------check loading of file from parameters----------- -;--------------------------------------------------------- - mov eax,file_path - cmp [eax],byte 0 - jz @f - call load_picture - call MovePictureToWorkScreen -@@: - -;--------------------------------------------------------------------- - mov edi,filename_area - mov esi,path4+5 - call copy_str_1 - - mov edi,file_path - cmp [edi],byte 0 - jne @f - mov esi,path4 - call copy_str_1 -@@: -;OpenDialog initialisation - stdcall [OpenDialog_Init], OpenDialog_data - stdcall [ColorDialog_Init], ColorDialog_data -;--------------------------------------------------------------------- - -align 4 -red: - call drawwin -;---------------------------------------------------------- -;---------------------main loop---------------------------- -;---------------------------------------------------------- -align 4 -still: - mcall SF_WAIT_EVENT - - cmp eax,1 - je red - - cmp eax,2 - je keys - - cmp eax,3 - je buttons - - cmp eax,6 - je mouse - - jmp still - -;--------------------------------------------------------------------- -copy_str_1: - xor eax,eax - cld -@@: - lodsb - stosb - test eax,eax - jnz @b - ret -;--------------------------------------------------------------------- -include 'events.inc' -include 'events_of_window.inc' -include 'events_of_keys.inc' -include 'events_of_buttons.inc' -include 'events_of_mouse.inc' -include 'panel_engen.inc' -include 'screen.inc' -include 'menu_instruments.inc' -include 'icons_instruments.inc' -include 'icons.inc' -include 'sprites.inc' -include 'string.inc' -include 'palette.inc' -include 'files.inc' -include 'time.inc' -include 'menu.inc' -;----------------------------------------------------------- -;------------variables and data of program------------------ -;----------------------------------------------------------- -;sound_havent_memory db 150,64,0 - -include 'lib_data.inc' -include 'panel_data.inc' -include 'brushes.inc' -include 'spray.inc' -include 'width_lines.inc' -;---------------------------------------------------------- -;-------------------icon's picture------------------------- -;---------------------------------------------------------- -align 4 -panel_picture: -file 'panel_buttons.png' -.end: -align 4 -panel_zoom: -file 'panel_zoom.png' -.end: -;****************cursors****************** -brush_cursor: -file 'cursors/brush.cur' -flood_fill_cursor: -file 'cursors/flood_fill.cur' -lastik_cursor: -file 'cursors/lastik.cur' -other_cursor: -file 'cursors/other.cur' -pencil_cursor: -file 'cursors/pencil.cur' -pipette_cursor: -file 'cursors/pipette.cur' -spray_cursor: -file 'cursors/spray.cur' -zoom_cursor: -file 'cursors/zoom.cur' -;---------------------------------------------------------- -align 4 -IM_END: -;----------------------------------------------------------- -;------------variables and data of program------------------ -;----------------------------------------------------------- -time rd 1 -PosX rd 1 ;scroll x file position -PosY rd 1 ;scroll y file position -PointerToIcons rd 1 -ScreenPointer rd 1 -PointerToPicture rd 1 -PointerToCopyPicture rd 1 -PointerToCopyPicture2 rd 1 -PointerToEditBufer rd 1 -PointerToSpriteBufer rd 1 -PointerToPalette rd 1 ;указатель на пилитру (нужен для сохранения в *.bmp) -Color rd 1 -SColor rd 1 -Number_Brush rd 1 -Brush_SizeX rd 1 -Brush_SizeY rd 1 -Current_instrument rd 1 -Last_instrument rd 1 -OldX rd 1 -OldY rd 1 - -MouseX rd 1 -MouseY rd 1 -MouseBut rd 1 ;события от кнопок мыши -Window_SizeX rd 1 -Window_SizeY rd 1 -Window_CordinatX rd 1 -Window_CordinatY rd 1 -Picture_SizeX rd 1 -Picture_SizeY rd 1 -ScreenX rd 1 ;координата x курсора с учетом масштаба -ScreenY rd 1 ;координата y курсора с учетом масштаба -WorkScreen_SizeX rd 1 ;ширина рабочего экрана -WorkScreen_SizeY rd 1 ;высота рабочего экрана -MaxWorkScreen_SizeX rd 1 -MaxWorkScreen_SizeY rd 1 -k rd 1 ;масштаб - -ReserveArray rd 1 ;указатель на память используемую при рисовании фигур - ;для сохранения участков фона под фигурами, а также для заливки -CounterX rd 1 ;число пикселей изображения по ширине, которые попадают - ;в экран рабочей области, с учетом текущего масштаба -CounterY rd 1 -OffsetYPicture rd 1 ;сдвиг по оси y в буфере изображения при рисовании - ;следующей линии изображения -OffsetYWorkScreen rd 1 ;сдвиг по оси y в буфере рабочей области при - ;рисовании следующей линии пикселей. Чем больше масштаб, тем ниже - ;нужно опускаться по рабочей области. -OffsetYBigPixel rd 1 ;сдвиг по оси y для рисования пикселей на большом - ;масштабе. Рисуется 1-я полоса пикселя, а потом нужно перейти вниз и - ;влево для рисования следующей полосы. - -Icon_X rd 1 -Icon_Y rd 1 -counter rd 1 -counter2 rd 1 -number_panel rd 1 -number_menu rd 1 - -Scroll1CoordinatX rd 1 ;scroll x screen position -Scroll1CoordinatY rd 1 ;scroll y screen position -Scroll1MaxSizeX rd 1 -Scroll1MaxSizeY rd 1 -Scroll1SizeX rd 1 ;scroll polzunok size -Scroll1FreeX rd 1 - -Scroll2CoordinatX rd 1 -Scroll2CoordinatY rd 1 -Scroll2MaxSizeX rd 1 -Scroll2MaxSizeY rd 1 -Scroll2SizeY rd 1 -Scroll2FreeY rd 1 - -x rd 1 -y rd 1 - -Radius rd 1 -Dx_ rd 1 -Dy_ rd 1 -line_width rd 1 -a_ellips rd 1 -b_ellips rd 1 - -used_OldX rd 1 ;for draw hard contour -used_OldY rd 1 -paste_img_w rd 1 ;ширина вставляемого изображения -paste_img_h rd 1 ;высота вставляемого изображения -crossing_old_x rd 1 ;начальная коорд. x области копирования -crossing_old_y rd 1 ;начальная коорд. y области копирования -rectangular_shade_x rd 1 ;конечная коорд. x области копирования -rectangular_shade_y rd 1 ;конечная коорд. y области копирования -crossing rd 1 ;0 - выделения нет, 1 - идет процес выделения, - ;2 - выделение завершено, 3 - область выделения перемещается -number_undo rd 1 -SpriteSizeX rd 1 ;??? -SpriteSizeY rd 1 ;??? -SpriteCoordinatX rd 1 -SpriteCoordinatY rd 1 -SpriteOldCoordinatX rd 1 -SpriteOldCoordinatY rd 1 - -CursorsID rd 10 - -Activate_instrument rb 1 ;если равно 0 - то копирование текущего буфера - ;для его редактирования, если 1 - текущий буфер не копируется -save_flag rb 1 -exit_from_work_arrea rb 1 -lastik_is_active rb 1 -instrument_used rb 1 -DrawSprite_flag rb 1 -Paste_flag rb 1 -;--------------------------------------------------------------------- -IncludeUGlobals -;--------------------------------------------------------------------- -align 4 -file_path rb 4096 -filename_area rb 256 -temp_dir_pach rb 4096 -library_path rb 4096 -cur_dir_path rb 4096 -procinfo: rb 1024 -align 4 -syscolors rb 192 -syscolors_end: -;--------------------------------------------------------------------- -align 4 - rb 4096 -stacktop: -;--------------------------------------------------------------------- -I_END: \ No newline at end of file +; SPDX-License-Identifier: NOASSERTION +; + +;******************************************************* +;**************GRAPHICS EDITOR ANIMAGE ***************** +;******************************************************* +; version: 1.52 +; last update: 23.11.2016 +; changes: Can save *.png files +; author: IgorA +;-------------------------------------------------------- +; version: 1.51 +; last update: 23.03.2016 +; changes: Use library 'kmenu.obj', update GUI +; authors: IgorA, Veliant, Leency +;-------------------------------------------------------- +; version: 1.4 +; last update: 12.03.2016 +; changes: Use library 'libimg.obj' +; author: IgorA +;-------------------------------------------------------- +; version: 1.3 +; last update: 05.10.2010 +; written by: Marat Zakiyanov aka Mario79, aka Mario +; changes: Fixed window flicker when redrawing, +; Fixed memory leak for stack +;-------------------------------------------------------- +; version: 1.2 +; last update: 30.09.2010 +; written by: Marat Zakiyanov aka Mario79, aka Mario +; changes: Program used function 68 instead 64 is now, +; select path with OpenDialog +;-------------------------------------------------------- +; version: 1.1 +; last update: 09.12.2006 +; authors: +; programming by andrew_programmer +; design by golus + +use32 +org 0 + db 'MENUET01' + dd 1, START, IM_END, I_END + dd stacktop, file_path, cur_dir_path + +include '../../config.inc' ;for nightbuild +include '../../macros.inc' +include '../../proc32.inc' +include '../../KOSfuncs.inc' +include '../../load_lib.mac' +include '../../dll.inc' +include '../../develop/libraries/libs-dev/libio/libio.inc' +include '../../develop/libraries/libs-dev/libimg/libimg.inc' +;include '../../debug.inc' + +@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load + +;--------------------------------------------------------- +; *** constants for interface *** + +; skin adjustments +ci_offs_skin_w equ 5 ;adjustment to the width of the skin frame +ci_offs_skin_h equ 24 ;skin height adjustment + +; main window +ci_wnd_min_siz_x equ 585 ;minimum size x +ci_wnd_min_siz_y equ 400 ;minimum size y + +; toolbar +ci_panel_x_pos equ 0 ;coord. x for panel +ci_panel_y_pos equ 20 ;coord. y for panel +ci_panel_but_y1 equ ci_panel_y_pos +5 ;y coordinate for 1st row of buttons +ci_panel_but_y2 equ ci_panel_y_pos+30 ;y coordinate for 2nd row of buttons +ci_palete_y_pos equ ci_panel_y_pos+51 ;y coordinate for color palette +ci_panel_zoom_x equ 178 ;x coordinate for zoom bar buttons + +; editor window +ci_edit_wnd_x_pos equ 0 ;x coordinate for editor window +ci_edit_wnd_y_pos equ 71 ;y coordinate for editor window +ci_edit_wnd_border equ 3 ;frame around the editor window + +; scrolling +ci_scroll_dim equ 22 ;scroll sizes +ci_scrollh_coord_x_min equ (ci_edit_wnd_x_pos+3) ;x minimum slider position + ;horizontal scrolling +ci_scrollv_coord_y_min equ (ci_edit_wnd_y_pos+3) ;y minimum slider position + ;vertical scrolling +;--------------------------------------------------------- + +include 'bmplib.inc' +include 'dialog2.inc' +include 'design.inc' +include 'graphlib.inc' + +include 'cursors.inc' +include 'memory.inc' +include 'load_from_parameters.inc' + +START: + mcall SF_SYS_MISC,SSF_HEAP_INIT + mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, syscolors, syscolors_end-syscolors + +load_libraries l_libs_start,end_l_libs + + cmp eax,-1 + jz close + + mcall SF_SET_EVENTS_MASK,0x80000067 ; 1100111b +;--------------------------------------------------------- +;-----------------------init data------------------------- +;--------------------------------------------------------- +include 'init_data.inc' + +;---------------------------------------------------------- +;--------get memory and draw window of program------------- +;---------------------------------------------------------- + call GetMemory + mov [Current_instrument],10 ;pencil + call TakeButtonInstruments ;set startup instrument + call cleare_work_arrea + call load_icons + call init_main_menu + +;load cursors + mov eax,CursorsID + call load_cursors + +;--------------------------------------------------------- +;---------check loading of file from parameters----------- +;--------------------------------------------------------- + mov eax,file_path + cmp [eax],byte 0 + jz @f + call load_picture + call MovePictureToWorkScreen +@@: + +;--------------------------------------------------------------------- + mov edi,filename_area + mov esi,path4+5 + call copy_str_1 + + mov edi,file_path + cmp [edi],byte 0 + jne @f + mov esi,path4 + call copy_str_1 +@@: +;OpenDialog initialisation + stdcall [OpenDialog_Init], OpenDialog_data + stdcall [ColorDialog_Init], ColorDialog_data +;--------------------------------------------------------------------- + +align 4 +red: + call drawwin +;---------------------------------------------------------- +;---------------------main loop---------------------------- +;---------------------------------------------------------- +align 4 +still: + mcall SF_WAIT_EVENT + + cmp eax,1 + je red + + cmp eax,2 + je keys + + cmp eax,3 + je buttons + + cmp eax,6 + je mouse + + jmp still + +;--------------------------------------------------------------------- +copy_str_1: + xor eax,eax + cld +@@: + lodsb + stosb + test eax,eax + jnz @b + ret +;--------------------------------------------------------------------- +include 'events.inc' +include 'events_of_window.inc' +include 'events_of_keys.inc' +include 'events_of_buttons.inc' +include 'events_of_mouse.inc' +include 'panel_engen.inc' +include 'screen.inc' +include 'menu_instruments.inc' +include 'icons_instruments.inc' +include 'icons.inc' +include 'sprites.inc' +include 'string.inc' +include 'palette.inc' +include 'files.inc' +include 'time.inc' +include 'menu.inc' +;----------------------------------------------------------- +;------------variables and data of program------------------ +;----------------------------------------------------------- +;sound_havent_memory db 150,64,0 + +include 'lib_data.inc' +include 'panel_data.inc' +include 'brushes.inc' +include 'spray.inc' +include 'width_lines.inc' +;---------------------------------------------------------- +;-------------------icon's picture------------------------- +;---------------------------------------------------------- +align 4 +panel_picture: +file 'panel_buttons.png' +.end: +align 4 +panel_zoom: +file 'panel_zoom.png' +.end: +;****************cursors****************** +brush_cursor: +file 'cursors/brush.cur' +flood_fill_cursor: +file 'cursors/flood_fill.cur' +lastik_cursor: +file 'cursors/lastik.cur' +other_cursor: +file 'cursors/other.cur' +pencil_cursor: +file 'cursors/pencil.cur' +pipette_cursor: +file 'cursors/pipette.cur' +spray_cursor: +file 'cursors/spray.cur' +zoom_cursor: +file 'cursors/zoom.cur' +;---------------------------------------------------------- +align 4 +IM_END: +;----------------------------------------------------------- +;------------variables and data of program------------------ +;----------------------------------------------------------- +time rd 1 +PosX rd 1 ;scroll x file position +PosY rd 1 ;scroll y file position +PointerToIcons rd 1 +ScreenPointer rd 1 +PointerToPicture rd 1 +PointerToCopyPicture rd 1 +PointerToCopyPicture2 rd 1 +PointerToEditBufer rd 1 +PointerToSpriteBufer rd 1 +PointerToPalette rd 1 ;pointer to the file (needed for saving in *.bmp) +Color rd 1 +SColor rd 1 +Number_Brush rd 1 +Brush_SizeX rd 1 +Brush_SizeY rd 1 +Current_instrument rd 1 +Last_instrument rd 1 +OldX rd 1 +OldY rd 1 + +MouseX rd 1 +MouseY rd 1 +MouseBut rd 1 ;mouse button events +Window_SizeX rd 1 +Window_SizeY rd 1 +Window_CordinatX rd 1 +Window_CordinatY rd 1 +Picture_SizeX rd 1 +Picture_SizeY rd 1 +ScreenX rd 1 ;x coordinate of the cursor accounting for the scale +ScreenY rd 1 ;y coordinate of the cursor accounting for the scale +WorkScreen_SizeX rd 1 ;width of the working screen +WorkScreen_SizeY rd 1 ;height of the working screen +MaxWorkScreen_SizeX rd 1 +MaxWorkScreen_SizeY rd 1 +k rd 1 ;scale + +ReserveArray rd 1 ;pointer to memory used when drawing figures + ;to save background areas under figures, as well as for filling +CounterX rd 1 ;number of image pixels by width that fall + ;within the workspace screen, given the current zoom level +CounterY rd 1 +OffsetYPicture rd 1 ;y-shift in image buffer when drawing + ;next line of image +OffsetYWorkScreen rd 1 ;y-shift in the workspace buffer when + ;drawing the next line of pixels. The larger the scale, the lower + ;you need to go down the workspace. +OffsetYBigPixel rd 1 ;shift along the y-axis to draw pixels on a large + ;scale. The 1st strip of the pixel is drawn, and then you need to move down and + ;left to draw the next strip. + +Icon_X rd 1 +Icon_Y rd 1 +counter rd 1 +counter2 rd 1 +number_panel rd 1 +number_menu rd 1 + +Scroll1CoordinatX rd 1 ;scroll x screen position +Scroll1CoordinatY rd 1 ;scroll y screen position +Scroll1MaxSizeX rd 1 +Scroll1MaxSizeY rd 1 +Scroll1SizeX rd 1 ;scroll polzunok size +Scroll1FreeX rd 1 + +Scroll2CoordinatX rd 1 +Scroll2CoordinatY rd 1 +Scroll2MaxSizeX rd 1 +Scroll2MaxSizeY rd 1 +Scroll2SizeY rd 1 +Scroll2FreeY rd 1 + +x rd 1 +y rd 1 + +Radius rd 1 +Dx_ rd 1 +Dy_ rd 1 +line_width rd 1 +a_ellips rd 1 +b_ellips rd 1 + +used_OldX rd 1 ;for draw hard contour +used_OldY rd 1 +paste_img_w rd 1 ;width of the inserted image +paste_img_h rd 1 ;height of the inserted image +crossing_old_x rd 1 ;initial x-coord of copy area +crossing_old_y rd 1 ;initial y-coord of copy area +rectangular_shade_x rd 1 ;end x-coord of copy area +rectangular_shade_y rd 1 ;end y-coord of copy area +crossing rd 1 ;0 - no selection, 1 - selection in progress, + ;2 - selection complete, 3 - selection area moving +number_undo rd 1 +SpriteSizeX rd 1 ;??? +SpriteSizeY rd 1 ;??? +SpriteCoordinatX rd 1 +SpriteCoordinatY rd 1 +SpriteOldCoordinatX rd 1 +SpriteOldCoordinatY rd 1 + +CursorsID rd 10 + +Activate_instrument rb 1 ;if equal to 0 - then copy the current buffer + ;for editing it, if 1 - the current buffer is not copied +save_flag rb 1 +exit_from_work_arrea rb 1 +lastik_is_active rb 1 +instrument_used rb 1 +DrawSprite_flag rb 1 +Paste_flag rb 1 +;--------------------------------------------------------------------- +IncludeUGlobals +;--------------------------------------------------------------------- +align 4 +file_path rb 4096 +filename_area rb 256 +temp_dir_pach rb 4096 +library_path rb 4096 +cur_dir_path rb 4096 +procinfo: rb 1024 +align 4 +syscolors rb 192 +syscolors_end: +;--------------------------------------------------------------------- +align 4 + rb 4096 +stacktop: +;--------------------------------------------------------------------- +I_END: diff --git a/programs/media/kiv/kiv.asm b/programs/media/kiv/kiv.asm index 54f0d6e5d..06b4506a4 100644 --- a/programs/media/kiv/kiv.asm +++ b/programs/media/kiv/kiv.asm @@ -1,3 +1,6 @@ +; SPDX-License-Identifier: NOASSERTION +; + format binary as "" use32 @@ -13,13 +16,13 @@ __DEBUG_LEVEL__ = 1 LG_TRACE equ 1 -include '../../../config.inc' -include '../../../proc32.inc' -include '../../../macros.inc' -include '../../../KOSfuncs.inc' -include '../../../dll.inc' -include '../../../debug-fdo.inc' -include '../../../develop/libraries/libs-dev/libimg/libimg.inc' +include '../../config.inc' +include '../../proc32.inc' +include '../../macros.inc' +include '../../KOSfuncs.inc' +include '../../dll.inc' +include '../../debug-fdo.inc' +include '../../develop/libraries/libs-dev/libimg/libimg.inc' KEY_MOVE_PIXELS = 50 diff --git a/programs/media/listplay/listplay.asm b/programs/media/listplay/listplay.asm index 51cbae727..1c0163a58 100644 --- a/programs/media/listplay/listplay.asm +++ b/programs/media/listplay/listplay.asm @@ -1,848 +1,848 @@ - -; -; Compile with flat assembler -; Программка позволяющая проигрывать плейлист -; Разработал: ДедОк :) - -use32 - - org 0x0 - - db 'MENUET01' ; 8 byte id - dd 0x01 ; header version - dd START ; start of code - dd I_END ; size of image - dd 0x25000 ; memory for app - dd 0x20000 ; esp - dd playlist, 0x0 - -include '../../../macros.inc' - -START: ; start of execution -cmp [playlist],0x00000000 -jne dprod -mcall -1 -dprod: -or [trig_sys],40h -call scandr -jmp mmm.seach -still: - not [trig_sys] - or [trig_sys],400h - not [trig_sys] - or [trig_sys],200h - call enproc - call delproc - mov eax,23 ; wait here for event - mov ebx,20 - mcall - cmp eax,1 ; redraw request ? - je red - cmp eax,3 ; button in buffer ? - je button - test [trig_sys],200h - jz next_song - jmp still -next_song: - add [poz_butt],1 - movzx eax,[poz_song] - add eax,1 - mov [poz_song],al - mov dx,255 - mul dx - mov [song_poz], eax - movzx eax,[poz_song] - sub eax,1 - cmp [song_count],eax - ja .dgo - mov [poz_song],1 - mov [song_poz],255 - mov [poz_butt],6 -.dgo: - call load_song - call procskan - call start - or [trig_sys],200h - call draw_window - jmp still -red: - call draw_window - jmp still -button: ; button - mov eax,17 - mcall - cmp ah,1 - je close - cmp ah,2 - je mmm - cmp ah,3 - je mma - cmp ah,4 - je mmd - cmp ah,5 - je mmf - cmp ah,38 - jb mma - ret -close: - mov eax,-1 - mcall -mma: - mov [poz_butt],ah - mov [poz_song],ah - sub [poz_song],5 - movzx eax,[poz_song] - add eax,[sme] - mov [poz_song],al - mov dx,255 - mul dx - mov [song_poz], eax - call load_song - call procskan - call start - or [trig_sys],200h - call draw_window - jmp still -mmw: - mov ebx,file_info2 - mov ecx,[razm_str] - add dword [ebx+4],ecx - or [trig_sys],40h - jmp mmm.seach - ret -mmm: -.seach: - call getstring - call get_drive - call put_db - call draw_window - test [trig_sys],04h - jz mmw - jmp still -mmd: - cmp [poz_db3],510 - jb .emd - sub [poz_db3],255 - add [poz_butt],1 - sub [sme],1 -.emd: - call draw_window - jmp still -mmf: - add [poz_db3],255 - sub [poz_butt],1 - add [sme],1 - call draw_window - jmp still -procskan: - mov [num_proc],255 -qqqqq: - mov eax,9 - mov ebx,pib - mov ecx, [num_proc] - mcall - cld - lea si,[pib.process_name] - lea di,[minus] - mov cx,7 - rep cmps byte [si],[di] - jcxz mat - sub [num_proc],1 - cmp [num_proc],1 - jne qqqqq - ret -mat: - mov eax,18 - mov ebx,2 - mov ecx,[num_proc] - mcall - jmp procskan -scandr: - mov eax,18 - mov ebx,11 - mov ecx,1 - mov edx,scan_rez - mcall - ret -mountpl: - mov cx,255 - cld - lea di,[fl] - mov al,00h - repne stos byte [di] - cld - mov cx,6 - lea si,[play_list] - lea di,[fl] - rep movs byte [di],[si] - mov cx,0 - ret -get_drive: - mov al,byte[scan_rez+1] - mov [my_draw],al - mov [ns],48 - cmp [my_draw],0 - jne .c0 - or [trig_sys],01h -.c0: - cmp [my_draw],0x80 - jb .h0 - sub [my_draw],0x80 - mov [n_razd],1 - mov [nd],49 - mov al,[cd_0] - mov [td],al - call folscan -.h0: - cmp [trig_scan],1 - je ex1 - cmp [my_draw],0x40 - jb .c1 - sub [my_draw],0x40 - mov al,byte[scan_rez+2] - mov [n_razd],al - add al,48 - mov [nd],al - mov al,[hd_0] - mov [td],al - call folscan -.c1: - cmp [trig_scan],1 - je ex1 - cmp [my_draw],0x20 - jb .h1 - sub [my_draw],0x20 - mov [n_razd],1 - mov [nd],49 - mov al,[cd_0] - mov [ns],19 - call folscan -.h1: - cmp [trig_scan],1 - je ex1 - cmp [my_draw],0x10 - jb .c2 - sub [my_draw],0x10 - mov al,byte[scan_rez+3] - mov [n_razd],al - add al,48 - mov [nd],al - mov al,[hd_0] - mov [td],al - mov [ns],49 - call folscan -.c2: - cmp [trig_scan],1 - je ex1 - cmp [my_draw],0x08 - jb .h2 - sub [my_draw],0x08 - mov [n_razd],1 - mov [nd],49 - mov al,[cd_0] - mov [td],al - mov [ns],50 - call folscan -.h2: - cmp [trig_scan],1 - je ex1 - cmp [my_draw],0x04 - jb .c3 - sub [my_draw],0x04 - mov al,byte[scan_rez+4] - mov [n_razd],al - add al,48 - mov [nd],al - mov al,[hd_0] - mov [td],al - mov [ns],50 - call folscan -.c3: - cmp [trig_scan],1 - je ex1 - cmp [my_draw],0x02 - jb .h3 - sub [my_draw],0x02 - mov [n_razd],1 - mov [nd],49 - mov al,[cd_0] - mov [td],al - mov [ns],51 - call folscan -.h3: - cmp [trig_scan],1 - je ex1 - cmp [my_draw],0x01 - jb ex1 - sub [my_draw],0x01 - mov al,byte[scan_rez+5] - mov [n_razd],al - add al,48 - mov [nd],al - mov al,[hd_0] - mov [td],al - mov [ns],51 - call folscan -ex1: - cmp [fold],05h - jne ext2 - or [trig_sys],04h -ext2: - cmp [fold],0Ah - jne ext3 - or [trig_sys],08h - jmp eext -ext3: - mov [trig_scan],0 - not [trig_sys] - or [trig_sys],0Eh - not [trig_sys] -eext: - ret -folscan: - cmp [trig_scan],1 - je .out2 - mov eax,70 - mov ebx,file_info - mcall - mov [fold],eax - cmp [fold],0 - jne .out - mov al,1 - mov [trig_scan],al - jmp .out2 -.out: - mov al,1 - sub [n_razd],al - mov al,1 - sub [nd],al - cmp [n_razd],0 - jne folscan -.out2: - ret -get_play: - mov cx,255 - lea si,[floc] - lea di,[playlist] - rep movs byte [di],[si] - mov cx,0 -ret -getstring: - mov eax,70 - mov ebx,file_info2 - mov dword [ebx+12], 255 - mov dword [ebx+16],string1 - mov dword [ebx+21],playlist - mcall - cmp eax,6 - jne .pro - or [trig_sys],04h - call draw_window - jmp still -.pro: - - cmp ebx,0xFFFFFFFF - je .exit - call rus_m - cld - lea di,[string1] - mov cx,255 - mov al,0ah - repne scas byte [es:di] - je .calc - mov [razm_str],0 - mov ebx,file_info2 - add dword [ebx+4], 255 - or [trig_sys],40h - jmp mmm.seach -.calc: - mov [razm_str],255 - sub [razm_str],ecx -.kon: - mov [razm_path],0 - cld - lea di,[string1] - mov ecx,0 -.ppr: - cmp byte [es:di],70h - je .s1 - cmp byte [es:di],50h - je .s1 - add ecx,1 - add di,1 - cmp ecx,[razm_str] - jb .ppr - jmp .next -.s1: - add di,1 - cmp byte [es:di],33h - je .s2 - sub di,1 - jmp .next - ret -.s2: - - or [trig_sys],80h - mov [razm_path],ecx - add [razm_path],2 - -; mov [ss2],0 - cld - lea di,[string1] - mov cx,0 - mov [zzz],cx -.ppre: - cmp byte [es:di],3Ah - je .se1 - add cx,1 - add di,1 - cmp ecx,[razm_path] - jne .ppre - jmp .mount -.se1: - add di,1 - cmp byte [es:di],5Ch - je .se2 - sub di,1 - jmp .mount -.se2: - cmp ecx,250 - jb .se3 - mov ecx,0 -.se3: - add cx,2 -; mov [ss2],cx - mov [zzz],cx -.mount: - movzx ecx,[zzz] - cmp ecx, [razm_path] - jb .mount1 - or [trig_sys],04h - jmp still -.mount1: - mov ecx,255 - cld - lea di,[fl] - mov al,00h - repne stos byte [di] - cld - mov ecx,[razm_path] - sub cx,[zzz] - lea si,[string1] - add si,[zzz] - lea di,[fl] - rep movs byte [di],[si] - mov ecx,0 -.sl_m: - mov ecx,0 - lea di,[fl] -.cikl_mx: - mov al,byte[di] - mov [char_con],al - cmp al,5Ch - je .con_sl - jmp .ext6 -.con_sl: - mov al,2Fh -.ext6: - stos byte [di] - add ecx,1 - cmp ecx,[razm_path] - jb .cikl_mx - -.exit: - ret -.next: - not [trig_sys] - or [trig_sys],80h - not [trig_sys] - mov ebx,file_info2 - mov ecx,[razm_str] - add dword [ebx+4],ecx - or [trig_sys],40h - jmp mmm.seach -rus_m: - test [trig_sys],40h - jnz ddff - ret -ddff: - mov ecx,0 - lea di,[string1] -cicl_m: - mov al,byte[di] - mov [char_con],al - shr al,4 - cmp al,0Eh - je min_sor - cmp al,0Ch - je min_sor - cmp al,0Dh - je min_sor - cmp al,0Fh - je min_des - shl al,4 - mov al,0 - jmp ext5 -min_sor: - sub [char_con],40h - jmp ext5 -min_des: - sub [char_con],10h - jmp ext5 -ext5: - mov al,[char_con] - stos byte [di] - add ecx,1 - cmp ecx,255 - jb cicl_m - not [trig_sys] - or [trig_sys],40h - not [trig_sys] - ret - -put_db: - test [trig_sys],80h - jz .exit - add [song_count],1 - add [poz_db],255 - mov ecx,255 - cld - mov ebx,[poz_db] - lea di,[memlist+ebx] - mov al,00h - repne stos byte [di] - cld - mov ecx,255 - lea si,[floc] - mov ebx,[poz_db] - lea di,[memlist+ebx] - rep movs byte [di],[si] - mov ecx,0 -.exit: - ret -load_song: - cld - mov ecx,255 - lea di,[song_path] - mov ebx,[song_poz] - lea si,[memlist+ebx] - rep movs byte [di],[si] - mov ecx,0 - ret -start: - mov eax,70 - mov ebx,folder_inf - mcall - ret -delproc: - test [trig_sys],400h - jnz .sdf - ret -.sdf: - mov [num_proc],255 -.fgf: - mov eax,9 - mov ebx,pib - mov ecx, [num_proc] - mcall - cld - lea si,[pib.process_name] - lea di,[minus] - mov cx,7 - rep cmps byte [si],[di] - jcxz .qwer - sub [num_proc],1 - cmp [num_proc],1 - jne .fgf - test [trig_sys],200h - ret -.qwer: - mov eax,[pib+process_information.cpu_usage] - mov [q_takt],eax - cmp [q_takt],200000 - jb .asdf - ret -.asdf: - add [count_err],1 - cmp [count_err],6 - ja .djbn - ret -.djbn: - mov [count_err],0 - not [trig_sys] - or [trig_sys],200h - not [trig_sys] - ret -enproc: - mov [num_proc],255 -.fgf: - mov eax,9 - mov ebx,pib - mov ecx, [num_proc] - mcall - cld - lea si,[pib.process_name] - lea di,[minus] - mov cx,7 - rep cmps byte [si],[di] - jcxz .qwer - sub [num_proc],1 - cmp [num_proc],1 - jne .fgf - ret -.qwer: - or [trig_sys],400h - ret - -; ********************************************* -; ******* WINDOW DEFINITIONS AND DRAW ******** -; ********************************************* - -draw_window: - mov eax,48 - mov ebx,3 - mov ecx,sc - mov edx,sizeof.system_colors - mcall - mov eax,12 ; function 12:tell os about windowdraw - mov ebx,1 ; 1, start of draw - mcall - ; DRAW WINDOW - xor eax,eax ; function 0 : define and draw window - mov ebx,100*65536+550 ; [x start] *65536 + [x size] - mov ecx,100*65536+420 ; [y start] *65536 + [y size] - mov edx,[sc.work] ; color of work area RRGGBB,8->color gl - or edx,0x33000000 - mov edi,title - mcall - mov eax,4 - mov ebx,5*65536+5 - mov ecx,0xC0000000 - mov edx,label1 - mov edi,[sc.work] - mcall - mov eax,4 - mov ebx,300*65536+5 - mov ecx,0xC0000000 - mov edx,label5 - mov edi,[sc.work] - mcall - mov eax,4 - mov ebx,300*65536+15 - mov ecx,0xC0000000 - mov edx,label6 - mov edi,[sc.work] - mcall - mov eax,4 - mov ebx,25*65536+35 - mov ecx,0xC00000dd - mov edx,song_path - mov edi,[sc.work] - mcall - mov eax,4 - mov ebx,100*65536+5 - mov ecx,0xC0000000 - mov edx,playlist - mov edi,[sc.work] - mcall - test [trig_sys],4h - jnz .zam1 - mov eax,4 - mov ebx,5*65536+15 - mov ecx,0xC0000000 - mov edx,label3 - mov edi,[sc.work] - mcall - jmp .zam2 -.zam1: - mov eax,4 - mov ebx,5*65536+15 - mov ecx,0xC0000000 - mov edx,label2 - mov edi,[sc.work] - mcall - mov eax,4 - mov ebx,5*65536+25 - mov ecx,0xC0000000 - mov edx,label4 - mov edi,[sc.work] - mcall -.zam2: - -; mov eax,47 -; mov esi,0x50000000 -; mov ecx, [trig_sys] -; mov edi,[sc.work] -; mov ebx,0x00080100 -; mov edx,385*65536+25 -; mcall - mov eax,47 - mov esi,0x50000000 - mov ecx, [song_count] - mov edi,[sc.work] - mov ebx,0x00030000 - mov edx,500*65536+5 - mcall - mov eax,47 - mov esi,0x50000000 - movzx ecx, [poz_song] - mov edi,[sc.work] - mov ebx,0x00030000 - mov edx,500*65536+15 - mcall - mov [bbut],32 - mov [poz_but],48*65536+10 - mov edx,6 -butt1: - mov ebx,0*65536+20 - mov ecx,[poz_but] - mov esi,[color1] - movzx eax,[poz_butt] - cmp edx,eax - jne .uuu - mov esi,[color2] -.uuu: - mov eax,8 - mcall - add edx,1 - add [poz_but],10*65536 - sub [bbut],1 - cmp [bbut],0 - jne butt1 - mov eax,8 - mov ebx,525*65536+15 - mov ecx,45*65536+15 - mov esi,0x00aaaadd - mov edx,4 - mcall - mov eax,8 - mov ebx,525*65536+15 - mov ecx,365*65536+15 - mov esi,0x00aaaadd - mov edx,5 - mcall - mov [ai],32 - mov [list_poz],25*65536+50 - mov ebx,[poz_db3] - mov [poz_db2],ebx -list: - mov eax,4 - mov ecx,0xC0000000 - mov ebx,[poz_db2] - lea edx,[memlist+ebx] - mov ebx, [list_poz] - mov edi,[sc.work] - mcall - add [list_poz],10 - add [poz_db2],255 - sub [ai],1 - cmp [ai],0 - ja list - mov eax,12 ; function 12:tell os about windowdraw - mov ebx,2 ; 2, end of draw - mcall - ret - - - -; DATA AREA - - -title: db 'Проигрываем плейлист v 0.20',0 -play_list: db '1.kpl',0 -cd_0: db 'c',0 -hd_0: db 'h',0 -label1: db 'Файл плейлиста:',0 -label2: db 'сканирование закончено... :) ',0 -label3: db 'Подождите, пожалуйста, идёт сканирование',0 -label4: db 'Воспроизводимый файл:',0 -label5: db 'Всего файлов в плейлисте найдено:',0 -label6: db 'Номер воспроизводимого файла:',0 -minus: db 'ac97snd',0 -player: db '/sys/media/ac97snd' ,0 -my_draw db 0 -n_razd db 0 -trig_scan db 0 -char_con db 0 -poz_butt db 0 -poz_song db 0 -count_err dd 0 -num_proc dd 0 -q_takt dd 0 -razm_str dd 0 -fold dd 0 -razm_path dd 0 -trig_sys dd 0 -poz_db dd 0 -poz_db2 dd 0 -poz_db3 dd 255 -song_poz dd 0 -list_poz dd 5*65536+50 -song_count dd 0 -ai dd 0 -st_r dd 0 -bbut dd 0 -poz_but dd 0 -sme dd 0 -color1 dd 0x006666dd -color2 dd 0x00dddddd -ss2 dd 0 -zzz dw 22 -scan_rez: - db 0 - db 0 - db 0 - db 0 - db 0 - db 0 - db 0 - db 0 - db 0 - db 0 -floc: -pc: db '/' -td: db 'h' -dr: db 'd' -ns db 48 -vc: db '/' -nd db 48 -ks: db '/' -fl: - rb 255 -playlist rb 255 -song_path rb 255 -folder_inf: - dd 7 - dd 0 - dd song_path - dd 0 - dd 0 - db 0 - dd player -file_info: - dd 0 - dd 0 - dd 0 - dd 0 - dd 0 - db 0 - dd floc -file_info2: - dd 0 - dd 0 - dd 0 - dd 0 - dd 0 - db 0 - dd 0 -string1 rb 255 - -I_END: - - - -temp dd ? -sc system_colors -pib process_information -memlist rb 65536 - +; SPDX-License-Identifier: NOASSERTION +; +; +; Compile with flat assembler +; A program that allows you to play a playlist +; Developed by: DedOk :) + +use32 + + org 0x0 + + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd I_END ; size of image + dd 0x25000 ; memory for app + dd 0x20000 ; esp + dd playlist, 0x0 + +include '../../macros.inc' + +START: ; start of execution +cmp [playlist],0x00000000 +jne dprod +mcall -1 +dprod: +or [trig_sys],40h +call scandr +jmp mmm.seach +still: + not [trig_sys] + or [trig_sys],400h + not [trig_sys] + or [trig_sys],200h + call enproc + call delproc + mov eax,23 ; wait here for event + mov ebx,20 + mcall + cmp eax,1 ; redraw request ? + je red + cmp eax,3 ; button in buffer ? + je button + test [trig_sys],200h + jz next_song + jmp still +next_song: + add [poz_butt],1 + movzx eax,[poz_song] + add eax,1 + mov [poz_song],al + mov dx,255 + mul dx + mov [song_poz], eax + movzx eax,[poz_song] + sub eax,1 + cmp [song_count],eax + ja .dgo + mov [poz_song],1 + mov [song_poz],255 + mov [poz_butt],6 +.dgo: + call load_song + call procskan + call start + or [trig_sys],200h + call draw_window + jmp still +red: + call draw_window + jmp still +button: ; button + mov eax,17 + mcall + cmp ah,1 + je close + cmp ah,2 + je mmm + cmp ah,3 + je mma + cmp ah,4 + je mmd + cmp ah,5 + je mmf + cmp ah,38 + jb mma + ret +close: + mov eax,-1 + mcall +mma: + mov [poz_butt],ah + mov [poz_song],ah + sub [poz_song],5 + movzx eax,[poz_song] + add eax,[sme] + mov [poz_song],al + mov dx,255 + mul dx + mov [song_poz], eax + call load_song + call procskan + call start + or [trig_sys],200h + call draw_window + jmp still +mmw: + mov ebx,file_info2 + mov ecx,[razm_str] + add dword [ebx+4],ecx + or [trig_sys],40h + jmp mmm.seach + ret +mmm: +.seach: + call getstring + call get_drive + call put_db + call draw_window + test [trig_sys],04h + jz mmw + jmp still +mmd: + cmp [poz_db3],510 + jb .emd + sub [poz_db3],255 + add [poz_butt],1 + sub [sme],1 +.emd: + call draw_window + jmp still +mmf: + add [poz_db3],255 + sub [poz_butt],1 + add [sme],1 + call draw_window + jmp still +procskan: + mov [num_proc],255 +qqqqq: + mov eax,9 + mov ebx,pib + mov ecx, [num_proc] + mcall + cld + lea si,[pib.process_name] + lea di,[minus] + mov cx,7 + rep cmps byte [si],[di] + jcxz mat + sub [num_proc],1 + cmp [num_proc],1 + jne qqqqq + ret +mat: + mov eax,18 + mov ebx,2 + mov ecx,[num_proc] + mcall + jmp procskan +scandr: + mov eax,18 + mov ebx,11 + mov ecx,1 + mov edx,scan_rez + mcall + ret +mountpl: + mov cx,255 + cld + lea di,[fl] + mov al,00h + repne stos byte [di] + cld + mov cx,6 + lea si,[play_list] + lea di,[fl] + rep movs byte [di],[si] + mov cx,0 + ret +get_drive: + mov al,byte[scan_rez+1] + mov [my_draw],al + mov [ns],48 + cmp [my_draw],0 + jne .c0 + or [trig_sys],01h +.c0: + cmp [my_draw],0x80 + jb .h0 + sub [my_draw],0x80 + mov [n_razd],1 + mov [nd],49 + mov al,[cd_0] + mov [td],al + call folscan +.h0: + cmp [trig_scan],1 + je ex1 + cmp [my_draw],0x40 + jb .c1 + sub [my_draw],0x40 + mov al,byte[scan_rez+2] + mov [n_razd],al + add al,48 + mov [nd],al + mov al,[hd_0] + mov [td],al + call folscan +.c1: + cmp [trig_scan],1 + je ex1 + cmp [my_draw],0x20 + jb .h1 + sub [my_draw],0x20 + mov [n_razd],1 + mov [nd],49 + mov al,[cd_0] + mov [ns],19 + call folscan +.h1: + cmp [trig_scan],1 + je ex1 + cmp [my_draw],0x10 + jb .c2 + sub [my_draw],0x10 + mov al,byte[scan_rez+3] + mov [n_razd],al + add al,48 + mov [nd],al + mov al,[hd_0] + mov [td],al + mov [ns],49 + call folscan +.c2: + cmp [trig_scan],1 + je ex1 + cmp [my_draw],0x08 + jb .h2 + sub [my_draw],0x08 + mov [n_razd],1 + mov [nd],49 + mov al,[cd_0] + mov [td],al + mov [ns],50 + call folscan +.h2: + cmp [trig_scan],1 + je ex1 + cmp [my_draw],0x04 + jb .c3 + sub [my_draw],0x04 + mov al,byte[scan_rez+4] + mov [n_razd],al + add al,48 + mov [nd],al + mov al,[hd_0] + mov [td],al + mov [ns],50 + call folscan +.c3: + cmp [trig_scan],1 + je ex1 + cmp [my_draw],0x02 + jb .h3 + sub [my_draw],0x02 + mov [n_razd],1 + mov [nd],49 + mov al,[cd_0] + mov [td],al + mov [ns],51 + call folscan +.h3: + cmp [trig_scan],1 + je ex1 + cmp [my_draw],0x01 + jb ex1 + sub [my_draw],0x01 + mov al,byte[scan_rez+5] + mov [n_razd],al + add al,48 + mov [nd],al + mov al,[hd_0] + mov [td],al + mov [ns],51 + call folscan +ex1: + cmp [fold],05h + jne ext2 + or [trig_sys],04h +ext2: + cmp [fold],0Ah + jne ext3 + or [trig_sys],08h + jmp eext +ext3: + mov [trig_scan],0 + not [trig_sys] + or [trig_sys],0Eh + not [trig_sys] +eext: + ret +folscan: + cmp [trig_scan],1 + je .out2 + mov eax,70 + mov ebx,file_info + mcall + mov [fold],eax + cmp [fold],0 + jne .out + mov al,1 + mov [trig_scan],al + jmp .out2 +.out: + mov al,1 + sub [n_razd],al + mov al,1 + sub [nd],al + cmp [n_razd],0 + jne folscan +.out2: + ret +get_play: + mov cx,255 + lea si,[floc] + lea di,[playlist] + rep movs byte [di],[si] + mov cx,0 +ret +getstring: + mov eax,70 + mov ebx,file_info2 + mov dword [ebx+12], 255 + mov dword [ebx+16],string1 + mov dword [ebx+21],playlist + mcall + cmp eax,6 + jne .pro + or [trig_sys],04h + call draw_window + jmp still +.pro: + + cmp ebx,0xFFFFFFFF + je .exit + call rus_m + cld + lea di,[string1] + mov cx,255 + mov al,0ah + repne scas byte [es:di] + je .calc + mov [razm_str],0 + mov ebx,file_info2 + add dword [ebx+4], 255 + or [trig_sys],40h + jmp mmm.seach +.calc: + mov [razm_str],255 + sub [razm_str],ecx +.kon: + mov [razm_path],0 + cld + lea di,[string1] + mov ecx,0 +.ppr: + cmp byte [es:di],70h + je .s1 + cmp byte [es:di],50h + je .s1 + add ecx,1 + add di,1 + cmp ecx,[razm_str] + jb .ppr + jmp .next +.s1: + add di,1 + cmp byte [es:di],33h + je .s2 + sub di,1 + jmp .next + ret +.s2: + + or [trig_sys],80h + mov [razm_path],ecx + add [razm_path],2 + +; mov [ss2],0 + cld + lea di,[string1] + mov cx,0 + mov [zzz],cx +.ppre: + cmp byte [es:di],3Ah + je .se1 + add cx,1 + add di,1 + cmp ecx,[razm_path] + jne .ppre + jmp .mount +.se1: + add di,1 + cmp byte [es:di],5Ch + je .se2 + sub di,1 + jmp .mount +.se2: + cmp ecx,250 + jb .se3 + mov ecx,0 +.se3: + add cx,2 +; mov [ss2],cx + mov [zzz],cx +.mount: + movzx ecx,[zzz] + cmp ecx, [razm_path] + jb .mount1 + or [trig_sys],04h + jmp still +.mount1: + mov ecx,255 + cld + lea di,[fl] + mov al,00h + repne stos byte [di] + cld + mov ecx,[razm_path] + sub cx,[zzz] + lea si,[string1] + add si,[zzz] + lea di,[fl] + rep movs byte [di],[si] + mov ecx,0 +.sl_m: + mov ecx,0 + lea di,[fl] +.cikl_mx: + mov al,byte[di] + mov [char_con],al + cmp al,5Ch + je .con_sl + jmp .ext6 +.con_sl: + mov al,2Fh +.ext6: + stos byte [di] + add ecx,1 + cmp ecx,[razm_path] + jb .cikl_mx + +.exit: + ret +.next: + not [trig_sys] + or [trig_sys],80h + not [trig_sys] + mov ebx,file_info2 + mov ecx,[razm_str] + add dword [ebx+4],ecx + or [trig_sys],40h + jmp mmm.seach +rus_m: + test [trig_sys],40h + jnz ddff + ret +ddff: + mov ecx,0 + lea di,[string1] +cicl_m: + mov al,byte[di] + mov [char_con],al + shr al,4 + cmp al,0Eh + je min_sor + cmp al,0Ch + je min_sor + cmp al,0Dh + je min_sor + cmp al,0Fh + je min_des + shl al,4 + mov al,0 + jmp ext5 +min_sor: + sub [char_con],40h + jmp ext5 +min_des: + sub [char_con],10h + jmp ext5 +ext5: + mov al,[char_con] + stos byte [di] + add ecx,1 + cmp ecx,255 + jb cicl_m + not [trig_sys] + or [trig_sys],40h + not [trig_sys] + ret + +put_db: + test [trig_sys],80h + jz .exit + add [song_count],1 + add [poz_db],255 + mov ecx,255 + cld + mov ebx,[poz_db] + lea di,[memlist+ebx] + mov al,00h + repne stos byte [di] + cld + mov ecx,255 + lea si,[floc] + mov ebx,[poz_db] + lea di,[memlist+ebx] + rep movs byte [di],[si] + mov ecx,0 +.exit: + ret +load_song: + cld + mov ecx,255 + lea di,[song_path] + mov ebx,[song_poz] + lea si,[memlist+ebx] + rep movs byte [di],[si] + mov ecx,0 + ret +start: + mov eax,70 + mov ebx,folder_inf + mcall + ret +delproc: + test [trig_sys],400h + jnz .sdf + ret +.sdf: + mov [num_proc],255 +.fgf: + mov eax,9 + mov ebx,pib + mov ecx, [num_proc] + mcall + cld + lea si,[pib.process_name] + lea di,[minus] + mov cx,7 + rep cmps byte [si],[di] + jcxz .qwer + sub [num_proc],1 + cmp [num_proc],1 + jne .fgf + test [trig_sys],200h + ret +.qwer: + mov eax,[pib+process_information.cpu_usage] + mov [q_takt],eax + cmp [q_takt],200000 + jb .asdf + ret +.asdf: + add [count_err],1 + cmp [count_err],6 + ja .djbn + ret +.djbn: + mov [count_err],0 + not [trig_sys] + or [trig_sys],200h + not [trig_sys] + ret +enproc: + mov [num_proc],255 +.fgf: + mov eax,9 + mov ebx,pib + mov ecx, [num_proc] + mcall + cld + lea si,[pib.process_name] + lea di,[minus] + mov cx,7 + rep cmps byte [si],[di] + jcxz .qwer + sub [num_proc],1 + cmp [num_proc],1 + jne .fgf + ret +.qwer: + or [trig_sys],400h + ret + +; ********************************************* +; ******* WINDOW DEFINITIONS AND DRAW ******** +; ********************************************* + +draw_window: + mov eax,48 + mov ebx,3 + mov ecx,sc + mov edx,sizeof.system_colors + mcall + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,1 ; 1, start of draw + mcall + ; DRAW WINDOW + xor eax,eax ; function 0 : define and draw window + mov ebx,100*65536+550 ; [x start] *65536 + [x size] + mov ecx,100*65536+420 ; [y start] *65536 + [y size] + mov edx,[sc.work] ; color of work area RRGGBB,8->color gl + or edx,0x33000000 + mov edi,title + mcall + mov eax,4 + mov ebx,5*65536+5 + mov ecx,0xC0000000 + mov edx,label1 + mov edi,[sc.work] + mcall + mov eax,4 + mov ebx,300*65536+5 + mov ecx,0xC0000000 + mov edx,label5 + mov edi,[sc.work] + mcall + mov eax,4 + mov ebx,300*65536+15 + mov ecx,0xC0000000 + mov edx,label6 + mov edi,[sc.work] + mcall + mov eax,4 + mov ebx,25*65536+35 + mov ecx,0xC00000dd + mov edx,song_path + mov edi,[sc.work] + mcall + mov eax,4 + mov ebx,100*65536+5 + mov ecx,0xC0000000 + mov edx,playlist + mov edi,[sc.work] + mcall + test [trig_sys],4h + jnz .zam1 + mov eax,4 + mov ebx,5*65536+15 + mov ecx,0xC0000000 + mov edx,label3 + mov edi,[sc.work] + mcall + jmp .zam2 +.zam1: + mov eax,4 + mov ebx,5*65536+15 + mov ecx,0xC0000000 + mov edx,label2 + mov edi,[sc.work] + mcall + mov eax,4 + mov ebx,5*65536+25 + mov ecx,0xC0000000 + mov edx,label4 + mov edi,[sc.work] + mcall +.zam2: + +; mov eax,47 +; mov esi,0x50000000 +; mov ecx, [trig_sys] +; mov edi,[sc.work] +; mov ebx,0x00080100 +; mov edx,385*65536+25 +; mcall + mov eax,47 + mov esi,0x50000000 + mov ecx, [song_count] + mov edi,[sc.work] + mov ebx,0x00030000 + mov edx,500*65536+5 + mcall + mov eax,47 + mov esi,0x50000000 + movzx ecx, [poz_song] + mov edi,[sc.work] + mov ebx,0x00030000 + mov edx,500*65536+15 + mcall + mov [bbut],32 + mov [poz_but],48*65536+10 + mov edx,6 +butt1: + mov ebx,0*65536+20 + mov ecx,[poz_but] + mov esi,[color1] + movzx eax,[poz_butt] + cmp edx,eax + jne .uuu + mov esi,[color2] +.uuu: + mov eax,8 + mcall + add edx,1 + add [poz_but],10*65536 + sub [bbut],1 + cmp [bbut],0 + jne butt1 + mov eax,8 + mov ebx,525*65536+15 + mov ecx,45*65536+15 + mov esi,0x00aaaadd + mov edx,4 + mcall + mov eax,8 + mov ebx,525*65536+15 + mov ecx,365*65536+15 + mov esi,0x00aaaadd + mov edx,5 + mcall + mov [ai],32 + mov [list_poz],25*65536+50 + mov ebx,[poz_db3] + mov [poz_db2],ebx +list: + mov eax,4 + mov ecx,0xC0000000 + mov ebx,[poz_db2] + lea edx,[memlist+ebx] + mov ebx, [list_poz] + mov edi,[sc.work] + mcall + add [list_poz],10 + add [poz_db2],255 + sub [ai],1 + cmp [ai],0 + ja list + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + mcall + ret + + + +; DATA AREA + + +title: db 'Проигрываем плейлист v 0.20',0 +play_list: db '1.kpl',0 +cd_0: db 'c',0 +hd_0: db 'h',0 +label1: db 'Файл плейлиста:',0 +label2: db 'сканирование закончено... :) ',0 +label3: db 'Подождите, пожалуйста, идёт сканирование',0 +label4: db 'Воспроизводимый файл:',0 +label5: db 'Всего файлов в плейлисте найдено:',0 +label6: db 'Номер воспроизводимого файла:',0 +minus: db 'ac97snd',0 +player: db '/sys/media/ac97snd' ,0 +my_draw db 0 +n_razd db 0 +trig_scan db 0 +char_con db 0 +poz_butt db 0 +poz_song db 0 +count_err dd 0 +num_proc dd 0 +q_takt dd 0 +razm_str dd 0 +fold dd 0 +razm_path dd 0 +trig_sys dd 0 +poz_db dd 0 +poz_db2 dd 0 +poz_db3 dd 255 +song_poz dd 0 +list_poz dd 5*65536+50 +song_count dd 0 +ai dd 0 +st_r dd 0 +bbut dd 0 +poz_but dd 0 +sme dd 0 +color1 dd 0x006666dd +color2 dd 0x00dddddd +ss2 dd 0 +zzz dw 22 +scan_rez: + db 0 + db 0 + db 0 + db 0 + db 0 + db 0 + db 0 + db 0 + db 0 + db 0 +floc: +pc: db '/' +td: db 'h' +dr: db 'd' +ns db 48 +vc: db '/' +nd db 48 +ks: db '/' +fl: + rb 255 +playlist rb 255 +song_path rb 255 +folder_inf: + dd 7 + dd 0 + dd song_path + dd 0 + dd 0 + db 0 + dd player +file_info: + dd 0 + dd 0 + dd 0 + dd 0 + dd 0 + db 0 + dd floc +file_info2: + dd 0 + dd 0 + dd 0 + dd 0 + dd 0 + db 0 + dd 0 +string1 rb 255 + +I_END: + + + +temp dd ? +sc system_colors +pib process_information +memlist rb 65536