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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 260
» Latest member: Ra001
» Forum threads: 1,073
» Forum posts: 6,437

Full Statistics

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

Latest Threads
Strange Happenings
Forum: Bug Reports
Last Post: boriel
05-23-2025, 09:15 AM
» Replies: 4
» Views: 1,834
.tap file code not execut...
Forum: Help & Support
Last Post: Zoran
04-28-2025, 10:59 AM
» Replies: 4
» Views: 2,017
Exit from more than one l...
Forum: Wishlist
Last Post: Duefectu
04-23-2025, 10:06 PM
» Replies: 3
» Views: 1,678
put small ASM programs li...
Forum: How-To & Tutorials
Last Post: Zoran
04-18-2025, 02:02 PM
» Replies: 6
» Views: 4,068
Creating +3 Menus - Loadi...
Forum: Help & Support
Last Post: merlinkv
04-16-2025, 02:08 PM
» Replies: 6
» Views: 2,824
Randomize not very random...
Forum: Help & Support
Last Post: Zoran
04-08-2025, 10:40 AM
» Replies: 4
» Views: 2,694
Scope rules
Forum: Bug Reports
Last Post: Zoran
04-04-2025, 09:46 AM
» Replies: 2
» Views: 1,444
Using constants not allow...
Forum: Bug Reports
Last Post: baltasarq
03-19-2025, 10:00 PM
» Replies: 8
» Views: 3,614
404 page not found
Forum: Documentation
Last Post: boriel
03-08-2025, 07:16 PM
» Replies: 5
» Views: 4,675
Spectrum keywords codes
Forum: Bug Reports
Last Post: boriel
03-08-2025, 11:00 AM
» Replies: 1
» Views: 1,159

 
  Pass an array as a parameter?
Posted by: LTee - 02-24-2011, 02:46 PM - Forum: Help & Support - Replies (3)

A question today, rather than a bug. :-)

Is it possible to pass an array as a parameter to a function or a sub?

And if so, does the function/sub receive a copy of the array or a pointer to the original? i.e. if I made changes to the array within a function, would those changes be local to the function or would they also be visible from the calling method?

Print this item

  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