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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 279
» Latest member: imd
» Forum threads: 1,089
» Forum posts: 6,493

Full Statistics

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

Latest Threads
zxmoria, a port of umoria
Forum: Gallery
Last Post: sdo303
2026-10-23, 05:46 PM
» Replies: 1
» Views: 263
zxpaging
Forum: Gallery
Last Post: sdo303
2026-10-18, 12:12 PM
» Replies: 0
» Views: 177
GuSprites
Forum: Help & Support
Last Post: zedex82
2026-06-19, 06:39 PM
» Replies: 2
» Views: 746
New video Couse / Nuevo c...
Forum: News
Last Post: Duefectu
2026-04-29, 11:02 PM
» Replies: 0
» Views: 3,063
location of heap manageme...
Forum: Help & Support
Last Post: boriel
2026-03-07, 12:13 AM
» Replies: 1
» Views: 1,146
non-paged supervisor code...
Forum: Help & Support
Last Post: sdo303
2026-02-20, 06:38 PM
» Replies: 8
» Views: 2,545
How to open fuse as an ex...
Forum: How-To & Tutorials
Last Post: Duefectu
2026-02-09, 01:52 PM
» Replies: 3
» Views: 2,136
Old zxbasic game errors
Forum: Help & Support
Last Post: boriel
2025-11-09, 11:52 AM
» Replies: 7
» Views: 3,045
Error: Undefined GLOBAL l...
Forum: Help & Support
Last Post: ardentcrest
2025-11-04, 05:46 PM
» Replies: 3
» Views: 1,777
A Fast(er) Plot Routine f...
Forum: How-To & Tutorials
Last Post: tubz74
2025-10-30, 03:16 PM
» Replies: 2
» Views: 1,825

 
  Compiler crash (solved)
Posted by: baltasarq - 2024-12-15, 09:54 PM - Forum: Bug Reports - Replies (3)

I've run into a crash while compiling my project:

