64 bit ivan

Sep 1, 2008, 8:05 am
#1
Joined: Mar 25, 2008
Posts: 9
So I spent a few hours the other day getting IVAN running on my 64 bit Gentoo system. There was a lot of odd stuff with the reference counting, then a weird problem with the fonts. All seems to work now.
I've tested it on a 32 bit freebsd 7 system too, which seems to work, so hope I've not broken too much. Let me know. Most of the changes are in FeLib, so the likes of LIVAN should be able to take from that.

As always, disable optimisation or it'll die. Also chances are saves aren't compatible with the 32 bit version (but then they might be, not tried, just a hunch).

at some point I'll get round to comparing all the produced asm with the optimised stuff and see where it's going wrong, but with the amount of pointer tricks it's unlikely that the optimiser will be able to do a decent job anyway.

So anyway, here goes:
Attached files
ivan.tar.gz ()
Sep 2, 2008, 8:05 am
#2
Joined: Mar 25, 2008
Posts: 9
can't remember if I posted this before or after a certain change. In short I screwed up somewhere, probably forgetting to make install between builds. Anyway, in FeLib/Source/bitmap.cpp:
void cachedfont::PrintCharacter(cblitdata B) const
{
  if&#40;B.Dest.X < 0 || B.Dest.Y < 0 || B.Dest.X + 10 >= B.Bitmap->Size.X || B.Dest.Y + 9 >= B.Bitmap->Size.Y&#41;
  &#123;
    NormalMaskedBlit&#40;B&#41;;
    return;
  &#125;

  packcol16** SrcLine = &Image&#91;B.Src.Y&#93;;
  packcol16** EndLine = SrcLine + 9;
  packcol16** SrcMaskLine = &MaskMap&#91;B.Src.Y&#93;;
  packcol16** DestLine = &B.Bitmap->Image&#91;B.Dest.Y&#93;;

  for&#40;; SrcLine != EndLine; ++SrcLine, ++SrcMaskLine, ++DestLine&#41;
  &#123;
    culong* FontPtr = reinterpret_cast<culong*>&#40;*SrcLine + B.Src.X&#41;;
    culong* EndPtr = FontPtr + &#40;20/sizeof&#40;ulong&#41;&#41;;
    culong* MaskPtr = reinterpret_cast<culong*>&#40;*SrcMaskLine + B.Src.X&#41;;
    ulong* DestPtr = reinterpret_cast<ulong*>&#40;*DestLine + B.Dest.X&#41;;

    for&#40;; FontPtr != EndPtr; ++DestPtr, ++MaskPtr, ++FontPtr&#41;
      *DestPtr = *DestPtr & *MaskPtr | *FontPtr;
  &#125;
&#125;

At some point I tried changing it back to 32 bit values and it didn't go too well... I'm aware that 20/8 doesn't go, but it seems to work... can't tell the difference in looks anyway.
Jump to