Do you have a non visible are in the buffer?
no , i'm using a pointer into the the actual frame buffer of the display so i can't hide any data.
its vital that -
the width is in whole bytes ie for a 128x64 display thats 16 bytes
if i had a hidden byte each end then it would be 18
if you are short or long then the data will appear to move up or down at the wrap around
this may be clearer and can be applicable anywhere
note bank dependence has been eliminated
Code:
width con 128 ;display buffer width and
height con 64 ; height
bcnt VAR BYTE
dcnt VAR BYTE
WindowWidth CON 5 ;window is 5 bytes wide scrolling window
windowHeight CON 8 ;window is 8 bits high " "
@windowPad = _width/8 - _WindowWidth ;number of bytes to get to start of next row
@dspbuff = _fbr+16*8+5 ;window start address row8 byte 5
; fbr is the display frame buffer
rotate_r: ' pic18
asm
banksel _bcnt ;ROW
movlw _windowHeight
movwf _bcnt
movlw high (dspbuff) ;BOTTOM OF BUFFER
movwf FSR0H
movlw low (dspbuff)
movwf FSR0L
movlw low((_WindowWidth )*_windowHeight-1) ;TOP OF BUFFER
ADDWF FSR0L
movlw high((_WindowWidth )*_windowHeight-1)
ADDWFC FSR0H
MOVLW _WindowWidth
RROW
banksel _dcnt
movwf _dcnt ;display
bcf STATUS, C
Rcol
rrcf POSTDEC0 ,f ;PER display
DECFSZ _dcnt ,F
BRA Rcol
BNC RBNC
bsf PLUSW0,7 ;max would be 127 to use plusw
RBNC
banksel _bcnt
DECFSZ _bcnt ,F
BRA RROW
;banksel 0
return
endasm
rotate_l: ' pic18
asm
banksel _bcnt ;ROW
movlw _windowHeight
movwf _bcnt
lfsr 0, dspbuff
LROW
MOVLW _WindowWidth
banksel _dcnt
movwf _dcnt ;
comf WREG
incf WREG
bcf STATUS, C
Lcol
rlcf POSTINC0 ,f ;
DECFSZ _dcnt ,F
BRA Lcol
BNC LBNC
bsf PLUSW0,0 ;max would be 127 to use plusw
LBNC
movlw windowPad
addwf FSR0L ,f
bnc Lrnc
incf FSR0H ,f
Lrnc
banksel _bcnt
DECFSZ _bcnt ,F
BRA LROW
banksel 0
return
endasm
ps window is rotate_l only . not done rr yet
Bookmarks