Re: A86: Scrolling starfield question


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

Re: A86: Scrolling starfield question




Actually the quickest way to create a good asm scrolling technique would be to
randomly fill the last bit of VIDEO_MEM 
...
ld a,1
ld ($ffff),a
...
about every twenty or thirty rotates and then rotate like this (please note
this is by far not optimized..... but it works and that is what is important)
(keep reading....more at the end!!!)
...
 push hl
 push de
 ld hl,$ffff
 ld de,(VIDEO_MEM)
RotateLoop:
 ld a,(hl)
 rla
 ld (hl),a
CompareHL_DE:
 ld a,h
 cp d
 jr nz,SkipCompare
 ld a,l
 cp e
 jr z,StopRotateLoop
SkipCompare:
 dec hl
 jr RotateLoop
StopRotateLoop:
 pop de
 pop hl
...

this routine rotates once, but it wraps the screen around, so stars will go
off the left side and enter on the right one pixel higher.  The number of
rotates between each pixel draw (to the last bit of VIDEO_MEM) needs to be
somewhat random.... but you knew you would have to get a random number routine
already...
Hope this helps

-Tim-
honoriam2@aol.com