Drawing a circle in BBC BASIC

discussion of beeb/electron applications, languages, utils and educational s/w
Post Reply
LordVaderUK
Posts: 22
Joined: Thu Jan 31, 2019 12:26 am
Contact:

Drawing a circle in BBC BASIC

Post by LordVaderUK » Sat Mar 09, 2019 2:14 pm

I'm trying to get back into really simple programming using my BBC B+ and BBC BASIC, just to teach myself what I have forgotten from 30+ years ago... :?

To do this, I've written a really simple Hangman program (see attached screenshot, yes I know it's crude but it's early days!!). Can you guess the word, by the way...?
HM Screenshot.png
This all works fine on the SDLIDE editor/emulator but crashes out on BeebEm (emulating a BBC B) because the CIRCLE command (used to draw his head) isn't part of the original BBC BASIC.

So my question is how on earth does one draw a circle using MOVE, DRAW, PLOT commands (and others I assume). I would appreciate a nudge in the right direction from someone who knows more than me - which is pretty much anyone at this point...!

alex_farlie
Posts: 132
Joined: Sun Jul 07, 2013 9:46 pm
Contact:

Re: Drawing a circle in BBC BASIC

Post by alex_farlie » Sat Mar 09, 2019 2:30 pm

LordVaderUK wrote:
Sat Mar 09, 2019 2:14 pm
I'm trying to get back into really simple programming using my BBC B+ and BBC BASIC, just to teach myself what I have forgotten from 30+ years ago... :?

To do this, I've written a really simple Hangman program (see attached screenshot, yes I know it's crude but it's early days!!). Can you guess the word, by the way...?

HM Screenshot.png

This all works fine on the SDLIDE editor/emulator but crashes out on BeebEm (emulating a BBC B) because the CIRCLE command (used to draw his head) isn't part of the original BBC BASIC.

So my question is how on earth does one draw a circle using MOVE, DRAW, PLOT commands (and others I assume). I would appreciate a nudge in the right direction from someone who knows more than me - which is pretty much anyone at this point...!
Do you recall anything about trig functions, or polar co-ordinates?
See https://en.wikipedia.org/wiki/Midpoint_circle_algorithm and http://members.chello.at/%7Eeasyfilter/Bresenham.pdf although others here can probably suggest other optimisations? ( How did the GXR rom do it?)
Last edited by alex_farlie on Sat Mar 09, 2019 2:43 pm, edited 2 times in total.

User avatar
lurkio
Posts: 1930
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Drawing a circle in BBC BASIC

Post by lurkio » Sat Mar 09, 2019 3:33 pm

LordVaderUK wrote:
Sat Mar 09, 2019 2:14 pm
So my question is how on earth does one draw a circle using MOVE, DRAW, PLOT commands (and others I assume). I would appreciate a nudge in the right direction from someone who knows more than me - which is pretty much anyone at this point...!
Searching the forum for the words "draw" and "circle", I found this post by JGH, who has a library of useful functions in un-useful formats.

By loading his Circle file into BBC BASIC For Windows and then copying and pasting the text of the PROCedure, I've ended up with the following code, which seems to work in BeebEm in Model B mode:

[Code deleted. See later post for updated version of code.]

Try it in JSBeeb:
:idea:
Last edited by lurkio on Sun Mar 10, 2019 11:05 am, edited 4 times in total.

User avatar
sbadger
Posts: 373
Joined: Mon Mar 25, 2013 1:12 pm
Location: Farnham, Surrey
Contact:

Re: Drawing a circle in BBC BASIC

Post by sbadger » Sat Mar 09, 2019 4:18 pm

I remember a thread on Minsky cirlces, in BASIC, very quick and close enough.

RTW did an example:-
viewtopic.php?f=1&t=13576&hilit=Minsky+circle#p178292
Last edited by sbadger on Sat Mar 09, 2019 4:18 pm, edited 1 time in total.
So many projects, so little time...

User avatar
jgharston
Posts: 3454
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: Drawing a circle in BBC BASIC

Post by jgharston » Sat Mar 09, 2019 8:02 pm

lurkio wrote:
Sat Mar 09, 2019 3:33 pm

Code: Select all

3000 REM > BLib.Graphic.Circle 1.00 15Apr1985
That looked really odd, and running it in BBfW had loads of artifacts which I never remember happening, and checking the link it is, the correct link is BLib/Graphics/Circle The above code was hacked out of a menu program that just drew filled semicircles where the glitches were invisible due to the happenstance of what was being drawn. I've corrected the link in the linked-to post. I'm not sure how two copies managed to get online.

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

