Re: A89: Re: how to test 2 keys at once? and another question.


[Prev][Next][Index][Thread]

Re: A89: Re: how to test 2 keys at once? and another question.




On Mon, Apr 24, 2000 at 13:57:51 -0700, Hatch wrote:
>
> i was wondering if there was any way to test something, and make it do
> something if the value is true without going to a label... 
> 
> i dont want to have to do:
> 
>     cmp.w whatever,whatever
>     beq    add_1_to_x
> 
> add_1_to_x:
>     add.w #1,x

Use a `set if condition' instruction:

	cmp.w	whatever,whatever
	seq	d0	; set d0.b to $FF if equal, $00 otherwise
	ext.w	d0	; extend to word: d0.w = $FFFF or $0000
	sub.w	d0,x	; add $0001 (=sub $FFFF) or $0000 (=sub $0000)

Of course there are `sne', `sgt', `sle', `shi', `slo', etc ... too.

/Johan



References: