I admit that I have never done anything with MorphOS before, but maybe it's not too late.
I have some old software that should actually run under MorphOS, but it causes problems if it doesn't run on its own screen.
I have narrowed it down to a problem with a BltTemplate() call, but I don't understand why it shouldn't work.
This is how I would expect it to work:
AmigaOS 3.1 screenshotAnd this in with MorphOS:
MorphOS screenshotSorry for the long listing, but I am hunting down that problem now for quite some time..
Code:
#include <exec/types.h>
#include <intuition/intuition.h>
#include <graphics/gfx.h>
#include <graphics/rastport.h>
#include <graphics/gfxbase.h>
#include <proto/intuition.h>
#include <proto/graphics.h>
#include <proto/exec.h>
/* 16x16 1-bit template pattern */
UWORD pattern[] =
{
0xAAAA,
0x5555,
0xAAAA,
0x5555,
0xAAAA,
0x5555,
0xAAAA,
0x5555,
0xAAAA,
0x5555,
0xAAAA,
0x5555,
0xAAAA,
0x5555,
0xAAAA,
0x5555
};
int main()
{
struct Window *win;
win = OpenWindowTags(NULL,
WA_Title, "BltTemplate Example",
WA_Width, 320,
WA_Height, 200,
WA_CloseGadget, TRUE,
WA_DepthGadget, TRUE,
WA_DragBar, TRUE,
WA_Activate, TRUE,
WA_IDCMP, IDCMP_CLOSEWINDOW,
WA_Flags, WFLG_SMART_REFRESH | WFLG_GIMMEZEROZERO,
TAG_DONE);
if (!win)
return 0;
struct RastPort *rp = win->RPort;
/* Set drawing colors */
SetAPen(rp, 1);
SetBPen(rp, 0);
/* Draw template at (50,50) */
BltTemplate(
pattern, /* template */
0, /* source x offset */
16/8, /* bytes per row */
rp,
50, 50, /* destination */
16, 16 /* width, height */
);
/* Wait until window close */
BOOL running = TRUE;
while (running)
{
struct IntuiMessage *msg;
WaitPort(win->UserPort);
while ((msg = (struct IntuiMessage *)GetMsg(win->UserPort)))
{
if (msg->Class == IDCMP_CLOSEWINDOW)
running = FALSE;
ReplyMsg((struct Message *)msg);
}
}
CloseWindow(win);
return 0;
}
Of course one can write cleaner code, but I wanted to come up with some minimal code to test. There is a major thing going wrong here, I can't figure out.
Any ideas?
(I guess I am doing something really stupid..)
If it makes any difference: AmigaOS runs in WinUAE, MorphOS in qemu.