User avatar
BigEd
Posts: 2400
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Drawing a circle in BBC BASIC

Post by BigEd » Sat Mar 09, 2019 9:15 pm

This looked very odd to me:
step=(2*PI/90)+50
because I can't think how 50 radians should come into play.

I'd be interested to see the new version in text form. I'd wonder if it would 'better' to divide the circle into 32 and draw 8 lines (or triangles) at a line by taking advantage of symmetry. Maybe not in Basic, as we're not doing lots of trig calls so saving a few multiplies won't make up for extra interpretation overhead.

(And why does it use DRAW and then PLOT 69? Is that obvious??)

User avatar
lurkio
Posts: 1930
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Drawing a circle in BBC BASIC

Post by lurkio » Sat Mar 09, 2019 10:32 pm

BigEd wrote:
Sat Mar 09, 2019 9:15 pm
This looked very odd to me: step=(2*PI/90)+50
because I can't think how 50 radians should come into play. I'd be interested to see the new version in text form.
[Code deleted. See later post for updated version of code.]

:idea:
Last edited by lurkio on Sun Mar 10, 2019 11:05 am, edited 1 time in total.

User avatar
BigEd
Posts: 2400
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Drawing a circle in BBC BASIC

Post by BigEd » Sat Mar 09, 2019 10:44 pm

So, indeed, the more expected

Code: Select all

120 step=2*PI/31
works about as well, because of a coincidence of how close 50 is to 16 times pi.

Changing both the '31' to '32' results in a slightly more circular circle, perhaps not just because 32 is a larger number, perhaps because the pixels line up more evenly.

Code: Select all

120 step=2*PI/32
170 FOR s%=1 TO 32         :REM We'll do 32 segments
Last edited by BigEd on Sat Mar 09, 2019 10:45 pm, edited 1 time in total.

User avatar
jgharston
Posts: 3454
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: Drawing a circle in BBC BASIC

Post by jgharston » Sat Mar 09, 2019 11:06 pm

BigEd wrote:
Sat Mar 09, 2019 10:44 pm

Code: Select all

120 step=2*PI/32
170 FOR s%=1 TO 32         :REM We'll do 32 segments
That actually does 33 segments, with the last segment overlapping the first segment, because the code does the last segment outside the loop to draw to the initial start position instead of assuming that the multiple recalculations have converged back to the start position.

The original code did all the SINs and COSs within the loop, I rewrote it to calculate s, c and step once outside the loop.
I don't know where the (2*PI/90)+50 came from, it was originally typed in from a book or magazine by somebody else in 1984-ish to draw our network menu logo. 2*PI/32 makes sense.

Image

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

User avatar
BigEd
Posts: 2400
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Drawing a circle in BBC BASIC

Post by BigEd » Sun Mar 10, 2019 7:20 am

Ah, thanks, that explains the 31 instead of 32!

User avatar
lurkio
Posts: 1930
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Drawing a circle in BBC BASIC

Post by lurkio » Sun Mar 10, 2019 11:03 am

I gather that this is the final, correct version of the PROCedure, then:

Code: Select all

 10 MODE0
 15 FOR R%=1 TO 54
 20 PROCcircle(500+R%*40,512,R%*50,FALSE)
 25 NEXT
 30 END
 50 REM > BLib.Graphic.Circle 1.01 22May1986
 60 REM v1.00 15Apr1985 Code from Econet front end
 70 REM v1.01 22May1986 Optimised MOVE/PLOTs
 80 :
 90 DEFPROCcircle(x%,y%,r%,f%):REM X posn, Y posn, Radius, Filled
100 LOCAL step,s,c,xp,yp,xr,s%,k%
110 k%=13+72*(f%AND1)      :REM PLOT action
120 step=2*PI/32           :REM Length of each arc
130 s=SINstep              :REM Precalculate sin of step
140 c=COSstep              :REM Precalculate cosine of step
150 xp=r%:yp=0             :REM Set initial position
160 MOVE x%+r%,y%          :REM Move to initial point on edge
170 FOR s%=1 TO 31         :REM We'll do 31 segments here
180   xr=xp*c-yp*s           :REM Calculate next point on edge
190   yp=xp*s+yp*c
200   xp=xr
210   IF f%:MOVE x%,y%       :REM If filled, extra point at centre
220   PLOT k%,x%+xp,y%+yp    :REM Draw a line or a segment
230 NEXT                   :REM And again
240 IF f%:MOVE x%,y%       :REM Do final segment back to start
250 PLOT k%,x%+r%,y%
260 ENDPROC
EDIT: If you can live without the option of filled circles, you can fit the whole procedure onto a single line:

