home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / alt / folklore / computer / 16581 < prev    next >
Encoding:
Text File  |  1992-11-21  |  4.7 KB  |  117 lines

  1. Newsgroups: alt.folklore.computers
  2. Path: sparky!uunet!spool.mu.edu!agate!linus!linus.mitre.org!jcmorris
  3. From: jcmorris@mwunix.mitre.org (Joe Morris)
  4. Subject: The name "BSS" (Was: ASSEMBLY LANGUAGE IBM)
  5. Message-ID: <jcmorris.722362695@mwunix>
  6. Sender: news@linus.mitre.org (News Service)
  7. Nntp-Posting-Host: mwunix.mitre.org
  8. Organization: The MITRE Corporation
  9. References: <16NOV92.12250000.0072@VM1.MCGILL.CA> <1egom1INNdk1@early-bird.think.com>
  10. Date: Sat, 21 Nov 1992 16:18:15 GMT
  11. Lines: 104
  12.  
  13. rst@think.com (Robert Thau) writes:
  14.  
  15. [in response to what appears to be a request for the net to do someone's 
  16.  class assignment]
  17.  
  18. >                                                                 I begin
  19. >with a code fragment for the type 709 electronic data-processing machine
  20. >(using the FAP assembler):
  21.  
  22. > [...]
  23.  
  24. >           However, if we want to use the calling sequence of the library 
  25. >routines (SINF, COSF, etc. --- we're talking FORTRAN II here, so the 'F' at 
  26. >the end of the name has semantic content), then the arguments will be in 
  27. >the AC and MQ, and we may use the following routine:
  28.  
  29. > MYMIN STQ       SAVEQ
  30. >       CAS       SAVEQ
  31. >       XCA
  32. >       TRA       1,4
  33. >       TRA       1,4
  34. > SAVEQ PZE
  35.  
  36. >Here, the XCA instruction exchanges the contents of the AC and MQ, and the
  37. >PZE (Plus ZEro) is a dummy operation which assembles a word of zero bits
  38. >to reserve space.  (I might just as well have punched
  39.  
  40. > SAVEQ BSS       1
  41.  
  42. >to reserve a Block (of one word) Starting with the Symbol SAVEQ, but for
  43. >a block of fewer than 24 words, that would have wasted space in the object 
  44. >deck.  FAP also supports a BES directive, for Block Ending with Symbol,
  45. >should you want that).
  46.  
  47. Which brings up the question: did the symbol "BSS" (as a word to indicate
  48. a memory area allocated for variable storage in a program) originate with
  49. FAP?  That's where I first ran into it, and I don't recall having seen it
  50. in earlier languages.  
  51.  
  52. Incidentally, the BES pseudo-operation (the word "directive" appeared much
  53. later) was defined on the 704/709/etc systems because of the way the
  54. index registers worked:  their contents were *subtracted* from the value
  55. of the address field to generate the effective address.  (Since the address
  56. field, the index registers, and the addressing hardware were all 15-bit
  57. paths you could "add" an index by setting the index register to a negative
  58. number, 2-s complement style).  Thus, the instructions:
  59.  
  60.      AXT   5,1        Address to indeX True
  61.      CLA   FOO,1      CLear accumulator and Add
  62.  
  63. places the value 5 in index register 1, then loads into the accumulator
  64. the contents of (FOO-5).
  65.  
  66. I don't know the reason that the hardware was designed this way, but on 
  67. result of the decision was that until IBSYS came around the 704/709/7090
  68. FORTRAN defined arrays in descending order: lower subscript values 
  69. represented higher storage addresses.  Thus, the FORTRAN declaration:
  70.  
  71.      DIMENSION BAR(10)
  72.  
  73. would be assembled as:
  74.  
  75.  BAR   BES   10
  76.  
  77. and might appear in memory as:
  78.  
  79.    1400   BAR(10)
  80.    1377   BAR(9)
  81.    1376   BAR(8)
  82.    ...
  83.    1367   BAR(1)
  84.    1366    <--- value of BAR
  85.  
  86. Adding to the fun, the 709 FORTRAN assigned arrays row-wise descending,
  87. the 7090 (FMS) FORTRAN column-wise descending, and the (IBSYS) IBFTC
  88. compiler used column-wise ascending.  I have a not particularly fond
  89. memory of trying to rehost to an IBSYS machine a hairy statistical program
  90. written in assembler for a 709.  I finally told the customer that it would
  91. be cheaper to rewrite the entire thing from scratch.  (The user didn't
  92. consult us on this; he just came in and told us to convert the code.)
  93.  
  94. Oh yes...for readers curious about Mr. Thau's comment about the BSS
  95. not being appropriate for less than 24 words, I disagree slightly.  A
  96. little background:
  97.  
  98. Binary decks were (to nobody's surprise, I hope) written as 80-byte 
  99. images, and in most cases were actually punched to pieces of cardboard.
  100. Each card image included 24 (decimal) words of information: three of 
  101. loader controls and up to 21 words of program image.  The loader controls
  102. included the address within the image of the first data word and how
  103. many data words (up to 21) were on the card.
  104.  
  105. A BSS or BES did not store any value in memory, so if a BSS/BES appeared
  106. in the source program whatever was in the current binary card buffer was
  107. written out, and the next card was not started until somthing in the
  108. source program required that a memory word be initialized.
  109.  
  110. A series of contiguous BSS and/or BES pseudo-ops which together reserved
  111. 21 words or more were always more efficient than memory-initializing 
  112. operations like PZE.  On the average they were usually more efficient
  113. if they totalled 11 words or more, and usually were not as efficient if
  114. the total was under 11 words.
  115.  
  116. Joe Morris / MITRE
  117.