2006-01-03 10:43:31 +01:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;; flat assembler source ;;
|
2006-07-28 15:39:16 +02:00
|
|
|
|
;; Copyright (c) 1999-2006, Tomasz Grysztar ;;
|
2006-01-03 10:43:31 +01:00
|
|
|
|
;; All rights reserved. ;;
|
|
|
|
|
;; ;;
|
2011-08-18 17:20:00 +02:00
|
|
|
|
;; KolibriOS port by KolibriOS Team ;;
|
2006-01-03 10:43:31 +01:00
|
|
|
|
;; Menuet port by VT ;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
NORMAL_MODE = 8
|
|
|
|
|
CONSOLE_MODE = 32
|
|
|
|
|
|
2010-01-04 18:51:09 +01:00
|
|
|
|
MAGIC1 = 6*(text.line_size-1)+14
|
2006-10-11 00:15:57 +02:00
|
|
|
|
MAX_PATH = 100
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2006-10-11 00:15:57 +02:00
|
|
|
|
APP_MEMORY = 0x00800000
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
;; Menuet header
|
|
|
|
|
|
2006-11-02 15:18:23 +01:00
|
|
|
|
appname equ "flat assembler "
|
2011-08-18 17:20:00 +02:00
|
|
|
|
;---------------------------------------------------------------------
|
|
|
|
|
use32
|
|
|
|
|
org 0x0
|
|
|
|
|
db 'MENUET01' ; 8 byte id
|
|
|
|
|
dd 0x01 ; header version
|
|
|
|
|
dd START ; program start
|
|
|
|
|
dd program_end ; program image size
|
|
|
|
|
dd stacktop ; required amount of memory
|
|
|
|
|
dd stacktop ; stack
|
|
|
|
|
dd params,cur_dir_path ; parameters,icon
|
|
|
|
|
;---------------------------------------------------------------------
|
2006-01-03 10:43:31 +01:00
|
|
|
|
include 'lang.inc'
|
2010-03-26 23:19:27 +01:00
|
|
|
|
include '../../../macros.inc'
|
2010-01-04 18:51:09 +01:00
|
|
|
|
purge add,sub ; macros.inc does incorrect substitution
|
2006-01-03 10:43:31 +01:00
|
|
|
|
include 'fasm.inc'
|
|
|
|
|
|
2010-03-26 23:19:27 +01:00
|
|
|
|
include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
|
|
|
|
|
include '../../../develop/libraries/box_lib/load_lib.mac'
|
2010-01-04 18:51:09 +01:00
|
|
|
|
@use_library
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
center fix true
|
2011-08-18 17:20:00 +02:00
|
|
|
|
;---------------------------------------------------------------------
|
2006-07-28 15:39:16 +02:00
|
|
|
|
START: ; Start of execution
|
2010-01-04 18:51:09 +01:00
|
|
|
|
mov edi, fileinfos
|
|
|
|
|
mov ecx, (fileinfos_end-fileinfos)/4
|
|
|
|
|
or eax, -1
|
|
|
|
|
rep stosd
|
|
|
|
|
push 68
|
|
|
|
|
pop eax
|
|
|
|
|
push 11
|
|
|
|
|
pop ebx
|
|
|
|
|
mcall
|
|
|
|
|
|
2011-08-18 17:20:00 +02:00
|
|
|
|
cmp [params],0
|
|
|
|
|
jz start_1
|
|
|
|
|
|
|
|
|
|
mov ecx,10
|
|
|
|
|
mov eax,' '
|
|
|
|
|
mov edi,infile
|
|
|
|
|
push ecx
|
|
|
|
|
cld
|
|
|
|
|
rep stosd
|
|
|
|
|
mov ecx,[esp]
|
|
|
|
|
mov edi,outfile
|
|
|
|
|
rep stosd
|
|
|
|
|
pop ecx
|
|
|
|
|
mov edi,path
|
|
|
|
|
rep stosd
|
|
|
|
|
|
|
|
|
|
mov esi,params
|
|
|
|
|
; DEBUGF "params: %s\n",esi
|
|
|
|
|
mov edi,infile
|
|
|
|
|
call mov_param_str
|
|
|
|
|
; mov edi,infile
|
|
|
|
|
; DEBUGF " input: %s\n",edi
|
|
|
|
|
mov edi,outfile
|
|
|
|
|
call mov_param_str
|
|
|
|
|
; mov edi,outfile
|
|
|
|
|
; DEBUGF "output: %s\n",edi
|
|
|
|
|
mov edi,path
|
|
|
|
|
call mov_param_str
|
|
|
|
|
; mov edi,path
|
|
|
|
|
; DEBUGF " path: %s\n",edi
|
|
|
|
|
dec esi
|
|
|
|
|
cmp [esi], dword ',run'
|
|
|
|
|
jne @f
|
|
|
|
|
mov [_run_outfile],1
|
|
|
|
|
@@:
|
|
|
|
|
mov [_mode],CONSOLE_MODE
|
|
|
|
|
jmp start
|
|
|
|
|
;---------------------------------------------------------------------
|
2010-02-07 23:24:35 +01:00
|
|
|
|
start_1:
|
2010-09-13 23:33:33 +02:00
|
|
|
|
;sys_
|
|
|
|
|
load_libraries l_libs_start,load_lib_end
|
2010-02-07 23:24:35 +01:00
|
|
|
|
|
2011-08-18 17:20:00 +02:00
|
|
|
|
cmp eax,-1
|
|
|
|
|
jne @f
|
|
|
|
|
mcall -1 ;exit if not open box_lib.obj
|
|
|
|
|
@@:
|
|
|
|
|
mcall 40,0x27 ;<3B><>᪠ <20><><EFBFBD>⥬<EFBFBD><E2A5AC><EFBFBD> ᮡ<>⨩
|
|
|
|
|
;---------------------------------------------------------------------
|
|
|
|
|
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]
|
|
|
|
|
;---------------------------------------------------------------------
|
2006-07-28 15:39:16 +02:00
|
|
|
|
red: ; Redraw
|
2011-08-18 17:20:00 +02:00
|
|
|
|
call draw_window
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2010-01-04 18:51:09 +01:00
|
|
|
|
still:
|
2011-08-23 12:56:32 +02:00
|
|
|
|
mcall 10 ; Wait here for event
|
2011-08-18 17:20:00 +02:00
|
|
|
|
cmp al,6
|
|
|
|
|
je call_mouse
|
|
|
|
|
dec eax
|
|
|
|
|
je red ; Redraw request
|
|
|
|
|
dec eax
|
|
|
|
|
jne button ; Button in buffer
|
2010-01-04 18:51:09 +01:00
|
|
|
|
key: ; Key
|
2011-08-23 12:56:32 +02:00
|
|
|
|
mcall 2 ; Read it and ignore
|
2011-08-18 17:20:00 +02:00
|
|
|
|
|
|
|
|
|
push dword edit1
|
|
|
|
|
call [edit_box_key]
|
|
|
|
|
push dword edit2
|
|
|
|
|
call [edit_box_key]
|
|
|
|
|
push dword edit3
|
|
|
|
|
call [edit_box_key]
|
|
|
|
|
jmp still
|
|
|
|
|
;---------------------------------------------------------------------
|
2010-03-26 23:19:27 +01:00
|
|
|
|
call_mouse:
|
2011-08-18 17:20:00 +02:00
|
|
|
|
call mouse
|
|
|
|
|
jmp still
|
|
|
|
|
;---------------------------------------------------------------------
|
2006-01-03 10:43:31 +01:00
|
|
|
|
button: ; Button in Window
|
2011-08-23 12:56:32 +02:00
|
|
|
|
mcall 17
|
2011-08-18 17:20:00 +02:00
|
|
|
|
cmp ah,1
|
|
|
|
|
jne noclose
|
|
|
|
|
or eax,-1
|
|
|
|
|
mcall
|
|
|
|
|
;---------------------------------------------------------------------
|
2006-10-11 00:15:57 +02:00
|
|
|
|
noclose:
|
2011-08-18 17:20:00 +02:00
|
|
|
|
cmp ah,5 ;press button for OpenDialog
|
|
|
|
|
jne @f
|
|
|
|
|
call fun_opn_dlg
|
|
|
|
|
@@:
|
|
|
|
|
cmp ah,2 ; Start compiling
|
|
|
|
|
je start
|
|
|
|
|
cmp ah,3 ; Start compiled file
|
|
|
|
|
jnz norunout
|
|
|
|
|
|
|
|
|
|
mov edx,outfile
|
|
|
|
|
call make_fullpaths
|
|
|
|
|
mcall 70,file_info_start
|
|
|
|
|
; xor ecx,ecx
|
|
|
|
|
jmp still
|
|
|
|
|
;---------------------------------------------------------------------
|
|
|
|
|
norunout:
|
|
|
|
|
cmp ah,4
|
|
|
|
|
jnz norundebug
|
|
|
|
|
|
|
|
|
|
mov edx,outfile
|
|
|
|
|
call make_fullpaths
|
|
|
|
|
mcall 70,file_info_debug
|
|
|
|
|
jmp still
|
|
|
|
|
;---------------------------------------------------------------------
|
|
|
|
|
norundebug:
|
|
|
|
|
jmp still
|
|
|
|
|
;---------------------------------------------------------------------
|
2010-01-04 18:51:09 +01:00
|
|
|
|
mouse:
|
2011-08-18 17:20:00 +02:00
|
|
|
|
push dword edit1
|
|
|
|
|
call [edit_box_mouse]
|
|
|
|
|
push dword edit2
|
|
|
|
|
call [edit_box_mouse]
|
|
|
|
|
push dword edit3
|
|
|
|
|
call [edit_box_mouse]
|
|
|
|
|
push dword ch1_dbg
|
|
|
|
|
call [check_box_mouse]
|
|
|
|
|
ret
|
|
|
|
|
;---------------------------------------------------------------------
|
2006-01-03 10:43:31 +01:00
|
|
|
|
draw_window:
|
2011-08-18 17:20:00 +02:00
|
|
|
|
pusha
|
|
|
|
|
mcall 12,1 ; Start of draw
|
|
|
|
|
;get_sys_colors 1,0
|
2011-08-23 12:56:32 +02:00
|
|
|
|
|
2011-08-18 17:20:00 +02:00
|
|
|
|
mov edx,[sc.work]
|
|
|
|
|
or edx,0x33000000
|
2011-08-23 12:56:32 +02:00
|
|
|
|
xor eax,eax
|
|
|
|
|
xor esi,esi
|
|
|
|
|
mcall ,<100,280>,<90,260>,,,title ; Draw Window Label Text
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2011-08-18 17:20:00 +02:00
|
|
|
|
mcall 9,PROCESSINFO,-1
|
|
|
|
|
|
|
|
|
|
mov eax,[PROCESSINFO+70] ;status of window
|
|
|
|
|
test eax,100b
|
|
|
|
|
jne .end
|
|
|
|
|
|
|
|
|
|
cmp dword[pinfo.box.width],230 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
jge @f
|
|
|
|
|
mov dword[pinfo.box.width],230 ; <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
@@:
|
|
|
|
|
mpack ecx,1,1
|
|
|
|
|
mov ebx,[pinfo.box.width]
|
|
|
|
|
sub ebx,10
|
|
|
|
|
mov eax,8
|
|
|
|
|
mov edx,0x4000000B
|
|
|
|
|
mpack ebx,[pinfo.box.width],MAGIC1
|
|
|
|
|
msub ebx,MAGIC1+10+1,0
|
|
|
|
|
mpack ecx,0, (14*3+16)/3-1
|
|
|
|
|
madd ecx,1,0
|
|
|
|
|
mcall ,,,0x00000002,[sc.work_button]
|
|
|
|
|
madd ecx, (14*3+16)/3+1,0
|
|
|
|
|
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
|
|
|
|
|
mcall ,,,5
|
|
|
|
|
|
|
|
|
|
mpack ebx,6,0 ; Draw Window Text
|
|
|
|
|
add ebx,1+ 14/2-3
|
2011-08-23 12:56:32 +02:00
|
|
|
|
mcall 4,,[sc.work_text],text,text.line_size ;InFile
|
2011-08-18 17:20:00 +02:00
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
mcall ;Path
|
|
|
|
|
|
|
|
|
|
mov ebx,[pinfo.box.width]
|
|
|
|
|
sub ebx,MAGIC1+10+1-9
|
|
|
|
|
shl ebx,16
|
|
|
|
|
add ebx,1+( (14*3+16)/3-1)/2-3
|
|
|
|
|
mcall ,,[sc.work_button_text],s_compile,7
|
|
|
|
|
add ebx,(14*3+16)/3+1
|
|
|
|
|
mcall ,,,s_run
|
|
|
|
|
add ebx,(14*3+16)/3+1
|
|
|
|
|
mcall ,,,s_debug
|
|
|
|
|
|
|
|
|
|
mpack ebx,MAGIC1+6,0
|
|
|
|
|
add ebx,1+ 14/2-3+ 14*0
|
|
|
|
|
mov esi,[pinfo.box.width]
|
|
|
|
|
sub esi,MAGIC1*2+5*2+6+3
|
|
|
|
|
mov eax,esi
|
|
|
|
|
mov cl,6
|
|
|
|
|
div cl
|
|
|
|
|
cmp al,MAX_PATH
|
|
|
|
|
jbe @f
|
|
|
|
|
mov al,MAX_PATH
|
|
|
|
|
@@:
|
|
|
|
|
movzx esi,al
|
|
|
|
|
|
|
|
|
|
call draw_messages
|
|
|
|
|
|
2011-08-21 20:38:08 +02:00
|
|
|
|
mov eax,dword [pinfo.box.width]
|
2011-08-18 17:20:00 +02:00
|
|
|
|
sub eax,127
|
|
|
|
|
mov dword[edit1.width],eax ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov dword[edit2.width],eax
|
|
|
|
|
mov dword[edit3.width],eax
|
|
|
|
|
|
|
|
|
|
push dword edit1
|
|
|
|
|
call [edit_box_draw]
|
|
|
|
|
push dword edit2
|
|
|
|
|
call [edit_box_draw]
|
|
|
|
|
push dword edit3
|
|
|
|
|
call [edit_box_draw]
|
|
|
|
|
push dword ch1_dbg
|
|
|
|
|
call [check_box_draw]
|
|
|
|
|
.end:
|
|
|
|
|
mcall 12,2 ; End of Draw
|
|
|
|
|
popa
|
|
|
|
|
ret
|
|
|
|
|
;---------------------------------------------------------------------
|
2006-01-03 10:43:31 +01:00
|
|
|
|
bottom_right dd ?
|
|
|
|
|
|
2010-09-13 23:33:33 +02:00
|
|
|
|
align 4
|
|
|
|
|
fun_opn_dlg: ;<3B>㭪<EFBFBD><E3ADAA><EFBFBD> <20><><EFBFBD> <20>맮<EFBFBD><EBA7AE> OpenFile <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
pushad
|
|
|
|
|
copy_path open_dialog_name,communication_area_default_path,library_path,0
|
2011-08-18 17:20:00 +02:00
|
|
|
|
mov [OpenDialog_data.type],0
|
2010-09-13 23:33:33 +02:00
|
|
|
|
|
2011-08-18 17:20:00 +02:00
|
|
|
|
xor al,al
|
2011-08-21 20:38:08 +02:00
|
|
|
|
mov edi,dword [edit3.text]
|
|
|
|
|
mov ecx,dword [edit3.max]
|
2010-09-13 23:33:33 +02:00
|
|
|
|
cld
|
2011-08-18 17:20:00 +02:00
|
|
|
|
repne scasb
|
|
|
|
|
cmp byte[edi-2],'/'
|
|
|
|
|
jne @f
|
|
|
|
|
mov byte[edi-2],0 ;<3B> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <>, <20><> <20><><EFBFBD><EFBFBD> 㪮<><E3AAAE>稢<EFBFBD><E7A8A2><EFBFBD> <20><> 1 ᨬ<><E1A8AC><EFBFBD>
|
|
|
|
|
@@:
|
|
|
|
|
push dword OpenDialog_data
|
|
|
|
|
call dword [OpenDialog_Start]
|
|
|
|
|
cmp [OpenDialog_data.status],2
|
|
|
|
|
je @f
|
|
|
|
|
|
|
|
|
|
xor al,al
|
2011-08-21 20:38:08 +02:00
|
|
|
|
mov edi,dword [edit3.text]
|
2011-08-18 17:20:00 +02:00
|
|
|
|
mov ebx,edi ;copy text pointer
|
2011-08-21 20:38:08 +02:00
|
|
|
|
mov ecx,dword [edit3.max]
|
2011-08-18 17:20:00 +02:00
|
|
|
|
cld
|
|
|
|
|
repne scasb
|
|
|
|
|
cmp byte[edi-2],'/'
|
|
|
|
|
jne .no_slash
|
|
|
|
|
|
|
|
|
|
dec edi ;<3B> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <>, <20><> <20><><EFBFBD><EFBFBD> 㪮<><E3AAAE>稢<EFBFBD><E7A8A2><EFBFBD> <20><> 1 ᨬ<><E1A8AC><EFBFBD>
|
|
|
|
|
.no_slash:
|
|
|
|
|
mov byte[edi-1],'/' ;<3B>⠢<EFBFBD><E2A0A2> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <>
|
|
|
|
|
mov byte[edi],0 ;<3B><>१<EFBFBD><E0A5A7><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 䠩<><E4A0A9>
|
|
|
|
|
sub edi,ebx ;edi = strlen(edit3.text)
|
|
|
|
|
mov [edit3.size],edi
|
|
|
|
|
mov [edit3.pos],edi
|
|
|
|
|
|
|
|
|
|
push dword [OpenDialog_data.filename_area]
|
|
|
|
|
push dword edit1
|
|
|
|
|
call dword [edit_box_set_text]
|
|
|
|
|
|
|
|
|
|
push dword [OpenDialog_data.filename_area]
|
|
|
|
|
push dword edit2
|
|
|
|
|
call dword [edit_box_set_text]
|
|
|
|
|
|
|
|
|
|
mov esi,[edit2.text]
|
|
|
|
|
xor eax,eax
|
|
|
|
|
cld
|
|
|
|
|
.cycle:
|
|
|
|
|
lodsb
|
|
|
|
|
test eax,eax
|
|
|
|
|
jnz .cycle
|
|
|
|
|
|
2011-08-21 20:38:08 +02:00
|
|
|
|
sub esi,5
|
2011-08-18 17:20:00 +02:00
|
|
|
|
cmp esi,[edit2.text]
|
|
|
|
|
jle .short_fn
|
|
|
|
|
|
|
|
|
|
mov byte[esi],0
|
|
|
|
|
sub dword [edit2.size],4
|
|
|
|
|
sub dword [edit2.pos],4
|
|
|
|
|
|
|
|
|
|
.short_fn:
|
|
|
|
|
push dword edit1
|
|
|
|
|
call dword [edit_box_draw]
|
|
|
|
|
push dword edit2
|
|
|
|
|
call dword [edit_box_draw]
|
|
|
|
|
push dword edit3
|
|
|
|
|
call dword [edit_box_draw]
|
|
|
|
|
@@:
|
2010-09-13 23:33:33 +02:00
|
|
|
|
popad
|
|
|
|
|
ret
|
2011-08-18 17:20:00 +02:00
|
|
|
|
;---------------------------------------------------------------------
|
2006-01-03 10:43:31 +01:00
|
|
|
|
draw_messages:
|
2011-08-18 17:20:00 +02:00
|
|
|
|
mpack ebx,7-2,[pinfo.box.width]
|
|
|
|
|
sub ebx,5*2+7*2-1-2*2
|
|
|
|
|
mpack ecx,0,[pinfo.box.height]
|
|
|
|
|
madd ecx, 14*3+16+1+7+1,-( 14*3+16+1+7*2+25)
|
|
|
|
|
mov word[bottom_right+2],bx
|
|
|
|
|
mov word[bottom_right],cx
|
|
|
|
|
msub [bottom_right],7,11
|
|
|
|
|
add [bottom_right],7 shl 16 + 53
|
2011-08-23 12:56:32 +02:00
|
|
|
|
mcall 13,,,[sc.work] ; clear work area
|
2006-01-03 10:43:31 +01:00
|
|
|
|
_cy = 0
|
|
|
|
|
_sy = 2
|
|
|
|
|
_cx = 4
|
|
|
|
|
_sx = 6
|
2011-08-18 17:20:00 +02:00
|
|
|
|
push ebx ecx
|
|
|
|
|
mpack ebx,4,5
|
|
|
|
|
add bx,[esp+_cx]
|
|
|
|
|
mov ecx,[esp+_sy-2]
|
|
|
|
|
mov cx,[esp+_sy]
|
|
|
|
|
msub ecx,1,1
|
|
|
|
|
mcall 38,,,[sc.work_graph]
|
|
|
|
|
mov si,[esp+_cy]
|
|
|
|
|
add cx,si
|
|
|
|
|
shl esi,16
|
|
|
|
|
add ecx,esi
|
|
|
|
|
madd ecx,1,1
|
|
|
|
|
mcall
|
|
|
|
|
mpack ebx,4,4
|
|
|
|
|
mov esi,[esp+_sy-2]
|
|
|
|
|
mov si,cx
|
|
|
|
|
mov ecx,esi
|
|
|
|
|
mcall
|
|
|
|
|
mov si,[esp+_cx]
|
|
|
|
|
add bx,si
|
|
|
|
|
shl esi,16
|
|
|
|
|
add ebx,esi
|
|
|
|
|
madd ebx,1,1
|
|
|
|
|
mcall
|
|
|
|
|
pop ecx ebx
|
|
|
|
|
ret
|
|
|
|
|
;---------------------------------------------------------------------
|
2010-01-04 18:51:09 +01:00
|
|
|
|
; DATA
|
2011-08-18 17:20:00 +02:00
|
|
|
|
;---------------------------------------------------------------------
|
2010-01-04 18:51:09 +01:00
|
|
|
|
if lang eq ru
|
|
|
|
|
text:
|
|
|
|
|
db ' <20>唠<EFBFBD><E594A0>:'
|
|
|
|
|
.line_size = $-text
|
|
|
|
|
db '<27><>唠<EFBFBD><E594A0>:'
|
|
|
|
|
db ' <20><><EFBFBD><EFBFBD>:'
|
2010-09-13 23:33:33 +02:00
|
|
|
|
;db 'x'
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2010-01-04 18:51:09 +01:00
|
|
|
|
s_compile db '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.'
|
|
|
|
|
s_run db ' <20><><EFBFBD><EFBFBD> '
|
|
|
|
|
s_debug db '<27>⫠<EFBFBD><E2ABA0><EFBFBD>'
|
2010-01-08 20:33:30 +01:00
|
|
|
|
s_dbgdescr db '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>⫠<EFBFBD><E2ABA0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ଠ<EFBFBD><E0ACA0><EFBFBD>',0
|
|
|
|
|
s_dbgdescr_end:
|
2010-01-04 18:51:09 +01:00
|
|
|
|
|
2010-09-13 23:33:33 +02:00
|
|
|
|
err_message_found_lib0 db '<27><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⥪<EFBFBD> box_lib.obj',0 ;<3B><>ப<EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>㤥<EFBFBD> <20> <20><><EFBFBD>ନ<E0ACA8><E0AEA2><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⥪<EFBFBD> <20><> <20>㤥<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
err_message_import0 db '<27>訡<EFBFBD><E8A8A1> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⥪<EFBFBD> box_lib.obj',0
|
|
|
|
|
err_message_found_lib1 db '<27><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⥪<EFBFBD> proc_lib.obj',0
|
|
|
|
|
err_message_import1 db '<27>訡<EFBFBD><E8A8A1> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⥪<EFBFBD> proc_lib.obj',0
|
|
|
|
|
head_f_i:
|
2010-01-04 18:51:09 +01:00
|
|
|
|
head_f_l db '<27><><EFBFBD>⥬<EFBFBD><E2A5AC><EFBFBD> <20>訡<EFBFBD><E8A8A1>',0 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>訡<EFBFBD><E8A8A1>
|
|
|
|
|
else
|
|
|
|
|
text:
|
2010-09-13 23:33:33 +02:00
|
|
|
|
db ' InFile:'
|
2010-01-04 18:51:09 +01:00
|
|
|
|
.line_size = $-text
|
2010-09-13 23:33:33 +02:00
|
|
|
|
db 'OutFile:'
|
|
|
|
|
db ' Path:'
|
|
|
|
|
;db 'x'
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2010-01-04 18:51:09 +01:00
|
|
|
|
s_compile db 'COMPILE'
|
|
|
|
|
s_run db ' RUN '
|
|
|
|
|
s_debug db ' DEBUG '
|
2010-01-08 20:33:30 +01:00
|
|
|
|
s_dbgdescr db 'Generate debug information',0
|
|
|
|
|
s_dbgdescr_end:
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2010-09-13 23:33:33 +02:00
|
|
|
|
err_message_found_lib0 db 'Sorry I cannot found library box_lib.obj',0
|
|
|
|
|
err_message_import0 db 'Error on load import library box_lib.obj',0
|
|
|
|
|
err_message_found_lib1 db 'Sorry I cannot found library proc_lib.obj',0
|
|
|
|
|
err_message_import1 db 'Error on load import library proc_lib.obj',0
|
|
|
|
|
|
|
|
|
|
head_f_i:
|
2010-01-04 18:51:09 +01:00
|
|
|
|
head_f_l db 'System error',0 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>訡<EFBFBD><E8A8A1>
|
|
|
|
|
end if
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2010-09-13 23:33:33 +02:00
|
|
|
|
system_dir0 db '/sys/lib/'
|
|
|
|
|
lib0_name db 'box_lib.obj',0
|
|
|
|
|
|
|
|
|
|
system_dir1 db '/sys/lib/'
|
|
|
|
|
lib1_name db 'proc_lib.obj',0
|
2011-08-18 17:20:00 +02:00
|
|
|
|
;---------------------------------------------------------------------
|
2010-09-13 23:33:33 +02:00
|
|
|
|
align 4
|
|
|
|
|
import_box_lib:
|
2011-08-18 17:20:00 +02:00
|
|
|
|
edit_box_draw dd aEdit_box_draw
|
|
|
|
|
edit_box_key dd aEdit_box_key
|
|
|
|
|
edit_box_mouse dd aEdit_box_mouse
|
|
|
|
|
edit_box_set_text dd aEdit_box_set_text
|
|
|
|
|
;version_ed dd aVersion_ed
|
|
|
|
|
|
|
|
|
|
check_box_draw dd aCheck_box_draw
|
|
|
|
|
check_box_mouse dd aCheck_box_mouse
|
|
|
|
|
;version_ch dd aVersion_ch
|
|
|
|
|
|
|
|
|
|
dd 0,0
|
|
|
|
|
|
|
|
|
|
aEdit_box_draw db 'edit_box',0
|
|
|
|
|
aEdit_box_key db 'edit_box_key',0
|
|
|
|
|
aEdit_box_mouse db 'edit_box_mouse',0
|
|
|
|
|
aEdit_box_set_text db 'edit_box_set_text',0
|
|
|
|
|
;aVersion_ed db 'version_ed',0
|
|
|
|
|
|
|
|
|
|
aCheck_box_draw db 'check_box_draw',0
|
|
|
|
|
aCheck_box_mouse db 'check_box_mouse',0
|
|
|
|
|
;aVersion_ch db 'version_ch',0
|
|
|
|
|
;---------------------------------------------------------------------
|
2010-09-13 23:33:33 +02:00
|
|
|
|
align 4
|
|
|
|
|
import_proc_lib:
|
2011-08-18 17:20:00 +02:00
|
|
|
|
OpenDialog_Init dd aOpenDialog_Init
|
|
|
|
|
OpenDialog_Start dd aOpenDialog_Start
|
|
|
|
|
dd 0,0
|
|
|
|
|
aOpenDialog_Init db 'OpenDialog_init',0
|
|
|
|
|
aOpenDialog_Start db 'OpenDialog_start',0
|
|
|
|
|
;---------------------------------------------------------------------
|
2010-09-13 23:33:33 +02:00
|
|
|
|
;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
|
|
|
|
|
lib1 l_libs lib1_name, cur_dir_path, library_path, system_dir1, err_message_found_lib1, head_f_l, import_proc_lib,err_message_import1, head_f_i
|
|
|
|
|
load_lib_end:
|
|
|
|
|
|
2010-01-08 20:33:30 +01:00
|
|
|
|
edit1 edit_box 153, 56, 1, 0xffffff, 0xff, 0x80ff, 0, 0x8000, (outfile-infile-1), infile, mouse_dd, 0, 11,11
|
|
|
|
|
edit2 edit_box 153, 56, 17, 0xffffff, 0xff, 0x80ff, 0, 0x8000,(path-outfile-1), outfile, mouse_dd, 0, 7,7
|
|
|
|
|
edit3 edit_box 153, 56, 33, 0xffffff, 0xff, 0x80ff, 0, 0x8000,(path_end-path-1), path, mouse_dd, 0, 6,6
|
2010-01-09 18:39:07 +01:00
|
|
|
|
editboxes_end:
|
|
|
|
|
ch1_dbg check_box 5, 49, 6, 12, 0xffffff, 0x80ff, 0, s_dbgdescr,(s_dbgdescr_end-s_dbgdescr)
|
2010-09-13 23:33:33 +02:00
|
|
|
|
;---------------------------------------------------------------------
|
|
|
|
|
align 4
|
|
|
|
|
OpenDialog_data:
|
|
|
|
|
.type dd 0
|
|
|
|
|
.procinfo dd pinfo ;+4
|
|
|
|
|
.com_area_name dd communication_area_name ;+8
|
|
|
|
|
.com_area dd 0 ;+12
|
|
|
|
|
.opendir_path dd path ;+16
|
|
|
|
|
.dir_default_path dd default_dir ;+20
|
|
|
|
|
.start_path dd library_path ;+24 <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 䠩<><E4A0A9><EFBFBD>
|
|
|
|
|
.draw_window dd draw_window ;+28
|
|
|
|
|
.status dd 0 ;+32
|
|
|
|
|
.openfile_path dd path ;+36 <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>뢠<EFBFBD><EBA2A0><EFBFBD><EFBFBD><EFBFBD> 䠩<><E4A0A9>
|
|
|
|
|
.filename_area dd filename_area ;+40
|
|
|
|
|
.filter_area dd Filter
|
|
|
|
|
.x:
|
|
|
|
|
.x_size dw 420 ;+48 ; Window X size
|
|
|
|
|
.x_start dw 10 ;+50 ; Window X position
|
|
|
|
|
.y:
|
|
|
|
|
.y_size dw 320 ;+52 ; Window y size
|
|
|
|
|
.y_start dw 10 ;+54 ; Window Y position
|
|
|
|
|
|
|
|
|
|
default_dir db '/rd/1',0 ;<3B><>४<EFBFBD><E0A5AA><EFBFBD><EFBFBD><EFBFBD> <20><> 㬮<>砭<EFBFBD><E7A0AD>
|
|
|
|
|
|
|
|
|
|
communication_area_name:
|
|
|
|
|
db 'FFFFFFFF_open_dialog',0
|
|
|
|
|
open_dialog_name:
|
|
|
|
|
db 'opendial',0
|
|
|
|
|
communication_area_default_path:
|
|
|
|
|
db '/rd/1/File managers/',0
|
|
|
|
|
|
|
|
|
|
Filter:
|
|
|
|
|
dd Filter.end - Filter
|
|
|
|
|
.1:
|
|
|
|
|
db 'ASM',0
|
|
|
|
|
.end:
|
|
|
|
|
db 0
|
2011-08-18 17:20:00 +02:00
|
|
|
|
;---------------------------------------------------------------------
|
2010-01-04 18:51:09 +01:00
|
|
|
|
mouse_dd dd 0 ;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> Shift-<2D> <20> editbox
|
2011-08-18 17:20:00 +02:00
|
|
|
|
;---------------------------------------------------------------------
|
2006-11-02 15:18:23 +01:00
|
|
|
|
infile db 'example.asm'
|
2010-01-08 20:33:30 +01:00
|
|
|
|
times MAX_PATH-$+infile db 0
|
2006-11-02 15:18:23 +01:00
|
|
|
|
outfile db 'example'
|
2010-01-08 20:33:30 +01:00
|
|
|
|
times MAX_PATH-$+outfile db 0
|
2010-09-13 23:33:33 +02:00
|
|
|
|
path db '/rd/1//' ;OpenDialog <20><><EFBFBD> <20><><EFBFBD><EFBFBD>᪥ 㡨ࠥ<E3A1A8> <20><><EFBFBD><E1ABA5><EFBFBD><EFBFBD> <>, <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20>ᯮ<EFBFBD>짮<EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>ᥣ<EFBFBD><E1A5A3>, <20><>⮬<EFBFBD> <><E1ABA5> 2
|
2010-01-08 20:33:30 +01:00
|
|
|
|
times MAX_PATH-$+path db 0
|
2010-01-07 22:35:23 +01:00
|
|
|
|
path_end:
|
2006-01-03 10:43:31 +01:00
|
|
|
|
lf db 13,10,0
|
2011-08-18 17:20:00 +02:00
|
|
|
|
;---------------------------------------------------------------------
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov_param_str:
|
2011-08-18 17:20:00 +02:00
|
|
|
|
cld
|
2010-02-07 23:24:35 +01:00
|
|
|
|
@@:
|
2011-08-18 17:20:00 +02:00
|
|
|
|
lodsb
|
|
|
|
|
cmp al,','
|
|
|
|
|
je @f
|
|
|
|
|
stosb
|
|
|
|
|
test al,al
|
|
|
|
|
jnz @b
|
2010-02-07 23:24:35 +01:00
|
|
|
|
@@:
|
2011-08-18 17:20:00 +02:00
|
|
|
|
xor al,al
|
|
|
|
|
stosb
|
|
|
|
|
ret
|
|
|
|
|
;---------------------------------------------------------------------
|
2006-01-03 10:43:31 +01:00
|
|
|
|
start:
|
2011-08-18 17:20:00 +02:00
|
|
|
|
cmp [_mode],NORMAL_MODE
|
|
|
|
|
jne @f
|
|
|
|
|
call draw_messages
|
|
|
|
|
mov [textxy],7 shl 16 + 70
|
2006-01-03 10:43:31 +01:00
|
|
|
|
@@:
|
2011-08-18 17:20:00 +02:00
|
|
|
|
mov esi,_logo
|
|
|
|
|
call display_string
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2011-08-18 17:20:00 +02:00
|
|
|
|
;---------------------------------------------------------------------
|
|
|
|
|
; Fasm native code
|
|
|
|
|
;---------------------------------------------------------------------
|
|
|
|
|
mov [input_file],infile
|
|
|
|
|
mov [output_file],outfile
|
|
|
|
|
|
|
|
|
|
call init_memory
|
|
|
|
|
|
|
|
|
|
call make_timestamp
|
|
|
|
|
mov [start_time],eax
|
|
|
|
|
|
|
|
|
|
call preprocessor
|
|
|
|
|
call parser
|
|
|
|
|
call assembler
|
|
|
|
|
bt dword[ch1_dbg.flags],1 ;cmp [bGenerateDebugInfo], 0
|
|
|
|
|
jae @f ;jz @f
|
|
|
|
|
call symbol_dump
|
2007-06-14 14:56:45 +02:00
|
|
|
|
@@:
|
2011-08-18 17:20:00 +02:00
|
|
|
|
call formatter
|
|
|
|
|
|
|
|
|
|
call display_user_messages
|
|
|
|
|
movzx eax,[current_pass]
|
|
|
|
|
inc eax
|
|
|
|
|
call display_number
|
|
|
|
|
mov esi,_passes_suffix
|
|
|
|
|
call display_string
|
|
|
|
|
call make_timestamp
|
|
|
|
|
sub eax,[start_time]
|
|
|
|
|
xor edx,edx
|
|
|
|
|
mov ebx,100
|
|
|
|
|
div ebx
|
|
|
|
|
or eax,eax
|
|
|
|
|
jz display_bytes_count
|
|
|
|
|
xor edx,edx
|
|
|
|
|
mov ebx,10
|
|
|
|
|
div ebx
|
|
|
|
|
push edx
|
|
|
|
|
call display_number
|
|
|
|
|
mov dl,'.'
|
|
|
|
|
call display_character
|
|
|
|
|
pop eax
|
|
|
|
|
call display_number
|
|
|
|
|
mov esi,_seconds_suffix
|
|
|
|
|
call display_string
|
|
|
|
|
display_bytes_count:
|
|
|
|
|
mov eax,[written_size]
|
|
|
|
|
call display_number
|
|
|
|
|
mov esi,_bytes_suffix
|
|
|
|
|
call display_string
|
|
|
|
|
xor al,al
|
|
|
|
|
|
|
|
|
|
cmp [_run_outfile],0
|
|
|
|
|
je @f
|
|
|
|
|
mov edx,outfile
|
|
|
|
|
call make_fullpaths
|
|
|
|
|
xor ecx,ecx
|
2011-08-21 20:38:08 +02:00
|
|
|
|
mcall 70,file_info_start
|
2006-01-03 10:43:31 +01:00
|
|
|
|
@@:
|
2011-08-18 17:20:00 +02:00
|
|
|
|
jmp exit_program
|
|
|
|
|
;---------------------------------------------------------------------
|
2006-01-03 10:43:31 +01:00
|
|
|
|
include 'system.inc'
|
|
|
|
|
include 'version.inc'
|
|
|
|
|
include 'errors.inc'
|
|
|
|
|
include 'expressi.inc'
|
|
|
|
|
include 'preproce.inc'
|
|
|
|
|
include 'parser.inc'
|
|
|
|
|
include 'assemble.inc'
|
|
|
|
|
include 'formats.inc'
|
|
|
|
|
include 'x86_64.inc'
|
2006-07-28 15:39:16 +02:00
|
|
|
|
include 'tables.inc'
|
2007-06-14 14:56:45 +02:00
|
|
|
|
include 'symbdump.inc'
|
2007-12-31 00:34:37 +01:00
|
|
|
|
include 'messages.inc'
|
2011-08-18 17:20:00 +02:00
|
|
|
|
;---------------------------------------------------------------------
|
2007-05-10 15:48:35 +02:00
|
|
|
|
title db appname,VERSION_STRING,0
|
2006-10-27 09:38:46 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
_logo db 'flat assembler version ',VERSION_STRING,13,10,0
|
|
|
|
|
|
|
|
|
|
_passes_suffix db ' passes, ',0
|
|
|
|
|
_seconds_suffix db ' seconds, ',0
|
|
|
|
|
_bytes_suffix db ' bytes.',13,10,0
|
|
|
|
|
|
|
|
|
|
_include db 'INCLUDE',0
|
|
|
|
|
|
|
|
|
|
_counter db 4,'0000'
|
|
|
|
|
|
2006-07-28 15:39:16 +02:00
|
|
|
|
_mode dd NORMAL_MODE
|
2006-01-03 10:43:31 +01:00
|
|
|
|
_run_outfile dd 0
|
2010-01-08 20:33:30 +01:00
|
|
|
|
;bGenerateDebugInfo db 0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
sub_table:
|
|
|
|
|
times $41 db $00
|
|
|
|
|
times $1A db $20
|
|
|
|
|
times $25 db $00
|
|
|
|
|
times $10 db $20
|
|
|
|
|
times $30 db $00
|
|
|
|
|
times $10 db $50
|
|
|
|
|
times $04 db $00,$01
|
|
|
|
|
times $08 db $00
|
|
|
|
|
|
|
|
|
|
;include_debug_strings
|
|
|
|
|
program_end:
|
2010-02-07 23:24:35 +01:00
|
|
|
|
; params db 0 ; 'TINYPAD.ASM,TINYPAD,/HD/1/TPAD4/',
|
|
|
|
|
params rb 4096
|
|
|
|
|
cur_dir_path rb 4096
|
|
|
|
|
library_path rb 4096
|
2010-09-13 23:33:33 +02:00
|
|
|
|
filename_area rb 256
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
|
|
|
|
include 'variable.inc'
|
|
|
|
|
|
|
|
|
|
program_base dd ?
|
|
|
|
|
buffer_address dd ?
|
|
|
|
|
memory_setting dd ?
|
|
|
|
|
start_time dd ?
|
2008-02-23 11:16:37 +01:00
|
|
|
|
memblock dd ?
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2007-12-31 00:34:37 +01:00
|
|
|
|
predefinitions rb 1000h
|
|
|
|
|
|
2010-01-04 18:51:09 +01:00
|
|
|
|
dbgfilename rb MAX_PATH+4
|
2007-06-14 14:56:45 +02:00
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
sc system_colors
|
2007-02-08 17:38:05 +01:00
|
|
|
|
max_handles = 8
|
|
|
|
|
fileinfos rb (4+20+MAX_PATH)*max_handles
|
|
|
|
|
fileinfos_end:
|
2006-01-03 10:43:31 +01:00
|
|
|
|
pinfo process_information
|
2007-09-20 19:07:33 +02:00
|
|
|
|
|
|
|
|
|
align 1000h
|
|
|
|
|
rb 1000h
|
|
|
|
|
stacktop:
|