[comp.sys.amiga] Lattice C routine

nor1675@dsacg2.UUCP (Michael Figg) (05/03/88)

I am trying to run a simple program from an old copy of Amazing Computing
(Vol 2, Num 10 "Quick and Dirty Bobs", by Michael Swinger) on Lattice 4.0
with no luck. The program is to run under intuition and just display a 
simple bob. All i get is a blank screen with a close gadget. Here are 
relevant (hopefully) pieces of the program: 

#define RP1 Window1->RPort 
VOID Drawit();

  .
  .

void Open_Libraries(),Open_Screens(),Init_Bobs(),Cleanup();
/* added to get program to compile under Lattice */

USHORT colormap[32] = {
0x0ccd,0x0585,0x0f79,0x0f30,0x0f9b,
   .
   .
0x0fff,0x0000  };

short Image_data1[130] = {
/* Width:  18 (pixels)
Height: 13 (pixels)
Depth: 5 (planes) */
0x0000,0x0000,0x0000,0x0000,0x0080,
0x0000,0x0080,0x0000,0x0080,0x0000,
  .
  .
  .
0x0000,0x0000,0x0000,0x0000,0x0000};

  .
  .
  .

VOID main()              /* VOID added for Lattice */
{
  Open_Libraries();

  Open_Screens();

  Init_Bobs();

  Drawit();

  Cleanup();
}

void Open_libraries()
{
  IntuitionBase = etc

  GfxBase = etc
}

void Open_Screens()
{
  Screen1 = OpenScreen(&NewScreen1);
  NewWindow1.Screen = Screen1;
  Window1=OpenWindow(&NewWindow1);
  WVP1 = (struct ViewPort *)ViewPortAddress(Window1);
  LoadRGB4(WVP1,&colormap,32);
  /* return; */    /* removed for Lattice */
}

void Init_Bobs()
{
  gelsinfo.nextLine = NULL;
  gelsinfo.lastColor = NULL;
  gelsinfo.collHandler = NULL;
  RP1->GelsInfo = &gelsinfo;
  v1.VSBob=&b1;
  InitGels(&s1, &s2, &gelsinfo);
  InitMasks(&v1);
  v1.X = 25;
  v1.Y = 75;
  AddBob(&b1,RP1);
  /* return; */
}

void Cleanup()
{
  Wait(1<<Window1->UserPort->mp_SigBit);
  CloseWindow(Window1);
    .
    .
}

VOID Drawit()
{
  SortGList(RP1);
  WaitTOF();
  DrawGList(RP1,WVP1);
}

I am suspect of this last module but am not familiar with the functions
and have not found much about them in the Intuition Manual. Do they return
something that I am missing and need to be defined and/or declared? Does 
anybody see anything obvious? The author lives here in Columbus but
unfortunately doesn't know anything about Lattice. I am also sending a 
similar posting to the Lattice BBS and see if they can help but I wanted to
cover as many bases as possible.

					 Thanks,

-- 
"Don't quote me on this!"                      Michael Figg
					       DLA Systems Automation Center
					       Columbus, Oh.
					       (614)-238-9036

nor1675@dsacg2.UUCP (Michael Figg) (05/08/88)

In article <197@dsacg2.UUCP>, nor1675@dsacg2.UUCP (Michael Figg) writes:
> I am trying to run a simple program from an old copy of Amazing Computing
> (Vol 2, Num 10 "Quick and Dirty Bobs", by Michael Swinger) on Lattice 4.0
> with no luck. The program is to run under intuition and just display a 
> simple bob. All i get is a blank screen with a close gadget. Here are 
> relevant (hopefully) pieces of the program: 
> 
> 					 Thanks,
> 
> -- 
> "Don't quote me on this!"                      Michael Figg
> 					       DLA Systems Automation Center
> 					       Columbus, Oh.
> 					       (614)-238-9036


