G.I.S.T. for GFA pascal or c

GFA BASIC-related articles in here please

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

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

G.I.S.T. for GFA pascal or c

Post by charles »

hi anyone recall gist
and where would it be now ..

.im looking to obtain a copy please
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!
User avatar
Mug UK
Administrator
Administrator
Posts: 11904
Joined: Thu Apr 29, 2004 7:16 pm
Location: Stockport (UK)
Contact:

Re: G.I.S.T. for GFA pascal or c

Post by Mug UK »

It's buried on the Daily Double game disk - http://www.atarimania.com/game-atari-st ... 21205.html

Edit: Found it buried in a massive collection of .ST disk images. I've converted it to a .ZIP for you.
You do not have the required permissions to view the files attached to this post.
Main site: http://www.mug-uk.co.uk - digging up bits from my past: Atari ST, ZX Spectrum, Sega 8-bit (game hacks) and NDS (Music ripping guide). I host a C64 Radio Show for a mate, Max Hall, called the Chip SID Show.

I develop a free Word (for Windows) add-in for Word 2007 upwards. A toolbox that will allow power Word users to fix document errors. You can find it at: http://www.mikestoolbox.co.uk
User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 3132
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: G.I.S.T. for GFA pascal or c

Post by charles »

When i dont know how to google
i can always rely on good ole' muguk.....

many thanks mug!!!
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!
User avatar
dje
Atari nerd
Atari nerd
Posts: 48
Joined: Sat Apr 08, 2023 10:21 am

Re: G.I.S.T. for GFA pascal or c

Post by dje »

New GFA LIB for GIST

I took a look at the GFA example for GIST and found It didn't match the manual function names and contains at least one bug. ie: It sends a long to the asm command c:gt_prior.

So, I thought I'd write a documented GFA library, with an example and a soundboard for testing out all the effects. There are 52 GIST SND's in the zip and the soundboard supports up to 70. Just drag your creations into the SOUNDS/ folder.
grab0001.png
The library works with GFA v2.0+

Note: It is essential you add ON ERROR/ON BREAK routines to remove the GIST interrupt, which is pretty standard.

Cheers

Code: Select all

' ----------------------------------------------------------------------------
'
' GIST Library for GFA BASIC 2.0+
'
' ----------------------------------------------------------------------------
'
' @install_int will install the interrupt routine. The vector for
' the 200 Hz system timer interrupt routine is set to point to the
' sound interrupt routine. This routine MUST be called after @appl_init
' and before any of the below routines are called.
'
PROCEDURE install_int
  IF DIM?(gistdrvr%())=0
    OPEN "I",#1,"GISTDRVR.PRG"
    DIM gistdrvr%(3000\4)
    BGET #1,VARPTR(gistdrvr%(0)),LOF(#1)
    CLOSE #1
    LET install_int%=VARPTR(gistdrvr%(0))
    LET remove_int%=install_int%+148
    LET init_snds%=install_int%+176
    LET snd_on%=install_int%+210
    LET stop_snd%=install_int%+704
    LET snd_off%=install_int%+782
    LET get_prior%=install_int%+868
    VOID C:install_int%()
    @init_snds
  ENDIF
RETURN
'
' ----------------------------------------------------------------------------
'
' @remove_int will remove the interrupt routine. The 200 Hz system timer
' interrupt routine vector is returned to its normal location. This
' routine MUST be called prior to @appl_exit. None of the below routines
' should be called after this routine.
'
PROCEDURE remove_int
  IF DIM?(gistdrvr%())
    @init_snds
    VOID C:remove_int%()
    ERASE gistdrvr%()
  ENDIF
RETURN
'
' ----------------------------------------------------------------------------
'
' @init_snds will completely stop sound on all channels.
'
PROCEDURE init_snds
  VOID C:init_snds%()
