Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2059 → Rev 2058

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