Path: utzoo!attcan!uunet!lll-winken!ames!oliveb!apple!claris!wombat From: wombat@claris.com (Scott Lindsey) Newsgroups: comp.sys.apple Subject: Re: Border color Message-ID: <9104@claris.com> Date: 19 Mar 89 03:02:34 GMT References: <8903181756.AA05520@crash.cts.com> Organization: Claris Corporation, Mountain View CA Lines: 41 From article <8903181756.AA05520@crash.cts.com>, by mdavis@pro-sol.cts.com (Morgan Davis): > Dan Bornstein describes the method by which one changes the border color > register on the IIGS. You have to be careful with the upper nibble in this > register because it is used by the Real Time Clock (RTC). However, Dan's > example showed 16-bit memory access being made to the $E0Cxxx area. Is it not > unsafe to do this? When you fetch 16 bits from a location here you could > possibly be hitting a softswitch. I think it might be better to drop into > 8-bit accumulator mode when working in the peripheral RAM area. As a general rule, probably so. However, in this case, there is no soft- switch at 0xE0C035 or in the high nibble, so it _is_ safe. To add my macros to the fray, these two are used in tandem to set the border on entry to a section of code and restore it on exit. Admittedly, these are not the most efficient pieces of code, but they're fairly clear and only for debugging anyway. #define SETBORDER(color) asm{ lda >0xE0C034 \ and #0xF \ pha \ lda >0xE0C034 \ and #0xFFF0 \ ora #color \ sta >0xE0C034 \ } /* Reset border back to what SETBORDER saved */ #define RESETBORDER() asm{ lda >0xE0C034 \ and #0xFFF0 \ ora 1,s \ sta >0xE0C034 \ pla \ } -- Scott Lindsey |"Cold and misty morning. I heard a warning borne in the air Claris Corp. | About an age of power when no one had an hour to spare" ames!claris!wombat| DISCLAIMER: These are not the opinions of Claris, Apple, wombat@claris.com | StyleWare, the author, or anyone else living or dead.