vro_cpyfm

C and PASCAL (or any other high-level languages) in here please

Moderators: exxos, simonsunnyboy, Mug UK, Zorro 2, Moderator Team

AtariOwl
Atari freak
Atari freak
Posts: 55
Joined: Mon Nov 03, 2003 2:04 pm

vro_cpyfm

Postby AtariOwl » Mon Feb 08, 2016 12:09 am

Hi Guys

Been experimenting with vro_cpyfm (oh i should add in Lattice C)

Lovely.. i can copy bits of the screen easily, scroll around.. super.

As soon as i try to copy from offscreen memory... nothing.
I'm not at all sure what i'm doing wrong.

Ideally i want a large buffer images (several screens wide and tall lets say maybe 1280*1280) from which i can copy chunks to the screen.

Any ideas what i'm doing wrong?

Cheers

User avatar
shoggoth
Nature
Nature
Posts: 848
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: vro_cpyfm

Postby shoggoth » Mon Feb 08, 2016 8:27 am

AtariOwl wrote:Any ideas what i'm doing wrong?Cheers


No, because you didn't post any code :)
Ain't no space like PeP-space.

AtariOwl
Atari freak
Atari freak
Posts: 55
Joined: Mon Nov 03, 2003 2:04 pm

Re: vro_cpyfm

Postby AtariOwl » Mon Feb 08, 2016 9:27 am

I kind of assumed there must be a known answer as it seems to be a question i'm seeing often when i look around the net but i'm not seeing answers

OK the relevent bits

Code: Select all

   struct mfdbstr
   {   INT   *IMAGE;
      INT   WIDTH;
      INT   HEIGHT;
      INT   WORDW;
      INT   FLAG;
      INT   PLANES;
      INT   R1,R2,R2;
      }   srcMFDB, destMFDB;
      
      vhandle = graf_handle(&junk,&junk,&junk,&junk);
      v_opnvwk(work_in,&vhandle,work_out);
      v_clrwk(vhandle);
            
      points[0]=points[1]=0;
      points[2]=points[3]=239;
      
      points[4]=points[5]=80;
      points[6]=points[7]=319;
      
      vro_cpyfrm(vhandle,3, &srcMFDB,destMFDB);


For the screen one uses zeroed MFDBs,this works fine, i can copy parts of the screen without difficulty where it goes wrong is if i try to copy from a src offscreen

Code: Select all

      srcMFDB.IMAGE = map;
      srcMFDB.WIDTH = 1280;
      srcMFDB.HEIGHT = 1280;
      srcMFDB.WORDW = 80;
      srcMFDB.FLAG = 0;
      srcMFDB.PLANES =1;
      destMFDB.IMAGE = 0L;  /* To still copy to screen*/


where map[] is an array containing the image data for mono, this is all in hi-res.

I get nothing, nada, zip.

Now reading the net it seems as though there should be a second workstation assigned to the offscreen image? I've not really handled GEM much before and what would be really useful is an example of some code that works.
Last edited by AtariOwl on Mon Feb 08, 2016 9:57 am, edited 1 time in total.

User avatar
shoggoth
Nature
Nature
Posts: 848
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: vro_cpyfm

Postby shoggoth » Mon Feb 08, 2016 9:50 am

No need to open a second workstation for that.
- Which VDI are you using (fVDI is very picky on the order of the coordinates, for example)?
- Does "nothing" mean you get white space, or that nothing is copied at all?

I guess:
vro_cpyfrm(vhandle,3, &srcMFDB,destMFDB);

... is actually:
vro_cpyfrm(vhandle,3, &srcMFDB, &destMFDB);
Ain't no space like PeP-space.

AtariOwl
Atari freak
Atari freak
Posts: 55
Joined: Mon Nov 03, 2003 2:04 pm

Re: vro_cpyfm

Postby AtariOwl » Mon Feb 08, 2016 9:58 am

its NVDI 5


Now you raise a good point is that area of screen giving me a wite space or not writing anything.. i'll put something there and see if it it gets overwritten

