Add set command to debugger
diff --git a/dbg.c b/dbg.c
index fe1355d..2de4eb6 100644
--- a/dbg.c
+++ b/dbg.c
@@ -48,6 +48,47 @@
#undef R
}
}
+ else if (!strcmp(tok, "set"))
+ {
+ char reg_name[32];
+ uint16_t addr;
+ uint8_t val;
+
+ tok = strtok(NULL, "\0");
+
+ printf("%s\n", tok);
+
+ if (sscanf(tok, "$%hx #$%hhx", &addr, &val))
+ {
+ cpu->mem[addr] = val;
+ }
+ else if (sscanf(tok, "%s #$%hhx", reg_name, &val))
+ {
+ int reg = -1;
+ if (!strcasecmp(tok, "A"))
+ reg = A;
+ else if (!strcasecmp(tok, "X"))
+ reg = X;
+ else if (!strcasecmp(tok, "Y"))
+ reg = Y;
+ else if (!strcasecmp(tok, "SP"))
+ reg = SP;
+ else if (!strcasecmp(tok, "PC"))
+ cpu->pc = val;
+ else if (!strcasecmp(tok, "SR"))
+ *(uint8_t *)&cpu->status = val;
+
+ if (reg != -1)
+ {
+ cpu->regs[reg] = val;
+ }
+ }
+ else
+ {
+ printf("set command expects either a memory address and a constant, "
+ "or a register and a constant as arguments.\n");
+ }
+ }
else if (!strcmp(tok, "run"))
{
*running = true;
diff --git a/docs/templates/page.html b/docs/templates/page.html
index a9c6219..71c5aa8 100644
--- a/docs/templates/page.html
+++ b/docs/templates/page.html
@@ -17,6 +17,9 @@
<ul>
<li><a href="https://github.com/swissChili/6502">Git</a></li>
+ <li><a href="https://builds.sr.ht/~swisschili/6502">
+ <img src="https://builds.sr.ht/~swisschili/6502.svg"></a>
+ </li>
<li><a href="/usage.html">Basic usage</a></li>
<li><a href="/examples.html">Example programs</a></li>
<li><a href="/building.html">Building from source</a></li>