1 |
|
/* |
2 |
< |
* mon.cpp - Machine language monitor |
2 |
> |
* mon.cpp - cxmon main program |
3 |
|
* |
4 |
< |
* (C) 1997-1999 Christian Bauer |
4 |
> |
* cxmon (C) 1997-2002 Christian Bauer, Marc Hellwig |
5 |
> |
* |
6 |
> |
* This program is free software; you can redistribute it and/or modify |
7 |
> |
* it under the terms of the GNU General Public License as published by |
8 |
> |
* the Free Software Foundation; either version 2 of the License, or |
9 |
> |
* (at your option) any later version. |
10 |
> |
* |
11 |
> |
* This program is distributed in the hope that it will be useful, |
12 |
> |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
> |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
> |
* GNU General Public License for more details. |
15 |
> |
* |
16 |
> |
* You should have received a copy of the GNU General Public License |
17 |
> |
* along with this program; if not, write to the Free Software |
18 |
> |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 |
|
*/ |
20 |
|
|
21 |
< |
#include <sys/types.h> |
22 |
< |
#include <netinet/in.h> |
21 |
> |
#include "sysdeps.h" |
22 |
> |
|
23 |
|
#include <stdio.h> |
24 |
|
#include <stdlib.h> |
11 |
– |
#include <string.h> |
25 |
|
#include <signal.h> |
26 |
|
#include <ctype.h> |
27 |
< |
#include <unistd.h> |
28 |
< |
#include <errno.h> |
27 |
> |
#include <string> |
28 |
> |
#include <map> |
29 |
|
|
30 |
+ |
#if defined(HAVE_READLINE_H) |
31 |
+ |
extern "C" { |
32 |
+ |
#include <readline.h> |
33 |
+ |
} |
34 |
+ |
#elif defined(HAVE_READLINE_READLINE_H) |
35 |
|
extern "C" { |
36 |
< |
extern char *readline(char *prompt); |
19 |
< |
extern void add_history(char *str); |
36 |
> |
#include <readline/readline.h> |
37 |
|
} |
38 |
+ |
#endif |
39 |
+ |
|
40 |
+ |
#if defined(HAVE_HISTORY_H) |
41 |
+ |
extern "C" { |
42 |
+ |
#include <history.h> |
43 |
+ |
} |
44 |
+ |
#elif defined(HAVE_READLINE_HISTORY_H) |
45 |
+ |
extern "C" { |
46 |
+ |
#include <readline/history.h> |
47 |
+ |
} |
48 |
+ |
#endif |
49 |
|
|
50 |
|
#include "mon.h" |
51 |
|
#include "mon_cmd.h" |
52 |
+ |
#include "mon_lowmem.h" |
53 |
+ |
|
54 |
+ |
#ifndef VERSION |
55 |
+ |
#define VERSION "2" |
56 |
+ |
#endif |
57 |
|
|
58 |
|
|
59 |
|
// Buffer we're operating on |
96 |
|
|
97 |
|
|
98 |
|
// List of variables |
99 |
< |
struct Variable { |
100 |
< |
Variable *next; // Pointer to next variable (must be first element of struct) |
68 |
< |
char *name; // Variable name |
69 |
< |
uint32 value; // Variable value |
70 |
< |
}; |
71 |
< |
|
72 |
< |
static Variable *first_var; // Pointer to first variable |
99 |
> |
typedef map<string, uint32> var_map; |
100 |
> |
static var_map vars; |
101 |
|
|
102 |
|
|
103 |
|
// Prototypes |
119 |
|
static bool add_expr(uint32 *number); |
120 |
|
static bool mul_expr(uint32 *number); |
121 |
|
static bool factor(uint32 *number); |
94 |
– |
static Variable *lookup_var(const char *s); |
95 |
– |
static Variable *insert_var(const char *s); |
96 |
– |
static void remove_var(const char *s); |
122 |
|
|
123 |
|
|
124 |
|
/* |
202 |
|
* Access to buffer |
203 |
|
*/ |
204 |
|
|
205 |
< |
uint32 mon_read_byte(uint32 adr) |
205 |
> |
uint32 (*mon_read_byte)(uint32 adr); |
206 |
> |
|
207 |
> |
uint32 mon_read_byte_buffer(uint32 adr) |
208 |
|
{ |
209 |
< |
if (mon_use_real_mem) |
183 |
< |
return *(uint8 *)adr; |
184 |
< |
else |
185 |
< |
return mem[adr % mon_mem_size]; |
209 |
> |
return mem[adr % mon_mem_size]; |
210 |
|
} |
211 |
|
|
212 |
< |
void mon_write_byte(uint32 adr, uint32 b) |
212 |
> |
uint32 mon_read_byte_real(uint32 adr) |
213 |
|
{ |
214 |
< |
if (mon_use_real_mem) |
215 |
< |
*(uint8 *)adr = b; |
216 |
< |
else |
217 |
< |
mem[adr % mon_mem_size] = b; |
214 |
> |
return *(uint8 *)adr; |
215 |
> |
} |
216 |
> |
|
217 |
> |
void (*mon_write_byte)(uint32 adr, uint32 b); |
218 |
> |
|
219 |
> |
void mon_write_byte_buffer(uint32 adr, uint32 b) |
220 |
> |
{ |
221 |
> |
mem[adr % mon_mem_size] = b; |
222 |
> |
} |
223 |
> |
|
224 |
> |
void mon_write_byte_real(uint32 adr, uint32 b) |
225 |
> |
{ |
226 |
> |
*(uint8 *)adr = b; |
227 |
|
} |
228 |
|
|
229 |
|
uint32 mon_read_half(uint32 adr) |
230 |
|
{ |
231 |
< |
if (mon_use_real_mem) |
199 |
< |
return ntohs(*(uint16 *)adr); |
200 |
< |
else |
201 |
< |
return mem[adr % mon_mem_size] << 8 | mem[(adr+1) % mon_mem_size]; |
231 |
> |
return (mon_read_byte(adr) << 8) | mon_read_byte(adr+1); |
232 |
|
} |
233 |
|
|
234 |
|
void mon_write_half(uint32 adr, uint32 w) |
235 |
|
{ |
236 |
< |
if (mon_use_real_mem) |
237 |
< |
*(uint16 *)adr = htons(w); |
208 |
< |
else { |
209 |
< |
mem[adr % mon_mem_size] = w >> 8; |
210 |
< |
mem[(adr+1) % mon_mem_size] = w; |
211 |
< |
} |
236 |
> |
mon_write_byte(adr, w >> 8); |
237 |
> |
mon_write_byte(adr+1, w); |
238 |
|
} |
239 |
|
|
240 |
|
uint32 mon_read_word(uint32 adr) |
241 |
|
{ |
242 |
< |
if (mon_use_real_mem) |
217 |
< |
return ntohl(*(uint32 *)adr); |
218 |
< |
else |
219 |
< |
return mon_read_byte(adr) << 24 | mon_read_byte(adr+1) << 16 | mon_read_byte(adr+2) << 8 | mon_read_byte(adr+3); |
242 |
> |
return (mon_read_byte(adr) << 24) | (mon_read_byte(adr+1) << 16) | (mon_read_byte(adr+2) << 8) | mon_read_byte(adr+3); |
243 |
|
} |
244 |
|
|
245 |
|
void mon_write_word(uint32 adr, uint32 l) |
246 |
|
{ |
247 |
< |
if (mon_use_real_mem) |
248 |
< |
*(uint32 *)adr = htonl(l); |
249 |
< |
else { |
250 |
< |
mem[adr % mon_mem_size] = l >> 24; |
228 |
< |
mem[(adr+1) % mon_mem_size] = l >> 16; |
229 |
< |
mem[(adr+2) % mon_mem_size] = l >> 8; |
230 |
< |
mem[(adr+3) % mon_mem_size] = l; |
231 |
< |
} |
247 |
> |
mon_write_byte(adr, l >> 24); |
248 |
> |
mon_write_byte(adr+1, l >> 16); |
249 |
> |
mon_write_byte(adr+2, l >> 8); |
250 |
> |
mon_write_byte(adr+3, l); |
251 |
|
} |
252 |
|
|
253 |
|
|
257 |
|
|
258 |
|
static void read_line(char *prompt) |
259 |
|
{ |
260 |
+ |
#ifdef HAVE_LIBREADLINE |
261 |
|
static char *line_read = NULL; |
262 |
|
|
263 |
|
if (line_read) { |
272 |
|
|
273 |
|
strncpy(in_ptr = input, line_read, INPUT_LENGTH); |
274 |
|
input[INPUT_LENGTH-1] = 0; |
275 |
+ |
#else |
276 |
+ |
fprintf(monout, prompt); |
277 |
+ |
fflush(monout); |
278 |
+ |
fgets(in_ptr = input, INPUT_LENGTH, monin); |
279 |
+ |
char *s = strchr(input, '\n'); |
280 |
+ |
if (s != NULL) |
281 |
+ |
*s = 0; |
282 |
+ |
#endif |
283 |
|
} |
284 |
|
|
285 |
|
|
702 |
|
return true; |
703 |
|
|
704 |
|
case T_NAME:{ |
705 |
< |
Variable *var; |
706 |
< |
if ((var = lookup_var(mon_name)) != NULL) { |
707 |
< |
*number = var->value; |
705 |
> |
var_map::const_iterator v = vars.find(mon_name); |
706 |
> |
if (v == vars.end()) |
707 |
> |
return false; |
708 |
> |
else { |
709 |
> |
*number = v->second; |
710 |
|
mon_get_token(); |
711 |
|
return true; |
712 |
< |
} else |
683 |
< |
return false; |
712 |
> |
} |
713 |
|
} |
714 |
|
|
715 |
|
case T_DOT: |
769 |
|
|
770 |
|
|
771 |
|
/* |
743 |
– |
* Lookup the value of a variable |
744 |
– |
*/ |
745 |
– |
|
746 |
– |
static Variable *lookup_var(const char *s) |
747 |
– |
{ |
748 |
– |
// Lookup variable |
749 |
– |
for (Variable *var=first_var; var; var=var->next) |
750 |
– |
if (!strcmp(s, var->name)) |
751 |
– |
return var; |
752 |
– |
|
753 |
– |
// Not found, error |
754 |
– |
mon_error("Undefined variable"); |
755 |
– |
return NULL; |
756 |
– |
} |
757 |
– |
|
758 |
– |
|
759 |
– |
/* |
760 |
– |
* Insert new variable (or redefine old) |
761 |
– |
*/ |
762 |
– |
|
763 |
– |
static Variable *insert_var(const char *s) |
764 |
– |
{ |
765 |
– |
// Lookup variable |
766 |
– |
for (Variable *var=first_var; var; var=var->next) |
767 |
– |
if (!strcmp(s, var->name)) |
768 |
– |
return var; |
769 |
– |
|
770 |
– |
// Insert new variable |
771 |
– |
Variable *var = new Variable; |
772 |
– |
var->name = strdup(s); |
773 |
– |
var->next = first_var; |
774 |
– |
first_var = var; |
775 |
– |
return var; |
776 |
– |
} |
777 |
– |
|
778 |
– |
|
779 |
– |
/* |
780 |
– |
* Remove variable |
781 |
– |
*/ |
782 |
– |
|
783 |
– |
static void remove_var(const char *s) |
784 |
– |
{ |
785 |
– |
Variable *var, *prev = (Variable *)&first_var; |
786 |
– |
|
787 |
– |
// Lookup variable and remove it |
788 |
– |
for (var=prev->next; var; prev=var, var=var->next) |
789 |
– |
if (!strcmp(s, var->name)) { |
790 |
– |
prev->next = var->next; |
791 |
– |
free(var->name); |
792 |
– |
free(var); |
793 |
– |
return; |
794 |
– |
} |
795 |
– |
} |
796 |
– |
|
797 |
– |
|
798 |
– |
/* |
772 |
|
* Set/clear/show variables |
773 |
|
* set [var[=value]] |
774 |
|
*/ |
778 |
|
if (mon_token == T_END) { |
779 |
|
|
780 |
|
// Show all variables |
781 |
< |
if (first_var == NULL) |
781 |
> |
if (vars.empty()) |
782 |
|
fprintf(monout, "No variables defined\n"); |
783 |
< |
else |
784 |
< |
for (Variable *v=first_var; v; v=v->next) |
785 |
< |
fprintf(monout, "%s = %08lx\n", v->name, v->value); |
783 |
> |
else { |
784 |
> |
var_map::const_iterator v = vars.begin(), end = vars.end(); |
785 |
> |
for (v=vars.begin(); v!=end; ++v) |
786 |
> |
fprintf(monout, "%s = %08x\n", v->first.c_str(), v->second); |
787 |
> |
} |
788 |
|
|
789 |
|
} else if (mon_token == T_NAME) { |
790 |
< |
char var_name[256]; |
816 |
< |
strcpy(var_name, mon_name); |
790 |
> |
string var_name = mon_name; |
791 |
|
mon_get_token(); |
792 |
|
if (mon_token == T_ASSIGN) { |
793 |
|
|
800 |
|
mon_error("Too many arguments"); |
801 |
|
return; |
802 |
|
} |
803 |
< |
insert_var(var_name)->value = value; |
803 |
> |
vars[var_name] = value; |
804 |
|
|
805 |
|
} else if (mon_token == T_END) { |
806 |
|
|
807 |
|
// Clear variable |
808 |
< |
remove_var(var_name); |
808 |
> |
vars.erase(var_name); |
809 |
|
|
810 |
|
} else |
811 |
|
mon_error("'=' expected"); |
821 |
|
|
822 |
|
static void clear_vars(void) |
823 |
|
{ |
824 |
< |
Variable *var, *next; |
851 |
< |
for (var=first_var; var; var=next) { |
852 |
< |
free(var->name); |
853 |
< |
next = var->next; |
854 |
< |
free(var); |
855 |
< |
} |
856 |
< |
first_var = NULL; |
824 |
> |
vars.clear(); |
825 |
|
} |
826 |
|
|
827 |
|
|
870 |
|
} |
871 |
|
|
872 |
|
if (mon_token == T_END) { |
873 |
< |
fprintf(monerr, "Buffer size: %08lx bytes\n", mon_mem_size); |
873 |
> |
fprintf(monerr, "Buffer size: %08x bytes\n", mon_mem_size); |
874 |
|
return; |
875 |
|
} |
876 |
|
|
882 |
|
} |
883 |
|
|
884 |
|
if ((mem = (uint8 *)realloc(mem, size)) != NULL) |
885 |
< |
fprintf(monerr, "Buffer size: %08lx bytes\n", mon_mem_size = size); |
885 |
> |
fprintf(monerr, "Buffer size: %08x bytes\n", mon_mem_size = size); |
886 |
|
else |
887 |
|
fprintf(monerr, "Unable to reallocate buffer\n"); |
888 |
|
} |
924 |
|
read_func = mon_read_word; |
925 |
|
write_func = mon_write_word; |
926 |
|
break; |
927 |
+ |
default: |
928 |
+ |
abort(); |
929 |
+ |
break; |
930 |
|
} |
931 |
|
|
932 |
|
while (adr<=end_adr) { |
1003 |
|
num_cmds = 0; |
1004 |
|
cmd_help = NULL; |
1005 |
|
|
1006 |
< |
mon_add_command("??", mon_cmd_list, "?? Show list of commands\n"); |
1007 |
< |
mon_add_command("ver", version, "ver Show version\n"); |
1008 |
< |
mon_add_command("?", print_expr, "? expression Calculate expression\n"); |
1009 |
< |
mon_add_command("@", reallocate, "@ [size] Reallocate buffer\n"); |
1010 |
< |
mon_add_command("i", ascii_dump, "i [start [end]] ASCII memory dump\n"); |
1011 |
< |
mon_add_command("m", memory_dump, "m [start [end]] Hex/ASCII memory dump\n"); |
1012 |
< |
mon_add_command("d", disassemble_ppc, "d [start [end]] Disassemble PowerPC code\n"); |
1013 |
< |
mon_add_command("d65", disassemble_6502, "d65 [start [end]] Disassemble 6502 code\n"); |
1014 |
< |
mon_add_command("d68", disassemble_680x0, "d68 [start [end]] Disassemble 680x0 code\n"); |
1015 |
< |
mon_add_command("d80", disassemble_8080, "d80 [start [end]] Disassemble 8080 code\n"); |
1016 |
< |
mon_add_command("d86", disassemble_80x86, "d86 [start [end]] Disassemble 80x86 code\n"); |
1017 |
< |
mon_add_command(":", modify, ": start string Modify memory\n"); |
1018 |
< |
mon_add_command("f", fill, "f start end string Fill memory\n"); |
1019 |
< |
mon_add_command("y", apply_byte, "y[b|h|w] start end expr Apply expression to memory\n"); |
1006 |
> |
mon_add_command("??", mon_cmd_list, "?? Show list of commands\n"); |
1007 |
> |
mon_add_command("ver", version, "ver Show version\n"); |
1008 |
> |
mon_add_command("?", print_expr, "? expression Calculate expression\n"); |
1009 |
> |
mon_add_command("@", reallocate, "@ [size] Reallocate buffer\n"); |
1010 |
> |
mon_add_command("i", ascii_dump, "i [start [end]] ASCII memory dump\n"); |
1011 |
> |
mon_add_command("m", memory_dump, "m [start [end]] Hex/ASCII memory dump\n"); |
1012 |
> |
mon_add_command("b", binary_dump, "b [start [end]] Binary memory dump\n"); |
1013 |
> |
mon_add_command("d", disassemble_ppc, "d [start [end]] Disassemble PowerPC code\n"); |
1014 |
> |
mon_add_command("d65", disassemble_6502, "d65 [start [end]] Disassemble 6502 code\n"); |
1015 |
> |
mon_add_command("d68", disassemble_680x0, "d68 [start [end]] Disassemble 680x0 code\n"); |
1016 |
> |
mon_add_command("d80", disassemble_z80, "d80 [start [end]] Disassemble Z80 code\n"); |
1017 |
> |
mon_add_command("d86", disassemble_80x86_32, "d86 [start [end]] Disassemble 80x86 (32-bit) code\n"); |
1018 |
> |
mon_add_command("d8086", disassemble_80x86_16, "d8086 [start [end]] Disassemble 80x86 (16-bit) code\n"); |
1019 |
> |
mon_add_command(":", modify, ": start string Modify memory\n"); |
1020 |
> |
mon_add_command("f", fill, "f start end string Fill memory\n"); |
1021 |
> |
mon_add_command("y", apply_byte, "y[b|h|w] start end expr Apply expression to memory\n"); |
1022 |
|
mon_add_command("yb", apply_byte, NULL); |
1023 |
|
mon_add_command("yh", apply_half, NULL); |
1024 |
|
mon_add_command("yw", apply_word, NULL); |
1025 |
< |
mon_add_command("t", transfer, "t start end dest Transfer memory\n"); |
1026 |
< |
mon_add_command("c", compare, "c start end dest Compare memory\n"); |
1027 |
< |
mon_add_command("h", help_or_hunt, "h start end string Search for byte string\n"); |
1028 |
< |
mon_add_command("\\", shell_command, "\\ \"command\" Execute shell command\n"); |
1029 |
< |
mon_add_command("ls", mon_exec, "ls [args] List directory contents\n"); |
1030 |
< |
mon_add_command("rm", mon_exec, "rm [args] Remove file(s)\n"); |
1031 |
< |
mon_add_command("cp", mon_exec, "cp [args] Copy file(s)\n"); |
1032 |
< |
mon_add_command("mv", mon_exec, "mv [args] Move file(s)\n"); |
1033 |
< |
mon_add_command("cd", mon_change_dir, "cd directory Change current directory\n"); |
1034 |
< |
mon_add_command("o", redir_output, "o [\"file\"] Redirect output\n"); |
1035 |
< |
mon_add_command("[", load_data, "[ start \"file\" Load data from file\n"); |
1036 |
< |
mon_add_command("]", save_data, "] start size \"file\" Save data to file\n"); |
1037 |
< |
mon_add_command("set", set_var, "set [var[=value]] Set/clear/show variables\n"); |
1038 |
< |
mon_add_command("cv", clear_vars, "cv Clear all variables\n"); |
1025 |
> |
mon_add_command("t", transfer, "t start end dest Transfer memory\n"); |
1026 |
> |
mon_add_command("c", compare, "c start end dest Compare memory\n"); |
1027 |
> |
mon_add_command("h", help_or_hunt, "h start end string Search for byte string\n"); |
1028 |
> |
mon_add_command("\\", shell_command, "\\ \"command\" Execute shell command\n"); |
1029 |
> |
mon_add_command("ls", mon_exec, "ls [args] List directory contents\n"); |
1030 |
> |
mon_add_command("rm", mon_exec, "rm [args] Remove file(s)\n"); |
1031 |
> |
mon_add_command("cp", mon_exec, "cp [args] Copy file(s)\n"); |
1032 |
> |
mon_add_command("mv", mon_exec, "mv [args] Move file(s)\n"); |
1033 |
> |
mon_add_command("cd", mon_change_dir, "cd directory Change current directory\n"); |
1034 |
> |
mon_add_command("o", redir_output, "o [\"file\"] Redirect output\n"); |
1035 |
> |
mon_add_command("[", load_data, "[ start \"file\" Load data from file\n"); |
1036 |
> |
mon_add_command("]", save_data, "] start size \"file\" Save data to file\n"); |
1037 |
> |
mon_add_command("set", set_var, "set [var[=value]] Set/clear/show variables\n"); |
1038 |
> |
mon_add_command("cv", clear_vars, "cv Clear all variables\n"); |
1039 |
> |
|
1040 |
> |
mon_read_byte = NULL; |
1041 |
> |
mon_write_byte = NULL; |
1042 |
|
} |
1043 |
|
|
1044 |
|
|
1069 |
|
monout = stdout; |
1070 |
|
monerr = stdout; |
1071 |
|
|
1072 |
< |
if (argc) { |
1073 |
< |
// Access real memory if mon was started as "rmon" |
1074 |
< |
char *prgname = argv[0]; |
1075 |
< |
char *lastslash; |
1076 |
< |
if ((lastslash = strrchr(prgname, '/')) != NULL) |
1077 |
< |
prgname = lastslash + 1; |
1078 |
< |
if (strcmp(prgname, "rmon") == 0) |
1072 |
> |
// Make argc/argv point to the actual arguments |
1073 |
> |
const char *prg_name = argv[0]; |
1074 |
> |
if (argc) |
1075 |
> |
argc--; argv++; |
1076 |
> |
|
1077 |
> |
// Parse arguments |
1078 |
> |
mon_macos_mode = false; |
1079 |
> |
mon_use_real_mem = false; |
1080 |
> |
while (argc > 0) { |
1081 |
> |
if (strcmp(argv[0], "-h") == 0 || strcmp(argv[0], "--help") == 0) { |
1082 |
> |
printf("Usage: %s [-m] [-r] [command...]\n", prg_name); |
1083 |
> |
exit(0); |
1084 |
> |
} else if (strcmp(argv[0], "-m") == 0) |
1085 |
> |
mon_macos_mode = true; |
1086 |
> |
else if (strcmp(argv[0], "-r") == 0) |
1087 |
|
mon_use_real_mem = true; |
1088 |
+ |
else |
1089 |
+ |
break; |
1090 |
+ |
argc--; argv++; |
1091 |
+ |
} |
1092 |
+ |
interactive = (argc == 0); |
1093 |
|
|
1094 |
< |
// Make argc/argv point to the actual arguments |
1095 |
< |
argc--; |
1096 |
< |
argv++; |
1097 |
< |
interactive = (argc == 0); |
1094 |
> |
// Set up memory access functions if not supplied by the user |
1095 |
> |
if (mon_read_byte == NULL) { |
1096 |
> |
if (mon_use_real_mem) |
1097 |
> |
mon_read_byte = mon_read_byte_real; |
1098 |
> |
else |
1099 |
> |
mon_read_byte = mon_read_byte_buffer; |
1100 |
> |
} |
1101 |
> |
if (mon_write_byte == NULL) { |
1102 |
> |
if (mon_use_real_mem) |
1103 |
> |
mon_write_byte = mon_write_byte_real; |
1104 |
> |
else |
1105 |
> |
mon_write_byte = mon_write_byte_buffer; |
1106 |
|
} |
1107 |
|
|
1108 |
|
// Allocate buffer |
1112 |
|
|
1113 |
|
// Print banner |
1114 |
|
if (interactive) |
1115 |
< |
fprintf(monerr, "\n *** mon V%d.%d by Christian Bauer ***\n" |
1116 |
< |
" *** Press 'h' for help ***\n\n", MON_VERSION, MON_REVISION); |
1115 |
> |
fprintf(monerr, "\n *** cxmon V" VERSION " by Christian Bauer and Marc Hellwig ***\n" |
1116 |
> |
" *** Press 'h' for help ***\n\n"); |
1117 |
> |
} |
1118 |
> |
|
1119 |
> |
// Clear variables |
1120 |
> |
vars.clear(); |
1121 |
> |
|
1122 |
> |
// In MacOS mode, pull in the lowmem globals as variables |
1123 |
> |
if (mon_macos_mode) { |
1124 |
> |
const lowmem_info *l = lowmem; |
1125 |
> |
while (l->name) { |
1126 |
> |
vars[l->name] = l->addr; |
1127 |
> |
l++; |
1128 |
> |
} |
1129 |
|
} |
1130 |
|
|
1131 |
|
init_abort(); |
1134 |
|
while (!done) { |
1135 |
|
if (interactive) { |
1136 |
|
char prompt[16]; |
1137 |
< |
sprintf(prompt, "[%08lx]-> ", mon_dot_address); |
1137 |
> |
sprintf(prompt, "[%08x]-> ", mon_dot_address); |
1138 |
|
read_line(prompt); |
1139 |
|
} else { |
1140 |
|
if (argc == 0) { |