A problem shared by both DOS and ST versions of GFA-Basic?

GFA BASIC-related articles in here please

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

Hartzok
Atarian
Atarian
Posts: 6
Joined: Sun Jul 02, 2006 6:07 pm

A problem shared by both DOS and ST versions of GFA-Basic?

Postby Hartzok » Tue Jul 04, 2006 5:32 pm

Hello everyone

I've been trying to find a general GFA-Basic forum on the web, but I could only find this forum for the ST, and since it probably has a lot in common with the DOS version, I thought I might give it a try.

I'm trying to do full-screen 3D graphics, but I can't find a SetActivePage or SetDisplayPage command in the text help file that I've read. Is it really true that you can't flip pages with this compiler? I'm working on EGA graphics mode, so there is plenty of room for video pages. How can I implement flicker-free full-screen animation?

I've thought of a way, which is to write graphics commands that act directly on the string array that gets to be put on the screen, but I know nothing about the way the compiler stores images, when you execute the GET command. Could you give me some pointers, and explain how the image gets stored in the array, and how I can process it? I'm not really used to working with strings. Thanks.

lowdensity
Atari maniac
Atari maniac
Posts: 89
Joined: Tue Jun 27, 2006 11:50 pm
Location: Portland, Oregon

Postby lowdensity » Tue Jul 04, 2006 6:05 pm

By 3D graphics, do you mean virtual objects that have been ray-traced from hypothetical distances against virtual backgrounds, or do you mean 3D graphics - as in anaglyphic red and green graphics, where you put on those blue glasses?

The reason I was asking, is that I once bought a game for a PC compatible because it supposedly had 3D graphics, and instead of anaglyphic 3D graphics, all it had was objects that were contoured with ray-traced backgrounds and reflections.

Hartzok
Atarian
Atarian
Posts: 6
Joined: Sun Jul 02, 2006 6:07 pm

Postby Hartzok » Tue Jul 04, 2006 6:27 pm

Just simple, solid-polygon filled 3d graphics on a 2D plane, no glasses required, no parallax, no stereoscopic projection, not even ray-tracing. Just 3D cubes. The basics.

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

Postby simonsunnyboy » Tue Jul 04, 2006 6:31 pm

"SetActivePage or SetDisplayPage" - the ST version of GFABASIC has no such functions. On the Atari ST you can achieve those with either using the XBIOS call Nr. 5 Setscreen or by manipulating the video hardware directly.
I could tell you how to do this but it won't help you as it simply won't work under DOS.
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
simonsunnyboy
Moderator
Moderator
Posts: 5015
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Postby simonsunnyboy » Tue Jul 04, 2006 6:36 pm

Code: Select all

'
' SWITCH - routines and small library for usage of a doublebuffered screen
' (c) 2005 by Simon Sunnyboy / Paradize         http://paradize.atari.org/
'
' This routine gives you two additional screens in memory so you
' can draw a picture on one screen while displaying another.
' Additionally you get a third screen as a buffer for a background
' or to scroll things around.
'
' I used similar routines for about 10 years but I never bothered
' to make a library or include file out of it.
' USE AT YOUR OWN RISK!
'
' call initpage23 once at the start of your program
' make sure to call reset23 even in case of error (ON ERROR GOSUB ...)
' or you probably will disturb normal screen management
'
> PROCEDURE initpage23
  LOCAL hilf2%,hilf3%
  ' get address of current screen, it is reused by our routines!
  physbase%=XBIOS(2)
  oldphysbase%=physbase%
  ' get memory for two additional screens
  ' feel free to rewrite it to use MALLOC() :)
  res32s2$=STRING$(32256,"0")
  res32s3$=res32s2$
  hilf2%=VARPTR(res32s2$)
  hilf3%=VARPTR(res32s3$)
  logbase%=(hilf2%+256) AND &HFFFFFF00
  background%=(hilf3%+256) AND &HFFFFFF00
  '
  CLS
  scopy(physbase%,logbase%)
  scopy(physbase%,background%)
RETURN
' scopy(src%,dest%)
' coyp contents of screen src% to screen dest%
> PROCEDURE scopy(pagea%,pageb%)
  BMOVE pagea%,pageb%,32000
