.. _punchcard:

===============================================
Punch cards
===============================================

Once upon a time (through the 1970s) many computer programs were written on
punch cards of the type shown here [`image source
<http://commons.wikimedia.org/wiki/File:Blue-punch-card-front-horiz.png>`_]:

.. image:: images/punch-card.*

This is a form of binary memory (see :ref:`memory`)
where a specific set of locations each has a
hole punched (representing 1) or not (representing 0).

This particular card has had the sequence of ASCII characters typed on it so
that you can see the binary sequence the corresponds to each.

When programs were written on cards, one card was required for each line of
the program.  The early conventions of the :ref:`fortran` programming
language are related to the columns on a punch card.  
Only the first 72 columns were used for the program statements.  The last 8
columns could be used to print a card number, so that the unlucky programmer
who dropped a deck of cards had some chance of reordering them properly.
Many Fortran 77  compilers still ignore any characters beyond column 72 in a
line of a program, leading to bugs that can be hard to find if care is not 
taken, e.g. a called *xnew* might be truncated to *x* if the *x* is in
column 72.  If the program also uses a variable called *x*, this will not be
caught by the compiler.

Punch cards were a great step forward from *punched tape* `[wikipedia]
<http://en.wikipedia.org/wiki/Punched_tape>`_ where a long strip of paper
was used to store the entire program (and making a mistake required retyping
more than just one card).