CompuServe Thread

#void UnLock(lock)? Bah!

5 messages in this thread
#59From: Thomas HoladaySep 6, 1990 9:20 PM
It appears that the reason my code has been falling over for the past three days is that UnLock(lock) is, contrary to the 2nd Edition AmigaDOS manual, clearing D0 rather than leaving it alone, and hence the argument I was holding there for repeated calls to FreeMem was being zeroed out. Is this typical MetaComCo humor, or have I failed to understand something important? THol() { cout << "Sir, I exist." ;}
#73From: Vic WagnerSep 7, 1990 3:11 AM
Well, one fairly important thing is that if a function does not explicitly say it returns something, then D0, D1, A0, and A1 should be considered to be trash. Even if experimentation shows they are 'useful'. Victor A. Wagner, Jr.
#77From: Khalid AldoseriSep 7, 1990 6:46 AM
Thol, normally d0,d1,a0,a1 are considered to be trash. I wouldn't trust their contents no matter what the docs say. Don't you wish you had a thousand registers? (grin) Khalid.
#91From: Mike Spille/ManxSep 7, 1990 3:13 PM
Resident library routines are always allowed to trash the A0/A1 and D0/D1 registers. These are typically called 'temporary registers', and are used for scratch purposes. The reason for scratch registers is to make it so that routines are constantly pushing and popping registers, which can slow things down alot. So, if you need to keep A0/A1/D0/D1 preserved over calls to resident library stuff (or indeed, really if you're doing any kind of call), then you should push 'em before the call and pop 'em after. Oh, the exception to this rule of course is that some routines return values in D0 😎 -Mike
#92From: Mike Spille/ManxSep 7, 1990 3:14 PM
Er, make that 'so that routines are _not_ constantly pushing and popping registers'. I gotta start typing faster or thinking slower 😎 -Mike