[an error occurred while processing this directive] [an error occurred while processing this directive] PDP-8 Card Reader Instructions [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive]
[an error occurred while processing this directive] (none)
   [an error occurred while processing this directive]

The Digital Equipment Corporation PDP-8

[an error occurred while processing this directive]

Card Reader Instructions

[an error occurred while processing this directive] Part of [an error occurred while processing this directive] the PDP-8 Programmer's Reference Manual
[an error occurred while processing this directive] See also [an error occurred while processing this directive] (none)
[an error occurred while processing this directive] [an error occurred while processing this directive] (none) Douglas W. Jones [an error occurred while processing this directive] (none)
[an error occurred while processing this directive] (none)
THE UNIVERSITY OF IOWA Department of Computer Science [an error occurred while processing this directive] and (none) [an error occurred while processing this directive]

(none) [an error occurred while processing this directive]

Copyright © (none) This work may be transmitted or stored in electronic form on any computer attached to the Internet or World Wide Web so long as this notice is included in the copy. Individuals may make single copies for their own use. All other rights are reserved.

[an error occurred while processing this directive]
[an error occurred while processing this directive]

This document describes the CR8E/CR8F (M843) card reader interface of the PDP-8/E, 8/F, 8/M and 8/A, as well as earlier models such as the CR8I and CR8L. The type 451 card reader control for the classic-8 was not compatable with this!

Index


Device Registers

Reader Buffer

            12 11 10  1  2  3  4  5  6  7  8  9
            ___________________________________
           |  |  |  |  |  |  |  |  |  |  |  |  |
           |__|__|__|__|__|__|__|__|__|__|__|__|
           |        |                          |
           |  Zone  |          Numeic          |
           |  Punch |           Punch          |
The reader buffer register holds the column most recently read from the card. The bit positions in this buffer are labeled with the conventional row numbers used on all Hollerith format punched cards. These are conventionally grouped as zone punches and numeric punches, and all variations of the 12 column Hollerith system are upwards compatable from the following basic character set:
No punch - space

No zone punch - numeric
A numeric punch in rows 1 to 9 codes that numeric digit.

Zone 12 punch - alphabetic A-I
A numeric punch in rows 1 to 9 codes a letter from A to I.

Zone 11 punch - alphabetic J-R
A numeric punch in rows 1 to 9 codes a letter from J to R.

Zone 10 punch - alphabetic S-Z
A numeric punch in rows 2 to 9 codes a letter from S to Z.

Zone 10 punch - no numeric punch
This exception codes the digit zero. For this reason, zone punch 10 is sometimes also considered to be numeric punch zero.
Beyond this basic framework, Hollerith codes have varied immensely over the years!

Condition Register

            00 01 02 03 04 05 06 07 08 09 10 11
            ___________________________________
           |  |  |  |  |  |  |  |  |  |  |  |  |
           |__|__|__|__|__|__|__|__|__|__|__|__|
           |           |                       |
           |DR CD TT RT|         unused        |
This register contains the flags indicating the card reader condition. These are:
DR - Data Ready
Set when one column is read into the reader buffer. The data in the reader buffer will remain valid for at least 1 millisecond after data ready becomes true. (For the CR8L and CR8I interfaces, the data remains valid for 1.4 milliseconds.) The hardware does not detect overrun errors, but by counting the number of characters read per card, they can be detected by software.

CD - Card Done
Set when the end of a card is sensed.

TT - Trouble Transition
Set when the reader status goes from ready to not-ready, for example, because the reader is not turned on, or because of a jam, full output hopper, or empty input hopper.

RT - Ready Transition
Set when the reader status goes from not-ready to ready.
At most one of the transition flags will be set at any time, indicating the current reader status and the fact that the status has changed since the last status reset. The transition flags are not present in the CR8I or CR8L card reader interfaces. Initialization resets all condition flags.

Interrupt Enable

            00 01 02 03 04 05 06 07 08 09 10 11
            ___________________________________
           |  |  |  |  |  |  |  |  |  |  |  |  |
           |__|__|__|__|__|__|__|__|__|__|__|__|
           |                             |     |
           |           unused            |TE DE|
This register contains two interrupt enable bits. These are:
TE - Transition Enable
If set, enables interrupt requests when either the Ready Tranasition or the Trouble Transition flag is set.

DE - Data Enable
If set enables interrupt requests when either the Data Ready or the Card Done flag is set.
These enable flipflops are not present in the CR8I and CR8L reader interfaces. Power-on initialization resets the Ready Enable bit and sets the Data Enable bit.

