MaxCoderz.org

Back in business




Post new topic Reply to topic  [ 159 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9 ... 11  Next
Author Message
 Post subject: Re: [News] BBC BASIC Beta Testing - 2009/01/28 r654
PostPosted: Wed Jan 28, 2009 7:29 am 
Regular Member

Joined: Tue Apr 18, 2006 5:33 am
Posts: 81
Location: Earth
Sad, I can't even open the .zip file since it says something about a corruption. =.-

_________________
Trying to learn assembly =)


Top
 Profile  
 
 Post subject: Re: [News] BBC BASIC Beta Testing - 2009/01/28 r654
PostPosted: Wed Jan 28, 2009 10:05 am 
Maxcoderz Staff
User avatar

Joined: Thu Dec 16, 2004 10:06 pm
Posts: 2938
Location: Croydon, England
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.


Top
 Profile  
 
 Post subject: Re: [News] BBC BASIC Beta Testing - 2009/01/29 r660
PostPosted: Thu Jan 29, 2009 3:03 am 
Maxcoderz Staff
User avatar

Joined: Thu Dec 16, 2004 10:06 pm
Posts: 2938
Location: Croydon, England
A few bug-fixes in the r660 release:

  • 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.

The circle drawing code has been sped up significantly by skipping two expensive multiplications and a 32-bit square root calculation when the supplied point on its circumference has the same x or y component as the centre of the circle (ie, in normal use).

EXIT FOR now lets you pass an optional loop variable to break out of nested FOR loops:
Code:
FOR I%=1 TO 3
  FOR J%=4 TO 5
    IF bool% THEN EXIT FOR I%
  NEXT J%
NEXT I%
This shares the same caveats as EXIT FOR on the Windows version.


Top
 Profile  
 
 Post subject: Re: [News] BBC BASIC Beta Testing - 2009/01/28 r654
PostPosted: Thu Jan 29, 2009 3:53 am 
Regular Member

Joined: Tue Apr 18, 2006 5:33 am
Posts: 81
Location: Earth
K, got it to work and i'm excited to test this thing out. ;o

My .zip skills aren't to good, heh.

_________________
Trying to learn assembly =)


Top
 Profile  
 
 Post subject: Re: [News] BBC BASIC Beta Testing - 2009/01/29 r660
PostPosted: Thu Jan 29, 2009 11:48 pm 
New Member

Joined: Sun Nov 09, 2008 8:16 pm
Posts: 15
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!


Top
 Profile  
 
 Post subject: Re: [News] BBC BASIC Beta Testing - 2009/01/29 r660
PostPosted: Fri Jan 30, 2009 2:42 am 
Maxcoderz Staff
User avatar

Joined: Thu Dec 16, 2004 10:06 pm
Posts: 2938
Location: Croydon, England
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:
Code:
INPUT A$ : A=EVAL(A$)

If you wish to get rid of the "? " prompt, use the following instead:
Code:
INPUT;A$ : A=EVAL(A$)


Top
 Profile  
 
 Post subject: Re: [News] BBC BASIC Beta Testing - 2009/01/29 r660
PostPosted: Fri Jan 30, 2009 11:40 am 
Maxcoderz Staff
User avatar

Joined: Thu Dec 16, 2004 10:06 pm
Posts: 2938
Location: Croydon, England
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:

Image Image Image

Code:
   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

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.


Top
 Profile  
 
 Post subject: Re: [News] BBC BASIC Beta Testing - 2009/01/30 r668
PostPosted: Fri Jan 30, 2009 11:38 pm 
Maxcoderz Staff
User avatar

Joined: Thu Dec 16, 2004 10:06 pm
Posts: 3981
Location: I cant seem to get out of this cryogenic chamber!
Oh wow ben! The dithering on that mandelbrot is fantastic! It generates super fast for a calc too!. BBC BASIC teh future!

_________________
"My world is Black & White. But if i blink fast enough, i see it in Grayscale."
Image


Top
 Profile  
 
 Post subject: Re: [News] BBC BASIC Beta Testing - 2009/01/30 r668
PostPosted: Mon Feb 02, 2009 12:20 am 
Regular Member

Joined: Tue Apr 18, 2006 5:33 am
Posts: 81
Location: Earth
It works on my calc but I don't get the syntax to much.

