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: desainrumahkeren
» Forum threads: 1,075
» Forum posts: 6,439

Full Statistics

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

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

 
  compiler bug
Posted by: slenkar - 04-13-2013, 03:23 PM - Forum: Help & Support - Replies (1)

having problems with imports
please download the project
<!-- m --><a class="postlink" href="http://www.4shared.com/zip/sBALDAkZ/wars.html">http://www.4shared.com/zip/sBALDAkZ/wars.html</a><!-- m -->

and compile wars.bas

it says the function findpath is not found but its in pathfinding.bas

also it says the error is in wars.bas on line 23

but its really in movingfunctions.bas

Print this item

  End if
Posted by: Darkstar - 04-12-2013, 04:22 PM - Forum: Wishlist - Replies (12)

Is there a way so you can write:

IF a = b THEN PRINT "A and B are equal";

Instead of:
IF a = b THEN PRINT "A and B are equal";: END IF

To keep compatibillty with the original ZX BASIC?

Then you will not have to change all of those IF/THEN lines in old sorce code, and also perhaps some kind of swithc or a #pragma directive so
you will not have to rewrite draw and plot commands while also keeping the new way of using those commands and then without the directive
of course.

The original BASIC version would also not allow to PLOT or DRAW on the bottom two lines.
Example:
PLOT x+100,y-100 ' original BASIC version
PLOT x+100,96-y ' zxb version

This would greatly simplify things and keep bugs to the minimum.

READ/RESTORE/DATA is not that important compared to the other stuff.

Print this item

  Save bug (*solved*)
Posted by: Darkstar - 04-11-2013, 05:52 PM - Forum: Bug Reports - Replies (20)

Code:
asm
jr ZXBASICBorielVersionEnd
db "ZX Boriel BASIC version 1.3.0-s979"
ZXBASICBorielVersionEnd:
end asm

SAVE "SAVETEST"CODE 49152,8192

Heap size is 256
-O0

When saved to a blank .TAP file and that file is loaded back then the result is: "Bytes: SAVETEST??"
This of course kills any possibillty of loading it back with: LOAD "SAVETEST"CODE

The bug is present as far as I know in versions 1.3.0-s924, 1.3.0-s967 and 1.3.0-s979.

Print this item

  Rotating some points , seems slow
Posted by: slenkar - 04-08-2013, 12:59 AM - Forum: Help & Support - Replies (9)

I was going to make a vector graphics game like asteroids but different
I rotated some points around an origin but even that seems too slow

I was going to draw lines between the points


Code:
#include <FSin.bas>


Dim trishipx(12) as UByte
Dim trishipy(12) as UByte
Dim drawtrishipx(12) as UByte
dim drawtrishipy(12) as UByte


trishipx(0)=62
trishipy(0)=58

trishipx(1)=58
trishipy(1)=58

trishipx(2)=58
trishipy(2)=62

trishipx(3)=58
trishipy(3)=54

trishipx(4)=60
trishipy(4)=58

trishipx(5)=60
trishipy(5)=62

Dim trishipangle as Integer

Function rotate(degrees as Integer) as Integer
dim transformedX as Ubyte=0
dim transformedY as ubyte=0
dim pointx as Ubyte=54
dim pointy as Ubyte=54
  for  x=0 to 5
'Local theta:Float=1
transformedX= fCos(degrees) * (trishipx(x)-pointx) - fSin(degrees) * (trishipy(x)-pointy) + pointx
transformedY = fSin(degrees) * (trishipx(x)-pointx) + fCos(degrees) * (trishipy(x)-pointy) + pointy
drawtrishipx(x) = transformedX
drawtrishipy(x) = transformedY
Next
return 1
End Function

Function drawship() as Integer


for x=0 to 5
plotPoint(drawtrishipx(x),drawtrishipy(x))
next

return 1
End Function

While 1


trishipangle=trishipangle+1
if trishipangle>360 then
trishipangle=0
end if


rotate(trishipangle)

drawship()

Wend



