Fixed the silly bug which would use the current settings as default. Now, it correctly does nothing when debug settings do not exist for the current file type.
diff -Narb -X EXCLUDE.TXT R:\FASM17112\SOURCE\IDE\FASMW\FASMW.ASM R:\!FASM\SOURCE\IDE\FASMW\FASMW.ASM
15c15
< IDE_VERSION_STRING equ "0.96.0"
---
> IDE_VERSION_STRING equ "0.96.0a"
80a81
> _pick_debugger db 'Select debugger program',0
124a126,129
> debugger_type db '%s_%X_%X_%s',0
> debugger_program db 'Program',0
> debugger_params db 'Params',0
> _section_debugger db 'Debugger',0
230a236,239
> debuggerprogram rb 200h
> debuggerparams rb 200h
> debugcmdline rb 1000h
>
1199a1209,1210
> cmp eax,IDM_DEBUG
> je debug
1207a1219,1220
> cmp eax,IDM_DEBUGGERSETUP
> je debugger_setup
1580a1594,1603
> debug:
> and [command_flags],0
> invoke SendMessage,[hwnd],FM_COMPILE,0,FALSE
> or eax,eax
> jnz finish
> stc ; debug mode
> call Debugger
> jmp finish
1600a1624,1628
> debugger_setup:
> mov eax,[hwnd]
> clc ; setup mode
> call Debugger
> jmp finish
3056a3085,3196
> proc DebuggerSetup 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
> .notprocessed:
> xor eax,eax
> jmp .finish
> .pick:
> mov [ofn.lpstrFile],debuggerprogram
> mov [ofn.lpstrFilter],0
> mov [ofn.Flags],OFN_EXPLORER+OFN_FILEMUSTEXIST
> mov [ofn.lpstrTitle],_pick_debugger
> invoke GetOpenFileName,ofn
> .initdialog:
> invoke SetDlgItemText,[hwnd_dlg],ID_DEBUGGERPROGRAM,debuggerprogram
> invoke SetDlgItemText,[hwnd_dlg],ID_DEBUGGERPARAMS,debuggerparams
> jmp .processed
> .command:
> cmp [wparam],IDCANCEL
> je .close
> cmp [wparam],ID_DEBUGGERPICK
> je .pick
> cmp [wparam],IDOK
> jne .finish
> invoke GetDlgItemText,[hwnd_dlg],ID_DEBUGGERPROGRAM,debuggerprogram,200h
> invoke GetDlgItemText,[hwnd_dlg],ID_DEBUGGERPARAMS,debuggerparams,200h
> invoke EndDialog,[hwnd_dlg],TRUE
> jmp finish
> .close:
> invoke EndDialog,[hwnd_dlg],FALSE
> .processed:
> mov eax,1
> .finish:
> pop edi esi ebx
> ret
> endp
>
> Debugger:
> push ebx esi edi
> virtual at ebp-.FRAME
> .key_program rb $80
> .key_params rb $80
>
> .hwnd rd 1
> .CF rb 1
> .FRAME = ($-$$+3)AND-4
> end virtual
> enter .FRAME,0
> setc [.CF]
> mov [.hwnd],eax
>
> cmp [output_format],1
> adc [output_format],0
>
> lea edi,[path_buffer]
> cmp byte[edi],0
> jz .finish
> mov esi,edi
>
> xor ebx,ebx
> .ext: inc edi
> cmp byte[edi-1],'.'
> cmovz ebx,edi
> cmp byte[edi-1],0
> jnz .ext
> ; convert extension to uppercase?
> movzx eax,[output_format]
> mov edx,[format_flags]
> and edx,$030C ; what bits?
> mov [param_buffer+0],ebx
> mov [param_buffer+4],eax
> mov [param_buffer+8],edx
>
> mov [param_buffer+12],debugger_params
> lea ebx,[.key_params]
> invoke wvsprintf,ebx,debugger_type,param_buffer
> invoke GetPrivateProfileString,_section_debugger,ebx,0,debuggerparams,200h,ini_path
>
> mov [param_buffer+12],debugger_program
> lea edi,[.key_program]
> invoke wvsprintf,edi,debugger_type,param_buffer
> invoke GetPrivateProfileString,_section_debugger,edi,0,debuggerprogram,200h,ini_path
> test [.CF],1
> jnz .debug
> .settings:
> invoke DialogBoxParam,[hinstance],IDD_DEBUGGERSETUP,[.hwnd],DebuggerSetup,edi
> test eax,eax
> jz .finish
> invoke WritePrivateProfileString,_section_debugger,ebx,debuggerparams,ini_path
> invoke WritePrivateProfileString,_section_debugger,edi,debuggerprogram,ini_path
> jmp .finish
> .debug:
> test eax,eax
> jz .finish
> mov [param_buffer+0],debuggerprogram
> mov [param_buffer+4],path_buffer
> invoke wvsprintf,debugcmdline,debuggerparams,param_buffer
>
> mov [sinfo.cb],sizeof.STARTUPINFO
> mov [sinfo.dwFlags],0
> invoke CreateProcess,debuggerprogram,debugcmdline,0,0,0,NORMAL_PRIORITY_CLASS,0,0,sinfo,pinfo
> invoke CloseHandle,[pinfo.hThread]
> invoke CloseHandle,[pinfo.hProcess]
> .finish:
> leave
> pop edi esi ebx
> retn
>
>
3254a3395
> IDD_DEBUGGERSETUP,LANG_ENGLISH+SUBLANG_DEFAULT,debugger_setup_dialog,\
3281,3282c3422,3424
< IDD_ABOUT = 309
< IDD_CALCULATOR = 310
---
> IDD_DEBUGGERSETUP = 309
> IDD_ABOUT = 310
> IDD_CALCULATOR = 311
3314a3457
> IDM_DEBUGGERSETUP = 1503
3357a3501,3503
> ID_DEBUGGERPROGRAM=3000
> ID_DEBUGGERPARAMS= 3001
> ID_DEBUGGERPICK = 3002
3390c3536,3537
< ;menuitem '&Debug' _ 'F8',IDM_DEBUG
---
> menuitem '&Debug' _ 'F8',IDM_DEBUG
> menuseparator
3394a3542
> menuitem '&Debugger setup...',IDM_DEBUGGERSETUP
3535a3684,3693
> enddialog
>
> dialog debugger_setup_dialog,'Debugger Setup',54,28,186,44,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME
> dialogitem 'STATIC','&Debugger:',-1,4,8,40,8,WS_VISIBLE+SS_RIGHT
> dialogitem 'EDIT','',ID_DEBUGGERPROGRAM,48,6,74,12,WS_VISIBLE+WS_BORDER+WS_TABSTOP+ES_AUTOHSCROLL
> dialogitem 'BUTTON','...',ID_DEBUGGERPICK,122,6,8,12,WS_VISIBLE+WS_TABSTOP
> dialogitem 'STATIC','&Parameters:',-1,4,26,40,8,WS_VISIBLE+SS_RIGHT
> dialogitem 'EDIT','',ID_DEBUGGERPARAMS,48,24,82,12,WS_VISIBLE+WS_BORDER+WS_TABSTOP+ES_AUTOHSCROLL
> dialogitem 'BUTTON','OK',IDOK,138,6,42,14,WS_VISIBLE+WS_TABSTOP+BS_DEFPUSHBUTTON
> dialogitem 'BUTTON','C&ancel',IDCANCEL,138,22,42,14,WS_VISIBLE+WS_TABSTOP+BS_PUSHBUTTON