Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 293
» Latest member: BillBennar
» Forum threads: 1,027
» Forum posts: 6,211

Full Statistics

Online Users
There are currently 289 online users.
» 0 Member(s) | 287 Guest(s)
Bing, Google

Latest Threads
Includes in ASM
Forum: How-To & Tutorials
Last Post: bracckets
04-04-2024, 12:17 AM
» Replies: 2
» Views: 896
Intermittent errors
Forum: Help & Support
Last Post: zarsoft
03-12-2024, 12:39 PM
» Replies: 0
» Views: 462
Store array information i...
Forum: Help & Support
Last Post: rbiondi
03-10-2024, 09:42 PM
» Replies: 0
» Views: 615
ScrollLeft function scrol...
Forum: Bug Reports
Last Post: rbiondi
03-07-2024, 03:57 PM
» Replies: 2
» Views: 1,192
string.bas errors when co...
Forum: Bug Reports
Last Post: rbiondi
03-01-2024, 10:10 AM
» Replies: 2
» Views: 1,051
Using Beepola with ZX BAS...
Forum: How-To & Tutorials
Last Post: edtoo
02-29-2024, 09:47 AM
» Replies: 15
» Views: 34,595
Johnny Bravo
Forum: Gallery
Last Post: zarsoft
02-11-2024, 11:20 PM
» Replies: 0
» Views: 630
Compiling +D G+DOS progra...
Forum: ZX Basic Compiler
Last Post: boriel
01-22-2024, 08:32 AM
» Replies: 4
» Views: 9,234
VAL = ? (solved)
Forum: Bug Reports
Last Post: zarsoft
01-03-2024, 11:44 PM
» Replies: 8
» Views: 4,253
Wrong math (solved)
Forum: Bug Reports
Last Post: zarsoft
01-03-2024, 11:38 PM
» Replies: 4
» Views: 2,332

 
  compiler error (*solved*)
Posted by: slenkar - 02-15-2011, 04:44 AM - Forum: Bug Reports - Replies (8)

im using the latest beta build

here is my source:

Code:
BORDER 7 : PAPER 7 : INK 0 : CLS
  PRINT AT 3,13 ; PAPER 1 ; INK 7 ; "BattleField"
  PRINT AT 5,9 ; PAPER 7 ; INK 0 ; "Q - Up"
  PRINT AT 6,9 ; PAPER 7 ; INK 0 ; "A - Down"
  PRINT AT 7,9 ; PAPER 7 ; INK 0 ; "O - Left"
  PRINT AT 8,9 ; PAPER 7 ; INK 0 ; "P - Right"
  PRINT AT 9,9 ; PAPER 7 ; INK 0 ; "M - Select"

  PRINT AT 10,3 ; PAPER 7 ; INK 0 ; "You have to select units"
  PRINT AT 11,3 ; PAPER 7 ; INK 0 ; "to fight the enemy units"
  PRINT AT 15,3 ; PAPER 7 ; INK 0 ; "Press any key to start"

60  LET j$ = INKEY$
  IF j$ = "" THEN GOTO 60: END IF

cls
Dim BlueFactoryX (6) as uByte
Dim BlueFactoryY (6) as uByte

for x =1 to 6
BlueFactoryX(x)  = byterndrange(1,30)
BlueFactoryY(x)  = byterndrange(1,30)
next

drawFactories()

function drawFactories()
for x =1 to 6
print at BlueFactoryX(x), BlueFactoryY(x); "O"
next
end function

Function byterndrange (first As uByte, last As uByte) As uByte
    return Rnd * (last - first) + first
End Function

here is the error message when I compile:



Quote:Traceback (most recent call last):
File "zxb.py", line 309, in <module>
File "zxb.py", line 242, in main
File "zxbtrad.pyc", line 316, in traverse
File "zxbtrad.pyc", line 1202, in traverse
File "zxbtrad.pyc", line 217, in emmit_let_left_part
TypeError: bad operand type for unary -: 'NoneType'


also it seems that underscores are not allowed in function names, is this right?

Print this item

  Show off your creativity!
Posted by: boriel - 02-14-2011, 11:25 PM - Forum: Gallery - Replies (54)

Have you created a game or a program with ZX BASIC? Want to show off what you are able to??
Just put here a screenshot (and optionally a .tap or .tzx file) so people can try your game or program.
You needn't to put the source code (so keep your secrets with you) :!:

The only requisite is that your program must be created using ZX BASIC (and optionally other tools). Idea

Print this item

  IDE bug?
