A little test program with a batch file for five targets that I have tried it with:
Code: Select all
// CapsTest.c
// #pragma define CLIB_EXIT_STACK_SIZE=0
#include <conio.h>
#include <sys/ioctl.h> // required for querying system capabilites and for switching screen modes
#if defined(__MC1000__) || defined(__PC6001__)
#define SCREEN_MODE 1
// #elif defined(__TIKI100__)
// #define SCREEN_MODE 3
// #elif defined(__VZ200__) || defined(__SV8000__)
// #define SCREEN_MODE 1
#endif
void main()
{
int caps;
int result;
int x;
#if defined(SCREEN_MODE)
int mode;
mode = SCREEN_MODE;
console_ioctl(IOCTL_GENCON_SET_MODE, &mode);
#endif
// On the ZX Spectrum, we switch to 32 column mode
#if defined(__SPECTRUM__)
printf("%c%c",1,32);
#endif
// Clear the screen
printf("%c",12);
printf("\x0c"); // the "\x0c" (0x0c character) resets the cursor position to the top left corner
printf("*** Capabilities Test ***\n\n");
console_ioctl(IOCTL_GENCON_GET_CAPS, &caps);
printf("IOCTL Result: %d\n", caps);
if (caps>255)
{
caps = (caps >> 8) & 0xFF;
printf(">255, right-shifted: %d\n", caps);
}
printf("\n");
// CAP_GENCON_CUSTOM_FONT 1
// CAP_GENCON_UDGS 2
// CAP_GENCON_FG_COLOUR 4
// CAP_GENCON_BG_COLOUR 8
// CAP_GENCON_INVERSE 16
// CAP_GENCON_BOLD 32
// CAP_GENCON_UNDERLINE 64
result = caps & CAP_GENCON_CUSTOM_FONT;
printf("Custom Font: ");
if (result==0) printf("no\n"); else printf("yes\n");
result = caps & CAP_GENCON_UDGS;
printf("UDG: ");
if (result==0) printf("no\n"); else printf("yes\n");
result = caps & CAP_GENCON_INVERSE;
if (result==0)
printf("Inverse: no\n");
else
printf("Inverse: yes %cpInverse%cq\n",27,27);
result = caps & CAP_GENCON_BOLD;
if (result==0)
printf("Bold: no\n");
else
printf("Bold: yes %c2Bold%c3\n",27,27);
result = caps & CAP_GENCON_UNDERLINE;
if (result==0)
printf("Underline: no\n");
else
printf("Underline: yes %c0Underline%c1\n",27,27);
result = caps & CAP_GENCON_FG_COLOUR;
if (result==0)
printf("Fore Colour: no\n");
else
{
printf("Fore Colour: yes ");
for (x = 0; x < 8 ; x++ )
printf("%cb%c%u", 27, x + 32,x);
printf("\n");
}
result = caps & CAP_GENCON_BG_COLOUR;
if (result==0)
printf("Back Colour: no\n");
else
{
printf("Back Colour: yes ");
for (x = 0; x < 8 ; x++ )
printf("%cc%c%u", 27, x + 32,x);
printf("\n");
}
#if defined(__PV1000__) || defined(__COLECO__) || defined(__PACMAN__) || defined(__Z80TVGAME__) || defined(__GAMEBOY__) || defined(__MYVISION__) || defined(__SV8000__)
// On systems without keyboard, wait five seconds
msleep(5000);
#else
fgetc_cons(); // wait for keypress
#endif
}
Code: Select all
setlocal
rem Set your z88dk root path here
set z88root=C:\Misc\z88dk\
set path=%PATH%;%z88root%bin\
set zcccfg=%z88root%lib\config\
set z80_ozfiles=%z88root%lib\
zcc +coleco -pragma-redirect:fputc_cons=fputc_cons_generic -o CapsTest_coleco -create-app CapsTest.c
zcc +hgmc -pragma-redirect:fputc_cons=fputc_cons_generic -o CapsTest_HueblerGrafikMC -create-app CapsTest.c
zcc +pv2000 -create-app -pragma-redirect:fputc_cons=fputc_cons_generic -o CapsTest_PV2000 CapsTest.c
zcc +rx78 -pragma-redirect:fputc_cons=fputc_cons_generic -o CapsTest_rx78 -create-app CapsTest.c
zcc +zx -pragma-redirect:fputc_cons=fputc_cons_generic -lndos -create-app -o CapsTest_ZXSpectrum CapsTest.c
endlocal
rem pause
1. PV2000: the result was 6144 and therefore greater than 255, so I had to right-shift it by 8 bits to get the desired 8-bit result.
Is this normal behaviour? If so, what's the reason for such a great result value?
2. PV2000: FG Colour result is "no" while this system definitively supports FG colour.
3. RX78: I couldn't get the underlining sample text to work (this is so far the only system I encountered that supports underlining).
4. Spectrum and H?bler Grafik MC: the result is always 0.