Re: A83: Re: Negative or positive?
[Prev][Next][Index][Thread]
Re: A83: Re: Negative or positive?
In a message dated 3/1/00 12:02:23 PM Eastern Standard Time,
gte172i@prism.gatech.edu writes:
> When coding assembly, you have to scrap alot of techniques that worked well
> for Basic, such as adding a positive or negative number to increment a
> value.
>
> just do this...
>
> ld a,r ; or insert your favorite random number routine
Actually to save a byte you could just do
rra
jr nc,increaseSpeed
> and %1 ; 0 or 1
> jr z,increaseSpeed ; move right if A=1
>
> ld a,(speed)
> dec a
> cp 6
> jr z,skipChangeSpeed ; dont change speed
> ld (speed),a
>
> jr skipChangeSpeed ; dont want to increase it either
>
> increaseSpeed:
> ld a,(speed)
> inc a
> cp 90
> jr z,skipChangeSpeed ; dont change speed
> ld (speed),a
>
> skipChangeSpeed:
>
> ; end of routine
>
----
Jonah Cohen
<ComAsYuAre@aol.com>
http://linux.hypnotic.org/~jonah/ (down)