Skip to content

Commit

Permalink
Added vdp_clear_sprite() and vdp_add_sprite_bitmap()
Browse files Browse the repository at this point in the history
  • Loading branch information
pcawte committed Aug 2, 2023
1 parent c33b7f7 commit 358cc91
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,14 @@ In the relevant: example, test or any other directory created at the same level.

- `tests/sprite` added to demonstrate sprites and keyboard handling

02/08/2023

- Added sprite related functions

- `vdp_clear_sprite()`

- `vdp_add_sprite_bitmap()`

### To-Do / Known Issues:

- Testing / validation
Expand Down
2 changes: 2 additions & 0 deletions include/vdp_vdu.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ int vdp_load_sprite_bitmaps( const char *fname_prefix, const char *fname_format,
void vdp_create_sprite( int sprite, int bitmap_num, int frames );

void vdp_select_sprite( int n );
void vdp_clear_sprite( void );
void vdp_add_sprite_bitmap( int n );
void vdp_move_sprite_to( int x, int y );
void vdp_move_sprite_by( int x, int y );
void vdp_show_sprite( void );
Expand Down
34 changes: 34 additions & 0 deletions lib/agon/vdp_vdu.c.src
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,40 @@ _vdp_select_sprite:
ret
section .text,"ax",@progbits

section .text,"ax",@progbits
public _vdp_clear_sprite
_vdp_clear_sprite:
ld hl, _vdu_sprite_clear
ld de, 3
ld bc, 0
push bc
push de
push hl
call _mos_puts
pop hl
pop hl
pop hl
ret
section .text,"ax",@progbits

section .text,"ax",@progbits
public _vdp_add_sprite_bitmap
_vdp_add_sprite_bitmap:
call __frameset0
ld a, (ix + 6)
ld hl, _vdu_sprite_add_bitmap
ld de, 4
ld (_vdu_sprite_add_bitmap+3), a
ld bc, 0
push bc
push de
push hl
call _mos_puts
ld sp, ix
pop ix
ret
section .text,"ax",@progbits

section .text,"ax",@progbits
public _vdp_move_sprite_to
_vdp_move_sprite_to:
Expand Down
11 changes: 11 additions & 0 deletions src/libc/vdp_vdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,17 @@ void vdp_select_sprite( int n )
VDP_PUTS( vdu_sprite_select );
}

void vdp_clear_sprite( void )
{
VDP_PUTS( vdu_sprite_clear );
}

void vdp_add_sprite_bitmap( int n )
{
vdu_sprite_add_bitmap.n = n;
VDP_PUTS( vdu_sprite_add_bitmap );
}

void vdp_move_sprite_to( int x, int y )
{
vdu_sprite_moveto.x = x;
Expand Down

0 comments on commit 358cc91

Please sign in to comment.