TL;DR:
Use the correct Intel 8085 opcode for
Use the correct Intel 8085 opcode for
MOV B, C: 41. Assemble it as 01000001. If your toolchain still balks, force the byte with DB 41h in NASM syntax.
What’s causing this error?
Your assembler isn’t happy because it can’t translate MOV B, C into valid 8085 machine code. The MOV instruction copies data between registers, and for this specific move—from C to B—the Intel 8085 expects the single-byte opcode 41. That’s just how the chip’s instruction set works. The assembler should handle this automatically, but sometimes it doesn’t.
How do I fix it step by step?
- Double-check your mnemonic.
MOV B, Cis absolutely valid in 8085 assembly—it means “copy whatever’s in C over to B.” If your assembler still complains, move to the next step. - Look at your assembler’s settings. NASM, GAS, and ASM80 all understand
MOV B, C, but some tools default to 8086 mode. That’s a common tripwire. Check your project’s configuration. - Bypass the assembler entirely. Sometimes the easiest fix is to drop the raw byte straight into your source. Add this line:
section .text db 41h ; Intel 8085 machine code for MOV B, CThen assemble withnasm -f bin prog.asm -o prog.bin. No translation needed. - Confirm the output. Run
ndisasm -b 85 prog.binand you should see:00000000 41 mov b,c
If that line appears, your instruction is correct. - Test it in a simulator. Fire up an 8085 simulator like Sim8085 and step through the instruction. You’ll see register B change to match whatever was in C before the move.
What if none of that works?
- Wrong CPU target. Make sure your project is set to 8085, not 8086 or Z80. In NASM you can force it with
cpu 8085at the top of your file, or set the architecture in your IDE’s project settings. - Different syntax rules. A few assemblers want no comma—just
MOV B C. Others expect parentheses for indirect moves likeMOV B, [C]. Stick to the syntax shown in the official 8085 manual. - Corrupted source file. Open your file in a hex editor. If you see
B2instead of41, your file was assembled in 8086 mode. Recreate the file from scratch.
How can I avoid this problem in the future?
| Tip | What to do |
|---|---|
| Set the CPU early | Put %define cpu 8085 at the very top of every .asm file. Or assemble with nasm -Dcpu=8085 every time. |
| Start with a template | Create new projects from a clean 8085 template: all eight registers (B, C, D, E, H, L, A plus flags) plus a simple MOV B, C test line you can delete later. |
| Simulate before you build | Before you flash anything to real hardware, run every new instruction in an 8085 simulator. Compare the register dump against the official timing table to catch mismatches early. |
Keep the Intel 8085 manual on your desk. When your assembler starts lying, the bytes never do.