procedure player_sprite_0();
begin
asm ("
  ld de, $1c
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $02
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $a8
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $0a
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $66
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $0a
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $aa
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $02
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $a8
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $08
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $02
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
");
end;
procedure player_sprite_1();
begin
asm ("
  ld de, $1c
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $aa
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $02
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $99
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $80
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $02
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $aa
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $80
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $aa
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $02
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $80
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
");
end;
procedure player_sprite_2();
begin
asm ("
  ld de, $1c
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $2a
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $80
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $a6
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $60
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $aa
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $a0
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $2a
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $80
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $80
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $20
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
");
end;
procedure player_sprite_3();
begin
asm ("
  ld de, $1c
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $0a
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $a0
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $29
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $98
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $2a
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $a8
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $0a
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $a0
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $20
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $08
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
 ld a,[ix+0] 
 or $00
 ld [hl],a
 inc hl 
 inc ix 
  add hl,de
  add ix,de
");
end;
var player_sprite_pi : integer;
var player_sprite_buf : integer;
@donotremove player_sprite_dst 
procedure player_sprite(player_sprite_src,player_sprite_dst : pointer; player_spritepx,player_spritepy : byte);
begin
  player_sprite_pi:=player_sprite_dst + player_spritepy<<5 + player_spritepx>>2;
  player_sprite_buf:=#buf + player_spritepy<<5 + player_spritepx>>2;
asm("  ld ix, [player_sprite_buf] 
  ld hl, [player_sprite_pi]
");
 player_spritepx:=player_spritepx&3;
 if (player_spritepx=0) then player_sprite_0();
 if (player_spritepx=1) then player_sprite_1();
 if (player_spritepx=2) then player_sprite_2();
 if (player_spritepx=3) then player_sprite_3();
end;
