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 333 online users.
» 0 Member(s) | 331 Guest(s)
Bing, Google

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

 
  Space Worm
Posted by: emook - 11-15-2018, 12:32 AM - Forum: Gallery - Replies (1)

Just some fun little code.


Code:
' SpaceWorm - em00k
' David Saphier 2018

paper 0 : ink 0: cls :border 0
dim c,sc as uinteger
dim a as float

' Fill screen with some Graphics

for n=1 to 192

    print inverse 0;"\.' ";
    print inverse 1;"\.' ";
    
Next

a=1 : ad=1

do
    
    ' draws a line of attribs at X=26 Y+7 colour blue (1)
    for y=1 to 7
        poke 22528+26+(y<<5),1
    next
    
    ' reads the sin data from sinpos+c and pops into cc
    cc=peek(@sinpos+c)+1
    
    ' get the current colour and make sure its *8 so it affects the paper
    ic=i<<3
    
    ' draw the colour ic at X=26 and Y+cc
    poke 22528+26+((15-cc)<<5),ic
    poke 22528+26+((16-cc)<<5),ic
    
    ' increase c to for reading sintable
    c=c+ad
    
    ' if its bigger than 60, reset the position
    if c>60
        c=0
    endif
    
    ' increase mc, used for setting speed
    mc=mc+1

    if mc>10
        ' mc was 10 to now we make ad = (speed+sc)
        ad=peek(@speed+sc) : sc=sc+1 : mc=0
        
        if sc>13 : sc=0 :    endif     
        
    endif
    
    ' fractional for slower colour changes
    a=a+.75
    
    if a>1
        i=i+1 : a=0
        if i>7 : i=1 : endif        
    endif

    pause 2

    asm
        ; code for copying the attribs from right to left
        lin equ 4
        len equ 26
        
        ld hl,22529+lin+32
        ld de,22528+lin+32
        ld bc,len
        ldir
        
        ld hl,22529+lin+32+32
        ld de,22528+lin+32+32
        ld bc,len
        ldir
        
        ld hl,22529+lin+32+32+32
        ld de,22528+lin+32+32+32
        ld bc,len
        ldir
        
        ld hl,22529+lin+32+32+32+32
        ld de,22528+lin+32+32+32+32
        ld bc,len
        ldir
        
        ld hl,22529+lin+32+32+32+32+32
        ld de,22528+lin+32+32+32+32+32
        ld bc,len
        ldir
        ld hl,22529+lin+32+32+32+32+32+32
        ld de,22528+lin+32+32+32+32+32+32
        ld bc,len
        ldir
        
        ld hl,22529+lin+32+32+32+32+32+32+32
        ld de,22528+lin+32+32+32+32+32+32+32
        ld bc,len
        ldir
    end asm

loop

cols:
asm
    db 6,6,6,6,6,2
    db 70,68,6,6,6,2
    db 3,4,5,6,6,2
    db 6,6,6,6,6,2
    db 3,4,5,6,6,2    
end asm

sinpos:
asm
    db 2,2,2,1,1,1,1,1,0,0,0,0,0,0,0,0
    db 0,0,0,0,0,0,0,0,0,1,1,1,1,1,2,2
    db 2,2,3,3,3,3,3,4,4,4,4,4,4,4,4,4
    db 4,4,4,4,4,4,4,4,3,3,3,3,3,2,2,2
end asm

speed:
asm
    db 1,1,2,3,4,5,6,5,4,3,2,1,1
end asm

Print this item

  Mirror a sprite
Posted by: oblo - 11-14-2018, 04:34 PM - Forum: Help & Support - Replies (9)

Hi all

Trying to save some UDGs, I'm looking for a way to mirror an existing sprite/UDG, so I only have to define them one way (i.e. facing sprites left) and, with a function, use those sprites to print them facing right.
I was toying with the hmirror function (<!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:HMirror.bas">http://www.boriel.com/wiki/en/index.php ... Mirror.bas</a><!-- m -->) but I can't get it to work Undecided

Thanks and cheers.

Print this item

  Possible array bug in version 1.8.8 (*solved*)
Posted by: oblo - 11-08-2018, 06:21 PM - Forum: Bug Reports - Replies (8)

Hi all

I think I've just found a bug in 1.8.8 (or just my Spectrum emulators doesn't work any more); please, look at this piece of code:

Code:
paper 0: border 0: bright 1: ink 7: cls

DIM y as byte

dim testarray(4,2) as byte
print at 0,0; "Creacion de testarray OK";

for y = 0 to 4
    testarray(y,0) = 0
    testarray(y,1) = 1
    testarray(y,2) = 2
next y
print at 1,0; "Inicializacion de testarray OK";

for y = 0 to 4
    print at y+5,0; testarray(y,0);
