by vmarsy · 10y ago · 0 comments
This is odd that these comments aren't in the github source code, is it missing something? Why does it starts at line 940?
940 REM The IBM Personal Computer Donkey
950 REM Version 1.10 (C)Copyright IBM Corp 1981, 1982
960 REM Licensed Material - Program Property of IBM 10 PRINT "1"
30 PRINT "2"
20 GOTO 10
What would print out? Just a bunch of "1"s or "12"s?The thing is that basic programs were not entered through a 2D text-editor per rather line per line. You would type "LIST" to re-read the whole program you typed so far, with the lines in the correct order. Then, you would enter a line starting with a number. It would overwrite any existing line with the same number.
Typically, a way to correct the program you wrote would be to type:
30
15 PRINT "2"
(replace the line 30 by an empty line, and insert a line number 15)
LIST
command, the interpreter would return 10 PRINT "1"
20 GOTO 10
30 PRINT "2"
You don't have to type LIST to reorder the lines, that just shows the re-ordering to you. If you didn't type LIST, but did type RUN (with the "unordered" listing) the interpreter would run each line in sequence of line number.If you ran out of line numbers you could sometimes RENUMber the listing.
Here's Stackoverflow:
This question is marked as a duplicate: http://stackoverflow.com/questions/2435488/why-basic-had-num...
Here's the closed question it's marked as a duplicate of: http://stackoverflow.com/questions/541421/why-did-we-bother-...
10 PRINT "1" 20 GOTO 10 30 PRINT "2"
The reason this is allowed is because it let you rewrite existing programs; if you later entered
10 PRINT "Hello World"
It would replace the original line 10 and use this one instead.
So you can see that they added the copyright and SAMPLES$ logic later.
This is the improved 1982 version.
http://www.pcjs.org/devices/pcx86/machine/5150/cga/64kb/donk...