Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!oliveb!sun!ember!dre From: dre%ember@Sun.COM (David Emberson) Newsgroups: comp.arch Subject: Re: Self Modifying Code Summary: A True HP2100 Story... Keywords: writing return address to routine front Message-ID: <60742@sun.uucp> Date: 20 Jul 88 23:57:46 GMT References: <5254@june.cs.washington.edu> <76700032@p.cs.uiuc.edu> <361@scolex> <2317@pt.cs.cmu.edu> Sender: news@sun.uucp Lines: 41 > > The idea of storing a return address into the front word of a subroutine > was widespread. It would be nice to think that this rank stupidity died out > long ago, but in fact the HP 2100 series worked that way. (I believe it > went off the market in the 1980's.) > Stupidity?!?? They didn't have stacks in those days. It probably seemed like a pretty cute idea at the time. I had the pleasure of spending many, many hours hacking on one of these machines during my undergrad days. At the Digital Systems Lab at MIT a group led by grad student extraordinaire Brad Hampson and fellow hacker Don Slutz wrote a Multics clone in HP2100 assembler called DSL/TSS. It had dynamic linking, a Runoff-type text formatting capability, and networking to a bunch of microcomputers--mostly 8080s. The only thing we did not have was any languages--just assembler. As a consequence the system ran like a bat out of hell, and we never really noticed the fact that we only had 32K of memory. This was around 1975-76. Now for my absolutely true story: In order to receive my bachelor's degree, I was assigned the job of completing Dave Presotto's bachelor's thesis. (I can say this now because Dave is currently wildly successful at Bell Labs.) The mission: to build a micro out of the new 6800 processor from Motorola and create software development tools for the 6800 which would run under DSL/TSS. I wrote tens of thousands of lines of HP2100 assember, including a cross assembler for the 6800. But the thesis deadline was approaching. In one all-nighter, I typed into the DecWriter II some 1500 lines of assembler which constituted the expression evaluator for the cross assembler. I assembled it and ran my test. The entire expression evaluator worked perfectly on the very first attempt, except that it bombed out when attempting to return to the calling routine. It turned out that I had JMP'ed to the evaluator instead of JSR'ing. Since the JMP did not deposit the return address in the entry point, the JMP indirect through the entry point (which is how you do a return on a 2100) got a return address of zero. Ah, for the good old days of ASR 33s and punched tape. Sigh... Someone once told me that the 2100 architecture was the result of someone's masters thesis at Stanford. I have no idea who. Dave Emberson (dre@sun.com)