News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

CPC Basic 3

Started by Dinoneno, 14:45, 14 March 12

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dinoneno

We have a new version of CPC Basic. It's CPC Basic 3: cpcbasic.tk

ervin

Wow! That is a big surprise!

I think ccz80 is absolutely brilliant, so I'm very eager to have a look at this.
(I'm poppichicken on the ccz80 forum).

How long have you been working on this?

steve

#2
I thought it was a new version of basic for the CPC :D , perhaps you could compile your basic so we can put into megaflash or a cartridge or at least load it from disk or cassette.

EgoTrip

This looks interesting, thanks

TFM

Quote from: Dinoneno on 14:45, 14 March 12
We have a new version of CPC Basic. It's CPC Basic 3: cpcbasic.tk

Well eahm... If I go there I get this:

Interactive Cybersecurity Training

Any mirror available?
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

MiguelSky


TFM

TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Dinoneno

Quote from: steve on 15:22, 14 March 12
I thought it was a new version of basic for the CPC :D , perhaps you could compile your basic so we can put into megaflash or a cartridge or at least load it from disk or cassette.


Hello. CPC Basic is an application for Windows, so it's not possible put it in a support for Amstrad CPC as a ROM, cartridge, etc. Only you can put in a DISK, CDT, etc. the result generate by CPC Basic from the program you write with it.

Dinoneno

Quote from: ervin on 15:17, 14 March 12
Wow! That is a big surprise!

I think ccz80 is absolutely brilliant, so I'm very eager to have a look at this.
(I'm poppichicken on the ccz80 forum).

How long have you been working on this?


The main work is from November 2011, but it's a project in my head from many yeas ago. Maybe from 1985, when my parents buy me my Amstrad CPC  ;D ?

Optimus

This is interesting for cross developing purposes. So, you code on windows and then transfer the compiled assembly code to an emulator. I am wondering if there is a wysiwyg window showing the result in windows before seeing it on the real CPC. Even if not it's interesting for people who are not familiar with C and prefer Basic and I am curious to see the speed and size of some test programs compared to my C programs. Several years ago when I was not familiar with C and enjoyed developing in basic, this would be even great for me. Now, I love C more so I am not switching, but might give it a try out of curiosity.

Gryzor

This sounds mighty interesting... any screenshots? Couldn't find any on the site!

ervin

It's really cool actually!
I'll be putting some screenies up shortly.

Gryzor

Thanks, that'll be interesting to see :)

ervin

#13
WARNING! LONG post coming up!

Alrighty! I've been having a good look at CPC Basic 3, and I've gotta say, I'm really liking it!
For more serious stuff, I'll stick with ccz80 (also by the same dev), but for simpler stuff, CPC Basic 3 is FANTASTIC!

It's particularly good for prototyping, and for making magazine/book type-ins run about a bajillion times faster!
Your mileage may vary of course, as it still uses the same firmware routines for PRINT, PLOT, DRAW etc, but the actual program logic will be much, much quicker.

A few things to note:
CPC Basic 3 doesn't handle REAL values the same way that Locomotive Basic does.
This threw me at first, as the vast majority of the language works just like Locomotive.
In fact, I've typed up an old type-in from a book, and at least 95% of the code didn't need to change!

To handle real values, Emilio has developed a number of RSX commands, which allow you to pass in an element from a "table" of real variables. I had no idea how to get this working at first, but once I figured it out, it's actually pretty simple, and rather clever too.

If anyone wants to have a go with CPC Basic 3, and has troubles with REAL variables/values, post here and I'll do my best to help.

The website at cpcbasic.tk serves as the documentation. It needs to be read and understood, if only to learn about the differences from Locomotive. It's not too hard, and once again I'm happy to help with any questions (though I'm still learning as well!)  8)

For these screenshots, I'll be using this block of code:


10 REM Hello World!
20 RANDOMIZE TIME
30 MODE 1
40 FOR i=1 TO 10
50 LOCATE RND MOD 29+1,RND MOD 25+1
60 color=RND MOD 4
70 PAPER color:PEN (color+(RND MOD 3+1)) MOD 4
80 PRINT "Hello World!";
90 NEXT
100 PAPER 0:PEN 1:LOCATE 1,1


You'll notice a few instances of "RND MOD" in the code.
CPC Basic 3 handles RND a bit differently from Locomotive, but it is explained on the website, and is pretty simple to get working the same way.


NOTE that you can simply edit your program in a text file, and compile it using the command line (and therefore avoid the IDE entirely), and for many people that will be the preferred option. But for the more adventurous/nostalgic among us, the IDE is a lot of fun.


Okay, some screenies:


This is what you see when you run cpcbasic.exe.



Along the top of the IDE are some options:

This allows you to set the model of CPC you are targetting.



This allows you to select the output type.



And this allows you to tell the compiler how big the table of REAL values need to be.
There are also handy shortcuts to the Programs and Output folders.



Now for some cool things in the IDE.

You can type CLS to clear the screen.
It's not really a "screen", but a non-editable text window, syntax highlighted with CPC colours.
All typing is done in the white bit under the blue area.

You can click in the blue area, and use the arrow keys to move up/down through the window, to effectively see a history of what you've done.
Very handy for examining your program without having to use the LIST commands as on a real CPC.
Note that the blue section slows down if it gets too long, but can be cleared and sped up again by typing CLS.
You can also use PageUp/PageDown to move more quickly.

You can change the mode!
For example, here is the listing in mode 2 text.



The MODE commands are the same as on a real CPC.

Typing CAT lists the files in your Programs folder.



Typing LOAD"HELLO.BAS" will load that program, and it can be viewed by typing LIST.

Editing and deleting lines is done just like on a real CPC.
For example:
EDIT 80
The line will be made available to edit in the white editing area at the bottom.



Don't forget to SAVE your program periodically.
The saved file will be put into your Programs folder.

Typing RUN will compile the program according to the options you have selected at the top of the IDE.
In this example, it compiles the program, and automatically sends it to the included CPCE emulator.



Hopefully that'll be enough to get people started.
I'm really enjoying CPC Basic 3 so far, and I'm thinking of "updating" some old type-ins that I enjoyed back in the day.


Gryzor

Darn, it looks so cool it makes me want to start doing stuff again :)

MugUK

Now that looks like fun ;-)

Sent from my Galaxy S2 using Tapatalk.
I love poking (and peeking) around files.  I used to write saved-game editors on the Atari ST (and Amiga) using GFA BASIC, so looking forward to having some fun with my 6128 :)

