<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[Boriel Basic Forum - All Forums]]></title>
		<link>https://forum.boriel.com/</link>
		<description><![CDATA[Boriel Basic Forum - https://forum.boriel.com]]></description>
		<pubDate>Fri, 03 Apr 2026 20:09:20 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[location of heap management code...]]></title>
			<link>https://forum.boriel.com/showthread.php?tid=2652</link>
			<pubDate>Tue, 24 Feb 2026 13:17:50 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.boriel.com/member.php?action=profile&uid=2568">sdo303</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.boriel.com/showthread.php?tid=2652</guid>
			<description><![CDATA[I'd like to use strings and arrays in my paged code, but I seem to have reached a blockage whereby, even though my paged-code looks like:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>#PRAGMA push(case_insensitive)<br />
#PRAGMA case_insensitive = True<br />
#define STANDALONE  ' remove ROM initialization and SysVars...<br />
<br />
Asm<br />
    org &#36;6000<br />
    di<br />
End Asm<br />
s_stage_init()<br />
Asm<br />
    ret<br />
End Asm<br />
<br />
<br />
#include "constants.bas"<br />
#include "globals.bas"<br />
#include "stage-include.bas"<br />
<br />
<br />
Sub s_init_keyboard_table_ZX_keys()<br />
    ' effect: populates the lookup table for the 40-key spectrum matrix<br />
    ' row 0: port &#36;FEFE<br />
    gub_zxkeys(0)  = 0   ' caps shift<br />
'...<br />
    gub_zxkeys(55) = 127 ' delete (standard)<br />
End Sub<br />
<br />
<br />
Sub s_init_keyboard_table_ZX_symkeys()<br />
    ' row 0: z, x, c, v<br />
    gub_zxsymkeys(1)  = 58  ' :<br />
'...<br />
    gub_zxsymkeys(55) = 127 ' delete (standard)<br />
End Sub<br />
<br />
<br />
Sub s_init_title_screen()<br />
    ' footer prompt<br />
    s_print_string_at( 28, 21, "Press any key to begin..."  , UB_BRIGHT_YELLOW )<br />
<br />
    ' wait for player input<br />
    s_get_key()<br />
    ' check if the one-hour timeout occurred<br />
    If guw_key_code = 0 Then gub_core_end = true<br />
End Sub<br />
<br />
<br />
Sub s_stage_init()<br />
    s_init_keyboard_table_ZX_keys()<br />
    s_init_keyboard_table_ZX_symkeys()<br />
<br />
    s_init_title_screen()<br />
End Sub</code></div></div><br />
and when I compile with :<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>python &#36;Compiler "&#36;(&#36;Name).bas" -f bin -o "&#36;(&#36;Name).bin" --org 24576 -W150 --headerless --explicit --strict --zxnext -i --arch zxnext --opt-strategy size --heap-address 32000 --heap-size 767 -M "&#36;(&#36;Name).map"</code></div></div><br />
then I still seem to end up with some kind of header code that makes  a call to &#36;46A4...<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>&gt;6001  CALL 46A4        PC  6001<br />
 6004  NOP              SP  FFFA<br />
 6005  NOP              AF  FFFF'3C40<br />
 6006  NOP              SZ5H3PNC<br />
 6007  NOP              HL  0001'3C44<br />
 6008  NOP              DE  0000'FFFF<br />
 6009  NOP              BC  0000'5393<br />
 600A  LD BC, 6013      IX  FFF1<br />
 600D  EX AF, AF'       IY  EFF3<br />
 600E  LD B, A          IR  001B<br />
 600F  NOP              IM1 IFF--<br />
 6010  NOP              (HL) F3 00<br />
 6011  NOP              (DE) 00 F3<br />
                        (BC) 00 F3<br />
<br />
(SP) 0C3C 010B 0000 F300 C300 0</code></div></div><br />
which I think must be some kind of heap management setup...<br />
<br />
...so please may I ask...<br />
<br />
Is there a compiler switch or directive whereby I can get the heap management code tacked on just after my code ends, so that I can have private heap management per 8KB segment of paged code ?<br />
<br />
Thank you.]]></description>
			<content:encoded><![CDATA[I'd like to use strings and arrays in my paged code, but I seem to have reached a blockage whereby, even though my paged-code looks like:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>#PRAGMA push(case_insensitive)<br />
#PRAGMA case_insensitive = True<br />
#define STANDALONE  ' remove ROM initialization and SysVars...<br />
<br />
Asm<br />
    org &#36;6000<br />
    di<br />
End Asm<br />
s_stage_init()<br />
Asm<br />
    ret<br />
End Asm<br />
<br />
<br />
#include "constants.bas"<br />
#include "globals.bas"<br />
#include "stage-include.bas"<br />
<br />
<br />
Sub s_init_keyboard_table_ZX_keys()<br />
    ' effect: populates the lookup table for the 40-key spectrum matrix<br />
    ' row 0: port &#36;FEFE<br />
    gub_zxkeys(0)  = 0   ' caps shift<br />
'...<br />
    gub_zxkeys(55) = 127 ' delete (standard)<br />
End Sub<br />
<br />
<br />
Sub s_init_keyboard_table_ZX_symkeys()<br />
    ' row 0: z, x, c, v<br />
    gub_zxsymkeys(1)  = 58  ' :<br />
'...<br />
    gub_zxsymkeys(55) = 127 ' delete (standard)<br />
End Sub<br />
<br />
<br />
Sub s_init_title_screen()<br />
    ' footer prompt<br />
    s_print_string_at( 28, 21, "Press any key to begin..."  , UB_BRIGHT_YELLOW )<br />
<br />
    ' wait for player input<br />
    s_get_key()<br />
    ' check if the one-hour timeout occurred<br />
    If guw_key_code = 0 Then gub_core_end = true<br />
End Sub<br />
<br />
<br />
Sub s_stage_init()<br />
    s_init_keyboard_table_ZX_keys()<br />
    s_init_keyboard_table_ZX_symkeys()<br />
<br />
    s_init_title_screen()<br />
End Sub</code></div></div><br />
and when I compile with :<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>python &#36;Compiler "&#36;(&#36;Name).bas" -f bin -o "&#36;(&#36;Name).bin" --org 24576 -W150 --headerless --explicit --strict --zxnext -i --arch zxnext --opt-strategy size --heap-address 32000 --heap-size 767 -M "&#36;(&#36;Name).map"</code></div></div><br />
then I still seem to end up with some kind of header code that makes  a call to &#36;46A4...<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>&gt;6001  CALL 46A4        PC  6001<br />
 6004  NOP              SP  FFFA<br />
 6005  NOP              AF  FFFF'3C40<br />
 6006  NOP              SZ5H3PNC<br />
 6007  NOP              HL  0001'3C44<br />
 6008  NOP              DE  0000'FFFF<br />
 6009  NOP              BC  0000'5393<br />
 600A  LD BC, 6013      IX  FFF1<br />
 600D  EX AF, AF'       IY  EFF3<br />
 600E  LD B, A          IR  001B<br />
 600F  NOP              IM1 IFF--<br />
 6010  NOP              (HL) F3 00<br />
 6011  NOP              (DE) 00 F3<br />
                        (BC) 00 F3<br />
<br />
(SP) 0C3C 010B 0000 F300 C300 0</code></div></div><br />
which I think must be some kind of heap management setup...<br />
<br />
...so please may I ask...<br />
<br />
Is there a compiler switch or directive whereby I can get the heap management code tacked on just after my code ends, so that I can have private heap management per 8KB segment of paged code ?<br />
<br />
Thank you.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[non-paged supervisor code calling paged application code]]></title>
			<link>https://forum.boriel.com/showthread.php?tid=2651</link>
			<pubDate>Sun, 15 Feb 2026 15:01:23 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.boriel.com/member.php?action=profile&uid=2568">sdo303</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.boriel.com/showthread.php?tid=2651</guid>
			<description><![CDATA[Firstly, a proper thankyou to Boriel for the compiler.   And secondly, also a proper thankyou to Duefectu for the beginner's guide book (I bought a hard copy), which I have read cover to cover (but I did skip the sound/audio sections <img src="https://forum.boriel.com/images/smilies/smile.png" alt="Smile" title="Smile" class="smilie smilie_1" />).  And I bought a hard copy of Simon G's NextTech book too, again I have read it cover to cover (but skipped the sound/audio parts).<br />
<br />
Using Boriel ZXBasic and as little Z80 machine code as I can get away with (until I need to performance tune)... my project is that I am trying to write a quasi "character cell" based application, like being on an old VT100, whereby the application uses all 64KB of the Z80 for itself, and thus no ZX Spectrum ROM, and which internally leverages a poor man's virtual memory framework, whereby I have a supervisor layer of non-paged code running in MMU0/1, which boots from &#36;0000 and jumps over IM1 at &#36;0038 to begin my main code properly at say &#36;0050 where the application begins properly... and so I have my core non-paged system variables mapped in MMU2 and then I have my paged code to run from MMU3 - and then various different aspects of paged application data paging in and out MMU4/5/6, with finally MMU7 again being static non-paged to host the 5KB of screen tile map for an 80x32 screen, with the final 3KB of MMU7 being available for the stack pointer from &#36;FFFE downwards.<br />
phew...<br />
I know my code will never work first time, I get that... but I feel fairly sure that I have the basic (excuse the pun) initial structure of what I want to achieve, with all of my system variables (so far identified) defined at static addresses in MMU2, and my main supervisor MMU paging and also my screen updating routines and keyboard reading routines written (to be permanently resident in MMU0/1) and the first of my paged blocks of code to run from MMU3, and I have gotten the source code clean enough pass through zxbc without the compiler spitting any hard errors... (just lots and lots of warnings)... but I've now hit a roadblock...<br />
<br />
I get how I can have many separate pages of 8KB deposited across the ZX Next vast 200+ pages of 8KB across 1.75 MB of RAM, and I get how I can have my code paged in at MMU3 for my application to execute from &#36;6000, and I can get my non-paged supervisor layer code to make calls such as       uw_dummy = USR &#36;6000     to call my paged code in MMU3, and thus wait for a return... but what I don't understand is how I can have many different paged code blocks where each is aware of *ALL* of the available core supervisor routines and their parameter structures and thus able to makes calls back in to the supervisor to run any of the many core system routines...<br />
<br />
i.e. how can I make zxbc firstly compile the application core without dropping routines that zxbc thinks are unused, and yet also somehow get the compilations of many different "paged" application code to be aware of the core supervisor routines and their parameters and any return value data types (of functions).<br />
<br />
e.g. I get this from my compilation of my "core.bas":<br />
core.bas:115: warning: [W170] Function 's_crash' is never called and has been ignored<br />
core.bas:154: warning: [W170] Function 's_fc_ram_copy' is never called and has been ignored<br />
core.bas:165: warning: [W170] Function 's_clear_screen' is never called and has been ignored<br />
core.bas:126: warning: [W170] Function 's_print_char_at' is never called and has been ignored<br />
core.bas:143: warning: [W170] Function 's_print_string_at' is never called and has been ignored<br />
core.bas:217: warning: [W170] Function 's_display_monitor' is never called and has been ignored<br />
core.bas:283: warning: [W170] Function 'fub_key_get_minutes' is never called and has been ignored<br />
<br />
...and I get this for my first stage of my application:<br />
stage-include.bas:37: warning: [W170] Function 's_next_reg' is never called and has been ignored<br />
stage-include.bas:38: warning: [W170] Function 's_return_to_zxos' is never called and has been ignored<br />
stage-include.bas:39: warning: [W170] Function 's_crash' is never called and has been ignored<br />
stage-include.bas:40: warning: [W170] Function 's_fc_ram_copy' is never called and has been ignored<br />
stage-include.bas:42: warning: [W170] Function 's_clear_screen' is never called and has been ignored<br />
stage-include.bas:43: warning: [W170] Function 's_print_char_at' is never called and has been ignored<br />
stage-include.bas:44: warning: [W170] Function 's_print_string_at' is never called and has been ignored<br />
stage-include.bas:45: warning: [W170] Function 's_display_monitor' is never called and has been ignored<br />
stage-include.bas:47: warning: [W170] Function 'fub_key_get_minutes' is never called and has been ignored<br />
stage-include.bas:48: warning: [W170] Function 's_key_wait_for_vblank' is never called and has been ignored<br />
stage-include.bas:49: warning: [W170] Function 's_get_key' is never called and has been ignored<br />
...<br />
stage-init.bas:8: warning: [W170] Function 's_stage_init' is never called and has been ignored<br />
stage-init.bas:20: warning: [W170] Function 's_init_keyboard_table_ZX_keys' is never called and has been ignored<br />
stage-init.bas:21: warning: [W170] Function 's_init_keyboard_table_ZX_symkeys' is never called and has been ignored<br />
stage-init.bas:18: warning: [W170] Function 's_init_load_palette' is never called and has been ignored<br />
stage-init.bas:186: warning: [W170] Function 's_init_load_palette_entry' is never called and has been ignored<br />
stage-init.bas:223: warning: [W170] Function 's_init_clear_screen' is never called and has been ignored<br />
stage-init.bas:26: warning: [W170] Function 's_init_title_screen' is never called and has been ignored<br />
<br />
...where stage-include.bas was my attempt to make each "stage" aware of a jump-table of locations of core routines:<br />
<span style="color: #cccccc;" class="mycode_color"><span style="font-family: Consolas, 'Courier New', monospace;" class="mycode_font"><span style="color: #c586c0;" class="mycode_color">Asm</span><br />
    ; fixed jump table addresses <span style="color: #ce9178;" class="mycode_color">for</span> the linker<br />
    _s_main                          equ &#36;0050<br />
    _s_next_reg                      equ &#36;0053<br />
    _s_return_to_zxos                equ &#36;0056<br />
    _s_crash                         equ &#36;0059<br />
    _s_fc_ram_copy                   equ &#36;005C<br />
    _s_clear_screen                  equ &#36;005F<br />
    _s_print_char_at                 equ &#36;0062<br />
    _s_print_<span style="color: #b5cea8;" class="mycode_color">string</span>_at               equ &#36;0065<br />
    _s_display_monitor               equ &#36;0068<br />
    _fub_key_get_minutes             equ &#36;006B<br />
    _s_key_wait_for_vblank           equ &#36;006E<br />
    _s_get_key                       equ &#36;0071<br />
<span style="color: #c586c0;" class="mycode_color">End Asm</span></span></span><br />
<span style="font-family: Consolas, 'Courier New', monospace;" class="mycode_font"><br />
<span style="color: #6a9955;" class="mycode_color"><span style="color: #6a9955;" class="mycode_color">' implementation blocks to stop "not implemented" errors</span></span><br />
<span style="color: #6a9955;" class="mycode_color"><span style="color: #6a9955;" class="mycode_color">' these contain no code; the equate above handles the address</span></span><br />
<span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span> <span style="color: #dcdcaa;" class="mycode_color"><span style="color: #dcdcaa;" class="mycode_color">s_main</span></span><span style="color: #cccccc;" class="mycode_color">(): </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">End</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span><br />
<span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span> <span style="color: #dcdcaa;" class="mycode_color"><span style="color: #dcdcaa;" class="mycode_color">s_next_reg</span></span><span style="color: #cccccc;" class="mycode_color">(reg As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">UByte</span></span><span style="color: #cccccc;" class="mycode_color">, </span><span style="color: #9cdcfe;" class="mycode_color"><span style="color: #9cdcfe;" class="mycode_color">value</span></span><span style="color: #cccccc;" class="mycode_color"> As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">UByte</span></span><span style="color: #cccccc;" class="mycode_color">): </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">End</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span><br />
<span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span> <span style="color: #dcdcaa;" class="mycode_color"><span style="color: #dcdcaa;" class="mycode_color">s_return_to_zxos</span></span><span style="color: #cccccc;" class="mycode_color">(): </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">End</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span><br />
<span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span> <span style="color: #dcdcaa;" class="mycode_color"><span style="color: #dcdcaa;" class="mycode_color">s_crash</span></span><span style="color: #cccccc;" class="mycode_color">(</span><span style="color: #9cdcfe;" class="mycode_color"><span style="color: #9cdcfe;" class="mycode_color">error_code</span></span><span style="color: #cccccc;" class="mycode_color"> As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">UByte</span></span><span style="color: #cccccc;" class="mycode_color">, </span><span style="color: #9cdcfe;" class="mycode_color"><span style="color: #9cdcfe;" class="mycode_color">error_text</span></span><span style="color: #cccccc;" class="mycode_color"> As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">String</span></span><span style="color: #cccccc;" class="mycode_color">): </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">End</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span><br />
<span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Fastcall</span></span><span style="color: #cccccc;" class="mycode_color"> s_fc_ram_copy(src_address </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">As</span></span><span style="color: #cccccc;" class="mycode_color"> UInteger, dest_address </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">As</span></span><span style="color: #cccccc;" class="mycode_color"> UInteger, byte_count </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">As</span></span><span style="color: #cccccc;" class="mycode_color"> UInteger): </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">End</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span><br />
<span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span> <span style="color: #dcdcaa;" class="mycode_color"><span style="color: #dcdcaa;" class="mycode_color">s_clear_screen</span></span><span style="color: #cccccc;" class="mycode_color">(): </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">End</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span><br />
<span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span> <span style="color: #dcdcaa;" class="mycode_color"><span style="color: #dcdcaa;" class="mycode_color">s_print_char_at</span></span><span style="color: #cccccc;" class="mycode_color">(</span><span style="color: #9cdcfe;" class="mycode_color"><span style="color: #9cdcfe;" class="mycode_color">x</span></span><span style="color: #cccccc;" class="mycode_color"> As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">UByte</span></span><span style="color: #cccccc;" class="mycode_color">, </span><span style="color: #9cdcfe;" class="mycode_color"><span style="color: #9cdcfe;" class="mycode_color">y</span></span><span style="color: #cccccc;" class="mycode_color"> As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">UByte</span></span><span style="color: #cccccc;" class="mycode_color">, </span><span style="color: #9cdcfe;" class="mycode_color"><span style="color: #9cdcfe;" class="mycode_color">char</span></span><span style="color: #cccccc;" class="mycode_color"> As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">UByte</span></span><span style="color: #cccccc;" class="mycode_color">, </span><span style="color: #9cdcfe;" class="mycode_color"><span style="color: #9cdcfe;" class="mycode_color">colour</span></span><span style="color: #cccccc;" class="mycode_color"> As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">UByte</span></span><span style="color: #cccccc;" class="mycode_color">): </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">End</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span><br />
<span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span> <span style="color: #dcdcaa;" class="mycode_color"><span style="color: #dcdcaa;" class="mycode_color">s_print_string_at</span></span><span style="color: #cccccc;" class="mycode_color">(</span><span style="color: #9cdcfe;" class="mycode_color"><span style="color: #9cdcfe;" class="mycode_color">x</span></span><span style="color: #cccccc;" class="mycode_color"> As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">UByte</span></span><span style="color: #cccccc;" class="mycode_color">, </span><span style="color: #9cdcfe;" class="mycode_color"><span style="color: #9cdcfe;" class="mycode_color">y</span></span><span style="color: #cccccc;" class="mycode_color"> As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">UByte</span></span><span style="color: #cccccc;" class="mycode_color">, </span><span style="color: #9cdcfe;" class="mycode_color"><span style="color: #9cdcfe;" class="mycode_color">text</span></span><span style="color: #cccccc;" class="mycode_color"> As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">String</span></span><span style="color: #cccccc;" class="mycode_color">, </span><span style="color: #9cdcfe;" class="mycode_color"><span style="color: #9cdcfe;" class="mycode_color">colour</span></span><span style="color: #cccccc;" class="mycode_color"> As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">UByte</span></span><span style="color: #cccccc;" class="mycode_color">): </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">End</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span><br />
<span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span> <span style="color: #dcdcaa;" class="mycode_color"><span style="color: #dcdcaa;" class="mycode_color">s_display_monitor</span></span><span style="color: #cccccc;" class="mycode_color">(): </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">End</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span><br />
<span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Function</span></span> <span style="color: #dcdcaa;" class="mycode_color"><span style="color: #dcdcaa;" class="mycode_color">fub_key_get_minutes</span></span><span style="color: #cccccc;" class="mycode_color">() As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">UByte</span></span><span style="color: #cccccc;" class="mycode_color">: </span><span style="color: #ce9178;" class="mycode_color"><span style="color: #ce9178;" class="mycode_color">return</span></span><span style="color: #cccccc;" class="mycode_color"> 0: </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">End</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Function</span></span><br />
<span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span> <span style="color: #dcdcaa;" class="mycode_color"><span style="color: #dcdcaa;" class="mycode_color">s_key_wait_for_vblank</span></span><span style="color: #cccccc;" class="mycode_color">(): </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">End</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span><br />
<span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span> <span style="color: #dcdcaa;" class="mycode_color"><span style="color: #dcdcaa;" class="mycode_color">s_get_key</span></span><span style="color: #cccccc;" class="mycode_color">(): </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">End</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span></span><br />
<br />
<br />
But clearly there is something I'm not getting, and I've reached the limits of capability of AI helper tools.<br />
<br />
I had rationalised to myself that my build script should only call to zxbc to produce "-f asm" ASM files... as I expect to have to then somehow "link" the static core ASM and the many paged stage ASM together at some point... and I also seem to have rationalised that I may perhaps need to use     sjasmplus     to assemble my ".nex" package.<br />
<br />
Does the above sound achievable?  Or am I asking too much of the "Next" as a platform?  i.e. is the "Next" only any good for paging graphics data, and no good for paging application code?]]></description>
			<content:encoded><![CDATA[Firstly, a proper thankyou to Boriel for the compiler.   And secondly, also a proper thankyou to Duefectu for the beginner's guide book (I bought a hard copy), which I have read cover to cover (but I did skip the sound/audio sections <img src="https://forum.boriel.com/images/smilies/smile.png" alt="Smile" title="Smile" class="smilie smilie_1" />).  And I bought a hard copy of Simon G's NextTech book too, again I have read it cover to cover (but skipped the sound/audio parts).<br />
<br />
Using Boriel ZXBasic and as little Z80 machine code as I can get away with (until I need to performance tune)... my project is that I am trying to write a quasi "character cell" based application, like being on an old VT100, whereby the application uses all 64KB of the Z80 for itself, and thus no ZX Spectrum ROM, and which internally leverages a poor man's virtual memory framework, whereby I have a supervisor layer of non-paged code running in MMU0/1, which boots from &#36;0000 and jumps over IM1 at &#36;0038 to begin my main code properly at say &#36;0050 where the application begins properly... and so I have my core non-paged system variables mapped in MMU2 and then I have my paged code to run from MMU3 - and then various different aspects of paged application data paging in and out MMU4/5/6, with finally MMU7 again being static non-paged to host the 5KB of screen tile map for an 80x32 screen, with the final 3KB of MMU7 being available for the stack pointer from &#36;FFFE downwards.<br />
phew...<br />
I know my code will never work first time, I get that... but I feel fairly sure that I have the basic (excuse the pun) initial structure of what I want to achieve, with all of my system variables (so far identified) defined at static addresses in MMU2, and my main supervisor MMU paging and also my screen updating routines and keyboard reading routines written (to be permanently resident in MMU0/1) and the first of my paged blocks of code to run from MMU3, and I have gotten the source code clean enough pass through zxbc without the compiler spitting any hard errors... (just lots and lots of warnings)... but I've now hit a roadblock...<br />
<br />
I get how I can have many separate pages of 8KB deposited across the ZX Next vast 200+ pages of 8KB across 1.75 MB of RAM, and I get how I can have my code paged in at MMU3 for my application to execute from &#36;6000, and I can get my non-paged supervisor layer code to make calls such as       uw_dummy = USR &#36;6000     to call my paged code in MMU3, and thus wait for a return... but what I don't understand is how I can have many different paged code blocks where each is aware of *ALL* of the available core supervisor routines and their parameter structures and thus able to makes calls back in to the supervisor to run any of the many core system routines...<br />
<br />
i.e. how can I make zxbc firstly compile the application core without dropping routines that zxbc thinks are unused, and yet also somehow get the compilations of many different "paged" application code to be aware of the core supervisor routines and their parameters and any return value data types (of functions).<br />
<br />
e.g. I get this from my compilation of my "core.bas":<br />
core.bas:115: warning: [W170] Function 's_crash' is never called and has been ignored<br />
core.bas:154: warning: [W170] Function 's_fc_ram_copy' is never called and has been ignored<br />
core.bas:165: warning: [W170] Function 's_clear_screen' is never called and has been ignored<br />
core.bas:126: warning: [W170] Function 's_print_char_at' is never called and has been ignored<br />
core.bas:143: warning: [W170] Function 's_print_string_at' is never called and has been ignored<br />
core.bas:217: warning: [W170] Function 's_display_monitor' is never called and has been ignored<br />
core.bas:283: warning: [W170] Function 'fub_key_get_minutes' is never called and has been ignored<br />
<br />
...and I get this for my first stage of my application:<br />
stage-include.bas:37: warning: [W170] Function 's_next_reg' is never called and has been ignored<br />
stage-include.bas:38: warning: [W170] Function 's_return_to_zxos' is never called and has been ignored<br />
stage-include.bas:39: warning: [W170] Function 's_crash' is never called and has been ignored<br />
stage-include.bas:40: warning: [W170] Function 's_fc_ram_copy' is never called and has been ignored<br />
stage-include.bas:42: warning: [W170] Function 's_clear_screen' is never called and has been ignored<br />
stage-include.bas:43: warning: [W170] Function 's_print_char_at' is never called and has been ignored<br />
stage-include.bas:44: warning: [W170] Function 's_print_string_at' is never called and has been ignored<br />
stage-include.bas:45: warning: [W170] Function 's_display_monitor' is never called and has been ignored<br />
stage-include.bas:47: warning: [W170] Function 'fub_key_get_minutes' is never called and has been ignored<br />
stage-include.bas:48: warning: [W170] Function 's_key_wait_for_vblank' is never called and has been ignored<br />
stage-include.bas:49: warning: [W170] Function 's_get_key' is never called and has been ignored<br />
...<br />
stage-init.bas:8: warning: [W170] Function 's_stage_init' is never called and has been ignored<br />
stage-init.bas:20: warning: [W170] Function 's_init_keyboard_table_ZX_keys' is never called and has been ignored<br />
stage-init.bas:21: warning: [W170] Function 's_init_keyboard_table_ZX_symkeys' is never called and has been ignored<br />
stage-init.bas:18: warning: [W170] Function 's_init_load_palette' is never called and has been ignored<br />
stage-init.bas:186: warning: [W170] Function 's_init_load_palette_entry' is never called and has been ignored<br />
stage-init.bas:223: warning: [W170] Function 's_init_clear_screen' is never called and has been ignored<br />
stage-init.bas:26: warning: [W170] Function 's_init_title_screen' is never called and has been ignored<br />
<br />
...where stage-include.bas was my attempt to make each "stage" aware of a jump-table of locations of core routines:<br />
<span style="color: #cccccc;" class="mycode_color"><span style="font-family: Consolas, 'Courier New', monospace;" class="mycode_font"><span style="color: #c586c0;" class="mycode_color">Asm</span><br />
    ; fixed jump table addresses <span style="color: #ce9178;" class="mycode_color">for</span> the linker<br />
    _s_main                          equ &#36;0050<br />
    _s_next_reg                      equ &#36;0053<br />
    _s_return_to_zxos                equ &#36;0056<br />
    _s_crash                         equ &#36;0059<br />
    _s_fc_ram_copy                   equ &#36;005C<br />
    _s_clear_screen                  equ &#36;005F<br />
    _s_print_char_at                 equ &#36;0062<br />
    _s_print_<span style="color: #b5cea8;" class="mycode_color">string</span>_at               equ &#36;0065<br />
    _s_display_monitor               equ &#36;0068<br />
    _fub_key_get_minutes             equ &#36;006B<br />
    _s_key_wait_for_vblank           equ &#36;006E<br />
    _s_get_key                       equ &#36;0071<br />
<span style="color: #c586c0;" class="mycode_color">End Asm</span></span></span><br />
<span style="font-family: Consolas, 'Courier New', monospace;" class="mycode_font"><br />
<span style="color: #6a9955;" class="mycode_color"><span style="color: #6a9955;" class="mycode_color">' implementation blocks to stop "not implemented" errors</span></span><br />
<span style="color: #6a9955;" class="mycode_color"><span style="color: #6a9955;" class="mycode_color">' these contain no code; the equate above handles the address</span></span><br />
<span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span> <span style="color: #dcdcaa;" class="mycode_color"><span style="color: #dcdcaa;" class="mycode_color">s_main</span></span><span style="color: #cccccc;" class="mycode_color">(): </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">End</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span><br />
<span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span> <span style="color: #dcdcaa;" class="mycode_color"><span style="color: #dcdcaa;" class="mycode_color">s_next_reg</span></span><span style="color: #cccccc;" class="mycode_color">(reg As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">UByte</span></span><span style="color: #cccccc;" class="mycode_color">, </span><span style="color: #9cdcfe;" class="mycode_color"><span style="color: #9cdcfe;" class="mycode_color">value</span></span><span style="color: #cccccc;" class="mycode_color"> As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">UByte</span></span><span style="color: #cccccc;" class="mycode_color">): </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">End</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span><br />
<span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span> <span style="color: #dcdcaa;" class="mycode_color"><span style="color: #dcdcaa;" class="mycode_color">s_return_to_zxos</span></span><span style="color: #cccccc;" class="mycode_color">(): </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">End</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span><br />
<span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span> <span style="color: #dcdcaa;" class="mycode_color"><span style="color: #dcdcaa;" class="mycode_color">s_crash</span></span><span style="color: #cccccc;" class="mycode_color">(</span><span style="color: #9cdcfe;" class="mycode_color"><span style="color: #9cdcfe;" class="mycode_color">error_code</span></span><span style="color: #cccccc;" class="mycode_color"> As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">UByte</span></span><span style="color: #cccccc;" class="mycode_color">, </span><span style="color: #9cdcfe;" class="mycode_color"><span style="color: #9cdcfe;" class="mycode_color">error_text</span></span><span style="color: #cccccc;" class="mycode_color"> As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">String</span></span><span style="color: #cccccc;" class="mycode_color">): </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">End</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span><br />
<span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Fastcall</span></span><span style="color: #cccccc;" class="mycode_color"> s_fc_ram_copy(src_address </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">As</span></span><span style="color: #cccccc;" class="mycode_color"> UInteger, dest_address </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">As</span></span><span style="color: #cccccc;" class="mycode_color"> UInteger, byte_count </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">As</span></span><span style="color: #cccccc;" class="mycode_color"> UInteger): </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">End</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span><br />
<span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span> <span style="color: #dcdcaa;" class="mycode_color"><span style="color: #dcdcaa;" class="mycode_color">s_clear_screen</span></span><span style="color: #cccccc;" class="mycode_color">(): </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">End</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span><br />
<span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span> <span style="color: #dcdcaa;" class="mycode_color"><span style="color: #dcdcaa;" class="mycode_color">s_print_char_at</span></span><span style="color: #cccccc;" class="mycode_color">(</span><span style="color: #9cdcfe;" class="mycode_color"><span style="color: #9cdcfe;" class="mycode_color">x</span></span><span style="color: #cccccc;" class="mycode_color"> As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">UByte</span></span><span style="color: #cccccc;" class="mycode_color">, </span><span style="color: #9cdcfe;" class="mycode_color"><span style="color: #9cdcfe;" class="mycode_color">y</span></span><span style="color: #cccccc;" class="mycode_color"> As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">UByte</span></span><span style="color: #cccccc;" class="mycode_color">, </span><span style="color: #9cdcfe;" class="mycode_color"><span style="color: #9cdcfe;" class="mycode_color">char</span></span><span style="color: #cccccc;" class="mycode_color"> As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">UByte</span></span><span style="color: #cccccc;" class="mycode_color">, </span><span style="color: #9cdcfe;" class="mycode_color"><span style="color: #9cdcfe;" class="mycode_color">colour</span></span><span style="color: #cccccc;" class="mycode_color"> As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">UByte</span></span><span style="color: #cccccc;" class="mycode_color">): </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">End</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span><br />
<span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span> <span style="color: #dcdcaa;" class="mycode_color"><span style="color: #dcdcaa;" class="mycode_color">s_print_string_at</span></span><span style="color: #cccccc;" class="mycode_color">(</span><span style="color: #9cdcfe;" class="mycode_color"><span style="color: #9cdcfe;" class="mycode_color">x</span></span><span style="color: #cccccc;" class="mycode_color"> As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">UByte</span></span><span style="color: #cccccc;" class="mycode_color">, </span><span style="color: #9cdcfe;" class="mycode_color"><span style="color: #9cdcfe;" class="mycode_color">y</span></span><span style="color: #cccccc;" class="mycode_color"> As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">UByte</span></span><span style="color: #cccccc;" class="mycode_color">, </span><span style="color: #9cdcfe;" class="mycode_color"><span style="color: #9cdcfe;" class="mycode_color">text</span></span><span style="color: #cccccc;" class="mycode_color"> As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">String</span></span><span style="color: #cccccc;" class="mycode_color">, </span><span style="color: #9cdcfe;" class="mycode_color"><span style="color: #9cdcfe;" class="mycode_color">colour</span></span><span style="color: #cccccc;" class="mycode_color"> As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">UByte</span></span><span style="color: #cccccc;" class="mycode_color">): </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">End</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span><br />
<span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span> <span style="color: #dcdcaa;" class="mycode_color"><span style="color: #dcdcaa;" class="mycode_color">s_display_monitor</span></span><span style="color: #cccccc;" class="mycode_color">(): </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">End</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span><br />
<span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Function</span></span> <span style="color: #dcdcaa;" class="mycode_color"><span style="color: #dcdcaa;" class="mycode_color">fub_key_get_minutes</span></span><span style="color: #cccccc;" class="mycode_color">() As </span><span style="color: #b5cea8;" class="mycode_color"><span style="color: #b5cea8;" class="mycode_color">UByte</span></span><span style="color: #cccccc;" class="mycode_color">: </span><span style="color: #ce9178;" class="mycode_color"><span style="color: #ce9178;" class="mycode_color">return</span></span><span style="color: #cccccc;" class="mycode_color"> 0: </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">End</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Function</span></span><br />
<span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span> <span style="color: #dcdcaa;" class="mycode_color"><span style="color: #dcdcaa;" class="mycode_color">s_key_wait_for_vblank</span></span><span style="color: #cccccc;" class="mycode_color">(): </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">End</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span><br />
<span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span> <span style="color: #dcdcaa;" class="mycode_color"><span style="color: #dcdcaa;" class="mycode_color">s_get_key</span></span><span style="color: #cccccc;" class="mycode_color">(): </span><span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">End</span></span> <span style="color: #c586c0;" class="mycode_color"><span style="color: #c586c0;" class="mycode_color">Sub</span></span></span><br />
<br />
<br />
But clearly there is something I'm not getting, and I've reached the limits of capability of AI helper tools.<br />
<br />
I had rationalised to myself that my build script should only call to zxbc to produce "-f asm" ASM files... as I expect to have to then somehow "link" the static core ASM and the many paged stage ASM together at some point... and I also seem to have rationalised that I may perhaps need to use     sjasmplus     to assemble my ".nex" package.<br />
<br />
Does the above sound achievable?  Or am I asking too much of the "Next" as a platform?  i.e. is the "Next" only any good for paging graphics data, and no good for paging application code?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Old zxbasic game errors]]></title>
			<link>https://forum.boriel.com/showthread.php?tid=2649</link>
			<pubDate>Mon, 03 Nov 2025 20:32:31 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.boriel.com/member.php?action=profile&uid=204">ardentcrest</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.boriel.com/showthread.php?tid=2649</guid>
			<description><![CDATA[trying Escape From Cnossus from 2013 getting this error<br />
<br />
Error: 'subdivideHigh' is neither an array nor a function.<br />
<br />
the line is <br />
<br />
wall1 =	subdivideHigh(x1, y1, x - 1, y2)<br />
<br />
any help please]]></description>
			<content:encoded><![CDATA[trying Escape From Cnossus from 2013 getting this error<br />
<br />
Error: 'subdivideHigh' is neither an array nor a function.<br />
<br />
the line is <br />
<br />
wall1 =	subdivideHigh(x1, y1, x - 1, y2)<br />
<br />
any help please]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Error: Undefined GLOBAL label]]></title>
			<link>https://forum.boriel.com/showthread.php?tid=2648</link>
			<pubDate>Sun, 02 Nov 2025 12:43:21 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.boriel.com/member.php?action=profile&uid=204">ardentcrest</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.boriel.com/showthread.php?tid=2648</guid>
			<description><![CDATA[Looking over an old file of mine that once worked I'm now getting Error: Undefined GLOBAL label . each one is going to a fastcall.<br />
<br />
ie<br />
<br />
        ld hl, lineMSG<br />
        ld bc, end1-lineMSG<br />
        call myPrint42<br />
<br />
calling <br />
<br />
SUB fastcall myPrint42()<br />
ASM<br />
myPrint42:<br />
    push    af<br />
    push    ix<br />
    push    hl<br />
    ld    ix, PRINT42<br />
    CALL    IXCALL<br />
    pop    hl<br />
    pop    ix<br />
    pop    af<br />
    ret<br />
END ASM<br />
END SUB<br />
<br />
gives me Error: Undefined GLOBAL label ".myPrint42"<br />
<br />
any help please....]]></description>
			<content:encoded><![CDATA[Looking over an old file of mine that once worked I'm now getting Error: Undefined GLOBAL label . each one is going to a fastcall.<br />
<br />
ie<br />
<br />
        ld hl, lineMSG<br />
        ld bc, end1-lineMSG<br />
        call myPrint42<br />
<br />
calling <br />
<br />
SUB fastcall myPrint42()<br />
ASM<br />
myPrint42:<br />
    push    af<br />
    push    ix<br />
    push    hl<br />
    ld    ix, PRINT42<br />
    CALL    IXCALL<br />
    pop    hl<br />
    pop    ix<br />
    pop    af<br />
    ret<br />
END ASM<br />
END SUB<br />
<br />
gives me Error: Undefined GLOBAL label ".myPrint42"<br />
<br />
any help please....]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[A Fast(er) Plot Routine for Boriel Basic]]></title>
			<link>https://forum.boriel.com/showthread.php?tid=2647</link>
			<pubDate>Tue, 28 Oct 2025 14:56:34 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.boriel.com/member.php?action=profile&uid=2556">tubz74</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.boriel.com/showthread.php?tid=2647</guid>
			<description><![CDATA[I orginally posted this on SpectrumComputing Forum - copied here in case anyone wants to play with it :-)<br />
<br />
Hi<br />
<br />
Hope this helps someone else :-)<br />
<br />
I saw a post by Andy Dansby who writes at <a href="https://zxspectrumcoding.wordpress.com/" target="_blank" rel="noopener" class="mycode_url">https://zxspectrumcoding.wordpress.com/</a><br />
<br />
He has created a fast plot routine, (hellaplot), so I thought I'd try and convert it to a Boriel Basic (BB) subroutine, just for fun and learning - and as it was a single routine.<br />
<br />
I had to do a little bit of reading, but also had to ask for help from the BB telegram community, as to begin with the code was crashing the emulator. Turns out it was a simple fix when you know how - FASTCALL was needed when passing parameters for ASM to use from a SUB routine.<br />
<br />
Andy's code needs the x/y locations in DE, so I had to do a little bit to get them set up like this - I assume there might be some more efficiency if different registers were used as BB passes from the subroutine call, the first parameter into A, and the second parameter is the second item on the stack (the first being the return address).<br />
<br />
When I started, xPos was the first parameter, and yPos the second (as I like x,y), but this meant to get them into DE, took another load (POP DE, LD E with D, LD D with A, compared to POP DE, LD E with A)<br />
<br />
So some "non exact" timings - plot included as the library in BB takes about 15 seconds to fill up the screen with "points". Andy's one takes 5 seconds to do the same.<br />
<br />
As far as Andy's code goes, I understand the comments, but not exactly how it works :-)<br />
<br />
Anyway, code below :<br />
<br />
SUB FASTCALL HellaPrint(yPos as UBYTE, xPos as UBYTE)<br />
' HellaPrint prints an x,y pixel<br />
' 0,0 is top left<br />
' Original code by Andy Lansby<br />
' <a href="https://zxspectrumcoding.wordpress.com/" target="_blank" rel="noopener" class="mycode_url">https://zxspectrumcoding.wordpress.com/</a><br />
' yPos is first, as it save a LD instruction when putting xPos and yPos into DE<br />
ASM<br />
<br />
JP START ; Put this in as it's like this on the Wiki ASM desciption - can it be avoided?<br />
X_PositionBits: defb 128,64,32,16,8,4,2,1<br />
; Might there be a quicker way to do the above, so it's not needed every time the program is run? or does it not work like this and is created once at compile time?<br />
<br />
START: ; plot d = x-axis, e = y-axis<br />
; A contains the yPos, xPos is on stack.<br />
POP HL ; Pops the return address into HL<br />
POP DE ; xPos is on the stack, and it needs to be in D<br />
LD E, A ; A has our first paramter (yPos), load it into E. D should be Xpos, E should be yPos<br />
PUSH HL ; Puts the return address back onto stack ...<br />
; 166 T states per pixel<br />
XOR A ; reset A to 0 and flags to default<br />
LD A,E ; load Y plot point<br />
RRA ; rotate Right --- divide in half<br />
SCF ; turn on Carry flag-<br />
RRA ; rotate right with the carry flag<br />
OR A ; set flag S on - C flag off<br />
RRA ; rotate Right --- divide in half<br />
<br />
LD L,A ; temp store in L<br />
XOR E ; XOR the Y value<br />
AND %11111000 ; mask out bottom 3 bits<br />
XOR E ; XOR the Y value<br />
<br />
LD H,A ; store High byte<br />
LD A,D ; load X plot point<br />
XOR L ; XOR the temp value<br />
AND %00000111 ; mask out unwanted bits<br />
XOR D ; XOR the X value<br />
RRCA ; divide by 2<br />
RRCA ; divide by 4<br />
RRCA ; divide by 8<br />
<br />
LD L,A ; store Low byte<br />
; now we have the full address<br />
; now use LUT to find which bit to set<br />
LD A,D ; load X plot point<br />
AND %00000111 ; mask out unwanted bits<br />
<br />
; use a LUT to quickly find the bit position for the X position<br />
LD DE,X_PositionBits ; load LUT address into DE<br />
ADD A,E ; Add A to E to get offset into table<br />
LD E,A ; E now points to the LUT entry<br />
LD A,(DE) ; load answer into A<br />
<br />
; output to screen<br />
OR (HL) ; or with contents of address HL<br />
LD (HL),A ; load address HL with Answer from A<br />
END ASM<br />
END SUB]]></description>
			<content:encoded><![CDATA[I orginally posted this on SpectrumComputing Forum - copied here in case anyone wants to play with it :-)<br />
<br />
Hi<br />
<br />
Hope this helps someone else :-)<br />
<br />
I saw a post by Andy Dansby who writes at <a href="https://zxspectrumcoding.wordpress.com/" target="_blank" rel="noopener" class="mycode_url">https://zxspectrumcoding.wordpress.com/</a><br />
<br />
He has created a fast plot routine, (hellaplot), so I thought I'd try and convert it to a Boriel Basic (BB) subroutine, just for fun and learning - and as it was a single routine.<br />
<br />
I had to do a little bit of reading, but also had to ask for help from the BB telegram community, as to begin with the code was crashing the emulator. Turns out it was a simple fix when you know how - FASTCALL was needed when passing parameters for ASM to use from a SUB routine.<br />
<br />
Andy's code needs the x/y locations in DE, so I had to do a little bit to get them set up like this - I assume there might be some more efficiency if different registers were used as BB passes from the subroutine call, the first parameter into A, and the second parameter is the second item on the stack (the first being the return address).<br />
<br />
When I started, xPos was the first parameter, and yPos the second (as I like x,y), but this meant to get them into DE, took another load (POP DE, LD E with D, LD D with A, compared to POP DE, LD E with A)<br />
<br />
So some "non exact" timings - plot included as the library in BB takes about 15 seconds to fill up the screen with "points". Andy's one takes 5 seconds to do the same.<br />
<br />
As far as Andy's code goes, I understand the comments, but not exactly how it works :-)<br />
<br />
Anyway, code below :<br />
<br />
SUB FASTCALL HellaPrint(yPos as UBYTE, xPos as UBYTE)<br />
' HellaPrint prints an x,y pixel<br />
' 0,0 is top left<br />
' Original code by Andy Lansby<br />
' <a href="https://zxspectrumcoding.wordpress.com/" target="_blank" rel="noopener" class="mycode_url">https://zxspectrumcoding.wordpress.com/</a><br />
' yPos is first, as it save a LD instruction when putting xPos and yPos into DE<br />
ASM<br />
<br />
JP START ; Put this in as it's like this on the Wiki ASM desciption - can it be avoided?<br />
X_PositionBits: defb 128,64,32,16,8,4,2,1<br />
; Might there be a quicker way to do the above, so it's not needed every time the program is run? or does it not work like this and is created once at compile time?<br />
<br />
START: ; plot d = x-axis, e = y-axis<br />
; A contains the yPos, xPos is on stack.<br />
POP HL ; Pops the return address into HL<br />
POP DE ; xPos is on the stack, and it needs to be in D<br />
LD E, A ; A has our first paramter (yPos), load it into E. D should be Xpos, E should be yPos<br />
PUSH HL ; Puts the return address back onto stack ...<br />
; 166 T states per pixel<br />
XOR A ; reset A to 0 and flags to default<br />
LD A,E ; load Y plot point<br />
RRA ; rotate Right --- divide in half<br />
SCF ; turn on Carry flag-<br />
RRA ; rotate right with the carry flag<br />
OR A ; set flag S on - C flag off<br />
RRA ; rotate Right --- divide in half<br />
<br />
LD L,A ; temp store in L<br />
XOR E ; XOR the Y value<br />
AND %11111000 ; mask out bottom 3 bits<br />
XOR E ; XOR the Y value<br />
<br />
LD H,A ; store High byte<br />
LD A,D ; load X plot point<br />
XOR L ; XOR the temp value<br />
AND %00000111 ; mask out unwanted bits<br />
XOR D ; XOR the X value<br />
RRCA ; divide by 2<br />
RRCA ; divide by 4<br />
RRCA ; divide by 8<br />
<br />
LD L,A ; store Low byte<br />
; now we have the full address<br />
; now use LUT to find which bit to set<br />
LD A,D ; load X plot point<br />
AND %00000111 ; mask out unwanted bits<br />
<br />
; use a LUT to quickly find the bit position for the X position<br />
LD DE,X_PositionBits ; load LUT address into DE<br />
ADD A,E ; Add A to E to get offset into table<br />
LD E,A ; E now points to the LUT entry<br />
LD A,(DE) ; load answer into A<br />
<br />
; output to screen<br />
OR (HL) ; or with contents of address HL<br />
LD (HL),A ; load address HL with Answer from A<br />
END ASM<br />
END SUB]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Hall of Fame - Include for ZX Basic]]></title>
			<link>https://forum.boriel.com/showthread.php?tid=2646</link>
			<pubDate>Tue, 28 Oct 2025 14:48:44 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.boriel.com/member.php?action=profile&uid=2556">tubz74</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.boriel.com/showthread.php?tid=2646</guid>
			<description><![CDATA[Hi<br />
<br />
HOF.zxbas - Hall of fame procedures<br />
main.zxbas - a demo<br />
<br />
Attached is a little "library" for a Hall of Fame / High Score table.<br />
<br />
To use it - you need to create two Arrays (at least 2 ...)<br />
<br />
Array 1 = UInteger, for scores<br />
Array 2 = String, for names<br />
<br />
Probably best to keep to 10 entries, but could be more.  You can have more than 1 HOF, so could have Array2, Arry3 etc etc for say Easy Score, Medium Scores, Hard Scores.  As it passes the Arrays by reference, no other variables are needed.<br />
<br />
Completely and utterly free to use, adapt, change, republish how ever you want.<br />
<br />
Arraybase is 0<br />
<br />
SUB HOF_IntialiseHOF(BYREF HOF_Scores() AS UINTEGER, BYREF HOF_Names() AS STRING, HOF_IntialTopScore as UINTEGER,HOF_InitialName AS STRING)<br />
Use this to initialise the two HOF arrays - with a "highest score, working down to a low score and gives each entry "InitialName".<br />
<br />
FUNCTION HOF_HighScore_CheckEntry (HOF_Scores() AS UINTEGER, NewHighScore as UINTEGER) AS BYTE <br />
Returns 1 if the High Score can g into the Arrays.<br />
<br />
SUB HOF_HighScore_NewEntry (BYREF HOF_Scores() AS UINTEGER, BYREF HOF_Names() AS STRING, NewHighScore as UINTEGER, NewHighScoreName AS STRING)<br />
Puts the new entries (name &amp; score) into the HOF array.<br />
<br />
SUB HOF_Print(BYREF HOF_Scores() AS UINTEGER, BYREF HOF_Names() AS STRING, YPOS as INTEGER, XPOS as INTEGER)<br />
A simple print location, witch prints the Score and Names.  Will carry on printing if you have many entries ...<br />
<br />
SUB HOF_PrintSpecial(BYREF HOF_Scores() AS UINTEGER, BYREF HOF_Names() AS STRING)<br />
A "pretty High Score screen", that prints the top 10 scores.<br />
<br />
Can probably be improved and made much more efficient.  There are porbably bugs as well (for example not sure what would happen if you had 100 entries with a first high score of 10 ... i think it's probably overflow to 655555 etc.  It includes string.bas and input.bas - not sure if the library needs both of those.<br /><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://forum.boriel.com/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=362" target="_blank" title="">HOF.zip</a> (Size: 2.98 KB / Downloads: 116)
<!-- end: postbit_attachments_attachment --><br /><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://forum.boriel.com/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=363" target="_blank" title="">Hall Of Fame.png</a> (Size: 2.13 KB / Downloads: 148)
<!-- end: postbit_attachments_attachment -->]]></description>
			<content:encoded><![CDATA[Hi<br />
<br />
HOF.zxbas - Hall of fame procedures<br />
main.zxbas - a demo<br />
<br />
Attached is a little "library" for a Hall of Fame / High Score table.<br />
<br />
To use it - you need to create two Arrays (at least 2 ...)<br />
<br />
Array 1 = UInteger, for scores<br />
Array 2 = String, for names<br />
<br />
Probably best to keep to 10 entries, but could be more.  You can have more than 1 HOF, so could have Array2, Arry3 etc etc for say Easy Score, Medium Scores, Hard Scores.  As it passes the Arrays by reference, no other variables are needed.<br />
<br />
Completely and utterly free to use, adapt, change, republish how ever you want.<br />
<br />
Arraybase is 0<br />
<br />
SUB HOF_IntialiseHOF(BYREF HOF_Scores() AS UINTEGER, BYREF HOF_Names() AS STRING, HOF_IntialTopScore as UINTEGER,HOF_InitialName AS STRING)<br />
Use this to initialise the two HOF arrays - with a "highest score, working down to a low score and gives each entry "InitialName".<br />
<br />
FUNCTION HOF_HighScore_CheckEntry (HOF_Scores() AS UINTEGER, NewHighScore as UINTEGER) AS BYTE <br />
Returns 1 if the High Score can g into the Arrays.<br />
<br />
SUB HOF_HighScore_NewEntry (BYREF HOF_Scores() AS UINTEGER, BYREF HOF_Names() AS STRING, NewHighScore as UINTEGER, NewHighScoreName AS STRING)<br />
Puts the new entries (name &amp; score) into the HOF array.<br />
<br />
SUB HOF_Print(BYREF HOF_Scores() AS UINTEGER, BYREF HOF_Names() AS STRING, YPOS as INTEGER, XPOS as INTEGER)<br />
A simple print location, witch prints the Score and Names.  Will carry on printing if you have many entries ...<br />
<br />
SUB HOF_PrintSpecial(BYREF HOF_Scores() AS UINTEGER, BYREF HOF_Names() AS STRING)<br />
A "pretty High Score screen", that prints the top 10 scores.<br />
<br />
Can probably be improved and made much more efficient.  There are porbably bugs as well (for example not sure what would happen if you had 100 entries with a first high score of 10 ... i think it's probably overflow to 655555 etc.  It includes string.bas and input.bas - not sure if the library needs both of those.<br /><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://forum.boriel.com/images/attachtypes/zip.png" title="ZIP File" border="0" alt=".zip" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=362" target="_blank" title="">HOF.zip</a> (Size: 2.98 KB / Downloads: 116)
<!-- end: postbit_attachments_attachment --><br /><!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://forum.boriel.com/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=363" target="_blank" title="">Hall Of Fame.png</a> (Size: 2.13 KB / Downloads: 148)
<!-- end: postbit_attachments_attachment -->]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[[SOLVED] Array layout bug - regression in 1.18.3]]></title>
			<link>https://forum.boriel.com/showthread.php?tid=2645</link>
			<pubDate>Fri, 24 Oct 2025 22:24:41 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.boriel.com/member.php?action=profile&uid=2327">Zoran</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.boriel.com/showthread.php?tid=2645</guid>
			<description><![CDATA[Please take a look at this simple programme:<br />
<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>dim a(5) as ubyte =&gt; {0, 1, 2, 3, 4, 5}<br />
dim b(5) as ubyte<br />
dim i as uinteger<br />
<br />
for i = 0 to 5<br />
    poke @b + i, a(i)<br />
next<br />
<br />
cls<br />
<br />
for i = 0 to 5<br />
    print a(i), b(i)<br />
next</code></div></div><br />
When compiled with zxbasic 1.18.2 this works as expected - both arrays are same. See the attached image:<br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://forum.boriel.com/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=360" target="_blank" title="">arrays_zxbasic_1_18_2.png</a> (Size: 8.81 KB / Downloads: 153)
<!-- end: postbit_attachments_attachment --><br />
However, with zxbasic 1.18.3, the programme fails miserably and crashes the Spectrum<br />
<br />
In both cases compiled with <br />
<blockquote class="mycode_quote"><cite>Quote: Wrote:</cite>--optimize 2  --output-format=tzx --BASIC --autorun --explicit --strict</blockquote><br />
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 <a href="https://skoolkid.github.io/rom/asm/5C36.html" target="_blank" rel="noopener" class="mycode_url">the system variable 5C36</a> to the address of the array minus 256 (@array - &#36;100) and when I want to print latin text, I just poke this variable back to default value  &#36;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.<br />
What happend with array layout?<br />
<br />
<hr class="mycode_hr" />
<br />
<br />
Now I tried to see the address of the array itself, compared with the addresses of array elements:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>dim a(5) as ubyte =&gt; {0, 1, 2, 3, 4, 5}<br />
dim i as uinteger<br />
cls<br />
print "@a = "; @a<br />
print "------------"<br />
for i = 0 to 5<br />
  print "@a("; i; ") = "; @a(i)<br />
next</code></div></div><br />
The attached image shows the output with zxbasic 1.18.2 compared with zxbasic 1.18.3:<br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://forum.boriel.com/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=361" target="_blank" title="">arrayAddresses.png</a> (Size: 14.42 KB / Downloads: 172)
<!-- end: postbit_attachments_attachment --><br />
<br />
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.<br />
<br />
So, I can workaround the problem with the custom character set that I mentioned in my previous post using:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>poke (uinteger &#36;5c36, @charset(0,0) - &#36;100) ' the address of the first element</code></div></div>instead of<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>poke (uinteger &#36;5c36, @charset - &#36;0100) ' the address of the array</code></div></div><br />
But still, is there a reason for this, or is it just a bug?]]></description>
			<content:encoded><![CDATA[Please take a look at this simple programme:<br />
<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>dim a(5) as ubyte =&gt; {0, 1, 2, 3, 4, 5}<br />
dim b(5) as ubyte<br />
dim i as uinteger<br />
<br />
for i = 0 to 5<br />
    poke @b + i, a(i)<br />
next<br />
<br />
cls<br />
<br />
for i = 0 to 5<br />
    print a(i), b(i)<br />
next</code></div></div><br />
When compiled with zxbasic 1.18.2 this works as expected - both arrays are same. See the attached image:<br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://forum.boriel.com/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=360" target="_blank" title="">arrays_zxbasic_1_18_2.png</a> (Size: 8.81 KB / Downloads: 153)
<!-- end: postbit_attachments_attachment --><br />
However, with zxbasic 1.18.3, the programme fails miserably and crashes the Spectrum<br />
<br />
In both cases compiled with <br />
<blockquote class="mycode_quote"><cite>Quote: Wrote:</cite>--optimize 2  --output-format=tzx --BASIC --autorun --explicit --strict</blockquote><br />
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 <a href="https://skoolkid.github.io/rom/asm/5C36.html" target="_blank" rel="noopener" class="mycode_url">the system variable 5C36</a> to the address of the array minus 256 (@array - &#36;100) and when I want to print latin text, I just poke this variable back to default value  &#36;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.<br />
What happend with array layout?<br />
<br />
<hr class="mycode_hr" />
<br />
<br />
Now I tried to see the address of the array itself, compared with the addresses of array elements:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>dim a(5) as ubyte =&gt; {0, 1, 2, 3, 4, 5}<br />
dim i as uinteger<br />
cls<br />
print "@a = "; @a<br />
print "------------"<br />
for i = 0 to 5<br />
  print "@a("; i; ") = "; @a(i)<br />
next</code></div></div><br />
The attached image shows the output with zxbasic 1.18.2 compared with zxbasic 1.18.3:<br />
<!-- start: postbit_attachments_attachment -->
<br /><!-- start: attachment_icon -->
<img src="https://forum.boriel.com/images/attachtypes/image.png" title="PNG Image" border="0" alt=".png" />
<!-- end: attachment_icon -->&nbsp;&nbsp;<a href="attachment.php?aid=361" target="_blank" title="">arrayAddresses.png</a> (Size: 14.42 KB / Downloads: 172)
<!-- end: postbit_attachments_attachment --><br />
<br />
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.<br />
<br />
So, I can workaround the problem with the custom character set that I mentioned in my previous post using:<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>poke (uinteger &#36;5c36, @charset(0,0) - &#36;100) ' the address of the first element</code></div></div>instead of<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>poke (uinteger &#36;5c36, @charset - &#36;0100) ' the address of the array</code></div></div><br />
But still, is there a reason for this, or is it just a bug?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[3DOS Commands?]]></title>
			<link>https://forum.boriel.com/showthread.php?tid=2643</link>
			<pubDate>Sun, 05 Oct 2025 21:33:54 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.boriel.com/member.php?action=profile&uid=2556">tubz74</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.boriel.com/showthread.php?tid=2643</guid>
			<description><![CDATA[Hi<br />
<br />
I'm looking at using some 3DOS commands, starting to see how I can cat a disk.<br />
<br />
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.<br />
<br />
I'm assuming that there might be some incompatibility somewhere between, starting reading, and returning contorl to the program.  Code is below.<br />
<br />
Any thoughts?<br />
<br />
(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)<br />
<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>#include &lt;input.bas&gt;<br />
#include &lt;screen.bas&gt;<br />
#INCLUDE &lt;keys.bas&gt; <br />
<br />
PRINT "This is the start"<br />
main()<br />
<br />
<br />
SUB main()<br />
    LET YesNo = "n"<br />
    PRINT "do you want to CAT disk"<br />
    YesNo = INPUT(1)<br />
    IF YesNo="y" then<br />
        Catalogue()<br />
    END IF<br />
    PRINT "Ed#nd Main"<br />
END SUB<br />
<br />
<br />
<br />
SUB Catalogue()<br />
    ASM<br />
        PUSH IX ; dos catalog corrupts ix<br />
        PROC<br />
        <br />
        LOCAL   MYSTACK<br />
        LOCAL   STACKSTORAGE<br />
        LOCAL   BANKM<br />
        LOCAL   PORT1<br />
        LOCAL   CATBUFF<br />
        LOCAL   DOS_CATALOG<br />
        <br />
        <br />
        MYSTACK         EQU     9fffh ; <br />
        STACKSTORAGE    EQU     9000h ; save pointer<br />
        BANKM           EQU     5b5ch ; system var that holds last value output to 7ff0h<br />
        PORT1           EQU     7ffdh ; address of rom/ram switching port<br />
        CATBUFF         EQU     8000h ; location for dos to output<br />
        DOS_CATALOG     EQU     011Eh ; DOS routine to call<br />
    <br />
        JP start<br />
        stardstar:  defb "*.*",255                    <br />
        dosret:     defw 0<br />
    <br />
        start:<br />
            DI<br />
            LD (STACKSTORAGE),SP<br />
            LD BC,PORT1         ; <br />
            LD A,(BANKM)        ; current switch state<br />
            RES 4,A             ; move right to left in horizontal rom switch (3 to 2)<br />
            OR 7                ; switch in ram page 7<br />
            LD (BANKM),A        ; keep system var up to date<br />
            OUT (C),A           ; switch ram and rom<br />
            LD SP,MYSTACK       ; make sure stack is above 4000h and below bfeoh<br />
            EI                  ; enable interrupts<br />
            ; <br />
    <br />
   <br />
            LD HL,CATBUFF<br />
            LD DE,CATBUFF+1<br />
            LD BC,1024<br />
            LD (HL),0<br />
            LDIR<br />
            LD B,64<br />
            LD C,1<br />
            LD DE, CATBUFF<br />
            LD HL,stardstar             ;file name *.*<br />
            CALL DOS_CATALOG            ;call dos catalog<br />
            PUSH AF<br />
            POP HL<br />
            LD (dosret),HL              ; put here so can be seen from basic<br />
            LD C,B                      ; number of files in catalog, low byte of bc<br />
            LD B,0                      ; returned to basic by usr functio<br />
    <br />
            DI<br />
            PUSH BC<br />
            LD BC, PORT1<br />
            LD A, (BANKM)<br />
            SET 4, A                    ; move left to right (riom 2 to 3)<br />
            AND 48h                     ; ram page 9<br />
            LD (BANKM),A                ; update syste value<br />
            OUT (C),A                   ;switch<br />
            POP BC                      ; get back saved number of files<br />
            LD SP,(STACKSTORAGE)        ; <br />
            EI<br />
            ;RET ; not sure if thisis needed<br />
        ENDP<br />
        POP IX<br />
        ;RET ; Not sure if this is needed here<br />
    END ASM<br />
END SUB</code></div></div>]]></description>
			<content:encoded><![CDATA[Hi<br />
<br />
I'm looking at using some 3DOS commands, starting to see how I can cat a disk.<br />
<br />
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.<br />
<br />
I'm assuming that there might be some incompatibility somewhere between, starting reading, and returning contorl to the program.  Code is below.<br />
<br />
Any thoughts?<br />
<br />
(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)<br />
<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>#include &lt;input.bas&gt;<br />
#include &lt;screen.bas&gt;<br />
#INCLUDE &lt;keys.bas&gt; <br />
<br />
PRINT "This is the start"<br />
main()<br />
<br />
<br />
SUB main()<br />
    LET YesNo = "n"<br />
    PRINT "do you want to CAT disk"<br />
    YesNo = INPUT(1)<br />
    IF YesNo="y" then<br />
        Catalogue()<br />
    END IF<br />
    PRINT "Ed#nd Main"<br />
END SUB<br />
<br />
<br />
<br />
SUB Catalogue()<br />
    ASM<br />
        PUSH IX ; dos catalog corrupts ix<br />
        PROC<br />
        <br />
        LOCAL   MYSTACK<br />
        LOCAL   STACKSTORAGE<br />
        LOCAL   BANKM<br />
        LOCAL   PORT1<br />
        LOCAL   CATBUFF<br />
        LOCAL   DOS_CATALOG<br />
        <br />
        <br />
        MYSTACK         EQU     9fffh ; <br />
        STACKSTORAGE    EQU     9000h ; save pointer<br />
        BANKM           EQU     5b5ch ; system var that holds last value output to 7ff0h<br />
        PORT1           EQU     7ffdh ; address of rom/ram switching port<br />
        CATBUFF         EQU     8000h ; location for dos to output<br />
        DOS_CATALOG     EQU     011Eh ; DOS routine to call<br />
    <br />
        JP start<br />
        stardstar:  defb "*.*",255                    <br />
        dosret:     defw 0<br />
    <br />
        start:<br />
            DI<br />
            LD (STACKSTORAGE),SP<br />
            LD BC,PORT1         ; <br />
            LD A,(BANKM)        ; current switch state<br />
            RES 4,A             ; move right to left in horizontal rom switch (3 to 2)<br />
            OR 7                ; switch in ram page 7<br />
            LD (BANKM),A        ; keep system var up to date<br />
            OUT (C),A           ; switch ram and rom<br />
            LD SP,MYSTACK       ; make sure stack is above 4000h and below bfeoh<br />
            EI                  ; enable interrupts<br />
            ; <br />
    <br />
   <br />
            LD HL,CATBUFF<br />
            LD DE,CATBUFF+1<br />
            LD BC,1024<br />
            LD (HL),0<br />
            LDIR<br />
            LD B,64<br />
            LD C,1<br />
            LD DE, CATBUFF<br />
            LD HL,stardstar             ;file name *.*<br />
            CALL DOS_CATALOG            ;call dos catalog<br />
            PUSH AF<br />
            POP HL<br />
            LD (dosret),HL              ; put here so can be seen from basic<br />
            LD C,B                      ; number of files in catalog, low byte of bc<br />
            LD B,0                      ; returned to basic by usr functio<br />
    <br />
            DI<br />
            PUSH BC<br />
            LD BC, PORT1<br />
            LD A, (BANKM)<br />
            SET 4, A                    ; move left to right (riom 2 to 3)<br />
            AND 48h                     ; ram page 9<br />
            LD (BANKM),A                ; update syste value<br />
            OUT (C),A                   ;switch<br />
            POP BC                      ; get back saved number of files<br />
            LD SP,(STACKSTORAGE)        ; <br />
            EI<br />
            ;RET ; not sure if thisis needed<br />
        ENDP<br />
        POP IX<br />
        ;RET ; Not sure if this is needed here<br />
    END ASM<br />
END SUB</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[How to open fuse as an external emulator in ZXBasic Studio for +2a/b/+3- Windows 11]]></title>
			<link>https://forum.boriel.com/showthread.php?tid=2642</link>
			<pubDate>Sun, 05 Oct 2025 18:13:38 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.boriel.com/member.php?action=profile&uid=2556">tubz74</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.boriel.com/showthread.php?tid=2642</guid>
			<description><![CDATA[ZXStudio doesn't support +3/+2a etc in the included emulator.  Requires at least Beta 6 of ZXBasicStudio<br />
<br />
Use Project/Configure Project to configure.<br />
<br />
Example Compiler Parameters<br />
<br />
<span style="font-weight: bold;" class="mycode_b">-O 0 -S 32768 -H 4768</span>  <span style="text-decoration: underline;" class="mycode_u">-f tap -B -a</span><br />
<br />
(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.<br />
<br />
Example Launch External Emulator<br />
<br />
C:\zx\projects\DOSTesting\ZXStartFuse.bat<br />
<br />
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.<br />
<br />
ZXStartFuse.bat created in the OS, and renamed to .bat, as it was txt file.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>ECHO OFF<br />
"C:&#92;Program Files (x86)&#92;Fuse&#92;fuse.exe" -m plus3 --auto-load %1%2.tap</code></div></div><br />
<br />
This would open a plus3 spectrum in fuse and run the tap file.<br />
<br />
(Thanks to support from telegram for getting this to work ..)]]></description>
			<content:encoded><![CDATA[ZXStudio doesn't support +3/+2a etc in the included emulator.  Requires at least Beta 6 of ZXBasicStudio<br />
<br />
Use Project/Configure Project to configure.<br />
<br />
Example Compiler Parameters<br />
<br />
<span style="font-weight: bold;" class="mycode_b">-O 0 -S 32768 -H 4768</span>  <span style="text-decoration: underline;" class="mycode_u">-f tap -B -a</span><br />
<br />
(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.<br />
<br />
Example Launch External Emulator<br />
<br />
C:\zx\projects\DOSTesting\ZXStartFuse.bat<br />
<br />
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.<br />
<br />
ZXStartFuse.bat created in the OS, and renamed to .bat, as it was txt file.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>ECHO OFF<br />
"C:&#92;Program Files (x86)&#92;Fuse&#92;fuse.exe" -m plus3 --auto-load %1%2.tap</code></div></div><br />
<br />
This would open a plus3 spectrum in fuse and run the tap file.<br />
<br />
(Thanks to support from telegram for getting this to work ..)]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[CLS/Fade out ASM Sub-routine]]></title>
			<link>https://forum.boriel.com/showthread.php?tid=2641</link>
			<pubDate>Sun, 05 Oct 2025 13:37:34 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.boriel.com/member.php?action=profile&uid=2556">tubz74</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.boriel.com/showthread.php?tid=2641</guid>
			<description><![CDATA[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.<br />
<br />
No idea if it breaks anything else, but I've not had any issues.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>SUB CLSFadeOut()<br />
' Fade out Screen Clearing<br />
<br />
    ASM<br />
<br />
        LD DE,08feh<br />
        NXTFADE:<br />
            LD A,E<br />
            RLCA<br />
            RLCA<br />
            RLCA<br />
            LD E,A<br />
            LD HL,4000H<br />
            LD BC,0018H<br />
            NXT:<br />
                LD A, (HL)<br />
                AND E<br />
                LD (HL),A<br />
                INC HL<br />
            DJNZ NXT<br />
            DEC C<br />
            JR NZ,NXT<br />
            DEC D<br />
        JR NZ,NXTFADE<br />
        LD A,(5C8DH)<br />
        LD (HL),A<br />
        LD D,H<br />
        LD E,L<br />
        INC DE<br />
        LD BC,02C0H<br />
        LDIR<br />
        LD A,(5C48H)<br />
        LD (HL),A<br />
        LD C,3FH<br />
        LDIR<br />
    END ASM<br />
<br />
END SUB</code></div></div>]]></description>
			<content:encoded><![CDATA[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.<br />
<br />
No idea if it breaks anything else, but I've not had any issues.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>SUB CLSFadeOut()<br />
' Fade out Screen Clearing<br />
<br />
    ASM<br />
<br />
        LD DE,08feh<br />
        NXTFADE:<br />
            LD A,E<br />
            RLCA<br />
            RLCA<br />
            RLCA<br />
            LD E,A<br />
            LD HL,4000H<br />
            LD BC,0018H<br />
            NXT:<br />
                LD A, (HL)<br />
                AND E<br />
                LD (HL),A<br />
                INC HL<br />
            DJNZ NXT<br />
            DEC C<br />
            JR NZ,NXT<br />
            DEC D<br />
        JR NZ,NXTFADE<br />
        LD A,(5C8DH)<br />
        LD (HL),A<br />
        LD D,H<br />
        LD E,L<br />
        INC DE<br />
        LD BC,02C0H<br />
        LDIR<br />
        LD A,(5C48H)<br />
        LD (HL),A<br />
        LD C,3FH<br />
        LDIR<br />
    END ASM<br />
<br />
END SUB</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[ZX Basic Studio Bugs]]></title>
			<link>https://forum.boriel.com/showthread.php?tid=2638</link>
			<pubDate>Fri, 19 Sep 2025 15:21:36 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.boriel.com/member.php?action=profile&uid=2552">ZXPeter</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.boriel.com/showthread.php?tid=2638</guid>
			<description><![CDATA[Don't know if this is the correct place for this post  but I'm sure someone will let me know if not.<br />
<br />
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.<br />
<br />
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:<br />
<br />
(1)<br />
With buildA the Main.bas file appears in the explorer window when it is created,as described in the book. <br />
<br />
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 <br />
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.<br />
<br />
(2)<br />
For both buildA and buildB running the book's example code (page 51) without debug results in the expected coloured block of X's.<br />
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).<br />
<br />
Hope this information is useful.]]></description>
			<content:encoded><![CDATA[Don't know if this is the correct place for this post  but I'm sure someone will let me know if not.<br />
<br />
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.<br />
<br />
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:<br />
<br />
(1)<br />
With buildA the Main.bas file appears in the explorer window when it is created,as described in the book. <br />
<br />
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 <br />
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.<br />
<br />
(2)<br />
For both buildA and buildB running the book's example code (page 51) without debug results in the expected coloured block of X's.<br />
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).<br />
<br />
Hope this information is useful.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Printing with FZX]]></title>
			<link>https://forum.boriel.com/showthread.php?tid=2632</link>
			<pubDate>Mon, 14 Jul 2025 15:45:43 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.boriel.com/member.php?action=profile&uid=2514">solar penguin</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.boriel.com/showthread.php?tid=2632</guid>
			<description><![CDATA[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)<br />
<br />
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?<br />
<br />
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?<br />
<br />
Thanks]]></description>
			<content:encoded><![CDATA[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)<br />
<br />
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?<br />
<br />
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?<br />
<br />
Thanks]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Strange Happenings]]></title>
			<link>https://forum.boriel.com/showthread.php?tid=2625</link>
			<pubDate>Wed, 07 May 2025 09:05:06 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.boriel.com/member.php?action=profile&uid=2220">zedex82</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.boriel.com/showthread.php?tid=2625</guid>
			<description><![CDATA[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. <br />
<br />
I have noticed two things.<br />
<br />
1. Any new file I create is not showing in the Project Explorer. I have to reload the project for them to appear<br />
<br />
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.<br />
<br />
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.<br />
<br />
Thanks<br />
<br />
ZeD]]></description>
			<content:encoded><![CDATA[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. <br />
<br />
I have noticed two things.<br />
<br />
1. Any new file I create is not showing in the Project Explorer. I have to reload the project for them to appear<br />
<br />
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.<br />
<br />
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.<br />
<br />
Thanks<br />
<br />
ZeD]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[.tap file code not executed]]></title>
			<link>https://forum.boriel.com/showthread.php?tid=2624</link>
			<pubDate>Thu, 24 Apr 2025 16:09:58 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.boriel.com/member.php?action=profile&uid=2384">manuelzo75</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.boriel.com/showthread.php?tid=2624</guid>
			<description><![CDATA[Hello, I'm a newbie tinkering with the Spectrum.<br />
I tried to get some code to test like the classic 'clock.bas' or 'circle. bas' and then converting a .bas file to .tap.<br />
In some cases, I obtain some errors like:<br />
<br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">manuelzompetta@Manuels-MacBook-Pro zxbasic % python zxbc.py clock.bas </span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">clock.bas:21: warning: [W100] Using default implicit type 'float' for 'a'</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">clock.bas:22: warning: [W100] Using default implicit type 'float' for 'sx'</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">clock.bas:22: warning: [W100] Using default implicit type 'float' for 'sy'</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">clock.bas:25: warning: [W100] Using default implicit type 'ulong' for 't2'</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">Traceback (most recent call last):</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">  File "/Users/manuelzompetta/Downloads/zxbasic/zxbc.py", line 12, in &lt;module&gt;</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">    sys.exit(zxbc.main())  # Exit</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">             ^^^^^^^^^^^</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">  File "/Users/manuelzompetta/Downloads/zxbasic/src/zxbc/zxbc.py", line 155, in main</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">    asm_output = backend.emit(optimize=OPTIONS.optimization_level &gt; 0)</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">  File "/Users/manuelzompetta/Downloads/zxbasic/src/arch/z80/backend/main.py", line 770, in emit</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">    self._output_join(output, self._QUAD_TABLE[quad.instr].func(quad), optimize=optimize)</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">  File "/Users/manuelzompetta/Downloads/zxbasic/src/arch/z80/backend/generic.py", line 362, in _cast</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">    output.extend(to_long(tA))</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">                  ^^^^^^^^^^^</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">  File "/Users/manuelzompetta/Downloads/zxbasic/src/arch/z80/backend/common.py", line 401, in to_long</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">    raise NotImplementedError(f"type conversion from {stype} to long is undefined")</span></span></span><br />
<span style="font-size: 10pt;" class="mycode_size"><span style="color: #000000;" class="mycode_color"><span style="font-family: Monaco;" class="mycode_font">NotImplementedError: type conversion from u32 to long is undefined</span></span></span><br />
<br />
<br />
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.<br />
<br />
What I'm doing wrong?<br />
<br />
Thanks]]></description>
			<content:encoded><![CDATA[Hello, I'm a newbie tinkering with the Spectrum.<br />
I tried to get some code to test like the classic 'clock.bas' or 'circle. bas' and then converting a .bas file to .tap.<br />
In some cases, I obtain some errors like:<br />
<br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">manuelzompetta@Manuels-MacBook-Pro zxbasic % python zxbc.py clock.bas </span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">clock.bas:21: warning: [W100] Using default implicit type 'float' for 'a'</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">clock.bas:22: warning: [W100] Using default implicit type 'float' for 'sx'</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">clock.bas:22: warning: [W100] Using default implicit type 'float' for 'sy'</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">clock.bas:25: warning: [W100] Using default implicit type 'ulong' for 't2'</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">Traceback (most recent call last):</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">  File "/Users/manuelzompetta/Downloads/zxbasic/zxbc.py", line 12, in &lt;module&gt;</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">    sys.exit(zxbc.main())  # Exit</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">             ^^^^^^^^^^^</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">  File "/Users/manuelzompetta/Downloads/zxbasic/src/zxbc/zxbc.py", line 155, in main</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">    asm_output = backend.emit(optimize=OPTIONS.optimization_level &gt; 0)</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">  File "/Users/manuelzompetta/Downloads/zxbasic/src/arch/z80/backend/main.py", line 770, in emit</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">    self._output_join(output, self._QUAD_TABLE[quad.instr].func(quad), optimize=optimize)</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">  File "/Users/manuelzompetta/Downloads/zxbasic/src/arch/z80/backend/generic.py", line 362, in _cast</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">    output.extend(to_long(tA))</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">                  ^^^^^^^^^^^</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">  File "/Users/manuelzompetta/Downloads/zxbasic/src/arch/z80/backend/common.py", line 401, in to_long</span></span></span><br />
<span style="color: #000000;" class="mycode_color"><span style="font-size: 10pt;" class="mycode_size"><span style="font-family: Monaco;" class="mycode_font">    raise NotImplementedError(f"type conversion from {stype} to long is undefined")</span></span></span><br />
<span style="font-size: 10pt;" class="mycode_size"><span style="color: #000000;" class="mycode_color"><span style="font-family: Monaco;" class="mycode_font">NotImplementedError: type conversion from u32 to long is undefined</span></span></span><br />
<br />
<br />
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.<br />
<br />
What I'm doing wrong?<br />
<br />
Thanks]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Exit from more than one level]]></title>
			<link>https://forum.boriel.com/showthread.php?tid=2623</link>
			<pubDate>Fri, 18 Apr 2025 14:50:07 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://forum.boriel.com/member.php?action=profile&uid=2327">Zoran</a>]]></dc:creator>
			<guid isPermaLink="false">https://forum.boriel.com/showthread.php?tid=2623</guid>
			<description><![CDATA[Sometimes we need exit not only from innermost loop, but also from some outer loop (sometimes more than two levels).<br />
<br />
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":<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>do<br />
   ' some code<br />
   while 1<br />
      ' some code<br />
<br />
      if somecondition then<br />
       &nbsp;&nbsp;exit do ' exit from two levels<br />
      end if<br />
<br />
      ' some code...<br />
      if someothercondition then<br />
       &nbsp;&nbsp;exit while ' exit inner loop only<br />
      end if<br />
<br />
      ' some code...<br />
   end while<br />
<br />
    ' some code...<br />
loop</code></div></div><br />
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.<br />
<br />
What do you think?]]></description>
			<content:encoded><![CDATA[Sometimes we need exit not only from innermost loop, but also from some outer loop (sometimes more than two levels).<br />
<br />
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":<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>do<br />
   ' some code<br />
   while 1<br />
      ' some code<br />
<br />
      if somecondition then<br />
       &nbsp;&nbsp;exit do ' exit from two levels<br />
      end if<br />
<br />
      ' some code...<br />
      if someothercondition then<br />
       &nbsp;&nbsp;exit while ' exit inner loop only<br />
      end if<br />
<br />
      ' some code...<br />
   end while<br />
<br />
    ' some code...<br />
loop</code></div></div><br />
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.<br />
<br />
What do you think?]]></content:encoded>
		</item>
	</channel>
</rss>