flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 22 Oct 2023, 14:15
You have to show all the code. We don't know what you have done there.
|
|||
![]() |
|
ShreyasJejurkar 22 Oct 2023, 14:16
This is what all my code is. I don't have anything else.
|
|||
![]() |
|
Furs 22 Oct 2023, 14:24
Your memory layout for the 3 variables is one after the other. So it displays it from there when it tries to display first message, likely because your macro is wrong and has some sort of buffer overflow. Can you show the macro?
As for why the number itself, which is in-between, is not displayed, that's because it's initialized to NUL chars which aren't displayed. |
|||
![]() |
|
ShreyasJejurkar 22 Oct 2023, 14:54
Here is my other utils.asm file
Code: macro exit exit_code { mov rax, 60 mov rdi, exit_code syscall } macro write msg, msg_len { mov rax, 1 mov rdi, 1 mov rsi, msg mov rdx, msg_len syscall } ; segment readable writeable |
|||
![]() |
|
revolution 22 Oct 2023, 15:46
The length is stored in a byte. But your macro uses the address, not the value.
You can either change len to a variable. Code: msg_first_number.len = $ - msg_first_number Code: movzx rdx, [msg_len] |
|||
![]() |
|
ShreyasJejurkar 22 Oct 2023, 17:02
oh what a small mistake, After changing
Code:
msg_first_number.len db $ - msg_first_number
To => Code: msg_first_number.len = $ - msg_first_number it worked. I changed for other variables as well where we are calculating the length of it. Also, I had to remove the square bracket of my Code: first_number Code: rsi |
|||
![]() |
|
ShreyasJejurkar 22 Oct 2023, 17:04
And also how do I find this small issue in my code? @revolution
I mean what's the strategy or way you use to find the issue? Maybe that might help to find small issues like this when I encounter them in the future. That will be a great help for me. |
|||
![]() |
|
revolution 22 Oct 2023, 17:10
You can use a debugger to follow the execution of each instruction one-by-one.
fdbg was created by a member of this board. |
|||
![]() |
|
ShreyasJejurkar 22 Oct 2023, 17:15
how to use it, is it pre included in fasm? I installed FASM via APT on my ubuntu.
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.