Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/home/oam.asm
1270 views
1
; INPUT:
2
; a = oam block index (each block is 4 oam entries)
3
; b = Y coordinate of upper left corner of sprite
4
; c = X coordinate of upper left corner of sprite
5
; de = base address of 4 tile number and attribute pairs
6
WriteOAMBlock::
7
ld h, HIGH(wShadowOAM)
8
swap a ; multiply by 16
9
ld l, a
10
call .writeOneEntry ; upper left
11
push bc
12
ld a, 8
13
add c
14
ld c, a
15
call .writeOneEntry ; upper right
16
pop bc
17
ld a, 8
18
add b
19
ld b, a
20
call .writeOneEntry ; lower left
21
ld a, 8
22
add c
23
ld c, a
24
; lower right
25
.writeOneEntry
26
ld [hl], b ; Y coordinate
27
inc hl
28
ld [hl], c ; X coordinate
29
inc hl
30
ld a, [de] ; tile number
31
inc de
32
ld [hli], a
33
ld a, [de] ; attribute
34
inc de
35
ld [hli], a
36
ret
37
38