[BITS 16] in real mode

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
karim
Posts: 7
Joined: Mon Jun 23, 2025 8:03 pm

[BITS 16] in real mode

Post by karim »

Do I have to write [BITS 16] at the beginning of the assembly code because in real mode all the registers in the CPU are only 16-bit, and also so that NASM compiles the code as 16-bit only? Is that correct?
Octocontrabass
Member
Member
Posts: 5873
Joined: Mon Mar 25, 2013 7:01 pm

Re: [BITS 16] in real mode

Post by Octocontrabass »

No. You have to use "bits 16" because instructions are encoded differently in 16-bit mode, 32-bit mode, and 64-bit mode. The same registers are available in 16-bit mode and in 32-bit mode.
Post Reply