[comp.sys.amiga.tech] Assembly confusion

koleman@pnet51.orb.mn.org (Kurt Koller) (01/02/91)

 
Well, guys, I have two questions...  First of all, I am just learning the
"intuition" side of assembly programming.  I have a program that moves a
palette to a custom screen.  The part in question looks like this:
 

                movea.l #KolePalette,a2         ;beginning of palette
palloop
                movea.l (GraphicsPtr),a6        ;*graphics.library in a6
                movea.l (KSViewPort),a0         ;*viewport in a0
                move.b  (a2),d0
                cmp.b   #$ff,d0                 ;If $ff then end-of-palette
                beq     endpal
                move.b  (a2)+,d0
                move.b  (a2)+,d1                ;Move colors
                move.b  (a2)+,d2
                move.b  (a2)+,d3
                jsr     (_LVOSetRGB4,a6)
                bra     palloop
 
endpal
 
 
 
        ***********
        * Palette *
        ************************
        *       COL  R   G   B *
        ************************
 
KolePalette
        dc.b    $00,$0b,$09,$07         ;Color 0
        dc.b    $01,$00,$00,$00         ;Color 1
        dc.b    $02,$0e,$0e,$0e         ;Color 2
        dc.b    $03,$00,$09,$0d         ;Color 3
        dc.b    $04,$0e,$0e,$00         ;Color 4
        dc.b    $05,$0e,$00,$00         ;Color 5
        dc.b    $06,$0f,$0f,$0f         ;Color 6
        dc.b    $07,$0e,$0e,$0e         ;Color 7
        dc.b    $08,$0c,$0c,$0c         ;Color 8
        dc.b    $09,$0b,$0b,$0b         ;Color 9
        dc.b    $0a,$0a,$0a,$0a         ;Color 10
        dc.b    $0b,$09,$09,$09         ;Color 11
        dc.b    $0c,$08,$08,$08         ;Color 12
        dc.b    $0d,$06,$06,$06         ;Color 13
        dc.b    $0e,$05,$05,$05         ;Color 14
        dc.b    $0f,$04,$04,$04         ;Color 15
        dc.b    $ff                     ;End of Table
        even
 
 
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.
 
 
And for the second question...
 
I have this:
                movea.l (KWPtr),a0              ;Pointer to window's user
                movea.l (wd_UserPort,a0),a0     ;  port goes in a0
                move.b  (MP_SIGBIT,a0),d1       ;window's signal bits
                moveq.l #1,d0                   ;Convert bit number in mask
                lsl.l   d1,d0                   ;  and place result in d0
                SYSCALL Wait                    ;Wait for closegadget
 
 
And I'm waiting for a MENUPICK.  This is the only thing I am waiting for, not
a closegadget.  It used to be a closegadget.  Anyhow, what do I do next?  All
of the RKM examples on this are in C, and I am having a difficult time with
this one.  CAn someone maybe mail me an example of how to figure out what
menuitem was chosen, etc?  MAybe mail me an example (in assembly, please)...
 
Thanks, any help is appreciateed, etc...
Koleman

Kurt "Koleman" Koller
UUCP: {crash tcnet}!orbit!pnet51!koleman
INET: koleman@pnet51.orb.mn.org

johnv@tower.actrix.gen.nz (John Veldthuis) (01/04/91)

Quoted from <3735@orbit.cts.com> by koleman@pnet51.orb.mn.org (Kurt Koller):

[stuff deleted]

>  
> And for the second question...
>  
> I have this:
>                 movea.l (KWPtr),a0              ;Pointer to window's user
>                 movea.l (wd_UserPort,a0),a0     ;  port goes in a0

Make sure that d1 has been zeroed as only the lower 8 bits are effected by
this instruction and old data may be still in there
add a moveq #0,d1 to zero out d1

>                 move.b  (MP_SIGBIT,a0),d1       ;window's signal bits
>                 moveq.l #1,d0                   ;Convert bit number in mask
>                 lsl.l   d1,d0                   ;  and place result in d0
>                 SYSCALL Wait                    ;Wait for closegadget
>  
>  
> And I'm waiting for a MENUPICK.  This is the only thing I am waiting for, not
> a closegadget.  It used to be a closegadget.  Anyhow, what do I do next?  All
> of the RKM examples on this are in C, and I am having a difficult time with
> this one.  CAn someone maybe mail me an example of how to figure out what
> menuitem was chosen, etc?  MAybe mail me an example (in assembly, please)...

Once the Wait call returns you have to call GetMsg() untill it returns a
NULL and process each of these messages.
--
*** John Veldthuis, NZAmigaUG.         johnv@tower.actrix.gen.nz       ***

koleman@pnet51.orb.mn.org (Kurt Koller) (01/07/91)

johnv@tower.actrix.gen.nz (John Veldthuis) writes:
>Quoted from <3735@orbit.cts.com> by koleman@pnet51.orb.mn.org (Kurt Koller):
>
>[stuff deleted]
>
>>  
>> And for the second question...
>>  
>> I have this:
>>                 movea.l (KWPtr),a0              ;Pointer to window's user
>>                 movea.l (wd_UserPort,a0),a0     ;  port goes in a0
>
>Make sure that d1 has been zeroed as only the lower 8 bits are effected by
>this instruction and old data may be still in there
>add a moveq #0,d1 to zero out d1
>
 
Yes, this WAS the problem.  After I dragged my handy debugger out and took a
look at what was happening, d2 and d3 had trash in them.  After I zero'd them,
everything was fine.  I then changed the whole thing to 1 call, LoadRGB4().
>>                 move.b  (MP_SIGBIT,a0),d1       ;window's signal bits
>>                 moveq.l #1,d0                   ;Convert bit number in mask
>>                 lsl.l   d1,d0                   ;  and place result in d0
>>                 SYSCALL Wait                    ;Wait for closegadget
>>  
>>  
>> And I'm waiting for a MENUPICK.  This is the only thing I am waiting for, not
>> a closegadget.  It used to be a closegadget.  Anyhow, what do I do next?  All
>> of the RKM examples on this are in C, and I am having a difficult time with
>> this one.  CAn someone maybe mail me an example of how to figure out what
>> menuitem was chosen, etc?  MAybe mail me an example (in assembly, please)...
>
>Once the Wait call returns you have to call GetMsg() untill it returns a
>NULL and process each of these messages.
>--
>*** John Veldthuis, NZAmigaUG.         johnv@tower.actrix.gen.nz       ***

Thanks
Kurt "Koleman" Koller
UUCP: {crash tcnet}!orbit!pnet51!koleman
INET: koleman@pnet51.orb.mn.org