DECUS, SN: BBN-37, Ben Gurley, Weldon Clark, April 10, 1961 (PDP-1, 5 × 7 matrix)
Ref: https://archive.computerhistory.org/resources/text/DEC/pdp-1/DEC.pdp_1.1961.102650098.pdf
Format: FRAP, Ed Fredkin's Free of Rules Assembler Program, fitting into a single K words of RAM.
Attachment to Memo 1652-17 Character-Display (BBN-37) 4 May 1962
Character-Display, BBN-37, FRAP subroutine ,Original machine code program by Ben Gurley of DEC ,Symbolic translation and modifications by Welden Clark ,10 April 1961 , , ext character-display org character display nop ,(1) First call sets size of character. Remains set until changed. ,Cs is law m ,size number , jda char-size , r ,returns here ,Height of character is 7/512 face. , ext char size .. ,character size number, m dap return-1 get-size lac → - 2 ,pick up size sal s9 dac spot-spacing ,grid interval on 512 x 512 lin(e) sal s3 ,(original: no indentation) dac char spacing ,spacing is 8/5 char. width add spot-spacing add spot-spacing dac-line-spacing ,spacing is 10/7 char. height return-1 jmp .. , ,(2) Second call sets tab interval. Use only if tab desired) ,CS is law n ,tab interval, n/512 of scope face width jda set-tab r ,returns here , ,To set tab intervals as even multiples of character spacing use multiples of 8 x m for n , ext set-tab .. dap return 2 lac → - 2 ,pick up tab interval value sal s9 ,tab interval in 0-8 dac tab-interval return-2 jmp .. , ,(3) Third call sets lower left corner of first character. Will increment until erased or changed ,Cs is lac x0,y0 ,scope coordinates jda position r ,returns here , ,x0 should be in bits 1-8 with sign at 0, y0 at bits 10-17 with sign at 9, ,for 512 x 512 line scope face with origin center. , ext position .. ,x0,y0 dap return-3 get-position lac → - 2 ,pick up coordinates rcr s9 dio 1st-y ,8 bits + sign now in 0-8 ral s9 dac 1st-x ,8 bits + sign now in 0-8 return-3 jmp .. , ,(4) Fourth call resets to initial position specified in 3. Cs is jsp erase r ,returns here , ext erase dap return-4 lac 1st-x dac x ,reset x to start of line lac 1st-y dac y ,reset y to top of page return-4 jmp .. , ,(5) Fifth call displays one character. ,Concise code must be stored left-justified. Cs is law address ,address of register containing concise code jda display-one r ,returns here after all codes except 12 code r + 1 ,returns here after 12 code ext display-one .. ,loc of address of char code dap return-5 lac=nop dac next? lac ' → - 4 ,pick up the character code dap characters ,store it jmp test-1 , ,(6) Sixth call displays up to three characters where codes are in one word. Cs is law address ,address of register containing three codes jda display-three r ,returns here after all codes except 12 code r + 1 ,returns here after 12 code ext display-three .. dap return-5 law ' 2 dac char-counter ,set three characters lac =skip dac next? lac ' → - 6 ,pick up word with codes dac characters ,store it jmp test-1 ,(7) Seventh call displays an arbitrary length message consisting of a string of consecutive words in memory, of three concise codes, each, terminating in a 12 code. ,Cs is law message ,for address of last word in ac jda display-message r ,returns here , ext display message .. dap return-7 lac display-message jda display-three ,to call -6- skip return-7 jmp .. ,last character was 12 code idx display-message ,for next word jmp display-message + 2 ,loop , , , test-1 law char-table dap table-address lac characters and =770000 ,mask off 2nd and 3rd characters dac char sad =770000 jmp next-line ,do a carriage return sad =tab jmp tab ,do a tab sad =ucase jmp next? ,ignore code for shift to upper case sad =lcase jmp next? ,ignore code for shift to lower case sad =black jmp next? ,ignore code for shift to black sad =red jmp next? ,ignore code for shift to red sad =bspace jmp backspace ,do a backspace sas =120000 ,code for message end jmp find-matrix idx return-5 jmp return-5 jmp find-matrix , backspace lac x sad 1st-x jmp next? ,backspace impossible, already at gft sub char-spacing sub =1 dac x jmp next? next-line lac 1st-x dac x ,reset x to start of line lac y sub line-spacing dac y ,reset y down one line szo ,(original: was at end of previous line) jmp next-page jmp next? next-page lac 1st-y dac y ,reset y to top of page jmp next? tab law 1 dac tab-counter lac x which-tab? sub tab-interval dac x-pst-tab szo jmp → + 4 idx tab-counter lac x-post-tab jmp which-tab? ,loop lac tab-counter cma dac tab-counter lac 1st-x dac x-post-tab do-tab lac x-post-tab add tab-interval dac x-post-tab isp tab-counter jmp do-tab ,loop lac x-post-tab dac x ,tab completed add char-spacing szo jmp next-line next? .. return-5 jmp .. next-char isp char-counter jmp → + 3 lac =nop dac next? lac characters ral s6 dac characters ,temp storage jmp test-1 , find-matrix ral s7 add table-address dap matrix-1 ,address of table register withlst h dap matrix-2 idx matrix-2 law ' 7 dac up-counter law ' 5 dac rt-counter lac x dac display-x ,x value for scope spot lac y dac display-y ,y value for scope spot matrix-1 lio .. ,1st half of 35 bit word defining 5 x 7 matrix-2 lac .. ,2nd half test-spot? spi jmp → + 3 ,bit tested was a 1,display a spot dac matrix-after ,bit tested was a 0, go to next bit and i jmp → + 7 dio matriy-before dac matrix-after lio display-y lac display-x dpy ,display a spot in the 5 × 7 char. matrix lio matrix-before isp up-counter ,at top of matrix yet? jmp increment-y ,no isp rt-counter ,yes, at rt edge of matrix yet? jmp reset-up ,no lac x ,yes add char-spacing dac x ,set x for next character add char-spacing szo jmp next-line jmp next? reset-up law ' 7 dac up-counter lac y dac display-y ,reset display for next character lac display-x add spot-spacing dac display-x ,incerement display-x jmp → + 4 increment-y lac display-y add spot-spacing dac display-y lac matrix-after rcl s1 ,advance matrix in ac-io for next test jmp test-spot? , , , ,NOTE......Characters and concise codes are those of Concise III. Only one character is available per key. The characters for the non-space keys, codes 40 and 56, are not in the table, but blank registers corresponding to those alphabetics, lower case numerals, space, parentheses, hyphen, question-mark, comma and period are in the table. Carriage return, backspace, and tab are internal program operations. , , Each character that can be displayed is represented in the table by two words, starting at 2 times the concise code + the 1st table address. The two words are linear representations of the 5 x 7 matrix, proceeding from left to right and bottom to top. , , char-table 000000 ,table begins, code for "space" 000000 2057 ,1 740000 413032 ,2 144614 206231 ,3 545542 100602 ,4 411376 276231 ,5 144542 372231 ,6 144544 604421 ,7 102406 332231 ,8 144554 32231 ,9 144574 ,table interrupted spot-spacing .. char-spacing .. line-spacing .. 1st-x .. 1st-y .. x .. y .. display-x .. display-y .. characters .. char-counter .. tab-interval .. , table continues 161050 ,zero 121070 000040 ,code 21, ? 154414 232231 ,s 144544 4037 ,t 700402 376010 ,u 40176 175010 ,v 20076 775003 ,w 20376 405043 ,x 421202 4057 ,y 401002 606431 ,z 142606 ,table interrupted tab-counter .. x-post-tab .. comma 12 ,table continues 030000 black 000010 ,a right brace will be displayed 133020 red 041550 ,a left brace will be displayed 100000 ,table interrupted up-counter .. rt-counter .. matrix-after .. matrix-before .. , table continues 0 ,space for special character code 40 0 202010 ,j 137402 774202 ,k 421202 776010 ,l 40200 774041 ,m 401376 774141 ,n 30376 372030 ,o 140574 774221 ,p 104414 372032 ,q 160774 774223 ,r 124614 ,table interrupted table-address .. =nop 760000 ,constants for routine =skip skip =770000 770000 ,table continues 000201 ,code 54, hyphen 004000 002027 ,code 55, right parenthesis 600000 0 ,code 56 0 000007 ,code 57, left parenthesis 640400 0 ,code 60, not a typewriter code 0 760442 ,a 111370 776231 ,b 144554 372030 ,c 140504 776030 ,d 121070 776231 ,e 144602 774221 ,f 104402 372030 ,g 150544 774201 ,h 4376 2037 ,i 740400 ,tabel interrupted =lcase 720000 =tab 360000 , table continues 10 ,period 0 ,table ends, codes 74-77 unavailable as =ucase 740000 char .. =black 340000 =red 350000 =bspace 750000 =1 1 =120000 120000 , , , , jmp end