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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 259
» Latest member: DonaldDeade
» Forum threads: 1,074
» Forum posts: 6,434

Full Statistics

Online Users
There are currently 147 online users.
» 0 Member(s) | 146 Guest(s)
Bing

Latest Threads
.tap file code not execut...
Forum: Help & Support
Last Post: Zoran
04-28-2025, 10:59 AM
» Replies: 4
» Views: 321
Exit from more than one l...
Forum: Wishlist
Last Post: Duefectu
04-23-2025, 10:06 PM
» Replies: 3
» Views: 300
put small ASM programs li...
Forum: How-To & Tutorials
Last Post: Zoran
04-18-2025, 02:02 PM
» Replies: 6
» Views: 1,600
Creating +3 Menus - Loadi...
Forum: Help & Support
Last Post: merlinkv
04-16-2025, 02:08 PM
» Replies: 6
» Views: 555
Randomize not very random...
Forum: Help & Support
Last Post: Zoran
04-08-2025, 10:40 AM
» Replies: 4
» Views: 893
Scope rules
Forum: Bug Reports
Last Post: Zoran
04-04-2025, 09:46 AM
» Replies: 2
» Views: 330
Using constants not allow...
Forum: Bug Reports
Last Post: baltasarq
03-19-2025, 10:00 PM
» Replies: 8
» Views: 1,066
404 page not found
Forum: Documentation
Last Post: boriel
03-08-2025, 07:16 PM
» Replies: 5
» Views: 2,887
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,809

 
  STELA
Posted by: JBGV - 07-15-2011, 08:47 PM - Forum: Gallery - Replies (1)

13/7/2011


Hello all again.

See what you think of this second game. I hope you like.

Compiled with V.1.2.8.696 => zxb --org=28000 STELA.bas -T -B –a


GAME AND CODE:



.zip   STELA.zip (Size: 32.32 KB / Downloads: 961)


We go to the beach for a few days ¡¡ , see you soon

Print this item

  RETROBSESION
Posted by: JBGV - 07-15-2011, 08:43 PM - Forum: Gallery - No Replies

27/04/2011

Hola a todos, ya terminé mi primer programa (por llamarlo de alguna manera), no es que sea una gran cosa pero me lo he pasado muy bien haciéndolo. Lo compilo con la versión 1.2.6, con la 1.2.8 algunas sentencias iban demasiado rápido y tendría que ajustarlas.



google translate

Hi all, I finished my first program (call it that), is not it a great thing but I had a great time doing it. I compiled with version 1.2.6, with 1.2.8 some sentences were too fast and would be adjusted.


.rar   RETROBSESION.rar (Size: 34.9 KB / Downloads: 294)

Print this item

  Please re-post
Posted by: boriel - 07-15-2011, 07:43 PM - Forum: Gallery - No Replies

If you have done something and posted it in the "Show off..." thread, you can re-post it now in this sub-forum in a *SINGLE* post, so each program can have its own thread and we can discuss it in a more readable fashion.

Print this item

  B Integer out of range
Posted by: oblo - 07-12-2011, 05:38 PM - Forum: Help & Support - Replies (8)

Hi all

First of all, I'd like to introduce myself. I'm new at this forum but I visit it always I have a doubt about the ZX Basic Compiler.

Now, I'm compiling a large basic program (about 37k) and while the execution in Basic is OK, when I compiled it in a .tzx and try to load it in an emulator, at the end of the load the error B Integer out of range, 30:1 is showed.
The info of the CODE block is 32768,37229 and here is the basic code of the loader:
10 CLEAR 32767
20 LOAD""CODE
30 RANDOMIZE USR 32768

Should I suppose that the program is too big?

Thanks and regards

Print this item

  Returning to basic do not run PRINT.(*solved*)
Posted by: compiuter - 07-01-2011, 05:00 PM - Forum: Bug Reports - Replies (5)

