NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: Sharlenehargrove on February 11, 2023, 11:40:43 AM

Title: Why generates different code then TASM ?
Post by: Sharlenehargrove on February 11, 2023, 11:40:43 AM
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. MyAccountAccess (https://www.myaccountaccess.one/)
Title: Re: Why generates different code then TASM ?
Post by: Frank Kotler on February 11, 2023, 11:20:57 PM
Hi Sharlene,

There's an icon at the lower right that will allow you to edit your message to say "different than Tasm" :)

Tasm's way drove Borland out of Business! Seriously, I think you'd have to ask Simon Tatham, the original author, that question. I suspect an arbitrary decision, but it might have been intentional to be different than Tasm. At one time, courts ruled that software with the same "look and feel" were a copyright violation, even though the code was different.

Eric Isaacson, author of A86, designed A86 to produce a recognizable pattern of different encodings so he could enforce his "free for non-commercial use" license. I speculate that it would be an amusing day in court, trying to convince a jury of this!

Don't worry about "competition". Nobody is getting rich from this!

Out of curiosity, how did you specify the alternatives?

Best,
Frank