Re: A82: Side-Scrolling - some code


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

Re: A82: Side-Scrolling - some code




I feel like writing some code

Scroll_Left:
    ld  bc, 96
Screen_Loop:
    push    bc
    ld  b, 64
Scroll_Loop:
    push    bc
APD_POS = &+1
    ld  hl, APD_BUF+11
    ld  b, 12
Scroll_Line_APD:
    or  a   ;clear carry flag
    rl  (hl)
    dec hl
    djnz    Scroll_Line_APD
GRAPH_POS = &+1
    ld  hl, GRAPH_MEM+11
    ld  b, 12
Scroll_Line_Graph:
    rl  (hl)
    dec hl
    djnz    Scroll_Line_Graph
    ld  hl, (APD_POS)
    ld  de, 12
    add hl, de
    ld  hl, (GRAPH_POS)
    add hl, de
    pop bc
    djnz    Scroll_Loop
    call    DISP_GRAPH
    pop bc
    djnz    Screen_Loop

Although I didn't test this, it should work
Scroll_Left is the routine to call
Screen_Loop is the loop that scrolls the screen one pixel 96 times
Scroll_Loop scrolls the screen 1 pixel, line by line
Scroll_Line_APD scrolls one line of the apd buffer left one bit
Scroll_Line_Graph scrolls one line of the graph buffer left one bit
APD_POS is the starting point in the APD buffer, self modifying code
GRAPH_POS is the starting point in the graph mem, self modifying code
If this doesn't work or you have questions, email me

~Adamman


In a message dated 12/14/99 2:51:25 PM Eastern Standard Time, 
ADAMMAN106@aol.com writes:

> Use shift (actually rotate) functions and work with the actual memory.  I 
>  assume you are trying to scroll left:
>  
>  <--Graph Mem<--APD buffer
>  
>  until the previous contents of the APD buffer are in the graph mem.  The 
APD 
> 
>  buffer will then be filled with zeros
>  use the instruction RL (rotate left).  this instruction copies the carry 
> flag 
>  into bit 0 (lsb), shifts each bit one bit to the left, and copies bit 7 
(msb)
>  
>  into the carry flag.  Here's a picture (C is carry flag):
>  
>  C <-- | 7 <-- 0 | <-- Previous C
>  
>  for each line, do the following:
>  - start out by clearing the carry flag (use "or a")
>  - perform a RL on each byte of the apd buffer and the graph mem (in that 
>  line!), starting from rightmost byte in the apd buffer
>  
>  then repeat that 96 times (after doing that for every line)
>  
>  ~Adamman
>  
>  In a message dated 12/12/99 10:15:22 PM Eastern Standard Time, 
>  evil_sam@hotmail.com writes:
>  
>  > Does anyone have any ideas on how to smooth scroll (pixel by pixel) a 
>  >  picture onto the screen horizontally? The only minor snag is that the 
>  >  current contents of GRAPH_MEM cannot be deleted as the new data scrolls 
>  onto 
>  > 
>  >  the screen (the old data scrolls off as the new scrolls on, and that is 
>  >  easily accomplished). The technique I'm using now treats the entire 
>  picture 
>  >  as one gigantic sprite. The current screen is GRAPH_MEM, the new screen 
> is 
>  >  APD_BUF. It scrolls APD_BUF by changing the x coord and using a hacked 
>  >  version of CrASH_Man's PutSprClip that'll automask and work for an 
entire 
> 
>  >  screen. The GRAPH_MEM scrolls off of the screen using a simple routine 
>  >  similar to CrASH_Man's Scrolling routines. My technique works, but the 
>  >  hacked sprite routine and utility routines take up too much room(~250 
>  bytes) 
>  > 
>  >  for such a trivial effect. Zelda will be a pretty tight budget of 
space, 
>  so 
>  >  I really can't afford to waste space unneccessarily. Any thoughts?
>  >     Sam
>  >  
>  >  ______________________________________________________
>  >  Get Your Private, Free Email at http://www.hotmail.com
>  


Follow-Ups: