Forum
.tap file code not executed - Printable Version

+- Forum (https://www.boriel.com/forum)
+-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12)
+--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11)
+---- Forum: Help & Support (https://www.boriel.com/forum/forumdisplay.php?fid=16)
+---- Thread: .tap file code not executed (/showthread.php?tid=2624)



.tap file code not executed - manuelzo75 - 04-24-2025

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


RE: .tap file code not executed - Zoran - 04-25-2025

It was hard to read from the attached image, it is too small (or is it my Firefox fault?).

When reporting problems, please always state explicitly:
- the compiler version you used
- which options were passed to the compiler (show the full command used when compiling)
- your operating system
Please don't get me wrong, this information helps people who are willing to help you, so you are more likely to get a useful response when you provide this info.

Anyway, I don't think that you are doing anything wrong, I tried now with "clock.bas" and the compilation failed with same output that you show.

I tried on Windows 10, ZX Basic version 1.18.0 (latest stable at the moment), using these options:

Quote:zxbc.exe --optimize 2 --output ..\clock\clock.tap --output-format=tap --BASIC --autorun examples\clock.bas

So, this example seems to have bugs.

I haven't experienced the other outcome you describe (compilation passed, but then the tap file isn't correct).


RE: .tap file code not executed - boriel - 04-26-2025

I have fixed the font-size of your error message. :-)
This looks like a bug in the compiler. What compiler version are you using? (run python zxbc.py --version to see it)

EDIT: I have tested 1.18.0 and it's a new bug introduced in this version. Fixing it...


RE: .tap file code not executed - boriel - 04-27-2025

Please download the latest version 1.18.1 (just published), that fixes this bug:  Rolleyes
http://www.boriel.com/files/zxb/zxbasic-1.18.1.tar.gz
http://www.boriel.com/files/zxb/zxbasic-1.18.1.zip
http://www.boriel.com/files/zxb/zxbasic-1.18.1-win32.zip
http://www.boriel.com/files/zxb/zxbasic-1.18.1-linux64.tar.gz
http://www.boriel.com/files/zxb/zxbasic-1.18.1-macos.tar.gz


RE: .tap file code not executed - Zoran - 04-28-2025

The clock example works well with 1.18.1 (on Windows 10).