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
PDP-8
(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!
==Instruction set== The three high-order [[bit field|bits]] of the 12-bit [[instruction (computer science)|instruction]] word (labelled bits 0 through 2) are the operation code. For the six operations that refer to memory, bits 5 through 11 provide a seven-bit address. Bit 4, if set, says to complete the address using the five high-order bits of the [[program counter]] (PC) register, meaning that the addressed location was within the same 128 words as the instruction. If bit 4 is clear, zeroes are used, so the addressed location is within the first 128 words of memory. Bit 3 specifies indirection; if set, the address obtained as described so far points to a 12-bit value in memory that gives the actual effective address for the instruction; this way, operands can be anywhere in memory at the expense of an additional word. The [[jump instruction|JMP]] instruction does not operate on a memory word, except if indirection is specified, but has the same bit fields. {| | style="width:15px; text-align:center;" | 0 | style="width:15px;" | | style="width:15px; text-align:center" | 2 | style="width:15px; text-align:center" | 3 | style="width:15px; text-align:center" | 4 | style="width:15px; text-align:center" | 5 | style="width:15px;" | | style="width:15px;" | | style="width:15px;" | | style="width:15px;" | | style="width:15px;" | | style="width:15px; text-align:center;" | 11 |- | colspan="3" style="text-align:center; background-color:#CCCCCC;" | Operation | colspan="1" style="text-align:center; background-color:#9999FF;" | I | colspan="1" style="text-align:center; background-color:#FF9999;" | Z | colspan="7" style="text-align:center; background-color:#99FF99;" | Offset |} ; Memory pages This use of the instruction word divides the 4,096-word memory into 128-word [[memory page|pages]]; bit 4 of the instruction selects either the current page or [[Zero page|page 0]] (addresses 0000β0177 in [[octal]]). Memory in page 0 is at a premium, since variables placed here can be addressed directly from any page. (Moreover, address 0000 is where any interrupt service routine must start, and addresses 0010β0017 have the special property of auto-incrementing preceding any indirect reference through them.) The standard assembler places constant values for arithmetic in the current page. Likewise, cross-page jumps and subroutine calls use an indirect address in the current page. It was important to write routines to fit within 128-word pages, or to arrange routines to minimize page transitions, as references and jumps outside the current page require an extra word. Consequently, much time was spent cleverly conserving one or several words. Programmers deliberately placed code at the end of a page to achieve a free transition to the next page as PC was incremented. ===Basic instructions=== :000 β AND β [[bitwise AND|AND]] the memory operand with AC. :001 β TAD β [[Two's complement]] [[addition|ADd]] the memory operand to <L,AC> (a ''12 bit'' signed value (AC) w. carry in L). :010 β ISZ β Increment the memory operand and Skip next instruction if result is Zero. :011 β DCA β Deposit AC into the memory operand and Clear AC. :100 β JMS β JuMp to Subroutine (storing [[return address (computing)|return address]] in first word of subroutine!). :101 β JMP β JuMP. :110 β IOT β Input/Output Transfer (see below). :111 β OPR β microcoded OPeRations (see below). ===IOT (Input-Output Transfer) instructions=== The PDP-8 processor defined few of the IOT instructions, but simply provided a framework. Most IOT instructions were defined by the individual I/O devices. {| | style="width:15px; text-align:center;" | 0 | style="width:15px;" | | style="width:15px; text-align:center" | 2 | style="width:15px; text-align:center" | 3 | style="width:15px" | | style="width:15px" | | style="width:15px;" | | style="width:15px;" | | style="width:15px; text-align:center" | 8 | style="width:15px; text-align:center" | 9 | style="width:15px;" | | style="width:15px; text-align:center;" | 11 |- | colspan="3" style="text-align:center; background-color:#CCCCCC;" | 6=IOT | colspan="6" style="text-align:center; background-color:#9999FF;" | Device | colspan="3" style="text-align:center; background-color:#99FF99;" | Function |} ; Device Bits 3 through 8 of an IOT instruction select an I/O device. Some of these device addresses are standardized by convention: *00 is handled by the processor and not sent to any I/O device (see below). *01 is usually the high-speed paper tape reader. *02 is the high-speed paper tape punch. *03 is the console keyboard (and any associated low-speed paper tape reader). *04 is the console printer (and any associated low-speed paper tape punch). Instructions for device 0 affect the processor as a whole. For example, ION (6001) enables interrupt processing, and IOFF (6002) disables it. ; Function Bits 9 through 11 of an IOT instruction select the function(s) the device performs. Simple devices (such as the paper tape reader and punch and the console keyboard and printer) use the bits in standard ways: *Bit 11 causes the processor to skip the next instruction if the I/O device is ready. *Bit 10 clears AC. *Bit 9 moves a word between AC and the device, initiates another I/O transfer, and clears the device's "ready" flag. These operations take place in a well-defined order that gives useful results if more than one bit is set. More complicated devices, such as disk drives, use these 3 bits in device-specific fashions. Typically, a device decodes the 3 bits to give 8 possible function codes. ===OPR (OPeRate)=== Many operations are achieved using OPR, including most of the conditionals. OPR does not address a memory location; conditional execution is achieved by conditionally skipping the following instruction, which is typically a JMP. The OPR instruction was said to be "microcoded." This did not mean what the word means today (that a lower-level program fetched and interpreted the OPR instruction), but meant that each bit of the instruction word specifies a certain action, and the programmer could achieve several actions in a single instruction cycle by setting multiple bits. In use, a programmer can write several instruction mnemonics alongside one another, and the assembler combines them with [[logical disjunction|OR]] to devise the actual instruction word. Many I/O devices support "microcoded" IOT instructions. Microcoded actions take place in a well-defined sequence designed to maximize the utility of many combinations. The OPR instructions come in Groups. Bits 3, 8 and 11 identify the Group of an OPR instruction, so it is impossible to combine the microcoded actions from different groups. One action (and corresponding bit) which is the same in all groups is bit 4, CLA. If set, the accumulator is cleared. ====Group 1==== <pre> 00 01 02 03 04 05 06 07 08 09 10 11 ___________________________________ | 1| 1| 1| 0| | | | | | | | | |__|__|__|__|__|__|__|__|__|__|__|__| |CLA CMA RAR BSW CLL CML RAL IAC Execution order 1 1 2 2 4 4 4 3 </pre> :7200 β CLA β Clear Accumulator :7100 β CLL β Clear the L Bit :7040 β CMA β Ones Complement Accumulator :7020 β CML β Complement L Bit :7001 β IAC β Increment <L,AC> :7010 β RAR β Rotate <L,AC> Right :7004 β RAL β Rotate <L,AC> Left :7012 β RTR β Rotate <L,AC> Right Twice :7006 β RTL β Rotate <L,AC> Left Twice :7002 β BSW β Byte Swap 6-bit "bytes" (PDP 8/e and up) In most cases, the operations are sequenced so that they can be combined in the most useful ways. For example, combining CLA (CLear Accumulator), CLL (CLear Link), and IAC (Increment ACcumulator) first clears the AC and Link, then increments the accumulator, leaving it set to 1. Adding RAL to the mix (so CLA CLL IAC RAL) causes the accumulator to be cleared, incremented, then rotated left, leaving it set to 2. In this way, small integer constants were placed in the accumulator with a single instruction. The combination CMA IAC, which the assembler lets you abbreviate as CIA, produces the arithmetic inverse of AC: the twos-complement negation. Since there is no subtraction instruction, only the twos-complement add (TAD), computing the difference of two operands, requires first negating the subtrahend. A Group 1 OPR instruction that has none of the microprogrammed bits set performs no action. The programmer can write [[NOP (code)|NOP]] (No Operation) to assemble such an instruction. ====Group 2, Or Group==== <pre> 00 01 02 03 04 05 06 07 08 09 10 11 ___________________________________ | 1| 1| 1| 1| | | | | 0| | | 0| |__|__|__|__|__|__|__|__|__|__|__|__| |CLA SZA OSR SMA SNL HLT 2 1 1 1 3 3 </pre> :7600 β CLA β Clear AC :7500 β SMA β Skip on AC < 0 (or group) :7440 β SZA β Skip on AC = 0 (or group) :7420 β SNL β Skip on L β 0 (or group) :7404 β OSR β [[bitwise operation|logically 'or']] front-panel switches with AC :7402 β HLT β Halt Three of the bits (CLA, OSR, HLT) perform actions if set. Another three bits (SMA, SZA, SNL) encode skip conditions; a skip is performed if any of the specified conditions are true. For example, "SMA SZA", opcode 7540, skips if AC β€ 0. A Group 2 OPR instruction that has none of the microprogrammed bits set is another No-Op instruction. ====Group 2, And Group==== <pre> 00 01 02 03 04 05 06 07 08 09 10 11 ___________________________________ | 1| 1| 1| 1| | | | | 1| | | 0| |__|__|__|__|__|__|__|__|__|__|__|__| |CLA SNA OSR SPA SZL HLT 2 1 1 1 3 2 </pre> :7410 β SKP β Skip Unconditionally :7610 β CLA β Clear AC :7510 β SPA β Skip on AC β₯ 0 (and group) :7450 β SNA β Skip on AC β 0 (and group) :7430 β SZL β Skip on L = 0 (and group) When bit 8 is set, the Group 2 skip condition is inverted; the skip is ''not'' performed if any of the or group conditions are true. By [[De Morgan's laws]], this means that the skip ''is'' performed if all of the specified inverted conditions are true. For example, "SPA SNA", opcode 7550, skips if AC > 0. If none of bits 5β7 are set, then the skip is unconditional. The actions (CLA, OSR, HLT) are not affected by bit 8. ====Group 3==== Unused bit combinations of OPR are defined as a third Group of microprogrammed actions mostly affecting the MQ (Multiplier/Quotient) register. The MQ register and the extended arithmetic element (EAE) instructions are optional and only exist when EAE option was purchased.<ref>{{cite book |title=Small Computer Handbook 1967β1968 |date=1968 |publisher=Digital Equipment Corporation |pages=130β136}}</ref> <pre> 00 01 02 03 04 05 06 07 08 09 10 11 ___________________________________ | 1| 1| 1| 1| | | | | | | | 1| |__|__|__|__|__|__|__|__|__|__|__|__| |CLA SCA \_ _/ | MQA MQL CODE 1* 2 2 2 3 </pre> :7601 β CLA β Clear AC :7501 β MQA β Multiplier Quotient with AC (logical or MQ into AC) :7441 β SCA β Step counter load into AC :7421 β MQL β Multiplier Quotient Load (Transfer AC to MQ, clear AC) :7621 β CAM β CLA + MQL clears both AC and MQ. Typically CLA and MQA were combined to transfer MQ into AC. Another useful combination is MQA and MQL, to exchange the two registers. Three bits specified a multiply/divide instruction to perform: :7401 β No operation :7403 β SCL β Step Counter Load (immediate word follows, PDP-8/I and up) :7405 β MUY β Multiply :7407 β DVI β Divide :7411 β NMI β Normalize :7413 β SHL β Shift left (immediate word follows) :7415 β ASR β Arithmetic shift right :7417 β LSR β Logical shift right
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
PDP-8
(section)
Add topic