Showing posts with label jcalg1. Show all posts
Showing posts with label jcalg1. 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.

Thursday, May 1, 2008

Initial plan of attack

My plan of attack to get Cello out of the water is to port the file operations first. The first goal is to have something running on the Mac that can read a file (sample files generated from the Windows version) and then to be able to create the results (also a file). After that I can look at the visual representation of the file (getting it all to draw), the UI and all of the rest of it.

The program is written almost entirely in C++, so I figured that my start would be to map the file operations (etc.) to Core Foundation. Looking at the code, and from the brief tour of it from one of the Windows engineers Cello reads and writes compressed files. It uses a library called jcalg1 which is written in assembler. So the first dirty hands will be getting it to assemble in XCode.