org &8000
ld hl,&4000
ld b,200
ld c,8
xor a
.lp
push af
push bc
push hl
ld e,l
ld d,h
inc de
ld (hl),a
ld bc,79
ldir
pop hl
pop bc
ld a,h
add a,8
ld h,a
dec c
jr nz,lp2
ld c,8
ld a,l
add a,80
ld l,a
ld a,h
adc a,&c0
ld h,a
.lp2
pop af
inc a
djnz lp
di
ld b,&bc
ld hl,sequence
ld e,17
.seq
ld a,(hl)
out (c),a
inc hl
dec e
jr nz,seq
ei
ld bc,&bc0c
out (c),c
ld bc,&bd30
out (c),c
ld bc,&bc0d
out (c),c
ld bc,&bd00
out (c),c
ld bc,&7fb8
out (c),c
ld hl,&1000
ld a,h
ld (&6802),a
ld a,l
ld (&6803),a
.ml
ld b,&f5
.ml1
in a,(c)
rra
jr nc,ml1
ld a,0
ld (&6804),a
ld a,100
ld (&6800),a
ld (&6801),a
ld a,(scrl_val)
inc a
and 7
ld (scrl_val),a
add a,a
add a,a
add a,a
add a,a
ld (scrl+1),a
halt
.scrl ld a,0
ld (&6804),a
xor a
ld (&6800),a
ld (&6801),a
jp ml
.scrl_val defb 0
.sequence
defb &ff,&00,&ff,&77,&b3,&51,&a8,&d4,&62,&39,&9c,&46,&2b,&15,&8a,&cd,&ee