📄 fasmw.asm
字号:
retn
keyword:
invoke SendMessage,[hwnd_asmedit],AEM_GETWORDATCARET,1000h,string_buffer
call get_help_file_extension
cmp eax,'.hlp'
je winhelp_keyword
call check_htmlhelp
jc winhelp_keyword
mov [hhkey.cbStruct],sizeof.HH_AKLINK
mov [hhkey.pszKeywords],string_buffer
mov [hhkey.pszUrl],0
mov [hhkey.fIndexOnFail],TRUE
invoke HtmlHelp,[hwnd],help_path,HH_DISPLAY_TOPIC,0
invoke HtmlHelp,[hwnd],help_path,HH_KEYWORD_LOOKUP,hhkey
jmp finish
winhelp_keyword:
invoke WinHelp,[hwnd],help_path,HELP_KEY,string_buffer
jmp finish
pick_help:
mov [ofn.lpstrFile],help_path
mov [ofn.lpstrFilter],help_filter
mov [ofn.Flags],OFN_EXPLORER+OFN_FILEMUSTEXIST+OFN_HIDEREADONLY
mov [ofn.lpstrTitle],_pick_help
invoke GetOpenFileName,ofn
jmp finish
about:
invoke DialogBoxParam,[hinstance],IDD_ABOUT,[hwnd],AboutDialog,0
jmp finish
failed:
or eax,-1
jmp finish
wmnotify:
mov ebx,[lparam]
virtual at ebx
nmh NMHDR
end virtual
cmp [nmh.code],NM_RCLICK
je rclick
cmp [nmh.code],TCN_SELCHANGING
je selchanging
cmp [nmh.code],TCN_SELCHANGE
jne finish
update:
invoke SendMessage,[hwnd_tabctrl],TCM_GETCURSEL,0,0
invoke SendMessage,[hwnd],FM_SELECT,eax,0
jmp finish
selchanging:
xor eax,eax
jmp finish
rclick:
invoke GetCursorPos,pt
invoke GetWindowRect,[hwnd_tabctrl],rc
mov eax,[pt.x]
sub eax,[rc.left]
mov [tcht.pt.x],eax
mov eax,[pt.y]
sub eax,[rc.top]
mov [tcht.pt.y],eax
invoke SendMessage,[hwnd_tabctrl],TCM_HITTEST,0,tcht
cmp eax,-1
je finish
mov ebx,eax
invoke SendMessage,[hwnd_tabctrl],TCM_SETCURSEL,ebx,0
invoke SendMessage,[hwnd],FM_SELECT,ebx,0
cmp ebx,[assigned_file]
sete bl
neg bl
and ebx,MF_CHECKED
or ebx,MF_BYCOMMAND
invoke CheckMenuItem,[hmenu_tab],IDM_ASSIGN,ebx
invoke TrackPopupMenu,[hmenu_tab],TPM_RIGHTBUTTON,[pt.x],[pt.y],0,[hwnd],0
jmp finish
wmdropfiles:
invoke DragQueryFile,[wparam],-1,NULL,0
xor ebx,ebx
drop_files:
cmp ebx,eax
je drag_finish
push eax
invoke DragQueryFile,[wparam],ebx,path_buffer,1000h
push ebx
invoke GetFileTitle,path_buffer,name_buffer,100h
invoke SendMessage,[hwnd],FM_OPEN,name_buffer,path_buffer
cmp eax,-1
jne drop_ok
cinvoke wsprintf,string_buffer,_loading_error,path_buffer
invoke MessageBox,[hwnd],string_buffer,_caption,MB_ICONERROR+MB_OK
drop_ok:
pop ebx eax
inc ebx
jmp drop_files
drag_finish:
invoke DragFinish,[wparam]
xor eax,eax
jmp finish
wmclose:
mov [lparam],MB_DEFBUTTON2
close_window:
mov [wparam],0
check_and_exit:
mov [ei.header.mask],TCIF_PARAM+TCIF_TEXT
mov [ei.header.pszText],name_buffer
mov [ei.header.cchTextMax],100h
invoke SendMessage,[hwnd_tabctrl],TCM_GETITEM,[wparam],ei
or eax,eax
jz quit
mov esi,[ei.pszpath]
invoke SendMessage,[ei.hwnd],EM_CANUNDO,0,0
or eax,eax
jz release_path
invoke SendMessage,[hwnd_tabctrl],TCM_SETCURSEL,[wparam],0
invoke SendMessage,[hwnd],FM_SELECT,[wparam],0
mov eax,MB_ICONQUESTION+MB_YESNOCANCEL
or eax,[lparam]
invoke MessageBox,[hwnd],_saving_question,[ei.header.pszText],eax
cmp eax,IDCANCEL
je finish
cmp eax,IDNO
je release_path
invoke SendMessage,[hwnd],WM_COMMAND,IDM_SAVE,0
or eax,eax
jnz finish
release_path:
or esi,esi
jz check_next
invoke VirtualFree,esi,0,MEM_RELEASE
check_next:
inc [wparam]
jmp check_and_exit
quit:
stdcall WriteIniInteger,ini_path,_section_compiler,_key_compiler_memory,[compiler_memory]
stdcall WriteIniInteger,ini_path,_section_compiler,_key_compiler_priority,[compiler_priority]
stdcall WriteIniBit,ini_path,_section_options,_key_options_securesel,[asmedit_style],AES_SECURESEL
stdcall WriteIniBit,ini_path,_section_options,_key_options_autobrackets,[asmedit_style],AES_AUTOBRACKETS
stdcall WriteIniBit,ini_path,_section_options,_key_options_autoindent,[asmedit_style],AES_AUTOINDENT
stdcall WriteIniBit,ini_path,_section_options,_key_options_smarttabs,[asmedit_style],AES_SMARTTABS
stdcall WriteIniBit,ini_path,_section_options,_key_options_optimalfill,[asmedit_style],AES_OPTIMALFILL
stdcall WriteIniBit,ini_path,_section_options,_key_options_revivedeadkeys,[asmedit_style],AES_REVIVEDEADKEYS
stdcall WriteIniBit,ini_path,_section_options,_key_options_consolecaret,[asmedit_style],AES_CONSOLECARET
stdcall WriteIniColor,ini_path,_section_colors,_key_color_text,[editor_colors]
stdcall WriteIniColor,ini_path,_section_colors,_key_color_background,[editor_colors+4]
stdcall WriteIniColor,ini_path,_section_colors,_key_color_seltext,[editor_colors+8]
stdcall WriteIniColor,ini_path,_section_colors,_key_color_selbackground,[editor_colors+12]
stdcall WriteIniColor,ini_path,_section_colors,_key_color_symbols,[asm_syntax_colors]
stdcall WriteIniColor,ini_path,_section_colors,_key_color_numbers,[asm_syntax_colors+4]
stdcall WriteIniColor,ini_path,_section_colors,_key_color_strings,[asm_syntax_colors+8]
stdcall WriteIniColor,ini_path,_section_colors,_key_color_comments,[asm_syntax_colors+12]
invoke WritePrivateProfileString,_section_font,_key_font_face,font.lfFaceName,ini_path
stdcall WriteIniInteger,ini_path,_section_font,_key_font_height,[font.lfHeight]
stdcall WriteIniInteger,ini_path,_section_font,_key_font_width,[font.lfWidth]
stdcall WriteIniInteger,ini_path,_section_font,_key_font_weight,[font.lfWeight]
stdcall WriteIniBit,ini_path,_section_font,_key_font_italic,dword [font.lfItalic],1
movzx eax,[font.lfCharSet]
stdcall WriteIniInteger,ini_path,_section_font,_key_font_charset,eax
invoke GetWindowPlacement,[hwnd],wp
stdcall WriteIniInteger,ini_path,_section_window,_key_window_top,[wp.rcNormalPosition.top]
stdcall WriteIniInteger,ini_path,_section_window,_key_window_left,[wp.rcNormalPosition.left]
stdcall WriteIniInteger,ini_path,_section_window,_key_window_right,[wp.rcNormalPosition.right]
stdcall WriteIniInteger,ini_path,_section_window,_key_window_bottom,[wp.rcNormalPosition.bottom]
cmp [wp.showCmd],SW_SHOWMAXIMIZED
sete al
stdcall WriteIniBit,ini_path,_section_window,_key_window_maximized,eax,1
invoke WritePrivateProfileString,_section_help,_key_help_path,help_path,ini_path
invoke DestroyWindow,[hwnd]
jmp finish
wmdestroy:
invoke WinHelp,[hwnd],0,HELP_QUIT,0
invoke ImageList_Destroy,[himl]
invoke PostQuitMessage,0
xor eax,eax
finish:
pop edi esi ebx
ret
endp
proc WriteIniInteger ini,sec,key,val
cinvoke wsprintf,string_buffer,_value,[val]
invoke WritePrivateProfileString,[sec],[key],string_buffer,[ini]
ret
endp
proc WriteIniColor ini,sec,key,color
movzx eax,byte [color]
movzx ebx,byte [color+1]
movzx ecx,byte [color+2]
cinvoke wsprintf,string_buffer,_color,eax,ebx,ecx
invoke WritePrivateProfileString,[sec],[key],string_buffer,[ini]
ret
endp
proc WriteIniBit ini,sec,key,val,mask
mov eax,[val]
test eax,[mask]
setnz al
movzx eax,al
cinvoke wsprintf,string_buffer,_value,eax
invoke WritePrivateProfileString,[sec],[key],string_buffer,[ini]
ret
endp
proc GetIniInteger ini,sec,key,lpval
mov [string_buffer],0
invoke GetPrivateProfileString,[sec],[key],string_buffer,string_buffer,1000h,[ini]
mov esi,string_buffer
cmp byte [esi],0
je .done
call atoi
jc .done
mov ebx,[lpval]
mov [ebx],eax
.done:
ret
endp
proc atoi
lodsb
cmp al,20h
je atoi
cmp al,9
je atoi
mov bl,al
xor eax,eax
xor edx,edx
cmp bl,'-'
je atoi_digit
cmp bl,'+'
je atoi_digit
dec esi
atoi_digit:
mov dl,[esi]
sub dl,30h
jc atoi_done
cmp dl,9
ja atoi_done
mov ecx,eax
shl ecx,1
jc atoi_overflow
shl ecx,1
jc atoi_overflow
add eax,ecx
shl eax,1
jc atoi_overflow
js atoi_overflow
add eax,edx
jc atoi_overflow
inc esi
jmp atoi_digit
atoi_overflow:
stc
ret
atoi_done:
cmp bl,'-'
jne atoi_sign_ok
neg eax
atoi_sign_ok:
clc
ret
endp
proc GetIniColor ini,sec,key,lpcolor
mov [string_buffer],0
invoke GetPrivateProfileString,[sec],[key],string_buffer,string_buffer,1000h,[ini]
mov esi,string_buffer
cmp byte [esi],0
je .done
call atoi
jc .done
cmp eax,0FFh
ja .done
mov edi,eax
call .find
jne .done
call atoi
jc .done
cmp eax,0FFh
ja .done
shl eax,8
or edi,eax
call .find
jne .done
call atoi
jc .done
cmp eax,0FFh
ja .done
shl eax,16
or edi,eax
mov ebx,[lpcolor]
mov [ebx],edi
.done:
ret
.find:
lodsb
cmp al,20h
je .find
cmp al,9
je .find
cmp al,','
retn
endp
proc GetIniByte ini,sec,key,lpval
mov [string_buffer],0
invoke GetPrivateProfileString,[sec],[key],string_buffer,string_buffer,1000h,[ini]
mov esi,string_buffer
cmp byte [esi],0
je .done
call atoi
jc .done
cmp eax,100h
jae .done
mov ebx,[lpval]
mov [ebx],al
.done:
ret
endp
proc GetIniBit ini,sec,key,lpval,mask
mov [string_buffer],0
invoke GetPrivateProfileString,[sec],[key],string_buffer,string_buffer,1000h,[ini]
mov esi,string_buffer
xor eax,eax
.find:
lodsb
cmp al,20h
je .find
cmp al,9
je .find
sub al,30h
jc .done
cmp al,1
ja .done
neg eax
mov ebx,[lpval]
mov edx,[mask]
not edx
and [ebx],edx
and eax,[mask]
or [ebx],eax
.done:
ret
endp
proc fasm_syntax lpLine,uChars,lpColors
push ebx esi edi
mov esi,[lpLine]
mov edi,[lpColors]
mov ebx,characters
mov ecx,[uChars]
xor edx,edx
.scan_syntax:
lodsb
.check_character:
cmp al,20h
je .syntax_space
cmp al,3Bh
je .syntax_comment
mov ah,al
xlatb
or al,al
jz .syntax_symbol
or edx,edx
jnz .syntax_neutral
cmp ah,27h
je .syntax_string
cmp ah,22h
je .syntax_string
cmp ah,24h
je .syntax_pascal_hex
cmp ah,39h
ja .syntax_neutral
cmp ah,30h
jae .syntax_number
.syntax_neutral:
or edx,-1
inc edi
loop .scan_syntax
jmp .done
.syntax_space:
xor edx,edx
inc edi
loop .scan_syntax
jmp .done
.syntax_symbol:
mov al,1
stosb
xor edx,edx
loop .scan_syntax
jmp .done
.syntax_pascal_hex:
cmp ecx,1
je .syntax_neutral
mov al,[esi]
mov ah,al
xlatb
or al,al
jz .syntax_neutral
cmp ah,24h
jne .syntax_number
cmp ecx,2
je .syntax_neutral
mov al,[esi+1]
xlatb
or al,al
jz .syntax_neutral
.syntax_number:
mov al,2
stosb
loop .number_character
jmp .done
.number_character:
lodsb
mov ah,al
xlatb
xchg al,ah
or ah,ah
jz .check_character
cmp al,20h
je .check_character
cmp al,3Bh
je .check_character
mov al,2
stosb
loop .number_character
jmp .done
.syntax_string:
mov al,3
stosb
dec ecx
jz .done
lodsb
cmp al,ah
jne .syntax_string
mov al,3
stosb
dec ecx
jz .done
lodsb
cmp al,ah
je .syntax_string
xor edx,edx
jmp .check_character
.syntax_comment:
mov al,4
stosb
loop .syntax_comment
.done:
pop edi esi ebx
ret
endp
proc PositionDialog hwnd_dlg,msg,wparam,lparam
push ebx esi edi
cmp [msg],WM_INITDIALOG
je .initdialog
cmp [msg],WM_COMMAND
je .command
cmp [msg],WM_CLOSE
je .close
xor eax,eax
jmp .finish
.initdialog:
invoke SendMessage,[hwnd_asmedit],AEM_GETPOS,aepos,0
cinvoke wsprintf,string_buffer,_value,[aepos.caretLine]
invoke SetDlgItemText,[hwnd_dlg],ID_ROW,string_buffer
cinvoke wsprintf,string_buffer,_value,[aepos.caretPosition]
invoke SetDlgItemText,[hwnd_dlg],ID_COLUMN,string_buffer
jmp .processed
.command:
cmp [wparam],IDCANCEL
je .close
cmp [wparam],IDOK
jne .processed
invoke GetDlgItemInt,[hwnd_dlg],ID_ROW,param_buffer,FALSE
mov [aepos.caretLine],eax
mov [aepos.selectionLine],eax
invoke GetDlgItemInt,[hwnd_dlg],ID_COLUMN,param_buffer,FALSE
mov [aepos.caretPosition],eax
mov [aepos.selectionPosition],eax
invoke IsDlgButtonChecked,[hwnd_dlg],ID_SELECT
or eax,eax
jz .position
mov [aepos.selectionLine],0
mov [aepos.selectionPosition],0
.position:
invoke SendMessage,[hwnd_asmedit],AEM_SETPOS,aepos,0
invoke EndDialog,[hwnd_dlg],TRUE
jmp .processed
.close:
invoke EndDialog,[hwnd_dlg],FALSE
.processed:
mov eax,1
.finish:
pop edi esi ebx
ret
endp
proc GetStringsFromHistory hwnd_combobox
push ebx esi
invoke SendMessage,[hwnd_history],LB_GETCOUNT,0,0
mov esi,eax
xor ebx,ebx
.get_string:
cmp ebx,esi
je .finish
invoke SendMessage,[hwnd_history],LB_GETTEXT,ebx,string_buffer
invoke SendMessage,[hwnd_combobox],CB_ADDSTRING,0,string_buffer
inc ebx
jmp .get_string
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -