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.

Morri

The circle routine uses REAL numbers so before you "RUN" the program to the emulator, make sure that you change the "real numbers" box to 4.
This will ensure the program runs correctly. I have checked and got it to work using this method.
Keeping it Kiwi since 1977

rk last

Quote from: AMSDOS on 01:22, 27 July 16
So is the program returning to basic or just producing some weird syntax error loop?

If it's looping then perhaps it needs an end command at the exit point of the program to tell cpcbasic to return to basic?

The program switches to mode 2 and then presents the error message.
maRK

rk last

Quote from: ervin on 02:06, 27 July 16

My apologies if this is a silly question, but are you compiling the program before RUNning it?

Ive loaded the program, then type RUN, the emulator opens with the CALL command displayed.  Pressing RETURN runs the code in mode 2 and then error message appears. 
maRK

rk last

CPC TYPE: 6128
OUTPUT: Run in Emulator
REAL NUMBERS: 4
PROGRAM: Circle

I type in RUN and the emulator appears with the CALL command.  After pressing RETURN nothing happens now?
maRK

ervin

#79
Hmmm, that's really strange that you're not able to run it.

Technically, Real Numbers should be set to 6, as there are 6 real values in the program, with indexes from 1 to 5.
I'm not having any troubles running the program.

Are you able to upload a screenshot of your CPC BASIC 3 editor window, with the code to circle.bas listed?

rk last

First of all, may I thank you guys  for the help and support.  Secondly, things got worse after trying your suggestions where I could no longer list the code.  Also, the browser window that lists the basic programs remains fixed over the CPCBASIC window after selecting my choice.

