gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
gbdk-lib/libc/targets/mos6502/nes/set_sprite.s
1 .include "global.s"
2
3 .title "SetSprite"
4 .module SetSprite
5
6 .area GBDKOVR (PAG, OVR)
7 _move_sprite_PARM_3::
8 _scroll_sprite_PARM_3:: .ds 1
9
10 .area _HOME
11
12 ;
13 ; void set_sprite_tile(uint8_t nb, uint8_t tile)
14 ;
15 _set_sprite_tile::
16 asl
17 asl
18 tay
19 txa
20 sta _shadow_OAM+OAM_TILE_INDEX,y
21 rts
22
23 ;
24 ; void set_sprite_prop(uint8_t nb, uint8_t prop)
25 ;
26 _set_sprite_prop::
27 asl
28 asl
29 tay
30 txa
31 sta _shadow_OAM+OAM_ATTRIBUTES,y
32 rts
33
34 ;
35 ; void move_sprite(uint8_t nb, uint8_t x, uint8_t y)
36 ;
37 _move_sprite::
38 asl
39 asl
40 tay
41 txa
42 sta _shadow_OAM+OAM_POS_X,y
43 lda *_move_sprite_PARM_3
44 sta _shadow_OAM+OAM_POS_Y,y
45 rts
46
47 ;
48 ; void scroll_sprite(uint8_t nb, uint8_t x, uint8_t y)
49 ;
50 _scroll_sprite::
51 asl
52 asl
53 tay
54 txa
55 clc
56 adc _shadow_OAM+OAM_POS_X,y
57 sta _shadow_OAM+OAM_POS_X,y
58 lda *_scroll_sprite_PARM_3
59 clc
60 adc _shadow_OAM+OAM_POS_Y,y
61 sta _shadow_OAM+OAM_POS_Y,y
62 rts
63
64 ;
65 ; hide_sprite(uint8_t nb);
66 ;
67 _hide_sprite::
68 asl
69 asl
70 tay
71 txa
72 lda #240
73 sta _shadow_OAM+OAM_POS_Y,y
74 rts
75
76 ;
77 ; uint8_t get_sprite_prop(uint8_t nb)
78 ;
79 _get_sprite_prop::
80 asl
81 asl
82 tay
83 lda _shadow_OAM+OAM_ATTRIBUTES,y
84 rts
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.