This shows you the differences between two versions of the page.
its_midas [2022/05/24 01:49] ldbeth created |
its_midas [2022/05/24 02:09] ldbeth |
||
---|---|---|---|
Line 3: | Line 3: | ||
[[http:// | [[http:// | ||
- | The '' | + | The '' |
+ | |||
+ | Notice that almost all numbers in MIDAS are treated as octal. To specify a decimal number such as nineteen, use '' | ||
+ | |||
+ | You can lookup '': | ||
+ | |||
+ | ===== PDP-10 Instruction format ===== | ||
+ | |||
+ | Unlike some CISC instruction set, every instruction of PDP-10 is of the same 36-bit format (except for I/O instructions that are not available when the program is been supervised by an OS). | ||
+ | |||
+ | < | ||
+ | | ||
+ | | ||
+ | | ||
+ | | | ||
+ | | | ||
+ | |_________|____|_|____|__________________| | ||
+ | |||
+ | OP = operation code | ||
+ | AC = accumulator field | ||
+ | I = indirect bit | ||
+ | X = index field | ||
+ | Y = address field | ||
+ | DEV = device code | ||
+ | IOP = input-output operation code | ||
+ | </ | ||
+ | |||
+ | ===== Addressing ===== | ||
+ | |||
+ | Every instruction takes a register argument, and another address argument '' | ||
+ | |||
+ | Indirect addressing even applies to immediate variant of instructions. For example, the '' | ||
+ | |||
+ | < | ||
+ | start: | ||
+ | |||
+ | ... | ||
+ | add: addi | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | IFETCH: MA <- PC | ||
+ | OP <- Bits 0:8 of C(MA); | ||
+ | AC <- Bits 9:12 of C(MA); | ||
+ | EACOMP: I <- Bit 13 of C(MA); | ||
+ | X <- Bits 14:17 of C(MA); | ||
+ | Y <- Bits 18:35 of C(MA); | ||
+ | E <- Y; | ||
+ | IF NOT(X=0) then E <- E+C(X); | ||
+ | IF I=0 then go to done; | ||
+ | MA <- E; | ||
+ | GO TO EACOMP; | ||
+ | DONE: | ||
+ | </ | ||
+ | |||
+ | ===== Print first 500 primes ===== | ||
+ | |||
+ | The '' | ||
+ | |||
+ | < | ||
+ | ; -*- MIDAS -*- | ||
+ | TITLE | ||
+ | L==500. ; Decimal 500 | ||
+ | J=1 | ||
+ | N=2 | ||
+ | K=3 | ||
+ | A=4 | ||
+ | R=5 | ||
+ | PRIME: | ||
+ | BUF: BLOCK 30 | ||
+ | PDL: BLOCK 10 | ||
+ | START: | ||
+ | MOVEI N,2 | ||
+ | PUSH J,N | ||
+ | MOVEI | ||
+ | P2: | ||
+ | HLRO A,J | ||
+ | AOJE A, | ||
+ | P4: | ||
+ | MOVEI K,1 | ||
+ | P6: | ||
+ | IDIV A, | ||
+ | JUMPE | ||
+ | CAMG A, | ||
+ | JRST P2 ; Goto P2 | ||
+ | ADDI K,1 | ||
+ | JRST P6 | ||
+ | PRIN: | ||
+ | | ||
+ | MOVE J, | ||
+ | MOVE A, | ||
+ | PUSHJ | ||
+ | MOVEI | ||
+ | CONV: | ||
+ | NUM: MOVE A, | ||
+ | IDIVI | ||
+ | PUSHJ | ||
+ | IDIVI | ||
+ | PUSHJ | ||
+ | IDIVI | ||
+ | PUSHJ | ||
+ | CAIL K,450. | ||
+ | JRST PUTL | ||
+ | MOVEI | ||
+ | IDPB A,N | ||
+ | ADDI K,50. | ||
+ | JRST NUM | ||
+ | PUTL: | ||
+ | PUSHJ | ||
+ | ADDI K,1 | ||
+ | CAIL K,L | ||
+ | .LOGOUT 1, | ||
+ | SUBI K,450. | ||
+ | JRST CONV | ||
+ | |||
+ | DPC: ADDI A,60 | ||
+ | IDPB A,N | ||
+ | MOVE A,R | ||
+ | POPJ J, | ||
+ | OUT: ILDB N,A | ||
+ | JUMPE | ||
+ | .IOT 1,N | ||
+ | JRST OUT | ||
+ | EXIT: | ||
+ | .IOT 1,[^J] | ||
+ | POPJ J, | ||
+ | TITL: | ||
+ | END | ||
+ | </ |