2 Codegen for sm83 could generate an "ex de, hl" (a Z80 instruction not supported on SM83) when passing a struct as function argument while register hl holds another variable.
3 This would then result in an error message from the assembler.
8 // Based on code by "Under4Mhz" licensed under GPL 2.0 or later
9 #pragma disable_warning 85
25 uint8_t vdu_patch_crop_impl( uint8_t id
, int8_t col
, int8_t row
,
26 int8_t width
, int8_t offset
, const uint8_t *counts
, const uint8_t *colours
,
27 int8_t cols
, int8_t rows
, uint16_t tile_offset
, bool zoom
) {
29 ASSERT( tile_offset
== 8);
34 typedef uint8_t ImageBaseType
;
38 const ImageBaseType
* const * const * const sprites
;
43 const ImageBaseType
* const I1
= {0};
44 const ImageBaseType
* const * const I0
= &I1
;
45 SpriteItem SI
= {&I0
, 0};
47 const SpriteItem
* wolf_sheets
[1] = {&SI
};
49 uint8_t sprite_state_show( uint8_t id
, SpriteData
*sprite
, uint8_t y
, uint8_t tile
) {
51 static bool zoom
= false;
53 // Only allow zoom on first sprite, if it's full size enemy
55 zoom
= sprite
->type
> 1 && sprite
->scale
== 5;
56 if ( zoom
) sprite
->scale
--;
58 if ( zoom
) goto finish
;
61 const SpriteItem
* sprite_data
= wolf_sheets
[0];
63 const ImageBaseType
* const * const scale_sprite_data
= sprite_data
[0].sprites
[0];
65 id
= vdu_patch_crop_impl( id
, sprite
->left
, 0, sprite
->width
, 0, scale_sprite_data
[0], 0,0,0, tile
, zoom
);
74 SpriteData sprite
= { 1,2,3,4,5,6};
75 sprite_state_show( 0, &sprite
, 7, 8 );