SUB plotPoint (x as uByte, y as uByte)
ASM
ld d,(IX+5) ;'X
ld e,(IX+7) ;'Y

    ld a, 191
   sub e  
   ret c  
   ld e, a  
   and a  
  
    rra      
   scf      
   rra      
   and a  
   rra      
   xor e        
   and 248
   xor e
   ld h, a
   ld a, d
   rlca
   rlca
   rlca
   xor e
   and 199
   xor e
   rlca
   rlca
   ld l, a
  
    ld a, d
   and 7
   ld b, a
   inc b
   ld a, 1
  
    plotPoint_loop:
        rrca
   djnz plotPoint_loop  
   ;cpl
    ld b, a  
   ld a, (hl)
   or b  
   ld (hl), a
  
END ASM
END SUB

Print this item

  ELSIF
Posted by: einar - 03-27-2013, 02:46 AM - Forum: Wishlist - Replies (5)

For instance, suppose a game with 5 levels of difficulty, that needs to perform certain tasks depending on this. In ZX BASIC it will look like this:

Code:
IF level = 1 THEN
    ...
ELSE
    IF level = 2 THEN
        ...
    ELSE
        IF level = 3 THEN
            ...
        ELSE
            IF level = 4 THEN
                ...
            ELSE
                ...
            END IF
        END IF
    END IF
END IF

My suggestion is to add a new keyword "ELSIF", so the code above could be simplified as follows:

Code:
IF level = 1 THEN
    ...
ELSIF level = 2 THEN
    ...
ELSIF level = 3 THEN
    ...
ELSIF level = 4 THEN
    ...
ELSE
    ...
END IF

I know this is not an important feature (the kind of stuff they call "syntactic sugar"), but since this is probably very easy to implement in the compiler and should be very convenient for several programs, I'm suggesting it anyway Smile

Print this item

  How to put zxbasic code in memory banks
Posted by: oblo - 03-09-2013, 09:00 PM - Forum: How-To & Tutorials - Replies (10)

Hi all

I'm testing and expanding this code (without the CLEAR command) from a post from speccy.org forum in order to test memory bank paging:

Code:
10 CLEAR 49151
20 POKE 23388,16: OUT 32765,16: POKE 50000,1
30 POKE 23388,17: OUT 32765,17: POKE 50000,2
40 POKE 23388,19: OUT 32765,19: POKE 50000,3
50 POKE 23388,20: OUT 32765,20: POKE 50000,4
60 POKE 23388,22: OUT 32765,22: POKE 50000,5
70 POKE 23388,16: OUT 32765,16: PRINT PEEK 50000
75 POKE 23388,17: OUT 32765,17: PRINT PEEK 50000
80 POKE 23388,19: OUT 32765,19: PRINT PEEK 50000
85 POKE 23388,20: OUT 32765,20: PRINT PEEK 50000
90 POKE 23388,22: OUT 32765,22: PRINT PEEK 50000

Poking&Peeking memory addresses are working ok, but I'd like to know is there is a way to "put" zxbasic code in the memory bank I want to and, if yes, how I can achieve it.

Thanks and regards

Print this item

  Reading, storing and writing screen values
Posted by: oblo - 03-05-2013, 05:33 PM - Forum: Help & Support - Replies (4)

Hi all

I'm starting to learn how to manipulate screen directly at memory address level. Right now, I'm messing with this code

Code:
rem screen values
paper 0: border 0: ink 7: cls
dim conta as byte
dim x,y,n,adres,dirb as uinteger


bucle:

y=RND*10
x=RND*32
adres=0
POKE attrAddress(x,y),RND*256

Print at 10,0; "X="; x; " - "; "Y="; y;
print at 11,0; "Attrib address is.......: "; attrAddress(x,y);
print at 12,0; "Attrib value is.........: "; PEEK attrAddress(x,y);
print at 13,0; "The 8 screen addresses..: "

for conta=0 to 7
        poke scrAddress(x,y)+adres,RND*256
        print scrAddress(x,y)+adres;","; PEEK (scrAddress(x,y)+adres)
        adres=adres+256
next conta

pause 0

cls

goto bucle


rem funciones

