flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > [fasmg] Undocumented number feature: '_' |
| Author |
|
|
Tomasz Grysztar 08 Mar 2026, 10:56
It's one of the fasm-compatibility features. Apparently I did not put any information about this feature into fasm's manual either, but you may find the discussion that lead to it's introduction here.
|
|||
|
|
revolution 08 Mar 2026, 18:05
Both single-quote and underscore are valid numeric padding characters.
Code: db 1_0'0 db 1'0_0 |
|||
|
|
Jessé 13 Mar 2026, 21:34
Indeed, great stuff to have both syntaxes in fasm(g|2)!
Code: ; cmpxchg demo format ELF64 executable 3 include 'fastcall_v1.inc' include 'stdmacros.inc' include 'stdio.inc' macro prefetcht2? var* match =byte? [mem], var prefetcht2 byte [mem] else match [mem], var prefetcht2 byte [mem] else err "Syntax error", 10 end match end macro _code rwx Start entry endbr64 libc.StartMain ( & @f ); align 4 counter dd 200 @@ endbr64 prefetcht2 [ counter ] enter 16, 0 pthread_create ( rsp, NULL, & Thread_dec, NULL ); mov eax, [ counter ] @@ fprintf ( ** stdout, < 8,8,8,8,8,8,8,8, \ 32,32,32,32,32,32,32,32,13,"Counter is now at: %d",0 >, eax ); usleep ( 50'000 ); fflush ( ** stdout ); mov eax, -201 mov edx, 8000_0001h cmpxchg [ counter ], edx jne @b fprintf ( ** stdout, \n "Done."\n "Replaced by: 0x%08X"\n, * counter ); xor eax, eax leave ret Thread_dec: endbr64 enter 0, 0 @@ usleep ( 100'000 ); cmp [ counter ], 8000_0001h je @f lock dec [ counter ] jmp @b @@ leave xor eax, eax ret To my "eyes", each one now has its own place. |
|||
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2026, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.