FASM - checking for "rolled up" window

git-svn-id: svn://kolibrios.org@2059 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2011-08-18 15:20:00 +00:00
parent 8e1566eec3
commit 9934173476
3 changed files with 433 additions and 450 deletions

View File

@ -1,8 +1,6 @@
@fasm.exe -m 16384 ..\..\..\develop\libraries\box_lib\trunk\box_lib.asm box_lib.obj
@kpack box_lib.obj
@erase lang.inc @erase lang.inc
@echo lang fix en >lang.inc @echo lang fix en >lang.inc
@fasm fasm.asm fasm @fasm -m 16384 fasm.asm fasm
@erase lang.inc @erase lang.inc
@kpack fasm @kpack fasm
@pause @pause

View File

@ -1,8 +1,6 @@
@fasm.exe -m 16384 ..\..\..\develop\libraries\box_lib\trunk\box_lib.asm box_lib.obj
@kpack box_lib.obj
@erase lang.inc @erase lang.inc
@echo lang fix ru >lang.inc @echo lang fix ru >lang.inc
@fasm fasm.asm fasm @fasm -m 16384 fasm.asm fasm
@erase lang.inc @erase lang.inc
@kpack fasm @kpack fasm
@pause @pause

View File

@ -4,6 +4,7 @@
;; Copyright (c) 1999-2006, Tomasz Grysztar ;; ;; Copyright (c) 1999-2006, Tomasz Grysztar ;;
;; All rights reserved. ;; ;; All rights reserved. ;;
;; ;; ;; ;;
;; KolibriOS port by KolibriOS Team ;;
;; Menuet port by VT ;; ;; Menuet port by VT ;;
;; ;; ;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -19,9 +20,8 @@ APP_MEMORY = 0x00800000
;; Menuet header ;; Menuet header
appname equ "flat assembler " appname equ "flat assembler "
;---------------------------------------------------------------------
use32 use32
org 0x0 org 0x0
db 'MENUET01' ; 8 byte id db 'MENUET01' ; 8 byte id
dd 0x01 ; header version dd 0x01 ; header version
@ -30,7 +30,7 @@ use32
dd stacktop ; required amount of memory dd stacktop ; required amount of memory
dd stacktop ; stack dd stacktop ; stack
dd params,cur_dir_path ; parameters,icon dd params,cur_dir_path ; parameters,icon
;---------------------------------------------------------------------
include 'lang.inc' include 'lang.inc'
include '../../../macros.inc' include '../../../macros.inc'
purge add,sub ; macros.inc does incorrect substitution purge add,sub ; macros.inc does incorrect substitution
@ -40,10 +40,8 @@ include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
include '../../../develop/libraries/box_lib/load_lib.mac' include '../../../develop/libraries/box_lib/load_lib.mac'
@use_library @use_library
center fix true center fix true
;---------------------------------------------------------------------
START: ; Start of execution START: ; Start of execution
mov edi, fileinfos mov edi, fileinfos
mov ecx, (fileinfos_end-fileinfos)/4 mov ecx, (fileinfos_end-fileinfos)/4
@ -90,10 +88,9 @@ START: ; Start of execution
jne @f jne @f
mov [_run_outfile],1 mov [_run_outfile],1
@@: @@:
mov [_mode],CONSOLE_MODE mov [_mode],CONSOLE_MODE
jmp start jmp start
;---------------------------------------------------------------------
start_1: start_1:
;sys_ ;sys_
load_libraries l_libs_start,load_lib_end load_libraries l_libs_start,load_lib_end
@ -103,15 +100,15 @@ load_libraries l_libs_start,load_lib_end
mcall -1 ;exit if not open box_lib.obj mcall -1 ;exit if not open box_lib.obj
@@: @@:
mcall 40,0x27 ;¬ áª  á¨á⥬­ëå ᮡë⨩ mcall 40,0x27 ;¬ áª  á¨á⥬­ëå ᮡë⨩
;---------------------------------------------------------------------
get_sys_colors 1,0 get_sys_colors 1,0
edit_boxes_set_sys_color edit1,editboxes_end,sc edit_boxes_set_sys_color edit1,editboxes_end,sc
check_boxes_set_sys_color ch1_dbg,ch1_dbg+ch_struc_size,sc check_boxes_set_sys_color ch1_dbg,ch1_dbg+ch_struc_size,sc
;---------------------------------------------------------------------
; OpenDialog initialisation ; OpenDialog initialisation
push dword OpenDialog_data push dword OpenDialog_data
call dword [OpenDialog_Init] call dword [OpenDialog_Init]
;---------------------------------------------------------------------
red: ; Redraw red: ; Redraw
call draw_window call draw_window
@ -125,7 +122,6 @@ still:
je red ; Redraw request je red ; Redraw request
dec eax dec eax
jne button ; Button in buffer jne button ; Button in buffer
key: ; Key key: ; Key
mov al,2 ; Read it and ignore mov al,2 ; Read it and ignore
mcall mcall
@ -136,15 +132,13 @@ key: ; Key
call [edit_box_key] call [edit_box_key]
push dword edit3 push dword edit3
call [edit_box_key] call [edit_box_key]
jmp still jmp still
;---------------------------------------------------------------------
call_mouse: call_mouse:
call mouse call mouse
jmp still jmp still
;---------------------------------------------------------------------
button: ; Button in Window button: ; Button in Window
mov al,17 mov al,17
mcall mcall
@ -152,7 +146,7 @@ button: ; Button in Window
jne noclose jne noclose
or eax,-1 or eax,-1
mcall mcall
;---------------------------------------------------------------------
noclose: noclose:
cmp ah,5 ;press button for OpenDialog cmp ah,5 ;press button for OpenDialog
jne @f jne @f
@ -168,6 +162,7 @@ noclose:
mcall 70,file_info_start mcall 70,file_info_start
; xor ecx,ecx ; xor ecx,ecx
jmp still jmp still
;---------------------------------------------------------------------
norunout: norunout:
cmp ah,4 cmp ah,4
jnz norundebug jnz norundebug
@ -176,12 +171,10 @@ noclose:
call make_fullpaths call make_fullpaths
mcall 70,file_info_debug mcall 70,file_info_debug
jmp still jmp still
;---------------------------------------------------------------------
norundebug: norundebug:
jmp still jmp still
;---------------------------------------------------------------------
mouse: mouse:
push dword edit1 push dword edit1
call [edit_box_mouse] call [edit_box_mouse]
@ -192,14 +185,11 @@ mouse:
push dword ch1_dbg push dword ch1_dbg
call [check_box_mouse] call [check_box_mouse]
ret ret
;---------------------------------------------------------------------
draw_window: draw_window:
pusha pusha
mcall 12,1 ; Start of draw mcall 12,1 ; Start of draw
;get_sys_colors 1,0 ;get_sys_colors 1,0
xor eax,eax xor eax,eax
mov ebx,100*65536+280 mov ebx,100*65536+280
mov ecx,90*65536+260 mov ecx,90*65536+260
@ -210,15 +200,17 @@ draw_window:
mcall 9,PROCESSINFO,-1 mcall 9,PROCESSINFO,-1
mov eax,[PROCESSINFO+70] ;status of window
test eax,100b
jne .end
cmp dword[pinfo.box.width],230 ; ïðîâåðÿåì øèðèíó îêíà cmp dword[pinfo.box.width],230 ; ïðîâåðÿåì øèðèíó îêíà
jge @f jge @f
mov dword[pinfo.box.width],230 ; åñëè îêíî î÷åíü óçêîå, óâåëè÷èâàåì øèðèíó äëÿ èçáåæàíèÿ ãëþêîâ mov dword[pinfo.box.width],230 ; åñëè îêíî î÷åíü óçêîå, óâåëè÷èâàåì øèðèíó äëÿ èçáåæàíèÿ ãëþêîâ
@@: @@:
mpack ecx,1,1 mpack ecx,1,1
mov ebx,[pinfo.box.width] mov ebx,[pinfo.box.width]
sub ebx,10 sub ebx,10
mov eax,8 mov eax,8
mov edx,0x4000000B mov edx,0x4000000B
mpack ebx,[pinfo.box.width],MAGIC1 mpack ebx,[pinfo.box.width],MAGIC1
@ -230,7 +222,6 @@ draw_window:
mcall ,,,0x00000003 mcall ,,,0x00000003
madd ecx, (14*3+16)/3+1,0 madd ecx, (14*3+16)/3+1,0
mcall ,,,4 mcall ,,,4
;button for OpenDialog [..] ;button for OpenDialog [..]
mov ebx, 5*65536+47 mov ebx, 5*65536+47
mov ecx, 33*65536+14 mov ecx, 33*65536+14
@ -242,11 +233,12 @@ draw_window:
mov edx,text mov edx,text
mov esi,text.line_size mov esi,text.line_size
mov eax,4 mov eax,4
mcall ;InFile mcall ;InFile
add ebx, 16 ;14 add ebx, 16 ;14
add edx,text.line_size add edx,text.line_size
mcall ;OutFile mcall ;OutFile
mov ecx,[sc.work_button_text] mov ecx,[sc.work_button_text]
add ebx, 16 ;14 add ebx, 16 ;14
add edx,text.line_size add edx,text.line_size
@ -272,7 +264,8 @@ draw_window:
cmp al,MAX_PATH cmp al,MAX_PATH
jbe @f jbe @f
mov al,MAX_PATH mov al,MAX_PATH
@@: movzx esi,al @@:
movzx esi,al
call draw_messages call draw_messages
@ -290,12 +283,11 @@ draw_window:
call [edit_box_draw] call [edit_box_draw]
push dword ch1_dbg push dword ch1_dbg
call [check_box_draw] call [check_box_draw]
.end:
mcall 12,2 ; End of Draw mcall 12,2 ; End of Draw
popa popa
ret ret
;---------------------------------------------------------------------
bottom_right dd ? bottom_right dd ?
align 4 align 4
@ -313,11 +305,11 @@ fun_opn_dlg: ;
jne @f jne @f
mov byte[edi-2],0 ;¥á«¨ ¢ ª®­æ¥ ¯ã⨠¥áâì á«¥è, â® ¯ãâì 㪮à ç¨¢ ¥¬ ­  1 ᨬ¢®« mov byte[edi-2],0 ;¥á«¨ ¢ ª®­æ¥ ¯ã⨠¥áâì á«¥è, â® ¯ãâì 㪮à ç¨¢ ¥¬ ­  1 ᨬ¢®«
@@: @@:
push dword OpenDialog_data push dword OpenDialog_data
call dword [OpenDialog_Start] call dword [OpenDialog_Start]
cmp [OpenDialog_data.status],2 cmp [OpenDialog_data.status],2
je @f je @f
xor al,al xor al,al
mov edi,dword[edit3.text] mov edi,dword[edit3.text]
mov ebx,edi ;copy text pointer mov ebx,edi ;copy text pointer
@ -326,6 +318,7 @@ fun_opn_dlg: ;
repne scasb repne scasb
cmp byte[edi-2],'/' cmp byte[edi-2],'/'
jne .no_slash jne .no_slash
dec edi ;¥á«¨ ¢ ª®­æ¥ ¯ã⨠¥áâì á«¥è, â® ¯ãâì 㪮à ç¨¢ ¥¬ ­  1 ᨬ¢®« dec edi ;¥á«¨ ¢ ª®­æ¥ ¯ã⨠¥áâì á«¥è, â® ¯ãâì 㪮à ç¨¢ ¥¬ ­  1 ᨬ¢®«
.no_slash: .no_slash:
mov byte[edi-1],'/' ;áâ ¢¨¬ ¢ ª®­æ¥ ¯ã⨠᫥è mov byte[edi-1],'/' ;áâ ¢¨¬ ¢ ª®­æ¥ ¯ã⨠᫥è
@ -349,14 +342,16 @@ fun_opn_dlg: ;
lodsb lodsb
test eax,eax test eax,eax
jnz .cycle jnz .cycle
sub esi,4 sub esi,4
cmp esi,[edit2.text] cmp esi,[edit2.text]
jle .short_fn jle .short_fn
mov byte[esi],0 mov byte[esi],0
sub dword [edit2.size],4 sub dword [edit2.size],4
sub dword [edit2.pos],4 sub dword [edit2.pos],4
.short_fn:
.short_fn:
push dword edit1 push dword edit1
call dword [edit_box_draw] call dword [edit_box_draw]
push dword edit2 push dword edit2
@ -366,7 +361,7 @@ fun_opn_dlg: ;
@@: @@:
popad popad
ret ret
;---------------------------------------------------------------------
draw_messages: draw_messages:
mov eax,13 ; clear work area mov eax,13 ; clear work area
mpack ebx,7-2,[pinfo.box.width] mpack ebx,7-2,[pinfo.box.width]
@ -409,10 +404,9 @@ _sx = 6
mcall mcall
pop ecx ebx pop ecx ebx
ret ret
;---------------------------------------------------------------------
; DATA ; DATA
;---------------------------------------------------------------------
if lang eq ru if lang eq ru
text: text:
db ' ‚å” ©«:' db ' ‚å” ©«:'
@ -461,8 +455,7 @@ end if
system_dir1 db '/sys/lib/' system_dir1 db '/sys/lib/'
lib1_name db 'proc_lib.obj',0 lib1_name db 'proc_lib.obj',0
;---------------------------------------------------------------------
align 4 align 4
import_box_lib: import_box_lib:
edit_box_draw dd aEdit_box_draw edit_box_draw dd aEdit_box_draw
@ -486,7 +479,7 @@ import_box_lib:
aCheck_box_draw db 'check_box_draw',0 aCheck_box_draw db 'check_box_draw',0
aCheck_box_mouse db 'check_box_mouse',0 aCheck_box_mouse db 'check_box_mouse',0
;aVersion_ch db 'version_ch',0 ;aVersion_ch db 'version_ch',0
;---------------------------------------------------------------------
align 4 align 4
import_proc_lib: import_proc_lib:
OpenDialog_Init dd aOpenDialog_Init OpenDialog_Init dd aOpenDialog_Init
@ -494,7 +487,7 @@ import_proc_lib:
dd 0,0 dd 0,0
aOpenDialog_Init db 'OpenDialog_init',0 aOpenDialog_Init db 'OpenDialog_init',0
aOpenDialog_Start db 'OpenDialog_start',0 aOpenDialog_Start db 'OpenDialog_start',0
;---------------------------------------------------------------------
;library structures ;library structures
l_libs_start: l_libs_start:
lib0 l_libs lib0_name, cur_dir_path, library_path, system_dir0, err_message_found_lib0, head_f_l, import_box_lib, err_message_import0, head_f_i lib0 l_libs lib0_name, cur_dir_path, library_path, system_dir0, err_message_found_lib0, head_f_l, import_box_lib, err_message_import0, head_f_i
@ -506,7 +499,6 @@ edit2 edit_box 153, 56, 17, 0xffffff, 0xff, 0x80ff, 0, 0x8000,(path-outfile-1),
edit3 edit_box 153, 56, 33, 0xffffff, 0xff, 0x80ff, 0, 0x8000,(path_end-path-1), path, mouse_dd, 0, 6,6 edit3 edit_box 153, 56, 33, 0xffffff, 0xff, 0x80ff, 0, 0x8000,(path_end-path-1), path, mouse_dd, 0, 6,6
editboxes_end: editboxes_end:
ch1_dbg check_box 5, 49, 6, 12, 0xffffff, 0x80ff, 0, s_dbgdescr,(s_dbgdescr_end-s_dbgdescr) ch1_dbg check_box 5, 49, 6, 12, 0xffffff, 0x80ff, 0, s_dbgdescr,(s_dbgdescr_end-s_dbgdescr)
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
align 4 align 4
OpenDialog_data: OpenDialog_data:
@ -544,9 +536,9 @@ dd Filter.end - Filter
db 'ASM',0 db 'ASM',0
.end: .end:
db 0 db 0
;---------------------------------------------------------------------
mouse_dd dd 0 ;íóæíî äëÿ Shift-à â editbox mouse_dd dd 0 ;íóæíî äëÿ Shift-à â editbox
;---------------------------------------------------------------------
infile db 'example.asm' infile db 'example.asm'
times MAX_PATH-$+infile db 0 times MAX_PATH-$+infile db 0
outfile db 'example' outfile db 'example'
@ -555,8 +547,7 @@ path db '/rd/1//' ;OpenDialog
times MAX_PATH-$+path db 0 times MAX_PATH-$+path db 0
path_end: path_end:
lf db 13,10,0 lf db 13,10,0
;---------------------------------------------------------------------
mov_param_str: mov_param_str:
cld cld
@@: @@:
@ -570,9 +561,7 @@ mov_param_str:
xor al,al xor al,al
stosb stosb
ret ret
;---------------------------------------------------------------------
start: start:
cmp [_mode],NORMAL_MODE cmp [_mode],NORMAL_MODE
jne @f jne @f
@ -582,10 +571,9 @@ start:
mov esi,_logo mov esi,_logo
call display_string call display_string
; ;---------------------------------------------------------------------
; Fasm native code ; Fasm native code
; ;---------------------------------------------------------------------
mov [input_file],infile mov [input_file],infile
mov [output_file],outfile mov [output_file],outfile
@ -644,8 +632,7 @@ start:
mcall mcall
@@: @@:
jmp exit_program jmp exit_program
;---------------------------------------------------------------------
include 'system.inc' include 'system.inc'
include 'version.inc' include 'version.inc'
include 'errors.inc' include 'errors.inc'
@ -658,7 +645,7 @@ include 'x86_64.inc'
include 'tables.inc' include 'tables.inc'
include 'symbdump.inc' include 'symbdump.inc'
include 'messages.inc' include 'messages.inc'
;---------------------------------------------------------------------
title db appname,VERSION_STRING,0 title db appname,VERSION_STRING,0
_logo db 'flat assembler version ',VERSION_STRING,13,10,0 _logo db 'flat assembler version ',VERSION_STRING,13,10,0