RetroRetrospective – Fun today with yesterday’s gear……..

September 21st, 2016

RetroChallenge 2016/10 – Applesoft Enhanced

Apple2, Programming, RetroChallange, by Michael.

Way back in the day on of my favourite programming tools was Nibble BASIC from the Nibble Magazine.  It allowed you to write Applesoft programs without line numbers, and added additional commands such as If/ElseIf/Else, and Loop/EndLoop, as well as Goto and Gosub labels rather than using line numbers.

I added extra commands such as Repeat/Until and While/EndWhile, and “Turtle” like graphic commands.

In a previous RetroChallenge I was going to re-write Nibble BASIC in itself, but my project this time is to write an external “compiler” to take an enhanced Applesoft like script and convert it to run on an Apple][.

My target script is a version of the traditional “Hello World” program below:

# RetroChallenge 2016/10
# Hello World Program

my String$  = "Hello World"
my Counter% = 10
my Count%   = 1
my Co%      = 2
my Characters_Per_Line = 40


for i = 1 to Counter%
   Co% = centre_text(Characters_Per_line,String$)

Print "String$ [";String$;”]”
PRINT "Counter%>";Counter%
?     "Count%  >";Count%
print "Co%     >";Co%

sub centre_text
   my line_size = shift
   my text$     = shift
   my start_character = int(len(text$)/2))
   htab start_character : print text$

So, in a nutshell, declared variables with full name support, not just up to the first two characters, called subroutines passing and returning  values (no recursion support) , and case insensitive commands.

If time permits, I’ll add additional Applesoft commands to the parser.

Back Top

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.