| Welcome, Guest |
You have to register before you can post on our site.
|
| Forum Statistics |
» Members: 279
» Latest member: imd
» Forum threads: 1,089
» Forum posts: 6,493
Full Statistics
|
| Online Users |
There are currently 108 online users. » 0 Member(s) | 106 Guest(s) Bing, Google
|
| Latest Threads |
zxmoria, a port of umoria
Forum: Gallery
Last Post: sdo303
2026-10-23, 05:46 PM
» Replies: 1
» Views: 289
|
zxpaging
Forum: Gallery
Last Post: sdo303
2026-10-18, 12:12 PM
» Replies: 0
» Views: 200
|
GuSprites
Forum: Help & Support
Last Post: zedex82
2026-06-19, 06:39 PM
» Replies: 2
» Views: 779
|
New video Couse / Nuevo c...
Forum: News
Last Post: Duefectu
2026-04-29, 11:02 PM
» Replies: 0
» Views: 3,112
|
location of heap manageme...
Forum: Help & Support
Last Post: boriel
2026-03-07, 12:13 AM
» Replies: 1
» Views: 1,178
|
non-paged supervisor code...
Forum: Help & Support
Last Post: sdo303
2026-02-20, 06:38 PM
» Replies: 8
» Views: 2,594
|
How to open fuse as an ex...
Forum: How-To & Tutorials
Last Post: Duefectu
2026-02-09, 01:52 PM
» Replies: 3
» Views: 2,173
|
Old zxbasic game errors
Forum: Help & Support
Last Post: boriel
2025-11-09, 11:52 AM
» Replies: 7
» Views: 3,085
|
Error: Undefined GLOBAL l...
Forum: Help & Support
Last Post: ardentcrest
2025-11-04, 05:46 PM
» Replies: 3
» Views: 1,807
|
A Fast(er) Plot Routine f...
Forum: How-To & Tutorials
Last Post: tubz74
2025-10-30, 03:16 PM
» Replies: 2
» Views: 1,875
|
|
|
| [SOLVED] Array layout bug - regression in 1.18.3 |
|
Posted by: Zoran - 2025-10-24, 11:24 PM - Forum: Bug Reports
- Replies (2)
|
 |
Please take a look at this simple programme:
Code: dim a(5) as ubyte => {0, 1, 2, 3, 4, 5}
dim b(5) as ubyte
dim i as uinteger
for i = 0 to 5
poke @b + i, a(i)
next
cls
for i = 0 to 5
print a(i), b(i)
next
When compiled with zxbasic 1.18.2 this works as expected - both arrays are same. See the attached image:
However, with zxbasic 1.18.3, the programme fails miserably and crashes the Spectrum
In both cases compiled with
Quote: Wrote:--optimize 2 --output-format=tzx --BASIC --autorun --explicit --strict
Now, this is the simple case made to illustrate the bug. The main problem I have is with character arrays -- I have custom font with cyrilic letters designed in ZXBasicStudio, stored as two dimensional array (95, 7) -- when I want to write cyrilic text I poke the system variable 5C36 to the address of the array minus 256 (@array - $100) and when I want to print latin text, I just poke this variable back to default value $3C00. This worked perfectly until version 1.18.3 came out. Now, everything is broken, as the characters in the array are obviously not stored continuously in memory.
What happend with array layout?
Now I tried to see the address of the array itself, compared with the addresses of array elements:
Code: dim a(5) as ubyte => {0, 1, 2, 3, 4, 5}
dim i as uinteger
cls
print "@a = "; @a
print "------------"
for i = 0 to 5
print "@a("; i; ") = "; @a(i)
next
The attached image shows the output with zxbasic 1.18.2 compared with zxbasic 1.18.3:
It seems that in zxbasic 1.18.3, there are eight bytes between the address of the array itself (@a) and the first element (@a(0) ). The array elements are stored continuously after all.
So, I can workaround the problem with the custom character set that I mentioned in my previous post using:
Code: poke (uinteger $5c36, @charset(0,0) - $100) ' the address of the first element
instead of
Code: poke (uinteger $5c36, @charset - $0100) ' the address of the array
But still, is there a reason for this, or is it just a bug?
|
|
|
| 3DOS Commands? |
|
Posted by: tubz74 - 2025-10-05, 10:33 PM - Forum: Help & Support
- Replies (3)
|
 |
