The Story of Mel

This was posted to Usenet by its author, Ed Nather (), on May 21, 1983.


Arecentarticledevotedtothemachosideofprogramming
madethebaldandunvarnishedstatement:

RealProgrammerswriteinFORTRAN.

Maybetheydonow,
inthisdecadenteraof
Litebeer,handcalculators,and“user-friendly”software
butbackintheGoodOldDays,
whentheterm“software”soundedfunny
andRealComputersweremadeoutofdrumsandvacuumtubes,
RealProgrammerswroteinmachinecode.
NotFORTRAN.NotRATFOR.Not,even,assemblylanguage.
MachineCode.
Raw,unadorned,inscrutablehexadecimalnumbers.
Directly.

Lestawholenewgenerationofprogrammers
growupinignoranceofthisgloriouspast,
Ifeelduty-boundtodescribe,
asbestIcanthroughthegenerationgap,
howaRealProgrammerwrotecode.
I'llcallhimMel,
becausethatwashisname.

IfirstmetMelwhenIwenttoworkforRoyalMcBeeComputerCorp.,
anow-defunctsubsidiaryofthetypewritercompany.
ThefirmmanufacturedtheLGP-30,
asmall,cheap(bythestandardsoftheday)
drum-memorycomputer,
andhadjuststartedtomanufacture
theRPC-4000,amuch-improved,
bigger,better,faster—drum-memorycomputer.
Corescosttoomuch,
andweren'theretostay,anyway.
(That'swhyyouhaven'theardofthecompany,
orthecomputer.)

IhadbeenhiredtowriteaFORTRANcompiler
forthisnewmarvelandMelwasmyguidetoitswonders.
Meldidn'tapproveofcompilers.

Ifaprogramcan'trewriteitsowncode”,
heasked,“whatgoodisit?

Melhadwritten,
inhexadecimal,
themostpopularcomputerprogramthecompanyowned.
ItranontheLGP-30
andplayedblackjackwithpotentialcustomers
atcomputershows.
Itseffectwasalwaysdramatic.
TheLGP-30boothwaspackedateveryshow,
andtheIBMsalesmenstoodaround
talkingtoeachother.
Whetherornotthisactuallysoldcomputers
wasaquestionweneverdiscussed.

Mel'sjobwastore-write
theblackjackprogramfortheRPC-4000.
(Port?Whatdoesthatmean?)
Thenewcomputerhadaone-plus-one
addressingscheme,
inwhicheachmachineinstruction,
inadditiontotheoperationcode
andtheaddressoftheneededoperand,
hadasecondaddressthatindicatedwhere,ontherevolvingdrum,
thenextinstructionwaslocated.

Inmodernparlance,
everysingleinstructionwasfollowedbyaGOTO!
PutthatinPascal'spipeandsmokeit.

MellovedtheRPC-4000
becausehecouldoptimizehiscode:
thatis,locateinstructionsonthedrum
sothatjustasonefinisheditsjob,
thenextwouldbejustarrivingatthe“readhead
andavailableforimmediateexecution.
Therewasaprogramtodothatjob,
an“optimizingassembler”,
butMelrefusedtouseit.

Youneverknowwhereit'sgoingtoputthings”,
heexplained,“soyou'dhavetouseseparateconstants”.

ItwasalongtimebeforeIunderstoodthatremark.
SinceMelknewthenumericalvalue
ofeveryoperationcode,
andassignedhisowndrumaddresses,
everyinstructionhewrotecouldalsobeconsidered
anumericalconstant.
Hecouldpickupanearlier“add”instruction,say,
andmultiplybyit,
ifithadtherightnumericvalue.
Hiscodewasnoteasyforsomeoneelsetomodify.

IcomparedMel'shand-optimizedprograms
withthesamecodemassagedbytheoptimizingassemblerprogram,
andMel'salwaysranfaster.
Thatwasbecausethe“top-down”methodofprogramdesign
hadn'tbeeninventedyet,
andMelwouldn'thaveuseditanyway.
Hewrotetheinnermostpartsofhisprogramloopsfirst,
sotheywouldgetfirstchoice
oftheoptimumaddresslocationsonthedrum.
Theoptimizingassemblerwasn'tsmartenoughtodoitthatway.

Melneverwrotetime-delayloops,either,
evenwhenthebalkyFlexowriter
requiredadelaybetweenoutputcharacterstoworkright.
Hejustlocatedinstructionsonthedrum
soeachsuccessiveonewasjustpastthereadhead
whenitwasneeded;
thedrumhadtoexecuteanothercompleterevolution
tofindthenextinstruction.
Hecoinedanunforgettabletermforthisprocedure.
Although“optimum”isanabsoluteterm,
like“unique”,itbecamecommonverbalpractice
tomakeitrelative:
notquiteoptimum”or“lessoptimum
or“notveryoptimum”.
Melcalledthemaximumtime-delaylocations
the“mostpessimum”.

Afterhefinishedtheblackjackprogram
andgotittorun
(“Eventheinitializerisoptimized”,
hesaidproudly),
hegotaChangeRequestfromthesalesdepartment.
Theprogramusedanelegant(optimized)
randomnumbergenerator
toshufflethe“cards”anddealfromthe“deck”,
andsomeofthesalesmenfeltitwastoofair,
sincesometimesthecustomerslost.
TheywantedMeltomodifytheprogram
so,atthesettingofasenseswitchontheconsole,
theycouldchangetheoddsandletthecustomerwin.

