Author Topic: Porting SPITBOL to OSX  (Read 5543 times)

Offline daveshields

  • Jr. Member
  • *
  • Posts: 4
Porting SPITBOL to OSX
« on: January 13, 2015, 08:22:03 PM »
Hi,

I am the current maintainer of the SPITBOL language, http://github.com/hardbol/spitbol. It is written in a portable assembly language, based in part on SPITBOL/360 which was written in assembly language. It's the fastest implementation of SNOBOL4 ever.

I've just finished the port for 64-bit Unix, so now have Unix versions for both x86 and x64. (I did port for CDC 6600 many years ago, and also worked on IBM PC port. There have been ports to DEC-10,PDP-11, Macintosh, Solaris, MIPS, etc.)

I'm now attempting port to OSX, which uses macho,not elf, format, and also requires use of 'rip' addressing.

I found one bug in NASM trying to compile my code. Cyril Gorcunov fixed that, and I think I'm close, but I could use some help.

Consider the sequence:

var dd 0
...
 sub rcx,var

in which we want to subtract the address of var from rcx.

This fails assembly, due to the '32 bit address error' message.

I think the correct way is :

var dd 0
...
 lea rax,[rel var]
 sub rcx,rax

Is this right?

thanks,dave

Offline Cyrill Gorcunov

  • NASM Developer
  • Full Member
  • *****
  • Posts: 179
  • Country: 00
Re: Porting SPITBOL to OSX
« Reply #1 on: January 15, 2015, 06:43:56 PM »
Sorry for delay, busy as hell. Dave, the easiest way to check is to compile some testing program and check if results are correct. To be fair macho output format not well implemented and I fear has been not tested that well. As to code itself -- looks ok to me, until I miss something obvious.

Offline daveshields

  • Jr. Member
  • *
  • Posts: 4
Re: Porting SPITBOL to OSX
« Reply #2 on: January 15, 2015, 11:31:21 PM »
Cyril,

Thanks.

I've managed to generate a .o file in macho64 format (after making the changes suggested above). Thing is, I need to build nasm on osx to get your latest and greatest.

I'm sorting through that now. Next I need to install autoconf.

I'll keep in touch.

dave