Instruction Format

            00 01 02 03 04 05 06 07 08 09 10 11
            ___________________________________
           | 1| 1| 0| 1| 1| 0| x| 1| 1|  |  |  |
           |__|__|__|__|__|__|__|__|__|__|__|__|
           |        |                 |        |
           |  IOT   |      Device     |   Op   |
The card reader teletype is always connected as devices 63 and 67; this gives the potential for 16 operations, not all of which are decoded.

Input Instructions

6631 - RCSF Read Card Skip on data ready Flag

	RCSF
Skip the next instruction if the data ready flag is set. All applicable PDP-8 card reader interfaces support this operation.

6632 - RCRA Read Card Read Alphanumeric

	RCRA
The contents of the reader buffer are transferred to the accumulator, after translation to a 6-bit (BCD) code. Errors in translating from the 12-bit card code to the 6-bit code are not reported! The data ready bit is cleared by this instruciton. All applicable PDP-8 card reader interfaces support this operation.

The documentation of the particular 6-bit code used is very unclear, and the tables in different versions of the Small Computer Handbook differ in the details they give! The original 1965 PDP-8 User's Handbook gives a 6-bit code that is essentially the same as IBM 1401 BCD, The 1973 Small Computer Handbook erroniously gives 6-bit truncated ASCII. In fact, all applicable interfaces used the following 6-bit code, a code which is correctly documented in the PDP-8/I -8/L Small Computer Handbook, 1972 revision:

            00 01 02 03 04 05 06 07 08 09 10 11
            ___________________________________
           | 0| 0| 0| 0| 0| 0|  |  |  |  |  |  |
           |__|__|__|__|__|__|__|__|__|__|__|__|
           |                 |     |           |
           |     Unused      |Zone |  Number   |

	Zone = zone punch used
		00 -- none
		01 -- 10
		10 -- 11
		11 -- 12
	Number = BCD code for numeric punch used
		0000 -- none	1000 -- 8
		0001 -- 1       1001 -- 9
		0010 -- 2       1010 -- 8-2
		0011 -- 3       1011 -- 8-3
		0100 -- 4       1100 -- 8-4
		0101 -- 5       1101 -- 8-5
		0110 -- 6       1110 -- 8-6
		0111 -- 7       1111 -- 8-7
The BCD code is produced using 6 or-gates, as follows
	Bit 6  = or( punches 12, 11 )
	Bit 7  = or( punches 12, 10 )
	Bit 8  = or( punches 8, 9 )
	Bit 9  = or( punches 4, 5, 6, 7 )
	Bit 10 = or( punches 2, 3, 6, 7 )
	Bit 11 = or( punches 1, 3, 5, 7, 9 )

6634 - RCRB Read Card Read Binary

	RCRB
The contents of the reader buffer are transferred to the accumulator, as a literal uninterpreted 12-bit quantity, with Row 12 in the most significant bit. The data ready bit is cleared by this instruciton. All applicable PDP-8 card reader interfaces support this operation.

6635 - RCNO Read Conditions Out to card reader

	RCNO
The accumulator is transferred to the interrupt enable register. If one of the flags is set, this may cause an interrupt. This instruction is not supported on the CR8I and CR8L interfaces, where interrupts were always enabled unless globally disabled.

6636 - RCRC Read Card Read Compressed

	RCRC
The contents of the reader buffer are transferred to the accumulator, after translation to an 8-bit (extended BCD) code. Errors in translating from the 12-bit card code to the 8-bit code are reported by setting the sign bit! The data ready bit is cleared by this instruciton. This instruction is not supported on the CR8I and CR8L interfaces. The 8 bit code is as follows:
            00 01 02 03 04 05 06 07 08 09 10 11
            ___________________________________
           |  | 0| 0| 0|  |  |  |  |  |  |  |  |
           |__|__|__|__|__|__|__|__|__|__|__|__|
           |  |        |  |        |  |        |
           |ER| Unused |R9|  Zone  |R8|  R1-7  |

	ER   = error report
	R9   = row 9
	Zone = the zone field, uninterpreted
	R8   = row 8
	R1-7 = binary code for rows 1-7
		000 -- none	100 -- 4
		001 -- 1	101 -- 5
		010 -- 2	110 -- 6
		011 -- 3	111 -- 7
The binary code is produced using 3 or-gates, as follows
	Bit 9  = or( punches 4, 5, 6, 7 )
	Bit 10 = or( punches 2, 3, 6, 7 )
	Bit 11 = or( punches 1, 3, 5, 7 )
The error report is set if more than one punch was present in rows 1 to 7.

Compressed mode was included on the CR8E interface in order to support extended card codes that allowed for full support of EBCDIC, including lower case. Although IBM did introduce a keypunch that supported these extensions, they were not supported by the last IBM keypunch to attain widespread use, the 029.

