Pelles C forum

Assembly language => Assembly discussions => Topic started by: Freddy on February 13, 2008, 10:05:42 PM

Title: Why PoASM uses MASM-like syntax and the C compiler accepts NASM-like syntax?
Post by: Freddy on February 13, 2008, 10:05:42 PM
I just noticed that the C compiler will compile (and output ASM code from C with /Tx86-asm) NASM-Like syntax:
Code: [Select]
[global _addnum]
[section .text]
#line 1 "test.c"
[function _addnum]
_addnum:
push ebp
mov ebp,esp
mov eax,dword [ebp+(8)]
add eax,dword [ebp+(12)]
@1:
pop ebp
ret
..?X_addnum:
[section .drectve]
db " -defaultlib:crt"
[cpu pentium]

But PoASM assembles MASM-like syntax.
I don't know if it was on purpose. But very strange.
I like NASM-like syntax better, but I think PoASM is great.
Title: Re: Why PoASM uses MASM-like syntax and the C compiler accepts NASM-like syntax?
Post by: Pelle on February 15, 2008, 11:09:59 AM
Historical/compatibility reasons - too late to change...
Title: Re: Why PoASM uses MASM-like syntax and the C compiler accepts NASM-like syntax?
Post by: Romashka on March 04, 2008, 12:19:42 AM
I really thought POCC uses POASM now, instead of built-in assembler.
Is this planned for the future?
Title: Re: Why PoASM uses MASM-like syntax and the C compiler accepts NASM-like syntax?
Post by: Pelle on March 06, 2008, 04:00:08 PM
No. POCC and POASM share the same backend, but they use different parsers. POCC also have a separate inline assembly parser (which has nothing to do with POASM). Since it's possible to output an assembly file from POCC, tweak it (possibly using some private tool), and then pass the file back through POCC, I try to keep the POCC assembly syntax as 'static' as possible for compatibility reasons. Tweaking the assembly file from POCC is probably not very common, but I see no reason to change the current syntax.
Title: Re: Why PoASM uses MASM-like syntax and the C compiler accepts NASM-like syntax?
Post by: akko on July 21, 2009, 09:21:00 PM
One silly question:
Where can I set the CCFLAG /Tx86-asm in the IDE?
I tried in Project Options - Macros , however it does not work. I can't find any asm output.
BTW I am using PellesC 6 rel.cand- #3 (perhaps it is just not working in the test release)

Thx
Title: Re: Why PoASM uses MASM-like syntax and the C compiler accepts NASM-like syntax?
Post by: Pelle on July 31, 2009, 02:44:20 PM
Project Options -> Macros tab, but it will be 100% useless inside the IDE. You will get the assembly code as text in some xxx.obj file, and the following build steps will barf about the obj file not looking like an obj file. Use the command-line!