From 10efd998e0aa32e3d5214b35fb48d96e1afdd7df Mon Sep 17 00:00:00 2001 From: cuz Date: Fri, 31 Aug 2007 20:23:37 +0000 Subject: [PATCH] Move code to a subroutine. git-svn-id: svn://svn.cc65.org/cc65/trunk@3804 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/da65/labels.c | 11 +++++++++++ src/da65/labels.h | 3 +++ src/da65/main.c | 6 ++---- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/da65/labels.c b/src/da65/labels.c index ff401e7ae..20f93a98d 100644 --- a/src/da65/labels.c +++ b/src/da65/labels.c @@ -360,6 +360,17 @@ void ForwardLabel (unsigned Offs) +void ForwardLabels (unsigned Size) +/* Define forward labels for the range PC to PC+Size-1 if necessary */ +{ + unsigned I; + for (I = 0; I < Size; ++I) { + ForwardLabel (I); + } +} + + + static void DefOutOfRangeLabel (unsigned long Addr) /* Define one label that is outside code range. */ { diff --git a/src/da65/labels.h b/src/da65/labels.h index 53d46c6c8..0420ac2af 100644 --- a/src/da65/labels.h +++ b/src/da65/labels.h @@ -94,6 +94,9 @@ void ForwardLabel (unsigned Offs); * bytes and is therefore output as "label = * + x". */ +void ForwardLabels (unsigned Size); +/* Define forward labels for the range PC to PC+Size-1 if necessary */ + void DefOutOfRangeLabels (void); /* Output any labels that are out of the loaded code range */ diff --git a/src/da65/main.c b/src/da65/main.c index de77fa730..a43c564d3 100644 --- a/src/da65/main.c +++ b/src/da65/main.c @@ -408,10 +408,8 @@ static void OneOpcode (unsigned RemainingBytes) */ if (D->Size <= RemainingBytes) { /* Output labels within the next insn */ - unsigned I; - for (I = 1; I < D->Size; ++I) { - ForwardLabel (I); - } + ForwardLabels (D->Size); + /* Output the insn */ D->Handler (D); PC += D->Size; break; -- 2.39.2