[comp.sys.amiga.tech] Amiga 68000 help

a447@mindlink.UUCP (Colin Fox) (01/02/91)

> in <3735@orbit.cts.com>, (koleman@pnet51.orb.mn.org) writes:

> [ code deleted ]

>Now,  the  problem  is  after the palette is there.  All of the colors
>move.   Sometimes  the  background color remains that of my workbench.
>Sometimes  it  is  right, but when I move the screen it changes to the
>workbench  background.   It's  always  JUST  the  background.  This is
>driving me nuts.  I hope it's something really stupid.

Well,  all  of your problems would be solved by using LoadRGB4 instead
of SetRGB4.  You can load the whole palette in and alert the system in
one fell swoop.

Your example would change to:

    MOVE.L   (screen),A0
    LEA      (sc_ViewPort,A0),A0
    LEA      colorarray,A1
    MOVEQ    #16,D0
    MOVE.L   (GraphicsPtr),A6
    JSR      (_LVOLoadRGB4,A6)
    RTS

colorarray

    DC.W    $0B97
    DC.W    $0000
    DC.W    $0EEE
    DC.W    $009D
    DC.W    $0EE0
    DC.W    $0E00
    DC.W    $0FFF
    DC.W    $0EEE
    DC.W    $0CCC
    DC.W    $0BBB
    DC.W    $0AAA
    DC.W    $0999
    DC.W    $0888
    DC.W    $0666
    DC.W    $0555
    DC.W    $0444


This  bit of code should make sure that your background colour doesn't
change.   Your  problem is that all of the system lists didn't seem to
be aware of your palette modifications.

As for your second problem, using a Wait() call (please excuse the (),
I  know  you  are programming in asm, but it makes it easier to denote
functions if there are the brackets.  :) is perfectly fine, unless you
are  only waiting on one port.  In that case, it becomes easier to use
a WaitPort():

    MOVE.L  (KWPtr),A0
    MOVE.L  (wd_UserPort,A0),A0
    MOVE.L  A0,A3       ;cache the pointer to the port
    SYSCALL WaitPort
    MOVE.L  A3,A0
    SYSCALL GetMsg

; at this point D0 is now pointing at your IntuiMessage. If you have set
;MENUPICK as one of your INTUIFLAGS, then this may very well be it.
;
; I must make a suggestion here, if you will. If you would like to make
;your menu handling somewhat easier, I suggest creating a slightly larger
;menu structure (the system doesn't care how large the menu structure is,
;as long as it's larger than the minimum size), and put a pointer at the
;end of each structure pointing at the routine to execute if the user
;selected the item. If you do this, it makes menu handling enourmously
;easier. I'll show you:

    MOVE.L  D0,A0
    MOVE.L  (im_Class,A0),D0
    CMP.L   #MENUPICK,D0
    BNE     DoSomethingElse
    MOVE.L  (im_IAddress,A0),A0
    JSR     (mymenu_Extrapointer,A0)
    :
    :
DoSomethingElse
    CMP.L   #ANOTHERINTUIFLAG,D0

    RTS

; the above code is just an example, of course. It should work as written,
;but it is not complete.


Anyway, this bit of code avoids having to do any of that ugly menu decoding,
while giving you a handy menu-handler.


If you have any problems with this, or further questions, don't hesiate
to e-mail me.

######################################################################
#           |                             | Any opinions expressed   #
# Colin Fox | "...graphics is my life..." | herin reflect only those #
#           +-----------------------------++ of my employer. Me. :)  #
#-----------+   Colin_Fox@MindLink.uucp    +-------------------------#
############|     Home of req.library      |##########################
######################################################################