FAQ  •  Register  •  Login

found a bug on draw command

<<

nitrofurano

Posts: 135

Joined: Thu Sep 29, 2011 12:44 pm

Location: Porto, Portugal

Post Sat Oct 01, 2011 2:15 pm

found a bug on draw command

  Code:
 
10 cls:out 254,6

12 let x1=60:let y1=60
14 let x2=70:let y2=50
16 plot x1,192-y1
18 draw x2-x1,y1-y2

22 let x1=80:let y1=60
24 let x2=90:let y2=70
26 plot x1,192-y1
28 draw x2-x1,y1-y2

30 pause 0


this code should draw two lines, not one line and one dot...

Image
<<

boriel

Site Admin

Posts: 1145

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Sat Oct 01, 2011 3:16 pm

Re: found a bug on draw command

Unlike Sinclair Basic, which uses FLOAT type for every variable, when you don't declare vars, ZX BASIC tries to guess the best type for them.
It seems it's using Byte types (range -128..127) which could to be causing overflow.

Add this line:
  Code:
11 DIM x1, x2, y1, y2 As Integer
to ensure the Integer type will be used (using Float will also work, but will take more memory and will be almost as slow as Sinclair BASIC).
<<

nitrofurano

Posts: 135

Joined: Thu Sep 29, 2011 12:44 pm

Location: Porto, Portugal

Post Sat Oct 01, 2011 5:46 pm

Re: found a bug on draw command

thanks! :)

Return to Help & Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.

phpBB SEO