|
DataMuseum.dkPresents historical artifacts from the history of: CP/M |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about CP/M Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 199680 (0x30c00) Types: TextFile Names: »D38«
└─⟦2294a1cd1⟧ Bits:30005867/disk06.imd Dokumenter (RCSL m.m.) └─⟦this⟧ »D38«
\f i T_A_B_L_E_ _O_F_ _C_O_N_T_E_N_T_S_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _P_A_G_E_ 1. GENERAL ............................................... 1 \f ii \f 1_._ _ _ _ _ _ _ _ _G_E_N_E_R_A_L_ 1. The Testcable CBL936 is used to test the two parallel I/O ports of the RC701 or RC702 microcomputer system. The cable J3 is con- nected to J3 of the microcomputer and J4 is connected to J4 of the microcomputer. The test itself is described in the manual for RC702 Testprogram. \f CBL936 DRAWING \f T_A_B_L_E_ _O_F_ _C_O_N_T_E_N_T_S_ 1 DATA AND INSTRUCTIONS FORMATS Page 7 1.1 Data formats 7 1.2 Working Registers 8 1.3 Instruction Format 8 1.4 Use of the Effective Address as an Operand 10 1.5 Use of the Effective Address to refer to Memory Location 10 1.6 Jump Instructions 11 1.7 Modify Next Address Instruction 11 2 SUMMARY OF OPERATORS 12 2.1 Address Instructions 12 2.1.1 Address Load (al) 12 2.1.2 Address Complement (ac) 12 2.1.3 Address Modity (am) 12 2.2 Transfer between Memory and Registers 14 2.2.1 Register Load (rl) 14 2.2.2 Extend (and) Load (el) 14 2.2.3 Zero Load (zl) 14 2.2.4 Register Store (rs) 14 2.2.5 Double Load (dl) 14 2.2.6 Double Store (ds) 14 2.2.7 Half Load (hl) 14 2.2.8 Half Store (hs) 14 2.2.9 Register Exchange (rx) 15 2.2.10Exception Load (xl) 15 2.2.11 Exception Store (xs) 15 2.3 Integer Arithmetic 15 2.3.1 Word Add (wa) 15 2.3.2 Word Subtract (ws) 15 2.3.3 Word Multiply (wm) 16 2.3.4 Word Divide (wd) 16 2.3.5 Double Add (aa) 16 2.3.6 Double Subtract (ss) 16 2.3.7 Extend (and) Add (ea) 17 2.3.8 Extend (and) Subtract (es) 17 2.4 Floating Point Arithmetic 18 2.4.1 Floating Add (fa) 18 2.4.2 Floating Subtract (fs) 18 2.4.3 Floating Multiply (fm) 18 2.4.4 Floating Divide (fd) 18 2.4.5 Convert Integer to Floating (ci) 18 2.4.6 Convert Floating to Integer (cf) 18 2.4.7 Normalize Single (ns) 18\f 2.4.8 Normalize Double (nd) 18 2.5 Bit Processing 19 2.5.1 Logical And (la) 19 2.5.2 Logical Or (lo) 19 2.5.3 Logical Exclusive Or (lx) 19 2.6 Shift Operations 19 2.6.1 Arithmetic Single (as) 19 2.6.2 Arithmetic Double (ad) 19 2.6.3 Logical Single (ls) 19 2.6.4 Logical Double (ld) 19 2.7 Jump Instructions 21 2.7.1 Jump with Link (jl) 21 2.8 Conditional Instructions 22 2.8.1 Skip Equal (se) 22 2.8.2 Skip Not Equal (sn) 22 2.8.3 Skip Less than (sl) 22 2.8.4 Skip Higher than (sh) 22 2.9 Skip on Individual bits 25 2.9.1 Skip Ones (so) 25 2.9.2 Skip Zeroes (sz) 25 2.9.3 Skip if no Exception (sx) 25 3 SLANG 27 3.1 Simple Directives 27 3.1.1 Comments 27 3.1.2 Block Construction 27 3.1.3Storage Mode 27 3.2 Instruction Addressing29 3.2.1 Direct Addressing29 3.2.2 Relative Addressing29 3.2.3 Indexed Addressing29 3.2.4 Indirect Addressing30 3.3 Names 31 3.3.1 Declaration of Identifiers 31 3.3.2 The Reserved Identifier 32 3.3.3 Relative Addressing using Identifiers 33 3.3.4 Expressions in SLANG 33 3.3.5 Explicit Definition of Identifiers 35 3.3.6 Redefinition of Identifiers 36 3.4 Program Elements 36 3.4.1 Instructions 37 3.4.2 Numbers 38 3.4.3 Text strings 38 3.4.4 Directives 38 \f 3.4.5 j. code 40 3.5 Blocks and Segments 41 3.6 Calling the SLANG Assembler 43 3.7 Source Program Administration 44 3.8 Input and Output 46 3.8.1 Read a Character 47 3.8.2 Output a Character 47 3.8.3 Output a Text string48 3.8.4 Output a Number 48 3.8.5 End Program 49 3.8.6 Construction of a Program which makes use of Input and Output Routines 50 3.9 Code Procedure50 4 PROGRAMMING EXAMPLES 53 APPENDIX A: Assembly Messages 61 APPENDIX B: RC 8000 Instruction Set 65 APPENDIX C: RC 4000 Instruction Set 68 APPENDIX D: The SLANG Syntax71 APPENDIX E: Debugging of SLANG-programs78 APPENDIX F: The ISO 7 Bit Character Set 80 APPENDIX G: Survey of Instructions 82 APPENDIX H: References 84 Index 85 \f F_ 1 D_A_T_A_ _A_N_D_ _I_N_S_T_R_U_C_T_I_O_N_S_ _F_O_R_M_A_T_S_ 1.1 D_a_t_a_ _f_o_r_m_a_t_s_ The data structure of the RC 4000/8000 is shown in the following figure: DOUBLE-WORD FIRST WORD SECOND WORD HALF-WORD HALF-WORD HALF-WORD HALF-WORD INTEGER HALF-WORD INTEGER HALF-WORD 0 11 12 23 INTEGER WORD 0 23 FRACTION EXPONENT 0 353647 INTEGER DOUBLE-WORD 0 47 The basic arithmetic or logical operand is an integer of 24 bits. Two>s complement arithmetic is used. Data is packed with twohalf- words per word. The 12-bit half-words are directly addressable. The address of the first half-word is 0, the next is 1 etc. Doub- le words are used to represent integers of 48 bits and floating- point numbers with 36-bit fractions and 12-bit exponents. If a double-word/word/half-word is treated as a number, the left- most bit is the sign. If a double-word is treated as a floating point number, the first bit in both fraction and exponent are treated as the signs. The alignment of words in store is always such that the effective address is divisible by 2. Therefore the effective address, in word instructions, is the address of the left-hand half-word. An odd address in word instructions will be treated as if the corre- sponding left-hand half-word address had been used. \f T_1.2 W_o_r_k_i_n_g_ _r_e_g_i_s_t_e_r_s_ The register structure includes four 24-bit working registers, &_ one of which is specified as the result register in each instruc- tion. Three of the working registers also function as index regi- sters. The current index register is selected by the instruction format. The working registers are addressable as the first eight half- words (or four words) of the primary memory. The programmer can therefore perform operations directly between two registers by specifying a memory address between 0 and 7. It is also possible to execute instructions stored in the working registers. T_ Half-word address 0 24 bits working reg 0 (w0) 2 24 bits working reg 1 (w1) index reg 1 (x1) 4 24 bits working reg 2 (w2) index reg 2 (x2) &_ 6 24 bits working reg 3 (w3) index reg 3(x3) Two adjacent working registers can be used to hold a double-length operand of 48 bits. In double-length operations, the four registers are connected cyclically as follows: T_ double reg 0 address w3 and w0 double reg 1 address w0 and w1 double reg 2 address w1 and w2 &_ double reg 3 address w2 and w3 These connections are established by specifying the second regis- ter of the concatenation in the instruction format. T_ 1.3 I_n_s_t_r_u_c_t_i_o_n_ _F_o_r_m_a_t_ The instruction format is divided into an operation half-word and &_ an address half-word, each containing 12 bits: \f T_ FWMXD 0 5 6 7 8 9 10 11 12 23 Example: The instruction: al w3 7 will load working register 3 with the number 7 i.e. the contents of w3 is now 7. The mapping of this instruction in a primary storage word is: F W M X D &_ 11 3 0 0 7 Bits 0:5 F_ _f_i_e_l_d_. Contains the function code, specifying one of sixty-four basic operations. Bits 6:7 W_ _f_i_e_l_d_. Specifies one of the four working registers as the result register. Bits 8:9 M_ _f_i_e_l_d_. Specifies one of four address modes, used to control generation of the effective address (see be- low). Bits 10:11 X_ _f_i_e_l_d_. Selects the current index register. Only working registers w1, w2, and w3 act as index re- gisters (X field = 0 indicates no indexing). Bits 12:23 D_ _f_i_e_l_d_. Contains a truncated address, specifying a displacement from -2048 to +2047 half-words within the program. This is adequate for the majority of addresses, but not sufficient for direct addressing of the entire memory. A full address of 24 bits is formed by means of the displacement, D, in conjunction with the contents of an index register, X, and the contents of the instruction counter, IC. The generation of the effective address, A, is controlled by the address mode field, M, as follows: T_ relative bit indirect bit M = 00 A = X + D direct addressing M = 01 A = word (X + D) indirect addressing M = 10 A = X + IC + D relative addressing &_ M = 11 A = word (X + IC + D) indirect relative addressing \f In the address calculation, the displacement is treated as a 12- bit signed integer that is extended towards the left to 24 bits before being added to the index register and the instruction counter. In the final addition of X, IC, and D, overflow is ig- nored. The address modes 01 and 11 permit indirect addressing on one level. The indirect address fetched from the memory is assumed to be a full address of 24 bits. The address modes 10 and 11 modify the indexed displacement with the current load address of the instruction. This permits reloca- tion of programs during loading. T_1.4 U_s_e_ _o_f_ _t_h_e_ _e_f_f_e_c_t_i_v_e_ _a_d_d_r_e_s_s_ _a_s_ _a_n_ _o_p_e_r_a_n_d_ For some function codes, the effective address is used directly &_ as an operand. This is done in three different ways. The effective address or its two>s complement can be assigned to the addressed register. The contents of the working register can be compared with the effective address (word comparison) in several ways, the result of the comparison determining whether the following instruction is to be executed or skipped. The effective address can define a number of shifts to be per- formed on the addressed register. T_1.5 U_s_e_ _o_f_ _t_h_e_ _e_f_f_e_c_t_i_v_e_ _a_d_d_r_e_s_s_ _t_o_ _r_e_f_e_r_ _t_o_ _m_e_m_o_r_y_ _l_o_c_a_t_i_o_n_s_ For other function codes, the effective address is used to refer &_ to memory locations. Memory addresses are always expressed as half-word addresses. The half-word locations are numbered consecutively starting with zero. In word operations, the right-most bit in the effective address is ignored; thus it is irrelevant whether a word operation refers to the left or the right half of a word. In double-word operation the right-most bit in the effective address is also ignored; the word thus specified is the second word of the operand. \f The effective address is used to refer to memory locations in register transfer instructions as well as instructions for arith- metic and logical operations. T_ 1.6 J_u_m_p_ _i_n_s_t_r_u_c_t_i_o_n_s_ Jump instructions represent a special kind of memory reference, as they transfer program control to the instruction pointed out by the effective address. &_ Subroutine jumps are implemented as follows: If the W field is different from zero, the logical address of the return point, i.e. the instruction following the subroutine jump, is placed in the addressed working register. A jump is then made to the effec- tive address. At the end of the subroutine, a return jump is made as a simple unconditional jump. T_ 1.7 M_o_d_i_f_y_ _N_e_x_t_ _A_d_d_r_e_s_s_ _i_n_s_t_r_u_c_t_i_o_n_ The AM instruction, which modifies the displacement in the fol- lowing instruction by its own effective address, provides various possibilities of address modification. &_ One use of this instruction is for direct indexing with the con- tents of any memory location, for example: am (x1 + d1) jl d2 The effective address of the AM instruction is A1 = word (X1 + D1). This is used to modify the displacement D2 in the following JL instruction to produce an effective address A2 = word (X1 + D1) + D2. Another use of the AM instruction is for multi-level indirect addressing, for example: T_ am (x1 + d1) ; a1 = word (x1 + d1) am (0) ; a2 = word (a1) am (0) ; a3 = word (a2) &_ etc. \f F_ 2 S_U_M_M_A_R_Y_ _O_F_ _O_P_E_R_A_T_O_R_S_ The operators most frequently used (basic operations) will be briefly described in the following. As a verbal description only is given, doubts may arise as to subtle uses of the operators; in such cases the complete description in the "Reference Manual" should be read. In the notation indirect addressing is indicated by parentheses and comments are preceded by semicolons. Relative addressing is indicated by a period. Example: al w2 (82) ; w2:=word(82) With this instruction the contents of primary storage word with address 82 is placed in working register 2. 2.1 A_d_d_r_e_s_s_ _i_n_s_t_r_u_c_t_i_o_n_s_ 2.1.1 A_d_d_r_e_s_s_ _l_o_a_d_ _(_a_l_)_ The final address is transferred to the register. Example: al w1 500 ; w1 := 500; 2.1.2 A_d_d_r_e_s_s_ _c_o_m_p_l_e_m_e_n_t_ _(_a_c_)_ The final address with the opposite sign is transferred to the register. Example: ac w1 100 ; is the same as al w1 -100 Example: The contents of w1 can be complemented (two>s complement) using the instruction: ac w1 x1 e.g if w1 is +2 = 000........10 in the binary then -w1 is -2 = 111........10 system 2.1.3 A_d_d_r_e_s_s_ _m_o_d_i_f_y_ _(_a_m_)_ The final address is added to the displacement in the following instruction. (The instruction is not altered in memory though). A working register is not used in an am instruction. T_ Example: am 100 al w0 200 causes w0 := 300 \f Example: am (100) al w0 200 &_ causes w0 := word(100) + 200. Example: Word 74 contains the start address of a table where word with address 10 (relative to table start) contains the address of a description of device no. 5 (usually the printer). T_ Half-word address relative to first 0 dev. 0 2 dev. 1 74: first 4 dev. 2 printer 6 dev. 3 descriptor 8 dev. 4 10 dev. 5 12 dev. 6 &_ T_ The start address of this description can be transferred to the w2 register by the instructions: am (74) i.e. adds contents of word 74 to rl w2 +10 the displacement 10 and uses this as address of the word which is &_ loaded to w2. T_ Example: A long sequence of am instructions is often found on &_ entry into procedures etc. Imagine the following instruction sequence starts at word 100: T_ am 1 ; word 100 am 1 ; word 102 am 1 ; word 104 &_ al w0 0 ;word 106 In this example if entry is made at word 106, w0 will be initia- lized to 0, if entry is made at word 104, w0 will be 1 and if entry is made at word 100, w0 will be 3. \f 2.2 T_r_a_n_s_f_e_r_ _b_e_t_w_e_e_n_ _m_e_m_o_r_y_ _a_n_d_ _r_e_g_i_s_t_e_r_s_ 2.2.1 R_e_g_i_s_t_e_r_ _l_o_a_d_ _(_r_l_)_ The contents of the storage word addressed are transferred to the W register. This instruction using a signed half-word integer corresponds to the el instruction. Using a unsigned integer half- word, this instruction corresponds to the zl instruction. T_ 2.2.2 E_x_t_e_n_d_ _(_a_n_d_)_ _l_o_a_d_ _(_e_l_)_ The half-word addressed is transferred to the right half of the W register, and the sign is extended through the left half of the register. &_ 2.2.3 Z_e_r_o_ _l_o_a_d_ _(_z_l_)_ The half-word addressed is transferred to the right half of the W register and the left half of the register is zeroed. 2.2.4 R_e_g_i_s_t_e_r_ _s_t_o_r_e_ _(_r_s_)_ The contents of the W register are transferred to the storage word addressed. 2.2.5 D_o_u_b_l_e_ _l_o_a_d_ _(_d_l_)_ 2.2.6 D_o_u_b_l_e_ _s_t_o_r_e_ _(_d_s_)_ These instructions are the double-word equivalents of rl and rs. Example: dl w0 100 causes word(98) to be transferred to w3 and word(100) to be transferred to w0. T_ _ 2.2.7 H_a_l_f_ _l_o_a_d_ _(_h_l_)_ 2.2.8 H_a_l_f_ _s_t_o_r_e_ _(_h_s_)_ These instructions transfer of a single half-word between memory and the right half of a W register. The left half of the register is unaffected. Example: &_ hl w1 0 The left half-word of w0 (=half-word 0) is transferred to the right half-word of w1. Example: hs w0 2 The right half-word of w0 is stored in half-word 2 i.e. the left half-word of w1. \f 2.2.9 R_e_g_i_s_t_e_r_ _e_x_c_h_a_n_g_e_ _(_r_x_)_ The contents of the W registers are exchanged with the contents of the storage word addressed. Example: rx w3 0 ; Interchange of w3 and w0 Example: rl w0 100; w0:= word(100) rx w0 200; word(200):= word(100), w0:= word(200) rs w0 100; word(100):= word(200) (w0 = word(200)) These three instructions interchange the contents of word 100 and word 200. Example: The contents of w1 are to be transferred to w0. This is executed by each of the following 4 instruc- tions, but the first is the fastest (and "most natu- ral"). al w0 x1; or al w0 (2); or rl w0 2 ; or rs w1 0 2.2.10 E_x_c_e_p_t_i_o_n_ _L_o_a_d_ _(_x_l_)_ The contents of the three rightmost bits in the half-word addressed are loaded into the exception register. 2.2.11 E_x_c_e_p_t_i_o_n_ _S_t_o_r_e_ _(_x_s_)_ Extend the exception register towards the left with zeroes and store it in the half-word addressed. The exception register remains unchanged. 2.3 I_n_t_e_g_e_r_ _a_r_i_t_h_m_e_t_i_c_ 2.3.1 W_o_r_d_ _a_d_d_ _(_w_a_)_ 2.3.2 W_o_r_d_ _s_u_b_t_r_a_c_t_ _(_w_s_)_ The contents of the word addressed are added to/subtracted from the W register. Overflow and carry are noted in the exception register. \f T_ Example: The instructions rl w0 100 wa w0 102 ws w0 104 rs w0 106 &_ execute: word(106):= word(100) + word(102) - word(104); 2.3.3 W_o_r_d_ _m_u_l_t_i_p_l_y_ _(_w_m_)_ The W register is multiplied by the contents of the word addres- sed. The result appears in the corresponding double register. Overflow cannot occur. T_ Example: wm w0 100 will insert "w0 D*U word(100)" in the double &_ register w3, w0. 2.3.4 W_o_r_d_ _d_i_v_i_d_e_ _(_w_d_)_ The contents of the double register specified are divided by the contents of the word addressed. The quotient appears in the W register specified, and the remainder in the preceding register. The remainder has the same sign as the quotient. Overflow is noted in the exception register and in this case the double register remains unaltered. Example: The positive number in word(200) is to be divided by the contents of word(100). The quotient is to be stored in word(104) and the remainder stored in word(102). rl w1 200 ; w1:= word(200); al w0 0 ; w0:= sign(+); wd w1 100 ; divide; ds w1 104 ; word(102):= word(200) mod word(100); word(104):= word(200)/word(100); T_ 2.3.5 D_o_u_b_l_e_ _a_d_d_ _(_a_a_)_ 2.3.6 D_o_u_b_l_e_ _s_u_b_t_r_a_c_t_ _(_s_s_)_ &_ The instructions act as wa/ws but using double-word operands. Example: In copy loops etc. there are often two registers which must be updated simultaneously. This is often done using e.g. \f al w1 x1 + 2 al w2 x2 + 2 but the following could also be used: aa w2 - - where the address points at two numbers of value 2 (the latter method is slow, but saves space). Example: All double-word operations (dl, ds, aa, and ss) are carried out in two stages in that right-hand words in the operand are dealt with before left-hand words. Usually this is not important but if both operands are double registers and these overlap, surprising results may occur. The instruction aa w1 4 has as operands w0,w1 and w1,w2 and will be executed as the fol- lowing ALGOL statement sequence: w1:= w1 + w2; w0:= w0 + w1; It will be seen that in the second statement an updated w1 is one of the operands. T_ 2.3.7 E_x_t_e_n_d_ _(_a_n_d_)_ _a_d_d_ _(_e_a_)_ 2.3.8 E_x_t_e_n_d_ _(_a_n_d_)_ _s_u_b_t_r_a_c_t_ _(_e_s_)_ The contents of the half-word addressed are extended to a 24-bit operand (sign extension) which is added to/subtracted from the &_ contents of the W register. Example: calculate w0:= word(200) + half-word(351) - half-word(17); rl w0 200 ea w0351 es w0 17 Example: In connection with the al instruction it was seen that the con- tents of a register could be increased by 10, for example, in the following way: al w2 x2 + 10 This method cannot be used for W0, but incrementing/decrementing by 1 can be carried out in the following way: ea. w0 1 ; w0:= w0 + 1; es. w0 1 ; w0:= w0 - 1; \f In these instructions the number 1 is used both as an address and a data half-word, as the final address is (IC + 1) which points at the address (displacement) in the current instruction. T_2.4 F_l_o_a_t_i_n_g_ _p_o_i_n_t_ _a_r_i_t_h_m_e_t_i_c_ 2.4.1 F_l_o_a_t_i_n_g_ _a_d_d_ _(_f_a_)_ 2.4.2 F_l_o_a_t_i_n_g_ _s_u_b_t_r_a_c_t_ _(_f_s_)_ 2.4.3 F_l_o_a_t_i_n_g_ _m_u_l_t_i_p_l_y_ _(_f_m_)_ 2.4.4 F_l_o_a_t_i_n_g_ _d_i_v_i_d_e_ _(_f_d_)_ Note that floating point operands are always double-words. The &_ operand is added to (subtracted from,...) the contents of the double register specified and the result appears in the double register. Over- and underflow are noted in the exception register. 2.4.5 C_o_n_v_e_r_t_ _i_n_t_e_g_e_r_ _t_o_ _f_l_o_a_t_i_n_g_ _(_c_i_)_ Convert the w register, interpreted as an integer multiplied by 2** effective address, to a floating point number and place it in the corresponding double register. An overflow is registered in the exception register if the exponent exceeds the 12 bit range. 2.4.6 C_o_n_v_e_r_t_ _f_l_o_a_t_i_n_g_ _t_o_ _i_n_t_e_g_e_r_ _(_c_f_)_ Convert the specified double register, interpreted as a floating point number divided by 2** effective address, to an integer and place it in the register specified. An overflow is registered if the integer exceeds the 24 bit range. T_ 2.4.7 N_o_r_m_a_l_i_z_e_ _s_i_n_g_l_e_ _(_n_s_)_ 2.4.8 N_o_r_m_a_l_i_z_e_ _d_o_u_b_l_e_ _(_n_d_)_ The contents of the register (double register) are shifted to the &_ left until bit(0) is different from bit(1). The number of shifts (= normalization exponent) is stored with opposite sign in the half-word addressed. If the register contains 0, -2048 is stored. \f T_ 2.5 B_i_t_ _P_r_o_c_e_s_s_i_n_g_ 2.5.1 L_o_g_i_c_a_l_ _a_n_d_ _(_l_a_)_ 2.5.2 L_o_g_i_c_a_l_ _o_r_ _(_l_o_)_ 2.5.3 L_o_g_i_c_a_l_ _e_x_c_l_u_s_i_v_e_ _o_r_ _(_l_x_)_ In these operations the contents of the register specified as &_ well as the contents of the word addressed are regarded as 24 single bits which are processed in parallel. The result appears in the register specified. "Logical and" is used to zero bits in a word. "Logical or" is used to set bits to 1 and "logical exclu- sive or" is seldom used. T_ 2.6 S_h_i_f_t_ _o_p_e_r_a_t_i_o_n_s_ The operations shift the contents of a register (or a double re- gister) linearly (circular shift does not exist). The absolute &_ value of the address gives the number of shifts. Left shift for a positive address, and right shift for a negative address. Logical shift is distinguished from arithmetic shift. In the latter the sign is propagated on right shift, and possible overflow is noted (in the exception register) on left shift. T_ 2.6.1 A_r_i_t_h_m_e_t_i_c_ _s_i_n_g_l_e_ _(_a_s_)_ 2.6.2 A_r_i_t_h_m_e_t_i_c_ _d_o_u_b_l_e_ _(_a_d_)_ The operations act as a multiplication by 2 ** (effective ad- &_ dress). T_2.6.3 L_o_g_i_c_a_l_ _s_i_n_g_l_e_ _(_l_s_)_ 2.6.4 L_o_g_i_c_a_l_ _d_o_u_b_l_e_ _(_l_d_)_ The operations are analogous with "shift" in ALGOL. The chosen &_ working register (double or single) will be shifted as noted in the resulting address. It will be filled up with zeroes at both left and right shifts. Example: Calculate word(1000):= word(2000) shift(-9) extract 3; (word(100) is expected to contain a suitable pattern). \f T_ rl w0 2000 ; w0:= word(2000); ls w0 -9 ;shift(-9); la w0 100 ; and word(100); &_ rs w0 1000 ; word(1000):= w0; The contents of word(100) must be defined such that on logical multiplication all bits will be set to zero apart from the last three. That is, the last three bits in word(100) must = 1 and the other bits = 0. Thus word(100) must contain the number 7. Example: The contents of the last 4 bits of word(1002) are to be inserted in the word(1000) from bit(12) to bit(15). To achieve this 2 work areas (2000 and 2002) with bit patterns are used. Using the first, 4 bits are to extracted i.e. it must contain the binary number 1111 = 15. Using the second constant bit(12) - bit(15) are to be zeroed and all the other bits extracted. On calculating this bit pattern it is to be noted that the number "-1" consists of 1 bit only. Thus in this case it is easier to extract the unwanted bits from the number "-1". In SLANG notation the constant will appear as follows: -1-(15 8)or 2.111111111111000011111111 or 8.77770377 as 15 is 4 bits set to 1 and 8 is the number of places from the rightmost bit (i.e. from bit(23) to bit(15)). When the constants are set up, the program is as follows: T_ rl w0 1002; w0:= word(1002); la w0 2000 ; extract 4; ls w0 8;shift 8; rl w1 1000; w1:= word(1000); la w1 2002; clear bits (12-15); &_ lo w1 0 ; w1:= w1 or w0; rs w1 1000; word(1000):= w1; Example: w0 contains a text word (3 characters), which is to be stored character for character in the half-words (2000-2002); \f T_ al w3 0 ; ld w0 8 ; w3:= 1st character hs w3 2000 ; store 1st character al w3 0 ; ld w0 8 ; 2nd character hs w3 2001 ; al w3 0 ; ld w0 8 ; 3rd character &_ hs w3 2002 ; The last 3 instructions could be replaced by the two following, but they are slower than those above: T_ ls w0 -16 &_ hs w0 2002 T_ 2.7 J_u_m_p_ _i_n_s_t_r_u_c_t_i_o_n_s_ 2.7.1 J_u_m_p_ _w_i_t_h_ _l_i_n_k_ _(_j_l_)_ The effective address is transferred to the IC. If the W-field in the jump is greater than 0, the previous IC-value will be stored &_ in the W-register specified. If a W-register (only w1, w2, w3) is specified when using a jump instruction it corresponds to a CALL-statement in FORTRAN. For example, if word(900) contains the instruction: jl w3 1000 when this is reached at runtime 1) the jump instruction is fetched from memory 2) the final address is calculated (=1000) 3) the IC is updated to point at the next word (=902) 4) the jump instruction is carried out i.e. w3:= IC; IC:= address; i.e. w3:= 902 and IC = 1000. The next instruction is then taken from word(1000). If a jump to a procedure uses jl w3 ..... return can be made with the instruction jl x3 Parameters for a procedure will generally be transferred via the registers, but in some cases it is an advantage to have the para- meters positioned immediately after the call: \f T_ jl w3 1000 ; call add (2,3) &_ 2, 3 ; T_ the procedure will then appear as follows: rl w0 x3+0 ; w0:= 1st parameter wa w0 x3+2 ; + 2nd parameter &_ jl x3+4 ;return; Example: Often a procedure needs all 4 registers for intermediate results and thus must store the return address in a work variable. En- trance and exit may then appear thus: rs w3 1000 ; save return; - - - - - - - - - jl (1000); return; T_2.8 C_o_n_d_i_t_i_o_n_a_l_ _i_n_s_t_r_u_c_t_i_o_n_s_ All conditional instructions have the following construction: skip next instruction if ..... &_ T_ 2.8.1 S_k_i_p_ _e_q_u_a_l_ _(_s_e_)_ 2.8.2 S_k_i_p_ _n_o_t_ _e_q_u_a_l_ _(_s_n_)_ 2.8.3 S_k_i_p_ _l_e_s_s_ _t_h_a_n_ _(_s_l_)_ 2.8.4 S_k_i_p_ _h_i_g_h_e_r_ _t_h_a_n_ _(_s_h_)_ In these instructions the relation has the W register as the left &_ operand and the effective address as the right operand. Example: sn w0 100 al w3 0 Here the zeroing of w3 is skipped if w0 does notcon- tain the value 100. Note that an ALGOL comment to a skip instruction will contain the opposite condition: \f Example: sn w0 100 ; if w0=100 then al w3 0 ; w3:= 0; This is one of the reasons why most programming errors occur in the vicinity of skip instructions!!! T_ Example: The ALGOL statement: for w1:= 1 step 1 until 100 do begin ............. end; can be coded as (starting at word 2000): al w1 1 ;w1:= 1; - - - ; word2002; begin..... - - - ;..........end; al w1 x1+1 ; w1:= w1+1; sh w1 100 ; if w1 = 100 then jl 2002 ;goto word2002; &_ Example: A group of records are chained together such that the word with relative address, 10, contains the start address of the next record in the chain. If this address = -1, the chain is finished. T_ In ALGOL the chain can be run through thus: while chain ' -1 do begin - - - - - - chain:= record(chain,10); end; &_ T_ In SLANG it appears thus (first word is no. 2000): sn w2 -1 ; if chain = -1 then jl - - ; exit_loop; - - - - ; - - - - - - - ; - - - rl w2 x2+10 ; chain:= record(chain,10); &_ jl 2000 ;repeat; \f T_ C_o_m_b_i_n_e_d_ _c_o_n_d_i_t_i_o_n_a_l_ _i_n_s_t_r_u_c_t_i_o_n_s_ Example: if a = 2 or a = 4 then a:= 3; se w0 2 sn w0 4 al w0 3 &_ T_ if a = 2 and b = 4 then c:= 3; sn w0 2 se w1 4 jl. 4 al w2 3 &_ In this case the condition cannot be calculated directly so the opposite condition is calculated. If this holds true, jl. 4 is executed, thus skipping an instruction. T_ if a ' 0 and a 5 then a:= 17; sl w0 1 sl w0 5 jl. 4 &_ al wl 17 T_ Example: Comparison of double words: Jump to word2000 if double-word(900,902) ' double-word(800,802). dl w1 902 ; w0,w1:= double-word(900,902); sn w0 (800) ; jump if 1st part not true; se w1 (802) ; skip jump if 2nd part true; &_ jl 2000 ; T_ Example: Register comparison: continue if w2 ' w0 sh w2 (0) ;word(0) = w0; jl - - - continue if w2 = w3 + 10 se w2 x3+10; &_ jl - - - \f T_ Example: Simple if... then.... else.... w0:= if w1 = 2 then 100 else 200; se w1 2 ; am 100 ; al w0 100 ; &_ Example: Comparison of a primary storage word with a small constant without using registers: am (200) ; sh w2 x2-10 ; - - - - condition is: skip if w2 ' x2-10+word(200) which is skip if word(200)10 T_ 2.9 S_k_i_p_ _o_n_ _i_n_d_i_v_i_d_u_a_l_ _b_i_t_s_ 2.9.1 S_k_i_p_ _o_n_e_s_ _(_s_o_)_ The effective address is regarded as a 24-bit bit pattern. All the positions which are 1 in the address are examined in the W &_ register. If all = 1 the next instruction is skipped. 2.9.2 S_k_i_p_ _z_e_r_o_e_s_ _(_s_z_)_ The same effect as >so>, but all the specified bits in W register must = 0. Example: Rounding up an odd number to the nearest even number. sz w1 1 ; if w1 is odd then al w1 x1+1 ; w1:= w1+1; Example: Status word test. if parity error or block-length error then goto .....; As word(100) is meant to contain a bit pattern, where the two status bits = 1, the query can be written thus: sz w0 (100) ; if error bits = 0 then skip; 2.9.3 S_k_i_p_ _i_f_ _n_o_ _e_x_c_e_p_t_i_o_n_ _(_s_x_)_ The instruction acts as skip zeroes, using the exception regis-\f ter is used instead of a W-register (therefore this must not be stated in the instruction). Example: Word(100) is to be added to w0. On overflow a branch is made to word(2000). wa w0 100 ; sx 2 ; if overflow then jl 2000 ; goto....; The address "2" in the sx instruction is used because overflow is noted in bit(22) of EX (see "Reference Manual"). ). \f F_ 3 S_L_A_N_G_ The programming language used to describe the machine code is called SLANG (= Symbolic LANGuage). The SLANG input text contains two different types of information, 1. definition of that which is to be stored in the program (instructions, textstrings, and numbers) 2. information controlling the assembly (directives). A directly executable object program is produced on the backing storage. 3.1 S_i_m_p_l_e_ _d_i_r_e_c_t_i_v_e_s_ In the following section the most important directives will be described. A complete description follows in section 3.4.4. 3.1.1 C_o_m_m_e_n_t_s_ In the source text (input to the SLANG assembler) comments may be inserted between the delimiter, semicolon, and the "new line" character. Syntactically such a construction is equivalent to the "new line" character alone. In this case semicolon is a "command" to the SLANG assembler (a directive), which says: ignore all text until "new line" is read. 3.1.2 B_l_o_c_k_ _c_o_n_s_t_r_u_c_t_i_o_n_ A SLANG program can be structured in blocks as an ALGOL program. The intention is the same as with ALGOL: variable identifiers declared in an inner block are local to this and cannot cause conflict with identifiers of corresponding variables in an outer block. A block is initiated with "b". or "s." (the difference is ex- plained later in section 3.4). A block is terminated with "e.". 3.1.3 S_t_o_r_a_g_e_ _m_o_d_e_ The SLANG program consists of elements which may be instructions, text strings or variables. As it is not always possible to decide implicitly whether a variable can be contained in a half-word or a word, the programmer is required to state explicitly to the assembler how all elements of the program are to be stored. This is done using directives which define storage mode: \f "w." (= word mode) is the most usual, and states that all following elements are to be assembled as words. Variables, instructions and text strings may be stored in this mode. "h." (= half-word mode) states that the following program elements are to be stored as half-words. In this mode half-word variables and instruction codes may be stored, (the latter being the left half of an instruction, so this is seldom used). "f." (= floating point mode) can only be used to store floating point numbers. Storage mode must be defined at each block start (i.e. between "b." or "s." and the first program element to be stored). The mode may also be redefined at any time between two program ele- ments. On exit from a block (e.) the mode will be reset to that value which was valid immediately before entry into the block. On exit from half-word mode SLANG may store an extra half-word (containing 0), as a word (or double-word) must always begin with an even half-word address. Example: This example shows how numbers are stored in the various modes: Source text b. w. ; block start, word mode 2, 4, 6 ; integers b. f. ; new block, floating-point number 8, -1 ; floating-point number e. ; end inner block 8, -1 ; integers h. ; change to half-word mode 4, -1, 3000 ; half-words w. 117 ; word e. ; end outer block If these numbers are printed out after assembly as signed half- words, the result will be as follows: \f T_ half-word 1 half-word 2 0 2 ; integer word 0 4 ; integer word 0 6; integer word 1024 0 ; 0 4 ; floating point no. = 8 -2048 0 ; 0 0 ; floating point no. = -1 0 8 ; integer word -1 -1 ; integer word 4 -1 ; half-words -1096 0 ; half-words, 0 inserted by SLANG 0 117 ; integer word 3.2 Instruction addressing 3.2.1 D_i_r_e_c_t_ _a_d_d_r_e_s_s_i_n_g_ As it is only possible to address the first 2048 half-words with the displacement alone (negative storage-addresses do not exist), this addressing method is not much used, except for addressing of the register. 3.2.2 R_e_l_a_t_i_v_e_ _a_d_d_r_e_s_s_i_n_g_ If the R-field is included in the address (i.e. set to 1) it means that the value of the instruction counter will be added to the displacement before it is used as an address. This address, which is used by the operator, is called the effective address. When implemented the relative addressing means that regardless of where in the storage an operator is situated, it can reach its operands if they are placed less than 2048 half-words before or after the current instruction. In the SLANG-notation relative addressing is indicated by a period immediately following the instruction-code. Examples: jl. 0 The instruction will be executed an infinite number of times. jl. +6 Skip the two next instructions. 50000 Constant rl. w2 -2 Result w2:= 50000 3.2.3 I_n_d_e_x_e_d_ _a_d_r_e_s_s_i_n_g_ As well as it is possible to have the instruction counter added to one>s address, it is possible to specify that one of the working registers is to be part of the effective address. This is\f done by simply placing the number of the working register in the X-field - as "0" in the X-field means that this type of address- ing is not wanted, w0 can not be used in this way. In the SLANG- notation indexed addressing is indicated by means of x1, x2 or x3 between W-register and the displacement. When the working registers are used as described above, they are often called i_n_d_e_x_-registers. Normally index-registers are used in two principally different ways: 1) As basis-registers. Let us assume that x1 contains the address of the first word of a table. The effective address of the instruction "rl w0 x0+0" is: The start address +0, which means that the first table word will be fetched to w0. The instruction "rl w0 x1+2" will fetch the second table word etc. This type of addressing is well suited for processing a number of data- structures (e.g. simple tables) with an identical construc- tion. 2) As "real" index registers. Let us assume that a table is stored from word 1000 and forward and that the index value always is calculated in w1. A table word is thus fetched to w0 with the instruction "rl w0 x1+1000". Finally one can take advantage of the working registers also being index registers. Example: The instruction al w2 x2+100 will add 100 to w2 3.2.4 I_n_d_i_r_e_c_t_ _a_d_d_r_e_s_s_i_n_g_ Using this type of addressing a temporary address is calculated on the basis of the R, X and D-fields. A word with this address is fetched from the storage, and the contents of the word - regarded as an ordinary integer with a sign - constitutes the effective address. Example: If w1 contains the number 30, and the contents of word 100 is -5000 the instruction: al w3 (x1+70) will transfer the number -5000 to w3. \f In SLANG-notation indirect addressing is indicated by parentheses around the X-field and displacement. Indirect addressing is used e.g. in procedures as follows. When the procedure is entered, the return address is placed in one of the index-registers. As it is not normally possible to reserve a register for this purpose throughout the procedure, the return address will normally be stored in a working variable. When the exit from the procedure is to be made, the index register can, of course, be reestablished and the exit then made, but with in- direct addressing it is possible to exit indirectly via the working variable in which the return address is stored. Example: rs. w3 i1. ; save return . . . jl. (i1.) ; return i1: 0 3.3 N_a_m_e_s_ In the explanation of instruction addressing it was noted that in the majority of references to memory, the use of relative addres- sing is necessary. The manual calculation of relative addresses is difficult, and it is a complicated problem to correct the com- pleted program, as the insertion of a single half-word would alter all the addresses throughout the program. 3.3.1 D_e_c_l_a_r_a_t_i_o_n_ _o_f_ _i_d_e_n_t_i_f_i_e_r_s_ To help with declaration of identifiers SLANG has introduced identifiers which can be used as symbolic addresses (labels) - for both absolute and relative addressing. An identifier is a letter followed by a serial number. The let- ters may be "a" to "j" and "l" to "v". Example: Examples of identifiers: a0, b45, v322 All the local names for a block should be declared after "b." or "s.". The declarations must be made "letter by letter" by giving the letter and the maximum serial number. The declarations are\f separated by commas and concluded by the definition of the storage mode. Example: The local identifiers a0, a1, a2 and v0, v4 are used in a block. The block head for this block will appear thus: b. a2, v4 w. In declarations, identifiers will often be defined with serial numbers larger than necessary. This simplifies later amendments in the block as the insertion of a new identifier will not make alteration of the declarations necessary. The following standard names are used: s0 s1 these contain the sum and the double sum of the characters processed (not including comments etc.). s2 shortclock, meant for tails for insertproc, so that program entries will contain the time of the SLANG compilation. s3 Isodate, decimal s4 Clock, decimal s3 and s4 are meant for the date in code pro- cedures so that they will contain the time of the SLANG compilation. 3.3.2 T_h_e_ _r_e_s_e_r_v_e_d_ _i_d_e_n_t_i_f_i_e_r_ _"_k_"_ "k" is a reserved identifier which is updated by SLANG every time a half-word, word or double-word is stored. k is initialized to 0, and will, unless its value is explicitly altered, at all times gives the number of half-words SLANG has translated. Therefore k will always give the relative address, in relation to program start, of the next half-word which is to be stored. The current value of k can be transferred to an identifier by writing the identifier followed by a colon. The identifier is in this case called a label. Labels are used as symbolic addresses of storage locations. These may either be position in a program or data items. In floating point mode the identifier is given the value k+2 to simplify the addressing of floating-point numbers. Example: The current value of k can be transferred to an\f identifier in this way. a0: k A piece of code which is to be executed at assembly time should not contain assignments to the reserved identifier k. T_ 3.3.3 R_e_l_a_t_i_v_e_ _a_d_d_r_e_s_s_i_n_g_ _u_s_i_n_g_ _i_d_e_n_t_i_f_i_e_r_s_ If a word to be addressed is supplied with a label, relative &_ addressing will (nearly) always be used. The D field (displace- ment) in the instruction will then be "interval from the current instruction to the label", which may be expressed as "label-k". As this form of addressing is used in most instructions in a program, the expression is abbreviated to "label" followed by a period. The identifier in this case is called r_e_l_a_t_i_v_e_. This gives the general rule for addressing: If the address in an instruction is a label then this as well as the operator must be given with relative notation. Example: jl. w3 p12. ;call procedure p12; rl. w0 b0. ;w0:= word(b0); wa. w0 b2. ;w0:= w0+word(b2); rs. w0 b5. ;word(b5):= w0; al. w0 b5. ;w0:= word b5; As the values for the relative identifiers are calculated during the SLANG assembly, programs which use such relative addressing are not sensitive to amendments which alter the interval between the operators and their operands, whereas programs which contain relative intervals as fixed numbers (this has been used in pre- vious examples) will be nearly impossible to alter. 3.3.4 E_x_p_r_e_s_s_i_o_n_s_ _i_n_ _S_L_A_N_G_ Simple arithmetic expressions can be used for: 1) variable initialization 2) statement of address (definition of the D field) 3) definition of identifier values (to be explained later) 4) parameters for certain SLANG directives (this is explained later). \f The operands in a SLANG expression may be: 1) numbers 2) identifiers (both relative and absolute) - though only if the identifiers have been given a value previously in the program (see the following). 3) "k". All operands in SLANG expressions are regarded as 24-bit signed integers. Integers will, as a rule, be given as decimal numbers but other number systems may be used by giving the number as: "radix"."number in radix system" Example: The number 10 may be stated in the following ways: T_ 10 ;implicitly stated: decimal system 10.10 ;explicitly stated: decimal system 3.101 ;explicitly stated: ternary system &_ 2.1010 ;explicitly stated: binary system There is no syntactical upper limit on the value of the radix, but as digits can only be given with the characters "0", "1", ..."9", radix values greater than 10 can hardly be used in practice. As it is not tested whether a digit is larger than the radix a number such as the following may be stated: 2.256 This number would have the value ("normally" calculated as a polynomial): 4 * 2 * 2 * 5 + 1 * 6 = 24 The following operators may be used in expressions: ' respectively left, right shift (logical shift) * / multiplication, division + - addition, subtraction a. & both mean: and (i.e. logical multiplication) o. ! both mean: or (i.e. logical addition) The operators are given in order of priority (shift has highest priority). \f The order of priority can be altered by the use of parentheses supplied with colon "(:"and":)" - the normal parentheses are used for indirect addressing in instructions. Example: In the example k has the value 200, and a0 has the value 100 (for example, a0 could have been used as a label at a point where k had the value 100). a0+4 ;value = 104 a0-k ;value = -100 a0.-10 ;value = -110 (:a0.+200:)/a0 ;value = 1 k12+a0 ;819300(=200*2**12+100) 3.3.5 E_x_p_l_i_c_i_t_ _d_e_f_i_n_i_t_i_o_n_ _o_f_ _i_d_e_n_t_i_f_i_e_r_s_ It is shown above that an identifier can be assigned a value by declaring it as a label. A more direct method for assigning values is the explicit definition: "identifier" = "expression" where "expression" is a SLANG expression as described above. This gives the possibility of defining labels, as the expression may contain "k": Example: a2 = k a3 = k + 6 a5: a6 = a5 - 4 Example: Also a form of field variable as in ALGOL 7 may be introduced, as tables may be structured using identifiers with relative address values. A table contains elements of 4 words (a double-word, a word and two half-words). The table is stored beginning at a0. b0 = 8 ;defines element length b1 = 3 ;defines field variable for the double-word b2 = 5 ;defines field variable for the word b3 = 6 ;defines field variable for half-word 1 b4 = 7 ;defines field variable for half-word 2 \f If w2 gives the position of the current element in the table, this can be updated using the instruction: al w2 x2 + b0 ; w2:= next element; half-word 1 can be extracted with the instruction: el w0 x2 + b3 ; w0:= element.half-word1; If the double-word in element no. 17 is to be used this can be done by, for example: dl. w1 a0. + 17 * b0 + b1 (with this example it is shown, a little prematurely, that addres- ses in instructions may also be SLANG expressions). Finally, identifiers may be used as a kind of direct variable as according to the description of explicit definition it is valid to write, for example: a17 = a15 + 2 3.3.6 R_e_d_e_f_i_n_i_t_i_o_n_ _o_f_ _i_d_e_n_t_i_f_i_e_r_s_ Identifiers which have already been assigned a value can always be redefined using an expression. On the other hand it is not permitted to redefine using a label. Thus it is not entirely the same if the following are used: q43: or q43 = k as the latter form is a valid redefinition, whereas the former is only permissible if q43 has not been previously defined. "k" can be redefined as for explicitly defined names. In this con- nection it must be stressed that "k" is used for address calcula- tion in SLANG and has no influence as to where the program ele- ments are stored. T_3.4 P_r_o_g_r_a_m_ _e_l_e_m_e_n_t_s_ A program element is an instruction, a number, or a text string. Program elements are separated from each other by: 1. "new line" (or constructions which are syntactically &_ equivalent to "new line" e.g. comments) \f 2. a directive 3. a comma Any program element may have a label. Assignments (explicit definitions) may be placed anywhere among the program elements, but must be separated from them by one of the three constructions above. 3.4.1 I_n_s_t_r_u_c_t_i_o_n_s_ Instructions written in word mode, consist of an operation part and a D field value. The operation part begins with an operation code, then comes the specification of relative addressing ".", W register (w0,w1,w2, or w3), indirect addressing indication "(" and x register (x1,x2, or x3) in if the corresponding fields in the instruction are non-zero. The order of these specifications is not fixed but the order used above is usually followed. Note that a left parenthesis alone is required to specify an indirect address; a right parenthesis may also be used, it is treated as a blind symbol. The displacement value (D field) follows the operation part. This value may be given as: 1) a SLANG expression 2) an identifier (defined or undefined) 3) a relative identifier (defined or undefined). When the value is inserted, the SLANG assembler will check that it lies in the range -2048 to 2047. If not an alarm is given. If the displacement is given as an expression (defined names in- cluded) the value is inserted when the instruction is translated. In half-word mode, instructions may be written as a half-word containing the operation part (described in notation above) fol- lowed by a half-word giving the displacement value. This method of writing instructions has two points where errors can arise, firstly it is not checked that the operation part is stored in a half-word with an even address, and secondly relative addressing of identifiers is not quite the same as in word mode: \f T_ 1) k = 100, a9 = 200 w. al. w0 a9. ;the instruction is translated as: ;al. w0 100 &_ T_ 2) k = 100, a9 = 200 h. al. w0, a9. ;the instruction is translated as: ;al. w0 99 ;as k is updated between the two ;half-words &_ 3.4.2 N_u_m_b_e_r_s_ Integer numbers are stated in word or half-word mode as SLANG expressions or as undefined names (absolute or relative). In half-word mode the value has the range from -2048 to 4095 (corresponding to signed and unsigned half-words) - if this is not the case an alarm is given. In floating-point mode values can only be given as absolute deci- mal numbers according to the syntax in appendix D. 3.4.3 T_e_x_t_ _s_t_r_i_n_g_s_ Text strings may only be stored in word mode. All the characters between ":" and ":'" are taken as text and are stored. The only exception is the construction integer' which will be stored as a single character with the value "integer". A text string will always be held in a complete number of words. Any unused character positions in the last word will be zeroed (corresponding to the NULL character). As a rule it is desirable that texts are terminated by at least one NULL character, this will normally be explicitly inserted at the end of the text. T_ Example: :alpha0':' =' 2 words :ab:' =' 1 word &_ 3.4.4 D_i_r_e_c_t_i_v_e_s_ The following gives a complete list of all valid directives: ; comment. Everything up to a "new line" is ignored. m. m_essage. Everything up to a "new line" is printed out\f but is not included in the program (corresponds to "message" in ALGOL). b.s.e. block and segment definition. (The difference is de- scribed in the next section). h.w.f. definition of storage mode. Described previously. r. r_epetition. An expression must follow "r.". If this is greater than zero the last stored word (half-word or double-word - depending on storage mode) is repeated so that it occurs "expression" times. Repetition is used, for example, to set up variable areas inside the program. If the value of "expression" is less than (or equal to) zero, a warning is printed out. If the delimiter r. follows a k assignment, the word/ double-word value loaded expression'-1 times is unde- fined. c.z. c_ondition. After c. there follows an expression which determines whether the following program text - up to z. - is to be included in the program or not. If the value of the expression is less than zero the following SLANG code will be ignored. If the expression is greater than or equal to zero the code will be as- sembled. This method of determining assembly of certain parts of the program may be, for example, used to include text output in the program - controlled by an identifier which is defined at the beginning of the program. i. i_dentifier listing. All local defined names together with their values will be output during assembly. (The output can be suppressed with a parameter when calling the SLANG assembler). t.n. Read from the other input medium: The SLANG assembler will switch input from the current source text area to the medium from which the assembler was called. When n. is read from this medium, input is continued from the source text area. Examples of the use of these directives are given in the description of the SLANG assembler call. p.u. Copying of text. A specification of a source text must\f follow p. This is done by writing "p.text", where "text" is a normal SLANG text string containing a maximum of 11 characters.The SLANG assembler will replace "p.text" by the complete source text stored in "text". This source text must be terminated by "end medium" or "u". This directive can be used to copy standard procedures, etc. Examples of p. are given later. l.d. Used for selective listing of the source text. If it is specified in the call of the SLANG assembler that the program is to be listed during assembly (the parameters "list.yes" or "list.on") the listing may be terminated by using "d." (= "d_elete listing") and later reestab- lished using "l." (= l_ist). j. This directive causes the assembly to be halted and a jump made to the last instruction assembled. 3.4.5 j_._ _c_o_d_e_ The directive "j." causes the SLANG assembler to stop the assem- bly and call a procedure in the newly translated program. When this procedure returns, the translation will continue (or termi- nate with an error message, if specified). On "j." the reaction of the SLANG assembler is a jump (jl w3...) to the last stored word, with w1 and w2 pointing at the base for the file processor procedures (FP-BASE) and the internal varia- bles in the SLANG assembler (SLANG BASE), respectively. The SLANG internal variable of most interest is the pointer which gives the address of the word last stored. If this pointer is al- tered it is possible to make the SLANG assembler store the follow- ing section of the program on top of the "j." code and thus avoid the inclusion of this in the translated program. On entry into the procedure, w2 will point directly at the variable which con- tains the memory address of the location where the next half-word is to be stored. When control returns from the procedure to the SLANG assembler, w_0_ can be used to indicate whether a text, the start address of the text is in w0, is to be output by the assembler. If w_0_ = 0 there is no output. If w_2_ ' 0 on return, the SLANG assembler will output the error message "jump" and stop the translation. \f The directive "j." should never follow immediately after a k assignment. The S_l_a_n_g_ _b_a_s_e_ is the address of a table within the assembler, which contains the following entities: slang base: program top (first free word) +2 stack top (last free word) +4 not used +6 last k assignment +8 result name address ( -1 if noname) +10 jump to insert identifiers The meaning of the addresses p_r_o_g_r_a_m_ _t_o_p_ and s_t_a_c_k_ _t_o_p_ is illu- strated by the following map of the internal store: T_ assembled code jump entry: program top: free area stack top: identifier stack &_ The l_a_s_t_ _k_ _a_s_s_i_g_n_m_e_n_t_ is the address of the word defining the va- lue of the last k assignment. The r_e_s_u_l_t_ _n_a_m_e_ _a_d_d_r_e_s_s_ is the address of the first of four words defining the name of the catalog entry which describes the object program file. Identifiers may be defined or redefined inside a "j." code by a jump to slangbase +10. To illustrate the use of "j." see examples 4.8 and 4.9. 3.5 P_r_o_g_r_a_m_s_,_ _B_l_o_c_k_s_ _a_n_d_ _S_e_g_m_e_n_t_s_ Blocks are used in SLANG to control the scope of identifiers, in that all identifiers are local to the block in which they are de- clared. As in ALGOL, local identifiers as well all the global iden- tifiers (declared in an outer block and not in the local block)\f may be referenced from an inner block. The outer-most block delimits the program to be assembled. Segments have the same characteristics as a block but also have the important function of controlling the output of the transla- ted program to backing storage. While SLANG is translating a segment it lies in primary storage. When the terminating "e." is reached, the complete segment is transferred to backing storage, where the SLANG assembler will not make further modifications. This means that all names used in a segment must be defined before "e." is reached. The restriction can make reference from one segment to another very complicated. In the majority of cases programs will consist of one segment only. A program will only be written in segments when at assembly time it is so large that there is not room in primary storage for the whole program. Further it must be stressed that the concept "segment" in rela- tion to SLANG has nothing to do with segments of backing storage. As the SLANG assembler transfers program segments to backing storage these are placed directly after each other - without con- sideration to the physical format of the backing storage area. If several segments are "nested" the inner segments are treated as blocks - otherwise the program elements in the inner segments would be transferred before the outer segment, and references between the levels would not be in agreement. E_x_a_m_p_l_e_: Here is the skeleton of a program consisting of two segments (enclosed by delimiters s. and e.) surrounded by a global block to illustrate the nesting of segments and blocks: T_ b.- - - ;global block s.- - - ;segment 1 b.- - - e. ;local blocks b.- - - e. ; e. s.- - - ;segment 2 b.- - - ;local blocks b.- - - e. ; e. ; e. ; &_ e. \f 3.6 C_a_l_l_i_n_g_ _t_h_e_ _S_L_A_N_G_ _a_s_s_e_m_b_l_e_r_ The call has the following format: T_ 1 * program' = slang texts and parameters' 00 &_ program' is the name of a backing storage area where the SLANG assembler is to output the assembled program. If program' is not given in the call, output is not produced by the SLANG assembler. texts and parameters' consists of names of text files from which the SLANG assembler can read the program text (source program) and parameters controlling the assembly. Source files are read in the order stated in the call. If no source file is specified, input is taken from the current input medium. Parameters for the SLANG assembler begin with a keyword which defines the type of parameter. This is followed by one or more numbers or texts each starting with a period. The following list gives a survey of all parameter types. The underlined data is standard, that is, it is used where the parameter is not defined in the call. message.y_e_s_ states that texts after "m." are to be output during assembly. If this is not required the following is used: message.no warning.y_e_s_ specify whether warning messages are to be warning. no output. A warning is given, for example, if a half-word is specified to hold too large a value. names.yes states whether or not the directive "i" is to names.n_o_ cause output of identifier values. type.yes states whether or not the directive "t" is to type.n_o_ be used. entry.y_e_s_ states whether the SLANG assembler is to de- entry.no scribe the assembled program in the standard way (see the description of this in ref. 2). \f remove.y_e_s_ states whether the area containing the trans- remove.no lated program is to be removed in case of as- sembly error. list.yes states whether a_l_l_ source files are to be lis- list.n_o_ ted during assembly. The listing may be sup- pressed locally, though, using the directive d. and restarted using "l.". If "list.no" is specified, "d." and "l." are ignored. Each line in a program listing starts with a line number (which may be omitted) and the current value of "k". Then follows the contents of the line. list.on states whether or not the source files named list.o_f_f_ after this parameter are to be listed (not to be listed) - "d." and "l." are obeyed after a "list.on" parameter. This parameter is used when only a few of the source files for the SLANG assembler are to be listed. lines.y_e_s_ states whether line numbers are to be output lines.no on a listing, if any. xref.yes states whether a survey of all the identifiers xref.n_o_ used in the program is required. The survey relates in which lines the identifiers are defined and from which lines each identifier is referred to. The printout is sorted after block level and identifier. proc."names" described in the next section. 3.7 S_o_u_r_c_e_ _p_r_o_g_r_a_m_ _a_d_m_i_n_i_s_t_r_a_t_i_o_n_ As the source files may be specified in various ways the follow- ing shows several examples of calling the SLANG assembler. In all examples "prog" defines the backing storage file in which the assembled object program is to be stored. "text1", "text2" ... define the text files containing the source text (or file descriptors). \f In all the examples it is assumed that the SLANG assembler is called directly from the terminal - examples of other call forms are found in the following sections. Example: prog = slang text1 text2 The SLANG assembler reads in from text1; when "end medium" is reached, the assembler will read in from text2. If the outer block (segment) is terminated in text1, text2 will not be read. If the outer block (segment) is not terminated in either text1 or text2, the SLANG assembler adds "z.e." until the block is termi- nated ("z." is added to conclude any conditions in the program, extra "z." are ignored). Example: prog = slang The SLANG assembler will read in from current input. This method should not be used, as a single keying error can cause the whole program to be rejected by the SLANG assembler, and as the assem- bler does not save the source text, the whole program must be rekeyed. Example: Text1 contains a program text with 3 possible test outputs which are dependent on the values of the 3 identifiers t1, t2, and t3. At the beginning of the program these are initialized to "-1". The instructions for each test output can be made conditional by the following method, for example: c.t2; the following instructions are skipped if t20 - - ; test output - - ; z. ; end test output. Immediately after the initialisation of t1, t2, and t3 the pro- gram contains a "t.". If a program without test output is required, this is generated by the SLANG assembler call: prog = slang text1 As "t." is ignored unless the parameter "type.yes" is used in the call of the assembler, the program will be translated without any\f form of interruption. If the test output is to be included in the program, the call of the assembler appears thus: prog = slang text1, type.yes When the directive "t." is read by the assembler xxx type is output on the terminal (xxx is the current k value), and t1, t2, and t3 may be redefined depending on the form of test output required. The keying in is terminated by "n.". E.g. if test 2 and test 3 are required, the input is as follows: t2 = 1, t3 = 1 n. Example: In the previous example there was the possibility that the program instructions for each test output should be included several times in the program. To avoid repetition of the same instructions in several places, the 3 sets of instructions for the 3 test outputs could be written in "text5", "text6", and "text7". These areas can be copied using the "p." directive. The conditio- nal insertion of test output 2 could thus be written: c. t2, p.:text2:'; copies test output 2 if z. ; t2 ' 0 Example: In all the previous examples illustrating the use of "p.", the text has been described using a constant. The possibility exists of delaying the definition of the text identifier until assembly time as after "p." an integer may be written which refers to a text parameter in the assembler call. If the parameter proc.text6.text.7.text8 is given in the SLANG assembler call, "text6" may be referred to by writing "p.1", "text7" by writing "p.2" and "text8" by writing "p.3". 3.8 I_n_p_u_t_ _a_n_d_ _o_u_t_p_u_t_ As input/output operations are complicated, an auxiliary system exists which simplifies the input and output in a SLANG program. This system is called "the File Processor" (FP). This consists of a number of routines and procedures which are each responsible\f for simplifying a process concerned with input/output. Some of these procedures, concerned with reading or writing a character, text or number using current input/output, are described in this section. FP procedures are subroutines which all have names beginning with h. It is the rule, for all the procedures, that the return address must be found in w3. (For further information see ref. 2) T_ 3.8.1 R_e_a_d_ _a_ _c_h_a_r_a_c_t_e_r_ Call: jl. w3 h25. -2 ; read a character into w2 ; return Result: w0 : unchanged w1,w3 : destroyed w2 : contains the value of the character read. &_ Note that the contents of w1 are lost. Care should be taken that information which is to be saved, is not found in the working registers on the call of an FP procedure. T_ 3.8.2 O_u_t_p_u_t_ _a_ _c_h_a_r_a_c_t_e_r_ Call: jl. w3 h26. -2 ; outputs the character in w2 ; return &_ Result: A character, the value of which is contained by w2 before the call, is output. w0: unchanged w1,w2,w3: the contents are destroyed. &_ Note that the contents of w2 also are lost. This means, if the same character is to be output several times in a row, the value for the character must be inserted in w2 before each call of h26. \f T_ Example: The character "a" is to be output: al w2 97 ; w2:= :a:' jl. w3 h26.-2 &_ T_ 3.8.3 O_u_t_p_u_t_ _a_ _t_e_x_t_ _s_t_r_i_n_g_ Call: &_ jl. w3 h31. -2 ; output a textstring T_ Result: A text string, with the start address contained in w0, is output. w2: unchanged w0,w1,w3: destroyed &_ T_ Example: The text string "I am me" is to be output: al. w0 c5. ; w0:= start address of the text string jl. w3 h31.-2 ; output: I am me - - - - c5: : I am me 0' :' &_ T_ 3.8.4 O_u_t_p_u_t_ _a_ _n_u_m_b_e_r_ Call: jl. w3 h32.-2 ; output the number contained in w0 ; format &_ ; return point T_ Result: The number contained by w0 is output in a format defined by the constant format. w2: unchanged w0,w1,w3: destroyed &_ The constant format, which must be positioned in the word imme- diately after the call of h32, is constructed thus: sign 23 + filler 12 + positions. "Positions" states how many positions the number is to fill in the printout. The numbers are right justified. \f "Filler" states which character is to be used in the empty po- sitions, in those cases where there are not as many digits in the number as "positions" defines. Normally the filler is a space, which has the value 32. If "sign" is 1 the first position in the output is reserved for the sign (- for negative numbers and the filler characters for positive numbers). Example: The format 1 23 + 32 12 + 8 means that when the number -317 in w0 is to be output, it will fill 8 positions, the first posi- tion in front of the first significant digit will contain the sign, and the four empty positions to the left of the digits will contain spaces: _ _ _ _ _ _-_3_1_7_ T_ Example of call of h32 rl. w0 b7. ; w0:= number jl. w3 h32.-2 ; output number 1 23 + 32 12 + 8 - - - - - - &_ b7: -317 3.8.5 E_n_d_ _p_r_o_g_r_a_m_ The computer has no "stop instruction" so if a program is to be ended, the FP procedure h7 must be called, this ensures a suit- able ending. Call: jl. h7. ; end of program Effect: The program is ended, and if w2 ' 0 error messages are output depending on which bits in w2 are set to 1. As the programmer may not define the contents of the error message, w2 is usually set to 0. Example: al w2 0 jl. h7. The h7 call does not necessarily have to be positioned as the last instruction in the program, but it must be the last the program executes. \f 3.8.6 C_o_n_s_t_r_u_c_t_i_o_n_ _o_f_ _a_ _p_r_o_g_r_a_m_ _w_h_i_c_h_ _m_a_k_e_s_ _u_s_e_ _o_f_ i_n_p_u_t_ _a_n_d_ _o_u_t_p_u_t_ _r_o_u_t_i_n_e_s_ When one or more FP procedures are to be used in a SLANG program, four things must be done: 1. At the start of the program k must be set to h55, thus making room for FP. (h55 is used instead of 1536). 2. The two first elements in the program must contain zero (because program execution starts at word 3) 3. The program must be supplied with an extra e. Example: s. d. ; delete listing p.:fpnames:' l. ; reset listing k = h55 w. 0,0 ..... .....program ..... al w2 0 jl. w3 h7. ; end e. e. ; end for the fpnames 4. When FP procedures are used the source file :fpnames:' must be assembled together with the program. T_ 3.9 Code Procedure A code procedure is a special kind of external procedure which can be called from an ALGOL/FORTRAN program; contrary to the normal external procedures, the whole procedure is written in SLANG, either to give a faster run or to utilize possibilities &_ which are not available in ALGOL/FORTRAN. A code procedure can be called from an ALGOL/FORTRAN as a normal procedure and information can be exchanged between a code proce- dure and the program by means of parameters, own variables or the ALGOL/FORTRAN running system. Procedures of any kind may again be called from a code procedure. The necessary entries in the catalog for a code procedure may be inserted during the SLANG translation of the procedure by means\f of a standardfile i_n_s_e_r_t_p_r_o_c_. The inserproc file contains an auxiliary code which is able to create catalog entries as speci- fied by the code procedure in the socalled tail part. Three files are needed in the SLANG translation: 1. The file f_p_n_a_m_e_s_ 2. The file(s) containing the c_o_d_e_ _p_r_o_c_e_d_u_r_e_ _f_i_l_e_ 3. The file i_n_s_e_r_t_p_r_o_c_. f_p_n_a_m_e_s_:_ The file fpnames is a standard file containing definitions of the File Processor h-names: b. h100 w. h0=-28, h1=-18, ........... C_o_d_e_ _p_r_o_c_e_d_u_r_e_ _f_i_l_e_:_ The code procedure file must be organized as follows: b. g1,... w. ; Declaration of names used in the tail part and ; insertproc. No h-names may be declared here. s. a.... w. ; This Slang segment contains one or more code ; procedure segments of 512 half-words each and ; organized as shown in ref. 3. e. ; End of Slang segment. ; T_a_i_l_ _p_a_r_t_: Here follows a list of t_a_i_l_s_ to be ; inserted into the catalog. They describe the code ; procedure entries and the corresponding parameter ; specifications. The first word of the first tail ; is labelled g0. The first word of the last tail ; is labelled g1. I_n_s_e_r_t_p_r_o_c_:_ The file i_n_s_e_r_p_r_o_c_ contains: b. a....w. ; A piece of code which, if necessary, creates the ; catalog entries describing the code procedures ; and inserts the tail parts from the code proce- ; dure file. e. ; End of block for insertproc. e. ; End of block for names used in tails. j. ; Jump to insertproc e. ; End of block for fpnames. The auxiliary code for insertproc occupies for the moment around 600 half-words in primary storage. \f T_a_i_l_:_ A tail consists of 20 half-words corresponding to the words de- scribed in the manual of the File Processor (Ref. 3). The first tail will become the tail of an area entry in the catalog. The corresponding area holds the segments of the code procedure. Other tails, if any, refers then to this area. For further in- formation about code procedures, see ref. 3. \f F_ 4 P_r_o_g_r_a_m_m_i_n_g_ _e_x_a_m_p_l_e_s_ E_x_a_m_p_l_e_ _1_. The following shows how to program a procedure. Entry is made by jl. w3 d18. ;procedure read char (char) ;comment: unpacks the next character from a storage ;address initialized by init read. ; call: return: ;w0 char ;w1 unchanged ;w2 unchanged ;w3 link link b.i24 ;begin w.d18: rx.w1 i1. ; rx.w2 i2. ; sh w1 0 ; if readshift'0 then jl. i0. ; begin al w1 -16 ; readshift:=-16; al w2 x2+2 ; readaddr:=readaddr+2; i0: rl w0 x2+0 ; end; ls w0 x1+0 ; char:=word(readaddr) shift readshift; la.w0 i3. ; char:=char(17.23); al w1 x1+8 ; readshift:=readshift+8 rx.w1 i1. ; rx.w2 i2. ; jl x3+0 ; i1: 0 ;readshift: i2: 0 ; readaddr: i3: 8.177 ; e. ;end \f T_ E_x_a_m_p_l_e_ _2_._ ; this program will copy from current input to current output s. a0; w. ;begin d. ; p.:fpnames:' ;k:=first address after fp l.; k=h55; 0 ; 0 ; ;entry: a0: jl. w3 h25.-2 ;loop: inchar(in,w2); jl. w3 h33.-2 ; outend(out,w2); jl. a0. ; goto loop; e. ;end fpnames e. ;end program If above slang text is stored in text2 the program is translated by copy=slang text2 and called by &_ copy E_x_a_m_p_l_e_ _3_._ ;this program will calculate and output the sum of n half-word ;elements in an array s. a2 ;begin w.; d.; p.:pfnames.'; ; k=first address after fp l. ; k=h55 ; 0 ; 0 ; al w0 0 ;entry: sum:=0; al w1 0 ; index:=0; a0: ea. w0 x1+a1. ;loop: sum:= sum+a(index); al w1 x1+1 ; index:=index+1; se. w1 (a2.) ; jl. a0. ; if index'n then goto loop; \f jl. w3 h32.-2 ; out integer(out,w0); 123+3212+5 ; layout -dddd' al w2 10 ; w2:=NL; jl. w3 h33.-2 ; outend(out,NL); al w2 0 ; status:=ok; jl. h7. ; goto end program a2: 5 ; n h. ; store in half word mode a1: 2 ; a(0) 3 ; a(1) 4 ; a(2) 7 ; a(3) 9 ; a(4) (is not summed) e. ;end segment e. ;end fpnames E_x_a_m_p_l_e_ _4_._ s. a4 w. d. p.:fpnames:' l. k=h55 0,0 ;this program calculates and outputs all the Fibonacci numbers ;which are less than 10000 a4: al w2 10 jl. w3 h26.-2 ;output lineshift rl. w0 a0. ;w0:= first no. rl. w1 a1. ;w1:= second no. wa w0 2 ;w0:= first no. + second no. rs. w1 a0. ;first no.:= second no. rs. w0 a1. ;second no.:= new no. ws. w0 a2. sh w0 0 ;is new no. ' 10000 jl. a3. ;no - go to continue al w2 0 ;yes - end jl. h7. a3: wa. w0 a2. ;continue jl. w3 h32.-2 ;output number 3212+6 jl. a4. a0:0 a1:1 a2:10000 e. e. \f Output: 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 E_x_a_m_p_l_e_ _5_._ s. a2, c1 w. d. p.:fpnames:' l. k=h55 0,0 ;this program reads in and outputs characters using the following ;rules: non-numeric characters are output directly, one or more ;consecutive digits are regarded as a number, and this is used as ;a repetition factor for the output of the immediately following ;character. al w0 0 ;w0:=0 a0 jl. w3 h25.-2 ;read a character sn w2 25 ;= EM jl. a2. ;yes - go to end sl w2 48 ;no sl w2 58 ;is it a digit? jl. a1. ;no - go to write char. wm. w0 c0. ;yes - number:= number x10 al w2 x2-48 ;digit:=char-48 wa w0 4 ;number:=number+digit jl. a0. ;go to read char. \f a1. rs. w2 c1. ; jl. w3 h26.-2 ;write character sh w0 1 ;number=0 jl. a0.-2 ;yes - go to read char. es w0 1 ;no - number:=number-1 rl. w2 c1. ; jl. a1.+2 ;go to write character a2: al w2 0 ;end jl. h7. c0: 10 c1: 0 e. e. E_x_a_m_p_l_e_ _6_._ r=slang type.yes s. a2, w. p.:fpnames:', k=h55, 0, 0 ;The program reads a row of characters, terminated by ;NL. ;Each character is output, followed by its character ;value. a0: al w2 10 ;start jl. w3 h26.-2 ;write NL jl. w3 h25.-2 ;read a character sn w2 10 ;is it NL? jl. a1. ;yes - go to end rs. w2 a2. ;no - save character jl. w3 h26.-2 ;write character rl. w0 a2. ;fetch character jl. w3 h32.-2 ;write character value 32 12 + 4 jl. a0. ;go to start a1: al w2 0 jl. h7. ;end a2: 0 e. e. r abed 123.,/ finis \f When the job is executed, the following output will appear: 0 fpnames 0 type output from slang ok 1/32/1 the SLANG assembler a 97 b 98 c 99 d 100 32 output from 1 49 the program 2 50 3 51 . 46 , 44 &_ / 47 E_x_a_m_p_l_e_ _7_._ Many SLANG coded programs contain a table of am instructions, modifying an al instruction selecting a certain text or table. As an example consider the following construction: T_ ;texts for actions: t0: :text00':' t1: :text10':' . . . tN::textN0':' ;next action, prints some text and then continues n0: am t0-t1 ;w1:= addr text0 n1: am t1-t2 ;w1:= addr text1 . . . nN: al. w1 tN. ;w1:= addr textN r0: jl. w3 d7. ;call some procedure using the ... ;data pointed at by w1 &_ ... select next action ... An alternative - and often faster - solution to the same problem is to let a jl instruction select the table or text address: \f n0: jl. w1 r0., :text00':';w1:= addr text0 n1: jl. w1 r0., :text10':';w1:= addr text1 . . . nN: jl. w1 r0., :textN0':';w1:= addr textN ... r0: jl. w3 d7. ;... E_x_a_m_p_l_e_ _8_._ The following example shows a jump action that looks up and changes the catalog entry describing the result file. At the end the jump action decreases the program top with the size of the jump code, thus preventing it from being included in the final program: b. a4 ;begin w. a0: rs w3 a3. ;jump action: al. w1 a2. ; rl w3 x2+8 ; jd 111+42 ;look up entry (result name, tail, result), se w0 0 ;if result ' 0 jl. a1. ;then terminate slang; - - - -;change tail as desired jd 111+44 ;change entry (result name, tail, result); se w0 0 ;if result ' 0 jl. a1. ;then terminate slang; rl w1 x2+0 ; al w1 x1+a4 ;program top:= rs w1 x2+0 ;program top - size of jump action; al w2 0 ; a1: al w0 0 ; continue slang; jl. (a3.) ; a2: 0, r.10 ;tail: a3: 0 ;return address: jl. a0. ;entry point: a4=a0. ;size of jump action: j. ; goto jump action; ;end k=a0 e. E_x_a_m_p_l_e_ _9_._ Identifiers may be defined or redefined inside a j. code by a jump to slangbase+10 \f call return w0 value destroyed w1 id-letter12+id-index destroyed w2 - destroyed w3 link destroyed If the identifier is undeclared, the procedure returns to link else to link+2 The following example illustrates how the identifier a120 is defined (redefined) to the value 158, from a routine inside a jump code: i0: 158 ;value (a120) i1: 9712+120 ;id:=a120; i2: 0 ;slang base, saved w2 at entry of ;j. code, see section 3.4.5 ... rl. w0 i0. ; rl. w1 i1. ; rl. w2 i2. ; jl w3 x2+10 ; jl. e0. ;error return: goto alarm ;ok return: ... \f F_ A_p_p_e_n_d_i_x_ _A_ A_s_s_e_m_b_l_y_ _M_e_s_s_a_g_e_s_ During assembly, certain control and error messages will be prin- ted on the current output medium. Most of these include the value of the load address k. This, in combination with a listing of iden- tifier values, facilitates the identification of trouble spots. The following are normal CONTROL messages: k' type The delimiter t. causes switching from a source file to the currrent input medium. message comment' The delimiter m. causes printing of a message comment. ;k' id list b.declaration' id list' The delimiter i. causes printing of declarations and identifier values local to the current block orseg- ment. k'no' address overflow: value' k' address overflow: value' An address part has a value value' outside the range -2048 to 2047. The address part of a jd-instruction can, however, lie in the range -2048 to 4095. Thus monitor calls will not cause warnings during assembly. no' indicates the load address where this variable was used as an erroneous address part. k'no' half-word overflow: value' k' half-word overflow: value' A half-word value is outside the range -2048 to 4095. no' indicates the load address where this variable was used as an erroneous half-word. slang ok slang segments'/half-words'/backing storage segments' SLANG returns to the fp and sets the ok bit to true. The size of the assembled program is expressed as the number of SLANG segments, half-words, and backing storage segments output. \f During a call of the assembler the following messages can appear: ***slang param illegal parameter' Illegal parameter syntax. The parameter is ignored. ***slang work area connect result' The result file cannot be connected for output. Assem- bly is performed without binary output. ***slang work area kind result' The kind of the result file is neither backing store nor magnetic tape. Assembly is performed without binary output. During assembly, warnings are printed in the following cases: k' cancel Input of a CAN character from typewriter causes all previous characters on the current text line to be skipped. k' illegal character value' Input of a blind control character other than NUL, CR, or DEL. k' file mark Troubles encountered during output of final tape mark on magnetic tape. k' relative A relative identifier is used as address part in an instruction without relative addressing. k' repetition A repetition expression with a value less than 1. The following error messages cause everything up to next separa- tor to be skipped: k' syntax Illegal structure of delimiters and operands. k'identifier' declaration An identifier is declared twice in the same block head, or a declaration index exceeds 4095. \f k'identifier' undeclared An identifier is used without being declared. k'identifier' definition An identifier that has been defined elsewhere by a label or an assignment is redefined by a label within the same block. k'identifier' undefined An identifier is undefined when an expression is eva- luated; or an identifier declared outside of a segment is undefined when it is used within the segment. k' undefined at end One or more identifiers that have been used as half- words or words are undefined on exit from the block in which they are declared. Each undefined identifier is followed by the addresses at which it has been used. k' program too big The binary output exceeds the capacity of the result file. Assembly continues without binary output. The following situations cause immediate termination of assembly: k' stack The size of the object code and the identifier table ex- ceeds the available internal store. This can be remedied either by using a larger process during assembly or by dividing the source program into segments. k' connect source file' A source file cannot be connected for input. k' source unknown source file' A source file cannot be found. k' connect source integer' The SLANG parameter list does not contain a procedure source number integer'. k' no text source file' A source file contains a character with a value ' 127. \f k' end source The last source file is empty before the logical pro- gram end. The missing number of "z."s and "e."s are generated by the assembler. k' jump Working register 2 ' 0 on return from a jump action. k' slang fault Caused by a programming error in the assembler. Please send a listing of the source text and the assembly mes- sages to Regnecentralen. A_l_l_ error messages cause the following final assembly message: ***slang sorry number of errors'slang segments'/ half-words'/backing storage segments' The ok-bit is only set to false if there was an error message. If the source text is empty before a block begin (b. or s.) is read, the ok bit is also set to false and the assembly message is: ***slang no program \f F_ A_p_p_e_n_d_i_x_ _B_ R_C_ _8_0_0_0_ _I_n_s_t_r_u_c_t_i_o_n_ _s_e_t_ Mne- Nu- monic meric C_o_d_e_ C_o_d_e_ A_d_d_r_e_s_s_ _h_a_n_d_l_i_n_g_ am Next Address, Modify 9 al Address, Load 11 ac Address Complemented, Load 33 R_e_g_i_s_t_e_r_ _t_r_a_n_s_f_e_r_ hl Half Register, Load 3 hs Half Register, Store 26 rl Register, Load 20 rs Register, Store 23 rx Register and Memory Word, Exchange 25 dl Double Register, Load 54 ds Double Register, Store 55 xl Exception Register, Load 16 xs Exception Register, Store 27 I_n_t_e_g_e_r_ _h_a_l_f_-_w_o_r_d_ _a_r_i_t_h_m_e_t_i_c_ zl Integer Half-word, Zero Load 19 el Integer Half-word, Extend (and) Load 2 ea Integer Half-word, Extend (and) Add 18 es Integer Half-word, Extend (and) Subtract 17 I_n_t_e_g_e_r_ _w_o_r_d_ _a_r_i_t_h_m_e_t_i_c_ wa Integer Word, Add 7 ws Integer Word, Subtract 8 wm Integer Word, Multiply 10 wd Integer Word, Divide 24 I_n_t_e_g_e_r_ _d_o_u_b_l_e_-_w_o_r_d_ _a_r_i_t_h_m_e_t_i_c_ aa Integer Double-Word, Add 56 ss Integer Double-Word, Subtract 57 \f F_ Mne- Nu- monic meric C_o_d_e_ C_o_d_e_ A_r_i_t_h_m_e_t_i_c_ _c_o_n_v_e_r_s_i_o_n_ ci Convert Integer to Floating 32 cf Convert Floating to Integer 53 F_l_o_a_t_i_n_g_-_p_o_i_n_t_ _a_r_i_t_h_m_e_t_i_c_ fa Floating, Add 48 fs Floating, Subtract 49 fm Floating, Multiply 50 fd Floating, Divide 52 L_o_g_i_c_a_l_ _o_p_e_r_a_t_i_o_n_s_ la Logical And 4 lo Logical Or 5 lx Logical Exclusive Or 6 S_h_i_f_t_ _o_p_e_r_a_t_i_o_n_s_ as Arithmetic Shift Single 36 ad Arithmetic Shift Double 37 ls Logical Shift Single 38 ld Logical Shift Double 39 ns Normalize Single 34 nd Normalize Double 35 S_e_q_u_e_n_c_i_n_g_ jl Jump with Register Link 13 sh Skip if Register High 40 sl Skip if Register Low 41 se Skip if Register Equal 42 sn Skip if Register Not Equal 43 so Skip if Register Bits One 44 sz Skip if Register Bits Zero 45 sx Skip if No Exceptions 46 sp Skip if No Write Protection 21 re Return from Escape 22 \f F_ Mne- Nu- monic meric C_o_d_e_ C_o_d_e_ M_o_n_i_t_o_r_ _c_o_n_t_r_o_l_ je Jump with Interrupt Enabled 15 jd Jump with Interrupt Disabled 14 gp General Register, Put 47 (unassigned) 31 ri Return from Interrupt 12 (unassigned) 30 gg General Register, Get 28 (unassigned) 0 (unassigned) 51 do Data Out 1 di Data In 29 (unassigned) 58 (unassigned) 59 (unassigned) 60 (unassigned) 61 (unassigned) 62 (unassigned) 63 \f F_ A_p_p_e_n_d_i_x_ _C_ R_C_ _4_0_0_0_ _I_n_s_t_r_u_c_t_i_o_n_ _s_e_t_ Mne- Nu- monic meric C_o_d_e_ C_o_d_e_ A_d_d_r_e_s_s_ _h_a_n_d_l_i_n_g_ am Next Address, Modify 9 al Address, Load 11 ac Address Complemented, Load 33 R_e_g_i_s_t_e_r_ _t_r_a_n_s_f_e_r_ hl Half Register, Load 3 hs Half Register, Store 26 rl Register, Load 20 rs Register, Store 23 rx Register and Memory Word, Exchange 25 dl Double Register, Load 54 ds Double Register, Store 55 xl Exception Register, Load 16 xs Exception Register, Store 27 I_n_t_e_g_e_r_ _h_a_l_f_-_w_o_r_d_ _a_r_i_t_h_m_e_t_i_c_ bz Integer Half-word, Zero Load 19 bl Integer Half-word, Extend (and) Load 2 ba Integer Half-word, Extend (and) Add 18 bs Integer Half-word, Extend (and) Subtract 17 I_n_t_e_g_e_r_ _w_o_r_d_ _a_r_i_t_h_m_e_t_i_c_ wa Integer Word, Add 7 ws Integer Word, Subtract 8 wm Integer Word, Multiply 10 wd Integer Word, Divide 24 I_n_t_e_g_e_r_ _d_o_u_b_l_e_-_w_o_r_d_ _a_r_i_t_h_m_e_t_i_c_ aa Integer Double-Word, Add 56 ss Integer Double-Word, Subtract 57 \f F_ Mne- Nu- monic meric C_o_d_e_ C_o_d_e_ A_r_i_t_h_m_e_t_i_c_ _c_o_n_v_e_r_s_i_o_n_ ci Convert Integer to Floating 32 cf Convert Floating to Integer 53 F_l_o_a_t_i_n_g_-_p_o_i_n_t_ _a_r_i_t_h_m_e_t_i_c_ fa Floating, Add 48 fs Floating, Subtract 49 fm Floating, Multiply 50 fd Floating, Divide 52 L_o_g_i_c_a_l_ _o_p_e_r_a_t_i_o_n_s_ la Logical And 4 lo Logical Or 5 lx Logical Exclusive Or 6 S_h_i_f_t_ _o_p_e_r_a_t_i_o_n_s_ as Arithmetical Shift Single 36 ad Arithmetical Shift Double 37 ls Logical Shift Single 38 ld Logical Shift Double 39 ns Normalize Single 34 nd Normalize Double 35 S_e_q_u_e_n_c_i_n_g_ jl Jump with Register Link 13 sh Skip if Register High 40 sl Skip if Register Low 41 se Skip if Register Equal 42 sn Skip if Register Not Equal 43 so Skip if Register Bits One 44 sz Skip if Register Bits Zero 45 sx Skip if No Exceptions 46 sp Skip if No Write Protection 21 kl Protection Key Load 22 \f F_ Mne- Nu- monic meric C_o_d_e_ C_o_d_e_ M_o_n_i_t_o_r_ _c_o_n_t_r_o_l_ je Jump with Interrupt Enabled 15 jd Jump with Interrupt Disabled 14 ic Interrupt Bits Clear 47 is Interrupt Register Store 31 ml Mask Register Load 12 ms Mask Register Store 30 pl Protection Register Load 28 ps Protection Register Store 29 ks Protection Key Store 51 io Input Output 1 aw Autoload Word 0 (unassigned) 58 (unassigned) 59 (unassigned) 60 (unassigned) 61 (unassigned) 62 (unassigned) 63 \f F_ A_p_p_e_n_d_i_x_ _D_ T_h_e_ _S_L_A_N_G_ _s_y_n_t_a_x_ The method employed to describe the SLANG syntax is the widely used Backus notation. A short description of the meaning of the symbols used is given in the following: name' the symbols "'" indicate that "name" is the name of a class of marks and that in a given situation "name" is replaced by a member of the name class. / means OR ::= this symbol means that, in a specific situation, that to the left of the symbol should be replaced by a mem- ber(s) of its class given on the right-hand side of the symbol. In other words, by doing this, we go from the general to the specific. Look below at the syntax of the character set. Here digit' describes a class and the marks 0 1 2 3 4 5 6 7 8 9 are all members of this class. This also illustrates the meaning of the ::= sign. In moving from left to right in the description we go from the general to the specific; e.g. 4 is a specific member of the digit class. In writing instructions blanks can be used as required as SLANG is position independent. 1_._ _C_h_a_r_a_c_t_e_r_ _S_e_t_ S_y_n_t_a_x_ assembly character'::= digit'/letter'/special character'/ space'/new line' digit'::= 0/1/2/3/4/5/6/7/8/9 letter'::= a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/æ//å/ A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/Æ//Å \f T_ special character'::= "/ /</%/&//(/)/*/+/,/-/./slash'/:/;//=/'/?/@// _/ >/ /apostrophe' &_ S_e_m_a_n_t_i_c_s_ SLANG accepts a subset of ISO-7 bit character set consisting of all grahics plus the layout character space, new line, vertical tabulation, and form feed. All other ISO characters are treated as blind symbols. Outside a textstring, SLANG does not distinguish between small letters and capital letters, and all spaces are ignored. space'::= SP' new line'::= NL'/VT'/FF' 2_._ _N_u_m_b_e_r_s_ S_y_n_t_a_x_ number'::= real number'/integer'/radix number' real number'::= decimal number'/exponent'/decimal number' exponent' decimal number'::= integer'/fraction'/integer'fraction' fraction'::= .unsigned integer' exponent'::= integer' radix number'::= radix'unsigned integer' radix'::= unsigned integer'. integer'::= unsigned integer'/+unsigned integer'/-unsigned integer' unsigned integer'::= digit'/unsigned integer'digit' S_e_m_a_n_t_i_c_s_ SLANG accepts three types of numbers: real numbers, integer num- bers and radix numbers. R_e_a_l_ _n_u_m_b_e_r_s_ and i_n_t_e_g_e_r_ _n_u_m_b_e_r_s_ have their conventional meaning. The exponent part of a real number is expressed as an integral power of 10. R_a_d_i_x_ _n_u_m_b_e_r_s_ are expressed as a radix followed by a digitstring, for example, 2.110111 (a binary number) or 8.4357 (an octal number). The radix can be greater than 9, but in any case the number is converted digit by digit as follows: number:=radixD*Unumber+digit \f T_ E_x_a_m_p_l_e_s_ Real: 33 +4956 -0.67 +8 Integer: 225 +17 -588 0 Radix: 2.101 5.3241 8.4692 &_ 3_._ _I_d_e_n_t_i_f_i_e_r_s_ S_y_n_t_a_x_ identifier'::= declared identifier'/load address' declared identifier'::= identifier letter'unsigned integer' identifier letter'::= a/b/c/d/e/f/g/h/i/j/l/m/n/.../v load address'::= k S_e_m_a_n_t_i_c_s_ An i_d_e_n_t_i_f_i_e_r_ is a symbolic name given either to a s_t_o_r_a_g_e_ l_o_- c_a_t_i_o_n_ in the object program or to the value of an e_x_p_r_e_s_s_i_o_n_ evaluated by the assembler. L_o_a_d_ _A_d_d_r_e_s_s_ The letter k is a reserved identifier for the l_o_a_d_ _a_d_d_r_e_s_s_ of the current half-word or word. k is initialized to zero before assemb- ly. T_ E_x_a_m_p_l_e_s_ k a0 d25 hl23 &_ 4_._ _E_x_p_r_e_s_s_i_o_n_s_ S_y_n_t_a_x_ expression'::= sign'term'/expression'operator'term' term'::= operand'/(:expression':) operator'::= +/-/*/slash'//'/a./o. sign'::= empty'/+/- operand'::= unsigned integer'/radix number'/identifier'/ relative identifier' relative identifier'::= declared identifier'. S_e_m_a_n_t_i_c_s_ An e_x_p_r_e_s_s_i_o_n_ specifies the computation of an integer value during assembly. All o_p_e_r_a_n_d_s_ and intermediate results are evaluated as 24-bit integers. I_d_e_n_t_i_f_i_e_r_s_ An identifier used as a computational operand must have a value when the expression is evaluated, i.e. it must be defined either by a previous expression or through its use as a label. \f An identifier followed by a period is evaluated r_e_l_a_t_i_v_e_l_y_ to the current load address. For example the value of b2. is b2-k O_p_e_r_a_t_o_r_s_ The arithmetic o_p_e_r_a_t_o_r_s_ + - * / have their conventional meanings of a_d_d_i_t_i_o_n_, s_u_b_t_r_a_c_t_i_o_n_, m_u_l_t_i_p_l_i_c_a_t_i_o_n_ and d_i_v_i_s_i_o_n_. The s_h_i_f_t_ operators and ' shift the left-hand operand logically left or right the number of bit positions specified by the right-hand operand. The Boolean operators a. and o. form the a_n_d_ and o_r_ combinations of the two operands bit by bit. P_r_e_c_e_d_e_n_c_e_ _o_f_ _O_p_e_r_a_t_o_r_s_ The sequence of operations in evaluating an expression is from left to right subject to the following rules of p_r_e_c_e_d_e_n_c_e_ among the operators: first: ' second: * / third: + - fourth: a. fifth: o. This can be overruled, however, by the use of p_a_r_e_n_t_h_e_s_e_s_ (:and:) T_ E_x_a_m_p_l_e_s_ -a5 k + 128 2.101120+618+g4. (:(:c35 - c0:)/5:)3 o. 6.323 &_ 5_._ _I_n_s_t_r_u_c_t_i_o_n_s_ S_y_n_t_a_x_ instruction'::= operation part'address part' operation part'::= operation code'relative mode'W register'indirect mode'Xregister' operation code'::= aa/ac/ad/al/am/as/ba/bl/bs/bz/cf/ci/di/dl/do/ds/RC 4000 fa/fd/fm/fs/gg/gp/hl/hs/jd/je/jl/la/ld/lo/ls/lx/see nd/ns/re/ri/rl/rs/rx/se/sh/sl/sn/so/sp/ss/sx/sz/app. D wa/wd/wm/ws/xl/xs relative mode'::= empty'/. W register'::= empty'/w0/w1/w2/w3 indirect mode'::= empty'/( X register'::= empty'/x1/x2/x3/ address part'::= empty'/expression' \f S_e_m_a_n_t_i_c_s_ O_p_e_r_a_t_i_o_n_ _P_a_r_t_ The o_p_e_r_a_t_i_o_n_ _p_a_r_t_ of an instruction is assembled as a 12-bit half-word. It must begin with one of the m_n_e_m_o_n_i_c_ _c_o_d_e_s_ listed in Appendix B; m_o_d_i_f_i_c_a_t_i_o_n_s_ may follow in any order. If no modifi- cations are specified, w0, and direct addressing are understood. A_d_d_r_e_s_s_ _P_a_r_t_ The a_d_d_r_e_s_s_ _p_a_r_t_ of an instruction is evaluated by an e_x_p_r_e_s_s_i_o_n_ and assembled as a 12-bit half-word. It must be confined to the r_a_n_g_e_: -2048= address part= 2047 An empty address part is loaded as a zero. I_n_d_i_r_e_c_t_ _A_d_d_r_e_s_s_i_n_g_ For aesthetic reasons, SLANG permits the programmer to terminate an indirect address by a right parenthesis ). This is a blind symbol however. E_x_a_m_p_l_e_s_ Operation parts: ac rl w0 jd x3 zl. w3 (x2) Instructions: sz w1 2.1110 jl e55 wa. w3 (x1+f15.) ls w0 24-(:c1-c1/24*24:) The RC 8000 will also accept the instructions bl, bs, bz, ba from the RC 4000 instructions set. 6_._ _T_e_x_t_s_t_r_i_n_g_s_ S_y_n_t_a_x_ text'::= :textstring':' textstring'::= text character'/textstring'text character' text character'::= assembly character'/numerical character' numerical character'::= unsigned integer'' \f S_e_m_a_n_t_i_c_s_ I_n_t_e_r_n_a_l_ _R_e_p_r_e_s_e_n_t_a_t_i_o_n_ The characters between the delimiters : and :' are stored in consecutive words with 3 characters per word. Each character will be represented by its 7-bit numerical representation defined in Appendix F. Unused character positions at the end of the last word are filled with NULL characters. B_l_i_n_d_ _C_h_a_r_a_c_t_e_r_s_ All unprintable characters are ignored by SLANG. They can, how- ever, be included in textstrings by means of the numerical no- tation described below. N_u_m_e_r_i_c_a_l_ _C_h_a_r_a_c_t_e_r_s_ An unsigned integer enclosed in the brackets and ' is inter- preted as an 8-bit character with a numerical representation defined by the integer modulo 256. This notation can be used to specify c_o_n_t_r_o_l_ _c_h_a_r_a_c_t_e_r_s_ in a textstring. For example: null :0':' acknowledge:6':' SLANG interpretes the pair :' as a text terminator, and the character followed by a digit as the beginning of a numerical character. The numerical notation can be used to include these symbols in the assembled textstring: :' :58'62':' 6' :60'6':' E_x_a_m_p_l_e_s_ :syntax error0':' :This text includes a New Line character:' :too big10'try again:' 7_._ _D_i_r_e_c_t_i_v_e_s_ _a_n_d_ _C_o_m_m_e_n_t_s_ directive'::= m./b./s./e./h./w./f./r./c./z./i./t./n./p./u./l./d./j. end line'::= new line'/;line comment'new line'/ m.line comment'new line' line comment'::= any string not containing a new line' \f S_e_m_a_n_t_i_c_s_ Directives have no effect on the binary code produced but controls only the assembly, see 3.4.4. Comments can be included in the program following the delimiter m. or a semicolon. This causes everything up to a new line to be ignored. Comments following the delimiter m. are messages which are displayed on the output medium during assembly. \f F_ A_p_p_e_n_d_i_x_ _E_ D_e_b_u_g_g_i_n_g_ _o_f_ _S_L_A_N_G_-_p_r_o_g_r_a_m_s_ The illegal instruction ks address' with a negative address results in test output: The interrupt is trapped by the FP BREAK ROUTINE which issues the test output on current output instead of the normal "break" text. After printing the test output FP restores the registers and returns to the in- struction following the key store instruction i.e. the program continues as if nothing had happened. The test output contains instruction counter, working registers and exception registers. Not only value but also value - absolute address of FP START is given. If the value in question is an absolute primary storage address this difference is the address relative to FP START (i.e. the k-value) of the location addressed. Test output inside a procedure may for instance tell where the procedure was called from. Warning: Test output cannot be used inside a private block procedure in the program. E_x_a_m_p_l_e_:_ r = set 100 r = slang type.yes s.w. p.:fpnames:' k=h55 0,0 al w0 0 al w1 1 al w2 2 al w3 3 ks -1 al w2 0 jl. h7. e. e. r \f T_ This program will produce following output: 3 0 fpnames 102 0 type slang ok 1/18/1 * breakpoint -1 w0 0 -142002 w1 1 -142001 w2 2 -142000 w3 3 -141999 ex 1 -142001 ic 143552 1550 &_ end 4 1977.11.29 11.40.18 \f F_ A_p_p_e_n_d_i_x_ _F_ T_h_e_ _I_S_O_ _7_-_B_i_t_ _C_h_a_r_a_c_t_e_r_ _S_e_t_ The character set contains 128 7-bit characters. In the numerical representation of any one character the bits are identified by: b7 b6 b5 b4 b3 b2 b1 which have the following significance in the binary system: 64 32 16 8 4 2 1 In the code table below the columns and rows are identified by the decimal equivalent of the following binary numbers: column: b7 b6 b5 0 0 0 0 row: 0 0 0 b4 b3 b2 b1 Accordingly, the decimal value of a character is the sum of the column and row numbers. For instance, the character H has the numerical representation 64 + 8 = 72. Empty positions in the code table specify characters that are ignored by SLANG. \f T_ 0 16 32 48 64 80 96 112 0 SP 0 @ P p 1 ! 1 A Q a q 2 " 2 B R b r 3 > 3 C S c s 4 < 4 D T d t 5 % 5 E U e u 6 & 6 F V f v 7 7 G W g w 8 ( 8 H X h x 9 EM ) 9 I Y i y 10 NL * : J Z j z 11 VT + ; K Æ k æ 12 FF , L Ø l ø 13 - = M Å m å 14 . ' N n 15 / ? O _ o &_ \f A_p_p_e_n_d_i_x_ _G_ S_u_r_v_e_y_ _o_f_ _I_n_s_t_r_u_c_t_i_o_n_s_ In the following a short description of the common instructions is given. A complete description can be found in the "Reference Manual". In the description it is assumed that working register 3 (w3) is stated in the instruction. The effective address is stated as "addr". The construction word (addr) means "the contents of the word with address addr". A_d_d_r_e_s_s_ _I_n_s_t_r_u_c_t_i_o_n_s_ al address load w3:= addr ac address complemented w3:= - addr am address modify see section 2.1.3 T_r_a_n_s_f_e_r_ _b_e_t_w_e_e_n_ _M_e_m_o_r_y_ _a_n_d_ _R_e_g_i_s_t_e_r_s_ rl register load w3:= word (addr) rs register store word (addr):= w3 rx register exchange change (w3, word (addr)) dl double load w2, 23:= doubleword (addr) ds double store doubleword (addr):= w2, w3 hl half load w3 (12-23):= halfword (addr) hs half store halfword (addr):= w3 (12-23) el extend load w3 (12-23):= halfword (addr) w3 (0-11):= sign (halfword(addr)) zl zero load w3 (12=23):= halfword (addr) w3 (0-11):= 0 I_n_t_e_g_e_r_ _A_r_i_t_h_m_e_t_i_c_ wa word add w3:= w3 + word (addr) ws word subtract w3:= w3 - word (addr) wm word multiply w2, w3:= w3 D*U word (addr) wd word divide w3:= w2, w3// word (addr) w2:= w2, w3 mod word (addr) aa double add w2, w3:= w2, w3 + doubleword (addr) ss double subtract w2, w3:= w2, w3 - doubleword (addr)\f ea extend add w3:= w3 + extend halfword (addr) es extend subtract w3:= w3 - extend halfword (addr) F_l_o_a_t_i_n_g_ _P_o_i_n_t_ _A_r_i_t_h_m_e_t_i_c_ fa floating add w2, w3:= w2, w3 + doubleword (addr) fs floating subtract w2, w3:= w2, w3 - doubleword (addr) fm floating multiply w2, w3:= w2, w3 D*U doubleword (addr) fd floating divide w2, w3:= w2, w3/ doubleword (addr) ci convert integer w2, w3:= float (w3 2 D**U addr) cf convert floating w3:= round (w2, w3 D*U 2D**U addr) B_i_t_ _P_r_o_c_e_s_s_i_n_g_ la logical and w3:= w3 and word (addr) lo logical or w3:= w3 or word (addr) lx logical exclusive or w3:= w3 exor word (addr) S_h_i_f_t_ _O_p_e_r_a_t_i_o_n_s_ ls logical single w3:= w3 shift addr ld logical double w2, w3:= shift addr as arithmetical single w3:= w3 D*U 2D**U addr ad arithmetical double w2, w3:= w2, w3 D*U 2D**U addr J_u_m_p_ _a_n_d_ _S_k_i_p_ _I_n_s_t_r_u_c_t_i_o_n_s_ jl jump with link w3:= IC; IC:= addr se skip equal if w3 = addr then IC:= IC + 2 sn skip not equal if w3 ' addr then IC:= IC + 2 sh skip higher if w3 ' addr then IC:= IC + 2 sl skip less if w3 addr then IC:= IC + 2 so skip ones if w3 and addr = addr then IC:= IC + 2 sz skip zeroes if w3 and addr = 0 then IC:= IC + 2 sx skip if no exception if EX and addr = 0 then IC:= IC + 2 \f A_p_p_e_n_d_i_x_ _H_ R_e_f_e_r_e_n_c_e_s_:_ 1. RC 8000 MONITOR, PART 2 Reference Manual RCSL No: 31-D477 January 1978 2. SYSTEM 3 UTILITY PROGRAMS Part Three RCSL No: 31-D379 November 1975 3. CODE PROCEDURES AND RUN TIME ORGANIZATION OF ALGOL 5 PROGRAMS RCSL No: 31-D199 August 1972 RC 8000 COMPUTER REFERENCE MANUAL RCSL No: 31-D383 January 1976 RC 4000 COMPUTER REFERENCE MANUAL RCSL No: 55-D1 June 1969 \f INDEX address calculation 1.3 direct 1.3, 3.2.1 effective 1.1, 3.2.1 indirect 1.3, 3.2.2 indirect relative 1.3 indexed 3.2.3 relative 1.3, 3.2.4 symbolic 3.2.1 arithmetic operator 3.3.4 ' * / + - a. & o. ! assembly parameters 3.6 entry lines list message names proc type warning xref assignment (see explicit definition) D-field 1.3 data format 1.1 directives ; 3.4.4, 3.1.1 m. 3.4.4 b.s.e. 3.1.2, 3.4.4 h.w.f. 3.1.3, 3.4.4 \f r. 3.4.4 c.z. 3.4.4 i. 3.4.4 t.n. 3.4.4 p.u. 3.4.4 l.d. 3.4.4 j. 3.4.4, 3.4.5 displacement 1.3 double register 1.2 exception register 2.9.3 explicit difinition 3.3.5, 3.4 exponent 1.1 F-field 1.3 file processor 3.8 fpnames 3.9 fraction 1.1 h-names 3.8 insert identifiers 3.4.5 insertproc 3.9 Instructions aa 2.3.5 ac 2.1.2 ad 2.6.2 al 2.1.1 am 2.1.3 as 2.6.1 cf 2.4.6 ci 2.4.5 dl 2.2.5 ds 2.2.6 ea 2.3.7 el 2.2.2 es 2.3.8 fa 2.4.1 fd 2.4.4 fm 2.4.3 fs 2.4.2 hl 2.2.7 hs 2.2.8 jd 2.7.2 jl 2.7.1 la 2.5.1 ld 2.6.4 \f lo 2.5.2 ls 2.6.3 lx 2.5.3 nd 2.4.8 ns 2.4.7 rl 2.2.1 rs 2.2.4 rx 2.2.9 se 2.8.1 sh 2.8.4 sl 2.8.3 sn 2.8.2 so 2.9.1 ss 2.3.6 sx 2.9.3 sz 2.9.2 wa 2.3.1 wd 2.3.4 wm 2.3.3 ws 2.3.2 xl 2.2.10 xs 2.2.11 zl 2.2.3 index register 1.2 instruction format 1.3 jump instructions 1.6, 2.7.1 M-field 1.3 modify next address 1.7 New Line 3.1.1 overflow 2.9.3 priority of operators 3.3.4 program top 3.4.5 radix 3.3.4 result name address 3.4.5 stack top 3.4.5 standard names 3.3.1 s0 s1 s2 s3 s4 tail 3.9 W-field 1.3 working register 1.2 X-field 1.3 \f i T_A_B_L_E_ _O_F_ _C_O_N_T_E_N_T_S_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _P_A_G_E_ 1. GENERAL DESCRIPTION ................................... 1 1.1 Chassis .......................................... 1 1.2 Cardcage SBC604 .................................. 1 1.3 Power Supplies ................................... 1 1.4 Switches etc. .................................... 1 Assembly drawing .......................................... 2 Multibus Chassis, Diagram ................................. 3 Bus Signals (P1) .......................................... 4 Bus Signals (P2) .......................................... 5 Backplane Layout .......................................... 6 \f ii \f 1_._ _ _ _ _ _ _ _ _G_E_N_E_R_A_L_ _D_E_S_C_R_I_P_T_I_O_N_ 1.1 1_._1_ _ _ _ _ _ _ _C_h_a_s_s_i_s_ 1.1 Made of electroplated steel and aluminium, fitted with two fans and telescope slides. Width = 19", height = 3.5". 1_._2_ _ _ _ _ _ _ _C_a_r_d_c_a_g_e_ _S_B_C_ _6_0_4_ 1.2 Contains 4 slots for Multibus adapter cards, placed horizontally. The cards can be locked into position. The Multibus backplane has 4 connectors (J2, J3, J4, and J5) connected to the bus-out edge connector. Connector P2 is not fitted. Should be fitted if signal ACLO is wanted. 1_._3_ _ _ _ _ _ _ _P_o_w_e_r_ _S_u_p_p_l_i_e_s_ 1.3 The chassis is fitted with the control module POW738 and one +5V power module POW729 (max. 20A). The +5V module should always be mounted in the top right position. The two left positions can be used for +/-12V and -5V power modules. DO NOT WORK ON POWER SUPPLIES WITH POWER ON! 1_._4_ _ _ _ _ _ _ _S_w_i_t_c_h_e_s_ _e_t_c_. 1.4 I-O: Mains Switch (Power) INIT: Reset LED: Power OK Voltage Adj., Reset and PINT, see powersupply manual. \f Assembly Drawing. \f O-R21327 Multibus Chassis Diagram. \f \f \f \f i T_A_B_L_E_ _O_F_ _C_O_N_T_E_N_T_S_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _P_A_G_E_ 1. DESCRIPTION ........................................... 1 Power Supply for Diskette Drive, POW740 ................... 2 RC899 Cable Lay Out ....................................... 3 Connection 8" Disc Drive to RC equipment .................. 4 \f ii \f 1_._ _ _ _ _ _ _ _ _D_E_S_C_R_I_P_T_I_O_N_ 1. This paper contains the circuit diagram for the POW740 power supply used to supply the RC762 Floppy disk drive to RC702 microcomputer system. The paper also contains a description of the cable connecting the floppy disk to RC702. \f \f RC899 Cable Lay Out. \f Connection 8" Disc Drive to RC equipment. \f i T_A_B_L_E_ _O_F_ _C_O_N_T_E_N_T_S_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _P_A_G_E_ 1. INTRODUCTION ........................................... 1 1.1 Scope of the Manual ............................... 1 2. AN ILLUSTRATIVE EXAMPLE ................................ 2 3. REQUESTS TO THE MASTER ................................. 4 3.1 Block Types ....................................... 4 3.2 Request and Answer Formats ........................ 5 3.2.1 Open Link .................................. 5 3.2.2 Close Link ................................. 5 3.2.3 Open File .................................. 6 3.2.4 Close File ................................. 6 3.2.5 Get Page ................................... 6 3.2.6 Put Page ................................... 7 3.2.7 Create File ................................ 8 3.2.8 Delete File ................................ 8 3.2.9 Rename File ................................ 8 A_P_P_E_N_D_I_C_E_S_: A. REFERENCES ............................................. 9 B. ERROR CODES ............................................ 10 \f ii \f 1_._ _ _ _ _ _ _ _ _I_N_T_R_O_D_U_C_T_I_O_N_ 1. The RC700 Master/Slave System is used for connecting a Master computer with a number of (RC700) slave computers. The slaves are physically connected to the master through one or more LIS701 Line Selectors 1. The main objective of a Master/Slave configuration is the ability to share common resources. It should, however, be noted that sharing of resources is limited to sharing of resources residing at the Master computer. This is due to the unsymmetrical nature of the Line Selector. Consequently, communication between slave and master consists of slave requests to the master followed by master answers. 1_._1_ _ _ _ _ _ _ _S_c_o_p_e_ _o_f_ _t_h_e_ _M_a_n_u_a_l_ 1.1 The scope of the present manual is rather limited. It does by no means give complete information on Master/Slave communications. Reasons for this are that many of the software components which the present Master/Slave system relies upon (file system, imple- mentation language, etc.) are liable (in fact certain) to be changed in the near future. Therefore, descriptions are limited to data formats for requests (to the master) and answers (from the master), since these for- mats hopefully will remain unchanged. Information concerning - point-to-point communication protocols, - interfaces to other software components of both master and slave systems, are thus not included in this description. \f F_ 2_._ _ _ _ _ _ _ _ _A_N_ _I_L_L_U_S_T_R_A_T_I_V_E_ _E_X_A_M_P_L_E_ 2. Below is given a brief outline of the block transfers involved in a typical "session" between a slave and its master. The slave opens a file, reads a page and finally closes the file. \f F_ Line Selector reserved SLAVE MASTER _ _ _ _ _ _ _ _ _ _ _ _ Reserve LIS Open Link Return free link number Release LIS _ _ _ _ _ _ _ _ _ _ _ _ . . . . . . _ _ _ _ _ _ _ _ _ _ _ _ Reserve LIS Open file (open file in Master) Return answer Release LIS _ _ _ _ _ _ _ _ _ _ _ _ . . . . . . _ _ _ _ _ _ _ _ _ _ _ _ Reserve LIS Read page (read page on file) Return page Release LIS _ _ _ _ _ _ _ _ _ _ _ _ . . . . . . _ _ _ _ _ _ _ _ _ _ _ _ Reserve LIS Close file (close file) Return answer Release LIS _ _ _ _ _ _ _ _ _ _ _ _ . . . . . . _ _ _ _ _ _ _ _ _ _ _ _ Reserve LIS Close Link Return answer Release LIS _ _ _ _ _ _ _ _ _ _ _ _ \f F_ 3_._ _ _ _ _ _ _ _ _R_E_Q_U_E_S_T_S_ _T_O_ _T_H_E_ _M_A_S_T_E_R_ 3. This chapter gives detailed information on the format of (1) the data-blocks which a slave may transmit to a master, and (2) the resulting answer-blocks from the master to the slave. 3_._1_ _ _ _ _ _ _ _B_l_o_c_k_ _T_y_p_e_s_ 3.1 Below a number of types are defined. They are to be used in the following paragraphs. Please refer to 2 for the exact memory layout for the individual types. HEADERTYPE = RECORD opcode, result, unused, linkno: byte END IOARG = RECORD header: HEADERTYPE; path: ARRAY (1..32) OF char; entry: ARRAY (1..32) OF byte; access: SET OF (read, write, exclusive); unused1, amount: integer; unused2: byte END; BUFFERHEAD = RECORD header: HEADERTYPE first, last, next: integer; pageno, unused1, amount, unused2: integer END; \f BUFFERTYPE = RECORD bufhead: BUFFERHEAD data: ARRAY (14..525) OF byte END; 3_._2_ _ _ _ _ _ _ _R_e_q_u_e_s_t_ _a_n_d_ _A_n_s_w_e_r_ _F_o_r_m_a_t_s_ 3.2 (Result codes may be found in appendix B). 3_._2_._1_ _ _ _ _ _O_p_e_n_ _L_i_n_k_ 3.2.1 R_e_q_u_e_s_t_: Blocktype is HEADERTYPE (cf. section 3.1). .opcode: 10. A_n_s_w_e_r_: Blocktype is HEADERTYPE .result: Result code .linkno: A free link number to be used in subsequent requests. 3_._2_._2_ _ _ _ _ _C_l_o_s_e_ _L_i_n_k_ 3.2.2 R_e_q_u_e_s_t_ Blocktype is HEADERTYPE .opcode: 11. .linkno: The link number to be closed. A_n_s_w_e_r_ Blocktype is HEADERTYPE .result: Result code. \f 3_._2_._3_ _ _ _ _ _O_p_e_n_ _F_i_l_e_ 3.2.3 R_e_q_u_e_s_t_ Blocktype is IOARG .header.opcode: 6 .header.linkno: The linknumber representing the file. .path: The name of the file to be opened. .access: Designates the wanted use-mode of the file. A_n_s_w_e_r_ Blocktype is IOARG .header.result: Result code. .entry: may contain various status information concerning the opened file (optional). 3_._2_._4_ _ _ _ _ _C_l_o_s_e_ _F_i_l_e_ 3.2.4 R_e_q_u_e_s_t_ Blocktype is HEADERTYPE .opcode: 20. .linkno: The link number representing the file to be closed. A_n_s_w_e_r_ Blocktype is HEADERTYPE .result: Result code. 3_._2_._5_ _ _ _ _ _G_e_t_ _P_a_g_e_ 3.2.5 The following information is valid for backing storage files only: R_e_q_u_e_s_t_ Blocktype is BUFFERHEAD .header.opcode: 21. .header.linkno: The link number representing the file from which the page should be read. .first,.last and .next: Defines the accessible area of the buffer to be returned, according to the driver conventions of 3. \f .pageno: The logical page number (within the file - pages numbered from 2 and up) of the page to be read. A_n_s_w_e_r_ Blocktype is BUFFERTYPE .header.result: Result code. .first, .last and .next: Defines accessible area of .data. .data: The read page of data. 3_._2_._6_ _ _ _ _ _P_u_t_ _P_a_g_e_ 3.2.6 Following information is valid for backing storage files only. R_e_q_u_e_s_t_ Blocktype is BUFFERTYPE .header.opcode: 22. .header.linkno: The link number representing the file to be written. .first, .last and .next: Defines the accessible area of .data (cf. 3). .pageno: The logical page number (within the file - pages numbered from 2 and up) of the page to be written. .data: The page buffer. A_n_s_w_e_r_ Blocktype is BUFFERHEAD .header.result: Result code. .first, .last and.next: Defines the data actually written (cf. 3). \f 3_._2_._7_ _ _ _ _ _C_r_e_a_t_e_ _F_i_l_e_ 3.2.7 R_e_q_u_e_s_t_ Blocktype is IOARG .header.opcode: 3. .name: Name of the file to be created. .amount: Requested size of file (in pages). A_n_s_w_e_r_ Blocktype is IOARG .header.result: Result code. .amount: Number of actually allocated pages. 3_._2_._8_ _ _ _ _ _D_e_l_e_t_e_ _F_i_l_e_ 3.2.8 R_e_q_u_e_s_t_ Blocktype is IOARG .header.opcode: 4. .name: Name of the file to be deleted. A_n_s_w_e_r_ Blocktype is IOARG .header.result: Result code. .amount: Number of actually deallocated pages. 3_._2_._9_ _ _ _ _ _R_e_n_a_m_e_ _F_i_l_e_ 3.2.9 Not implemented yet. \f F_ A_._ _ _ _ _ _ _ _ _R_E_F_E_R_E_N_C_E_S_ A. 1 RCSL No 31-D619: LIS 701, V24 Lineselector, Reference Manual 2 RCSL No 31-D618: PI-1 PASCAL80, Reference Manual 3 RCSL No 31-D617: PASCAL80 Driver Conventions \f F_ B_._ _ _ _ _ _ _ _ _E_R_R_O_R_ _C_O_D_E_S_ B. C_o_d_e_ _ _ _N_a_m_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _E_x_p_l_a_n_a_t_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 0 ok operation successful 1 not processed hard error on device 2 parity parity error on diskette 3 harderror hard error on device 4 unintelligible operation request unintelligible 5 name _exists name already exists 6 name _inexistant name does not exist 7 8 flt _overflow no more room in the FLT 9 mount error error due to wrong mount status 10 11 offline drive offline 12 name error name syntax error 13 directory full no more room in volume directory 14 software software error 15 indexlimit file cannot be further extended (reorganize diskette) 16 volumelimit no free pages on diskette 17 openlimit resource problems for open files 18 includelimit the maximum number of streams are connected to the file in question 19 writeprotect writeprotected diskette 20 streamconnection stream in wrong open status 21 22 version wrong version of the file system 23 not implemented operation not implemented yet 24 fragmentation the free pages of the diskette are too fragmentated to allow sensible allo- cation. Reorganize diskette 25 disconnected the drive has been offline without any dismount operation 26 illegal 27 unformatted diskette unformatted 28 rejected operation impossible in this context \f C_o_d_e_ _ _ _N_a_m_e_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _E_x_p_l_a_n_a_t_i_o_n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 29 filelimit attempt to read or write past end of file 30 unauthorized unauthorized operation 31 transmission checksum or location error in asyn- chronous transmission 32 linklimit slave cannot be connected to master due to shortage of links 33 busyline Transmission line busy or absent 34 reserved the device is reserved by somebody else \f F_ \f «eof»