Posted by: slenkar - 02-13-2011, 05:06 AM - Forum: Bug Reports - Replies (3)

I tried the program UDG.bas in the examples folder.

When I try to change the BIN values and run the program one of the numbers is removed from each BIN statement,

e.g.
0 DATA BIN 1111,BIN 1011,BIN 1011,BIN 1011,BIN 1011,BIN 1011,BIN 1011,BIN 1111
becomes:
DATA BIN 111,BIN 011,BIN 011,BIN 011,BIN 011,BIN 011,BIN 011,BIN 111

Print this item

  How to create and draw graphics
Posted by: slenkar - 02-13-2011, 03:59 AM - Forum: Help & Support - Replies (21)

What is the best way to draw graphics to the screen e.g. UDG or other method

How do you get sprites from the sprite editor into the basic program?

Print this item

  New beta release 1.2.7r2058
Posted by: boriel - 02-12-2011, 03:33 PM - Forum: Bug Reports - Replies (3)

Okay, a new beta release with Lbound() and UBound() functions implemented. This is a final release candidate. So, please, give it a try.
Also fixes an internal bug (but not critical), with the backend.

See LBound() and UBound() for usage. These functions allow to get the number of the dimensions of a given array (passing 0 as 2nd parameter), and also the lower and upper bounds of its dimensions.

They're not very useful yet, but will be when dynamic arrays are implemented. :wink:

Download:
<!-- m --><a class="postlink" href="http://www.boriel.com/files/zxb">http://www.boriel.com/files/zxb</a><!-- m -->

Update: The wiki has been *vandalized* Cry I've managed to clean it up. Also have put some documentation on Lbound() and Ubound() (see reserved keywords)

Print this item

  New beta release 1.2.7r2021
Posted by: boriel - 02-01-2011, 08:28 AM - Forum: Bug Reports - Replies (30)

Okay, a new beta release with a *critical* fix and two interesting optimizations :!:

  • ! The string parameters byVal (the default) in functions incorrecly managed causing crashes sometimes. Fixed.
  • ! Some other bugs in the Intermediate code has been fixed. And string management a bit optimized (faster and less memory used)
  • + Added a String.bas libray with MID$, LEFT$, RIGHT$, InStr and StrPos.
  • * The ZX Basic preprocessor has been *entirely* rewritten (refactored). It now allows true multivariate macros as cpp does (Thus allowing function inlining, etc).

Please, test needed :!: The compiler has undergone *deep changes* with this update.
You can download (as always) from <!-- m --><a class="postlink" href="http://www.boriel.com/files/zxb">http://www.boriel.com/files/zxb</a><!-- m -->

Print this item

  New beta release 1.2.7r1866
Posted by: boriel - 12-16-2010, 09:40 AM - Forum: Bug Reports - Replies (4)

Okay, a new beta release with a fix and two interesting optimizations :!:

  • ! The optimizer could hang under rare circumstances. Fixed.
  • ! The csrlin() routine had a bug reporting sometimes the wrong position (this also affected Input() library which uses it). Fixed.

  • + Every BEEP command always took 21 bytes. Now it only takes 11 bytes and it's faster (good for sound effects) if only constant numbers are used. So beep <num1>, <num2> is much optimized.
  • DRAW routine has been improved for speed. Now it's 200% faster (aprox.) and takes only 150 bytes more.
  • PLOT, DRAW & CIRCLE now uses SCREEN_ADD positioning => you can "DRAW" at part of the memory pointed by this internal variable.

To do:
  • If several constant beeps (BEEP <num1>, <num2>) are specified one after another, they will be "compressed" and played with a beep sequencer. So every beep in the sequence takes only 4 bytes.
  • A new library routine is in preparation: polyline, which draws a sequence of lines to coords Xn, Yn:
    Code:
    REM A list of coords (Unsigned Bytes)
    DIM CoordList(10, 2) as UByte = { {1, 1}, {3, 100}, {20, 80}, ... _
                            ... ' More coord lists
                         {128, 189}}

    REM Draws a polilyne of 10 coordinates, taking coord 0 as the 1st one
    REM The 2nd 0 is mondatory, but useless here.
    PolyLine(10, @CoordList(0, 0))
  • UBound and LBound soon to come (for getting the Upper and Lower bound of arrays).
    Code:
    DIM a(2 To 5, 1 TO 8) as Byte

    PRINT Ubound(a, 1) : REM prints 2
    PRINT LBound(a, 2) : REM prints 8
  • Variable parameters function calls, like in FreeBasic or C
    Code:
    Function Avg(n as uByte, ...)
        ...
    End Function

    PRINT Avg(3, 2.5, 3.6, 7.8)
    PRINT Avg(5, 1, 4, 5, 7, 9)
    This way, function AVG can receive any numbers of parameters of any type.
