I am new SDCC user and I have problem :-) struct { unsigned int READ_BL_LEN:4; unsigned int CCC:12; } CSD;
Accessing READ_BL_LEN is OK. Accessing CCC is wrong. Is there any problem with bitfields or is my code wrong? printf ("RDlen=%d\n", CSD.READ_BL_LEN); >> ld hl,#_CSD >> ... printf ("CCC=%03X\n", CSD.CCC); >> ld bc,#_CSD + 1 >> ld l,c >> ld h,b >> ld a,(hl) >> ld c,a >> inc hl >> ld a,(hl) >> and a,#0x0F It seems that second part of bitfield starts at next byte location from bit 0 :-( Thanks. Hynek Sladky ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user