Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Raymond Wiker Newsgroups: comp.sys.apple2 Subject: Re: Brutal Deluxe Software releases Merlin 32 Date: Sun, 01 Feb 2015 15:54:38 +0100 Organization: A noiseless patient Spider Lines: 39 Message-ID: References: <02ec2596-dc67-4b67-a524-958e6dce6150@googlegroups.com> <6fe10e83-0250-49eb-92eb-93afe530782c@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="6795c6b5efa8fe68018748717e86deed"; logging-data="8565"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ASoA/xM5vNO6MTg3OMf2l" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (darwin) Cancel-Lock: sha1:jvOMeT+EUWZov7l7tYCp886XimY= sha1:kAt/Cf9VilKdnty7oRj3dD3JVKE= Xref: csiph.com comp.sys.apple2:23774 Steven Hirsch writes: > On 02/01/2015 03:06 AM, Hugh Hood wrote: > >> I managed to cobble together enough PPC support in your Merlin 32 to satisfy >> my 8-bit assembly requirements, so please don't make PPC support a priority, >> unless you have others requesting it. >> >> For anyone else who is interested in building Merlin 32 on a PPC (and whose >> needs are as simple as mine), look in Olivier's a65816_Data.c file. Starting >> at line #447, he has a series of (12) statements that handle the Merlin data >> pseudo ops DW, DA, DFB, DB, DDB, ADR & ADRL. >> >> For example, here is line #447: >> >> current_line->data[2*nb_valid_element+0] = data[0]; >> >> As one method to fix the PPC 'endian' issue, change the instances of data[x] >> as follows: >> >> data[0] to data [3] >> data[1] to data [2] >> data[2] to data [1] >> data[3] to data [0] >> >> >> This swaps the order of the (4) 8-bit bytes in the 32-bit integer containing >> the data, and fixes the problem I was seeing on PPC, which is big-endian. > > Disclaimer: I haven't looked at the code, but based on my own > development experience with cross-platform interoperability it sounds > like some carefully crafted macros might be helpful. htonl and htons might be useful here: they turn native longs and short into "network byte order". Unfortunately, this is the same as big-endian, which is the opposite of what is required for the 6502. Still, you might implement something similar, like htoll (host to long little-endian) and htosl (host to short little-endian).