TIP: Click on subject to list as thread! ANSI
echo: quik_bas
to: RYAN POTETZ
from: DAVID WILLIAMS
date: 1998-04-16 09:46:00
subject: DATA statements

-> that *I* want them to.  I was wondering how programs work that
-> contain only DATA statements.
->
-> Ex. DATA
-> &h3C,&h66,&h6E,&h6E,&h60,&h62,&h3C,&h00,&h18,&h3C,&h66,&h7E,&h66,&h66
-> 66,&h00
-> DATA
-> &h7C,&h66,&h66,&h7C,&h66,&h66,&h7C,&h00,&h3C,&h66,&h60,&h60,&h60,&h66
-> 3C,&h00
Well, normally DATA are used in conjunction with READ and maybe RESTORE
commands. The DATA are information that the program will *use*, maybe to
fill an array with the lengths (numbers of days) of the months of the
year or something of the sort. So the program would contain coding such
as:
DIM Month_length%(12)
FOR Count% = 1 TO 12
    READ Month_length%(Count%)
NEXT
DATA 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
The information in the DATA could have been stored some other way, for
example in a separate disk file, but BASIC allows it to be put right
into the program.
Sometimes, DATA statements are used to hold a bunch of numbers that
would comprise a small machine-language program if they were POKEd into
memory, and that is what is done with them when the BASIC program is
run. Very often, numbers that are intended for this purpose are
expressed in hexadecimal form, which is the case in the example you
gave. So my first guess is that these DATA statements are a machine
language program.
However, the DATA statements would be no good on their own. There would
still have to be some READ and POKE statements to go with them. Maybe
what you have is not a complete BASIC program but a module that is
intended to be merged into other programs as they are written. Someone
has written a handy bit of machine language, and expressed it in DATA
form. It can then be merged into all kinds of other programs, which
would include the READ and POKE commands to use the DATA.
That's my guess...!
                             dow
--- PCBoard (R) v15.3 (OS/2) 5
---------------
* Origin: FidoNet: CAP/CANADA Support BBS : 416 287-0234 (1:250/710)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.