This convenience had a downside: if the line numbers were spaced out in
a meaningful way so that part of the work was done beginning at 100, an-
other segment beginning at 200, and so on, that thoughtful segmentation
would be obliterated. In any case, RENUMBER was not provided with the
version of BASIC that shipped on the Commodore 64.
One variant of this program, which was published in the Commodore-
speciﬁc magazine RUN, uses 8 as its line number. This makes this variant of
the program more concise in its textual representation, although it does not
change its function and saves only one byte of memory—for each line of
BASIC stored in RAM, two bytes are allocated for the line number, whether
it is 1 or the maximum value allowed, 63999. The only savings in memory
comes from GOTO 10 being shortened to GOTO 8. Any single digit includ-
ing 1 and even 0 could have been used instead. Line number variation
in the RUN variants attests to its arbitrariness for function, demonstrating
that 10 was a line-numbering convention, but was not required. That 8 was
both arbitrary and a speciﬁc departure from convention may then suggest
speciﬁc grist for interpretation. For a one-line program that loops forever,
it is perhaps appealing to number that line 8, the endlessly looping shape
of an inﬁnity symbol turned upon its side. However, whether the program
is numbered 8 or 10, the use of a number greater than 0 always signals that
10 PRINT (or 8 PRINT) is, like Barthes’s “work,” “a fragment of substance,”
partial with potential for more to be inserted and with the potential to be
extended (Barthes 1977, 142).
Why are typed line numbers required at all in a BASIC program? Pro-
grams written today in C, Perl, Python, Ruby, and other languages don’t
use line numbers as a language construct: they aren’t necessary in BASIC
either, as demonstrated by QBasic and Visual Basic, which don’t make use
of them. If one wants a program to branch to a particular statement, the
language can simply allow a label to be attached to the target line instead
of a line number. Where line numbers particularly helped was in the act of
editing a program, particularly when using a line editor or without access to
a scrolling full-screen editor. The Commodore 64 does allow limited screen
editing when programming in BASIC: the arrow keys can be used to move
the cursor to any visible line, that line can be edited, and the new version of
the line can be saved by pressing RETURN. This is a better editing capabil-
ity than comes standard on the Apple II, but there is still no scrollback (no
ability to go back past the current beginning of the screen) in BASIC on the
10 PRINT CHR$(205.5+RND(1)); : GOTO 10
Commodore 64. Line numbers provide a convenient way to get back to an
earlier part of the program and to list a particular line or range of lines. Typ-
ing a line number by itself will delete the corresponding line, if one exists in
memory. The interactive editing abilities that were based on line numbers
were well represented even in very early versions of BASIC, including the
ﬁrst version of the BASIC that ran on the Dartmouth Time-Sharing System.
Line numbers thus represent not just an organizational scheme, but also an
interactive affordance developed in a particular context.
The space between the line number 10 and the keyword PRINT is actually
optional, as are all of the spaces in this program. The variant line 10PRINT
CHR$(205.5+RND(1));:GOTO10 will function exactly as the standard 10
PRINT with spaces does. The spaces are of course helpful to the person
trying to type in this line of code correctly: they make it more legible and
Even in this exceedingly short program, which has no variables (and
thus no variable names) and no comments, the presence of these optional
spaces indicates some concern for the people who will deal with this code,
rather than merely the machine that will process it. Spaces acknowledge
that the code is both something to be automatically translated to machine
instructions and something to be read, understood, and potentially modi-
ﬁed and built upon by human programmers. The same acknowledgment
is seen in the way that the keywords are presented in their canonical form.
Instead of PRINT the short form ? could be used instead, and there are
Commodore-speciﬁc two-character abbreviations that allow the other key-
words to be entered quickly (e.g., GOTO can typed as G followed by SHIFT-
O.) Still, for clarity, the longer (but easier-to-read) version of these keywords
is shown in this program, as it is in printed variants.
The statement PRINT causes its argument to be displayed on the screen.
The argument to PRINT can take a variety of forms, but here it is a string
that is in many ways like the famous string “HELLO WORLD.” In PRINT
“HELLO WORLD” the output of the statement is simply the string literal, the
C# Word - Word Conversion in C#.NET
Word documents in .NET class applications independently, without using other external third-party dependencies like Adobe Acrobat. Word to PDF Conversion. adding text to pdf in acrobat; adding a text field to a pdf
text between double quotes. The string in the maze-generating program is
generated by a function, and the output of each PRINT execution consists
of only a single character, but it is nevertheless a string.
Today the PRINT command is well known, as are many similarly
named print commands in many other programming languages. It is easy
to overlook that, as it is used here, PRINT does not literally “print” anything
in the way the word normally is used to indicate reproduction by marking
a medium, as with paper and ink—instead, it displays. To send output to a
printer, PRINT must be followed by # and the appropriate device number,
then a comma, and then the argument that is to be printed. By default,
without a device number, the output goes to the screen—in the case of the
Commodore 64, a television or composite video monitor.
When BASIC was ﬁrst developed in 1964 at Dartmouth College, how-
ever, the physical interface was different. Remarkably, the language was
designed for college students to use in interactive sessions, so that they
would not have to submit batch jobs on punch cards as was common at
the time. However, the users and programmers at Dartmouth worked not
at screens but at print terminals, initially Teletypes. A PRINT command
that executed successfully did actually cause something to be printed. Al-
though BASIC was less than twenty years old when a version of it was made
for the Commodore 64, that version nevertheless has a residue of history,
leftover terms from before a change in the standard output technology.
Video displays replaced scrolls of paper with printed output, but the key-
word PRINT remained.
This function takes a numeric code and returns the corresponding charac-
ter, which may be a digit, a letter, a punctuation mark, a space, or a “char-
acter graphic,” a nontypographical tile typically displayed alongside others
to create an image. The standard numerical representation of characters in
the 1980s, still in wide use today, is ASCII (the American Standard Code
for Information Interchange), a seven-bit code that represents 128 char-
acters. On the Commodore 64 and previous Commodore computers, this
representation was extended, as it often was in different ways on different
systems. In extensions to ASCII, the other 128 numbers that can be rep-
resented in eight bits are used for character graphics and other symbols.
C# Excel - Excel Conversion & Rendering in C#.NET
Excel documents in .NET class applications independently, without using other external third-party dependencies like Adobe Acrobat. Excel to PDF Conversion. add text to pdf in acrobat; add text fields to pdf
10 PRINT CHR$(205.5+RND(1)); : GOTO 10
The Commodore 64’s character set, which had been used previously on the
Commodore PET, was nicknamed PETSCII.
The complement to CHR$ is the function ASC which takes a quoted
character and returns the corresponding numeric value. A user who is curi-
ous about the numeric value of a particular character, such as the capital
letter A, can type PRINT ASC("A") and see the result, 65. A program can
also use ASC to convert a character to a numeric representation, perform
arithmetic on the number that results, and then convert the new number
back to a character using CHR$. In lowercase mode, this can be used to
shift character between uppercase and lowercase, or this sort of manipula-
tion might be used to implement a substitution cipher.
Character graphics exist as special tiles that are more graphical than
typographical, more like elements of a mosaic than like pieces of type to
be composed on a press. That is, they are mainly intended to be assem-
bled into larger graphical images rather than “typeset” or placed along-
side letters, digits, and punctuation. But these special tiles do exist in a
typographical framework: a textual system, built on top of a bitmapped
graphic display, is reused for graphical purposes. This type of abstraction
may not be a smooth, clean way of accomplishing new capabilities, but it
represents a rather typical way in which a system, adapted for a new, par-
ticular purpose, can be retroﬁtted to do something else.
CHR$ and RND are both functions, so the keyword is followed in both cases
by an argument in parentheses. CHR$ ends with the dollar sign to indicate
that it is a string function (it takes a numeric argument and returns a string),
while RND does not, since it is an arithmetic function (it takes a numeric
argument and returns a number). The parentheses here also make clear
the order of arithmetic operations. For instance, RND(1-2) is the same as
RND(-1), while RND(1)-2 is two subtracted from the whatever value is
returned by RND(1).
All math in Commodore BASIC is done on ﬂoating point numbers (num-
bers with decimal places). When an integer result is needed (as it is in the
case of CHR$), the conversion is done by BASIC automatically. If this value,
205.5, were to be converted into an integer directly, it would be truncated
(rounded down) to become 205. If more than .5 and less than 1 is added to
205.5, the integer result will be 206.
This means the character printed will either be the one correspond-
ing to 205 or the one corresponding to 206:
. A quirk of the Com-
modore 64 character set is that these two characters, and a run of several
character graphics, have two numeric representations. Characters 109 and
110 duplicate 205 and 206, meaning that 109.5 could replace 205.5 in this
program and the identical output would be produced.
This symbol indicates addition, of course. It is less obvious that this is the
addition of two ﬂoating point numbers with a ﬂoating point result; Com-
modore 64 BASIC always treats numbers as ﬂoating point values when
it does arithmetic. The ﬁrst number to be added is 205.5; the second is
whatever value that RND returns, a value that will be between 0 and 1. On
the one hand, because all arithmetic is done in ﬂoating point, ﬁguring out
a simple 2 + 2 involves more number crunching and takes longer than it
would if integer arithmetic was used. On the other hand, the universal use
of ﬂoating point math means that an easy-to-apply, one-size-ﬁts-all math-
ematical operation is provided for the programmer by BASIC. Whether
the programmer wishes to add temperatures, prices, tomato soup cans, or
anything else, “+” will work.
The mathematical symbol “+” originated, like “&,” as an abbreviation
for “and.” As is still conventional on today’s computers, the Commodore
64 has a special “plus” or addition key but does not have any way to type
a multiplication sign or a division sign. While they appear in some eight-bit
codes that extend ASCII and in Unicode, the multiplication and division
signs are absent from ASCII and from PETSCII. Instead, the asterisk (*) and
the slash, virgule, or solidus (/) are used. Given the computer’s develop-
ment as a machine for the manipulation of numbers, it is curious that typo-
graphical symbols have to be borrowed from their textual uses (“*” indicat-
ing a footnote, “/” a line break or a juxtaposition of terms) and pressed
into service as mathematical symbols. But this has to do with the history
of computer input devices, which in early days included teletypewriters,
10 PRINT CHR$(205.5+RND(1)); : GOTO 10
devices that were not originally made for mathematical communication.
This function returns a (more or less) random number, one which is between
0 and 1. The number returned is, more precisely, pseudorandom. While the
sequence of numbers generated has no easily discernible pattern and is
hard for a person to predict, it is actually the same sequence each time.
This is not entirely a failing; the consistent quality of this “random” output
allows other programs to be tested time and time again by a programmer
and for their output to be compared for consistency.
It is convenient that the number is always between 0 and 1; this allows
it to easily be multiplied by another value and scaled to a different range. If
one wishes to pick between two options at random, however, one can also
simply test the random value to see if it is greater than 0.5. Or, as is done
in this program, one can add 205.5 and convert to an integer so that 205 is
produced with probability 0.5 and 206 with probability 0.5.
More can be said about randomness, and much more is said in the
chapter on the topic.
When RND is given any positive value (such as this 1) as an argument, it pro-
duces a number using the current seed. This means that when RND(1) is
invoked immediately after startup, or before any other invocation of RND, it
will always produce the same result: 0.185564016. The next invocation will
also be the same, no matter which Commodore 64 is used or at what time,
and the next will be the same, too. Since the sequence is deterministic, the
pattern produced by the 10 PRINT program, when run before any other
invocation of RND, is a complex-looking one that is always the same.
Using a semicolon after a string in a PRINT statement causes the next
string to be printed immediately after the previous one, without a newline
or any spaces between them. Other options include the use of a comma,
which moves to the next tab stop (10 spaces), or the use of no symbol at
all, which causes a new line to be printed and advances printing to the next
line. Although this use of the semicolon for output formatting was not orig-
inal to BASIC, the semicolon was introduced very early on at Dartmouth, in
version 2, a minor update that had only one other change. The semicolon
here is enough to show that not only short computer programs like this
one, but also the languages in which they are written, change over time.
The colon separates two BASIC statements that could have been placed
on different lines. In a program like this on the original Dartmouth version
of BASIC, each statement would have to be on its own line, since, to keep
programs clear and uncluttered, only a single statement per line is allowed.
The colon was introduced by Microsoft, the leading developer of micro-
computer BASIC interpreters, as one of several moves to allow more code
to be packed onto home computers.
This is an unconditional branch to the line indicated—the program’s only
line, line 10. The GOTO keyword and line number function here to return
control to an earlier point, causing the ﬁrst statement to be executed end-
lessly, or at least until the program is interrupted, either by a user pressing
the STOP key or by shutting off the power.
GOTO, although not original to BASIC, came to be very strongly asso-
ciated with BASIC. A denunciation of GOTO is possibly the most-discussed
document in the history of programming languages; this letter (discussed
in the “Regularity” chapter) plays an important part in the move from un-
structured high-level languages such as BASIC to structured languages
such as ALGOL, Pascal, Ada, and today’s object-oriented programming
languages, which incorporate the control structures and principles of these
Once a BASIC program is entered into the Commodore 64, it is set into
motion, executed, by the RUN command. Until RUN is typed, the program
10 PRINT CHR$(205.5+RND(1)); : GOTO 10
lies dormant, full of potential but inert. RUN is therefore an essential token
yet is not itself part of the program. RUN is what is needed to actualize the
In a similar fashion, describing the purpose of each of the twelve to-
kens in 10 PRINT does address the underlying complexity of the program.
A token-by-token explanation is like a clumsy translation from BASIC into
English, naively hewing to a literal interpretation of every single character.
Translation can happen this way, of course, but it glosses over nuance,
ambiguity, and most important, the cultural, computational, and historical
depth hidden within this one line of code. Plumbing those depths is pre-
cisely the goal of the rest of this book. The rest of this book is the RUN to
the introduction here. So, as the Commodore 64 says . . .
PLaN OF ThE bOOk
The more general discussions in this book are organized in ﬁve chapters
and a conclusion. Preceding each of the ﬁve chapters and before the con-
clusion are six “Remarks.” These are more speciﬁc discussions of particular
computer programs directly related to 10 PRINT; they are programs that
the authors have found or (in the spirit of early Commodore 64 BASIC
programmers, who were encouraged to modify, port, and elaborate code
and who often did so) ones that the authors have developed to shed light
on how 10 PRINT works. These remarks are indicated with “REM” to refer
to the BASIC statement of that name, one that allows programmers to use
a line of a program to write a remark or comment, such as 55 REM START
OF MAIN LOOP.
The ﬁrst chapter, Mazes, offers the cultural context for reading a maze
pattern in 1982. The chapter plumbs cultural and scientiﬁc associations
with the maze and some of the history of mazes in computing as well.
Regularity, the second chapter, considers the aspects of 10 PRINT that
repeat in space, in time, and in the program’s ﬂow of control. The aesthetic
and computational nature of repetition is discussed as well as the interplay
between regularity and randomness. The third chapter, Randomness, of-
fers a look at cultural uses and understandings of randomness and chance,
as they are generated in games, by artists, and in simulations. It aims to
Documents you may be interested
Documents you may be interested