RETURN
' switch()
' use this to flip screens
' screen physbase% is displayed, draw things to logbase%
' GFA commands will from now on automatically draw to logbase%
> PROCEDURE switch
  VSYNC
  SWAP physbase%,logbase%
  ~XBIOS(5,L:logbase%,L:physbase%,L:-1)
RETURN
' switch_background()
' use this to flip screens and copy your third background to the
' new workscreen in one go
> PROCEDURE switch_background
  VSYNC
  SWAP physbase%,logbase%
  ~XBIOS(5,L:logbase%,L:physbase%,L:-1)
  scopy(background%,logbase%)
RETURN
' draw_hidden()
' show screen physbase% but draw to screen logbase%
> PROCEDURE draw_hidden
  ~XBIOS(5,L:logbase%,L:physbase%,L:-1)
RETURN
' draw_normal()
' show and draw to physbase% (all GFA output is directly visible)
> PROCEDURE draw_normal
  ~XBIOS(5,L:physbase%,L:physbase%,L:-1)
RETURN
' reset23()
' clean up and go back to the initial screen
> PROCEDURE reset23
  ~XBIOS(5,L:oldphysbase%,L:oldphysbase%,L:-1)
RETURN


This is a small lib howto achieve flip screens on the Atari ST with GFABASIC. (Yes one can allocate the memory via GEMDOS, I know - it is in strings for simplicity in this lib)

On your GET problem, dunno about the DOS version.
The ST versions stores 3 words describing screen mode, width and height, followed by the bitplane data. The latter one comes as words as well due to the structure of the Atari ST video memory.
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
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2357
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Postby lp » Tue Jul 04, 2006 9:01 pm

The ST version does not share any such problems with the DOS version. In fact they are only syntax compatible at the base level of the language. GFA totally recoded it for DOS and it deviates quite a lot from the ST version.

My advice to you is to visit:
http://gfa-basic.liebenstein.de/index_en.htm

This is the only active group for GFA that can deal with non-ST issues. Someone there with real GFA DOS experience might be able to better help you.

Good luck.

Hartzok
Atarian
Atarian
Posts: 6
Joined: Sun Jul 02, 2006 6:07 pm

Postby Hartzok » Tue Jul 04, 2006 11:09 pm

Hey, thanks for the code and for the advice. Unfortunately for me, and upon examination of the code, it seem that it will take some assembler/hardware knowledge to solve the problem in the DOS version. I got as far as using a BIOS interrupt call to select the active display page, but GFA kept drawing to the same address as before (I should 've known better:)). You seem to redirect the drawing routines using an XBIOS() command, which should be equivalent to some form of BIOS interrupt call. Here it is:

~XBIOS(5,L:logbase%,L:physbase%,L:-1)

This is the key for redirecting graphics, right? Let me check if there is something similar in the DOS version's command listing.

I've joined the mailing-list, maybe they will be able to give more specific information on this. Thanks again.

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2357
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Postby lp » Wed Jul 05, 2006 12:29 am

The ST happens to share the same BIOS() calls as the PC due to its roots in CP/M. However XBIOS implies eXtended BIOS and I suspect you won't find this exact call on the PC as these where added by Atari to deal with the ST's hardware.

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

Postby simonsunnyboy » Wed Jul 05, 2006 6:44 am

Hartzok wrote:Hey, thanks for the code and for the advice. Unfortunately for me, and upon examination of the code, it seem that it will take some assembler/hardware knowledge to solve the problem in the DOS version. I got as far as using a BIOS interrupt call to select the active display page, but GFA kept drawing to the same address as before (I should 've known better:)). You seem to redirect the drawing routines using an XBIOS() command, which should be equivalent to some form of BIOS interrupt call. Here it is:

~XBIOS(5,L:logbase%,L:physbase%,L:-1)

This is the key for redirecting graphics, right? Let me check if there is something similar in the DOS version's command listing.


Well, you have two address pointers in memory. One is used to instruct the video hardware from where to fetch the screen contents. The other is used for the graphic commands to tell them where to manipulate the screen contents. If both addresses are the same, changes are directly visible. If they are different, you draw without seeing the change.
The XBIOS command above sets those address pointers.

It should be similar on PC.
Simon Sunnyboy/Paradize - http://paradize.atari.org/

Stay cool, stay Atari!

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


Social Media

     

Return to “GFA BASIC”

Who is online

Users browsing this forum: No registered users and 3 guests