Showing posts with label Assembler. Show all posts
Showing posts with label Assembler. Show all posts

Saturday, May 3, 2008

NASM another way out?

The .intel_syntax directive is not supported under the XCode Gas assembler. This is not an option.

In searching for information for converting MASM to Gas I have found that, as I understand it, most assembly work is actually done on NASM, and indeed this assembler has been available as part of he default XCode installation for a long time. Gas, it seems, is primarily designed as an assembler for GCC rather than as a stand-alone assembler. NASM is also closer to MASM than Gas.

MASM assembler still needs to be converted to NASM. I found a Perl program Nomyso that will do a fair bit of he work. It looks far promising than intel2gas which proved to be very disappointing.

Problems using Nomyso:
  1. Handling of structs seems wrong
  2. Included files are copied into the resulting file rather than being converted to %include.

Some useful links:
  1. A good survey of Assemblers
  2. Apple NASM Man Page
  3. NASM Documentation
  4. Writing A Useful Program With NASM

For the moment I am going to put the business of getting jcalg to assemble under OSX/XCode to one side as I can work around it.

Friday, May 2, 2008

jcalg1 - MASM and Gas Attack

Naïvely I assumed that assembler was assembler - this assumption like the best assumptions was based on ignorance. I have done assembler back in college days college on old PDP-11, later in 6502 and a little 68000 from this it never occurred that different assemblers (with the same target language) could be so very different. As jcag1 compiles under MASM - and XCode is Gas (gcc) they are quite different. My attempts to Google-up a gas version of jcalg1 did not yield.

The options from here seem to be:
  1. Convert jcag1 to Gas. I have found a tool that claims to be able to do this intel2gas - but there is a large amount that it just can't handle.
  2. Use the .intel_syntax directive in Gas and fix up all the errors manually. This directive makes gas use the AT&T syntax which is closer to MASM.
  3. Modify my approach - change the original windows version of Cello so that it saves and opens files that are not compressed and thereby just side-step this problem. This would allow me to still create sample files.
Of these approaches the last will obviously work - however I will have a crack at the .intel_syntax directive and see if it has millage.