TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

What does LETTER. do in LISTRD in FAP from 196x?

23 点作者 abrax31416 个月前

3 条评论

kens5 个月前
My conclusion is that LETTER is a categorization subroutine that categorizes characters into one of 14 types. Type 2 is minus sign, 4 is alphabetic character, 5 is period, 6 is right paren, 9 and 13 are blanks, 10 is left paren. Types 1, 3, 7, 8, and 11 are single characters (presumably different special characters). Type 12 is a digit. Type 14 gets handled as a single character or alphabetic character depending on circumstances.<p>The LETTER routine operates on a word of 6 characters at a time, producing 6 categorizations. The results of LETTER are stored in the variable KNOW, which is then used for a switch statement Z(IDENT), which transfers to W4, W5, W6, etc, which perform the appropriate action for the character type: creating a number, creating a sublist, creating a word token, or so forth.<p>Some other random things I determined on the way to this: IS is the parenthesization level, IC counts the character within a card (1 to 6), and IW counts selects the card (1-14). KGETBL and KGETIN extract one character from the specified word. I think KGETBL extracts it as a character and KGETIN extracts it as an index. MADIN converts its argument from a MAD language variable to an assembly variable, while MADOUT converts an assembly variable to a MAD variable.
abrax31416 个月前
Team ELIZA (and friends) are trying to make the original ~1965 MAD-SLIP ELIZA (discovered a few years ago in Jospeh Weizenbaum&#x27;s MIT archives) run. A number of semi-overlapping groups are involved in this. Some have a 7090 emulator, some have a CTSS emulator on that, and some have various versions of MAD, SLIP, and the underlying FAP (IBM&#x27;s Fortran Assembler) code that runs SLIP. (Yeah, I know. Go ahead and get the laughter out of your system. I did&#x27;t name it!)<p>We (they) have this mostly under control, but for one single function, called &quot;LETTER.&quot; that we cannot find the code for, and are having trouble divining the function of.<p>The code of concern is here:<p><pre><code> https:&#x2F;&#x2F;drive.google.com&#x2F;file&#x2F;d&#x2F;1zAJ2zX9WaeR7Ui8F88ZNFZtI5Q-Ow5sb </code></pre> If you search for &quot;LETTER.&quot; there is a single call to it on card 00386. (MAD functions all end with &quot;.&quot;; There are several occurrences of LETTER as labels, but only one function call.) This is in the function(entry) LISTRD. (000096) [This was in the days when functions could have multiple entry points in order to conserve memory.] and is used to load an array called KNOW (indexed by I). LISTRD is an s-expression reader (but into SLIP not LISP -- see below for LISTRD documentation).<p>Some potentially important factoids: The 7090 had 36 bit words and packed 6, 6-bit BCD characters into each. (You can see this in line 000356 where it appears to be packing 6 close parens (BCD 34k) into a word: CARD(I)=343434343434K (K for octal). Notice cards are (were) 84 characters in width and 84&#x2F;6 is 14 -- the number 14 is used in multiple places as a loop limiter, so it&#x27;s apparently scanning across cards (and the minimal comments and some variable names suggest this as well).<p>[Unfortunately, comments were used quite sparingly in those days because you had to punch them into cards!]<p>Again, the only function for which we don&#x27;t have code is LETTER. So, okay, Sherlock Hackers...What exactly does LETTER. do and what exactly is it doing here?<p>Here&#x27;s a SLIP manual:<p><pre><code> https:&#x2F;&#x2F;drive.google.com&#x2F;file&#x2F;d&#x2F;1XtF7EM1KhwMPKsp5t6F0gwN-8LsNDPOl </code></pre> LISTRD is documented on pg. 24 of the above manual.<p>(Possibly important is that lists had to start in column 1 with an open paren.)
评论 #42312224 未加载
评论 #42311995 未加载
mlaux5 个月前
You might already know this but here’s my guess:<p>OK, so this looks like it’s reading one card’s worth of code from either an actual card or tape. Based on how KNOW is used, the mystery LETTER looks like it’s classifying each word based on what type of token it is… then it goes into an interpreter loop with what’s basically a switch statement on the IDENT of each word (derived from its entry in KNOW). So I think each card could have 14 tokens of up to 6 chars each, some only one character (like a parenthesis) or some an entire literal?<p>A108 is the per-word outer loop and A105 is the per-char inner loop. A102 and A104 are the labels where the loop indices are updated and it jumps back to the beginning of the loop. As far as I can tell, MADIN and MADOUT are no-ops. I’m not sure what KGETIN is doing.<p>I believe the 343434343434k is meant to simulate some extra cells with a bunch of right parens so you could just end your program without wasting another card on closing everything?<p>Edit: I just read page 24 of the linked SLIP manual and what I’m calling tokens they’re calling SLIP cells.