aboutsummaryrefslogtreecommitdiff
path: root/src/ubox/ubox_set_sprite_pat8_flip.z80
blob: b453253b301f979c15b545dd695fe5ba7b49f35d (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 hl, #2
	add hl, sp

	ld e, (hl)
	inc hl
	ld d, (hl)
	inc hl

	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
	ret

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