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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 258
» Latest member: manuelzo75
» Forum threads: 1,074
» Forum posts: 6,434

Full Statistics

Online Users
There are currently 185 online users.
» 0 Member(s) | 182 Guest(s)
Applebot, Bing, Google

Latest Threads
.tap file code not execut...
Forum: Help & Support
Last Post: Zoran
04-28-2025, 10:59 AM
» Replies: 4
» Views: 319
Exit from more than one l...
Forum: Wishlist
Last Post: Duefectu
04-23-2025, 10:06 PM
» Replies: 3
» Views: 299
put small ASM programs li...
Forum: How-To & Tutorials
Last Post: Zoran
04-18-2025, 02:02 PM
» Replies: 6
» Views: 1,597
Creating +3 Menus - Loadi...
Forum: Help & Support
Last Post: merlinkv
04-16-2025, 02:08 PM
» Replies: 6
» Views: 554
Randomize not very random...
Forum: Help & Support
Last Post: Zoran
04-08-2025, 10:40 AM
» Replies: 4
» Views: 892
Scope rules
Forum: Bug Reports
Last Post: Zoran
04-04-2025, 09:46 AM
» Replies: 2
» Views: 328
Using constants not allow...
Forum: Bug Reports
Last Post: baltasarq
03-19-2025, 10:00 PM
» Replies: 8
» Views: 1,065
404 page not found
Forum: Documentation
Last Post: boriel
03-08-2025, 07:16 PM
» Replies: 5
» Views: 2,886
Spectrum keywords codes
Forum: Bug Reports
Last Post: boriel
03-08-2025, 11:00 AM
» Replies: 1
» Views: 419
ZXodus][Engine
Forum: ZX Basic Compiler
Last Post: boriel
02-19-2025, 11:43 PM
» Replies: 69
» Views: 213,807

 
  ELSE issue? (*solved*)
Posted by: LTee - 02-23-2011, 04:29 PM - Forum: Bug Reports - Replies (12)

Have you had enough of me yet? :-D

I'm having a weird issue with ELSE, but I'm not sure if I'm doing something wrong or not. Take a look at this test program:

Code:
dim num as ubyte

cls
num = 1
test()
num = 2
test()
num = 3
test()
num = 4
test ()

sub test
    IF num = 1 THEN
        PRINT "1"
    ELSEIF num = 2 THEN
        PRINT "2"
    ELSEIF num = 3 THEN
        PRINT "3"
    ELSE
        PRINT "X"
    END IF
    PRINT "---"
end sub

I would expect the output from this to be like this:
Code:
1
---
2
---
3
---
X
---

But it's actually like this:
Code:
1
---
2
---
3
X
---
X
---

Condition "3" is running correctly, but the final ELSE block is also being processed so you get two lines output if num is 3. Have I messed up the syntax there? The behaviour is certainly different to how it used to be, as an old program that used to be okay is now failing.

I've tried this in 2100 and also 1866 and it does the same in both, so it must've been a while since I compiled it! :-)

Print this item

  Small brackets-parsing glitch (*solved*)
Posted by: LTee - 02-23-2011, 01:38 PM - Forum: Bug Reports - Replies (5)

Messing around with some of my other code over lunchtime with the latest beta (2100), I discovered a small error when parsing brackets.

Take a look at this code:

Code:
DIM test(10, 10) as UBYTE
DIM x as UBYTE
DIM y as UBYTE

x = 5
y = 5

PRINT test(x - 1, y)
PRINT test((x - 1), y)
PRINT test(x, y - 1)
PRINT test(x, (y - 1))

The final PRINT statement will not compile unless you remove the brackets from around the (y - 1). Strangely, the brackets seem to be okay if we're dealing with the first dimension of the array (so it's okay to have 'x - 1' in brackets), just not for the second. :-)

Print this item

  array bounds must be constant
Posted by: slenkar - 02-22-2011, 05:02 PM - Forum: Help & Support - Replies (11)

How do I create an array with an integer instead of a literal number?

I want to do this:

Code:
DIM personX (numPersons) as ubyte
DIM personY (numPersons) as ubyte
DIM personHealth (numPersons) as ubyte
DIM personWeapon (numPersons) as ubyte

instead of:
Code:
DIM personX (6) as ubyte
DIM personY (6) as ubyte
DIM personHealth (6) as ubyte
DIM personWeapon (6) as ubyte
just in case I decide to change my mind about the number of persons

Print this item

  UDG problem
Posted by: slenkar - 02-22-2011, 04:32 PM - Forum: Help & Support - No Replies

I have 2 graphics
factory.bin and select.bin

factory is 17 bytes and select.bin is 9 bytes

When I put include select.bin first the graphics work
but when i include factory.bin first the select.bin graphic is not shown on screen, it is just blank

both were created and exported from sevenup sprite editor.

Print this item

  too fast :)
Posted by: slenkar - 02-22-2011, 12:48 AM - Forum: Help & Support - Replies (8)

i have a cursor that i move around the screen with the keys but its too fast

when i press "p" it shoots half way across the screen, how do i make it move 1 square every half a second

Print this item

  clear ink from attr
Posted by: slenkar - 02-22-2011, 12:36 AM - Forum: Help & Support - Replies (6)

How do you use print to remove all ink from an attribute (8*8 square)

the opposite is 'print /::' to draw a block but i want to clear all ink away and leave the paper

Print this item

  Psyco for Python
Posted by: slenkar - 02-21-2011, 11:11 PM - Forum: Wishlist - Replies (2)

<!-- m --><a class="postlink" href="http://psyco.sourceforge.net/">http://psyco.sourceforge.net/</a><!-- m -->

Would this speed up compilation?

Print this item

  Vim users
Posted by: slenkar - 02-21-2011, 10:57 PM - Forum: Help & Support - Replies (1)

I can highlight the syntax but how do people use the zxb.exe compiler with vim?

Print this item

  compiler error (*solved*)
Posted by: slenkar - 02-21-2011, 12:00 AM - Forum: Bug Reports - Replies (3)

i tried a simple program:

print "l"

and here is the output

Building file - wars.bas...
DOS: C:\Boriel Tm\ZX Basic Compiler\zxb.exe -T -B -a wars.bas
Traceback (most recent call last):
File "zxb.py", line 310, in <module>
File "zxb.py", line 244, in main
File "zxbtrad.pyc", line 1285, in traverse
File "zxbparser.pyc", line 823, in __get_type
AttributeError: 'SymbolSENTENCE' object has no attribute '_type'

Print this item

  Good song
Posted by: slenkar - 02-19-2011, 07:35 PM - Forum: Off-Topic - No Replies

<!-- m --><a class="postlink" href="http://www.youtube.com/watch?v=Wg7l2wKb3aA">http://www.youtube.com/watch?v=Wg7l2wKb3aA</a><!-- m -->

Print this item