Author Topic: Does nasm support 8086 microprocessor?  (Read 6253 times)

Srikar

  • Guest
Does nasm support 8086 microprocessor?
« on: February 02, 2009, 09:00:44 AM »
In college we are taught 8086 microprocessor .

Does nasm support 8086 architecture?

If yes ,do we need to specify architecture somewhere in the code?

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2437
  • Country: us
Re: Does nasm support 8086 microprocessor?
« Reply #1 on: February 02, 2009, 11:36:24 AM »
Yes, Nasm supports 8086. You don't need any special directive to specify architecture... but you might *want* one. For example...

shl al, 4

That's a perfectly good instruction - introduced on the 80186, but not available on 8086. Nasm will assemble it without complaint. But if you use "cpu 8086" (*before* the instruction!), Nasm will complain "no instruction for this cpu level"...

cpu 8086
...
;shl al, 4 ; <- error - not for 8086!
mov cl, 4
shl al, cl ; okay for 8086

So in order to avoid using some instruction that Nasm will assemble, but which will cause an 8086 to crash, you probably want to use it.

Either that, or get your college to upgrade their computer lab! :)

If your course is using some assembler other than Nasm, you probably want to use that assembler, too. There are subtle differences in syntax that might be confusing. But Nasm will *work* fine for your purposes.

Best,
Frank

nobody

  • Guest
Re: Does nasm support 8086 microprocessor?
« Reply #2 on: February 18, 2009, 09:25:33 AM »
> Does nasm support 8086 architecture?

No longer (host side) in 2.xx versions.

> Nasm will complain "no instruction for this cpu level"...

Very good.

> cpu 8086
> ...
> ;shl al, 4 ; <- error - not for 8086!
> mov cl, 4
> shl al, cl ; okay for 8086

or 4 x "shl al, 1"

Zdenek Sojka

  • Guest
Re: Does nasm support 8086 microprocessor?
« Reply #3 on: February 27, 2009, 01:30:33 AM »
However, there are cases when invalid code is emmited, for example:

cpu 8086
mov al,[fs:bx]
mov fs,ax

compiles (and 'pop cs' is accepted for cpu 386)
So better don't bet on it.