The Digital Equipment Corporation PDP-8Card Reader Instructions
Part of
the PDP-8 Programmer's Reference Manual
|
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!
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:
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:
00 01 02 03 04 05 06 07 08 09 10 11 ___________________________________ | | | | | | | | | | | | | |__|__|__|__|__|__|__|__|__|__|__|__| | | | | unused |TE DE|This register contains two interrupt enable bits. These are:
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.
RCSFSkip the next instruction if the data ready flag is set. All applicable PDP-8 card reader interfaces support this operation.
RCRAThe 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-7The 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 )
RCRBThe 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.
RCNOThe 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.
RCRCThe 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 -- 7The 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.
RCNIThe condition register is read into the accumulator. This instruction is not supported on the CR8/I and CR8/L interfaces.
RCSDIf the card done flag is set, skip the next instruction. All applicable PDP-8 card reader interfaces support this operation.
RCSEIf 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.
RCRDReset the done flag. All applicable PDP-8 card reader interfaces support this operation.
RCSIIf 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.
RCTFThe transition flags (trouble and ready) are reset. This instruction is not supported on the CR8/I and CR8/L interfaces.
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 / returnThis 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 - 7It 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.