Code:
10 INPUT "How old r u?",A
20 IF A > 50 THEN
30   PRINT "u r old"
40 END


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?

_________________
Trying to learn assembly =)


Top
 Profile  
 
 Post subject: Re: [News] BBC BASIC Beta Testing - 2009/01/30 r668
PostPosted: Mon Feb 02, 2009 1:04 am 
Maxcoderz Staff
User avatar

Joined: Thu Dec 16, 2004 10:06 pm
Posts: 2938
Location: Croydon, England
Quote:
Code:
10 INPUT "How old r u?",A
20 IF A > 50 THEN
30   PRINT "u r old"
40 END


What's wrong with this code? It prints the text regardless of what A is equal to.
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,
Code:
10 INPUT "How old r u",A
20 IF A>50 THEN PRINT "u r old"
will work. I know it's not ideal, and later versions of the language support IF/THEN/ENDIF blocks (a special case if THEN is the last thing on a line) but there are ways around the limitation. One way is to use the WHILE loop instead (which I've added and supports skipping over a block), like this:
Code:
10 INPUT "How old r u",A
20 WHILE A > 50
30   PRINT "u r old"
40 EXIT WHILE:ENDWHILE

Quote:
Wait is BBC basic interpretted or compiled? and are structures implemented?
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.

If you use the integrated assembler, that outputs fully assembled code (there is not a Z80 "interpreter"), which is useful for speed.


Top
 Profile  
 
 Post subject: Re: [News] BBC BASIC Beta Testing - 2009/01/30 r668
PostPosted: Mon Feb 02, 2009 1:07 am 
Regular Member

Joined: Tue Apr 18, 2006 5:33 am
Posts: 81
Location: Earth
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?

_________________
Trying to learn assembly =)


Top
 Profile  
 
 Post subject: Re: [News] BBC BASIC Beta Testing - 2009/01/30 r668
PostPosted: Mon Feb 02, 2009 1:23 am 
Maxcoderz Staff
User avatar

Joined: Thu Dec 16, 2004 10:06 pm
Posts: 2938
Location: Croydon, England
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).


Top
 Profile  
 
 Post subject: Re: [News] BBC BASIC Beta Testing - 2009/01/30 r668
PostPosted: Mon Feb 02, 2009 3:20 am 
Regular Member

Joined: Tue Apr 18, 2006 5:33 am
Posts: 81
Location: Earth
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?

_________________
Trying to learn assembly =)


Top
 Profile  
 
 Post subject: Re: [News] BBC BASIC Beta Testing - 2009/01/30 r668
PostPosted: Mon Feb 02, 2009 6:30 am 
Maxcoderz Staff
User avatar

Joined: Thu Dec 16, 2004 10:06 pm
Posts: 3981
Location: I cant seem to get out of this cryogenic chamber!
I believe there are already special cases in place to take advantage of integer math if thats all you require.

_________________
"My world is Black & White. But if i blink fast enough, i see it in Grayscale."
Image


Top
 Profile  
 
 Post subject: Re: [News] BBC BASIC Beta Testing - 2009/01/30 r668
PostPosted: Mon Feb 02, 2009 12:09 pm 
Maxcoderz Staff
User avatar

Joined: Thu Dec 16, 2004 10:06 pm
Posts: 2938
Location: Croydon, England
cjgone wrote:
How would I go about drawing a 8x8 picture?
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.
Quote:
And how do I make a pointer? or even an array of pointers?
Any numeric variable can be used as a pointer when using the indirection operators. You can allocate memory using DIM.
Quote:
Anyway to define an 8bit variable to make calculations faster?
If anything it will make calculations slower as they're all done in 32-bit anyway, but yes - using DIM and indirection:
Code:
10 DIM byte 0
20 FOR ?byte=0 TO 255
30   PRINT ?byte
40 NEXT
In terms of speed, the static variables (A%-Z% and @%) are faster than ones allocated on the heap as they are at constant places in memory. It is also faster if you use variables with different first letters as variables are stored in a linked list based on their first letter; if every variable started with the letter 'x' there would be only one (long) linked list in use and that would have to be searched every time a variable was used.
tr1p1ea wrote:
I believe there are already special cases in place to take advantage of integer math if thats all you require.
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".


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 159 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9 ... 11  Next


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
DVGFX2 By: Matt