User Tools

Site Tools


cdc:nos2.source:nam5871:np_n2d

NP$N2D

Table Of Contents

Source Code

NP$N2D.txt
  1. *DECK,NP$N2D
  2. *IF,DEF,XFR
  3. IDENT NP$N2D
  4. ENTRY NP$N2D
  5. NP$N2D BSS 1
  6. *
  7. * THIS TRANSLATION ROUTINE TAKES ONE CHARACTER AT A TIME
  8. * FROM THE NETWORK BUFFER, AND CONVERTS IT TO DISPLAY CODE
  9. * IN THE DISK BUFFER.
  10. *
  11. * ENTRY PARAMETERS :
  12. * - ADDRESS OF NETWORK FET
  13. * - ADDRESS OF DISK BUFFER FET
  14. * - ADDRESS OF CONVERTION TABLE PARAMETER BLOCK.
  15. *
  16. * THE STRUCTURE OF THE PARAMETER BLOCK IS :
  17. * +------------------+
  18. * 1 1 NBUF EMPTY FLAG 1
  19. * + -----------------+
  20. * 2 1 DISKBUF FULL FLAG1
  21. * +------------------+
  22. * 3 1 NCOUNT 1 NO. OF REMAINING CHARS. IN NET BUFFER
  23. * +------------------+
  24. * 4 1 NBYTE 1
  25. * +------------------+
  26. * 5 1 DBIT 1
  27. * +------------------+
  28. * 6 1 STATE OF CONVER. 1
  29. * +------------------+
  30. * 7 1 CONVER. TBL ADDR.1
  31. * +------------------+
  32. * 8 1 STEPSIZE (6/12) 1
  33. * +------------------+
  34. *
  35. * NBYTE - NUMBER OF BITS TO SHIFT CURRENT NETWORK WORD TO GET
  36. * CURRENT CHARACTER AT RIGHT MOST LOCATION.
  37. * COUNTS FROM 8 (12 IF WORD BEGINS WITH HALF CHARACTER)
  38. * STEP 8 UNTIL 64 (60)
  39. * DBIT - NUMBER OF BITS TO SHIFT A CHARACTER FROM RIGHTMOST
  40. * LOCATION TO CURRENT REQUIRED IN DISKBUF.
  41. * FOR DISPLAY CODE FILES : STARTS WITH 54 STEP -6 UNTIL 0
  42. * DISK ASCII FILES : STARTS WITH 48 STEP -12 TILL 0
  43. * STATE - 0 = ALL DONE IN PREVIOUS ENTRY.
  44. * 1 = ZERO WORD REQUIRED
  45. * 2 = LAST CHARACTER WRITTEN WAS (:) (SO THAT IF A *US*
  46. * ARRIVES WE FIRST WRITE A BLANK, THAN A Z-BYTE)
  47. *
  48. *
  49. * THE PRESETTING INCLUDES :
  50. *
  51. * A1 - ADDRESS OF NET FET+1 (*IN* POINTER)
  52. * A2 - ADDRESS OF DISK FET+1 (*IN* POINTER)
  53. * A4 - POINTER TO DISK BUFFER *IN* WORD.
  54. * A5 - POINTER TO NET BUFFER *OUT* WORD.
  55. *
  56. * X4 - ACCUMULATING THE WORD TO BE WRITTEN TO DISKBUF
  57. * X5 - CURRENT NETBUF WORD POINTED BY *OUT* (WORKING WORD)
  58. *
  59. * B1 - 1
  60. * B2 - ADDRESS OF FIRST ENTRY IN CONVERSION TABLE
  61. * B3 - STATE OF CONVERSION
  62. * B4 - DBIT
  63. * B5 - NBYTE
  64. * B6 - COUNT
  65. *
  66. SB1 1
  67.  
  68. SA2 A1+B1
  69. SA3 A2+B1
  70. *
  71. * THE PARAMETERS PASSED ARE WORDS CONTAINING THE A D D R E S S
  72. * OF THE REQUIRED PARAMETERS (FETS,PARAMETER-BLOCK)
  73. *
  74. SA1 X1 GET POINTER TO ACTUAL PARAMETER
  75. SA2 X2
  76. SA3 X3
  77.  
  78. SA1 X1+B1 POINT TO NFET WORD CONTAINING *IN*
  79. SA5 A1+B1 NFET WORD CONTAINING *OUT*
  80. SA5 X5 ADDRESS OF *OUT* OURD IN NETBUF
  81. SA2 X2+B1 POINT TO DFET WORD CONTAINING *IN*
  82. SA4 X2 ADDRESS OF *IN* WORD OF DISK BUF
  83. BX6 X3 SAVE PARAM TABLE ADDRESS
  84. SA6 PARAM
  85. MX6 0
  86.  
  87. SA6 X3 SET TO 'NETBUF AVAILABLE' INITIAL STATE
  88. SA3 X3+B1 GET THE 'DISKFULL' INDICATOR
  89. SA6 A3 SET TO 'DISK AVAILABLE' INITIAL STATE
  90.  
  91. SA3 A3+B1 WORD NUMBER 3 IN TABLE
  92. SB6 X3 NCOUNT
  93.  
  94. SA3 A3+B1 WORD NUMBER 4 IN TABLE
  95. SB5 X3 NBYTE
  96.  
  97. SA3 A3+B1
  98. SB4 X3 DBIT (WORD 5 )
  99.  
  100. SA3 A3+B1 STATE INTO X3 FROM WORD 6
  101. SB3 X3 B3=1 IS Z-WORD REQUIRED
  102. * B3=2 IS LAST CHAR IN NETBUF WAS :
  103. *
  104. SA6 A3 RESET THE STATE IN PARAMETER BLOCK
  105. SA3 A3+B1 WORD 7 - CONVERSION TABLE ADDRESS
  106. SB2 X3
  107.  
  108. SA3 A3+B1 WORD 8 = STEP SIZE IN DISKBUF (6 OR 12)
  109. BX6 X3
  110. SA6 STEP
  111.  
  112. * COMPARE *OUT* AND *FIRST* TO SEE IF IT IS FIRST TIME ENTRY
  113.  
  114. SA3 A1-B1 POINT AT FET WORD CONTAINING *FIRST*
  115. SB7 X3 *FIRST* ADDRESS IN B7
  116. SB7 A5-B7 *NETBUF *OUT* - *FIRST*
  117. NE B0,B7,READBLK0
  118. *
  119. * YES,IT IS FIRST TIME ENTRY. FIRST BLOCK HAS A TBH(6 OCTETS)
  120. *
  121. MX0 48
  122. BX5 -X0*X5
  123. SB6 X5 NUMBER OF CHARS FROM ABH
  124. SB6 B6-6 DECREMENT THE NBH SIZE
  125. SB5 56
  126. SA5 A5+B1 MOVE *OUT* TO FIRST WORD OF DATA
  127.  
  128. READBLK0 BSS 0
  129. *******
  130. *
  131. * CHECK IF WE STILL HAVE ROOM IN *DISKBUF* SO THAT WE CAN GO
  132. * ON WITH THE PROCESS.
  133. * 1. CHECK IF *B4* SHOWS NEW CHARACTER IN WORD.
  134. * 2. CHECK IF *IN+1* = *OUT*.
  135. *
  136. * IF B O T H CONDITIONS OCCUR THAN WE USED ALL DISK SPACE WE
  137. * COULD, WE FLAG THE *DISKFULL* AND QUIT.
  138. ********
  139.  
  140. SX0 A4+B1 *IN+1* (X0)
  141. SA3 A2+B1 POINT TO DFET CONTAINING *OUT* POINTER
  142. MX6 42
  143. BX0 -X6*X0
  144. BX7 -X6*X3 ADDRESS OF DISKBUF *OUT* WORD (X7)
  145. SA3 A3+B1 POINT TO DFET CONTAINING *LIMIT* POINTER
  146. BX3 -X6*X3 ADDRESS OF DISKBUF *LIMIT* POINTER (X3)
  147. BX3 X0-X3 DISKBUF *IN+1* - *LIMIT*
  148. NZ X3,ENDW2 SKIP THE FOLLOWING IF *IN+1*.NE.*LIMIT*
  149. SA3 A2-B1 POINT TO DFET WORD CONTAINING *FIRST*
  150. BX0 -X6*X3 ADDRESS OF *FIRST* REPLACES *IN+1*
  151.  
  152. ENDW2 BX6 X0-X7 CHECK IF *IN+1* = *OUT*
  153.  
  154. * NEW *IN+1* ADDRESS NOW IN X0
  155.  
  156. BX7 X0
  157. SA7 NEXTIN SAVE FOR NEXT WORD ADVANCE
  158.  
  159. SA3 STEP
  160. SB7 X3
  161. SB7 B7-60 SETTING FOR FIRST CHARACTER IN DISK WRITE
  162. SB7 B0-B7
  163. NE B4,B7,ENTER1 IF NOT 1ST CHARACTER OF A WORD
  164.  
  165. NZ X6,ENTER1 IF *IN+1* .NE. *OUT*
  166.  
  167. * DISK FULL, SO WE CAN NOT GO TO NEXT WORD FOR WRITE
  168.  
  169. DISKFUL SX6 1
  170. SA3 PARAM
  171. SA6 X3+B1 SET FLAG OF *DISK BUFFER FULL* (WORD 2)
  172. MX6 0
  173. SA6 A4 CLEAN WORD WE HAD NO CHANCE TO WRITE
  174. EQ NEXIT
  175. *
  176. **********
  177.  
  178. *
  179. * IF COUNT=0 READ NEXT BLOCK (OR RETURN IF LAST BLOCK)
  180. *
  181. ENTER1 BSS 0
  182. *
  183. * CHECK FOR SPECIAL ENTRIES :
  184. * B3 = 1 - A ZERO WORD IS REQUIRED IN *DISKBUF*
  185. * B3 = 2 - LAST CHARACTER IN *DISKBUF* WAS A COLON (:)
  186. *
  187. EQ B3,B1,ZRBYT1 TO WRITE A ZERO WORD
  188.  
  189. READBLK NE B6,B0,NEXT
  190. SB7 X1 NETBUF *IN* ADDRESS
  191. SX6 A5-B7 NETBUF *OUT* - *IN*
  192. NZ X6,NEXT2
  193.  
  194. * *IN* = *OUT* - NETWORK BUFFER EMPTIED.
  195.  
  196. SA3 PARAM
  197. SX6 1 SET FLAG 'NETWORK BUFFER EMPTY'
  198. SA6 X3 ADDRESS ON FLAG LOCATION
  199.  
  200. BX7 X4
  201. SA7 A4 FLUSH OUT LAST CHARACTERS ACCUMULATED
  202. EQ NEXIT
  203.  
  204. * ANOTHER BLOCK EXISTS IN NETBUF (BLK OR MSG)
  205.  
  206. NEXT2 SA5 A5+B1 ADVANCE THE POINTER TO NETBUF *OUT* WORD
  207. MX0 48
  208. BX5 -X0*X5 EXTRAXT TLC FROM BIT 48 THR 59
  209. SB6 X5 GET COUNT FROM TLC OF ABH
  210. SA5 A5+B1 POINT TO FIRST WORD OF DATA AREA
  211. SB5 8 SET TO 1ST CHARACTER IN WORD
  212. *
  213. ***********
  214.  
  215. * GET THE NEXT CHARACTER TO BE TRANSLATED
  216.  
  217. NEXT SB7 64
  218. NE B5,B7,REGBYTE IF NBYTE.NE.64 GO TO REGBYTE
  219. *
  220. * WE HAVE A BYTE SPLIT BETWEEN TWO WORDS (NBYTE = 64)
  221. *
  222. MX0 56
  223. BX3 -X0*X5 SAVE RIGHTMOST 4 BITS (BIT 7 FORCED TO 0)
  224. LX3 4 AND PUT THEM IN BITS 4-7
  225. SA5 A5+B1 ADVANCE TO NEXT WORD FOR 2ND HALF
  226. *
  227. * NOW COMBINE WITH PREVIOUS 4 BITS
  228. *
  229. MX0 4
  230. BX6 X5*X0
  231. LX6 4 TO MOVE THEM FROM LEFT TO RIGHT
  232. BX7 X3+X6 COMBINE AND REMEMBER IN *X7*
  233. SB5 12 START COUNTING FROM 12 (NOT 8)
  234. EQ TBLENT
  235. *
  236. * REGULAR ASCII BYTE (ALL IN THE SAME WORD)
  237. *
  238. REGBYTE LX3 B5,X5 GET ASCII CHAR TO RIGHTMOST BYTE
  239. MX0 52 KEEP LEFTMOST PARITY BIT
  240. BX7 -X0*X3 CHAR MASKED AT RIGHTMOST BITS OF *X7*
  241. SB5 B5+8 GET READY FOR NEXT BYTE
  242. *
  243. * IF NBYTE BECAME 68 RESET AND MOVE TO NEXT WORD OF NETBUF
  244. *
  245. SB7 B5-68
  246. LT B7,B0,TBLENT
  247. *****
  248. * WE ARE AT THE LAST CHARACTER IN THE WORD
  249. *
  250. SB7 X1 NETBUF *IN* WORD ADDRESS
  251. SB7 A5-B7 NETBUF *OUT* - *IN*
  252.  
  253. EQ B7,B0,TBLENT GO TO TBLENT IF NETBUF EMPTY(IN=OUT)
  254. *
  255. * NOT END OF BUFFER YET. GET NEXT WORD AND POSITION READY
  256. *
  257. SA5 A5+B1
  258. SB5 8
  259. *****
  260. * GET CHAR USING OFFSET OF CHARACTER STORED IN X7 PREVIOUSLY
  261. *
  262. TBLENT SB6 B6-B1 DECREMENT CHARACTER COUNTER
  263. SA3 STEP
  264. SX3 X3-6
  265. ZR X3,TBLENT1 8/8 TO DISPLAY CODE (6) CONV.
  266. *
  267. * ASCII (12 BITS) CONVERSION.
  268. *
  269. SB7 X7-37B 37B IS ASCII *UNIT SEPARATOR*
  270. EQ B0,B7,ZRBYT
  271. *
  272. * ONLY SPECIAL CASING IS NULL THAT GOES FROM 0000 TO 4000
  273. *
  274. NZ X7,NORM
  275. MX7 1
  276. LX7 12 X7 = 4000B
  277. EQ NORM
  278.  
  279. TBLENT1 SA3 X7+B2 CONV. TBL. ADDR. + THE OFFSET FOUND
  280.  
  281. MX0 12
  282. BX6 X3*X0 FUNCTION INTO X6
  283. MX0 48
  284. BX7 -X0*X3 VALUE OF DISPLAY CODE/ASCII12 INTO X7
  285.  
  286. NG X6,SPECIAL
  287.  
  288. SB3 B0 CLEAR POSSIBLE 'COLON READ' INDICATOR
  289. NORM LX7 B4 SHIFT VALUE TO CURRENT LOCATION
  290. BX4 X7+X4 ADD NEW CHARACTER
  291.  
  292. EQ B0,B4,ENDW
  293.  
  294. * NOT E-O-L YET. JUST GET NEXT LOCATION
  295.  
  296. SA3 STEP
  297. SB7 X3 STEP 6 OR 12 DEPENDING ON TRANSLATION MOD
  298. SB4 B4-B7
  299. EQ READBLK FOR NEXT CHARACTER FROM NETWORK
  300.  
  301. ENDW BX7 X4
  302. SA7 A4 STORE WORD JUST COMPOSED INTO DISKBUF
  303. SA4 NEXTIN
  304. SA4 X4 ADVANCE FOR NEXT WORD TO USE
  305. MX4 0 PRESET FOR NEXT ACCUMULATION
  306. *
  307. * SET *B4* TO THE FIRST CHARACTER SHIFT AMOUNT FOR NEXT WORD
  308. *
  309. SA3 STEP
  310. SB7 X3
  311. SB4 60
  312. SB4 B4-B7 STEP 6 OR 12 DEPENDING ON TRANSLATION MOD
  313. EQ READBLK0
  314. *
  315. * SPECIAL CASES SECTION
  316. *
  317. SPECIAL MX0 1
  318. BX3 -X0*X6 CLEAR LEFTMOST BIT OF FUNCTION (X'800')
  319. NZ X3,SP1
  320. * CODE = '800' JUST DELETE CHARACTER
  321. SB3 B0 CLEAR THE 'COLON READ' INDICATOR
  322. EQ READBLK GET NEXT CHARACTER
  323.  
  324. SP1 LX3 11 X'001'
  325. BX3 -X0*X3
  326. NZ X3,COLON ONLY POSSIBILITY LEFT (X'803')
  327.  
  328. *---------- CODE IS X'801' = Z-BYTE -----------------
  329.  
  330. ZRBYT SB7 B1+B1
  331. NE B3,B7,ZRBYT1 IF LAST CHAR WAS NOT COLON
  332. SX7 55B LAST CHAR COLON. SUFFIX A BLANK CHAR
  333. LX7 B4 MOVE TO CURRENT REQUESTED LOCATION
  334. BX4 X7+X4 INSERT INTO WORKING OUTPUT REGISTER.
  335.  
  336. SA3 STEP
  337. SB7 X3 STEP 6 OR 12 DEPENDING ON TRANSLATION MOD
  338.  
  339. SB4 B4-B7 GET READY FOR NEXT LOCATION
  340.  
  341. ZRBYT1 SB3 B0 CLEAR POSSIBLE 'LAST CHAR WAS COLON'
  342.  
  343. SA3 STEP
  344. SX3 X3-12 TO CHECK IF ASCII MOD
  345.  
  346. ZR X3,ENDW ONLY ONE ASCII CHAR WILL DO AS A Z-BYTE
  347. GE B4,B1,ENDW OR AT LEAST 2 DISPLAY CODE
  348.  
  349. SB3 1 SIGNAL ANOTHER ZERO WORD IS REQUIRED
  350.  
  351. EQ ENDW
  352. COLON SB3 B1+B1 RECORD INTERNALLY THE EVENT
  353. EQ NORM GO INSERT CHARACTER
  354. *
  355. * STORE VARIABLES IN TABLES AND RETURN
  356. *
  357. NEXIT SA3 PARAM RESERVE VARIABLES IN TABLE
  358. SX6 B6
  359. SA6 X3+2 SAVE NCOUNT ( WORD 3 OF PARAM TABLE)
  360. SX6 B5
  361. SA6 A6+B1 SAVE NBYTE (IN WORD 4)
  362. SX6 B4
  363. SA6 A6+B1 SAVE DBIT (IN WORD 5)
  364.  
  365. SX6 B3 RECORD THE STATE OF DISKBUF
  366. SA6 A6+B1 STORE IN WORD 6 OF PARAMETER BLOCK
  367. *
  368. * SAVE A4 (*IN* POINTER OF DISKBUF) BACK IN FET
  369. *
  370. NEXIT2 MX0 42
  371. SA2 A2 ADDRESS OF DFET WORD WITH *IN* POINTER
  372. BX2 X2*X0 MASK OUT OLD POINTER
  373. MX3 0
  374. SX3 A4 NEW *IN* ADDRESS
  375. BX7 X2+X3 INSERT ADDRESS TO WORD
  376. SA7 A2 WRITE BACK
  377. *
  378. * SAVE A5 (*OUT* POINTER OF NETBUF) BACK INTO FET
  379. *
  380. SA3 A1+B1 NFET WORD CONTAINING *OUT*
  381. BX3 X3*X0 MASK OUT OLD ADDRESS
  382. MX2 0
  383. SX2 A5 NEW ADDRESS
  384. BX6 X2+X3 INSERT NEW ADDRESS TO WORD
  385. SA6 A3 WRITE BACK
  386.  
  387. EQ NP$N2D
  388.  
  389. PARAM BSSZ 1
  390. STEP BSSZ 1
  391. NEXTIN BSSZ 1
  392. END
  393. *ENDIF
cdc/nos2.source/nam5871/np_n2d.txt ยท Last modified: 2023/08/05 17:22 by Site Administrator