RETURN
'
' ----------------------------------------------------------------------------
'
' @get_prior will return the priority of the requested voice. This
' routine is useful if you have a case where a @snd_off might turn off
' the wrong sound. You can call @get_prior and issue the @snd_off only
' if the priority matches the original.
'
' @get_prior(voice%)
'
' voice% = the voice whose priority is requested (0, 1 or 2)
'
' NOTE: type WORD is always returned
'
DEFFN get_prior(a%)=C:get_prior%(a%)
'
' ----------------------------------------------------------------------------
'
' @snd_on will play a sound that was created using GIST and stored as a
' GFA source code (DATA) on a channel of the GI chip.
'
' @snd_on(sndptr%,voice%,volume%,pitch%,priority%)
'
' sndptr%   = the pointer to the array of parameters known as
'             sound data, e.g., VARPTR(drwho%(0)).
'
' voice%    = the voice number corresponding to the GI channel number
'             0, 1, or 2. A -1 tells the sound driver to use any
'             available channel.
'
' volume%   = volume of the sound (0-15) or -1 to use volume
'             stored with sound data.
'
' pitch%    = the pitch of the sound. When playing sound effects,
'             (pitch = -1) the sound will play using the frequency value
'             in the sound data; the duration is determined by the
'             duration value in the sound data. A @snd_off will
'             automatically be issued when the duration has elapsed.
'             When playing musical tones, pitch (24-108) corresponds
'             to the semitone number.
'                 60 = middle C on a piano keyboard or 262 Hz;
'                 72 = one octave above;
'                 This is the same as MIDI pitch numbers.
'             The sound will remain on until a @snd_off is issued.
'             In other words, if pitch = -1, it is considered a sound effect.
'             If pitch is specified, it is considered a musical note.
'
' priority% = priority of the sound (0-32767) where the higher the value,
'             the higher the priority. Equal values take precedence over
'             each other.  When a @snd_off is issued, the priority is reduced
'             to zero during the release phase of any sound. Thus, priority
'             should normally set set to at least 1.
'
' The voice number used will be returned. If no voice was available, -1
' is returned (NOTE: type WORD is always returned
'
DEFFN snd_on(a%,b%,c%,d%,e%)=C:snd_on%(L:a%,b%,c%,d%,e%)
'
' ----------------------------------------------------------------------------
'
' @snd_off will cause the sound to move into its release phase and reduce
' the priority to zero.
'
' @snd_off(voice%)
'
' voice% = the voice which is to be moved into its release
'          phase (0, 1, or 2). Any other value has no effect.
'
PROCEDURE snd_off(voice%)
  VOID C:snd_off%(voice%)
RETURN
'
' ----------------------------------------------------------------------------
'
' @stop_snd will cause the sound to completely stop. No matter what phase
' the sound is in (attack, decay, sustain, or release), the sound will
' end. Unlike @snd_off, there is no release.
'
' @stop_snd(voice%)
'
' voice% = the voice which is to be stopped (0, 1 or 2).
'          Any other value has no effect.
'
PROCEDURE stop_snd(voice%)
  VOID C:stop_snd%(voice%)
