Welcome, Guest. Please login or register.

Author Topic: openscreen problems!!!  (Read 5458 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Thomas

Re: openscreen problems!!!
« on: March 23, 2004, 09:55:26 AM »

The program is correct as it is. It works well if compiled with Dice C. It must be the compiler's fault. Try to compile without debug.

The complaint of IntuitionBase closed twice is nonsense. The Amiga Library system maintains an open counter and each and every OpenLibrary must be complemented by a CloseLibrary. If the compiler lib opens the library, it is opened twice and so it must be closed twice either.

Also the complaint about closing IntuitionBase before the screen is closed is nonsense, too. When OpenScreen returns, the program does no longer have any responsibilities against it or against Intuition. Also IntuitionBase will never be flushed from memory because it is always in use by other programs and by the OS itself.

Bye,
Thomas

Offline Thomas

Re: openscreen problems!!!
« Reply #1 on: March 23, 2004, 03:40:14 PM »
Well, I tried it on WinUAE with Picasso96 running. Will try again tonight at home (A4000 + Voodoo).

Additinally I would do what Kronos suggested: drop the NewScreen structure completely and use the OpenScreenTags function.

Here is an example which should work:

Code: [Select]

#include <clib/intuition_protos.h>
#include <clib/dos_protos.h>
#include <clib/graphics_protos.h>

int main (void)

{
struct Screen *scr;
struct Window *win;
struct RastPort *rp;

if (scr = OpenScreenTags (NULL,SA_LikeWorkbench,TRUE,TAG_END))
{
Delay (50); /* one second */
if (win = OpenWindowTags (NULL,
WA_CustomScreen,scr,
WA_Left,100,WA_Top,100,
WA_Width,200,WA_Height,100,
TAG_END))
{
rp = win->RPort;
Move (rp,20,40);
Text (rp,&quot;Beep !&quot;,6); /* you won't see DisplayBeep on a Picasso screen */
Delay (50); /* one second */
CloseWindow (win);
}
Delay (100); /* two seconds */
CloseScreen (scr);
}

return (0);
}


Bye,
Thomas

Offline Thomas

Re: openscreen problems!!!
« Reply #2 on: March 23, 2004, 04:02:45 PM »

Quick Answer: look at the code.

Long Answer: Jörgen opens a native screen (VidewModes = HIRES) and I open a RTG screen (SA_LikeWorkbench,TRUE).

Bye,
Thomas

Offline Thomas

Re: openscreen problems!!!
« Reply #3 on: March 23, 2004, 05:55:31 PM »

Well, I tried both programs on my Amiga with StormC4 and both work as they should.

I too get this strange message "screen 0x09ddcc10 not closed" although I can clearly watch the screen disappear. Must be a compiler error. If I run the program in a shell window with avail before and after it both avails show exactly the same numbers, so no memory is left unfreed.

However, my example with OpenScreenTags works without any messages.

Bye,
Thomas

Offline Thomas

Re: openscreen problems!!!
« Reply #4 on: March 25, 2004, 11:50:46 AM »

Which one of the programs freezes, The RKRM example or my self-written one ?

Do you really want to open an AGA-native screen or would you rather like to open a P96 screen but didn't yet proceed that far ?

IMHO you should drop the RKRM example and use my one. You should understand how it works and then develop your own (better) programming style rather than to copy another one's style.

Are you really sure that the whole Amiga freezes ? Couldn't it be that you just see the rest of an inactive display ? Try to switch back to the Workbench screen using right Amiga-M. If it doesn't work, try to Amiga-M before it freezes (IIRC it freezes after the Delay(), so there should be enough time to react).

Also try to run the program from a shell window without the Storm environment around it.

Bye,
Thomas

Offline Thomas

Re: openscreen problems!!!
« Reply #5 on: April 05, 2004, 02:55:37 PM »

Well, I usually mistrust the RKRM examples, it often seems like the people who wrote the books didn't test their examples. Also the Amiga people used SAS/C to develop their programs and SAS/C is very tolerant about small mistakes. StormC is tolerant either in that form that it doesn't warn these mistakes, too. But the code does not run in the end.

Quote

I just want to learn the basics first and then move on to the new stuff, but it seems that I will have to learn the new stuff right now, because the old stuff does not seem to work any more.

I don't know if this is due to the relative new compiler Storm C V4 or if it's the "new" OS 3.9 that makes this hard.


I've got an A4000 with CSPPC, Mediator 4000, Voodoo 3, Picasso96 and OS3.9 and I can assure you that the old stuff *does* still work. I cannot imagine why it should crash you machine. Perhaps you are running some screen mode promotion utility ?

Bye,
Thomas