How to write data into an array, then read and print to screen ???

159 views
Skip to first unread message

Walt Perko

unread,
Sep 6, 2022, 6:00:04 PM9/6/22
to Altair-Duino
Hi, 

BASIC 80 manuals are only half the needed info at best ...

Every BASIC 80 manual I can find;

10 DIM A(20)
20 FOR I = 0 TO 20
30 READ A(I)
40 NEXT I

But how do I fill the array with "I"?  

How do I PRINT DIM A(X)?  


Jay Falck - GMail

unread,
Sep 6, 2022, 6:12:02 PM9/6/22
to Walt Perko, Altair-Duino

Change line 30 to be 30 A(I) = I

 

50 FOR I = 0 TO 20

60   PRINT A(I)

70 NEXT I

--
You received this message because you are subscribed to the Google Groups "Altair-Duino" group.
To unsubscribe from this group and stop receiving emails from it, send an email to altair-duino...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/altair-duino/ef8683c3-e4e6-4860-998a-f328a3e74912n%40googlegroups.com.

Tom Lake

unread,
Sep 6, 2022, 6:38:12 PM9/6/22
to Altair-Duino
If you want to fill the array with the element number I in every element, then just do this:


10 DIM A(20)
20 FOR I = 0 TO 20
30 A(I) = I
40 NEXT I

A(0) will contain 0, A(1) will contain 1, A(2) will contain 2, etc.

If you want all elements to have the same number than do this

5 N=7
10 DIM A(20)
20 FOR I = 0 TO 20
30 A(I) = N
40 NEXT I

Then array A will be filled with the number 7. Replace the number in line 5 with whatever number you want in the array.

Walt Perko

unread,
Sep 6, 2022, 7:03:31 PM9/6/22
to Altair-Duino
Hi, 

I almost think that it's time to write a new BASIC-80 reference manual, unless there is one I haven't found.  

Jay's and even better Tom's examples are better than the four or five manuals I've been using so far!  

Are there any newer references for how to use BASIC 80 commands?  

Tom Wilson

unread,
Sep 6, 2022, 7:05:58 PM9/6/22
to Walt Perko, Altair-Duino
Back in the 80s and 90s, there were whole college classes on BASIC. I'm sure you can still find lots of textbooks on the subject out there on Amazon, as well as PDF versions on the less ethical sites. 

I've been thinking of writing my own Programming In BASIC guide for the Commander X16. It wouldn't take much to adapt that to BASIC-80 and BASIC-85, as well. 

--
You received this message because you are subscribed to the Google Groups "Altair-Duino" group.
To unsubscribe from this group and stop receiving emails from it, send an email to altair-duino...@googlegroups.com.

peterq...@gmail.com

unread,
Sep 7, 2022, 11:09:44 AM9/7/22
to Altair-Duino
This is the book I learned from back in the 1970s https://www.amazon.com/Instant-freeze-dried-computer-programming-BASIC/dp/0918398576/ref=sr_1_3?crid=3CVRU772ZEEHJ&keywords=%22instant+basic%22&qid=1662563198&sprefix=instant+basic+%2Caps%2C146&sr=8-3

FYI the READ statement is for reading from DATA statements. I never really saw the point of DATA statements - they always seemed like a holdover from punch cards.

Walt Perko

unread,
Sep 7, 2022, 12:24:24 PM9/7/22
to Altair-Duino
Hi, 

That book is for people that don't know how to do anything.  The book starts with how to use the PRINT statement, I'm into page 25 and the book is still showing how to use the PRINT statement.  At this rate the book is too small as it will need a few thousand pages to cover all the BASIC statements.  

Sadly, the PDF on archive.org is only image scans so each page loads slowly in my browser and so far I cannot do a search through the book.  I did see both 1st and 2nd edition on eBay not too expensive.  

What people like me need, is something that shows simple straight forward examples of how to use each statement sans all the fluff, but each way each statement can be used.  The BASIC-80 manual I guess expects a teacher to do that and just shows part of the statement uses.  
Message has been deleted

Walt Perko

unread,
Sep 7, 2022, 1:18:14 PM9/7/22
to Altair-Duino
Hi, 

In the BASIC-80 manuals I have ... and I have several variations they all do the same thing.  This is all they show about the DIM statment!  

They don't show how to fill an array, how to setup a multi-dimensional array etc.  I know most of the tricks to the PRINT statement, maybe not all, but at least a book that just shows the variations of each statement without all the extra gobbledegook would be a good book!  

Where is the link to the  Microsoft Mbasic-80 manual that is so good?  
  

BASIC-80 DIM Statement.jpg



On Wednesday, September 7, 2022 at 9:45:47 AM UTC-7 furba...@gmail.com wrote:
===
That book is for people that don't know how to do anything.  The book starts with how to use the PRINT statement, I'm into page 25 and the book is still showing how to use the PRINT statement.  At this rate the book is too small as it will need a few thousand pages to cover all the BASIC statements.  
===

No you should actually read those areas you find simplistic because the print statement in basic is much more powerful then you think it is. there is a reason why its so extensive and while much of it might be known to you there are functions it can do that you most likely have never used, understood or have seen before.

in order to follow the author of a book you have to take it from the beginning to understand his way of teaching/explaining. much of it might be a chore to get through but you should at least remind yourself of it because you will be coming back to it later.

example is the MS Mbasic-80 manual:

The Microsoft Mbasic-80 manual is actually really good; 

The problem is you have to understand what the hell they are talking about before you even read it.

In fact just about every manual from the era of early computing into the early 1980s comes from the standpoint of the user already knows what is going on and the manual just needs a little guidance.

This was because its from a time when the people playing around with home micro computers were grad students, or already highly skilled in the field of computers.

