Re: A83: side scrolling background


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

Re: A83: side scrolling background




 shiftLeft:
   ld hl,plotsscreen+767
   ld c,64
 lineLoop:
   ld d,h
   ld e,l
   ld b,12
   xor a
 shiftRow:
   rl (hl)
   dec hl
   djnz shiftRow
   ld a,(de)
   adc a,b
   ld (de),a
   dec c
   jr nz,lineLoop
   ret


In a message dated Tue, 30 Jan 2001  1:53:14 AM Eastern Standard Time, Harper Maddox <gte172i@prism.gatech.edu> writes:

<< 
i dont see why you want it to loop, but anyways let me see if i can write 
an unoptimized routine real quick.  If this doesnt work, then one of you 
whiz kids should correct me soon.

shiftLeft:
  ld hl,plotsscreen
  ld b,64
lineLoop:
  ld d,(hl)
  sla d          ; bit we want is carried
  xor a
  rr a
  ld e,a         ; preserve offscreen bit

  ld c,11
byteLoop:
  inc hl
  ld a,(hl)
  sla a          ; shift byte, shifted bit = carry
  dec hl
  ld d,(hl)
  rl d           ; shift what was in carry onto this byte
  ld (hl),d
  inc hl
  dec c
  jr nz,byteLoop

  ld a,(hl)
  or e
  ld (hl),a
  inc hl
  djnz lineLoop
  ret




At 12:08 AM 1/30/01 -0600, you wrote:

>I'm trying to make a side scrolling game and I'm having some trouble
>figuring out a routine that will scroll the background (a 768 btye picture)
>to the left and have it loop back around to the right.  I mean, I can
>scroll it fine but I can't figure out how to make the bits that disappear
>on the left edge reappear on the right edge.  I've tried about 6 different
>ways of doing this, and each time I get some stupid little bug.  all I need
>is one stupid little routine to scroll the background and have it loop back
>around to the other side.  can anyone help?
>
>_____________________________________________
>Free email with personality! Over 200 domains!
>http://www.MyOwnEmail.com


 >>