I was testing an attr routine. I launch it with pokeing it and randomize usr 60000.
When returns to basic, the problem is if I put a single print, then returns out of memory.
Not this if I put a print at.
I think the compiler affects to variables ch add or something.

Code:
Sub GetAddrTileFull(y, x, buf)
      Dim attraddr as UInteger
      attradr = AttrAddr(y, x)
      POKE buf,peek(attradr-32)
      POKE buf+1,peek(attradr-31)
      POKE buf+2,peek(attradr-30)
      POKE buf+3,peek(attradr+2)      
      POKE buf+4,peek(attradr+34)
      POKE buf+5,peek(attradr+34+32)
      POKE buf+6,peek(attradr+34+31)
      POKE buf+7,peek(attradr+34+30)
      POKE buf+8,peek(attradr+34+29)
      POKE buf+9,peek(attradr+2+29)
      POKE buf+10,peek(attradr-1)
      POKE buf+11,peek(attradr-33)
  End Sub
Dim x,y as uinteger
x=peek 23421
y=peek 23422
GetAddrTileFull(y,x,23400)
command line:
zxb attr1a.bas -T -B -a -Z -O1 --org 32768

Regards.

Print this item

  Out of memory when using uinteger array (*solved*)
Posted by: Darkstar - 06-08-2011, 07:14 PM - Forum: Bug Reports - Replies (21)

Code:
' tn = TriangleNumber, mt = MaximumTriangles (# of), rn = RandomNumber, GraphicWidth, GraphicHeight, zn = ZeroNumber (Modifier) 'DIM udg(7) AS UBYTE => {0,1,3,7,15,31,63,127}
INK 6: PAPER 1: FLASH 0: BRIGHT 1: OVER 0: INVERSE 0: DIM tn, mt, rn, gw, gh, znw, znh AS UBYTE: DIM x(4,4) AS UINTEGER: DIM y(4,4) AS UINTEGER
'DIM x(4,4) AS FLOAT: DIM y(4,4) AS FLOAT
tn=0: mt=0: rn=0: znw=0: znh=16
gw=255: gh=175+znh: BORDER 1: CLS: PRINT AT 10,5;"The Sierpinski Triangle";: tn=1: mt=4 '256-1 '176-1
x(tn,1)=znw: y(tn,1)=znh: x(tn,2)=gw/2: y(tn,2)=gh: x(tn,3)=gw: y(tn,3)=znh: GOSUB FirstPoint: tn=tn+1
x(tn,1)=znw: y(tn,1)=gh: x(tn,2)=gw/2: y(tn,2)=znh: x(tn,3)=gw: y(tn,3)=gh: GOSUB FirstPoint: tn=tn+1
x(tn,1)=znw: y(tn,1)=gh: x(tn,2)=gw: y(tn,2)=gh/2: x(tn,3)=znw: y(tn,3)=znh: GOSUB FirstPoint: tn=tn+1
x(tn,1)=gw: y(tn,1)=gh: x(tn,2)=znw: y(tn,2)=gh/2: x(tn,3)=gw: y(tn,3)=znh: GOSUB FirstPoint
tn=1: PRINT AT 12,4;"Press any key to continue";
ScanAnyKey:
IF INKEY$="" THEN GO TO ScanAnyKey: END IF
RANDOMIZE : CLS
DrawTriangles:
rn=INT (RND*3)+1
x(tn,4)=(x(tn,4)+x(tn,rn))/2
y(tn,4)=(y(tn,4)+y(tn,rn))/2
PLOT x(tn,4),y(tn,4)
tn=tn+1: IF tn>mt THEN tn=1: END IF
GO TO DrawTriangles
FirstPoint:
x(tn,4)=x(tn,2): y(tn,4)=y(tn,2): RETURN

This crashes after a few pixels drawn with an out of memory error while if you use float it works fine under
the latest version of the compiler. In version 1.2.6 uinteger works without a hitch. The compilation options are:
zxb Triangles.bas --optimize=2 --output=TRIANGLES.ASM --asm --org=24576 --array-base=1 --string-base=1 --heap-size=1024
zxbasm TRIANGLES.ASM --output=TRIANGLES --tap --BASIC --autorun

