[Coco] MC-10/CoCo BASIC - why did I code this way?

Bill Gunshannon bill.gunshannon at hotmail.com
Thu Dec 28 14:47:11 EST 2017


Don't know why someone would do that.
It is really easy to write your program so that the DATA does not reside
in program and string space when run.
10 DATA  "A","B","C"
20 READ A$,B$,C$
30 PRINT A$,B$,C$
40 DEL 10
50 PRINT A$,B$,C$
99 END

bill

________________________________
From: Coco <coco-bounces at maltedmedia.com> on behalf of Allen Huffman <alsplace at pobox.com>
Sent: Thursday, December 28, 2017 2:26 PM
To: CoCoList for Color Computer Enthusiasts
Subject: [Coco] MC-10/CoCo BASIC - why did I code this way?

I was working on a text adventure called The Oddyssey. It was being coded so it could run on a CoCo or an MC-10.

I found the program, and it was all mapped out with commands and such, just waiting for objects and descriptions.

But I see weird things in the code. I load up arrays manually, like this:

100 NM$(0)=“aaa”:NM$(1)=“xxx”:NM$(2)=“yyy”

I know there were some Extended Color BASIC commands the MC-10 didn’t have, so we were making sure to only use things available on the MC-10.

I thought maybe the MC-10 didn’t have READ/DATA, or couldn’t READ in to arrays. Using the online www.mc-10.com<http://www.mc-10.com> emulator, I saw it does support that.

So why would I chose to do it manually? I assume this is a faster way to load the variables than READ/DATA, but I wonder if there was more.

My thought:

I knew strings could live in program code, or in string memory. Perhaps I did NOT know that strings could print IN to code, and assumed:

10 READ A$
20 DATA “THIS IS A STRING”

...would result in “THIS IS A STRING” being in the program space, PLUS a copy in string memory.

That’s the only thing I can think of.

Was there any other reason why someone would EVER manually load an array in BASIC like that? Seems awfully inefficient to me, now, and would have back then since I was well aware of READ/DATA.

Thoughts?

                — A



--
Coco mailing list
Coco at maltedmedia.com
https://pairlist5.pair.net/mailman/listinfo/coco


More information about the Coco mailing list