FUNCTION scrAddress(x AS UBYTE, y AS UBYTE) AS UINTEGER
ASM
; This FUNCTION returns the address into HL of the screen address
; x,y in character grid notation.
; Original CODE was extracted by BloodBaz

         ; x Arrives in A, y is in stack.
         AND     31
         ld      l,a
         ld      a,(IX+7) ; Y value
         ld      d,a
         AND     24
         add     a,64
         ld      h,a
         ld      a,d
         AND     7
         rrca
         rrca
         rrca
         OR      l
         ld      l,a
              
END ASM
END FUNCTION



FUNCTION attrAddress (x AS UBYTE, y AS UBYTE) AS UINTEGER
'This function returns the memory address of the Character Position
'x,y in the attribute screen memory.
'Adapted from code by Jonathan Cauldwell.
'Rebuilt for ZX BASIC by Britlion from NA_TH_AN's fourspriter, with permission.

ASM

         ld      a,(IX+7)  ;ypos
         rrca
         rrca
         rrca              ; Multiply by 32
         ld      l,a       ; Pass TO L
         AND     3         ; Mask with 00000011
         add     a,88      ; 88 * 256 = 22528 - start of attributes.
         ld      h,a       ; Put it in the High BYTE
         ld      a,l       ; We get y value *32
         AND     224       ; Mask with 11100000
         ld      l,a       ; Put it in L
         ld      a,(IX+5)  ; xpos
         add     a,l       ; Add it TO the Low BYTE
         ld      l,a       ; Put it back in L, AND we're done. HL=Address.
END ASM
END FUNCTION

Questions are:

- Are there any better options to read and write given a X and Y coordinates?
- What is the best way to storage screen memory addresses and their values? Integer (for addresses) and Ubyte (for values) arrays, right?

Thanks and regards

Print this item

  Parser bug (*solved*)
Posted by: einar - 02-26-2013, 04:16 PM - Forum: Bug Reports - Replies (4)

Trying to compile the following code:

Code:
#define BIFROSTstop() \
    asm               \
        call 65012    \
    end asm

10 PAUSE 0 : BIFROSTstop() : PAUSE 0
Produces the following error message:
Quote:illegal character ':'
However the following code compiles just fine:
Code:
#define BIFROSTstop() \
    asm               \
        call 65012    \
    end asm

10 PAUSE 0 : BIFROSTstop()
   PAUSE 0
This bug is relevant because BIFROST* interface library for ZX BASIC makes extensive use of defines as above, for performance reasons. I'm sure this is not the only case. Therefore I'm concerned about users getting confused by weird errors like this.

Print this item

  UDG definition bug (*solved*)
Posted by: wilco2009 - 02-20-2013, 10:55 PM - Forum: Bug Reports - Replies (10)

The ZXSpectrum hangs with the following code:

Code:
FOR n=0 TO 7: POKE USR "A"+n,255: NEXT n
FOR n=0 TO 7: POKE USR "B"+n,255: NEXT n
FOR n=0 TO 7: POKE USR "C"+n,255: NEXT n
FOR n=0 TO 7: POKE USR "D"+n,255: NEXT n
FOR n=0 TO 7: POKE USR "E"+n,255: NEXT n
FOR n=0 TO 7: POKE USR "F"+n,255: NEXT n

PRINT "\a \b \c \d \e \f"
Definition of UDG A & B works properly but program does not work from UDG C.

Print this item

  +3e FileBrowser
Posted by: BCH - 02-19-2013, 07:31 PM - Forum: Gallery - Replies (1)

Hello!

Im new in this forum.
First of all I would like to thanks to Boriel and the rest of the people involved in developing ZX Basic Compiler. Its really great!

Well, as the title says, Im writing a file browser/game launcher for the +3e (paired to an IDE device):
[Image: browserw.jpg]

Also I uploaded a video on u-tube:
http://www.youtube.com/watch?v=SfcJkIZXxnc

Its an early version, but the basic functionality is working (cat and load from the selected partition). It can load .BAS files as well as snapshots (Z80 and SNA).
The idea is to add some basic partition management features (create, erase, rename, copy files from one to the other)...will see if I can manage to code that.
The code is probably rough and needs some tweeks, which hopefully will do as I learn more about the Boriel's ZX Basic features.

Here you can download the first working version:
http://www.mediafire.com/?72j5rq70va99jij

And if someone is interested having the source just let me know. Its nothing fancy but I can post it here anyway.

Cheers!

Print this item