User Tools

Site Tools


base:4_ways_scroll

4 Way Scroll by Malcolm Bamber http://www.dark-well.pwp.blueyonder.co.uk/

How I scrolled a 2 by 2 tiled map I hope it is a help to some one trying to scroll the screen

This first part here will show you what the irq is doing when called

SCROLL UP

IF YSCROLL=3

  ADD ONE TO UDFLAG
  IF UDFLAG NOT 1 OR 2 THEN THEN QUIT OUT OF IRQ
  IF UDFLAG=1 THEN SO MOVE MAP POINTER UP ONE LINE IF WE CAN
  IF UDFLAG=2 THEN COPY SCREEN DOWN ONE LINE
  SET $D011 TO 3
  SET YSCROLL TO 5 FOR NEXT TIME IRQ IS CALLED

IF YSCROLL=5

  SET $D011 TO 5
  SET YSCROLL TO 7 FOR NEXT TIME IRQ IS CALLED
  DRAW TILE AT THE TOP OF THE SCREEN
  IF UDFLAG=1 THEN DRAW BOTTOM PART OF TILE
  IF UDFLAG=2	THEN DRAW TOP PART OF TILE

IF YSCROLL=7

  SET $D011 TO 7	
  SET YSCROLL TO 1 FOR NEXT TIME IRQ IS CALLED
  WE SCROLL EACH WAY TWO TIMES
  IF UDFLAG=1 THEN COPY EVEN COLOURS LINES TO SCREEN COLOUR MAP FROM SPARE COLOUR MAP 
  AND SWAP SCREEN
  IF UDFLAG=1 THEN COPY ODD COLOURS LINES TO SCREEN COLOUR MAP FROM SPARE COLOUR MAP 
  AND SWAP SCREEN 

IF YSCROLL=1

  SET YSCROLL TO 3 FOR NEXT TIME IRQ IS CALLED

SCROLL DOWN

IF YSCROLL=4

  ADD ONE TO UDFLAG
  IF UDFLAG NOT 1 OR 2 THEN QUIT OUT OF IRQ
  IF UDFLAG=1 THEN COPY SCREEN AND COLOUR UP ONE LINE
  IF UDFLAG=2 THEN SO MOVE MAP POINTER DOWN ONE LINE IF WE CAN
  SET $D011 TO 4
  SET YSCROLL TO 2 FOR NEXT TIME IRQ IS CALLED

IF YSCROLL=2

  IF UDFLAG=1 THEN DRAW TOP PART OF TILE AT BOTTOM OF SCREEN
  IF UDFLAG=2 THEN DRAW BOTTOM PART OF TILE AT BOTTOM OF SCREEN
  SET $D011 TO 2
  SET YSCROLL TO 0 FOR NEXT TIME IRQ IS CALLED

IF YSCROLL=0

  SET $D011 TO 0
  SET YSCROLL TO 6 NEXT TIME IRQ IS CALLED
  IF UDFLAG=1 THEN COPY COLOUR ODD LINE TO SCREEN COLOUR MAP AND SWAP SCREEN
  IF UDFLAG=2 THEN COPE COLOUR EVEN LINE TO SCREEN COLOUR MAP AND SWAP SCREEN

IF YSCROLL=6

 SET YSCROLL TO 4 FOR NEXT TIME IRQ IS CALLED	

SCROLL LEFT

IF xscroll=3

  ADD ONE TO LRFLAG				
  SET XSCROLL TO 5 FOR NEXT TIME IRQ IS CALLED
  SET $D016 TO 3 FOR SMOOTH SCROLL DOT POSITION
  IF LRFLAG NOT 1 OR 2 THEN THEN QUIT OUT OF IRQ
  IF LRFLAG=1 THEN SO MOVE MAP POINTER LEFT ONE POSITION IF WE CAN
  IF LRFLAG=2 THEN COPY SCREEN RIGHT ONE POSITION 

IF xscroll=5

  SET XSCROLL TO 7 FOR NEXT TIME IRQ IS CALLED
  SET $D016 TO 5 FOR SMOOTH SCROLL DOT POSITION
  DRAW A SIDE OF THE TILE ON THE LEFT SIDE OF THE SCREEN

IF xscroll=7

  SET XSCROLL TO 1 FOR NEXT TIME IRQ IS CALLED
  SET $D016 TO 7 FOR SMOOTH SCROLL DOT POSITION
  IF LRFLAG=1 THEN COPY COLOUR EVEN POSIION TO SCREEN COLOUR MAP AND SWAP SCREEN
  IF LRFLAG=2 THEN COPY COLOUR ODD POSITION TO SCREEN COLOUR MAP AND SWAP SCREEN

IF xscroll=1

  SET XSCROLL TO 3 FOR NEXT TIME IRQ IS CALLED

SCROLL RIGHT

IF xscroll=4

  ADD ONE TO LRFLAG
  IF LRFLAG NOT 1 OR 2 THEN QUIT OUT IRQ
  IF LRFLAG=1 THEN SO MOVE MAP POINTER RIGHT ONE POSITION IF WE CAN
  IF LRFLAG=2 THEN COPY SCREEN LEFT ONE POSITION 
  SET XSCROLL TO 0 FOR NEXT TIME IRQ IS CALLED
  SET $D016 TO 0 FOR SMOOTH SCROLL DOT POSITION

IF xscroll=2

  DRAW LEFT OR RIGHT SIDE OF TILE TO RIGHT SIDE OF SCREEN
  SET XSCROLL TO 0 FOR NEXT TIME IRQ IS CALLED
  SET $D016 TO 2 FOR SMOOTH SCROLL DOT POSITION

IF xscroll=0

  SET XSCROLL TO 6 FOR NEXT TIME IRQ IS CALLED
  SET $D016 TO 0 FOR SMOOTH SCROLL DOT POSITION
  IF LRFLAG=1 THEN COPY COLOUR ODD POSIION TO SCREEN COLOUR MAP AND SWAP SCREEN
  IF LRFLAG=2 THEN COPY COLOUR EVEN POSIION TO SCREEN COLOUR MAP AND SWAP SCREEN

IF xscroll=6

  SET XSCROLL TO 4 FOR NEXT TIME IRQ IS CALLED

See Part 1 & 2 For Source Code Part1 and Part2 Needs To Be Run Together

base/4_ways_scroll.txt · Last modified: 2015-04-17 04:30 by 127.0.0.1