Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!munnari.oz.au!comp.vuw.ac.nz!rata.vuw.ac.nz!newbery From: newbery@rata.vuw.ac.nz (Michael Newbery) Newsgroups: comp.arch Subject: Re: Self-modifying code Message-ID: <1989Oct17.215046.19527@comp.vuw.ac.nz> Date: 17 Oct 89 21:50:46 GMT References: <522@ryn.esg.dec.com> <1989Oct12.041940.5651@ginger.acc.com> <1989Oct12.162236.24239@utzoo.uucp> Sender: news@comp.vuw.ac.nz (News Admin) Reply-To: newbery@rata.vuw.ac.nz (Michael Newbery) Organization: Computing Serv. Ctr, Victoria Uni., Wellington, New Zealand Lines: 30 In article <1989Oct12.162236.24239@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes: >Bootstraps written before the days of decent-sized EPROMs often employ >all kinds of dirty tricks to minimize size. describes PDP8 bootstrap as... >.. two instructions. The first was "kick disk >controller" (the controller handily came up in a fairly reasonable state >after bus reset). The second was "branch to self".[...] Eons ago we had an IBM 1130 to boot which, you inserted a special binary punched card in the reader and pressed "Program Load". The 1130 was a 16bit machine with an instruction format like (I think, it's been a while) opcode Long Indirect Index_Reg rest [4 bits] [1] [1] [2] [8] But, an 80col card has only 12 rows, so the load read 12 bits into each 16bit word as [opcode] [4 zeros] [rest]. All very well, except that the XIO (eXecute Input Output) instruction had to be Long, so the bootstrap program spent its first few instructions franticly modifying itself to create the reuquired instructions. The IBM supplied card used most of the 80 cols and a friend of mine decided he could do better. The result was a program that modified itself to create an XIO to read in sector 0 of the disk, which it then executed... at about which point the program ended. Sector 0 was read in, containing, among other things, the interrupt handling routines for the interrupt that resulted when the I/O completed, and some code that was in the right place by the time the bootstrap program reached it... The 1130 was not noted for its speediness. The new bootstrap card only needed about 1/3 of a card. -- Michael Newbery (...!uunet!vuwcomp!newbery if you must) Abstain from wine, women and song. Mostly song.