Path: utzoo!mnetor!uunet!husc6!bloom-beacon!tut.cis.ohio-state.edu!mailrus!ames!amdahl!rtech!hoptoad!gnu From: gnu@hoptoad.uucp (John Gilmore) Newsgroups: comp.sys.mac.programmer Subject: Re: shutting off the instruction cache on 68020 Message-ID: <4269@hoptoad.uucp> Date: 29 Mar 88 05:45:52 GMT References: <5473@spool.cs.wisc.edu> Organization: Grasshopper Group in San Francisco Lines: 37 bier@speedy.cs.wisc.edu (George Bier) wrote: > I teach the machine language, assembly language class at the University > of Wisconsin. > The way we teach the class here is to keep as much hidden from them as > possible and slowly build up to the advanced material. The above uses > only absolute addressing (9f) which is the easiest mode to understand. Since > they only know absolute addressing, indexing through the array is > impossible leading to a self-modifying code solution. Many thanks for the explanation, Mr. Bier, however, as one of the "hot shit" programmers who wrote to you, I now feel even more strongly about it. For an ordinary application to be using self modifying code is one thing, but you are TEACHING this to unsuspecting students! Why not start with a program to add add up 10 numbers at fixed addresses using 10 add instructions? No big deal. You can go from there to "add 10 consecutive numbers at any location in memory" by using base+offset addressing, and from there to "add any number of numbers at any location in memory" by introducing looping. At no point is it necessary to introduce the idea of self-modifying code, to convey the basic concepts of machine language programming simply and one-at-a-time. You might even take 10 minutes to explain that in most computers, you are protected from writing on your programs because 999 times out of a thousand, that was not what you wanted to do; you had a store go wild, and would be happier if it failed there rather than when it tries to execute the data later. Not to mention its making the system more efficient in sharing program text, and making fast hardware easier to build (which is why you have to turn off the 68020 cache to get reliable results when you store in the instruction stream). There are many positive sides to the inability to write over instructions, and I'd much rather that you teach those to people, rather than teaching them how to circumvent the protection so they can use poor techniques. -- {pyramid,pacbell,amdahl,sun,ihnp4}!hoptoad!gnu gnu@toad.com "Watch me change my world..." -- Liquid Theatre