From a19478a8161b92e7026c76a8e8a0baab2d60c85c Mon Sep 17 00:00:00 2001 From: Piotr Wiszowaty Date: Sat, 20 Sep 2014 22:18:22 +0200 Subject: [PATCH] Handle ASCII strings --- README.md | 2 +- foco65 | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 38ae820..d1b2a03 100644 --- a/README.md +++ b/README.md @@ -149,7 +149,7 @@ Allocate Atari XL/XE Antic string: `'` _text_`'` -Allocate counted ASCII string: +Allocate ASCII string: `"` _text_`"` diff --git a/foco65 b/foco65 index 418009f..cda679e 100755 --- a/foco65 +++ b/foco65 @@ -563,15 +563,19 @@ class Forth: item = Code("\n dta %d" % self.pop(token), self.data_section) self.items.append(item) - def parse_comma_doublequote(self): - # allocate ASCII counted string + def parse_comma_doublequote(self, counted): + # allocate ASCII string self.input.mark_start() while True: token = self.next() if token.endswith('"'): self.input.mark_end() text = self.input.marked()[1:-1] - item = Code("\n dta %d,c'%s'" % (len(text), text), self.data_section) + if counted: + count = "%d," % len(text) + else: + count = "" + item = Code("\n dta %sc'%s'" % (count, text), self.data_section) self.items.append(item) break