6637 - RCNI Read Conditions In from card reader

	RCNI
The condition register is read into the accumulator. This instruction is not supported on the CR8/I and CR8/L interfaces.

6671 - RCSD Read Card Skip if Done

	RCSD
If the card done flag is set, skip the next instruction. All applicable PDP-8 card reader interfaces support this operation.

6672 - RCSE Read Card start and Skip if ready

	RCSE
If the card reader is not ready, for example, because it is turned off, no cards are available to be read, or it is jammed, this instruction does nothing. If the card reader is ready, this instruction starts one card into motion, clears the card-done flag and skips the next instruction. All applicable PDP-8 card reader interfaces support this operation.

6674 - RCRD Read Card Reset Done

	RCRD
Reset the done flag. All applicable PDP-8 card reader interfaces support this operation.

6675 - RCSI Read Card Skip if Interrupt

	RCSI
If the card reader is currently requesting an interrupt -- that is, if one of the flags in the condition register is set and the corresponding interrupt enable bit is also set, the next instruction is skipped. This instruction is not supported on the CR8/I and CR8/L interfaces.

6677 - RCTF Reader Clear Transition Flags

	RCTF
The transition flags (trouble and ready) are reset. This instruction is not supported on the CR8/I and CR8/L interfaces.

Programming Conventions

Typical PDP-8 assembly language programs begin by defining the necessary IOT instructions. In the case of the card reader interface, most PDP-8 assemblers did not predefine these symbols, so programmers had to define them as follows:
	RCSF=	6631	/ Read Card Skip on data ready Flag
	RCRA=	6632	/ Read Card Read Alphanumeric
	RCRB=	6634	/ Read Card Read Binary
	RCSD=	6671	/ Read Conditions Out to card reader
	RCSE=	6672	/ Read Card start and Skip if ready
	RCRD=	6674	/ Read Card Reset Done

Given these definitions, the following routine reads one card image into an 80 word buffer each time it is called, translating the columns to ASCII without checking for invalid card codes:

	RCARD,	.-.		/Read card
	/			  wipes out X1, TMP
	/			  returns AC = 0
	/			  takes buffer addr inline
	/			  on error, no skip
	/			  on success, skip
		CLA CMA
		TAD I	RCARD	/ get parameter minus 1
		DCA     X0	/ setup for auto increment
		ISZ	RCARD	/ advance over parameter
		RCSE		/ start reading card
		JMP I	RCARD   /   error return
	RCNEXT, RCSF		/ check for column ready
		JMP	RCEND	/   if not, go test done
		RCRA		/ get one column
		TAD	(RCTAB) / convert to address
		DCA	TMP	/
		TAD I	TMP	/ get TAB(column)
		DCA I	X0	/ store in buffer
	RCEND,  RDSD		/ see of card done
		JMP	RCNEXT	/   get next column if not
		RCRD		/ reset done (be polite!)
		ISZ	RCARD	/ prepare for normal return
		JMP I	RCARD	/ return
This code depends on a 64 word translation table to convert between the 6 bit code returned by the RCRA instruction and ASCII. The following table handles the conversion for cards punched with an IBM 029 keypunch:
						/zone numeric
	RCTAB,	" ;"1;"2;"3;"4;"5;"6;"7;"8;"9	/      x - 9
	      	":;"#;"@;"';"=;""		/     8, 2 - 7
		"0;"/;"S;"T;"U;"V;"W;"X;"Y;"Z	/ 10   x - 9
	      	"];",;"%;"_;">;"?		/ 10  8, 2 - 7
		"-;"J;"K;"L;"M;"N;"O;"P;"Q;"R	/ 11   x - 9
	      	"!;"$;"*;");";;"/		/ 11  8, 2 - 7
		"&;"A;"B;"C;"D;"E;"F;"G;"H;"I	/ 12   x - 9
	      	"[;".;"<;"(;"+;"^		/ 12  8, 2 - 7
It is worth noting that the the 8-bit codes returned by the RCRC instruction can be converted to the 6-bit format returned by the RCRA instruction as follows (the conversion is shown in pseudo C syntax):
	6bit = (  (8bit & 0077)
	       | ((8bit & 0200) >> 4)
	       | ((8bit & 0100) >> 2)
	       | ((8bit & 0100) >> 1)
A robust card input routine would do two things that are not covered by the above code. First, it would count columns, verifying that exactly 80 columns of data are read per card. Second, it would verify that the data in each column represented a valid character. The latter is most easily done by verifying that only one zone punch is present in rows 10, 11 and 12, and that the number of numeric punches is never greater than two, and if equal to two, one of those punches is in column 8 and the other is in columns 2 to 7.