more info for ;info

This commit is contained in:
Kelvin Sherlock 2013-08-21 22:40:53 -04:00
parent caac09787a
commit c7acd1d8e1
3 changed files with 48 additions and 1 deletions

View File

@ -57,6 +57,7 @@
#include <mpw/mpw.h>
#include <toolbox/loader.h>
#include <toolbox/mm.h>
namespace {
@ -840,6 +841,50 @@ void VariableSet(const std::string &key, uint32_t value)
SymbolTable.emplace(key, value);
}
void Info(uint32_t address)
{
// print info on the value.
Print(address);
// 1. as a pointer.
MM::Native::MemoryInfo(address);
// 2. (todo) - check SymbolTable for procedure address.
// 2. as a tool trap.
if (address >= 0xa000 && address <= 0xafff)
{
const char *cp = TrapName(address);
if (cp)
printf("Tool: %s\n", cp);
}
// 3. as a global
if (address <= 0xffff)
{
const char *cp = GlobalName(address);
if (cp)
printf("Global: %s\n", cp);
}
#if 0
// 4 as an error
// almost all are negative 16-bit values,
// but may also be a positive 16-bit value.
uint16_t error = 0;
if (address <= 0xffff) error = address;
if ((address & 0xffff8000) == 0xffff8000) error = address;
if (error)
{
const char *cp = ErrorName(error);
if (cp)
printf("Error: %s\n", cp);
}
#endif
}
namespace {
/*

View File

@ -108,6 +108,8 @@ uint8_t ReadByte(uint32_t);
void Print(uint32_t value);
void PrintRegisters();
void Info(uint32_t address);
void Dump(uint32_t address, int count = 256);
void List(uint32_t address, int count = 20);
void List(uint32_t pc, uint32_t endpc);

View File

@ -176,7 +176,7 @@ stmt ::= expr(a) AT expr(b) SEMI SEMIH EOL.
stmt ::= expr(a) SEMI SEMII EOL.
{
MM::Native::MemoryInfo(a.intValue);
Debug::Info(a.intValue);
}