Change SP to
diff --git a/README.md b/README.md
index 3f34714..2849e4a 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,6 @@
# 6502 Toolchain
-<center>
[![Screenshot](screenshot.png)](colors.webm)
-</center>
This project aims to create a portable toolchain for developing,
testing and debugging programs for the 6502 processor. An assembler
diff --git a/cpu.c b/cpu.c
index f58d181..9d85261 100644
--- a/cpu.c
+++ b/cpu.c
@@ -22,7 +22,7 @@
void reset(cpu_t *cpu)
{
- cpu->regs[SP] = 0xFD; // stack at is 0x100 + SP
+ cpu->regs[SP] = 0xFF; // stack at is 0x100 + SP
cpu->pc = 0x600; // arbitrary program counter start
cpu->running = true;
memset(cpu->mem + 0x100, 0, 0xFE);
@@ -31,7 +31,7 @@
cpu_t new_cpu()
{
cpu_t cpu = { 0 };
- cpu.regs[SP] = 0xFD; // stack at is 0x100 + SP
+ cpu.regs[SP] = 0xFF; // stack at is 0x100 + SP
cpu.pc = 0x600; // arbitrary program counter start
cpu.running = true;
cpu.mem = malloc(0xFFFF);
@@ -396,6 +396,7 @@
case JSR:
stack_pushle(cpu, cpu->pc);
+ cpu->pc = a.ptr;
break;
case RTS:
diff --git a/gui.c b/gui.c
index f9cd310..2b5799a 100644
--- a/gui.c
+++ b/gui.c
@@ -163,7 +163,7 @@
NK_WINDOW_MINIMIZABLE|NK_WINDOW_TITLE))
{
nk_layout_row_static(ctx, 24, 48, 2);
- for (int i = 0xFD; i >= 0; i--)
+ for (int i = 0xFF; i >= 0; i--)
{
char line[6];
sprintf(line, "$%x", 0x100 + i);