[CODE] Falcon TrueColor video for GFABASIC

GFA BASIC-related articles in here please

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

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

[CODE] Falcon TrueColor video for GFABASIC

Postby simonsunnyboy » Tue May 15, 2007 2:10 pm

I've finished a small library for GFABASIC which gives you 320x240 Truecolor video on the Falcon, both on RGB and VGA.
Fast routines for pixel access are not included!

Download the attached ZIP, load the inline code in place and test :)

Newbies take note: this code DOES NOT allow usage of GFA graphic commands once the videomode has been setup.

The code will exit properly on plain ST.

It even runs in Hatari Falcon emulation :D

Code: Select all

'
' Falcon TrueColor Video for GFABASIC
' (c) 2007 by Simon Sunnyboy / Paradize
'
' Use at your own risk!
'
HIDEM
INLINE tcvideomode%,1718
RESERVE 200000
'
falcon!=FALSE
fehler$=""
oldphysbase%=XBIOS(2)
ON ERROR GOSUB errorhandler
ON BREAK GOSUB endit
screenmemory%=MALLOC(153856)
IF screenmemory%=0
  PRINT "NOT ENOUGH MEMORY!"
  RESERVE
  ~INP(2)
  EDIT
ENDIF
physbase%=AND(ADD(screenmemory%,255),&HFFFFFF00)
'
' setup videomode in supervisor - will set Word tcvideomode%+8 to
' &hffff if this is a Falcon - saves videl settings
~XBIOS(38,L:tcvideomode%)
'
IF WORD{tcvideomode%+8}=0
  ~INP(2)
ELSE
  falcon!=TRUE
  ~XBIOS(5,L:physbase%,L:physbase%,L:-1)
  ' CLS and _ALL_ gfa graphics commands do not work anymore until you
  ' restore the video mode
  ' thank god, TC video is chunky :)
  '
  '
  FOR i%=0 TO 639 STEP 2
    WORD{physbase%+i%}=WORD(0)  ! clear 1st scanline
  NEXT i%
  ' clear remaining scanlines
  FOR i%=1 TO 239
    BMOVE physbase%,physbase%+i%*640,640
  NEXT i%
  '
  FOR i%=0 TO 639 STEP 2
    WORD{physbase%+i%}=WORD(&HF000) ! draw red pixels
  NEXT i%
  '
  FOR x%=0 TO 639 STEP 2
    VSYNC                       ! spend some time to make sure OS is intact
    WORD{physbase%+640+x%}=WORD(&H1F)
  NEXT x%
  ~INP(2)
  '
ENDIF
'
endit
'
PROCEDURE errorhandler
  fehler$=ERR$(ERR)
  GOSUB endit
RETURN
PROCEDURE endit
  IF falcon!
    ~XBIOS(38,L:tcvideomode%+4)
  ENDIF
  '
  ~XBIOS(5,L:oldphysbase%,L:oldphysbase%,L:-1)
  '
  IF fehler$>""
    ~FORM_ALERT(1,fehler$)
  ENDIF
  ~MFREE(screenmemory%)
  RESERVE
  '
  SHOWM
  EDIT
RETURN
[/code]
You do not have the required permissions to view the files attached to this post.
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: 5020
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Postby simonsunnyboy » Tue May 15, 2007 2:12 pm

I forgot:
GEM is goosed up as a whole and ALERT, FILESELECT and mouse pointer don't work as long as TC is active. TC is too slow anyway ;)
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