Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
IBM 1401
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Booting and sample program== When the '''LOAD''' button on the 1402 Card Read-Punch is pressed, a card is read into memory locations 001β080, a word mark is set in location 001 to indicate that it is an executable instruction, the word marks in locations 002-080 (if any) are cleared, and execution starts with the instruction at location 001. That is always the {{wt|en|dyadic}} ''Set Word Mark'', to set word marks on the two following words (instructions). A single ''Set Word Mark'' instruction can set two word marks but requires one word mark to have been on itself, so a sequence of these instructions are needed, which incrementally set word marks in the program's code or data, and set word marks for subsequent ''Set Word Mark'' instructions. Execution of instructions in the card continues, setting word marks, loading the program into memory, and then branching to the program's start address. To read subsequent cards, an explicit ''Read'' command (opcode <code>1</code>) must be executed as the last instruction on every card to get the new card's contents into locations 001β080. Note that the word marks are '''not''' erased when the ''Read'' command is executed, but are kept as-is for the next card read in. This is convenient, because much of what the first few cards do is set word marks in the proper locations; having the first half dozen or so word marks set means the programmer does not need to set those word marks again. <!-- the intent is that a "fixed word length" programmer with a little motivation, reading this for the first time, can follow the program's execution, understanding both the word marks and the commands. --> One-card programs can be written for various tasks. Commonly available were a one-card program to print the deck of cards following it, and another to duplicate a deck to the card punch. See Tom Van Vleck's web site.<ref>{{cite web | title = Tom Van Vleck: 1401s I have known | url = http://www.multicians.org/thvv/1401s.html }}</ref> Here is a one-card program which will print "HELLO, WORLD!". Pressing LOAD (above) reads one card, and begins execution at 001 (the first <code>,</code>). The program will automatically set its own wordmarks, assuming that the first <code>,</code> has a wordmark already. :<code><u>,</u>036008<u>,</u>040015<u>,</u>044022<u>,</u>051029<u>,</u>052053<u>/</u>299<u>/</u>332<u>L</u>065213<u>2.H</u>ELLO, WORLD!</code> Following conventional IBM notation, the underscores{{clarify|date=September 2021}} show where word marks are set in memory once the program has run; on punched cards they would not be indicated visually or present in the punched data. The program is: * ''Set Word Mark'' (opcode <code>,</code> operands 036 008). This must always be the first instruction, and one of its operands must always be 008 or else the next instruction would not have a word mark to indicate that it is an executable instruction. * Additional ''Set Word Mark''s. The underscores show where the word marks are after completing all <code>,</code> opcodes. Only word marks from 036 and further are needed for the "guts" of the program; word marks up through 029 are only needed for ''Set Word Mark'' instructions. Since the core of the program needs six word marks, five ''Set Word Mark'' instructions are needed in total. The reason one fewer is needed is because the final ''Set Word Mark'' does not need to waste an operand on other ''Set Word Marks'' * ''Clear Storage'' - the rest of the print area 299-200 (opcode <code>/</code> operand 299) * ''Clear Storage'' - part of the print area 332-300 (opcode <code>/</code> operand 332) * ''Move'' <code>HELLO, WORLD!</code> to the print area (opcode <code>L</code>, operands 065 and 213. ''Move'' stops due to the word mark in location 052 (which, doing double-duty, also defines the end of the ''Halt'' and branch instruction)) * ''Write a Line'' on the printer (opcode <code>2</code>; "HELLO, WORLD!" will be printed in the 13 leftmost printer positions) * ''Halt'' (opcode <code>.</code>)
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
IBM 1401
(section)
Add topic