So I deleted the BASIC folder and unzipped it again.  Same issues returned so in the end I restored my pc to an earlier date and have just unzipped the folder again.  I`m using Windows 10.  Upon clicking on the CPCBASIC icon, Windows warns me about an unknown program.  I clicked ignore and open.  Now when I pick the circle program Windows asks me what to open it with.  I am correct in browsing for the CPCBASIC icon?  I ask because Ive gone no further than this and wont until Ive passed this by you guys.

Thanks again.
maRK

rk last

[attachimg=1]
[attachimg=2]
[attachimg=3]
[attachimg=4]

maRK

Morri

Here are the steps I used.

       
  • open CPCBASIC 3
  • type load"circle.bas" into bottom window.
  • type list to ensure program loaded
  • change real numbers to 6 (thanks @ervin )
  • ensure output box says "Run in emulator"
  • type RUN into bottom window
  • After emulator loads press enter
My guess is you're forgetting step 2 as opening by clicking on the circle.bas from explorer won't work, it must be from in CPC BASIC 3.
Just remember that the bottom white box is where all the editing is done. The part that looks like an original CPC screen is only for reviewing. The cool part is once a program is listed you can click in that area and scroll right up through the listing. However if you want to edit anything, you have to go back to the white box at the bottom and type edit 100 etc... It's a bit different to start with and get your head around but once you get used to it i find it excellent to use.
Keeping it Kiwi since 1977

rk last

You were correct.  I was missing out step 2  :doh:

Thank you Morri and apologies for taking up your time.
maRK

Morri

No worries, here to help. Just as a side, have a look at a game I made using CPC BASIC 3 to see it's capabilities.
Let's GO!
It was made using a combination of CPC BASIC 3 and an old sprite driver made by Sean McManus called Easy Sprite driver.
The speed difference is amazing once the program is compiled so CPC BASIC 3 is worth learning if you are not assembly savvy (like myself).
Keeping it Kiwi since 1977

rk last

Thats a cool demonstration of what basic 3 can achieve.  I also liked the robocod theme - reminded me of my amiga days :)  Im defintely going to have a stab at producing a game using the new basic.

Back in the day I managed two loco basic games.  A mode 1 submarine game with detailed redefined text graphics - bubbles, shells, fish, ships etc. And a mode 0 platformer that i coded after playing the cassette 50 game - fantasy land.

Hey!  You ended up getting a review @ CPC Game reviews by the mysterious Missas :)  Whenever I tried to review a new game there, Nicholas would always tell me that I had been beaten to the review...grrrr.  I reviewed games there under the name: Pug.
maRK

ervin

#86
@rk last Excellent! That's great that you got it working.

One thing to remember about CPC BASIC 3 (and also ccz80 which CPC BASIC 3 code gets converted into during compilation), is that it can't handle signed numbers. i.e. handling negative numbers can be a tricky business.

The RSX commands implemented by Dinoneno (like |REAL etc.) may handle negative numbers, but normal CPC BASIC 3 variables can't.
Please check out my forum post from a few years ago; it contains some tips on getting started with CPC BASIC 3.
CPC Basic 3

@Morri - am I correct?
Did you have to have workarounds for negative numbers in your game?
Or am I totally wrong?

Morri

Quote from: ervin on 01:46, 28 July 16
@Morri - am I correct?
Did you have to have workarounds for negative numbers in your game?
Or am I totally wrong?
No, from memory, I just didn't use negative numbers. I think "x=x-1" etc was OK and I might have even had STEP -1 (would have to check my source) but as long as the result wasn't a negative CPC BASIC was OK.
I managed to avoid using those RSX extensions in CPC BASIC and only used integers as well.
Keeping it Kiwi since 1977

genesis8

Just  sure, Dinoneo is simply Emlio Guerrero ?
____________
Amstrad news site at Genesis8 Amstrad Page

cpcuser

#89
Circleplot with ccz80++ and Integer-Table.




include Indirections6128.ccz80++
include Text.ccz80++
include Keyboard.ccz80++
include Graphics.ccz80++

class Test
{
 
  static int tg_curx, tg_cury, sign, theta,grad;
   static int wert,deltax,deltay,length,x,y,xp,yp;
   
  static short winkel[] = {
         0   ,  2  ,   4  ,   7  ,   9,
         11  ,  13  ,  16  ,  18  ,  20,
         22  ,  24  ,  27  ,  29  ,  31,
         33  ,  35  ,  37  ,  40  ,  42,
         44  ,  46  , 48   , 50   , 52,
         54  ,  56   , 58  ,  60   , 62,
         64  ,  66  ,  68  ,  70   , 72,
         73  ,  75  ,  77  ,  79  ,  81,
         82  ,  84  ,  86  ,  87  ,  89,
         91  ,  92  ,  94  ,  95  ,  97,
         98  ,  99  ,  101 ,  102 ,  104,
         105  , 106 ,  107  , 109  , 110,
         111  , 112 ,  113  , 114  , 115,
         116 ,  117 ,  118  , 119  , 119,
         120  , 121 ,  122  , 122  , 123,
         124  , 124 ,  125  , 125  , 126,
         126 ,  126 ,  127  , 127 ,  127,
         128 ,  128 ,  128  , 128 ,  128,
         128 };
         
  static void main()   
  {   
      short a;
     
      Graphics.GraphicsMode(1);
      Graphics.Clg();
     
     while(1)
      {
         a=Keyboard.Inkey();     
         
         if(a=='d')
         { 
           Text.Locate(15,12);
          Text.PrintString("ein Kreis...");   
           
           for (grad = 0; grad <= 360; ++grad)
          {
               x=320;
               y=200;
               length=190;     
               wink_plot();                 
          }   
       }     
    }   
  }


  static void tg_isin()
  {
     sign=1;
      theta=grad;
     
     if(theta>180)
     {
       theta=360-theta;
       sign=-1;
     }
     
      if(theta>90)
      {
         theta=180-theta;
      }
      wert=sign*winkel[theta];
   }
   
   static void tg_icos()
  {
     sign=1;
      theta=grad;
     
      if(theta>180)
      {
        theta=360-theta;
      } 
     
      if(theta>90)
      {
         theta=180-theta;
         sign=-1;
      }
      wert=sign*winkel[90-theta];
   }
   
   static void wink_plot()
   {     
      tg_curx=x << 7;
      tg_cury=y << 7;
     
      tg_isin();
      deltay=length*wert;
      tg_icos();
      deltax=length*wert;
   
      tg_curx=tg_curx+deltax;
      tg_cury=tg_cury-deltay;
   
      xp=tg_curx >> 7;
      yp=tg_cury >> 7;
     
      Graphics.Plot(xp,yp);
   }
}



Greeting

AMSDOS

Quote from: cpcuser on 10:35, 26 December 16
Circleplot with ccz80++ and Integer-Table.



10 ccz80=0:cpcbasic3=1
20 while ccz80<>cpcbasic3
30   print"Try Again?"
40 wend
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Powered by SMFPacks Menu Editor Mod