Block copy functions in C

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

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

JonB
Captain Atari
Captain Atari
Posts: 303
Joined: Fri Dec 02, 2011 5:01 pm

Block copy functions in C

Postby JonB » Mon Aug 06, 2012 1:27 pm

What I want is a block copy like GFA BASIC's GET & PUT functions. Would be nice to use a system call (or even the Blitter chip, ho ho) but the API isn't well documented - or rather I haven't found it yet. Anyway it is more fun to write your own by memcpy direct to Physbase (start address of the screen). Anyway too much fiddling about setting up system calls; why can't it be simple?
Too many retro computers here: 1040STfm, Mega4, Ultrasatanx2 , Amiga A500, A500+ and A1200, Acorn Atom x2, BBC Micro, Electron, Spectrum 48k x2, +48, +128k, QL, Oric Atmos, ZX81, Memotech MTX512, Amstrad 6128 x2..

User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12673
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: offscreen bitmap help

Postby wongck » Mon Aug 06, 2012 11:35 pm

Actually the NVDI v4 programmer guide documented it well & so I was able to follow it (after some time).
Just the making of the bitmap is new, else all drawings to it uses standard VDI calls using the correct handle ( ie the bitmap handle return by the bitmap make function).
My Stuff: FB/Falcon CT63 CTPCI ATI RTL8139 USB 512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list

JonB
Captain Atari
Captain Atari
Posts: 303
Joined: Fri Dec 02, 2011 5:01 pm

Re: offscreen bitmap help

Postby JonB » Tue Aug 07, 2012 10:58 am

OK.. I have a copy of the Atari Compendium as well as GEM programmer's reference (Abacus), Atari ST Internals (Abacus), Learning C ("Programming Graphics on the Amiga and Atari ST" - covering the 16 bit bases, LOL), Atari ST Peeks & Pokes (Abacus), Atari ST Machine Language (Abacus) and Real Time 3D graphics for the Atari ST (a machine code programming book). I wonder where to start? :D
Too many retro computers here: 1040STfm, Mega4, Ultrasatanx2 , Amiga A500, A500+ and A1200, Acorn Atom x2, BBC Micro, Electron, Spectrum 48k x2, +48, +128k, QL, Oric Atmos, ZX81, Memotech MTX512, Amstrad 6128 x2..

User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12673
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: offscreen bitmap help

Postby wongck » Tue Aug 07, 2012 12:13 pm

Are you going to use C ?
I assume you are.

Have you done any C programming for GEM ?
The compendium & references do not really tell you how to program in C, they are, as called, a reference.
You should start with C programming for GEM.
My Stuff: FB/Falcon CT63 CTPCI ATI RTL8139 USB 512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list

JonB
Captain Atari
Captain Atari
Posts: 303
Joined: Fri Dec 02, 2011 5:01 pm

Re: offscreen bitmap help

Postby JonB » Tue Aug 07, 2012 2:14 pm

Hello wongck

Yes, I wrote a GEM application long ago for an HND project. It was called ELGAR ("Electronic Logic Gate AnalyseR") and it allowed you to draw logic circuits and test them. However in those days I was somewhat suspicious of pointers, not having understood them all that well, so they tended to be used only when absolutely necessary (for example, when an API mandated a pointer in its argument list, or returned a pointer). It was done using Megamax C v1.0 and only ran on monochrome monitors (well, it ran in colour devices too, but the screen size was hardcoded so it drew the gate arrays partially off the screen).