RETURN
'
' ----------------------------------------------------------------------------
'
' @loadfile will load a file into an array of 32 bit ints.
' usage: @loadfile(*filedata%(),"filename.ext")
'
PROCEDURE loadfile(a%,filename$)
  SWAP *a%,result%()
  OPEN "I",#1,filename$
  DIM result%(LOF(#1)\4)
  BGET #1,VARPTR(result%(0)),LOF(#1)
  CLOSE #1
  SWAP *a%,result%()
RETURN
You do not have the required permissions to view the files attached to this post.
Atari STE 4160 / OMIKRON.BASIC 3.03-4.08
simonsunnyboy
Moderator
Moderator
Posts: 5600
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Re: G.I.S.T. for GFA pascal or c

Post by simonsunnyboy »

A port to C should be straight forward from what I see.
Mainly point some official functions to the entry points and provide a header file.
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: 2736
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: G.I.S.T. for GFA pascal or c

Post by lp »

dje wrote: Tue May 23, 2023 9:00 pm New GFA LIB for GIST
With TOS 2.06 DRVRDEMO.PRG and DRVRDEMO.TOS from the GIST disk crash. However, your SNDBOARD.PRG works fine. Thanks for that. There isn't anything fundamentally wrong with GIST itself. Whatever was used to build the original demos isn't system friendly.
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2610
Joined: Sun Aug 03, 2014 5:54 pm

Re: G.I.S.T. for GFA pascal or c

Post by ThorstenOtto »

simonsunnyboy wrote: Wed May 24, 2023 5:18 am A port to C should be straight forward from what I see.
Yes, it is ;) Attached is a simple attempt.

I noticed that in the original archive there are also examples for C and Pascal, but i don't find the external entry points to the driver. Therefor the C version used the same approach as GFA, loading the driver and getting function pointers from known offsets. Next task would be to disassemble the driver so that it can be directly linked (or inlined in GFA).

The example is also compilable by GCC, but you will have to use -mshort (and therefor link with libcmini). I didn't bother yet to try to get it work with 32bit ints.
You do not have the required permissions to view the files attached to this post.
User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2736
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: G.I.S.T. for GFA pascal or c

Post by lp »

GISTDRVR.PRG is PC-relative and works fine placed in an INLINE that is at least 3000 bytes.
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2610
Joined: Sun Aug 03, 2014 5:54 pm

Re: G.I.S.T. for GFA pascal or c

Post by ThorstenOtto »

It isn't pc-relative, but has a routine at the beginning to relocate itself ;) I think that might cause problems on 68030+ because the cache is not flushed.
User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2736
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: G.I.S.T. for GFA pascal or c

Post by lp »

Figured since it didn't bomb it must be pc-relative. lol My mistake.
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2610
Joined: Sun Aug 03, 2014 5:54 pm

Re: G.I.S.T. for GFA pascal or c

Post by ThorstenOtto »

@dje: which GFA version did you use to compile the program? I tried GBE, with only minor changes: the DEFLIST and DEFWRD directives, because they cannot be compiled. But i also have a strange bug with the newly compiled version: i get garbage on the screen where the mouse pointer originally was located, apparently from some hide mouse call. That does not happen with your version.

What i also noticed: calling init_snds from your install_int and remove_int functions isn't neccessary. The function in the gistdrvr.prg already does that.

Another thing i noticed: although the sound files are 112 byte each, the original example allocates 122 for each sound. Don't know yet whether that is necessary.

Edit: and another oddity: the interrupt routine turns of keyclick in conterm ($484), and restores it at the end of the irq. The value that is restored is the value of conterm at the time the interrupt was installed. So if you really want to turn keyclick off in your sndboard program, you must do that *before* installing the interrupt routine. Although it seems that it is not strictly neccessary, due to the timers behaviour.
User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2736
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: G.I.S.T. for GFA pascal or c

Post by lp »

Indeed DEFLIST seems to be a show stopper. Perhaps that needs fixed. DEFINT and friends are correctly handled though. Mouse handling in GBE isn't automatic like the original, it must be hidden and shown as required.
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2610
Joined: Sun Aug 03, 2014 5:54 pm

Re: G.I.S.T. for GFA pascal or c

Post by ThorstenOtto »

Ah, right, only deflist has to be removed. The mouse problem can be fixed by moving the hidem call before the "CLS".
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2610
Joined: Sun Aug 03, 2014 5:54 pm

Re: G.I.S.T. for GFA pascal or c

Post by ThorstenOtto »

Attached is a new and slightly optimized version. In the orig folder, you will also find C-Sources of the driver that can be compiled by Alcyon to produce an exact copy of gistdrvr.prg (still have to figure out yet the meanings of some of the values in the sound struct).

The new version uses a different approach than the original one, the offsets to the various routines are defined at the start of the text segment, so you don't have to change your code if the driver changes.

Things that need to be done:
  • build a library from the source that you can just link to your sources, instead of loading the driver separately.
  • Find out the details of the various variables. That needs some closer look at what the interrupt routine does.
  • Get rid of the trap #9 routine that is currently used by the C-Part to access the sound registers (i think that can simply be replaced by a call to Giaccess)
I also think that the driver program should be renamed, otherwise it will just crash your machine if you accidently run it from the desktop (it will run straight into the "install_int" function, but then terminate, leaving the Timer-C interrupt pointing into nirwana).

Edit: forgot to mention, the interface routines in gistlib.c should also support gcc without -mshort now, but i haven't tested it yet.
You do not have the required permissions to view the files attached to this post.
User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2736
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: G.I.S.T. for GFA pascal or c

Post by lp »

I contacted the GIST author and inquired about the original source code and he said it was long gone. He then gave me the contact info for the guy listed as helping with design thinking he might still have a copy. Contacted that guy and he to has lost all the files. He also granted me permission to use it in GBE without hesitation, but to be 100% sure I sent him another email and ask if your reconstructed sources could be preserved on github. He wrote back "no problem".

Thorsten, you are free to publish it on github if you like. The author seems to have moved on years ago and I don't think he knows much about software licenses and all that, so do as you see fit. I would request however that the initial page clearly notes the original authors and the old software companies. Maybe you could break it into folders, like \original, \updated, \testcases, and perhaps \disk with the contents of the original disk.
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2610
Joined: Sun Aug 03, 2014 5:54 pm

Re: G.I.S.T. for GFA pascal or c

Post by ThorstenOtto »

Thanks for looking into it. Too bad that original source code is lost, eventually source of the actual gist application would also be of interest (but that's beyond the scope of this project).

I will publish my work soon. Maybe in the meantime, someone can take a look at the current version, and try to figure out what all the variables in the sound structure are for.
User avatar
Kirkman
Captain Atari
Captain Atari
Posts: 168
Joined: Fri Sep 03, 2010 2:29 am

Re: G.I.S.T. for GFA pascal or c

Post by Kirkman »

Wow, this all sounds pretty awesome. Wonder if having a C implementation of the source would be helpful to Larry Mears as he continues polishing his IGS v2.19 for release.

FWIW, I've got some GIST music and sound (via IGS) in the BBS login sequence I've been working on:

https://youtu.be/Ymii4HSuqt0
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2610
Joined: Sun Aug 03, 2014 5:54 pm

Re: G.I.S.T. for GFA pascal or c

Post by ThorstenOtto »

Uploaded now. You can find it at https://github.com/th-otto/gist
User avatar
charles
10 GOTO 10
10 GOTO 10
Posts: 3132
Joined: Tue Aug 17, 2004 12:11 am
Location: ont. Canada
Contact:

Re: G.I.S.T. for GFA pascal or c

Post by charles »

otto try comparing gists variables to stos replay
similar routines ?
know it had alot of functions. reverse reverse points play repeat
.i cant remember..
just writing in with what i think
The radioactive half-life : )
Atari is a lifestyle,not a hobby.
HOLD ON ! ! ! Im printing unreadable characters ...!
Post Reply

Return to “GFA BASIC”