Hi everyone,
first of all happy new year (yes, it is 2024, you need to update the verfication question for new users to 2025 :) )
I like CB very much and I am in favor using codeblocks as my IDE for FASM. (assembly)
Compiling works now as expected - after setup the user defined compiler.
I have used MASM as syntax highlighting, which does look to be working well.
But I have some luxury problems:
Inellisense / codecompletetion does not work at all. any chance to get this working for variables, declarations and commands - in case of an error, I have no option to jmp via double click to the line where the issues occured
- Edit: Debugging possible? Currently using x64dbg with int 4 as workaround, which is fine btw
example error where I can see the line occoured, but no possibilty to jump stright to the line 595 for example attached
thank you
DJ
EDIT: Command does seems to be working, maybe because of MASM
Quote from: denimjeans2007 on January 21, 2024, 01:34:02 PM
- Inellisense / codecompletetion does not work at all. any change to get this working for variables, declarations and commands
- in case of an error, I have no option to jmp via double click to the line where the issues occured
I am willing to try to help with "jmp via double click to the line where the issues occurred".
Edit2: The codecompletetion is not within my knowledge, ability, and/or desire.
I will need example code with error and information about which version of FASM is being used.
Also, the information on how you set up the toolchain setting to use FASM.
Edit: The Code::Blocks version information is also needed.
The link I think is correct for FASM https://flatassembler.net/download.php (https://flatassembler.net/download.php)
Tim S.
Hi stahta01,
thank you.
reg the toolchain: I am simply using fasm.exe (lastest from https://flatassembler.net/download.php), no linker etc. see screenshot below
I am using Code::Blocks SVN 13373 , Build Oct 15th, 2023.
Reg jump to the location where the error occured:
Basically any type of error, then as above you see the line number where the error occured
4 screenshots below (only 2 allowed per post as it seems, so look 1 more down for the next 2 screenshots)
next 2 screenshots
I need example code that gives error.
I am setting up the newest version 1 of FASM
What CB Compiler did you clone to make it use FASM?
I believe I did clone the C++ gcc standard compiler.
The error message is in the first post.
example program with error
; Template for program using standard Win32 headers
format PE GUI 4.0
entry start
include 'win32w.inc'
section '.text' code readable executable
start:
invoke GetModuleHandle,0
mov [wc.hInstance],eax
invoke LoadIcon,0,IDI_APPLICATION
mov [wc.hIcon],eax
invoke LoadCursor,0,IDC_ARROW
mov [wc.hCursor],eax
invoke RegisterClass,wc
test eax,eax
jz error
invoke CreateWindowEx,0,_class,_title,WS_VISIBLE+WS_DLGFRAME+WS_SYSMENU,128,128,256,192,NULL,NULL,[wc.hInstance],NULL
test eax,eax
jz error
msg_loop:
invoke GetMessage,msg,NULL,0,0
cmp eax,1
jb end_loop
jne msg_loop
invoke TranslateMessage,msg
invoke DispatchMessage,msg
jmp msg_loop
error:
invoke MessageBox,NULL,_error,NULL,MB_ICONERROR+MB_OK
end_loop:
invoke ExitProcess,[msg.wParam]
proc WindowProc uses ebx esi edi, hwnd,wmsg,wparam,lparam
cmp [wmsg],WM_DESTROY
je .wmdestroy
.defwndproc:
invoke DefWindowProc,[hwnd],[wmsg],[wparam],[lparam]
jmp .finish
.wmdestroy:
invoke PostQuitMessage,0
xor eax,eax
.finish:
ret
endp
ERROR_HERE
section '.data' data readable writeable
_class TCHAR 'FASMWIN32',0
_title TCHAR 'Win32 program template',0
_error TCHAR 'Startup failed.',0
wc WNDCLASS 0,WindowProc,0,0,NULL,NULL,NULL,COLOR_BTNFACE+1,NULL,_class
msg MSG
section '.idata' import data readable writeable
library kernel32,'KERNEL32.DLL',\
user32,'USER32.DLL'
include 'api\kernel32.inc'
include 'api\user32.inc'
so what I want to achieve is, that I dont want to scroll but doubleclick and then it jumps straight to the line 55, I hope I was able to explain what I mean :) We need to be able to parse the error message and fish the 55 out. then when user doubleclicks, jump to line 55. This would really awesome. My code is now approx 2000 line, and scrolling back forth is messy. Sure I can work with includes ... but still you need to scroll
For testing, if you are on Windows, you can try fasmw, which comes in the same package. All "portable" and no need to install, super small. It is the windows "IDE" but not really comfortable. no line numbers etc. but does the job.
-------------- Build: Release in test_fasm (compiler: FASM)---------------
FASM.EXE H:\devel\cb_projects\test\test_fasm\main.asm obj\Release\main.o
Linking stage skipped (build target has no object files to link)
H:\devel\cb_projects\test\test_fasm\main.asm [4]:
include 'win32ax.inc' ; you can simply switch between win32ax, win32wx, win64ax and win64wx here
error: file not found.
flat assembler version 1.73.32 (1048576 kilobytes memory)
Process terminated with status 2 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))
Edit: I am assembling hello.asm code
This is the build log I am getting; I will see if I can figure out what advanced compiler setting needs to be changed and to what.
Settings -> Compiler
Far right tab: "Other Settings"
Button: Advanced Options"
Tab: output parsing
But, it looks more complex than I remember from about 5 years, ago.
I will see which one looks closest or more correct to change.
I think I forgot all I knew about regex; so, it will be a while before I can figure it out.
Tim S.
here is my build log:
-------------- Build: Debug in server_tcp_listen_v0.2 (compiler: FASM2)---------------
Running target pre-build steps
mkdir -p bin/Debug
FASM.EXE D:\ASM\projects\01.TEMPLATES\server_tcp_listen_v0.2\main.asm bin\Debug\server_tcp_listen_v0.exe
Linking stage skipped (build target has no object files to link)
flat assembler version 1.73.31 (1048576 kilobytes memory)
7 passes, 0.2 seconds, 17131008 bytes.
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
here again my settings:
1. under global compiler settigns:
2. Selected Compiler: FASM (your newly created compiler settings)
3. Nothing checked or entered on any of these tabs beside:
4. Search directory -> Compiler -> d:\ASM\FASM (where your FAMS folder is)
5. Toolchain Executables ->
- 5a. Compiler install dir: D:\ASM\fasm
- 5b. C Compiler: fasm.exe
- 5c. C++ Compiler: fasm.exe
- Rest can stay as it is, it will ignored anyways
6. other settings -> Advanced options -> commands -> command line Macro: $compiler $file $exe_output
(before changing, make sure your selected compiler is your newly created FASM compiler settings, otherwise you will mess up the gcc settings :D )
under project build options:
7. pre/post build steps:
8. pre: mkdir -p bin/Debug
under properties of your asm file:
9. Build: uncheck link file (no obj file to be created)
10. Advance: customer build -> for this compiler: FASM
10a. use customer command to build: $compiler $file $exe_output
(will give you as example: fasm.exe main.asm main.exe)
with this settings, you should be able to complile without issues
In your output it does seem like that you are are missing:
4,5a.,maybe 6.
once everything compiles fine, says thanks god ;D and then save it as project template, example: ASM_Template
regarding the regex thing, I probaly can help you if we can tell me where I can check or where to test the regex?
Settings -> Compiler
Far right tab: "Other Settings"
Button: Advanced Options"
Tab: output parsing
Is where to both set and test the regex.
Tim S.
awesome !!! thank you so much, got it working now.
with
([{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+)\ \[([0-9]+)\]:
maybe not the best way, but its only for FASM compiler, therefore all fine.
only issue is, that the message is on the 2nd line. Trying to find a way
in notepad plus it match with
([{}()[:blank:]#%$~[:alnum:]!&_:+/\\\.-]+)\ \[([0-9]+)\]:\r\n(.*)
the last sub.expression (.*) is the second line, the 4th match. trying to figure it out now, maybe do you or anyone know on how to match in Codeblocks on the 2nd line as message?
Edit: workaround is a second match only on the message with :
processed:\ (.*)
screenshot attached.
meanwhile I got answer in the FASM forum (thanks to revolution)
we can change the system.inc depending on the system in use (win32 in my case) and recompile. took under 1 sec :)
now it works as expected.
see screenshot.
Issue 1 resolved
For each supported system the file named "SYSTEM.INC" has a line similar to this:
Code:
line_data_start db ':',0xA,0
You can delete the line feed.
only left problem is the intellisense / codecompletetion :)
if still interessed:
include 'win32ax.inc' ; you can simply switch between win32ax, win32wx, win64ax and win64wx here
error: file not found.
I found another possible issue why it was not working for you.
You need to set the windows variables as in the screenshot (path requires to point to your fasm dir)
Add to windows path
FASM -> C:\fasm
INCLUDE -> C:\fasm\include
then it will work (hopefully :D)
Adding an CB Environment Variable of INCLUDE did fix my build error.
oh, that's even a better solution, thanks for the tipp!