Code:
$ python ~/bin/zxbasic/zxbc.py --tap --BASIC --autorun reveni.bas /home/baltasarq/bin/zxbasic/src/lib/arch/zx48k/stdlib/keys.bas:50: warning: [W150] Parameter 'scancode' is never used /home/baltasarq/bin/zxbasic/src/lib/arch/zx48k/stdlib/print64.bas:20: warning: [W150] Parameter 'characters' is never used cmd.bas:41: warning: [W150] Parameter 'cmd' is never used io.bas:222: warning: [W100] Using default implicit type 'float' for 'current_loc' /home/baltasarq/bin/zxbasic/src/lib/arch/zx48k/stdlib/keys.bas:51: warning: [W190] Function 'MultiKeys' should return a value /home/baltasarq/bin/zxbasic/src/lib/arch/zx48k/stdlib/keys.bas:72: warning: [W190] Function 'GetKeyScanCode' should return a value objs.bas:88: warning: [W170] Function 'get_objs_in' is never called and has been ignored /home/baltasarq/bin/zxbasic/src/lib/arch/zx48k/stdlib/keys.bas:50: warning: [W170] Function 'MultiKeys' is never called and has been ignored /home/baltasarq/bin/zxbasic/src/lib/arch/zx48k/stdlib/keys.bas:71: warning: [W170] Function 'GetKeyScanCode' is never called and has been ignored /home/baltasarq/bin/zxbasic/src/lib/arch/zx48k/stdlib/string.bas:29: warning: [W170] Function 'mid' is never called and has been ignored /home/baltasarq/bin/zxbasic/src/lib/arch/zx48k/stdlib/string.bas:40: warning: [W170] Function 'left' is never called and has been ignored /home/baltasarq/bin/zxbasic/src/lib/arch/zx48k/stdlib/string.bas:51: warning: [W170] Function 'right' is never called and has been ignored /home/baltasarq/bin/zxbasic/src/lib/arch/zx48k/stdlib/string.bas:98: warning: [W170] Function 'strpos' is never called and has been ignored /home/baltasarq/bin/zxbasic/src/lib/arch/zx48k/stdlib/string.bas:124: warning: [W170] Function 'ucase2' is never called and has been ignored /home/baltasarq/bin/zxbasic/src/lib/arch/zx48k/stdlib/string.bas:174: warning: [W170] Function 'ucase' is never called and has been ignored /home/baltasarq/bin/zxbasic/src/lib/arch/zx48k/stdlib/string.bas:249: warning: [W170] Function 'ltrim' is never called and has been ignored /home/baltasarq/bin/zxbasic/src/lib/arch/zx48k/stdlib/string.bas:275: warning: [W170] Function 'rtrim' is never called and has been ignored /home/baltasarq/bin/zxbasic/src/lib/arch/zx48k/stdlib/string.bas:304: warning: [W170] Function 'trim' is never called and has been ignored util.bas:47: warning: [W170] Function 'testMultiplyStr' is never called and has been ignored util.bas:57: warning: [W170] Function 'testFormatStr' is never called and has been ignored Traceback (most recent call last):   File "/home/baltasarq/bin/zxbasic/zxbc.py", line 12, in <module>     sys.exit(zxbc.main())  # Exit             ^^^^^^^^^^^   File "/home/baltasarq/bin/zxbasic/src/zxbc/zxbc.py", line 110, in main     optimizer.visit(zxbparser.ast)   File "/home/baltasarq/bin/zxbasic/src/api/optimize.py", line 199, in visit     return super().visit(node)           ^^^^^^^^^^^^^^^^^^^   File "/home/baltasarq/bin/zxbasic/src/api/optimize.py", line 56, in visit     return super().visit(ToVisit(node))           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^   File "/home/baltasarq/bin/zxbasic/src/ast/ast.py", line 42, in visit     stack.append(last.send(last_result))                 ^^^^^^^^^^^^^^^^^^^^^^   File "/home/baltasarq/bin/zxbasic/src/api/optimize.py", line 423, in visit_FOR     if from_ > to_ and step_ > 0:       ^^^^^^^^^^^ TypeError: '>' not supported between instances of 'SymbolID' and 'SymbolID'

-- Baltasar



Attached Files
.zip   reveni.zip (Size: 11.6 KB / Downloads: 648)
Print this item

  Better parameters mismatch function (solved)
Posted by: baltasarq - 2024-12-13, 10:29 PM - Forum: Bug Reports - Replies (4)

I was compiling my program when the compiler claimed (correctly) that there was an error in my code:

Code:
util.bas:105: error: Function 'FormatStr' takes 3 parameters, not 1
This message was correct, but instead of signaling the file name and the line where the error was present, it was showing the line number and the file name of where the function was defined!
It also messes with the line number, which corresponds to where the error happened, not where the function was defined. In my case, the error happened at line number 105 of player.bas, calling function FormatStr() defined in line number 39 of util.bas.
I think it would be better to expose both pieces of information, maybe this way:
Code:
player.bas: 105: error: Function 'FormatStr' takes 3 parameters, not 1 util.bas:39: error: Function 'FormatStr' defined here.
Well, something like that.

Print this item

  String functions
Posted by: baltasarq - 2024-12-13, 10:15 PM - Forum: Wishlist - Replies (2)

I've found myself writing these functions:

Code:
' Duplicates the string for times times. ' For instance, MultiPlyStr( "0", 3 ) ' -> "000" ' times must be between 1 and 127 function MultiplyStr(ByVal s as string, ByVal times as byte) as string     dim toret as string = ""         if times > 0         for i = 1 to times             toret = toret + s         next     end if         return toret end function ' Returns a formatted string with the number n ' and enough preceding chars (the ch parameter), ' so that the length of the string is w or more. ' for instance, FormatStr(15, 4, "0") ' -> "0015" ' w must be between 1 and 127. function FormatStr(ByVal n as integer, ByVal w as byte, ByVal ch as string) as string     dim toret as string = str( n )     dim len_prefix as byte = w - len( toret )         return MultiplyStr( ch( 0 ), len_prefix ) + toret end function sub testMultiplyStr()     print("'0' * -1: '" + MultiplyStr("0", -1) + "'")     print("'0' * 0: '" + MultiplyStr("0", 0) + "'")     print("'0' * 1: '" + MultiplyStr("0", 1) + "'")     print("'0' * 2: '" + MultiplyStr("0", 2) + "'")     print("'0' * 3: '" + MultiplyStr("0", 3) + "'")     print("'0' * 4: '" + MultiplyStr("0", 4) + "'")     print("'0' * 5: '" + MultiplyStr("0", 5) + "'") end sub sub testFormatStr()     print("fmt(1, '0', -1): '" + FormatStr(1, -1, "0") + "'")      print("fmt(1, '0',  0): '" + FormatStr(1, 0, "0") + "'")      print("fmt(1, '0',  1): '" + FormatStr(1, 1, "0") + "'")     print("fmt(1, '0',  2): '" + FormatStr(1, 2, "0") + "'")     print("fmt(1, '0',  3): '" + FormatStr(1, 3, "0") + "'") end sub
Would it be of interest to incorporate MultiplyStr() and FormatStr() to ZXBasic?
I can prepare a PR if there is interest.

Print this item

  transfer data to "the spectrum" with flashair.
Posted by: funkheld - 2024-12-12, 09:45 PM - Forum: How-To & Tutorials - No Replies

https://spectrumcomputing.co.uk/forums/v...hp?t=12620

hello, good day.

I transfer my data/programs from my notebook to "the spectrum" with flashair.

works great.

greetings

Print this item

  char pointer bend to another address
Posted by: funkheld - 2024-11-29, 02:42 PM - Forum: How-To & Tutorials - Replies (11)

hello, good day.

how can you change the character pointer to another address to create new characters?

I want to change all characters.

greetings

Print this item

  my THE SPECTRUM has arrived for 99 euros in Germany.
Posted by: funkheld - 2024-11-27, 03:12 PM - Forum: How-To & Tutorials - Replies (1)

hello, good day.

my THE SPECTRUM has arrived for 99 euros in Germany.

a great device.

I set it to spectrum maschine 128k.

my programs-128k from ZX Basic run wonderfully.
also the bank programs in ZX Basic for the 128k with the bank switching.

greetings

this interrupt ist ok with "THE SPECTRUM"
----------------------------------------------

Code:
' Example of the use of the IM2 library ' Including the IM2 library #include "IM2.bas" ' We declare two variables to use inside IM2CallMyRoutine ' These variables must be global ' Time wasting counter DIM im2_Counter AS UInteger ' Height of the horizon DIM im2_Horizon AS UInteger = 400 ' We call the subroutine Main Main() ' - Main subroutine --------------------------------------- SUB Main() CLS PRINT AT 23,0;"q - Up, a - Down, s - Stop"; PRINT AT 0,0;"Height of the horizon:"; ' We configure and start up the interruptions. IM2Start(@MyInterruptRoutine) ' Infinite loop DO ' Print the current horizon height PRINT AT 0,23;im2_Horizon;" "; ' If we press "q", we raise the horizon. IF INKEY$ = "q" THEN ' We raise it as long as it is not 0 IF im2_Horizon > 0 THEN ' Going up means less pause im2_Horizon = im2_Horizon - 1 END IF ' Pressing "a" lowers the horizon. ELSEIF INKEY$ = "a" THEN ' Going down is to pause more im2_Horizon = im2_Horizon + 1 ' Pressing "s" stops the interruptions. ELSEIF INKEY$ = "s" THEN IM2Stop() RETURN END IF LOOP END SUB ' - This is our routine which is called at every interruption ' We can't do a lot of things inside ' Do not define local variables, do not use ROM, ' not to dawdle too much... SUB FASTCALL MyInterruptRoutine() ' The sky is cyan BORDER 5 ' We wait to change from heaven to earth FOR im2_Counter=0 to im2_Horizon NEXT im2_Counter ' The land is green BORDER 4 END SUB
------------------------------------------------

