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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 310
» Latest member: ajuliayndext8922
» Forum threads: 1,069
» Forum posts: 6,406

Full Statistics

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

Latest Threads
Using constants not allow...
Forum: Bug Reports
Last Post: baltasarq
6 hours ago
» Replies: 5
» Views: 203
404 page not found
Forum: Documentation
Last Post: boriel
03-08-2025, 07:16 PM
» Replies: 5
» Views: 2,376
Spectrum keywords codes
Forum: Bug Reports
Last Post: boriel
03-08-2025, 11:00 AM
» Replies: 1
» Views: 123
ZXodus][Engine
Forum: ZX Basic Compiler
Last Post: boriel
02-19-2025, 11:43 PM
» Replies: 69
» Views: 207,348
Download links broken
Forum: Bug Reports
Last Post: xthunderheartx@gmail.com
02-18-2025, 02:41 PM
» Replies: 3
» Views: 439
Breaking loops
Forum: Bug Reports
Last Post: boriel
02-16-2025, 10:26 PM
» Replies: 9
» Views: 1,056
2D Array Errors
Forum: Bug Reports
Last Post: boriel
02-16-2025, 04:05 PM
» Replies: 1
» Views: 320
put small ASM programs li...
Forum: How-To & Tutorials
Last Post: funkheld
02-11-2025, 07:15 AM
» Replies: 5
» Views: 775
Filling drawings
Forum: Help & Support
Last Post: boriel
02-09-2025, 04:36 PM
» Replies: 3
» Views: 510
Headerless load routine i...
Forum: Help & Support
Last Post: Maywind
02-06-2025, 12:49 PM
» Replies: 2
» Views: 475

 
  Spectrum keywords codes
Posted by: Zoran - 03-07-2025, 08:01 PM - Forum: Bug Reports - Replies (1)

Hello,

The documentation for CHR function (https://zxbasic.readthedocs.io/en/latest/chr/) says that, although expanded, the function is 100% Sinclair basic compatible.
If it is so, then for the same parameters I'd expect the same output, not only for ascii letters, but also for sinclair basic keywords.

In Sinclair basic, this programme:

Code:
10 CLS
20 FOR i = 230 TO 250
30 PRINT CHR$ i
40 NEXT i

gives some Basic keywords in the output (see the attached image zxkeywords_sinclair.png).

.png   zxkeywords_sinclair.png (Size: 10.26 KB / Downloads: 39)

The equivalent programme in ZX Basic:
Code:
dim i as ubyte

cls
for i = 230 to 250
    print chr(i)
next

outputs some silly characters (see the attached image zxkeywords_boriel.png).

.png   zxkeywords_boriel.png (Size: 11.44 KB / Downloads: 31)

Compiled with:
Quote:..\..\zxbasic\zxbc.exe --optimize 2 --output zxkeywords.tzx --output-format tzx --BASIC --autorun --explicit --strict zxkeywords.bas

I'd say it is a bug.

Print this item

  Using constants not allowed in DATAs
Posted by: baltasarq - 03-03-2025, 09:10 PM - Forum: Bug Reports - Replies (5)

Hi!
Another bug or at least improvement, sorry!
When I create constants, such as:
const DCMD_EOD                            as ubyte = 100
const DCMD_LINE                           as ubyte = 101
const DCMD_CIRCLE                         as ubyte = 102
const DCMD_FILL                           as ubyte = 103
const DCMD_UDG                            as ubyte = 104

And then try to use them like so (initializer expression):
sub draw_presentation()
    dim pic_data(11) as ubyte => { _
        DCMD_Circle, 50, 180, 10,  _
        DCMD_Fill, 50, 180,        _
        DCMD_Circle, 100, 160, 25, _
        DCMD_EOD }
   
    draw_pic( pic_data )
end sub

Or maybe like so (DATAs):
LocPics:
    ' Loc 0 - Limbo
    data DCMD_Line, 0, 180, 250, 100, _
        DCMD_Line, 250, 180, 0, 100, _
        DCMD_EOD

    ' Loc 1 - Landing
    data DCMD_Circle, 50, 180, 10,  _
        DCMD_Fill, 50, 180,        _
        DCMD_Circle, 100, 160, 25,  _
        DCMD_EOD

I receive the following errors:
For the use of constants inside DATAs:
locs.bas:64: warning: [W100] Using default implicit type 'float' for 'DCMD_Line'
locs.bas:69: warning: [W100] Using default implicit type 'float' for 'DCMD_Circle'
locs.bas:70: warning: [W100] Using default implicit type 'float' for 'DCMD_Fill'

This doesn't make any sense, since they are defined as constants of type ubyte.
For the use of these constants inside the constant initializer for an array:
reveni.bas:14: error: Initializer expression is not constant.
reveni.bas:19: warning: [W100] Using default implicit type 'float' for 'pic_data'
reveni.bas:19: error: Invalid argument 'pic_data'

Again, this doesn't make any sense, since they are constants but the initializer expression is erroneously detected as non-constant.
Could this be solved?
Thanks,

Print this item

  Download links broken
Posted by: xthunderheartx@gmail.com - 02-17-2025, 02:03 AM - Forum: Bug Reports - Replies (3)

Hey I just tried to download (from all the links) and got nothing.  Links look good but boriel.com/files appears to be empty.  Is that right?  It's Sunday night so maybe it's maintenance?

Thanks - Dallas

Print this item

  2D Array Errors
Posted by: raymondlesley - 02-13-2025, 03:42 PM - Forum: Bug Reports - Replies (1)

I've been enjoying using ZX BASIC so far. It's great to have something that's easy to use (and in-keeping with the original Sinclair BASIC). I have come up against an issue which I can't find a solution for:

The compiler supports multi-dimensional arrays, but it throws an error if I attempt to get a "slice" of the data.

My code:

Code:
DIM data_array(0 TO 2, 0 TO 3) AS UByte = { _
    {0, 1, 2, 3}, {4, 5, 6, 7}, {8, 9, 10, 11} _
}

DIM element12 AS UByte = data_array(1, 2)

DIM element0(0 TO 3) AS UByte

element0 = data_array(0)  ' throws an error

I get no errors relating to element12
I would expect that element0 should result in {0, 1, 2, 3}. It's the right "shape". Instead I get an error:

Quote:
array_test.bas:9: error: Syntax Error. Unexpected token '(' <LP>

I've tried variants e.g. data_array(0, : ) or data_array(0,0 TO 3). Nothing seems to work.

I'm using ZX BASIC 1.17.2

Print this item

  Breaking loops
Posted by: baltasarq - 02-07-2025, 12:28 PM - Forum: Bug Reports - Replies (9)

Out of simple routine, I created a for loop like this:

Code:
for i = 0 to ubound(m)
    if m( i ) = 0
        break
    end if
next

At first, I did not understand what was happening. break was not working. But there was not any error or even a warning. Then I realized: break is not a part of Basic. It never was.
The strange point is the absence of any error or warning. Either this was included in the grammar by error, or maybe because it is planned for inclusion.
I don't know.

Print this item

  Filling drawings
Posted by: baltasarq - 02-07-2025, 12:16 PM - Forum: Help & Support - Replies (3)

There's no function or command "fill", allowing to pass two coordinates and making the computer to fill all delimited pixels with the current color.


Code:
circle 50, 50, 30
fill 50, 50

In the eighties, I used to fill a circle with a for loop:


Code:
circle 50, 50, 30
for i = 1 to 30
    circle 50, 50, i
next i
I suppose I could do something like this for rectangles, as well. This is, however, slow, ugly (certain pixels remain unplotted), and clumsy. Is there an alternate way?
Thanks,

Print this item

  put small ASM programs like bin in a bank 128 and call from basic
Posted by: funkheld - 02-06-2025, 10:24 AM - Forum: How-To & Tutorials - Replies (5)

hello, good day.

zxbasic:
put small ASM programs like bin in a bank(1,3,4,6)  from spectrum 128 and then call them from basic in the $c000 ?


how does that work please?



thanks.

Print this item

  Headerless load routine in ZX Basic
Posted by: Maywind - 02-04-2025, 05:19 AM - Forum: Help & Support - Replies (2)

Hello,
I'm trying to code a simple headerless LOAD routine in ZX Basic using the inline assembly feature of the compiler. The basic idea here is to write a function that uses assembly to set up the necessary registers and call the ROM routine 0556h for a headerless load (e.g. to load an extra level from the tape). I have some progress in this area, but it looks like I misunderstand how to clean up things correctly after the ROM routine returns and my function ends, so the poor Speccy either hangs or is reset after the code loading routine completes. I tried a few things so far, but the experiment that went the farthest so far is this one:

Code:
function hload(addr as uInteger, size as uInteger) as uByte
    asm
        pop hl
        pop de
        pop ix
        ld a, 255
        scf
        call 0556h
        push hl
    end asm
end function


The expected result is that calling this function, for instance, in this way:
Code:
hload(16384, 6912)

should be able to load standard ZX screen data correctly. Trying to load a screen this way indicates that the screen is indeed loaded into the right area of memory, but once the loading completes, the computer is reset.

I'm pretty sure that this indicates that something is screwed up at the end of the function call. Could be due to the fact that SP or something else is modified from within 0556h and that changes the register state, or something else along those lines, but I can't quite figure it out :/ I would appreciate some help since I'm not sure how to proceed. I tried a few other cleanup tricks, but none of them worked. 

Another question is: how do I properly return a value from this function? As far as I understand, the return value can be stored in the A register. Suppose I wanted to indicate that the tape loaded correctly with a value of 0, would I simply LD A, 0 at the end of the function and that would be enough? This, of course, is a separate issue once I can actually get this function to load anything without resetting the PC or hanging Smile

Thanks in advance.

Print this item

  Turn Off Keyword Hint
Posted by: ChewBakker - 01-30-2025, 12:00 PM - Forum: Help & Support - Replies (2)

Is it possible to turn off the Keyword hints in ZXBasicStudio ?

I can't see them in the dropdown popup, and it annoyingly makes entering code awkward.

Print this item

  Unable to see Key Words
Posted by: ChewBakker - 01-29-2025, 11:57 AM - Forum: Help & Support - Replies (1)

I had an issue with my Boriel that prevented me from using the debugger. This has been fixed with help from the forum and me installing the latest version of the Boriel ZXBasicStudio.

My issue now is that I can no longer see Key Words when entering code (see attachment). If anyone could help on this it would be highly appreciated.

I checked with the older version and that does show the KeyWords, but won't run in debug mode.



Attached Files
.jpg   key words.jpg (Size: 57.19 KB / Downloads: 76)
Print this item