The computers most of us were exposed to as kids came after this time when they were translating things so a layman could understand it.

today you don't need any type of real manual or guidance to use a computer or application because its been designed that way.

because of how GOOGLE works its impossible to really search for early 1980s Basic and its examples.

what you need to do is search for GWBASIC and QBASIC examples. that will lead you to sites like PETE'S Qbasic site.

GWbasic and MBasic 5.0+ are basically the same, minus the GPL functions you can adapt GWBASIC code back to Mbasic and you can adapt Qbasic code back to Mbasic when you use it as Pseudo code.
that gives you enough combined with the MBasic-80 manual to port basic programs, and questions and more examples come from sites like Pete's you will find.

now there are books for GWbasic that are a great reference :

Programming in GW-BASIC by P. K. McBride (Author)

Advanced Graphics with the IBM Personal Computer 1st Edition by Ian O. Angell  (Author)

these books again start off for the beginner but quickly advance through complex topics.

now your thinking what in the world does IBM graphics and GWbasic have to do with a 1977 Altair that does not have a graphics card (unless you want to bring the Dazzler into this)?

its simply this: the ASCII Terminal card gives you most of the graphics functions of IBM BASIC 1.0 and BASIC 2.0
sending serial characters is really no different then sending instructions to some Nvidia Graphics card on a modern PC.
once you understand you can express an advanced 3d graphics shape as a series of String characters it becomes child's play 
just like when your sending VT100 escape codes to allow a cursor to move around. its the terminal display itself and what it can do that gives the computer a lot of power.

that little graphics patch i made for the terminal I/O massively increases the capabilities of the ASCII terminal much like a TEK terminal except the ASCII Terminal is WAY WAY Faster and you can even go to a ESP32 terminal emulator adding full color display.

and it all comes back to the amazing functions of the basic PRINT command, so read through and refresh your memory its actually has merit.
Message has been deleted

Walt Perko

unread,
Sep 7, 2022, 2:29:46 PM9/7/22
to Altair-Duino
Hi, 

You haven't read my initial question, and you didn't see that I got two good answers from two members here, and that's my complaint about that book for 5 year-olds as being mostly gobbledegook rather than a good book for learning BASIC-80.  

When I look at the little program where it say's; 30 READ A(I) ... all I thought after that was WRITE A(I) ... and that doesn't work.  It's the same kind of problem as a 4,000 year old pyramid puzzle ... how the human brain works.  

The BASIC-80 manual should include a few more examples for each instruction sans a lot of gobbledegook.  

e.g.,  
DIM Statement works like this;

Declare the array:  
DIM A(20) reserves 20 spaces for the array elements.

INPUT data into the array:  
FOR I = 0 TO 19
LET DIM A = I  data IN
          = calculated data
          = INPUT "Array Data =";X
NEXT I

FOR  I = 0 TO 19
DIM A(I) = DATAOUT
NEXT I

FOR  I = 0 TO 19
READ DIM A(I)
NEXT I

There maybe more examples, but these little bits are much easier to see and understand than paragraphs of gobbledegook.  

That is the kind of book needed.  



On Wednesday, September 7, 2022 at 10:46:37 AM UTC-7 furba...@gmail.com wrote:
yes and the code provided is the framework.

its creating a Dimensioned array of 21 integers because it starts from zero unless you tell it all arrays must start from 1 which is OPTION BASE.

next it is reading information from the  data statement that would be later in the program not shown.
thus filling Array A 0 to 20 with data integer information.

so it is filling the array

from there you could read back the information by accessing the loaded array.
STUFF=A(1)
print stuff
or print A(15) would output the data stored at that point in the array.

So if i added to that example 

100 data 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21


10 DIM A(20),B(5)                                                              
20 FOR I=0 TO 20                                                                

30 READ A(I)                                                                    
40 NEXT I                                                                      
100 DATA 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21


then ran the program and typed PRINT A(20) by hand it would return 21

because its been loaded into the array at line 30 inside the loop that filled in the array with data.
 
a two dimensional array is  DIM A(20,20)

a three DIM A(20,20,20)

thus i could access a 3 dimensional array as print A(1,4,10)
if you wanted 2 arrays
DIM A(20,20,20),B(10)


the manual is good, it not easy to understand given; because you don't know what your looking at.

In this case you would have to look up the READ Section 2.54 and then  DATA  to understand everything.

now there are ton of different version of the MBASIC 5.XX manual some more complete then others, some have all the the appendix some do not, some have the additional BASCOM manual  some have the additional Linker manual and might have the M80 compiler as well.

there are a few versions of the manual that cover advanced disk functions and lay out a really nice simple inventory program that a store in the early 1980s would of killed for.
there is also some accounting programs buried in some manuals that could be adapted for complex book keeping and formatted output via the printer.

However they are all the same on explaining the functions and commands as you have seen.

What will happen is you will learn by examples, find a beginner book then go back to the MBASIC manual and have more of an understanding what is going on, then you realize it was telling you same information.

these early manuals all expect the person to have a understanding of what is going on and they skip over the introduction and get right to it.

Roger Linhart

unread,
Sep 7, 2022, 2:31:21 PM9/7/22
to Walt Perko, Altair-Duino
Just thought I would chime in with:

Along the lines of what John is saying. Manuals are almost always intended as reference. You really need to know what you're looking for and to be able to understand concepts it documents. There are rare exceptions. Many Commodore 64 Users learned programming with the included Users Manual. You will continue to experience frustration until you find a good instructional text that will teach you the basic concepts that will allow you to use the manuals.



--
Roger Linhart
Portland, OR  97230
Mobile: 541-690-8560
Reply all
Reply to author
Forward
Message has been deleted
0 new messages