// // Viewer.h // // // PIC CHIP: 16C74 // #define HEX_DUMP_BK0_START 0x20 #define HEX_DUMP_BK0_END 0x7F #define HEX_DUMP_BK1_START 0xA0 #define HEX_DUMP_BK1_END 0xFF //== Macros ========================================================= #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #ifndef NULL #define NULL 0 #endif #ifndef STDCALL #define STDCALL #endif #ifndef Max #define Max(a,b) ((a) > (b) ? (a) : (b)) #endif #ifndef Min #define Min(a,b) ((a) < (b) ? (a) : (b)) #endif #ifndef ABS_VAL #define ABS_VAL(a) ((a) < 0 ? (-(a)) : (a)) #endif //== Interface Constants ============================================ // // keypress codes #define ESC 27 #define ENTER 13 #define PAGE_DN 81 #define PAGE_UP 73 #define LEFT_ARROW 75 #define UP_ARROW 72 #define RIGHT_ARROW 77 #define DOWN_ARROW 80 #define KEY_F1 59 #define FRAME_HEIGHT 16 #define FRAME_WIDTH 79 //== Functions ============================================================ #define MAX_NUM_SYMBOLS 255 #define MAX_SYMBOL_LENGTH 64 #define MAX_FILENAME_LENGTH 128 #define BANK_0_END 0x7F // // name - list of symbols by name (ordered as read from map file) // address - address assigned to the given symbol // length - calculated length for the given symbol // typedef struct { int address; int length; char name[ MAX_SYMBOL_LENGTH ]; } Symbol; extern Symbol Variables[ MAX_NUM_SYMBOLS ]; extern int OnChipData[ 256 ]; // display updating functions int STDCALL Display_Init( void ); void STDCALL Display_Frame( int x, int y, int width, int height ); void STDCALL Display_Frame_Line( void ); void STDCALL Display_Message( char *msg ); void STDCALL Display_Reset( void ); int STDCALL Display_Get_Key( char *key_str ); void STDCALL Display_String( char *dataStr, int row, int col ); void STDCALL Display_Data( int data, int length, int row, int col ); #define SHOW_FIRST_ROW 2 #define SHOW_LAST_ROW 16 #define SHOW_NUMBER_ROWS ( SHOW_LAST_ROW - SHOW_FIRST_ROW ) #define SHOW_NAMES_PER_PAGE ( (SHOW_NUMBER_ROWS + 1 ) * 2 ) int MapLoadFile( char *mapFileName, int sortedBy ); void Show_Data( int varStart, int varEnd, int hexBank ); void Show_Names( int *varStart, int *varEnd ); void InitUSART( int Port ); void TxData( int data ); int RxFlush( void ); int RxData( void );