2023-09-13 14:40:48 -04:00
|
|
|
#ifndef _ZX_CHARSET_H
|
|
|
|
#define _ZX_CHARSET_H
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <inttypes.h>
|
|
|
|
|
|
|
|
#define ZX81_CHARSET_LEN 64
|
|
|
|
|
2023-09-13 16:25:52 -04:00
|
|
|
#define ZX81_CHAR_TOKEN_LOW_START 0x40
|
|
|
|
#define ZX81_CHAR_TOKEN_LOW_END 0x42
|
|
|
|
|
|
|
|
#define ZX81_CHAR_TOKEN_HIGH_START 0xc0
|
|
|
|
#define ZX81_CHAR_TOKEN_HIGH_END 0xff
|
|
|
|
|
2023-09-13 14:40:48 -04:00
|
|
|
#define ZX81_CHAR_LOW(c) \
|
2023-09-13 16:41:19 -04:00
|
|
|
(c < ZX81_CHARSET_LEN)
|
2023-09-13 14:40:48 -04:00
|
|
|
|
|
|
|
#define ZX81_CHAR_INVERSE_START 0x80
|
|
|
|
#define ZX81_CHAR_INVERSE_END 0xbf
|
|
|
|
|
|
|
|
#define ZX81_CHAR_INVERSE(c) \
|
|
|
|
(c >= ZX81_CHAR_INVERSE_START && c <= ZX81_CHAR_INVERSE_END)
|
|
|
|
|
|
|
|
#define ZX81_CHAR_TOKEN_LOW(c) \
|
|
|
|
(c >= ZX81_CHAR_TOKEN_LOW_START && c <= ZX81_CHAR_TOKEN_LOW_END)
|
|
|
|
|
|
|
|
#define ZX81_CHAR_NEWLINE(c) \
|
|
|
|
(c == 0x76)
|
|
|
|
|
|
|
|
#define ZX81_CHAR_TOKEN_HIGH(c) \
|
|
|
|
(c >= 0xc0)
|
|
|
|
|
|
|
|
#define ZX81_CHAR_TOKEN(c) \
|
|
|
|
(ZX81_CHAR_TOKEN_LOW(c) || ZX81_CHAR_TOKEN_HIGH(c))
|
|
|
|
|
|
|
|
#define ZX81_CHAR_TOKEN_INTEGRAL(c) \
|
|
|
|
(c == 0x0e)
|
|
|
|
|
|
|
|
#define ZX81_CHAR_TOKEN_FLOAT(c) \
|
|
|
|
(c == 0x7e)
|
|
|
|
|
|
|
|
extern uint32_t zx81_charset[ZX81_CHARSET_LEN];
|
|
|
|
|
|
|
|
int zx81_fputc(uint8_t c, int inverse, FILE *stream);
|
|
|
|
|
|
|
|
#endif /* _ZX_CHARSET_H */
|