Welcome, Guest. Please login or register.

Author Topic: New software company/New Amiga game  (Read 5899 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: New software company/New Amiga game
« on: April 16, 2007, 08:12:11 AM »
@InsaneSoft
Quote
Maybe that Trance needs some more stack to run Amijeweled

Trance does not affect stack usage at all.

If the game requires more stack, maybe it should have stacksize check + StackSwap when required?
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: New software company/New Amiga game
« Reply #1 on: April 16, 2007, 07:35:07 PM »
@InsaneSoft
Quote
We would be really glad, if it was that simple. We are using automatic stack extension already, but we didn't know that this works for 68k programs on MOS.

It works, of course. It would be really silly to break that.
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: New software company/New Amiga game
« Reply #2 on: April 16, 2007, 10:43:46 PM »
@InsaneSoft

Debugged the thing a bit:

Avoid using custom planar bitmaps and it works just fine. Why are you using those in a "RTG" game anyway? It just slows the RTG system down as it must c2p/p2c all the time!

You could even use WriteLUTPixelArray IMO (doesn't P96 have cgx emulation for this too?).

Some other observations:
- You should not use scr->RastPort.BitMap->Depth directly, but GetBitMapAttr(scr->RastPort.BitMap, BMA_DEPTH).
- Using MEMF_CLEAR for every single allocation is a bit dull. In case the initial contents of the memory doesn't matter, it could be left out.
- Using 65536 byte array in decrunch and deflate routines accounts for most of the huge stack usage. This could be avoided quite easily with dynamic memory allocation (or static buffer and a semaphore).
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: New software company/New Amiga game
« Reply #3 on: April 17, 2007, 01:51:54 PM »
@InsaneSoft
Quote
If planar bitmaps occur for the colour graphics, one could think that your RTG install is broken oder CGFX bears some serious errors.

There is a code that allocates a BitMap with AllocMem(), then fills it, and allocates planes with AllocRaster(). It gives you a bitmap with planes in chip memory. This is really bad performance-wise, any CGX  bitmaps should really be fast memory. The routine also has some weird bits that attempts to build interleaved bitmap (and fails, the "interleaved" bitmap you build isn't detected as one, the only way to get true interleaved bitmap is to use AllocBitMap()).

Quote
BTW., how could WriteLUTPixelArray() be of help, if the program is designed for colour depths >8 bit?

Well I kind of assumed you do blit some palette indexed gfx, too. If you don't, then forget this call.

Quote
Sorry, we don't know, where you made this observation exactly, as we already and _only_ use GetBitMapAttr() for determining the screen BitMap depth attribute?  It appears only one time, btw. and that is for the window init time.

There's some 4 or 5 locations it's used, and yes it appears to be the code at init. It just looked a bit weird, considering all other things used the proper GetBitMapAttr() call.

Quote
Which, as we know in the meantime, is the reason for the crashes and DSI errors. We think, that it is a question of a major redesign in order to avoid the JIT compilers breaking for this routines. But we were not aware, that this routines, as simple and portable they are written, are such a problem for the JIT compilers of the PPC OSses.

MorphOS JIT compiler Trance has no issues with these routines whatsoever. So "PPC OSes" refers to OS4 I guess? :-)
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: New software company/New Amiga game
« Reply #4 on: April 17, 2007, 02:08:47 PM »
@InsaneSoft
Quote
Do you know a better solution to allocate the rasters for the blit masks? We would be glad to know, if such a solution exists, that stays compatible with the RTG systems (P96/CGFX interchangably).

IMO the best solution is to use AllocBitMap() to allocate any bitmaps, but mask bitmaps are a bit special case indeed. I'll look up the recommended way after work.
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show all replies
    • http://www.iki.fi/sintonen/
Re: New software company/New Amiga game
« Reply #5 on: April 17, 2007, 07:29:17 PM »
@InsaneSoft

Replacing the custom mask bitmap allocation with the following makes the game work just fine under MorphOS:
Code: [Select]

struct BitMap *allocmaskbitmap(struct BitMap *bm)
{
  return AllocBitMap(GetBitMapAttr(bm, BMA_WIDTH),
                     GetBitMapAttr(bm, BMA_HEIGHT),
                     8,
                     BMF_CLEAR | BMF_MINPLANES,
                     NULL);
}

void freemaskbitmap(struct BitMap *bm)
{
  FreeBitMap(bm);
}

Obviously the one other function using custom bitmap building should use similar AllocBitMap() aswell.

If you want to make the code conditional, you can detect MorphOS with:
Code: [Select]
APTR isMorphOS = FindResident("MorphOS");

then:
Code: [Select]
if (isMorphOS)
{
  /* mos code */
}
else
{
  /* regular code */
}

NOTE: Depth 8 is recommended here to workaround issues in some MorphOS versions, at least if the mask is built using WPA8/WCP family functions.