scrollpixeldown
        ld de,0x5000+2
        ld b,128
scrollpixeldown0
        ld h,d
        ld l,e
        call uphl
        push hl
        ld c,d ;>=28
        call copypixelline
        pop de
        djnz scrollpixeldown0
        jr scrollpixelupq
        ;ld h,d
        ;ld l,e
        ;inc e
        ;ld c,27
        ;ld (hl),b
        ;ldir
        ;ret
        
scrollpixelup
        ld de,0x4000+2
        ld b,128
scrollpixelup0
        ld h,d
        ld l,e
        call downhl
        push hl
        ld c,d ;>=28
        call copypixelline
        pop de
        djnz scrollpixelup0
scrollpixelupq
        ld h,d
        ld l,e
        inc e
        ld c,27
        ld (hl),b
        ldir
        ret
        
copypixelline
        dup 27
        ldi
        edup
        ld a,(hl)
        ld (de),a
        ret

uphl
        ld a,h
        dec h
        and 7
        ret nz
        ld a,l
        sub 32
        ld l,a
        ret c
        ld a,h
        add a,8
        ld h,a
        ret
        
downhl
        inc h
        ld a,h
        and 7
        ret nz
        ld a,l
        add a,32
        ld l,a
        ret c
        ld a,h
        sub 8
        ld h,a
        ret
