--- mon/src/mon.h 1999/10/04 19:31:09 1.1 +++ mon/src/mon.h 2004/02/12 16:42:35 1.10 @@ -1,34 +1,35 @@ /* - * mon.h - Machine language monitor + * mon.h - cxmon main program * - * (C) 1997-1999 Christian Bauer + * cxmon (C) 1997-2003 Christian Bauer, Marc Hellwig + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef _MON_H_ -#define _MON_H_ +#ifndef MON_H +#define MON_H +#include -// Version/revision -const int MON_VERSION = 2; -const int MON_REVISION = 2; - - -// Data types -#if __BEOS__ -#include -#else -typedef signed char int8; -typedef unsigned char uint8; -typedef signed short int16; -typedef unsigned short uint16; -typedef signed long int32; -typedef unsigned long uint32; -#endif +/* + * Initialization, deinitialization and invocation + */ -// Initialization, deinitialization and invocation -void mon_init(void); -void mon_exit(void); +void mon_init(); +void mon_exit(); void mon(int argc, char **argv); @@ -36,9 +37,6 @@ void mon(int argc, char **argv); * Definitions for adding commands to mon */ -// Maximum input length -const int INPUT_LENGTH = 256; - // Input tokens enum Token { T_NULL, // Invalid token @@ -66,33 +64,37 @@ enum Token { }; // Scanner variables -extern enum Token mon_token; // Last token read -extern uint32 mon_number; // Contains the number if mon_token==T_NUMBER -extern char mon_string[INPUT_LENGTH]; // Contains the string if mon_token==T_STRING -extern char mon_name[INPUT_LENGTH]; // Contains the variable name if mon_token==T_NAME +extern enum Token mon_token; // Last token read +extern uintptr mon_number; // Contains the number if mon_token==T_NUMBER +extern char *mon_string; // Contains the string if mon_token==T_STRING +extern char *mon_name; // Contains the variable name if mon_token==T_NAME // Streams for input, output and error messages extern FILE *monin, *monout, *monerr; // Current address, value of '.' in expressions -extern uint32 mon_dot_address; +extern uintptr mon_dot_address; + +extern bool mon_use_real_mem; // Flag: mon is using real memory +extern uint32 mon_mem_size; // Size of mon buffer (if mon_use_real_mem = false) -extern bool mon_use_real_mem; // Flag: mon is using real memory -extern uint32 mon_mem_size; // Size of mon buffer (if mon_use_real_mem = false) +extern bool mon_macos_mode; // Flag: enable features in the disassembler for working with MacOS code // Add command to mon -extern void mon_add_command(const char *name, void (*func)(void), const char *help_text); +extern void mon_add_command(const char *name, void (*func)(), const char *help_text); // Functions for commands -extern void mon_error(const char *s); // Print error message -extern enum Token mon_get_token(void); // Get next token -extern bool mon_expression(uint32 *number); // Parse expression -extern bool mon_aborted(void); // Check if Ctrl-C was pressed -extern uint32 mon_read_byte(uint32 adr); // Memory access -extern void mon_write_byte(uint32 adr, uint32 b); -extern uint32 mon_read_half(uint32 adr); -extern void mon_write_half(uint32 adr, uint32 w); -extern uint32 mon_read_word(uint32 adr); -extern void mon_write_word(uint32 adr, uint32 l); +extern void mon_error(const char *s); // Print error message +extern enum Token mon_get_token(); // Get next token +extern bool mon_expression(uintptr *number); // Parse expression +extern bool mon_aborted(); // Check if Ctrl-C was pressed + +// Memory access +extern uint32 (*mon_read_byte)(uintptr adr); +extern void (*mon_write_byte)(uintptr adr, uint32 b); +extern uint32 mon_read_half(uintptr adr); +extern void mon_write_half(uintptr adr, uint32 w); +extern uint32 mon_read_word(uintptr adr); +extern void mon_write_word(uintptr adr, uint32 l); #endif