Yes i get a white space, no matter what is in map[]

EDIT: OK it IS writing a white area over whatever i place there so its for some reason not seeing the srcMDFB image as i thought

User avatar
shoggoth
Nature
Nature
Posts: 848
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: vro_cpyfm

Postby shoggoth » Mon Feb 08, 2016 10:40 am

Try changing:
srcMFDB.FLAG = 0;
... to...
srcMFDB.FLAG = 1;
Ain't no space like PeP-space.

AtariOwl
Atari freak
Atari freak
Posts: 55
Joined: Mon Nov 03, 2003 2:04 pm

Re: vro_cpyfm

Postby AtariOwl » Mon Feb 08, 2016 10:44 am

Yes, i already tried that

i tried with a vr_trn_fm in between too, just on the off chance

No Luck though.

I should probably add what i tried

1. Changing FLAG status
2. Doing a vr_trn_fm in between
3. Matching src image file to blit size
4. Matching src image to screen size

None of these made any difference

User avatar
shoggoth
Nature
Nature
Posts: 848
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: vro_cpyfm

Postby shoggoth » Mon Feb 08, 2016 10:49 am

You do need to be in device dependent format either way though; both source and destination should have FLAG set to 1 (device dependent).

EDIT: OH! Sorry, I correct myself - it should be 0 (zero), I switched them in my head. So you're right.
Ain't no space like PeP-space.

User avatar
shoggoth
Nature
Nature
Posts: 848
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: vro_cpyfm

Postby shoggoth » Mon Feb 08, 2016 10:53 am

If you're comfortable with it, I could take a look at some more of the code to see if I spot something obvious there (pastebin or private or whatever)
Ain't no space like PeP-space.

AtariOwl
Atari freak
Atari freak
Posts: 55
Joined: Mon Nov 03, 2003 2:04 pm

Re: vro_cpyfm

Postby AtariOwl » Mon Feb 08, 2016 11:06 am

My issue is not with showing it, its that its on an STE and not on this PC... plus the code has kind of spread to become a bit of an unruly mess.
I should have been running it on an emulator or something, to make life easier.

I do appreciate the help.
I think i was just hoping there was an easy answer around... i looked online and it seems to be a question that's been asked a few times and there doesn't seem to be a satisfying answer anywhere.

Worst comes to worst i'll write some asm to do it but i kind of hoped VDI would let me do it simply as i'm not particularly concerned about speed, since i'm just writing a GEM Front End.


It's so frustrating that it works perfectly fine copying from the screen but AS SOON as i try to use and offscreen source... its just a white box.

Maybe i'll try writing to an offscreen block and see if its going ok in that direction?

User avatar
shoggoth
Nature
Nature
Posts: 848
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: vro_cpyfm

Postby shoggoth » Mon Feb 08, 2016 11:34 am

You're sure your source data is ok (and doesn't just contain zeroes)?
Ain't no space like PeP-space.

AtariOwl
Atari freak
Atari freak
Posts: 55
Joined: Mon Nov 03, 2003 2:04 pm

Re: vro_cpyfm

Postby AtariOwl » Mon Feb 08, 2016 11:44 am

Absolutely positive... i specifically put a check to printf some of the values after the blit

AtariOwl
Atari freak
Atari freak
Posts: 55
Joined: Mon Nov 03, 2003 2:04 pm

Re: vro_cpyfm

Postby AtariOwl » Mon Feb 08, 2016 12:02 pm

OK

It does not write anything to the offscreen buffer when dest is offscreen... the original data is remaining

Its either something to do with the pointing or just going outside the screen

User avatar
shoggoth
Nature
Nature
Posts: 848
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: vro_cpyfm

Postby shoggoth » Mon Feb 08, 2016 12:16 pm

And..

vro_cpyfrm(vhandle,3, &srcMFDB,destMFDB);

... is actually...

vro_cpyfrm(vhandle,3, points, &srcMFDB,&destMFDB);

?
Ain't no space like PeP-space.