Print this item

  Declare an array type
Posted by: baltasarq - 2024-11-22, 12:51 PM - Forum: Help & Support - Replies (2)

How do you declare an array type? I supposed it should be easy to find in the docs, but didn't have any luck. For instance:

Code:
sub doThis(v as string?)     print( v( 0 ) ) endsub
I'm certain it is not string() (I have tried that). I wonder if I have to use DIM again?
Thanks,
-- Baltasar

Print this item

  Reading DATA
Posted by: baltasarq - 2024-11-20, 09:25 PM - Forum: ZX Basic Compiler - Replies (4)

Lo siento si esto ha sido preguntado antes, pero no lo he encontrado.

Dado un proc como este:


Code:
const NumLocs as ubyte = 2 'enum Exits     const ExitNorth as ubyte = 0     const ExitSouth as ubyte = 1     const ExitEast as ubyte = 2     const ExitWest as ubyte = 3     const ExitUp as ubyte = 4     const ExitDown as ubyte = 5     const NumExits as ubyte = 6 'end enum dim locDescs(NumLocs) as string dim locExits(NumLocs, NumExits) as integer sub init_locs()     'locDescs( 0 ) = "El lugar del alunizaje. La vaina abierta y sin  " _     '   + "contenido parece una triste parodia de ella misma. " _     '   + "Un valle natural conduce al sur."     'locDescs( 1 ) = "El lugar del alunizaje. La vaina abierta y sin  " _     '   + "contenido parece una triste parodia de ella misma. " _     '   + "Un valle natural conduce al sur."         restore LocData         for i = 0 to NumLocs - 1         print "numloc i:", i                 ' Read the desc         read locDescs( i )         print "read numloc i: "; i; locDescs( i )                         ' Read the exits         for j = 0 to NumExits - 1             print "numloc i:"; i; " exit "; j             read locExits(i, j)             print "numloc i:"; i; " exit "; j; " = "; locExits(i, j)             input a         next     next         return                           LocData:     ' Loc 0 - Landing     data "El lugar del alunizaje. La vaina abierta y sin  " _       + "contenido parece una triste parodia de ella misma. " _       + "Un valle natural conduce al sur."     data -1, 1, -1, -1, -1, -1         ' Loc 1 - Valley     data "El lugar del alunizaje. La vaina abierta y sin  " _       + "contenido parece una triste parodia de ella misma. " _       + "Un valle natural conduce al sur."     data 0, -1, -1, -1, -1, -1 end sub


El problema es el siguiente. Si descomento las primeras líneas y comento la línea
Code:
read locDescs( i )
y los data correspondientes, el programa parece que funciona. Pero si dejo el programa tal y como está, solo lee porquería en la posición i del vector locDescs, y el Speccy se reinicia. ¿No se pueden leer cadenas con READ? Según los docs, entiendo que sí...

Print this item

  Discord?
Posted by: StevesGaming - 2024-11-19, 10:24 PM - Forum: Off-Topic - Replies (6)

Does anyone know of a discord server that features a Boriel Basic channel?
(I did a search on here and found one but the link has expired.)

Thanks

Print this item

  New telegram channels
Posted by: boriel - 2024-11-18, 10:13 AM - Forum: ZX Basic Compiler - No Replies

Hi, there

The forum is still alive, yes, but it's clear that the recent waves of spam attack have causes a great damage to our community :-(
In the meantime other tools and communities have emerged around instant messaging (Discord, Telegram, etc).

I've created two official Telegram channels (English, and Spanish). Please follow the invitation links if you're willing to join.


Boriel ZX Basic Compiler
Official channel (English Only)
Invite link:
https://t.me/+ag4E7W05dvRkZmZk

Boriel ZX Basic [ES] (Spanish official channel)
Sobre el compilador Boriel ZX Basic
Enlace de invitación:
https://t.me/+dSbWL8z8ol1lMjA0

Print this item