Melbalked.
Hefeltthiswaspatentlydishonest,
whichitwas,
andthatitimpingedonhispersonalintegrityasaprogrammer,
whichitdid,
soherefusedtodoit.
TheHeadSalesmantalkedtoMel,
asdidtheBigBossand,attheboss'surging,
afewFellowProgrammers.
Melfinallygaveinandwrotethecode,
buthegotthetestbackwards,
and,whenthesenseswitchwasturnedon,
theprogramwouldcheat,winningeverytime.
Melwasdelightedwiththis,
claiminghissubconsciouswasuncontrollablyethical,
andadamantlyrefusedtofixit.

AfterMelhadleftthecompanyforgreenerpa$ture$,
theBigBossaskedmetolookatthecode
andseeifIcouldfindthetestandreverseit.
Somewhatreluctantly,Iagreedtolook.
TrackingMel'scodewasarealadventure.

Ihaveoftenfeltthatprogrammingisanartform,
whoserealvaluecanonlybeappreciated
byanotherversedinthesamearcaneart;
therearelovelygemsandbrilliantcoups
hiddenfromhumanviewandadmiration,sometimesforever,
bytheverynatureoftheprocess.
Youcanlearnalotaboutanindividual
justbyreadingthroughhiscode,
eveninhexadecimal.
Melwas,Ithink,anunsunggenius.

Perhapsmygreatestshockcame
whenIfoundaninnocentloopthathadnotestinit.
Notest.None.
Commonsensesaidithadtobeaclosedloop,
wheretheprogramwouldcircle,forever,endlessly.
Programcontrolpassedrightthroughit,however,
andsafelyouttheotherside.
Ittookmetwoweekstofigureitout.

TheRPC-4000computerhadareallymodernfacility
calledanindexregister.
Itallowedtheprogrammertowriteaprogramloop
thatusedanindexedinstructioninside;
eachtimethrough,
thenumberintheindexregister
wasaddedtotheaddressofthatinstruction,
soitwouldrefer
tothenextdatuminaseries.
Hehadonlytoincrementtheindexregister
eachtimethrough.
Melneverusedit.

Instead,hewouldpulltheinstructionintoamachineregister,
addonetoitsaddress,
andstoreitback.
Hewouldthenexecutethemodifiedinstruction
rightfromtheregister.
Theloopwaswrittensothisadditionalexecutiontime
wastakenintoaccount—
justasthisinstructionfinished,
thenextonewasrightunderthedrum'sreadhead,
readytogo.
Buttheloophadnotestinit.

ThevitalcluecamewhenInoticed
theindexregisterbit,
thebitthatlaybetweentheaddress
andtheoperationcodeintheinstructionword,
wasturnedon—
yetMelneverusedtheindexregister,
leavingitzeroallthetime.
Whenthelightwentonitnearlyblindedme.

Hehadlocatedthedatahewasworkingon
nearthetopofmemory—
thelargestlocationstheinstructionscouldaddress—
so,afterthelastdatumwashandled,
incrementingtheinstructionaddress
wouldmakeitoverflow.
Thecarrywouldaddonetothe
operationcode,changingittothenextoneintheinstructionset:
ajumpinstruction.
Sureenough,thenextprograminstructionwas
inaddresslocationzero,
andtheprogramwenthappilyonitsway.

Ihaven'tkeptintouchwithMel,
soIdon'tknowifheevergaveintothefloodof
changethathaswashedoverprogrammingtechniques
sincethoselong-gonedays.
Iliketothinkhedidn't.
Inanyevent,
IwasimpressedenoughthatIquitlookingforthe
offendingtest,
tellingtheBigBossIcouldn'tfindit.
Hedidn'tseemsurprised.

WhenIleftthecompany,
theblackjackprogramwouldstillcheat
ifyouturnedontherightsenseswitch,
andIthinkthat'showitshouldbe.
Ididn'tfeelcomfortable
hackingupthecodeofaRealProgrammer.

This is one of hackerdom's great heroic epics, free verse or no. In a few spare images it captures more about the esthetics and psychology of hacking than all the scholarly volumes on the subject put together. (But for an opposing point of view, see the entry for Real Programmer.)

[1992 postscript — the author writes: “The original submission to the net was not in free verse, nor any approximation to it — it was straight prose style, in non-justified paragraphs. In bouncing around the net it apparently got modified into the ‘free verse' form now popular. In other words, it got hacked on the net. That seems appropriate, somehow.” The author adds that he likes the ‘free-verse' version better than his prose original...]

[1999 update: Mel's last name is now known. The manual for the LGP-30 refers to “Mel Kaye of Royal McBee who did the bulk of the programming [...] of the ACT 1 system”.]

[2001: The Royal McBee LPG-30 turns out to have one other claim to fame. It turns out that meteorologist Edward Lorenz was doing weather simulations on an LGP-30 when, in 1961, he discovered the “Butterfly Effect” and computational chaos. This seems, somehow, appropriate.]

[2002: A copy of the programming manual for the LGP-30 lives at http://ed-thelen.org/comp-hist/lgp-30-man.html]