AtariOwl
Atari freak
Atari freak
Posts: 55
Joined: Mon Nov 03, 2003 2:04 pm

Re: vro_cpyfm

Postby AtariOwl » Mon Feb 08, 2016 12:21 pm

yes i am sorry it is

User avatar
shoggoth
Nature
Nature
Posts: 848
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: vro_cpyfm

Postby shoggoth » Mon Feb 08, 2016 2:01 pm

AtariOwl wrote:yes i am sorry it is


It's a long shot - but what's in the three reserved fields in your MFDB source structure?
Ain't no space like PeP-space.

AtariOwl
Atari freak
Atari freak
Posts: 55
Joined: Mon Nov 03, 2003 2:04 pm

Re: vro_cpyfm

Postby AtariOwl » Mon Feb 08, 2016 2:06 pm

hmmmm

good point i've not done anything with them at all, not initialised or anything

ok i printf'd them... they are all 0

AtariOwl
Atari freak
Atari freak
Posts: 55
Joined: Mon Nov 03, 2003 2:04 pm

Re: vro_cpyfm

Postby AtariOwl » Mon Feb 08, 2016 2:40 pm

It's weird

If SrcMFDB.IMAGE is non 0.. 0's get blitted
if destMFDB.IMAGE is non 0 ... nothing gets blitted, at least not to the area i expect.

Its as if.. the pointer is somehow wrong?

short map[102400];

i even tried *map and &map

User avatar
shoggoth
Nature
Nature
Posts: 848
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: vro_cpyfm

Postby shoggoth » Mon Feb 08, 2016 3:41 pm

If I could just have some more of your code, I could help you debug it :)
Ain't no space like PeP-space.

User avatar
shoggoth
Nature
Nature
Posts: 848
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: vro_cpyfm

Postby shoggoth » Mon Feb 08, 2016 3:42 pm

Dumb question - you're using a monochrome resolution, right?
Ain't no space like PeP-space.

AtariOwl
Atari freak
Atari freak
Posts: 55
Joined: Mon Nov 03, 2003 2:04 pm

Re: vro_cpyfm

Postby AtariOwl » Mon Feb 08, 2016 3:42 pm

Yes, monochrome

its weird even if i change the parameters.. as soon as i set the IMAGE to 0.. it only matches the screen. so even if for example i set the src width to twice the screen it still copies the screen part exactly. As if putting a 0 in IMAGE forces it to match the screen.. and hmmmm

maybe it is a handle issue after all

AtariOwl
Atari freak
Atari freak
Posts: 55
Joined: Mon Nov 03, 2003 2:04 pm

Re: vro_cpyfm

Postby AtariOwl » Mon Feb 08, 2016 5:46 pm

ahhhhhhhh i'm looking through my lattice manual

and i see that the structure is

void *image,
short height... etc


i will try this

AtariOwl
Atari freak
Atari freak
Posts: 55
Joined: Mon Nov 03, 2003 2:04 pm

Re: vro_cpyfm

Postby AtariOwl » Mon Feb 08, 2016 6:01 pm

OK

That did it

Two errors

1. int instead of short for most of the block
2. Sheldon Leemon's book says
int *image
while Lattice C's manual says
void *image

Working now

Thank You for talking this through with me

User avatar
shoggoth
Nature
Nature
Posts: 848
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: vro_cpyfm

Postby shoggoth » Mon Feb 08, 2016 7:08 pm

Great! I guess Lattice has 32-bit INTs, then! I expected them to be 16-bit :)

void* image or short* image shouldn't really make a difference in this case.

Anyways - great! Now make something awesome!
Ain't no space like PeP-space.

User avatar
rudis
Captain Atari
Captain Atari
Posts: 153
Joined: Mon Feb 14, 2011 9:41 am
Contact:

Re: vro_cpyfm

Postby rudis » Mon Feb 08, 2016 7:35 pm

toshyp.atari.org is a good source for those things


Social Media

     

Return to “C / PASCAL etc.”

Who is online

Users browsing this forum: No registered users and 1 guest