user1807879
user1807879

Reputation: 151

Why use hexadecimal in ASM?

I couldn't seem to find an answer to this, and it's really starting to bug me. Is this simply because a hexadecimal value consists of 4 bits? (Assuming second operand would be an integer otherwise - point out if I'm incorrect)

mov   ebx,0x00   ; why not ebx,0?
mov   eax,0x01   ; why not ebx,1?

The above seems to work with both when making a system call to sys_exit(0), hence my confusion asto why use hexadecimal if it's easier to do it the other way.

Upvotes: 2

Views: 552

Answers (1)

NTyler
NTyler

Reputation: 1427

It's good practice to use whatever base makes sense for a given context. Much of what you're doing in ASM is dealing with registers, memory addresses, etc. which are conventionally notated in hex. Spend some more time in assembly and see if you still think base 10 is "easier."

Upvotes: 3

Related Questions