gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
gbdk-lib/libc/targets/z80/sms_set_1bpp_data.s
1 .include "global.s"
2
3 .title "VRAM utilities"
4 .module VRAMUtils
5
6 .ez80
7
8 .area _HOME
9
10 ; void set_tile_1bpp_data(uint16_t start, uint16_t ntiles, const void *src, uint16_t colors) __z88dk_callee __preserves_regs(iyh,iyl);
11 _set_tile_1bpp_data::
12 DISABLE_VBLANK_COPY ; switch OFF copy shadow SAT
13
14 pop de ; pop ret address
15 pop hl
16
17 add hl, hl
18 add hl, hl
19 add hl, hl
20 add hl, hl
21 add hl, hl
22
23 ld bc, #.VDP_VRAM
24 add hl, bc
25
26 VDP_WRITE_CMD h, l
27
28 ex de, hl ; hl = ret
29
30 pop bc ; bc = ntiles
31 pop de ; de = src
32 ex (sp), hl ; hl = palette
33
34 ex de, hl
35
36 inc b
37 inc c
38 push ix
39
40 ld ixh, d
41 ld ixl, e ; ix == palette
42
43 push iy
44 ld iy, #-4
45 add iy, sp
46 ld sp, iy
47 push bc
48 jr 2$
49
50 1$:
51 ex (sp), hl
52
53 ld d, #8
54 6$:
55 ld c, (hl)
56 inc hl
57
58 ld e, #8
59 5$:
60 srl c
61
62 jr c, 10$
63 ld a, ixh
64 jr 11$
65 10$:
66 ld a, ixl
67 11$:
68 rra
69 rr 0 (iy)
70 rra
71 rr 1 (iy)
72 rra
73 rr 2 (iy)
74 rra
75 rr 3 (iy)
76
77 dec e
78 jr nz, 5$
79
80 ld a, 0 (iy)
81 out (.VDP_DATA), a
82 ld a, 1 (iy)
83 out (.VDP_DATA), a
84 ld a, 2 (iy)
85 out (.VDP_DATA), a
86 ld a, 3 (iy)
87 out (.VDP_DATA), a
88
89 dec d
90 jr nz, 6$
91 2$:
92 ex (sp), hl
93
94 dec l
95 jr nz, 1$
96
97 dec h
98 jr nz, 1$
99
100 ld iy, #6
101 add iy, sp
102 ld sp, iy
103 pop iy
104 pop ix
105
106 ENABLE_VBLANK_COPY ; switch ON copy shadow SAT
107
108 ret
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.