z80 Development Kit
You are not logged in.
Hi,
int a = 0x10 => OK
int a = 10 = > OK
int a = 0b10 => KO!
GCC authorizes binary numbers through the 0bXXXXXXXX convention - is there something similar for z88DK's C compiler ?
Thank you ![]()
Offline
What about mixed C and ASM ?
<code>
#include "stdio.h"
extern char mydata[];
#asm
._mydata
defb @10000111
defb @10001000
defb 0 ; String termination
#endasm
main()
{
printf("%s",mydata);
}
</code>
Offline
Honestly, I don't find this solution very elegant
(even if it works).
Unfortunately, this does not work in the context I want to use it :
enum ESpriteMode
{
MODE_160_160 = 15, // 0b00001111
MODE_160_320 = 14, // 0b00001110
MODE_160_640 = 13, // 0b00001101
MODE_320_160 = 11, // 0b00001011
MODE_320_320 = 10, // 0b00001010
MODE_320_640 = 9, // 0b00001001
MODE_640_160 = 7, // 0b00000111
MODE_640_320 = 6, // 0b00000110
MODE_640_640 = 5 // 0b00000101
};Offline
I didn't know you could do that in gcc! - I've always used hex or left shifted 1 to get the correct values.
From a brief glance at the code, it doesn't look too tricky to add, give me a poke in a months time and I'll add it in.
Offline