Descriptor

GFA BASIC-related articles in here please

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

User avatar
paul92706
Atari God
Atari God
Posts: 1340
Joined: Mon Apr 25, 2011 4:28 am
Location: Orange, CA

Descriptor

Postby paul92706 » Wed Jun 05, 2013 2:14 am

Can some please elaborate a little on how does a string of characters is stored in the first four bytes of a descriptor, using function ARRPTR. I understand a max of 32768 characters can be stored in a string variable.
Atari Falcon CT60/CTPCI 14MB+ 512mb ATI9250 + NetUSBee
Atari Falcon030 CF 4gb + NetUSBee+ 14MB Ram
Atari TT030 2meg STRAM/16meg TTRAM + Nova Adaptor +Maxtor SCSI HD + DaynaPort Pocket SCSI

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

Re: Descriptor

Postby rudis » Wed Jun 05, 2013 7:04 pm

If i remember well.. It is described in the Compiler manual. (I dont have on, sorry)

User avatar
paul92706
Atari God
Atari God
Posts: 1340
Joined: Mon Apr 25, 2011 4:28 am
Location: Orange, CA

Re: Descriptor

Postby paul92706 » Wed Jun 05, 2013 8:09 pm

rudis wrote:If i remember well.. It is described in the Compiler manual. (I dont have on, sorry)

hi rudis thanks for your reply. Do you think theres an online manual somewhere? thanks kindly :D
Atari Falcon CT60/CTPCI 14MB+ 512mb ATI9250 + NetUSBee
Atari Falcon030 CF 4gb + NetUSBee+ 14MB Ram
Atari TT030 2meg STRAM/16meg TTRAM + Nova Adaptor +Maxtor SCSI HD + DaynaPort Pocket SCSI

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

Re: Descriptor

Postby lp » Wed Jun 05, 2013 8:31 pm

A string descriptor is 6 bytes.

<4 byte long><2 byte word>
pointer to the string data followed by the length

If you want the address of the string data use VARPTR() and LEN() for the size.
You can get the same data from the descriptor, but it takes more work.

User avatar
paul92706
Atari God
Atari God
Posts: 1340
Joined: Mon Apr 25, 2011 4:28 am
Location: Orange, CA

Re: Descriptor

Postby paul92706 » Thu Jun 06, 2013 3:13 pm

The master of GFA, thanks lonn. How are strings/numeric values stored in the four bytes of the descriptor using binary? and is the address of the descriptor stored in the four bytes? if that makes sense? thanks
Atari Falcon CT60/CTPCI 14MB+ 512mb ATI9250 + NetUSBee
Atari Falcon030 CF 4gb + NetUSBee+ 14MB Ram
Atari TT030 2meg STRAM/16meg TTRAM + Nova Adaptor +Maxtor SCSI HD + DaynaPort Pocket SCSI

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

Re: Descriptor

Postby lp » Fri Jun 07, 2013 12:31 am

I would not mess with the descriptor. Not sure why GFA gives access to them as they are used internally by GFA to manage string memory. If you alter a descriptor, it will usually lead to a crash. If you want info about a string:

Code: Select all

t$="test"
address%=VARPTR(t$)
length&=LEN(t$)

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

Re: Descriptor

Postby simonsunnyboy » Fri Jun 07, 2013 2:21 pm

lp wrote:I would not mess with the descriptor. Not sure why GFA gives access to them as they are used internally by GFA to manage string memory. If you alter a descriptor, it will usually lead to a crash. If you want info about a string:

Code: Select all

t$="test"
address%=VARPTR(t$)
length&=LEN(t$)


Second that! From a plain user point of view these are the only necessary operations for string memory. All other things should be done with the address% or proper string functions like MID$, LEFT$ etc.
Simon Sunnyboy/Paradize - http://paradize.atari.org/ - STOT: http://www.npoi.de/stot/

Stay cool, stay Atari!

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

Jabber: simonsunnyboy@atari-jabber.org

User avatar
paul92706
Atari God
Atari God
Posts: 1340
Joined: Mon Apr 25, 2011 4:28 am
Location: Orange, CA

Re: Descriptor

Postby paul92706 » Fri Jun 07, 2013 8:18 pm

lp wrote:I would not mess with the descriptor. Not sure why GFA gives access to them as they are used internally by GFA to manage string memory. If you alter a descriptor, it will usually lead to a crash. If you want info about a string:

Code: Select all

t$="test"
address%=VARPTR(t$)
length&=LEN(t$)


thats what exactly happened to me, crash! I will just stick with V:(var).Descriptors seem a lil more tricky to use.
Atari Falcon CT60/CTPCI 14MB+ 512mb ATI9250 + NetUSBee
Atari Falcon030 CF 4gb + NetUSBee+ 14MB Ram
Atari TT030 2meg STRAM/16meg TTRAM + Nova Adaptor +Maxtor SCSI HD + DaynaPort Pocket SCSI


Social Media

     

Return to “GFA BASIC”

Who is online

Users browsing this forum: No registered users and 1 guest