29f12f9bc6
keyboard.h: added constants for commonly used keys and reformatted array so that gcc would be happy. adbsys.c: new adb system. bounds.h: bound-checking macros. ite.c: new built-in mini-console. 8x14.h: no longer used by built-in console. adb.c: replaced by adbsys.c
35 lines
785 B
C
35 lines
785 B
C
#if defined(CHECKBOUNDS)
|
|
|
|
#undef CHECKBOUNDS
|
|
|
|
#define CHECKBOUNDS(a, i) \
|
|
{\
|
|
if((((a) + (i)) < (a)) || \
|
|
(((a) + (i)) >= ((a) + (sizeof(a) / sizeof(*(a)))))) \
|
|
{ \
|
|
printf("index " #i " (%d) exceeded bounds of " #a ", '%s' line %d.\n", \
|
|
(i), __FILE__, __LINE__); \
|
|
printf("halting...\n"); \
|
|
/*asm(" stop #0x2700");*/ \
|
|
} \
|
|
}
|
|
|
|
#define CHECKPOINTER(a, p) \
|
|
{\
|
|
if(((p) < (a)) || \
|
|
((p) >= ((a) + (sizeof(a) / sizeof(*(a)))))) \
|
|
{ \
|
|
printf("pointer " #p " (0x%X) exceeded bounds of " #a " (0x%X), '%s' line %d.\n", \
|
|
, (p), (a), (i), __FILE__, __LINE__); \
|
|
printf("halting...\n"); \
|
|
/*asm(" stop #0x2700");*/ \
|
|
} \
|
|
}
|
|
|
|
#else /* !defined(CHECKBOUNDS) */
|
|
|
|
#define CHECKBOUNDS(a, i)
|
|
#define CHECKPOINTER(a, p)
|
|
|
|
#endif /* defined(CHECKBOUNDS) */
|