[Coco] ASM Coders - Round two!

David Roper dave at ebonhost.com
Tue Aug 29 19:20:28 EDT 2006


Robert Gault wrote:
> <Snip>
> By the way, as you will want to make your code as fast as possible, 
> consider that you can set more than one byte of the screen per loop. 
> As an example,
>
> clrscrn    ldx    #HRESSCRN
>     ldu    #HSCLEN
>     ldd    #PATTERN
>     ldy    #PATTERN
> clrloop    std    ,x++
>     sty    ,x++
>     leau    -4,u
>     bne    clrloop
> endloop    bra    endloop
> HRESSCRN equ    $2000
> HSCLEN    equ    $3E80
> PATTERN    equ    $xxxx    or any 2 byte value you want
>
> You can make the routine faster still by pointing either regS or regU 
> at the bottom of the screen and pushing 8 bytes of data at a time. In 
> this case you don't use a counter but compare the stack to the start 
> of the screen.
>
> In short, as you reduce the number of passes through the loop, the 
> process speeds up.
>
Thanks, Robert - this code is quite handy, given my needs later on, as 
I'm using "virtual pixels" eg. setting 4x4 blocks as pixels. Depending 
on the heat value 0 - 255, this 2x2 block will be colored as flat color, 
or as a pattern of two adjacent colors
e.g
1111
1111
1111
1111

or
1010
0101
1010
0101

This nearly doubles the amount of fire-usable "colours", as well as 
allows me to reduce the number of heat-average calculations

Kind regards,
David



More information about the Coco mailing list