FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

DRAWING

Restore the system palette


Try this:
LOCAL MODE
LOCAL FN RestoreDeviceClut(GDHdl&)
  ` move.l  ^GDHdl&,-(sp)
  ` move.w  #$0002,D0
  ` dc.w    $AAA2
END FN

GDHdl& = FN GETMAINDEVICE

FN RestoreDeviceClut(GDHdl&)
Sylvain

For FB2, this will repair the system palette..its basically a fancy call to RestoreDeviceClut along with a forced update of the desktop.
LOCAL FN RestoreScreen
  `	 CLR.L	-(A7)
  `	 MOVEQ  #$02,D0
  `	 DC.W	 $AAA2
  `	 CLR.L	-(A7)
  `	 DC.W	 $2F38,$09EE
  `	 _PaintBehind
  `	 _DrawMenuBar
END FN
For FutureBasic^3 I use this.
LOCAL FN RestoreScreen
  COMPILE LONG IF cpu68k
   BEGINASSEM cpu68k
	 clr.l	-(sp);result of paldispatch.
	 moveq	 #02,D0;selector(RestoreDeviceClut)
	 dc.w	 $AAA2;_PaletteDispatch
	 clr.l	 -(sp);Ignore result, push more space
	 dc.w	 $2F38,$09EE;dunno, don' care
	 _PaintBehind;what it says
	 _DrawMenuBar;what it says
    ENDASSEM
  COMPILE XELSE
    RestoreDeviceClut(FN GetMainDevice)
    PaintBehind(FN FrontWindow,0)
    DrawMenubar
  COMPILE END IF
END FN
The code doesn't take into account multiple monitor setups though.

In the interest of completeness,
  `	 DC.W	 $2F38,$09EE 
happens to mean:
Move.l	GrayRgn,-(a7)
Which is the parameter for paintbehind. Just in case you were wondering.

This happens to mean that my powerpc code doesn't do quite the same thing as the 68k assembly code, however, the net effect appears to be the same in testing so far. If any problems appear, let me know and I will change the function.
Derek