aboutsummaryrefslogtreecommitdiff
path: root/src/ubox/ubox_set_sprite_pat8_flip.z80
blob: 64451e4e2830b492d14133eb979395508159e5b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
.globl _ubox_set_sprite_pat8_flip

WRTVRM = 0x004d
SP_PATTERNS = 0x3800

_ubox_set_sprite_pat8_flip::
	ld e, l
	ld d, h

	ld hl, #2
	add hl, sp
	ld l, (hl)
	ld h, #0
	add hl, hl
	add hl, hl
	add hl, hl
	ld bc, #SP_PATTERNS
	add hl, bc

	ld b, #8
flip0:
	call flip_and_copy
	inc hl
	inc de
	djnz flip0

	pop hl
	inc sp
	jp (hl)

flip_and_copy:
	ld a, (de)
	ld c, a
	rlca
	rlca
	xor c
	and #0xaa
	xor c
	ld c, a
	rlca
	rlca
	rlca
	rrc c
	xor c
	and #0x66
	xor c

	jp WRTVRM