[News] BBC BASIC Beta Testing - 2009/03/06 r720
Moderator: benryves
-
- Regular Member
- Posts: 83
- Joined: Tue 18 Apr, 2006 5:33 am
- Location: Washington->UC Berkeley '15
Re: [News] BBC BASIC Beta Testing - 2009/01/28 r654
Sad, I can't even open the .zip file since it says something about a corruption. =.-
- benryves
- Maxcoderz Staff
- Posts: 3087
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: [News] BBC BASIC Beta Testing - 2009/01/28 r654
Try downloading it again? I just downloaded it (to verify something hadn't gone wrong when uploading) and both the built-in Windows unzipping tool and 7-zip handle it fine.
- benryves
- Maxcoderz Staff
- Posts: 3087
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: [News] BBC BASIC Beta Testing - 2009/01/29 r660
A few bug-fixes in the r660 release:
EXIT FOR now lets you pass an optional loop variable to break out of nested FOR loops:This shares the same caveats as EXIT FOR on the Windows version.
- Circles are stretched correctly when the X axis and Y axis use different scale factors (eg in MODE 0, the default).
- Large circles are drawn (they weren't being drawn at all previously!)
- SWAP will let you swap indirected variables (including fixed strings and byte variables) and will not let you pass literals.
- The cursor flashes during WAIT operations.
EXIT FOR now lets you pass an optional loop variable to break out of nested FOR loops:
Code: Select all
FOR I%=1 TO 3
FOR J%=4 TO 5
IF bool% THEN EXIT FOR I%
NEXT J%
NEXT I%
-
- Regular Member
- Posts: 83
- Joined: Tue 18 Apr, 2006 5:33 am
- Location: Washington->UC Berkeley '15
Re: [News] BBC BASIC Beta Testing - 2009/01/28 r654
K, got it to work and i'm excited to test this thing out. ;o
My .zip skills aren't to good, heh.
My .zip skills aren't to good, heh.
Re: [News] BBC BASIC Beta Testing - 2009/01/29 r660
I have installed the latest beta on my TI-84 Plus SE and I noticed that the "Input" command had some problems. As you see in the code below (an excact replica of what I did with this simple calculator program) the Input command appears to only recognize the first value entered and does not evaluate the selection.
BBC BASIC (Z80) v3.00
(C) R.T.Russel 1987
10 PRINT "**************
********** CALCULAT
OR ****************
*********"
20 INPUT "",A
30 PRINT A
40 GOTO 20
SAVE "CALC"
RUN "CALC"
************************
* CALCULATOR *
************************
? 35+6
35
?
Escape at line 20
>
I am led to believe that this is a bug because, as illustrated below, the PRINT command will evaluate the selection.
BBC BASIC (Z80) v3.00
(C) R.T.Russel 1987
PRINT 35+8
43
Can you possibly look into this and corect the issue?
Thanks!
BBC BASIC (Z80) v3.00
(C) R.T.Russel 1987
10 PRINT "**************
********** CALCULAT
OR ****************
*********"
20 INPUT "",A
30 PRINT A
40 GOTO 20
SAVE "CALC"
RUN "CALC"
************************
* CALCULATOR *
************************
? 35+6
35
?
Escape at line 20
>
I am led to believe that this is a bug because, as illustrated below, the PRINT command will evaluate the selection.
BBC BASIC (Z80) v3.00
(C) R.T.Russel 1987
PRINT 35+8
43
Can you possibly look into this and corect the issue?
Thanks!
- benryves
- Maxcoderz Staff
- Posts: 3087
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: [News] BBC BASIC Beta Testing - 2009/01/29 r660
I'll point you to the INPUT documentation for why this happens, but if you're simply after the correct way to read an expression (like '35+6') and convert it into a numeric value then you should read input into a string variable then use EVAL to evaluate it, like this:
If you wish to get rid of the "? " prompt, use the following instead:
Code: Select all
INPUT A$ : A=EVAL(A$)
Code: Select all
INPUT;A$ : A=EVAL(A$)
- benryves
- Maxcoderz Staff
- Posts: 3087
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: [News] BBC BASIC Beta Testing - 2009/01/29 r660
I've started tweaking some of the graphics code, and have corrected ellipses (so they have the same shape when drawn filled as drawn outlined - filled ellipses were a little ugly before).
I'm holding off a release until I can figure out the rules for filled rectangles - on BBC BASIC for Windows if you ask for a rectangle one pixel width/height it is drawn as a single pixel; on the TI-83+ version it draws it two pixels wide/high. Rectangles are expressed as two diagonally opposite corners and the TI-83+ version fills between both inclusively (as with lines) whereas the Windows version appears to stop one pixel short. I'll experiment a bit with different versions of BBC BASIC to see which is correct, but this should be an easy correction.
In the meantime, have an ugly program that produces pretty results:
Increase the 3 in line 120's IFxx+yy>3 to increase the quality (and time it takes to render). Change mnX, mxX, mnY and mxY at the top of the program to change the window settings (ie, which bit of the fractal is being rendered).
Edit: The newly-uploaded version features the corrected ellipse code, some bug fixes to the EXIT and WHILE statements and support for indentation of extended keywords in the PC editor.
I'm holding off a release until I can figure out the rules for filled rectangles - on BBC BASIC for Windows if you ask for a rectangle one pixel width/height it is drawn as a single pixel; on the TI-83+ version it draws it two pixels wide/high. Rectangles are expressed as two diagonally opposite corners and the TI-83+ version fills between both inclusively (as with lines) whereas the Windows version appears to stop one pixel short. I'll experiment a bit with different versions of BBC BASIC to see which is correct, but this should be an easy correction.
In the meantime, have an ugly program that produces pretty results:
Code: Select all
10 REM Mandelbrot set fractal.
20 REM Based on a program by Ken Silverman.
30 MODE3
40 mnX=-1.8:mxX=.7
50 mnY=-1:mxY=1
60 dX=mxX-mnX:dY=mxY-mnY
70 FOR res%=0TO5
80 R%=128DIV2^res%:S%=0:T%=0
90 FORY%=0TO255STEPR%:FORX%=0TO383STEPR%
100 IFres%AND((T%ORS%)AND1)=0 S%=S%+1:NEXT
110 x=X%/384*dX+mnX:y=Y%/256*dY+mnY:ox=x:oy=y
120 FORC%=0TO14:xx=x*x:yy=y*y:IFxx+yy>3 EXIT FOR
130 y=x*y*2+oy:x=xx-yy+ox:NEXT
140 GCOLC%:RECTANGLE FILL X%,Y%,R%-1
150 S%=S%+1:NEXT:T%=T%+1:NEXT
160 NEXT res%
170 REPEAT:UNTILINKEY0<>-1
Edit: The newly-uploaded version features the corrected ellipse code, some bug fixes to the EXIT and WHILE statements and support for indentation of extended keywords in the PC editor.
- tr1p1ea
- Maxcoderz Staff
- Posts: 4141
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: I cant seem to get out of this cryogenic chamber!
- Contact:
Re: [News] BBC BASIC Beta Testing - 2009/01/30 r668
Oh wow ben! The dithering on that mandelbrot is fantastic! It generates super fast for a calc too!. BBC BASIC teh future!
-
- Regular Member
- Posts: 83
- Joined: Tue 18 Apr, 2006 5:33 am
- Location: Washington->UC Berkeley '15
Re: [News] BBC BASIC Beta Testing - 2009/01/30 r668
It works on my calc but I don't get the syntax to much.
What's wrong with this code? It prints the text regardless of what A is equal to.
Wait is BBC basic interpretted or compiled? and are structures implemented?
Code: Select all
10 INPUT "How old r u?",A
20 IF A > 50 THEN
30 PRINT "u r old"
40 END
Wait is BBC basic interpretted or compiled? and are structures implemented?
- benryves
- Maxcoderz Staff
- Posts: 3087
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: [News] BBC BASIC Beta Testing - 2009/01/30 r668
IF statements must fit on one line. A limitation of the interpreter's handling of statement blocks is that they must be executed at least once, as it can't skip over the block (unless you use a GOTO). So,What's wrong with this code? It prints the text regardless of what A is equal to.Code: Select all
10 INPUT "How old r u?",A 20 IF A > 50 THEN 30 PRINT "u r old" 40 END
Code: Select all
10 INPUT "How old r u",A
20 IF A>50 THEN PRINT "u r old"
Code: Select all
10 INPUT "How old r u",A
20 WHILE A > 50
30 PRINT "u r old"
40 EXIT WHILE:ENDWHILE
The BASIC code is entirely interpreted. This version of BBC BASIC does not support structures, though you may be able to replicate their functionality with multidimensional arrays. If you want to go lower level, you can use the indirection operators to create your own data structures.Wait is BBC basic interpretted or compiled? and are structures implemented?
If you use the integrated assembler, that outputs fully assembled code (there is not a Z80 "interpreter"), which is useful for speed.
-
- Regular Member
- Posts: 83
- Joined: Tue 18 Apr, 2006 5:33 am
- Location: Washington->UC Berkeley '15
Re: [News] BBC BASIC Beta Testing - 2009/01/30 r668
Okay, thanks.
Wait, since it's interpretted, and I think interpretation is slower then compiling, is their a way to turn it into a binary file for faster execution?
How fast is BBC basic compared to let's say assembler?
Wait, since it's interpretted, and I think interpretation is slower then compiling, is their a way to turn it into a binary file for faster execution?
How fast is BBC basic compared to let's say assembler?
- benryves
- Maxcoderz Staff
- Posts: 3087
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: [News] BBC BASIC Beta Testing - 2009/01/30 r668
BASIC programs are stored in a tokenised binary form which is easy to parse (see here and here); that's about as close as a binary format as you'll get.
BBC BASIC programs run at least an order of magnitude slower than native assembly, but on the other hand it's much quicker to develop a BASIC program than it is to develop an assembly program. BBC BASIC offers an alternative to assembly when you can accept a speed hit (though you can of course mix the two for the best of both worlds).
BBC BASIC programs run at least an order of magnitude slower than native assembly, but on the other hand it's much quicker to develop a BASIC program than it is to develop an assembly program. BBC BASIC offers an alternative to assembly when you can accept a speed hit (though you can of course mix the two for the best of both worlds).
-
- Regular Member
- Posts: 83
- Joined: Tue 18 Apr, 2006 5:33 am
- Location: Washington->UC Berkeley '15
Re: [News] BBC BASIC Beta Testing - 2009/01/30 r668
How would I go about drawing a 8x8 picture? And how do I make a pointer? or even an array of pointers? Anyway to define an 8bit variable to make calculations faster?
- tr1p1ea
- Maxcoderz Staff
- Posts: 4141
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: I cant seem to get out of this cryogenic chamber!
- Contact:
Re: [News] BBC BASIC Beta Testing - 2009/01/30 r668
I believe there are already special cases in place to take advantage of integer math if thats all you require.
- benryves
- Maxcoderz Staff
- Posts: 3087
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: [News] BBC BASIC Beta Testing - 2009/01/30 r668
This is where it starts to get a bit messy I'm afraid; the best solution currently is to use MODE 4 (for large 8x8 characters) and VDU 23 to redefine the characters. If you wish to draw a sprite at any position on the screen, you could then use VDU 5 to switch to drawing text at the graphics cursor position. It's all a bit slow, though (I acknowledge this!) Take a look at TILEMAP.8xp for an example of tilemapping using redefined characters.cjgone wrote:How would I go about drawing a 8x8 picture?
Any numeric variable can be used as a pointer when using the indirection operators. You can allocate memory using DIM.And how do I make a pointer? or even an array of pointers?
If anything it will make calculations slower as they're all done in 32-bit anyway, but yes - using DIM and indirection:Anyway to define an 8bit variable to make calculations faster?
Code: Select all
10 DIM byte 0
20 FOR ?byte=0 TO 255
30 PRINT ?byte
40 NEXT
As tr1p1ea astutely pointed out, "BBC BASIC (Z80) stores integer values in real variables in a special way which allows the faster integer arithmetic routines to be used if appropriate. The presence of an integer value in a real variable is indicated by the stored exponent being zero. Thus, if the stored exponent is zero, the real variable is being used to hold an integer and the 4 byte mantissa holds the number in normal integer format".tr1p1ea wrote:I believe there are already special cases in place to take advantage of integer math if thats all you require.