Okay, this was a trick question and you all missed it including me. The
problem isn't with Lattice but with expanded memory. NoFastMem worked
like a charm. Why didn't I think of this before presenting my problem in
front of the world? 

Now I'm faced with another challange. Lattice compile options. I've got 
this program to run by compiling with

lc -L swing1

and running NoFastMem but I should be able to shove this image data into
chip memory at compile time. I've tried compiling with options similar to

lc -ad -L swing1  

or

lc -acd -L swing1

or even 
 
lc -acdb -L swing1

but I keep getting an error on the compile saying 

    option conflict. -b option ignored

even though I am not using the -b option at all. This message is followed
later by a linkage error stating:

Error 510: _IntuitionBase symbol - Reference to unmerged data item
   First Reference in Unit cxovf.o at offset 00000c20 in file 'LIB:lc.lib'
   to Unit swing1.o at offset 00000010 in file 'swing1.o'

in checking the Lattice manual for this error I found a five word explanation
that said much less than what was on the screen. I don't have the manual
with me but I think it said something about an unrecognized symbol. I did
find that cxovf.o is a stack handler routine so I tried uping the stack to
20000. No go. Does this look like a problem with the library or what. And
do I have any control over this? I'm probably making myself look like a
fool again (or still) but inquiring minds want to know. I want to know.

actually two people gave me answers to this chip problem (Mike and Mike, but
not this Mike) and I don't know why I didn't think about it. Inexperience
I guess. Somebody else reccommended crayons for easy graphics!

						Thanks,


-- 
"Don't quote me on this!"                      Michael Figg
					       DLA Systems Automation Center
					       Columbus, Oh.
					       (614)-238-9036

rick@oresoft.UUCP (Rick Lahrson) (05/10/88)

In article <199@dsacg2.UUCP> nor1675@dsacg2.UUCP (Michael Figg) writes:
>but I keep getting an error on the compile saying 
>    option conflict. -b option ignored
>even though I am not using the -b option at all. This message is followed
>later by a linkage error stating:
>Error 510: _IntuitionBase symbol - Reference to unmerged data item
>   First Reference in Unit cxovf.o at offset 00000c20 in file 'LIB:lc.lib'
>   to Unit swing1.o at offset 00000010 in file 'swing1.o'
>in checking the Lattice manual for this error I found a five word explanation
>that said much less than what was on the screen. I don't have the manual
>with me but I think it said something about an unrecognized symbol. I did
>find that cxovf.o is a stack handler routine so I tried uping the stack to
>20000. No go. Does this look like a problem with the library or what. And
>do I have any control over this? I'm probably making myself look like a
>fool again (or still) but inquiring minds want to know. I want to know.

First, the -b option is now the default for compiles, so to get rid of
the warning, use -b0 .  The linker error message comes from the fact that
cxovf (from Lattice's library) was compiled with -b.  If you have the "nb"
libraries on your compiler distribution disks, use them whenever you use
the -b0 option.  Otherwise, take a look in the source subdirectory, and
you'll find cxovf.c .  You can compile it with -b0, and include the result
in the link.  That works for me.

-- 

Rick Lahrson  ...{tektronix|uunet}!oresoft!rick

Disclaimer:  If I ever speak for anyone but me, I'll warn you in advance.

walker@sas.UUCP (Doug Walker) (05/11/88)

In article <199@dsacg2.UUCP> nor1675@dsacg2.UUCP (Michael Figg) writes:
>Now I'm faced with another challange. Lattice compile options. I've got 
...
>and running NoFastMem but I should be able to shove this image data into
>chip memory at compile time. I've tried compiling with options similar to

You can probably fix this by simply BLINKing the old executable with the
CHIP option on:

BLINK oldname TO newname CHIP

This will force all code and data hunks into CHIP ram.

The 'Reference to unmerged data item' problem occurred because you were
trying to use SMALLDATA on BLINK to combine your data hunks into a single
hunk, but some of your data was marked CHIP and some FAST.