LZ: Please help me find the bug...
[Prev][Next][Index][Thread]
LZ: Please help me find the bug...
;Is there a bug in one of these (maybe all???)
;Thanks,
;terry
;scroll routines
;by Terry Peng
scrollu: ;scroll up
ld hl,$8641+$10 ;hl ->(points to) row2
ld de,$8641 ;de -> row1
ld bc,$400-$10 ;bc = graphmem length-1 row
ldir
ret
scrolld: ;scroll down
ld hl,$8641+$3F0 ;row $3F
ld de,$8641+$400 ;last row
ld bc,$400-$10 ;bc = graphmem length-1 row
lddr
ret
scrolll: ;scroll left
ld ix,$8641 ;ix->graphmem
ld bc,$400-$2 ;bc = graphmem length-2
ld a,0
sla (ix)
sl2:
sla (ix+1)
jr nc,sl3 ;if carry, set the prev byte's rightmost bit
set 0,(ix)
sl3:
inc ix ;next byte
dec bc
ld a,b
or c
jr nz,sl2 ;a djnz except its for bc
ld hl,$8650 ;last byte row 1
ld de,$10 ;de=length of row
ld b,$40 ;vert length of graphmem
sl4:
res 0,(hl)
add hl,de
djnz sl4 ;reset rightmost bit in last byte of
ret ;each row
scrollr: ;scroll right
ld ix,$8641+$3FE ;kinda like the previous routine
ld bc,$400-$2
ld a,0
srl (ix+1)
sr2:
srl (ix)
jr nc,sr3 ;if carry, set the prev byte's rightmost bit
set 7,(ix+1)
sr3:
dec ix
dec bc
ld a,b
or c
jr nz,sl2
ld hl,$8641
ld de,$10
ld b,$40
sr4:
res 7,(hl)
add hl,de
djnz sr4
ret
;--
;Terry Peng
;tpeng@geocities.com