ADC Home > Reference Library > Technical Notes > Legacy Documents > Graphics & Imaging >
Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.
Current information on this Reference Library topic can be found here:
|
Removing VBLs from queue when application exits unexpectedlyDate Written: 11/3/92 Last reviewed: 3/1/93 My application has VBL tasks that must run while my application is running. The problem I'm having is that when the application doesn't take the normal exit path, my VBL code continues to be called because it's still in the Macintosh Operating System's VBL run list, resulting in a crash. How can I get control back just before the application loses its context so that I can be guaranteed a chance to remove all installed VBLs? The best way to do this is probably to patch the ExitToShell trap, which is called every time your application quits, regardless of the method. It's called not only for a traditional exit--that is, when you call the trap yourself or just fall out the end of your program's main routine--but also when a system error occurs or when MacsBug is used to exit. At that point, you can dispose of your VBL task safely. Your context will still be valid, but you might want to make sure A5 is valid by restoring it from the CurrentA5 global before using any global variables. A little extra sanity checking might also be in order, because by definition you're arriving here because there's a problem; you obviously can't protect against every case, but you should try to take some precaution against making things worse. When you've removed your VBL and anything else you need to, just jump through to the old ExitToShell address; you don't need to worry about removing your trap patch, because it will go away when your context is disposed of by the Process Manager. PowerBook and screen saversDate Written: 5/8/92 Last reviewed: 6/14/93 I'm looking for a Macintosh Toolbox routine that will allow me to turn down the backlight on a Macintosh PowerBook from within a screen saver to prevent screen burn and save battery life. Is there such a thing? Turning down the backlight won't prevent screen burn. Screen burn can be prevented only by either shutting the system off or letting the PowerBook enter its native sleep mode. In an RGB monitor the phosphor that illuminates each pixel is what causes screen burn. By setting the pixels to black (the phosphor isn't active) or rapidly changing the colors of an RGB screen (as with a screen saver), you can prevent screen burn. While effective on an RGB display, setting the pixels to black may actually cause screen burn on a PowerBook. The reason is that all the PowerBooks have a liquid crystal display (LCD), which can be burned by white pixels, black pixels, or repeating patterns on the screen over a period of time. For this type of display the only good way to save the screen is to power it off. Only the Power Manager has access to the chip that shuts the screen off. After a certain amount of time, the Power Manager makes the function calls to put the system to sleep. (These calls are documented in Chapter 31 of Inside Macintosh Volume VI.) At this time the Power Manager signals the chip to turn the screen off. There's no direct interface between the user and the chip to achieve this. It's best to let the PowerBook's native screen-saving mechanism (sleep mode, which shuts off the screen) work as is. This also has the benefit of saving the precious battery power that would be used by the screen saver. By the way, if your PowerBook screen has ghost images because you've left it on too long without going into sleep mode, letting the screen sleep or shutting down your computer for at least 24 hours will probably make the ghost images go away. Although there's no hard and fast rule, usually ghost images caused by your system being on for less than 24 hours won't be permanent if the screen is rested for an equal amount of time. Any ghost images caused by the system being on for greater than 24 hours may be permanent. Monitor/video camera synchronization extensionDate Written: 3/9/92 Last reviewed: 6/14/93 Didn't I see a system extension somewhere that removes the video flicker that often happens when you try to shoot video from a monitor? Yes, there is a system extension for synchronizing your monitor with your video camera. It is called VideoSync and is available from APDA (800-282-2732). VideoSync works with System 6.0.4 or later, an Apple 12 or 13" color monitor, and one of the following video cards: Macintosh II Video Card VideoSync does not work with built in video (i.e. it cannot be used with the LC, LCII, IIsi, or IIci) Determining Macintosh screen resolutionDate Written: 1/21/92 Last reviewed: 4/22/92 What's the best way to determine the dots-per-inch (dpi) resolution of a Macintosh screen? Can we calculate it based on the pixel map fields? QuickDraw doesn't provide any method for determining the screen's dpi; the resolution is assumed always to be 72 dpi. Though the pixel map contains hres and vres fields, their values are ignored by the system and are used only locally within an application. By default these resolution fields are set to the fixed type value 0x00480000. Code for finding video slot before using SlotVinstall for VBLsDate Written: 12/17/91 Last reviewed: 6/14/93 I want to synchronize my routine with a Macintosh Quadra 900 built-in video interrupt, but this interrupt seems to always be disabled. I call the interrupt if it uses the same SIntInstall call, replacing the internal video slot number ($9) by the slot number of an external card ($D). Is SIntInstall the correct method for video synchronism with a Macintosh Quadra? Your routine should be calling SlotVInstall, which is used for vertical blanking tasks on Color QuickDraw monitors, instead of SlotIntInsall, which is used by NuBus card drivers to install handlers for interrupts generated by their cards. SlotVInstall is documented on page 567 of Inside Macintosh Volume V. You need to determine the slot of the video in question by examining the DCE of the GDevice. Get the GDHandle of the GDevice in question and then determine the slot with the following C code:
You can then use the returned slot number to install slot VBLs with the SlotVInstall function. This code should work regardless of the CPU (provided it has Color QuickDraw), and whether or not the screen in question is internal or external video. [Note that this is the standard technique for finding out which slot a video card is in; the above code can be used by anyone who wants to know which slot a specific video card is in.] Changing screen size for Mac server with no display connectedDate Written: 12/11/91 Last reviewed: 12/19/91 How can I make the screen size bigger than 9 inches for our Macintosh II server running System 7 without a monitor? Changing the dummy 'scrn' resource rect in the System Folder to 0 0 480 640 has no effect. Macintosh video cards and circuitry detect the kind of monitor attached by checking three sense lines in the display connector. The monitor considered to be attached (and the memory allocated to accommodate it) is dependent on which lines are pulled low during card initialization. You'll find this scheme documented in Chapter 12 of the Guide to Macintosh Family Hardware, 2nd Edition, and in the article on the 8*24 GC card in develop issue #3. (Back issues of develop are available on the Developer CD.) A summary of monitor connections is available in the Q&A Stack or in the Q&A folder in the Dev Tech Answers library on AppleLink. The simplest way to fool the Macintosh into believing that a larger monitor is attached is to build a terminator for the video port that sets the sense lines appropriately. For example, to simulate a 640 x 480 pixel monitor, sense lines 2, 1, and 0 (pins 10, 7, and 4) should be 1, 1, and 0 (where 0 is grounded and 1 is free). We're not aware of any commercially available video terminators. Building one should be simple; as always, Apple isn't responsible for problems caused by non-Apple hardware attachments. Adding video device to slotless Macintosh desktopDate Written: 10/22/91 Last reviewed: 10/22/91 My video driver for Macintosh 68000 SE-type models installs itself as a driver, but since there's no Graphics Device Manager in the ROM, it can't add itself to the desktop by creating a GDevice using NewGDevice and putting itself into the DeviceList. Do I need to add my region to the region whose handle is in GrayRgn and patch the QuickDraw bottlenecks to divert drawing to my VRAM, or is there an easier way? For the Macintosh Plus, SE, Classic, and Portable, your idea of how to add your video device to the system is right on: Add your region to the region whose handle is in GrayRgn and patch the QuickDraw bottlenecks to divert drawing to your VRAM. You didn't ask for implementation details, so this is just a confirmation that your approach is good. QuickDraw 32-bit video RAM access and boundariesDate Written: 10/15/91 Last reviewed: 10/15/91 Is there a way to let QuickDraw access video RAM in 32-bit mode, but on a word boundary ? Usually QuickDraw reads/writes on word boundaries, but sometimes it takes advantage of the 68020/30 and reads not a word boundary. QuickDraw optimizes whenever it can to make efficient frame buffer accesses, but there isn't a way for you to control how it makes accesses itself. That is, video hardware MUST be able to handle all flavors of accesses. This is because the user can position a window or other object on the screen that is not on a long/word boundry. However, some applications--HyperCard being a prime example--create their windows on aligned boundries and allow movement only to boundaries, so you'll see a "snap"-to-grid kind of effect. Your application can do so as well, but that's as far as you should go. Installing a Macintosh VBL task for on-board videoDate Written: 9/4/91 Last reviewed: 9/16/91 Installing a VBL task doesn't seem to work on Macintosh systems with on-board video. I get the slot number for a video card by extracting the second nibble of the base address of the screen's pixMap; however, on-board video computers report that the video card is in slot $B but the video card doesn't seem to exist in any slot. Is there a better way to determine a video card slot number? Is there any way to attach a VBL task to on-board video? How can I determine whether the main monitor is using on-board video? You should be getting the slot number for the video from the AuxDCE entry, not from the base address of the pixMap (Inside Macintosh Volume V, page 424). You'll need to get the gdRefNum for the desired monitor from the device list (Inside Macintosh Volume V, Chapter 5). For example, to install a VBL task for the main screen, do something like this:
This should work regardless of the kind of video used. Main versus application screens with multiple displaysDate Written: 8/20/91 Last reviewed: 9/16/91 On a multiple-display system, most commercial software comes up on the primary screen, even though it may need the color screen next door. Is there a utility for changing the default screen to a different one AFTER startup so I can switch to a color screen for certain applications without having to reboot? A user can use Monitors to change the main screen (the one with the menu bar).If an application or utility were to change the main screen whenever it wants, then every time you run a new application, the menu bar would be moved on you.This would get reeeeeeally ugly. If commercial applications need (or run better on) one screen over another, they should do the right thing and look for the right screen instead of the main screen. The code to do this is very easy. This is not the job for a utility package. You need to reboot the machine each time you change the main screen, because the Macintosh does a lot of caching of information and building internal structures early in the boot process, which need to be changed each time the screen information is changed. It might be possible to do this, but it would require a lot of patches to the system, as well as a deep knowledge of the internals of the ROM and OS. You'll also run into a lot of compatibility problems. SetEntries and setting CLUT asynchronouslyDate Written: 9/16/91 Last reviewed: 9/16/91 I want to call the device driver Control function on my screen device to set the CLUT asynchronously, so that it won't wait until vertical retrace time like SetEntries does, causing an average delay of half the screen refresh rate, which is too much for my application. Does the firmware in the Apple video boards support asynchronous operation, or do I need to write a VBL task to handle the setting of the CLUT? The control call (SetEntries) in the video card is designed to turn off interrupts in the machine until it can sync to the VBL and then change the CLUT. It does this because otherwise the update to the CLUT will look really bad. You can call PBControl to make the SetEntries call (basically what the Color Manager is doing). There is a flag for making the control call Async, but it will not take care of the problem with waiting for the VBL. This limit is due to the way the video cards are designed. There may be some video cards which don't do this, but you probably don't want to be hardware dependent. If you are interested in using the PBControl call, then you may want to take a look at the Cards and Drivers manual. In general, DTS doesn't recommend using SetEntries to animate the CLUT. It is not a very clean way to change the CLUT, and you don't really gain anything by using it over the Palette Manager. For more information about the two ways, take a look at the "Palette Manager Animation" article in issue #5 of develop. Where to put video board gamma table & custom option menu codeDate Written: 7/30/91 Last reviewed: 8/1/91 Can I put both my custom option menu and my custom gamma table in the firmware of my color video board, or must I have an 'INIT'? The gamma table information can be stored in the ROM of the video card; in fact, in most cases that is where you will want it. The monitor extension, however will need to be in the system folder. You can find a fair amount of information about making a monitor extension, including sample code, in Chapter 10 of Inside Macintosh Volume VI. Graphics Devices Manager call supportDate Written: 9/24/91 Last reviewed: 9/24/91 Is SysEnvirons' hasColorQD a good way to determine whether I can make Graphic Device calls? SysEnvirons' hasColorQD field is a good way to check whether the Graphics Device calls are available. Another good way is to see if Gestalt returns something >= gestalt8BitQD. You can tell if you have GWorlds (see the Graphics Devices chapter of Inside Macintosh Volume VI) if Gestalt returns something (> gestaltOriginalQD and < gestalt8BitQD) or >= gestalt32BitQD. Recognizing a 32-bit address mode video cardDate Written: 2/13/91 Last reviewed: 2/13/91 How do I get the Macintosh system to recognize that I have a video card installed that only supports 32-bit addressing? Two bits need to be set in the sRsrcFlags field: fOpenAtStart (bit 1) and f32BitMode (bit 2). If you do not have these bits set, SecondaryInit will not get called and QuickDraw will not realize that your card is a 32-bit address only card. These bits are documented in the second edition of Designing Cards and Drivers for the Macintosh Family on page 123. Why Macintosh IIci and IIsi don't support direct videoDate Written: 1/28/92 Last reviewed: 2/13/92 What prevents the RBV (Ram Based Video) chip in the Macintosh IIsi from displaying 16-bit color on the new 12" Macintosh RGB monitor similar to the Macintosh LC? The RBV chip is not able to supply data directly to its D/A converters; thus it bypasses the color lookup step completely. The Macintosh IIci and IIsi hardware is not capable of supporting direct video. CLUT should be black for video card startupDate Written: 1/25/91 Last reviewed: 2/8/91 On a system restart, our PrimaryInit routine clears our video card's memory before displaying grayscreen, but garbage appears on the Macintosh LC screen. What should we do to fix this problem? The problem you are having with your video card on the Macintosh LC sounds like a CLUT problem. We recommend that you start by setting your entire CLUT to black then do what you are already doing. Basically the problem is caused by the CLUT DAC coming in early. If the CLUT is set then it should not cause you any problems. XRefs: Designing Cards and Drivers for the Macintosh Family, page 127 Video depth on Macintosh IIsi and LC SystemsDate Written: 1/8/91 Last reviewed: 1/30/91 Is there any way to get 24-bit color with a Macintosh IIsi or LC? For the Macintosh LC, is it possible to substitute a 1-MB Video RAM SIMM for the 512K VRAM SIMM, which substitutes for the 256K stock VRAM? Neither the Macintosh IIsi nor the Macintosh LC is designed to support 24-bit video. The on-board video hardware and the video driver on the Macintosh IIsi are only designed to support 1, 2, 4, and 8-bit video. Putting more memory in the SIMMs or any hacks you might come up with will not get 24-bit video on the on- board video hardware. The on-board video hardware on the Macintosh LC is capable of supporting 16-bit video on the 12" monitor, but it is still limited to 8-bit video on the 13" monitor. If you try to put 1-MB of VRAM into the video RAM SIMM, you probably will not be able to boot the machine. At best the machine will only see 512K of the VRAM. So, on the Macintosh LC the video hardware and the video driver only support 1,2,4,8 bits on Apple's 13" monitor and 1,2,4,8,16 bits on Apple's 12" monitor. Upgrade old Macintosh II ROMs to use with 8*24 GC cardDate Written: 12/13/90 Last reviewed: 1/16/91 Why does our Macintosh II with old ROMs not boot up with the 8*24 GC card, but it works fine on a Macintosh IIfx? There is a problem with the really old Macintosh II ROMs that prevents them from working correctly with cards that have more than 1 MB of memory. The upgrade program is still available so take your machine to your friendly dealer and ask for a new board. X-Ref: "Test & board exchange for early Macintosh II/NuBus problem" Q&A Macintosh 8*24 GC card 4-MB SIMM testing and pinoutsDate Written: 1/20/91 Last reviewed: 2/1/91 Does the current Macintosh 8*24 GC card work with 4-MB SIMMs? What are the pinouts for the higher density SIMM? We have made 4-MB SIMMs for the 8*24 GC card, tested them, and they work just fine. The 'cdev' sees them and they work. One way to test your SIMMs is to do a memory test over NuBus on addresses $sD000000 to $sD3FFFFF (Bank A) and $sD400000 to $sD7FFFFF (Bank B). The pinouts for the DRAM SIMMs are as follows:
Macintosh video connector pinouts J26 and J2Date Written: 11/29/90 Last reviewed: 2/8/91 What are the pinout and signal descriptions of the tiny little connector marked J26, located on the main logic board near the external video connector. Also, what is the part number and manufacturer of the mating connector? You seem to be asking about the external connector (J26), but my guess is that you really want to know about the internal connector (J2), so I will tell you about both. J26 is the external connector and is documented in the Developer Notes for the Macintosh LC on page 13. The pin assignments are as follows:
This connector is a standard DB-15 external connector. Connector J2 is the internal connector that is documented in the Developer Notes on pages 37 and 38. The pinouts are as follows.:
One source for the mating connector is Amp Incorporated, Harrisburg, PA 17105. The part number of the connector is 4-174904-2. All modes must have same starting address for a frame bufferDate Written: 11/27/90 Last reviewed: 1/30/91 Does Macintosh QuickDraw require that all modes have the same starting address for a frame buffer? In other words, I can't have 1-bit mode start at offset 1024 and 8-bit mode start at offset 2048, right? Yes, QuickDraw requires that all modes have the same starting address for a frame buffer. When to put Mac configuration ROM at top of 16-MB slot spaceDate Written: 11/27/90 Last reviewed: 2/8/91 Is it OK to put the configuration ROM on my board at the top of the 16-MB slot space? As long as the card is installed on all Macintosh systems after the Rev A Macintosh II (the very first Macintosh II systems that were shipped), you will not have a problem with putting your configuration ROM at the top of the 16-MB space; in fact, we recommend this. To determine if the machine is a Rev A Macintosh II, you can use the tester application that is on the developer CD. Just run the application and if the machine is one of the old ones, a dialog box displays that tells the user to upgrade (for free) to a new motherboard. Macintosh CAS2 instruction needs bus error trap handlerDate Written: 11/29/90 Last reviewed: 12/19/90 When we use the CAS2 instruction with the Apple's 8*24 GC card, we get a bus error. Why? The reason you get a bus error has to do with the way the NuBus(TM) interface works on the Macintosh II. If an incoming NuBus cycle to the motherboard happens exactly at the same time a Read-Modify-Write (RMW) instruction such as CAS2 tries to go out over NuBus (something a card with bus master capability might do), the processor gets a bus error due to the bus conflict. What your software must do is set a bus error trap handler before the CAS2 instruction and eliminate the trap handler after the instruction. The trap handler needs only to do an RTE instruction to cause the CPU to retry the CAS2 instruction. Don't access Macintosh RBV chip VIA emulation registers directlyDate Written: 11/12/90 Last reviewed: 12/19/90 Are the VIA emulation registers of the Macintosh RBV chip documented? If not, what are the offsets to the VIA emulation registers on the RBV chip? Is there more than one way to access the RBV registers? The VIA emulation registers of the RBV chip are not documented because Apple does not want developers to use them. We have not supported the use of the VIA registers and we do not plan on supporting the registers of the various new ASICs that Apple has developed. If you decide to use these registers anyway, you are on your own. We don't know of another way to access the RBV registers. Eliminating 1-bit per pixel modeDate Written: 10/29/90 Last reviewed: 2/20/91 How do I declare 8- and 24-bit modes without having 1 bit-per-pixel (bbp) mode in my sResources? The trick is that your first video mode (which, in your code, would be 8 bpp) must start with ID 128. The modes have to be sequential so the next mode (24 bpp in your case) would be ID 129. Besides Designing Cards and Drivers for the Macintosh Family (2nd edition), there are some MacDraw drawings of configuration ROMs, one of which shows an old Apple video card (sometimes referred to as the "TFB" card). It is out of date, especially with regard to 32-Bit QuickDraw and multiple mode families, but it will give you an idea about how these things interact. A picture showing the exploded ROM and all these video sResource components may help when reading C&D. You can find these drawings on our developer CD and on AppleLink under the MacDTS folder of Developer Services (look for the hardware hints/slots folder). The only other gotcha I can think of is whether or not you can be the startup device if you don't have 1 bit per pixel. And I think this was due to older MacsBugs not being able to handle more than 1 bpp, which of course is fixed now. Macintosh II video connector pinoutsDate Written: 11/17/89 Last reviewed: 12/17/90 What are the pinouts for the Macintosh II video card and IIci built-in video connector? Here are the pinouts for the Apple 13" RGB and 12" Monochrome monitors for Macintosh II video cards and IIci built-in video:
Macintosh IIci video MON.ID information `0' means that the line is grounded inside the monitor to provide information to the Macintosh IIci as to what kind of monitor is connected. If no monitor is connected to the IIci's built-in video port, then the port is automatically disabled at startup.
Macintosh 8*24 GC card softwareDate Written: 10/19/90 Last reviewed: 2/15/93 What's the current version of the 8*24 GC card software and which Macintosh models does it support? The current 8*24 GC card software is "8*24 GC 7.0.1." It provides full 8*24 GC card support for all Macintosh models except the Macintosh Quadra. The 8*24 GC card works with the Macintosh Quadra as a video card only. You can turn your card in for a refund from your Apple dealer if you purchased an 8*24 GC card for a Macintosh Quadra and it's not useful to you as a video card. By the way, Rev. B of the 8*24 GC card supports Apple's 16" monitor. If you own an Apple 16" monitor and a Rev. A 8*24 GC card, you can exchange your Rev. A card for a Rev. B card from your Apple dealer. Downloadables
|
|