Untitled

mail@pastecode.io avatar
unknown
assembly_x86
a year ago
934 B
2
Indexable
Never
void AxelayScroller() {
  __asm
    ld hl,#0xc7cf; start from right
    ld c,#8 ; pixel lines
_Scroll_loop_outer::
    ld b,#80 ; bytes in a line
    ld d,#0 ; clear incoming buffer on right side of screen
_Scroll_loop_inner::
    ld a,(hl)
    ld e,a ; save current data for later
    and a,#0x77 ; got 3 right pixels
    rlca ; move them left
    or a,d ; get new right pixel from previous bytes left pixel, stored below
    ld (hl),a ; write back scrolled byte
    ld a,e ; get old byte data back to a
    and a,#0x88 ; get the left pixel
    rrca
    rrca
    rrca ; put in position of right pixel for byte to left of this one
    ld d,a ; and save in d for next byte
    dec hl ; move to left byte of current one
    djnz _Scroll_loop_inner
; next pixel line
    ld de,#0x800+#80
    add hl,de ; got hl pointing to right side of screen, 1 line down
    dec c ; count down pixel line count
    jr nz,_Scroll_loop_outer
__endasm;
}