next y
print at 2,0; "Lectura de valores OK";

If I compile the code without the --debug-array parameter, the code works well; but if the --debug-array parameter is used, the Spectrum can create the "testarray" array, but it can't initialize the arrays values, giving a 3 Subscript wrong, 40:1 error. Array-base is 0, heap-size is 4768 and ORG is 24576, but tried with other values and still fails.
[Image: good.jpg] [Image: errore.jpg]

Any ideas? Thanks and cheers.

Print this item

  Evaluate if one variable has several values
Posted by: oblo - 11-08-2018, 08:08 AM - Forum: Help & Support - Replies (3)

Hi all

Instead of...

Code:
IF var = 1 OR var = 2 OR var = 3 OR var = 4 THEN

... is there any way to achieve the same in a more efficient way? Something like that:

Code:
IF var = (1 OR 2 OR 3 OR 4) THEN

Thanks in advance and cheers

Print this item

  OVER - how it works?
Posted by: oblo - 11-04-2018, 05:57 PM - Forum: ZX Basic Compiler - Replies (2)

Hi all

While testing my last game, I come with some issue that makes me wonder if I understood well how OVER works. AFAIK, OVER 0 is the default mode, so if I have...

Code:
OVER 1
PRINT "Hello";
OVER 0

... last OVER 0 will affect all screen and all PRINT, DRAW, CIRCLE, PLOT commands? Affect sprites that are already draw in screen? I had a strange behaviour with the sonar so I had to make a workaround. Anyway, I'd like to know how OVER really works.

Thanks and cheers.

Print this item

  Cargas de Produndidad / Depth Charge
Posted by: oblo - 11-04-2018, 05:47 PM - Forum: Gallery - Replies (12)

Hi all, long time no see Smile

Thanks to some spare time, I had the opportunity to retake the speccy programming, so here is my last creation: a clone of the Depthcharge arcade game. Nothing fancy, but at least I could have some fun developing for ours old but reliable Spectrums.
Game mechanic is simple: move your ship left and right and drop charges to destroy submarines, while avoiding their missiles. Number of submarines and missiles can be chosen at each game start.
[Image: Capture.jpg]


The file attached contains:
- .TAP Spanish version
- .TAP English version
- Source code for both versions
- A 'readme.txt' file

Hope you enjoy and as always, any comments are welcome. Cheers!



Attached Files
.7z   Cargas-Depthcharge.7z (Size: 13.15 KB / Downloads: 826)
Print this item

  Compiling +D G+DOS programs
Posted by: merlinkv - 10-28-2018, 07:40 PM - Forum: ZX Basic Compiler - Replies (4)

Hello.

I have a lot of programs written in the +D G+DOS, but I have problems when I try to compile commands like: LOAD D*"filename" or LOAD d1"filename".

None of the commands to load or save files, or format disks, can be compiled.

The +D ROM is completely disassembled (<!-- m --><a class="postlink" href="http://www.biehold.nl/rudy/plusd/plusd.htm">http://www.biehold.nl/rudy/plusd/plusd.htm</a><!-- m -->) but I don't have the knowledge to work from Basic with the +D "Machine Code".

Maybe it's possible to add in the future some options in the ZX Basic Compiler to allow work with G+DOS programs?

Thanks Smile

Print this item

  ¿Qué tutorial se me recomienda para empezar a usar ZXBasic?
Posted by: Turriano - 10-14-2018, 04:39 PM - Forum: How-To & Tutorials - Replies (1)

Y ya puestos a pedir, si puede ser en español mejor B-)

---------------------------------------------------------------------------------

And already put to ask, if it can be in Spanish better B-)

Print this item

  bug on "if", "end if", etc.?
Posted by: nitrofurano - 09-30-2018, 12:15 PM - Forum: Help & Support - Replies (1)

when trying to compile this code on 1.8.8:

Code:
dim i as ubyte
i=3
if i>2 then:
  print "3>2"
  end if
do:loop

i get this error message when compiling
Code:
endifbug.bas:5: Syntax Error. Unexpected token 'IF' <IF>

on other few tests i tried, the same happened on "end if"

Print this item

  bug on --org command line argv, missing hex address support
Posted by: nitrofurano - 09-29-2018, 11:03 AM - Forum: Bug Reports - Replies (2)

Since always i used hex values on --org command line argument (zxb.py), it always worked until few months ago - like:
zxb.py code.bas --org=0xC000

Now, since it stopped working, i had to fix all the code i had to something like:
zxb.py code.bas --org=$((0xC000))
(i only tested it on Ubuntu GNU/Linux - i have no idea how fine it works on other operating systems and distributions)

i have no idea what caused that... perhaps some code cleanup on ZX-Basic Compiler? or something else?

Print this item