struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-3791.c
blob899e9c43c729cd7a13a861699169d32559968f0e
1 /* bug-3791.c
2 Ran into an assertion in z80 code generation.
3 */
5 // Based on code by "Under4Mhz" licensed under GPL 2.0 or later
7 #include <testfwk.h>
9 #include <stdint.h>
11 #define BYTE_HI2(x) ((x)>>8)
12 #define vdu_address_set2(address) { VDPControlPort=address; VDPControlPort=BYTE_HI2((address) ); }
13 #define vdu_next_set_fast2(value) VDPDataPortOut = value
14 #define VDU_SPRITE_POSITION_TABLE_ADDRESS2 0x1B00
16 #define __IO_VDP_DATA_OUT #0xbe
17 #define __IO_VDP_COMMAND #0xbf
19 #ifdef __SDCC_z80
20 static volatile __sfr __at __IO_VDP_COMMAND VDPControlPort;
21 static volatile __sfr __at __IO_VDP_DATA_OUT VDPDataPortOut;
22 #else
23 static volatile unsigned char VDPControlPort;
24 static volatile unsigned char VDPDataPortOut;
25 #endif
27 ///< Set position of sprite
28 void vdu_sprite_position_set_fast( uint8_t id ) {
30 vdu_address_set2( VDU_SPRITE_POSITION_TABLE_ADDRESS2 + id );
32 vdu_next_set_fast2( id );
35 void testBug( void )