On to another subject, what is the correct syntax for "DIM udg(7) AS UBYTE => {0,1,3,7,15,31,63,127}"
as a multidimensional array? I tried "DIM ma(2,2) AS UBYTE => {1,4,6,2,0,55}" but it did not work.

Print this item

  Oh oh
Posted by: Graeme - 06-04-2011, 03:17 PM - Forum: Help & Support - Replies (12)

Hola all,

First off, before I forget, the contact form on boriel.com is broken, complains about not being able to call the WPsend function (with the latest IE and firefox beta 7)

Well, I used to program C++ for a living but my programming days are long gone.. I can't even get the compiler to work, I installed Python but I have no idea how to get it up and running.

I have a short ZXS program in basic - could I please send some kind person the text (10 lines of code or so) and you compile it and return a ZX Spectrum tape file?

I'd be so grateful! Thanks!!

Graeme

Print this item

  Calling non-ZXB code with RANDOMIZE USR
Posted by: LTee - 05-13-2011, 02:11 PM - Forum: Help & Support - Replies (13)

Hi all, it's been a while but I've been kind of busy. :-)

My game project is almost complete, I just wanted to add some music. I wrote a couple of (quite bad) tunes with Beepola, compiled with the Music Box engine. I've loaded these high into memory (64000 up), well away from my ZXB code and I'm calling them with 'randomize usr X' from within ZXB. The player is configured to play the tune once and then return control to the caller.

I'm having a small problem that I can get around, but I wanted to ask about. If I call the music player from within a SUB or a FUNCTION, the Spectrum crashes after playing the tune. If I call it from OUTSIDE a SUB or FUNCTION (i.e. just from within the main code) then it returns fine.

For example:

Code:
cls
pause 0
print "test"
randomize usr 64000
pause 0
print "test 2"
test()
stop

SUB test()
    randomize usr 64000
END SUB

In the above code (surmising that the player is loaded at 64000), the tune plays and returns correctly after "test" is printed, but crashes after playing the tune after "test2" is printed.

Is calling external code via "randomize usr" actually supported? It's not in the Wiki, so I'm thinking 'not'. If it is supported, is there something else I should be doing before making such a call? Or is there a better way of doing this?

My main concern is that the call which appears to be working is actually doing something bad that I'm just not seeing immediately and might cause unexpected problems later.

Thanks for any insights! :-)

Print this item

  GOTO (arithmetical expression)
Posted by: JBGV - 05-09-2011, 08:23 PM - Forum: Help & Support - Replies (2)

Hello!

Could anyone tell me how I can simulate "GOTO (arithmetical expression)":

ex:

Code:
N can have a value between 1 and 20

GOTO (1000+(N*10))

I need to assign values ​​to an array depends on the value "N", I had thought something like this:

Code:
ASM
ORG 62000
DEFB 12,5,8,11,12,11,4,11,(...)      
END ASM

DIM P(7) AS UBYTE

...

N=20

...

FOR B=0 TO 7
P(B)=PEEK (62000+N+B)
NEXT B

Is this efficient?

Is there a danger that the program itself erase the data stored at positions 62000?

THANKS

Print this item

  Simple RLE Decompressor
Posted by: LCD - 04-29-2011, 11:47 PM - Forum: Wishlist - Replies (5)

Maybe not a bad idea: a decompress function for RLE encoded binaries (starting with dbyte contains length of compressed and a flag byte). Maybe something like UnRLE(sourceaddress,destinationaddress) returning the length of decompressed bytes or alternative, if the starting bytes are missing: UnRLE(sourceaddress,destinationaddress,length,flagbyte), or even with bank switching management. This will allow to pack more graphical and level-data into our programs. Maybe a job for britlion, to write a fastcall routine? This can be used for all Z80 computers then.

Print this item