Talk:CPC Basic

From CPCWiki - THE Amstrad CPC encyclopedia!
Jump to: navigation, search

Lets give this Compiler a Go!

In my mind compilers / programming languages are only made for one reason - to make programs from them.

Just seems to be such a waste to see so many of them out there which seem to have "No Programs" which were generated using that program. I hate to say it but this looks like another, but someone has gone to the trouble of making something which would allow people to make something, and it looks interersting.

Unfortunately I'm having trouble with this one though - here's the program I'm trying to compile.

DEFBYTE n

DIM w(5)

RESTORE myinf

FOR n = 1 to 5

READ w$(n)

PRINT w$(n)

next

end

myinf DATA "Hello"

But it's giving me this n is not defined rubbish following my FOR statement! :o I've defined "n" as a byte on the first line, so I'm so confused about what this program wants! I've gone to so much trouble and done a million things just to have it say "hello" and it's not working out! :(

I've gone over their manual and have used Google Languages to Translate their Guide, and while I thought I was getting somewhere, this is a Brick Wall. Naturally it's been so long since I've done this and that wouldn't normally be doing it that way, though it was also unhappy about:

DEFSTR n

name="Hello"

PRINT name

which comes from the horses mouth! :o

Would certainally love some of their examples!

--CPM User 10:39, 25 July 2010 (UTC)

Linking the Library to your program

Okay apparently it's important to CHAIN "CPCBasic.BAS" at the top of your program. After that it appears to work quite well. Take note you need to download the Libraries separately, keep it all in the same Directory helps (that includes the indended Source File). Looks like they also have Sprites Alive Programs Covered too! :o

With the Library file in play, Locomotive BASIC programs will be more compliant, though there are differences between this and the Real thing, Assembly Files generated are quite large though!

--CPM User 11:02, 25 July 2010 (UTC)