This took three weeks of 12 hour days to complete as it was delivered with all the proper documentation. Well, I say "all" but I did not deliver the detailed design document; no time. Despite that I still got a Merit for it (should have been a Distinction but the lecturer refused on the grounds that I hadn't attended any of the review meetings). Even so, his jaw dropped when he saw the drag & drop functionality in action, which you use to move gates around the display for the purposes of prettying it up - ha!

I wouldn't hold it up as an exemplar of GEM programming, but it *is* a GEM program, having a menu bar and a sort of window. Should have implemented it as a proper window with scroll bars and buttons, but I cheated...

If you have a monochrome monitor I will upload it and you can have a play...
Too many retro computers here: 1040STfm, Mega4, Ultrasatanx2 , Amiga A500, A500+ and A1200, Acorn Atom x2, BBC Micro, Electron, Spectrum 48k x2, +48, +128k, QL, Oric Atmos, ZX81, Memotech MTX512, Amstrad 6128 x2..

User avatar
mfro
Atari Super Hero
Atari Super Hero
Posts: 791
Joined: Thu Aug 02, 2012 10:33 am
Location: SW Germany

Re: offscreen bitmap help

Postby mfro » Tue Aug 07, 2012 3:35 pm

Then you should be familiar with making VDI calls. Drawing to NVDI offscreen bitmaps is no different to drawing to the screen. You need to open another physical workstation (using the offscreen drivers workstation number) doing GDOS calls and then use the VDI calls available through the corresponding driver to draw to it.

Once you're finished, you just use the VDI raster copy functions to blit the final result from the offscreen device to your screen device (virtual screen workstation).

User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12673
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: offscreen bitmap help

Postby wongck » Tue Aug 07, 2012 11:27 pm

JonB wrote:I wouldn't hold it up as an exemplar of GEM programming, but it *is* a GEM program, having a menu bar and a sort of window. Should have implemented it as a proper window with scroll bars and buttons, but I cheated...

That's great !!! :D :thumbs:
So you know about eventmulti, events, dialogbox objects, objects control etc etc.... actually to get all those in context is the hard part.
But once u get it, it is easy to visualise.
mfro wrote:Drawing to NVDI offscreen bitmaps is no different to drawing to the screen.

Yes, the trick is understand that you need to get a handler to that bitmap. Then you use normal VDI calls with that handler.
Actually, this is the thing to do with a printer, so it is no difference in using a bitmap like a device. :wink:

Just remember to get that bitmap handler.... it was this that makes everything fall into place for me.
(notice how I asked a stupid question in my posting above... before I realised it :lol: :lol: ).
My Stuff: FB/Falcon CT63 CTPCI ATI RTL8139 USB 512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list

User avatar
simonsunnyboy
Moderator
Moderator
Posts: 5080
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Re: Block copy functions in C

Postby simonsunnyboy » Wed Aug 08, 2012 3:30 pm

*Moderator note* I have splitted the thread as this goes into other directions. Hijacking threads is not nice. But Keep discsussing here in the new thread.
Simon Sunnyboy/Paradize - http://paradize.atari.org/

Stay cool, stay Atari!

1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee

User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 2462
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: Block copy functions in C

Postby charles » Sun Aug 12, 2012 12:58 pm

yes mfro is right ,
use the raster(pixel block) copy command of the vdi

a.k.a
vrt_cpyfm()
or
vro_cprfm()

charles
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!

JonB
Captain Atari
Captain Atari
Posts: 303
Joined: Fri Dec 02, 2011 5:01 pm

Re: Block copy functions in C

Postby JonB » Sun Aug 12, 2012 7:57 pm

simonsunnyboy wrote:*Moderator note* I have splitted the thread as this goes into other directions. Hijacking threads is not nice. But Keep discsussing here in the new thread.


Err... you talking to me? I'm hijacking my own thread! LOL

Anyway... care to post a link to the other thread...? :)
Too many retro computers here: 1040STfm, Mega4, Ultrasatanx2 , Amiga A500, A500+ and A1200, Acorn Atom x2, BBC Micro, Electron, Spectrum 48k x2, +48, +128k, QL, Oric Atmos, ZX81, Memotech MTX512, Amstrad 6128 x2..


Social Media

     

Return to “C / PASCAL etc.”

Who is online

Users browsing this forum: No registered users and 3 guests