Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!eecg.toronto.edu!leblanc From: leblanc@eecg.toronto.edu (Marcel LeBlanc) Newsgroups: comp.sys.cbm Subject: Re: Machine Language Smooth Scrolling Problem Summary: You need double buffering for bi-directional smooth scrolling Keywords: machine language, scrolling, C64 Message-ID: <1989Oct11.151724.18728@jarvis.csri.toronto.edu> Date: 11 Oct 89 19:17:24 GMT References: <2317@jarthur.Claremont.EDU> <136@cbmtor.UUCP> <2823@husc6.harvard.edu> Organization: EECG, University of Toronto Lines: 47 In article <2823@husc6.harvard.edu> byrd@husc7.UUCP (John Byrd) writes: [ much deleted ] >The programmer must watch for "flicker" when designing and writing this >type of sliding routine. If the raster (present line which is being drawn on >the television screen) happens to be on the screen when the screen is being ^^^^^^^^^^^^^^^^^^^^^^^^^^^ (difficult to avoid!) >moved via the software routine, the screen will flicker. This can be >resolved by checking location $D012. The raster is on the screen only when >the value of this location is between 51 and 251, AND when the high bit of >location $D011 is OFF. Otherwise it is okay to do the software scroll. Have you ever actually tried this (without double buffering)? As you point out later in your posting, the display is redrawn every 1/60 sec. This is a pretty tough timing problem. Try this loop: CYCLES ldy #0 2 lsrc lda screen+40,y 4/5 (4 on 216/256, 5 on 40/256) ldst sta screen,y 5 iny 2 bne lsrc 3/2 (3 on 255/256, 2 on 1/256) inc lsrc+2 6 inc ldst+2 6 lda lsrc+2 4 cmp #>[screen+$0400] 2 bcc lsrc 3/2 (3 on 3/4, 2 on 1/4) total cycles = 2 + ( (4+40/256+5+2+3)*256-1+6+6+4+2+3)*4-1 = 14577 us (not counting VIC cycles) 1/60 sec is only 16667 us. I suppose you could start a scroll *UP* 8 scan lines behind the raster, such that the scroll wouldn't catch up to the raster and would complete it's job just before the raster reaches the visible part of the screen on the next refresh. But what about a scroll *DOWN*? Starting from the bottom of the screen just after the raster has left the visible area doesn't leave enough time to complete the scroll before the raster starts displaying the top of the visible area on the next refresh! Unless the code I've listed above is *REALLY* bad, I can't think of a way to smooth *DOWN* scroll a screen unless you double buffer it. If I'm missing something obvious, please correct me! >John Byrd Marcel A. LeBlanc | University of Toronto -- Toronto, Canada "leblanc@eecg.toronto.edu" | and: LMS Technologies Ltd, Fredericton, NB, Canada ------------------------------------------------------------------------------- UUCP: uunet!utai!eecg!leblanc BITNET: leblanc@eecg.utoronto[.ca]