aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2016-04-18 12:14:21 +0100
committerIan C <ianc@noddybox.co.uk>2016-04-18 12:14:21 +0100
commit5dfc8ddb515c17b7c61a6e56d3ce3c57f6da2622 (patch)
tree8670d146ac6c2c4ebdfce7c41857f9a5ed0b16b6 /src
parenta8131ea5ed00c11517c2cb605834eb103ecac250 (diff)
Fixed problem with zero page detection.
Zero page detection wasn't aggressive enough; by only doing the test on the last past, labels weren't being updated till the final pass.
Diffstat (limited to 'src')
-rw-r--r--src/6502.c10
-rw-r--r--src/example/vcs.asm4
-rw-r--r--src/state.c7
-rw-r--r--src/state.h5
4 files changed, 16 insertions, 10 deletions
diff --git a/src/6502.c b/src/6502.c
index a6b377e..50ae07c 100644
--- a/src/6502.c
+++ b/src/6502.c
@@ -145,7 +145,7 @@ do \
break; \
\
case ZP_AUTO: \
- if (IsFinalPass() && *address >= 0 && *address <= 255) \
+ if (*address >= 0 && *address <= 255) \
{ \
*mode = ZP_mode; \
} \
@@ -834,6 +834,7 @@ static CommandStatus JMP(const char *label, int argc, char *argv[],
switch(mode)
{
case ABSOLUTE:
+ case ZERO_PAGE:
PCWrite(0x4c);
PCWriteWord(address);
return CMD_OK;
@@ -861,6 +862,7 @@ static CommandStatus JSR(const char *label, int argc, char *argv[],
switch(mode)
{
case ABSOLUTE:
+ case ZERO_PAGE:
PCWrite(0x20);
PCWriteWord(address);
return CMD_OK;
@@ -1493,6 +1495,7 @@ static const HandlerTable handler_table[] =
void Init_6502(void)
{
option.zp_mode = ZP_AUTO;
+ SetNeededPasses(3);
}
@@ -1513,11 +1516,6 @@ CommandStatus SetOption_6502(int opt, int argc, char *argv[],
CMD_TABLE(argv[0], zp_table, val);
option.zp_mode = val->value;
-
- if (option.zp_mode == ZP_AUTO)
- {
- SetNeededPasses(3);
- }
break;
default:
diff --git a/src/example/vcs.asm b/src/example/vcs.asm
index 379722c..fcc0481 100644
--- a/src/example/vcs.asm
+++ b/src/example/vcs.asm
@@ -15,10 +15,6 @@
option output-file,vcs.bin
- option +list
- option +list-hex
- option +list-pc
-
VSYNC equ $00
VBLANK equ $01
WSYNC equ $02
diff --git a/src/state.c b/src/state.c
index 27225e5..83eea97 100644
--- a/src/state.c
+++ b/src/state.c
@@ -23,6 +23,7 @@
*/
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
#include "global.h"
@@ -174,6 +175,12 @@ void SetNeededPasses(int n)
}
+int GetCurrentPass(void)
+{
+ return pass;
+}
+
+
void SetAddressBank(unsigned b)
{
currbank = b;
diff --git a/src/state.h b/src/state.h
index 247124f..2f4d856 100644
--- a/src/state.h
+++ b/src/state.h
@@ -87,6 +87,11 @@ int IsIntermediatePass(void);
void SetNeededPasses(int n);
+/* Get current pass. Just used for debug.
+*/
+int GetCurrentPass(void);
+
+
/* Set the current PC
*/
void SetPC(int i);