Author Topic: NASM generates different code then TASM  (Read 4822 times)

Offline RuudB

  • Jr. Member
  • *
  • Posts: 40
  • Country: nl
    • Ruud's Commodore Site
NASM generates different code then TASM
« on: December 06, 2016, 02:52:05 PM »
Hello,

I noticed that NASM generates a different code than NASM for the register-to-register version of MOV, SUB, SBB, AND and some other instructions. And I am very curious why this is done. Technical reasons, speed? Or just first pick?

My reason for this curiosity: From the '80s on I disassembled various XT/AT (clone) BIOSes to see how they work and to be able to write my own own that is focussed on testing suspicious motherboards. Some years ago I switched to NASM and it wasn't until I disassembled the BIOS of a Commodore PC and assembled it again with NASM some months ago that I noticed that the generated code was different. FYI: after recalculating the checksum the 'new' BIOS worked as fine as the original one.

Lately I disassembled Turbo Pascal 3 and ran into the same problem. That's why I decided to write my own assembler; one that would accept (my) NASM code and could, if needed, generate the alternative code. That's how I found out about the exact differences.
FYI: my assembler and disassembler are written in Free Pascal and are based on ones I wrote for the 6502, Z80 and other CPUs. Another good reason to write them: it was fun! :)
And don't worry about a competitor: both are only able to handle 8088 and 80286 (partly) instructions and I won't expand that.

Kind regards, Ruud Baltissen
With kind regards / met vriendelijke groet, Ruud Baltissen

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: NASM generates different code then TASM
« Reply #1 on: December 06, 2016, 03:34:49 PM »
If my fuzzy memory serves, Joseph Drexel modified Nasm to produce binary-compatible Tasm code. I have no idea what the advantage was supposed to be...

Best,
Frank