Hi
I'm looking at using some 3DOS commands, starting to see how I can cat a disk.
I've takend the below code from the +3 manula (pg 200 to 203) which should allow me to get the CAT into memory - the code looks to activate the disk (and for example if I don't attach a disk, it give me abort/retry) but then "reboots"/crashes the emulator back to the +3 menu.
I'm assuming that there might be some incompatibility somewhere between, starting reading, and returning contorl to the program. Code is below.
Any thoughts?
(PS If the ASM didn't crash, the program wouldn't actually do anything anyway yet, as I've not sorted any output, or any caribles)
Code: #include <input.bas>
#include <screen.bas>
#INCLUDE <keys.bas>
PRINT "This is the start"
main()
SUB main()
LET YesNo = "n"
PRINT "do you want to CAT disk"
YesNo = INPUT(1)
IF YesNo="y" then
Catalogue()
END IF
PRINT "Ed#nd Main"
END SUB
SUB Catalogue()
ASM
PUSH IX ; dos catalog corrupts ix
PROC
LOCAL MYSTACK
LOCAL STACKSTORAGE
LOCAL BANKM
LOCAL PORT1
LOCAL CATBUFF
LOCAL DOS_CATALOG
MYSTACK EQU 9fffh ;
STACKSTORAGE EQU 9000h ; save pointer
BANKM EQU 5b5ch ; system var that holds last value output to 7ff0h
PORT1 EQU 7ffdh ; address of rom/ram switching port
CATBUFF EQU 8000h ; location for dos to output
DOS_CATALOG EQU 011Eh ; DOS routine to call
JP start
stardstar: defb "*.*",255
dosret: defw 0
start:
DI
LD (STACKSTORAGE),SP
LD BC,PORT1 ;
LD A,(BANKM) ; current switch state
RES 4,A ; move right to left in horizontal rom switch (3 to 2)
OR 7 ; switch in ram page 7
LD (BANKM),A ; keep system var up to date
OUT (C),A ; switch ram and rom
LD SP,MYSTACK ; make sure stack is above 4000h and below bfeoh
EI ; enable interrupts
;
LD HL,CATBUFF
LD DE,CATBUFF+1
LD BC,1024
LD (HL),0
LDIR
LD B,64
LD C,1
LD DE, CATBUFF
LD HL,stardstar ;file name *.*
CALL DOS_CATALOG ;call dos catalog
PUSH AF
POP HL
LD (dosret),HL ; put here so can be seen from basic
LD C,B ; number of files in catalog, low byte of bc
LD B,0 ; returned to basic by usr functio
DI
PUSH BC
LD BC, PORT1
LD A, (BANKM)
SET 4, A ; move left to right (riom 2 to 3)
AND 48h ; ram page 9
LD (BANKM),A ; update syste value
OUT (C),A ;switch
POP BC ; get back saved number of files
LD SP,(STACKSTORAGE) ;
EI
;RET ; not sure if thisis needed
ENDP
POP IX
;RET ; Not sure if this is needed here
END ASM
END SUB
|
|
|
| How to open fuse as an external emulator in ZXBasic Studio for +2a/b/+3- Windows 11 |
|
Posted by: tubz74 - 2025-10-05, 07:13 PM - Forum: How-To & Tutorials
- Replies (3)
|
 |
ZXStudio doesn't support +3/+2a etc in the included emulator. Requires at least Beta 6 of ZXBasicStudio
Use Project/Configure Project to configure.
Example Compiler Parameters
-O 0 -S 32768 -H 4768 -f tap -B -a
(The bold was auto generated, underscore are the options added "-f tap" to create a tap file, "-B -a" required to Generate the basic file and auto start.
Example Launch External Emulator
C:\zx\projects\DOSTesting\ZXStartFuse.bat
This has to be a batch file, rather than direct to the emulator, %1 and %2 are passed into the batch file for ZXBasicStudio - %1 is the path, and %2 the filename excluding the extension.
ZXStartFuse.bat created in the OS, and renamed to .bat, as it was txt file.
Code: ECHO OFF
"C:\Program Files (x86)\Fuse\fuse.exe" -m plus3 --auto-load %1%2.tap
This would open a plus3 spectrum in fuse and run the tap file.
(Thanks to support from telegram for getting this to work ..)
|
|
|
| CLS/Fade out ASM Sub-routine |
|
Posted by: tubz74 - 2025-10-05, 02:37 PM - Forum: How-To & Tutorials
- Replies (2)
|
 |
This is a small clear screen, that sort of fades out the screen pixel by pixel to the background colour. I took it from one of the Melbourne house books, can't remember which one though.
No idea if it breaks anything else, but I've not had any issues.
Code: SUB CLSFadeOut()
' Fade out Screen Clearing
ASM
LD DE,08feh
NXTFADE:
LD A,E
RLCA
RLCA
RLCA
LD E,A
LD HL,4000H
LD BC,0018H
NXT:
LD A, (HL)
AND E
LD (HL),A
INC HL
DJNZ NXT
DEC C
JR NZ,NXT
DEC D
JR NZ,NXTFADE
LD A,(5C8DH)
LD (HL),A
LD D,H
LD E,L
INC DE
LD BC,02C0H
LDIR
LD A,(5C48H)
LD (HL),A
LD C,3FH
LDIR
END ASM
END SUB
|
|
|
| ZX Basic Studio Bugs |
|
Posted by: ZXPeter - 2025-09-19, 04:21 PM - Forum: Bug Reports
- Replies (5)
|
 |
Don't know if this is the correct place for this post but I'm sure someone will let me know if not.
This post relates to ZX Basic Studio builds 1.0.8702.19933 2023-10-29 and 1.5.9168.37638 2025-02-06 which ,for brevity, I shall call buildA and buildB respectively.
Following the instructions for creating a project from pages 47 to 53 of the "Boriel Basic for ZX Spectrum" book I have the following observations:
(1)
With buildA the Main.bas file appears in the explorer window when it is created,as described in the book.
With buildB it does not. Closing the displayed code by clicking the X next to the "Main.bas" file name removes the code from view and there is no way of re-opening
it from the explorer window (as it isn't listed there). One way to make the file name visible in the explorer window is to close then re-open the project.
(2)
For both buildA and buildB running the book's example code (page 51) without debug results in the expected coloured block of X's.
Running the code under debug with a breakpoint set as shown on page 52, neither build produces the full block (stops after 3 and a bit rows).
Hope this information is useful.
|
|
|
| Printing with FZX |
|
Posted by: solar penguin - 2025-07-14, 04:45 PM - Forum: Help & Support
- Replies (1)
|
 |
Hi, I'm new, so these are probably stupid questions. But, I'm confused about printing with printFzxStr. Is there any way to to get it to word wrap neatly? It's breaking to a new line in the middle of a word (or even the middle of a letter)
As a last resort, I guess I could have a go at writing my own word-wrap routine if I knew where to find the different widths of all the characters and the position of the text-printing cursor along the row. How would I go about finding them?
One final question. Is there a way to make FZX scroll when it reaches the bottom of the screen instead of just stopping ZX81-style with an error message?
Thanks
|
|
|
| Strange Happenings |
|
Posted by: zedex82 - 2025-05-07, 10:05 AM - Forum: Bug Reports
- Replies (4)
|
 |
I am not sure if this is just my laptop as I have just done a fresh install of ZXBasic Studio 1.5 and Boriel 1.18.1.
I have noticed two things.
1. Any new file I create is not showing in the Project Explorer. I have to reload the project for them to appear
2. I have left all the colours in the Coding window as default so the main commands are shown in blue. When I type ENDIF it does not change to blue but remains white.
The laptop I am using is a spare one (windows 10) that I take away with me and I have never installed ZXBasic Studio or Boriel before and I do not have my main laptop to check if it is the laptop or not.
Thanks
ZeD
|
|
|
| .tap file code not executed |
|
Posted by: manuelzo75 - 2025-04-24, 05:09 PM - Forum: Help & Support
- Replies (4)
|
 |
Hello, I'm a newbie tinkering with the Spectrum.
I tried to get some code to test like the classic 'clock.bas' or 'circle. bas' and then converting a .bas file to .tap.
In some cases, I obtain some errors like:
manuelzompetta@Manuels-MacBook-Pro zxbasic % python zxbc.py clock.bas
clock.bas:21: warning: [W100] Using default implicit type 'float' for 'a'
clock.bas:22: warning: [W100] Using default implicit type 'float' for 'sx'
clock.bas:22: warning: [W100] Using default implicit type 'float' for 'sy'
clock.bas:25: warning: [W100] Using default implicit type 'ulong' for 't2'
Traceback (most recent call last):
File "/Users/manuelzompetta/Downloads/zxbasic/zxbc.py", line 12, in <module>
sys.exit(zxbc.main()) # Exit
^^^^^^^^^^^
File "/Users/manuelzompetta/Downloads/zxbasic/src/zxbc/zxbc.py", line 155, in main
asm_output = backend.emit(optimize=OPTIONS.optimization_level > 0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/manuelzompetta/Downloads/zxbasic/src/arch/z80/backend/main.py", line 770, in emit
self._output_join(output, self._QUAD_TABLE[quad.instr].func(quad), optimize=optimize)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/manuelzompetta/Downloads/zxbasic/src/arch/z80/backend/generic.py", line 362, in _cast
output.extend(to_long(tA))
^^^^^^^^^^^
File "/Users/manuelzompetta/Downloads/zxbasic/src/arch/z80/backend/common.py", line 401, in to_long
raise NotImplementedError(f"type conversion from {stype} to long is undefined")
NotImplementedError: type conversion from u32 to long is undefined
In other cases I obtain .tap file but when I execute it in the Spectrum or in an emulator nothing happens, I just obtain the welcome screen.
What I'm doing wrong?
Thanks
|
|
|
| Exit from more than one level |
|
Posted by: Zoran - 2025-04-18, 03:50 PM - Forum: Wishlist
- Replies (3)
|
 |
Sometimes we need exit not only from innermost loop, but also from some outer loop (sometimes more than two levels).
As a workaround I use "do" in the outer loop and "while 1" in the inner, just to be able to use "exit do" or "exit while":
Code: do
' some code
while 1
' some code
if somecondition then
exit do ' exit from two levels
end if
' some code...
if someothercondition then
exit while ' exit inner loop only
end if
' some code...
end while
' some code...
loop
When exit from more than two levels is needed, there is no other way but to put a label and use "goto". It would be much more elegant if we could exit from more levels directly. For example, "exit do do" or "exit do do do" would exit from two or three levels of "do". I'm not sure that "exit for for for" or "exit while while" is needed; supporting "do" loop only is probably quite enough -- "do" loop is the most powerful and you can easily write any loop as a "do" loop.
What do you think?
|
|
|
|