Reputation: 1488
Given the following assembly program:
BITS 64
mov rax, 0b111
Yasm outputs:
error: expected `,'
Why does it expect a comma here? NASM happily assembles this.
Upvotes: 2
Views: 261
Reputation: 58467
From the YASM manual:
3.5.1. Numeric Constants
A numeric constant is simply a number. NASM allows you to specify numbers in a variety of number bases, in a variety of ways: you can suffix H, Q or O, and B for hex, octal, and binary, or you can prefix 0x for hex in the style of C, or you can prefix $ for hex in the style of Borland Pascal.
Some examples:
mov ax,10010011b ; binary
The NASM manual adds:
In addition, current versions of NASM accept the prefix 0h for hexadecimal, 0d or 0t for decimal, 0o or 0q for octal, and 0b or 0y for binary.
TL;DR: While NASM supports both a b
-suffix and a 0b
-prefix for binary literals, YASM only supports the suffix variant. So 0b111
needs to be written as 111b
.
Upvotes: 3