Path: utzoo!mnetor!tmsoft!torsqnt!jarvis.csri.toronto.edu!rutgers!ucsd!ucbvax!sysc.salford.ac.UK!R.D.Chafer From: R.D.Chafer@sysc.salford.ac.UK Newsgroups: comp.sys.atari.st Subject: Self Modifying code Message-ID: <15.Nov.89.16:38:32.A10297@UK.AC.SALF.C> Date: 15 Nov 89 16:38:32 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 44 >Date: 13 Nov 89 01:12:27 GMT >From: psuvm!sml108@psuvax1.cs.psu.edu >Subject: Self-Modifying Code > >Hi, I am writing an assembly language routine which modifies its own code in >a tight loop in order to avoid having to do a decision statement at every >iteration. Unfortunately, whatever code I am inserting is screwing things up >royally, and although I have checked it fairly throughly, I cannot figure out >what is going on. Question: Is there something screwy about executable and >object files that would disallow self modifying. The block that gets modified >is this: > > lsr.w d3 > bne cont > add.l #8,a0 > move.w #$8000,d3 > cont: nop > >Since branching is relative, one would think it would work, and a dump of >the object file indicates this is so. HELP !!!! > >Scott Le Grand I don't know if this has been answered, but could the 68000's instruction prefetch be causing the problem (The 68010 has a bigger prefetch I believe which would probably cause problems). Instruction prefetch on a 68000 or 68010 is one good reason NOT to write self modifying code. Robert Chafer ========================================================================= From: Robert Chafer Computing Centre Telephone: +44 61 736 5843 x 672 or x7328, University of Salford, Salford M5 4WT UK E-mail: JANET: chafer @ uk.ac.salford.sysc ARPANET: chafer%uk.ac.salford.sysc @ nss.cs.ucl.ac.uk BITNET: chafer%uk.ac.salford.sysc @ uk.ac or chafer%uk.ac.salford.sysc%ukacrl.bitnet @ cunyvm.cuny.edu