Go Down

Topic: Algorithm to rotate data (Read 2249 times) previous topic - next topic

Krupski


Quote
Basic uses 1-based arrays.

I know that
Code: [Select]
90     get #1,c+b // read byte "offset + index"
But that's not an array - it's file, isn't it?


The "get" command gets one byte from the file pointer "1" at index "c+b" and stores it in the string variable "d$". Then, using "asc(d$)" gives me the value of the byte. For example, if the byte at file location 24 was the letter "A", I would get this:

* get #1, 24
* (now d$ == "A")
* asc(d$) == 65 (a.k.a. 0x41)

Let's say the first 8 bytes of the font file are 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07.

The result would be:

fin(0) == 0
fin(1) == 1
fin(2) == 2
......
fin(6) == 6
fin(7) == 7

See? fin() in BASIC is the same thing as fin[] in C. At the top of the program where I do "dim fin(8)" is the same thing as "char fin[8];" in C.

Make sense?

Gentlemen may prefer Blondes, but Real Men prefer Redheads!

johncc


Quote
Basic uses 1-based arrays.

I know that
Code: [Select]
90     get #1,c+b // read byte "offset + index"
But that's not an array - it's file, isn't it?

Ok, Basic uses 1-based random-access-files :)

AWOL

Makes a bit of sense, but all this swapping between zero and unity origin indexing is crazy.
Why isn't it consistent?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

johncc


Makes a bit of sense, but all this swapping between zero and unity origin indexing is crazy.
Why isn't it consistent?


That *is* a rhetorical question, right?

http://c2.com/cgi/wiki?ZeroAndOneBasedIndexes

AWOL

I think I'm beginning to understand Dijkstra's comments about BASIC and brain-damage   ]:D
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Krupski


I think I'm beginning to understand Dijkstra's comments about BASIC and brain-damage   ]:D


Quote
"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration." -- EwDijkstra
Gentlemen may prefer Blondes, but Real Men prefer Redheads!

dhenry

Quote
"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration." -- EwDijkstra


It is surprising that such an elitist view comes within the Arduino community, given that both Arduino / BASIC are largely motivated by dumbing down things for newcomers.


AWOL

I didn't realise Dijkstra was a member of this community, and given that he died over ten years ago, he must've been a pre-founding father.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

PeterH


It is surprising that such an elitist view comes within the Arduino community, given that both Arduino / BASIC are largely motivated by dumbing down things for newcomers.


If you're familiar with Basic then I'm surprised that you're surprised that it is treated so scornfully.
I only provide help via the forum - please do not contact me for private consultancy.

Docedison

#24
Jan 14, 2013, 12:38 am Last Edit: Jan 14, 2013, 12:51 am by Docedison Reason: 1
The Hardest thing I have to do is "Unlearn" what I learned to do in basic.. This, compounded by several years with Basic Stamps and the Picaxe and their severe limitations to finally drive me here to learn what a real, embeddable and useful controller can be and how to work with it as well.
Because of both my engineering background and my basic familiarity with basic as I wrote apps to run on a '386 from the command line with Micro$oft's PDS 7.1 and my later experience designing process controllers for the Irrigation industry (I specified and tested but did not write the Pic firmware)..
learning C and C++ has been a battle that I am slow to win but winning it I am.

Bob
{Edit RKJ}
--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

Go Up