Words/Long Words

GFA BASIC-related articles in here please

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

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

Words/Long Words

Postby paul92706 » Fri Aug 02, 2013 3:47 pm

Can some please explain the use and meaning of Words: and LongWords:. All i pretty much know is W: consist of 2 bytes and L: consist of 4 bytes and that (XBIOS) functions use them often. The GFA book doesn't give a good explanation on these 2 functions. Thanks kindly
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
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 11927
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: Words/Long Words

Postby wongck » Sat Aug 03, 2013 3:51 am

The only longest word I know is Smiles.... a mile between the 2 'S'.

Sorry.... hope it brings a smile to you after all the time spend looking for the real meaning of long words in GFA. :angel:
My Stuff: FB/Falcon CT63+CTPCI_ATI_RTL8139 14+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

FedePede04
Atari Super Hero
Atari Super Hero
Posts: 936
Joined: Fri Feb 04, 2011 12:14 am
Location: Denmark
Contact:

Re: Words/Long Words

Postby FedePede04 » Sat Aug 03, 2013 7:15 am

Byte : 8 Bit Signed: From −128 to 127 Unsigned 0-255
Word : 16 Bit Signed: From -32768 to 32767 Unsigned 0-65535 in memory 64k memory size or memory addressing
Long Word 32 Bit Signed: From 2.147.483.648 to 2.147.483.648 Unsigned 4.294.967.295 in memory 4096Mb or memory addressing

so why the Xbios use a lot of long word is for memory addressing...
Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend :)

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

Re: Words/Long Words

Postby lp » Sat Aug 03, 2013 11:10 am

System calls are very specific on the size of each parameter. Whatever documentation you have on the system calls should say the size of each parameter. Thus you have to pass the parameters in the correct size. This is where W: and L: are used. Obviously L: forces the parameter to be passed as a 4 byte long and W: as a 2 byte word. If they are omitted GFA assumes word size.

Example: GEMDOS fread function

Code: Select all

bytes_read%=GEMDOS(63,W:handle&,L:count%,L:address%)
bytes_read%=GEMDOS(63,handle&,L:count%,L:address%) !gfa applies W: to handle& automatically


If you pass them using the wrong sizes, you can expect all sorts of strange behavior and/or crashes.

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

Re: Words/Long Words

Postby paul92706 » Sat Aug 03, 2013 3:13 pm

wongck wrote:The only longest word I know is Smiles.... a mile between the 2 'S'.

Sorry.... hope it brings a smile to you after all the time spend looking for the real meaning of long words in GFA. :angel:

Hehehe! ah yes you did bring me a great big smile wongck!
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
paul92706
Atari God
Atari God
Posts: 1341
Joined: Mon Apr 25, 2011 4:28 am
Location: Orange, CA

Re: Words/Long Words

Postby paul92706 » Sat Aug 03, 2013 3:19 pm

FedePede04 wrote:Byte : 8 Bit Signed: From −128 to 127 Unsigned 0-255
Word : 16 Bit Signed: From -32768 to 32767 Unsigned 0-65535 in memory 64k memory size or memory addressing
Long Word 32 Bit Signed: From 2.147.483.648 to 2.147.483.648 Unsigned 4.294.967.295 in memory 4096Mb or memory addressing

so why the Xbios use a lot of long word is for memory addressing...

so basically Word would equal 2bytes and Longword would equal 4bytes.
example 128,64,32,16,8,4,2,1 signed
128+64+32+16+8+4+2+1=256 unsigned
so in binary something like 10000000= 128
11111111=256
something along that road no?
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

FedePede04
Atari Super Hero
Atari Super Hero
Posts: 936
Joined: Fri Feb 04, 2011 12:14 am
Location: Denmark
Contact:

Re: Words/Long Words

Postby FedePede04 » Sat Aug 03, 2013 4:25 pm

paul92706 wrote:so basically Word would equal 2bytes and Longword would equal 4bytes.

thet look right

paul92706 wrote:example 128,64,32,16,8,4,2,1 signed

not quiet 64,32,16,8,4,2,1 in sign bit 7 determines if it is sign or not 0-127 positive and $ff-$80 negative .
$ff=-1 $fe=-2 ect.

paul92706 wrote:128+64+32+16+8+4+2+1=256 unsigned

yes :)

paul92706 wrote: so in binary something like 10000000= 128
11111111=256
something along that road no?

yes the about is correct if use as unsign number.
i don't remember anything about GFA basic, to many years since, but in asm it is control among others by the different jmp types.

like
BGE branch on greater than or equal . signed comparisons
BHS branch on higher than or same . Unsigned comparisons
Atari will rule the world, long after man has disappeared

sometime my English is a little weird, Google translate is my best friend :)


Social Media

     

Return to “GFA BASIC”

Who is online

Users browsing this forum: No registered users and 1 guest