ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/mon/src/mon.h
Revision: 1.1
Committed: 1999-10-04T19:31:09Z (25 years, 1 month ago) by cebix
Content type: text/plain
Branch: MAIN
Branch point for: cebix
Log Message:
Initial revision

File Contents

# User Rev Content
1 cebix 1.1 /*
2     * mon.h - Machine language monitor
3     *
4     * (C) 1997-1999 Christian Bauer
5     */
6    
7     #ifndef _MON_H_
8     #define _MON_H_
9    
10    
11     // Version/revision
12     const int MON_VERSION = 2;
13     const int MON_REVISION = 2;
14    
15    
16     // Data types
17     #if __BEOS__
18     #include <SupportDefs.h>
19     #else
20     typedef signed char int8;
21     typedef unsigned char uint8;
22     typedef signed short int16;
23     typedef unsigned short uint16;
24     typedef signed long int32;
25     typedef unsigned long uint32;
26     #endif
27    
28    
29     // Initialization, deinitialization and invocation
30     void mon_init(void);
31     void mon_exit(void);
32     void mon(int argc, char **argv);
33    
34    
35     /*
36     * Definitions for adding commands to mon
37     */
38    
39     // Maximum input length
40     const int INPUT_LENGTH = 256;
41    
42     // Input tokens
43     enum Token {
44     T_NULL, // Invalid token
45     T_END, // End of line
46     T_NUMBER, // Hexadecimal/decimal number (uint32)
47     T_STRING, // String enclosed in ""
48     T_NAME, // Variable name
49     T_DOT, // '.'
50     T_COLON, // ':'
51     T_COMMA, // ','
52     T_LPAREN, // '('
53     T_RPAREN, // ')'
54     T_PLUS, // '+'
55     T_MINUS, // '-'
56     T_MUL, // '*'
57     T_DIV, // '/'
58     T_MOD, // '%'
59     T_AND, // '&'
60     T_OR, // '|'
61     T_EOR, // '^'
62     T_SHIFTL, // '<<'
63     T_SHIFTR, // '>>'
64     T_NOT, // '~'
65     T_ASSIGN // '='
66     };
67    
68     // Scanner variables
69     extern enum Token mon_token; // Last token read
70     extern uint32 mon_number; // Contains the number if mon_token==T_NUMBER
71     extern char mon_string[INPUT_LENGTH]; // Contains the string if mon_token==T_STRING
72     extern char mon_name[INPUT_LENGTH]; // Contains the variable name if mon_token==T_NAME
73    
74     // Streams for input, output and error messages
75     extern FILE *monin, *monout, *monerr;
76    
77     // Current address, value of '.' in expressions
78     extern uint32 mon_dot_address;
79    
80     extern bool mon_use_real_mem; // Flag: mon is using real memory
81     extern uint32 mon_mem_size; // Size of mon buffer (if mon_use_real_mem = false)
82    
83     // Add command to mon
84     extern void mon_add_command(const char *name, void (*func)(void), const char *help_text);
85    
86     // Functions for commands
87     extern void mon_error(const char *s); // Print error message
88     extern enum Token mon_get_token(void); // Get next token
89     extern bool mon_expression(uint32 *number); // Parse expression
90     extern bool mon_aborted(void); // Check if Ctrl-C was pressed
91     extern uint32 mon_read_byte(uint32 adr); // Memory access
92     extern void mon_write_byte(uint32 adr, uint32 b);
93     extern uint32 mon_read_half(uint32 adr);
94     extern void mon_write_half(uint32 adr, uint32 w);
95     extern uint32 mon_read_word(uint32 adr);
96     extern void mon_write_word(uint32 adr, uint32 l);
97    
98     #endif