Meanwhile, you can download 1.2.7-r1866 here, as always: <!-- m --><a class="postlink" href="http://www.boriel.com/files/zxb">http://www.boriel.com/files/zxb</a><!-- m -->

Print this item

  SE Basic support
Posted by: cheveron - 12-11-2010, 11:25 PM - Forum: Wishlist - Replies (7)

Hi!

Thanks for the kind words on WoSF about SE Basic. It would be really cool if the compiler could:

* support the extra commands present in SE Basic

and also

* create code that runs with the SE Basic ROM used.

Happy to give whatever support you require to achieve one or both of these if you're interested.

Cheers!

-Andrew

Print this item

  Version 1.2.6 released!
Posted by: boriel - 12-10-2010, 09:48 PM - Forum: ZX Basic Compiler - Replies (4)

This release is just 1.2.6-r1812 renamed. I think it's quite stable now, and if new bugs are found, they will be fixed on 1.2.7.
So, those interested, please, download from: <!-- m --><a class="postlink" href="http://www.boriel.com/files/zxb">http://www.boriel.com/files/zxb</a><!-- m -->
This version finally implements bitwise operations (bAND, bOR, bXOR, bNOT) on any interger types (8, 16 and 32 bits). 8)

Thanks to Britlion, apenao, LCD, LTee, programandala & carloscomputer again (and maybe others, please priv. msg. me). They've detected many bugs again, but now I've started to use TDD (Unit Testing) to avoid already-fixed bugs to be reintroduced. Like the previous version, this one fixes so many that some parts has been completely rewritten. If you use any older version, do please upgrade to this one immediately. This version could be considered as another "Service Pack Update".

Changes since v.1.2.5
===================================
Assembler:

  • + The assembler now supports ALIGN <integer> directive
  • + Added support for checking out of memory in runtime.
  • + Added support for checking BREAK in runtime (--enable-break)
  • + Added support for Subscript Out of Range in runtime (--debug-memory)
  • + Added support for --strict-boolean (0 or 1) values (--debug-array)
  • + Added suport for 8 bit bitwise bAND, bOR, bXOR, bNOT operations.
  • + Added print64 by Britlion library routine, and Mojon Twins FourSpriter version (more to come).
Compiler:
  • + Added support for logical XOR (if A XOR B then...)
  • + Bitwise bAND, bOR, bXOR, bNOT finally added for 8, 16 and 32 bits
  • ! Fixed a bug in RANDOMIZE which wasn't updating the seed correctly.
  • ! Fixed a pragma typo in POS.bas library wich lead to errors.
  • ! Fixed a bug in STR$, VAL, CHR$ and CODE which could crash the program.
  • ! Fixed a bug in string comparison
  • ! Fixed 2 more bugs in the peephole optimizer (-O3) which could crash the program.
  • ! Fixed some syntax bugs. PI() and RND() are now allowed.
    Calling functions with no parenthesis is either.
  • ! Fixed a parser bug in which empty WHILE / DO .. LOOP loops crashed the compiler. Fixed.
  • ! Array access has been optimized for speed. Now faster.
  • ! For loops have been slightly optimized.
  • ! MEM_FREE heap routine has been slightly optimized.

  • * The print* intermediate code instructions have been removed and converted to routines.
  • * Lot of code refactoring, and moved to the standard trunk/tag/branches SVN repository scheme.
  • * String expresions now are standarized (like any other data type).
  • * TDD: Begin to create unitary tests cases for the compiler.

Print this item

  New beta release 1.2.6r1762
Posted by: boriel - 11-30-2010, 10:39 AM - Forum: Bug Reports - Replies (7)

This is a new beta version (released a minute ago :!Smile. Basically this is has *somewhat deep changes* in the code. So need you to test them, if possible, please :oops:

This release is needed in order to start the 2.0 branch. I also contains the print42 (fixed) and print64 by britlion, plus a fourspriter of MojonTwins (subdirectory /mj). Other graphic libraries posted here will be also included on later releases. But need more testing.

Download at <!-- m --><a class="postlink" href="http://www.boriel.com/files/zxb">http://www.boriel.com/files/zxb</a><!-- m --> as always...

Print this item