TFM

It's nice that file have date and time, but one could read it betten when data and time would be separated by a blank.
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Dinoneno

Quote from: TFM/FS on 16:46, 19 March 12
It's nice that file have date and time, but one could read it betten when data and time would be separated by a blank.
This problem is fixed in version 3.0.4. Dank der Beobachtung :D .

MugUK

I installed this last night and tried a small listing from 'The Amazing Amstrad Omnibus' that I had bought.  OK, it didn't work due to too many INT(RND ...) statements but it was fun to type in a listing with actual line numbers.

Times have changed - for the better with my eyesight - as it was done on my 40" LCD TV via a wireless keyboard.  Looking forward to having a proper play with this once I get my 6128 :)
I love poking (and peeking) around files.  I used to write saved-game editors on the Atari ST (and Amiga) using GFA BASIC, so looking forward to having some fun with my 6128 :)

Gryzor

BASIC programming to the next level...


Indeed, trying some listings so many years after the proper era, be it in Locomotive BASIC or GFA or what have you, is unique... :)

MiguelSky

I tried Mongui from Amstrad User listings but it hangs. Probably it is due the program creates and uses some RSX.

ervin

Quote from: MugUK on 19:20, 23 March 12
I installed this last night and tried a small listing from 'The Amazing Amstrad Omnibus' that I had bought.  OK, it didn't work due to too many INT(RND ...) statements but it was fun to type in a listing with actual line numbers.

Times have changed - for the better with my eyesight - as it was done on my 40" LCD TV via a wireless keyboard.  Looking forward to having a proper play with this once I get my 6128 :)

Which program did you try?
I'd like to have an attempt.

ervin

Quote from: MiguelSky on 00:11, 24 March 12
I tried Mongui from Amstrad User listings but it hangs. Probably it is due the program creates and uses some RSX.

Which issue of the magazine is Mongui in?

MugUK

Quote from: ervin on 11:15, 24 March 12
Which program did you try?
I'd like to have an attempt.

The Phantom Composer on pages 386 & 387.  The error message generated was:

"Unsupported function in line 100 position 5
Unsupported function in line 120 position 5
Unsupported function in line 130 position 5
Unsupported function in line 140 position 5
Unsupported function in line 160 position 21
Unsupported function in line 220 position 5
Unsupported function in line 240 position 5
Unsupported function in line 290 position 5"

Any occurrence of 'INT(RND ..) was coming up with an error.
I love poking (and peeking) around files.  I used to write saved-game editors on the Atari ST (and Amiga) using GFA BASIC, so looking forward to having some fun with my 6128 :)

MiguelSky

Quote from: MugUK on 13:55, 24 March 12
The Phantom Composer on pages 386 & 387. Any occurrence of 'INT(RND ..) was coming up with an error.
You must to edit the lines with the INT and delete the INT as the compiles assumes they are INT by default. The RND needs fixing too. From the cpcbasic page:
QuoteThe RND function returns a value from 0 to 65535. To obtain a value in the
range  n to m must use the expression RND MOD (m - n + 1) + n. For example, to
obtain a  random value between 7 and 10 would RND MOD 4+7; for a random value
between 1  and 5 would RND MOD 5+1, for a random value between 0 and 20 would
RND MOD 21.

QuoteWhich issue of the magazine is Mongui in?
I don't know :D I used the one at ftp://ftp.nvg.unit.no/pub/cpc/games/typeins/mongui.zip

Powered by SMFPacks Menu Editor Mod