Code: Select all

DEFPROCc(x%,y%,r%):LOCALA,s,c,x,y,B,s%:A=2*PI/32:s=SINA:c=COSA:x=r%:y=0:MOVEx%+r%,y%:FORs%=1TO31:B=x*c-y*s:y=x*s+y*c:x=B:PLOT13,x%+x,y%+y:NEXT:PLOT13,x%+r%,y%:ENDPROC
Here's a minor variant, with more arcs per circle:
:idea:
Last edited by lurkio on Mon Mar 11, 2019 2:58 pm, edited 2 times in total.

LordVaderUK
Posts: 22
Joined: Thu Jan 31, 2019 12:26 am
Contact:

Re: Drawing a circle in BBC BASIC

Post by LordVaderUK » Sun Mar 10, 2019 12:09 pm

Wow, Lurkio, that is absolutely brilliant, thank you. Sadly my maths is pretty shabby and I would never have worked this out. Very grateful :)

User avatar
lurkio
Posts: 1930
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Drawing a circle in BBC BASIC

Post by lurkio » Sun Mar 10, 2019 1:36 pm

LordVaderUK wrote:
Sun Mar 10, 2019 12:09 pm
Sadly my maths is pretty shabby and I would never have worked this out. Very grateful
No problem! My maths is quite shabby too, so I was glad to find the library function (though I was a bit surprised it was apparently the only time a general-purpose circle-drawing PROC had been posted on Stardot). Thanks to JGH and BigEd for their help.

If only JGH would make the rest of his code library available as plain text, so that it was easier for more people to use...

:idea:

User avatar
jgharston
Posts: 3454
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: Drawing a circle in BBC BASIC

Post by jgharston » Sun Mar 10, 2019 11:05 pm

lurkio wrote:
Sun Mar 10, 2019 1:36 pm
If only JGH would make the rest of his code library available as plain text, so that it was easier for more people to use...
They are BASIC program libraries intended to be loaded into BASIC, which is why they are BASIC files, because they are libraries of BASIC code. If they were text you'd get Bad program when you tried to use them. Would you similarly demand that graphics files that contain graphics data intended to be used as graphics data be text files?

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

User avatar
lurkio
Posts: 1930
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Drawing a circle in BBC BASIC

Post by lurkio » Mon Mar 11, 2019 12:42 am

jgharston wrote:
Sun Mar 10, 2019 11:05 pm
lurkio wrote:
Sun Mar 10, 2019 1:36 pm
If only JGH would make the rest of his code library available as plain text, so that it was easier for more people to use...
They are BASIC program libraries intended to be loaded into BASIC, which is why they are BASIC files, because they are libraries of BASIC code. If they were text you'd get Bad program when you tried to use them. Would you similarly demand that graphics files that contain graphics data intended to be used as graphics data be text files?
I wasn’t making a “demand”. It was more that I was expressing a kind of forlorn hope.

Yes, they are “BASIC” program libraries, but as you might have observed in this very thread, it was only when I converted one of the programs to plain text that errors came to light and were corrected, for the benefit of all.

It’s useful to have this kind of “BASIC” code available in plain text because plain text is more easily shared, viewed, and discussed on the web, and especially on Stardot. And it’s handy for copying and pasting into the user’s choice of text editor on a modern OS, and thence into BeebEm. Etc. etc.

So my feeling is that your libraries would get more use if they were available in plain text. But that’s just a feeling I have. It’s not a “demand”. You are of course free to keep your code in whatever format you like. It’s all still very useful, but it would be even more so if plain text versions of the library functions were available in addition to the “BASIC” versions.

Others may disagree, of course.

:idea:

User avatar
Richard Russell
Posts: 667
Joined: Sun Feb 27, 2011 10:35 am
Location: Downham Market, Norfolk
Contact:

Re: Drawing a circle in BBC BASIC

Post by Richard Russell » Mon Mar 11, 2019 4:51 am

lurkio wrote:
Mon Mar 11, 2019 12:42 am
Others may disagree, of course.
I agree with you entirely. In addition to your very valid points, Jonathan's BASIC files have no extension so (in Internet Explorer and Edge at least) when you click on one of the links it attempts to open the file in the browser, giving rise to this kind of gobbledygook:

*ô > BLib.Graphic.Circle 1.01 22May1986 0ô v1.00 15Apr1985 Code from Econet front end *ô v1.01 22May1986 Optimised MOVE/PLOTs (: 2:Ýòcircle(x%,y%,r%,f%):ô X posn, Y posn, Radius, Filled <ê step,s,c,xp,yp,xr,s%,k% F'k%=13+72*(f%€1) :ô PLOT action P/step=(2*¯/90)+50 :ô Length of each arc Z4s=µstep :ô Precalculate sin of step d7c=›step :ô Precalculate cosine of step n2xp=r%:yp=0 :ô Set initial position x8ì x%+r%,y% :ô Move to initial point on edge ‚4ã s%=1 ¸ 31 :ô We'll do 31 segments here Œ:xr=xp*c-yp*s :ô Calculate next point on edge –yp=xp*s+yp*c xp=xr ª:ç f%:ì x%,y% :ô If filled, extra point at centre ´3ð k%,x%+xp,y%+yp :ô Draw a line or a segment ¾$í :ô And again È8ç f%:ì x%,y% :ô Do final segment back to start Òð k%,x%+r%,y% Üá ÿ

In my opinion it would be far better for the code to be listed in plain text, ideally with indentation and syntax colouring. I have a BBC BASIC program which converts tokenised BASIC files to HTML, which is what I usually use if I want to publish code on the web. Here's an example which I uploaded only a few days ago.

User avatar
BeebMaster
Posts: 2679
Joined: Sun Aug 02, 2009 4:59 pm
Location: Lost in the BeebVault!
Contact:

Re: Drawing a circle in BBC BASIC

Post by BeebMaster » Mon Mar 11, 2019 4:53 pm

The solution I have for dealing with tokenised BASIC files in a readable format (like the output of LIST) is to use Brandy BASIC. Download the file, start Brandy, load it and list it. Then you can copy and paste the listing as necessary.

I have a Thunar custom action so I can just right click the stored file and its loads into Brandy then I just L. to display a listing on screen. This is the actual command saved in the custom action:

Code: Select all

gnome-terminal --tab --maximize --title=%n -e "/usr/bin/brandy -load %n"
Possibly the first ever circle drawing routine for a BBC Micro is on the Welcome tape, the Clock routine. I've put it all below as it's only about 40 lines:

Code: Select all

   10 REM CLOCK
   40 ONERRORGOTO50
   50 MODE7
   60 F%=0:O%=1:ONERRORGOTO800
  100 MODE7:PROCOFF:FORI%=8TO9:PRINTTAB(17,I%);CHR$&8D"CLOCK":NEXT
  110 IF F%=0 THEN CLEAR:DIMA%120:@%=2:FORI%=0TO119:A%?I%=100*(1+SINRAD(I%*6)):NEXT
  120 IFTIME<0THENTIME=0
  200 F%=1:ON O% GOTO1000,2000,1000
  500 PRINTTAB(15,1);"M E N U"'''"Choose between...."'
  510 PRINTTAB(9)"Analogue Display"''TAB(9)"Digital Display"''TAB(9)"Analogue and Digital Display"''TAB(9)"Reset Time"
  515 PRINTTAB(0,16)"Press ESCAPE to exit the program"
  520 FORI%=1TO4:PRINTTAB(5,4+2*I%);I%;" -":NEXT
  530 PRINT'"Enter 1-4 and Press RETURN: ";:K%=0:F%=2
  540 Y%=GET:IFY%=13ANDK%>0THEN570
  550 Y%=Y%AND&EF-32:IFY%<1ORY%>4THEN540
  560 K%=Y%:PRINTCHR$(K%+48);CHR$8;:GOTO540
  570 F%=1:IFK%<4THENO%=K%:GOTO100
  600 CLS:FORI%=7TO8:PRINTTAB(13,I%)CHR$&8D"ENTER TIME -":NEXT
  610 INPUTLINE'TAB(14)"HOURS  :"H% TAB(14)"MINUTES:"L% TAB(14)"SECONDS:"S%
  620 IFH%<0ORH%>23ORL%<0ORL%>59ORS%<0ORS%>59 THEN PROCOFF:PRINT'TAB(12)"INVALID TIME -"'TAB(12)"PLEASE RE-ENTER":N%=INKEY(400):GOTO600
  630 TIME=(S%+(L%+(H%*60))*60)*100:GOTO100
  800 MODE7:IF F%=1 THEN500
  810 IF F%=0 THEN100
  900 CHAIN "PHOTO"
 1000 MODE4:VDU19,0,1;0;19,1,3;0;16,29,500;512;5
 1010 FORA=0TORAD45STEPRAD.5:X%=400*COSA:Y%=400*SINA
 1020 PLOT69,X%,Y%:PLOT69,Y%,X%:PLOT69,-X%,Y%:PLOT69,Y%,-X%:PLOT69,X%,-Y%:PLOT69,-Y%,X%:PLOT69,-X%,-Y%:PLOT69,-Y%,-X%:NEXT
 1050 FORI%=1TO12:MOVE SINRAD(I%*30)*400*1.1-32-16*(I%<10),COSRAD(I%*30)*400*1.1+16
 1060 PRINT;I%;:X%=SINRAD(I%*30)*400:Y%=COSRAD(I%*30)*400:MOVEX%,Y%:DRAWX%*.9,Y%*.9:NEXT
 1070 VDU4:PROCOFF:PROCSET:PROCH:PROCM:PROCS
 1100 REPEATUNTILTIME MOD100=0:PROCS:S%=(S%+1)MOD60:PROCS:IFS%=0PROCM:L%=(L%+1)MOD60:PROCM:IFL%MOD12=0PROCH:H%=(H%+1)MOD120:PROCH
 1110 IFO%=3PRINTTAB(30,5);:PROCP
 1120 GOTO1100
 1700 DEFPROCS MOVE0,0:PLOT6,3.2*(A%?S%-100),3.2*(A%?(S%+15)-100):ENDPROC
 1800 DEFPROCM MOVE0,0:MOVE1.5*(A%?(L%+59)-100),1.5*(A%?(L%+14)-100):PLOT86,1.5*(A%?(L%+1)-100),1.5*(A%?(L%+16)-100)
 1810 PLOT6,1.5*(A%?(L%+59)-100),1.5*(A%?(L%+14)-100):PLOT86,3*(A%?L%-100),3*(A%?(L%+15)-100):ENDPROC
 1900 DEFPROCH G%=H%MOD60:MOVE0,0:MOVEA%?(G%+58)-100,A%?(G%+13)-100:PLOT86,A%?(G%+2)-100,A%?(G%+17)-100:PLOT6,A%?(G%+58)-100,A%?(G%+13)-100:PLOT86,2*(A%?G%-100),2*(A%?(G%+15)-100):ENDPROC
 2000 MODE5:VDU19,0,0;0;19,3,2;0;12:MOVE300,400:DRAW980,400:DRAW980,648:DRAW300,648:DRAW300,400:PROCOFF:PROCSET
 2010 REPEATUNTILTIME MOD100=0:S%=(S%+1)MOD60:IFS%=0L%=(L%+1)MOD60:IFL%MOD12=0:H%=(H%+1)MOD120
 2020 PRINTTAB(6,15);:PROCP:GOTO2010
 2500 DEFPROCP PRINTH%DIV5":";L%DIV10;L%MOD10":";S%DIV10;S%MOD10:ENDPROC
 8000 DEFPROCOFF VDU23;8202;0;0;0;:ENDPROC
 8100 DEFPROCSET T%=TIME:S%=(T%DIV100)MOD60:L%=(T%DIV6000)MOD60:H%=(T%DIV72000)MOD120:ENDPROC
Image

tom_seddon
Posts: 263
Joined: Mon Aug 29, 2005 11:42 pm
Contact:

Re: Drawing a circle in BBC BASIC

Post by tom_seddon » Mon Mar 11, 2019 5:27 pm

I've always found BBC BASIC more convenient as text too, since I'm almost always looking at it on the PC.

To do this on OS X, I use BBCBasicToText, in conjunction with wget. Use wget to download the tokenized data and print it to stdout; pipe the result through BBCBasicToText, and out comes text. For example:

Code: Select all

wget -qO - http://mdfs.net/blib/Graphics/Circle | BBCBasicToText
(The -q stops wget printing a load of extra output, but it's strictly optional: the extra output goes to stderr, so it won't interfere with redirecting or anything.)

--Tom
Last edited by tom_seddon on Mon Mar 11, 2019 5:28 pm, edited 1 time in total.

User avatar
Richard Russell
Posts: 667
Joined: Sun Feb 27, 2011 10:35 am
Location: Downham Market, Norfolk
Contact:

Re: Drawing a circle in BBC BASIC

Post by Richard Russell » Mon Mar 11, 2019 8:19 pm

BeebMaster wrote:
Mon Mar 11, 2019 4:53 pm
Download the file, start Brandy, load it and list it. Then you can copy and paste the listing as necessary.
I didn't know you could copy-and-paste a listing from Brandy, how do you do it?

Personally to use that approach I would (unsurprisingly) choose SDLIDE, which also loads both tokenised BASIC formats and supports copying to the clipboard using Select All followed by Copy, or Ctrl+A Ctrl+C.

User avatar
BeebMaster
Posts: 2679
Joined: Sun Aug 02, 2009 4:59 pm
Location: Lost in the BeebVault!
Contact:

Re: Drawing a circle in BBC BASIC

Post by BeebMaster » Tue Mar 12, 2019 12:13 am

Very similar, just highlight the listing and then copy and paste. I made a little video:

http://www.beebmaster.co.uk/Downloads/Brandy.avi
Image

User avatar
lurkio
Posts: 1930
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Drawing a circle in BBC BASIC

Post by lurkio » Sat Mar 23, 2019 6:48 pm

More than you ever wanted to know about drawing circles on a Beeb, from the December 1984 issue of Practical Computing magazine:

01.jpg
02.jpg
03.jpg
04.jpg
05.jpg
06.jpg
07.jpg
08.jpg
09.jpg
10.jpg

:idea:

User avatar
BigEd
Posts: 2400
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Drawing a circle in BBC BASIC

Post by BigEd » Mon Mar 25, 2019 1:39 pm

Thanks for snapping and posting the article and listings!

User avatar
lurkio
Posts: 1930
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Drawing a circle in BBC BASIC

Post by lurkio » Mon Mar 25, 2019 10:12 pm

BigEd wrote:
Mon Mar 25, 2019 1:39 pm
Thanks for snapping and posting the article and listings!
You're welcome!

Apropos of nothing:

Code: Select all

10MODE0
20FOR R%=40 TO 1 STEP-1
30PROCc(400,512,R%*25,32)
40PROCc(880,512,R%*25,32)
50NEXT
60END
80DEFPROCc(x%,y%,r%,n%):LOCALA,s,c,x,y,B,s%:A=2*PI/n%:s=SINA:c=COSA:x=r%:y=0:MOVEx%+r%,y%:FORs%=1TOn%-1:B=x*c-y*s:y=x*s+y*c:x=B:PLOT13,x%+x,y%+y:NEXT:PLOT13,x%+r%,y%:ENDPROC
http://bbcmicro.co.uk/jsbeeb/play.php?p ... 253AE10DFF

:idea:

User avatar
BigEd
Posts: 2400
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Drawing a circle in BBC BASIC

Post by BigEd » Mon Mar 25, 2019 10:16 pm

For a minute there it was looking a bit like the computer literacy owl...

Prime
Posts: 2673
Joined: Sun May 31, 2009 11:52 pm
Contact:

Re: Drawing a circle in BBC BASIC

Post by Prime » Mon Mar 25, 2019 11:26 pm

What kind of supprises me is that BBC basic doesn't have a Circle command, as most other basics of the time did.

Cheers.

Phill.

User avatar
Richard Russell
Posts: 667
Joined: Sun Feb 27, 2011 10:35 am
Location: Downham Market, Norfolk
Contact:

Re: Drawing a circle in BBC BASIC

Post by Richard Russell » Tue Mar 26, 2019 9:54 am

Prime wrote:
Mon Mar 25, 2019 11:26 pm
What kind of supprises me is that BBC basic doesn't have a Circle command
The CIRCLE statement was introduced in BBC BASIC 5. All 'modern' versions of BBC BASIC support it.
as most other basics of the time did.
Most? If that really was the case I would have expected there to be pressure for BBC BASIC to include it at the time, but I have no such recollection. Apart from the ZX Spectrum, what other contemporary BASICs had a CIRCLE statement? According to my references neither the Tatung Einstein nor the Amstrad CPC-series did.

User avatar
leenew
Posts: 3815
Joined: Wed Jul 04, 2012 3:27 pm
Location: Doncaster, Yorkshire
Contact:

Re: Drawing a circle in BBC BASIC

Post by leenew » Tue Mar 26, 2019 10:26 am

The computer shop I worked in 1983/4 sold Beebs, Spectrums, Dragons and Orics.
The Speccy, Dragon and Oric all have a circle command I believe.

Lee.

Post Reply