ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/mon/src/mon.cpp
(Generate patch)

Comparing mon/src/mon.cpp (file contents):
Revision 1.8 by hellwig, 2000-06-10T19:07:36Z vs.
Revision 1.21 by cebix, 2003-09-27T20:30:44Z

# Line 1 | Line 1
1   /*
2 < *  mon.cpp - mon main program
2 > *  mon.cpp - cxmon main program
3   *
4 < *  mon (C) 1997-2000 Christian Bauer, Marc Hellwig
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
# Line 24 | Line 24
24   #include <stdlib.h>
25   #include <signal.h>
26   #include <ctype.h>
27 + #include <string>
28 + #include <map>
29  
30 < #ifdef HAVE_READLINE_READLINE_H
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   #include <readline/readline.h>
37   }
38   #endif
39  
40 < #ifdef HAVE_READLINE_HISTORY_H
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   }
# Line 39 | Line 49 | extern "C" {
49  
50   #include "mon.h"
51   #include "mon_cmd.h"
52 + #include "mon_lowmem.h"
53  
54   #ifndef VERSION
55 < #define VERSION "2"
55 > #define VERSION "3"
56   #endif
57  
58  
# Line 60 | Line 71 | static char *in_ptr;
71   char *mon_args_ptr;
72  
73   // Current address, value of '.' in expressions
74 < uint32 mon_dot_address;
74 > uintptr mon_dot_address;
75  
76   // Current value of ':' in expression
77   static uint32 colon_value;
# Line 68 | Line 79 | static uint32 colon_value;
79  
80   // Scanner variables
81   enum Token mon_token;                   // Last token read
82 < uint32 mon_number;                              // Contains the number if mon_token==T_NUMBER
82 > uintptr mon_number;                             // Contains the number if mon_token==T_NUMBER
83   char mon_string[INPUT_LENGTH];  // Contains the string if mon_token==T_STRING
84   char mon_name[INPUT_LENGTH];    // Contains the variable name if mon_token==T_NAME
85  
# Line 85 | Line 96 | static char *cmd_help;         // Help text for
96  
97  
98   // List of variables
99 < struct Variable {
100 <        Variable *next; // Pointer to next variable (must be first element of struct)
90 <        char *name;             // Variable name
91 <        uint32 value;   // Variable value
92 < };
93 <
94 < static Variable *first_var;     // Pointer to first variable
99 > typedef std::map<std::string, uintptr> var_map;
100 > static var_map vars;
101  
102  
103   // Prototypes
# Line 101 | Line 107 | static void exit_abort(void);
107   static void read_line(char *prompt);            // Scanner
108   static char get_char(void);
109   static void put_back(char c);
110 < static enum Token get_hex_number(uint32 &i);
111 < static enum Token get_dec_number(uint32 &i);
112 < static enum Token get_char_number(uint32 &i);
110 > static enum Token get_hex_number(uintptr &i);
111 > static enum Token get_dec_number(uintptr &i);
112 > static enum Token get_char_number(uintptr &i);
113   static enum Token get_string(char *str);
114 < static enum Token get_hex_or_name(uint32 &i, char *name);
114 > static enum Token get_hex_or_name(uintptr &i, char *name);
115  
116 < static bool eor_expr(uint32 *number);   // Parser
117 < static bool and_expr(uint32 *number);
118 < static bool shift_expr(uint32 *number);
119 < static bool add_expr(uint32 *number);
120 < static bool mul_expr(uint32 *number);
121 < static bool factor(uint32 *number);
116 < static Variable *lookup_var(const char *s);
117 < static Variable *insert_var(const char *s);
118 < static void remove_var(const char *s);
116 > static bool eor_expr(uintptr *number);  // Parser
117 > static bool and_expr(uintptr *number);
118 > static bool shift_expr(uintptr *number);
119 > static bool add_expr(uintptr *number);
120 > static bool mul_expr(uintptr *number);
121 > static bool factor(uintptr *number);
122  
123  
124   /*
# Line 199 | Line 202 | bool mon_aborted(void)
202   *  Access to buffer
203   */
204  
205 < uint32 (*mon_read_byte)(uint32 adr);
205 > uint32 (*mon_read_byte)(uintptr adr);
206  
207 < uint32 mon_read_byte_buffer(uint32 adr)
207 > uint32 mon_read_byte_buffer(uintptr adr)
208   {
209          return mem[adr % mon_mem_size];
210   }
211  
212 < uint32 mon_read_byte_real(uint32 adr)
212 > uint32 mon_read_byte_real(uintptr adr)
213   {
214          return *(uint8 *)adr;
215   }
216  
217 < void (*mon_write_byte)(uint32 adr, uint32 b);
217 > void (*mon_write_byte)(uintptr adr, uint32 b);
218  
219 < void mon_write_byte_buffer(uint32 adr, uint32 b)
219 > void mon_write_byte_buffer(uintptr adr, uint32 b)
220   {
221          mem[adr % mon_mem_size] = b;
222   }
223  
224 < void mon_write_byte_real(uint32 adr, uint32 b)
224 > void mon_write_byte_real(uintptr adr, uint32 b)
225   {
226          *(uint8 *)adr = b;
227   }
228  
229 < uint32 mon_read_half(uint32 adr)
229 > uint32 mon_read_half(uintptr adr)
230   {
231          return (mon_read_byte(adr) << 8) | mon_read_byte(adr+1);
232   }
233  
234 < void mon_write_half(uint32 adr, uint32 w)
234 > void mon_write_half(uintptr adr, uint32 w)
235   {
236          mon_write_byte(adr, w >> 8);
237          mon_write_byte(adr+1, w);
238   }
239  
240 < uint32 mon_read_word(uint32 adr)
240 > uint32 mon_read_word(uintptr adr)
241   {
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)
245 > void mon_write_word(uintptr adr, uint32 l)
246   {
247          mon_write_byte(adr, l >> 24);
248          mon_write_byte(adr+1, l >> 16);
# Line 264 | Line 267 | static void read_line(char *prompt)
267  
268          line_read = readline(prompt);
269  
270 <        if (line_read && *line_read)
268 <                add_history(line_read);
270 >        if (line_read) {
271  
272 <        strncpy(in_ptr = input, line_read, INPUT_LENGTH);
273 <        input[INPUT_LENGTH-1] = 0;
272 >                if (*line_read)
273 >                        add_history(line_read);
274 >
275 >                strncpy(in_ptr = input, line_read, INPUT_LENGTH);
276 >                input[INPUT_LENGTH-1] = 0;
277 >
278 >        } else {
279 >
280 >                // EOF, quit cxmon
281 >                fprintf(monout, "x\n");
282 >                input[0] = 'x';
283 >                input[1] = 0;
284 >                in_ptr = input;
285 >        }
286   #else
287          fprintf(monout, prompt);
288          fflush(monout);
# Line 382 | Line 396 | enum Token mon_get_token(void)
396          }
397   }
398  
399 < static enum Token get_hex_number(uint32 &i)
399 > static enum Token get_hex_number(uintptr &i)
400   {
401          char c = get_char();
402  
# Line 391 | Line 405 | static enum Token get_hex_number(uint32
405                  return T_NULL;
406  
407          do {
408 +                c = tolower(c);
409                  if (c < 'a')
410                          i = (i << 4) + (c - '0');
411                  else
# Line 406 | Line 421 | static enum Token get_hex_number(uint32
421          }
422   }
423  
424 < static enum Token get_dec_number(uint32 &i)
424 > static enum Token get_dec_number(uintptr &i)
425   {
426          char c = get_char();
427  
# Line 427 | Line 442 | static enum Token get_dec_number(uint32
442          }
443   }
444  
445 < static enum Token get_char_number(uint32 &i)
445 > static enum Token get_char_number(uintptr &i)
446   {
447          char c;
448  
# Line 458 | Line 473 | static enum Token get_string(char *str)
473          return T_NULL;
474   }
475  
476 < static enum Token get_hex_or_name(uint32 &i, char *name)
476 > static enum Token get_hex_or_name(uintptr &i, char *name)
477   {
478          char *old_in_ptr = in_ptr;
479          char c;
# Line 486 | Line 501 | static enum Token get_hex_or_name(uint32
501   *  true: OK, false: Error
502   */
503  
504 < bool mon_expression(uint32 *number)
504 > bool mon_expression(uintptr *number)
505   {
506 <        uint32 accu, expr;
506 >        uintptr accu, expr;
507  
508          if (!eor_expr(&accu))
509                  return false;
# Line 514 | Line 529 | bool mon_expression(uint32 *number)
529   *  true: OK, false: Error
530   */
531  
532 < static bool eor_expr(uint32 *number)
532 > static bool eor_expr(uintptr *number)
533   {
534 <        uint32 accu, expr;
534 >        uintptr accu, expr;
535  
536          if (!and_expr(&accu))
537                  return false;
# Line 542 | Line 557 | static bool eor_expr(uint32 *number)
557   *  true: OK, false: Error
558   */
559  
560 < static bool and_expr(uint32 *number)
560 > static bool and_expr(uintptr *number)
561   {
562 <        uint32 accu, expr;
562 >        uintptr accu, expr;
563  
564          if (!shift_expr(&accu))
565                  return false;
# Line 570 | Line 585 | static bool and_expr(uint32 *number)
585   *  true: OK, false: Error
586   */
587  
588 < static bool shift_expr(uint32 *number)
588 > static bool shift_expr(uintptr *number)
589   {
590 <        uint32 accu, expr;
590 >        uintptr accu, expr;
591  
592          if (!add_expr(&accu))
593                  return false;
# Line 605 | Line 620 | static bool shift_expr(uint32 *number)
620   *  true: OK, false: Error
621   */
622  
623 < static bool add_expr(uint32 *number)
623 > static bool add_expr(uintptr *number)
624   {
625 <        uint32 accu, expr;
625 >        uintptr accu, expr;
626  
627          if (!mul_expr(&accu))
628                  return false;
# Line 640 | Line 655 | static bool add_expr(uint32 *number)
655   *  true: OK, false: Error
656   */
657  
658 < static bool mul_expr(uint32 *number)
658 > static bool mul_expr(uintptr *number)
659   {
660 <        uint32 accu, fact;
660 >        uintptr accu, fact;
661  
662          if (!factor(&accu))
663                  return false;
# Line 690 | Line 705 | static bool mul_expr(uint32 *number)
705   *  true: OK, false: Error
706   */
707  
708 < static bool factor(uint32 *number)
708 > static bool factor(uintptr *number)
709   {
710          switch (mon_token) {
711                  case T_NUMBER:
# Line 699 | Line 714 | static bool factor(uint32 *number)
714                          return true;
715  
716                  case T_NAME:{
717 <                        Variable *var;
718 <                        if ((var = lookup_var(mon_name)) != NULL) {
719 <                                *number = var->value;
717 >                        var_map::const_iterator v = vars.find(mon_name);
718 >                        if (v == vars.end())
719 >                                return false;
720 >                        else {
721 >                                *number = v->second;
722                                  mon_get_token();
723                                  return true;
724 <                        } else
708 <                                return false;
724 >                        }
725                  }
726  
727                  case T_DOT:
# Line 765 | Line 781 | static bool factor(uint32 *number)
781  
782  
783   /*
768 *  Lookup the value of a variable
769 */
770
771 static Variable *lookup_var(const char *s)
772 {
773        // Lookup variable
774        for (Variable *var=first_var; var; var=var->next)
775                if (!strcmp(s, var->name))
776                        return var;
777
778        // Not found, error
779        mon_error("Undefined variable");
780        return NULL;
781 }
782
783
784 /*
785 *  Insert new variable (or redefine old)
786 */
787
788 static Variable *insert_var(const char *s)
789 {
790        // Lookup variable
791        for (Variable *var=first_var; var; var=var->next)
792                if (!strcmp(s, var->name))
793                        return var;
794
795        // Insert new variable
796        Variable *var = new Variable;
797        var->name = strdup(s);
798        var->next = first_var;
799        first_var = var;
800        return var;
801 }
802
803
804 /*
805 *  Remove variable
806 */
807
808 static void remove_var(const char *s)
809 {
810        Variable *var, *prev = (Variable *)&first_var;
811
812        // Lookup variable and remove it
813        for (var=prev->next; var; prev=var, var=var->next)
814                if (!strcmp(s, var->name)) {
815                        prev->next = var->next;
816                        free(var->name);
817                        free(var);
818                        return;
819                }
820 }
821
822
823 /*
784   *  Set/clear/show variables
785   *  set [var[=value]]
786   */
# Line 830 | Line 790 | static void set_var(void)
790          if (mon_token == T_END) {
791  
792                  // Show all variables
793 <                if (first_var == NULL)
793 >                if (vars.empty())
794                          fprintf(monout, "No variables defined\n");
795 <                else
796 <                        for (Variable *v=first_var; v; v=v->next)
797 <                                fprintf(monout, "%s = %08x\n", v->name, v->value);
795 >                else {
796 >                        var_map::const_iterator v = vars.begin(), end = vars.end();
797 >                        for (v=vars.begin(); v!=end; ++v)
798 >                                fprintf(monout, "%s = %08x\n", v->first.c_str(), v->second);
799 >                }
800  
801          } else if (mon_token == T_NAME) {
802 <                char var_name[256];
841 <                strcpy(var_name, mon_name);
802 >                std::string var_name = mon_name;
803                  mon_get_token();
804                  if (mon_token == T_ASSIGN) {
805  
806                          // Set variable
807 <                        uint32 value;
807 >                        uintptr value;
808                          mon_get_token();
809                          if (!mon_expression(&value))
810                                  return;
# Line 851 | Line 812 | static void set_var(void)
812                                  mon_error("Too many arguments");
813                                  return;
814                          }
815 <                        insert_var(var_name)->value = value;
815 >                        vars[var_name] = value;
816  
817                  } else if (mon_token == T_END) {
818  
819                          // Clear variable
820 <                        remove_var(var_name);
820 >                        vars.erase(var_name);
821  
822                  } else
823                          mon_error("'=' expected");
# Line 872 | Line 833 | static void set_var(void)
833  
834   static void clear_vars(void)
835   {
836 <        Variable *var, *next;
876 <        for (var=first_var; var; var=next) {
877 <                free(var->name);
878 <                next = var->next;
879 <                free(var);
880 <        }
881 <        first_var = NULL;
836 >        vars.clear();
837   }
838  
839  
# Line 919 | Line 874 | static void mon_cmd_list(void)
874  
875   static void reallocate(void)
876   {
877 <        uint32 size;
877 >        uintptr size;
878  
879          if (mon_use_real_mem) {
880                  fprintf(monerr, "Cannot reallocate buffer in real mode\n");
# Line 952 | Line 907 | static void reallocate(void)
907  
908   static void apply(int size)
909   {
910 <        uint32 adr, end_adr, value;
910 >        uintptr adr, end_adr, value;
911          char c;
912  
913          if (!mon_expression(&adr))
# Line 966 | Line 921 | static void apply(int size)
921                  return;
922          }
923  
924 <        uint32 (*read_func)(uint32 adr);
925 <        void (*write_func)(uint32 adr, uint32 val);
924 >        uint32 (*read_func)(uintptr adr);
925 >        void (*write_func)(uintptr adr, uint32 val);
926          switch (size) {
927                  case 1:
928                          read_func = mon_read_byte;
# Line 1060 | Line 1015 | void mon_init(void)
1015          num_cmds = 0;
1016          cmd_help = NULL;
1017  
1018 <        mon_add_command("??", mon_cmd_list,                     "??                       Show list of commands\n");
1019 <        mon_add_command("ver", version,                         "ver                      Show version\n");
1020 <        mon_add_command("?", print_expr,                        "? expression             Calculate expression\n");
1021 <        mon_add_command("@", reallocate,                        "@ [size]                 Reallocate buffer\n");
1022 <        mon_add_command("i", ascii_dump,                        "i [start [end]]          ASCII memory dump\n");
1023 <        mon_add_command("m", memory_dump,                       "m [start [end]]          Hex/ASCII memory dump\n");
1024 <        mon_add_command("b", binary_dump,                       "b [start [end]]          Binary memory dump\n");
1025 <        mon_add_command("d", disassemble_ppc,           "d [start [end]]          Disassemble PowerPC code\n");
1026 <        mon_add_command("d65", disassemble_6502,        "d65 [start [end]]        Disassemble 6502 code\n");
1027 <        mon_add_command("d68", disassemble_680x0,       "d68 [start [end]]        Disassemble 680x0 code\n");
1028 <        mon_add_command("d80", disassemble_8080,        "d80 [start [end]]        Disassemble 8080 code\n");
1029 <        mon_add_command("d86", disassemble_80x86,       "d86 [start [end]]        Disassemble 80x86 code\n");
1030 <        mon_add_command(":", modify,                            ": start string           Modify memory\n");
1031 <        mon_add_command("f", fill,                                      "f start end string       Fill memory\n");
1032 <        mon_add_command("y", apply_byte,                        "y[b|h|w] start end expr  Apply expression to memory\n");
1018 >        mon_add_command("??", mon_cmd_list,                             "??                       Show list of commands\n");
1019 >        mon_add_command("ver", version,                                 "ver                      Show version\n");
1020 >        mon_add_command("?", print_expr,                                "? expression             Calculate expression\n");
1021 >        mon_add_command("@", reallocate,                                "@ [size]                 Reallocate buffer\n");
1022 >        mon_add_command("i", ascii_dump,                                "i [start [end]]          ASCII memory dump\n");
1023 >        mon_add_command("m", memory_dump,                               "m [start [end]]          Hex/ASCII memory dump\n");
1024 >        mon_add_command("b", binary_dump,                               "b [start [end]]          Binary memory dump\n");
1025 >        mon_add_command("d", disassemble_ppc,                   "d [start [end]]          Disassemble PowerPC code\n");
1026 >        mon_add_command("d65", disassemble_6502,                "d65 [start [end]]        Disassemble 6502 code\n");
1027 >        mon_add_command("d68", disassemble_680x0,               "d68 [start [end]]        Disassemble 680x0 code\n");
1028 >        mon_add_command("d80", disassemble_z80,                 "d80 [start [end]]        Disassemble Z80 code\n");
1029 >        mon_add_command("d86", disassemble_80x86_32,    "d86 [start [end]]        Disassemble 80x86 (32-bit) code\n");
1030 >        mon_add_command("d8086", disassemble_80x86_16,  "d8086 [start [end]]      Disassemble 80x86 (16-bit) code\n");
1031 >        mon_add_command("d8664", disassemble_x86_64,    "d8664 [start [end]]      Disassemble x86-64 code\n");
1032 >        mon_add_command(":", modify,                                    ": start string           Modify memory\n");
1033 >        mon_add_command("f", fill,                                              "f start end string       Fill memory\n");
1034 >        mon_add_command("y", apply_byte,                                "y[b|h|w] start end expr  Apply expression to memory\n");
1035          mon_add_command("yb", apply_byte, NULL);
1036          mon_add_command("yh", apply_half, NULL);
1037          mon_add_command("yw", apply_word, NULL);
1038 <        mon_add_command("t", transfer,                          "t start end dest         Transfer memory\n");
1039 <        mon_add_command("c", compare,                           "c start end dest         Compare memory\n");
1040 <        mon_add_command("h", help_or_hunt,                      "h start end string       Search for byte string\n");
1041 <        mon_add_command("\\", shell_command,            "\\ \"command\"              Execute shell command\n");
1042 <        mon_add_command("ls", mon_exec,                         "ls [args]                List directory contents\n");
1043 <        mon_add_command("rm", mon_exec,                         "rm [args]                Remove file(s)\n");
1044 <        mon_add_command("cp", mon_exec,                         "cp [args]                Copy file(s)\n");
1045 <        mon_add_command("mv", mon_exec,                         "mv [args]                Move file(s)\n");
1046 <        mon_add_command("cd", mon_change_dir,           "cd directory             Change current directory\n");
1047 <        mon_add_command("o", redir_output,                      "o [\"file\"]               Redirect output\n");
1048 <        mon_add_command("[", load_data,                         "[ start \"file\"           Load data from file\n");
1049 <        mon_add_command("]", save_data,                         "] start size \"file\"      Save data to file\n");
1050 <        mon_add_command("set", set_var,                         "set [var[=value]]        Set/clear/show variables\n");
1051 <        mon_add_command("cv", clear_vars,                       "cv                       Clear all variables\n");
1038 >        mon_add_command("t", transfer,                                  "t start end dest         Transfer memory\n");
1039 >        mon_add_command("c", compare,                                   "c start end dest         Compare memory\n");
1040 >        mon_add_command("h", help_or_hunt,                              "h start end string       Search for byte string\n");
1041 >        mon_add_command("\\", shell_command,                    "\\ \"command\"              Execute shell command\n");
1042 >        mon_add_command("ls", mon_exec,                                 "ls [args]                List directory contents\n");
1043 >        mon_add_command("rm", mon_exec,                                 "rm [args]                Remove file(s)\n");
1044 >        mon_add_command("cp", mon_exec,                                 "cp [args]                Copy file(s)\n");
1045 >        mon_add_command("mv", mon_exec,                                 "mv [args]                Move file(s)\n");
1046 >        mon_add_command("cd", mon_change_dir,                   "cd directory             Change current directory\n");
1047 >        mon_add_command("o", redir_output,                              "o [\"file\"]               Redirect output\n");
1048 >        mon_add_command("[", load_data,                                 "[ start \"file\"           Load data from file\n");
1049 >        mon_add_command("]", save_data,                                 "] start size \"file\"      Save data to file\n");
1050 >        mon_add_command("set", set_var,                                 "set [var[=value]]        Set/clear/show variables\n");
1051 >        mon_add_command("cv", clear_vars,                               "cv                       Clear all variables\n");
1052  
1053          mon_read_byte = NULL;
1054          mon_write_byte = NULL;
# Line 1125 | Line 1082 | void mon(int argc, char **argv)
1082          monout = stdout;
1083          monerr = stdout;
1084  
1085 <        if (argc) {
1086 <                // Access real memory if mon was started as "rmon"
1087 <                char *prgname = argv[0];
1088 <                char *lastslash;
1089 <                if ((lastslash = strrchr(prgname, '/')) != NULL)
1090 <                        prgname = lastslash + 1;
1091 <                if (strcmp(prgname, "rmon") == 0)
1085 >        // Make argc/argv point to the actual arguments
1086 >        const char *prg_name = argv[0];
1087 >        if (argc)
1088 >                argc--; argv++;
1089 >
1090 >        // Parse arguments
1091 >        mon_macos_mode = false;
1092 >        mon_use_real_mem = false;
1093 >        while (argc > 0) {
1094 >                if (strcmp(argv[0], "-h") == 0 || strcmp(argv[0], "--help") == 0) {
1095 >                        printf("Usage: %s [-m] [-r] [command...]\n", prg_name);
1096 >                        exit(0);
1097 >                } else if (strcmp(argv[0], "-m") == 0)
1098 >                        mon_macos_mode = true;
1099 >                else if (strcmp(argv[0], "-r") == 0)
1100                          mon_use_real_mem = true;
1101 <
1102 <                // Make argc/argv point to the actual arguments
1103 <                argc--;
1139 <                argv++;
1140 <                interactive = (argc == 0);
1101 >                else
1102 >                        break;
1103 >                argc--; argv++;
1104          }
1105 +        interactive = (argc == 0);
1106  
1107          // Set up memory access functions if not supplied by the user
1108          if (mon_read_byte == NULL) {
# Line 1161 | Line 1125 | void mon(int argc, char **argv)
1125  
1126                  // Print banner
1127                  if (interactive)
1128 <                        fprintf(monerr, "\n *** mon V" VERSION " by Christian Bauer and Marc Hellwig ***\n"
1128 >                        fprintf(monerr, "\n *** cxmon V" VERSION " by Christian Bauer and Marc Hellwig ***\n"
1129                                                          " ***               Press 'h' for help               ***\n\n");
1130          }
1131  
1132 +        // Clear variables
1133 +        vars.clear();
1134 +
1135 +        // In MacOS mode, pull in the lowmem globals as variables
1136 +        if (mon_macos_mode) {
1137 +                const lowmem_info *l = lowmem;
1138 +                while (l->name) {
1139 +                        vars[l->name] = l->addr;
1140 +                        l++;
1141 +                }
1142 +        }
1143 +
1144          init_abort();
1145  
1146          // Read and parse command line
1147          while (!done) {
1148                  if (interactive) {
1149                          char prompt[16];
1150 <                        sprintf(prompt, "[%08x]-> ", mon_dot_address);
1150 >                        sprintf(prompt, "[%0*lx]-> ", 2 * sizeof(mon_dot_address), mon_dot_address);
1151                          read_line(prompt);
1152                  } else {
1153                          if (argc == 0) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines