<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://f256wiki.wildbitscomputing.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mcassera</id>
	<title>Foenix F256 / Wildbits/K2 Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://f256wiki.wildbitscomputing.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mcassera"/>
	<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Special:Contributions/Mcassera"/>
	<updated>2026-04-20T09:03:41Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Tools_%26_Scripts&amp;diff=38427</id>
		<title>Tools &amp; Scripts</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Tools_%26_Scripts&amp;diff=38427"/>
		<updated>2026-01-30T07:14:52Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: /* Music Tools and Scripts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== 000F256 Machines Game Development Tools ==&lt;br /&gt;
&lt;br /&gt;
=== Sprite Creation Tools &amp;amp; Scripts ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Link !! Notes&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;white-space:nowrap;&amp;quot;| Aseprite&lt;br /&gt;
| style=&amp;quot;white-space:nowrap;&amp;quot;| https://www.aseprite.org/&lt;br /&gt;
| style=&amp;quot;white-space:nowrap;&amp;quot; |Aseprite can be used to create sprites animation or Tiles Sets.&lt;br /&gt;
|-&lt;br /&gt;
|Scripts relevant to Aseprite usage&lt;br /&gt;
|&lt;br /&gt;
*[[Export Aseprite Tilemap]]&lt;br /&gt;
* [[Export Aseprite Tileset]]&lt;br /&gt;
* [[Export Aseprite Sprites]]&lt;br /&gt;
|If you use Aseprite, you can convert your tile drawings to tilesets and tilemaps using these scripts. The export to sprites will convert sprites to a 64tass compatible text file.&lt;br /&gt;
|-&lt;br /&gt;
|f256_sprite_cutter&lt;br /&gt;
|https://gist.github.com/digarok/57b096236a7fb1c76efef6cbb9f73a83&lt;br /&gt;
|Sprite cutter that cuts a PNG according to line-by-line instructions in a text file. Requires python and the PIL library, install with:&lt;br /&gt;
 python -m pip install --upgrade pip &lt;br /&gt;
&lt;br /&gt;
 python -m pip install --upgrade Pillow&lt;br /&gt;
Run with:&lt;br /&gt;
 python f256_sprite_cutter.py myimage.png mylist.txt sprites.s&lt;br /&gt;
where mylist.txt contains a series of lines containing x, y offset, width, name, where it&#039;s assumed the width is the same as the height since it&#039;s for square sprites supported for the F256xx, such as 8,16, or 32.&lt;br /&gt;
&lt;br /&gt;
The output (named sprites.s in this above example) is a series of hex instructions with a list of hex values of a color picked from the CLUT. &lt;br /&gt;
&lt;br /&gt;
In order to make it compatible with 64tass, I search replaced hex-&amp;gt; .byte and replaced every value I could find by swapping in a $ in front (ie 00 -&amp;gt; $00 and 01 -&amp;gt; $01, etc.)&lt;br /&gt;
|-&lt;br /&gt;
|Foenix Graphics Toolkit&lt;br /&gt;
|https://github.com/econtrerasd/F256-GraphicToolkit&lt;br /&gt;
|The Sprite Editor module in the Graphics Toolkit can help you draw sprites of different sizes in the F256 platform and save them as Spr files. The file format is documented in the manual&lt;br /&gt;
|-&lt;br /&gt;
|png2raw.py&lt;br /&gt;
|https://github.com/cmassat/EffenX/tree/dev/util&lt;br /&gt;
|python script by SprySloth, converts a grid png of sprite frames into individual bin (raw bitmap) and pal (palette) files, ready to be consumed by your project. A good source of these grid pngs can be from Aseprite above.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Music Tools and Scripts ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Link !! Notes&lt;br /&gt;
|-&lt;br /&gt;
|DOSBox VGM music extraction mini-guide&lt;br /&gt;
|[[Software#Music]] for playvgm.pgx&lt;br /&gt;
|DOSBox uses a YM3812 chip that outputs OPL2, this is a great, immense source of music that can leverage the OPL functionality of the F256K &lt;br /&gt;
1) run dosbox 0.74+, from the command line and mount your game as &amp;lt;code&amp;gt;dosbox -c &amp;quot;MOUNT C C:\YOURGAMEISHERE&amp;quot;&amp;lt;/code&amp;gt; avoid spaces in folder names &lt;br /&gt;
&lt;br /&gt;
2) before you get to the point where the music you want to extract plays, hit CTRL-ALT-F7 and you should see in the dosbox &#039;log&#039; window that a music capture has started. I think it dumps your captures in /username/appdata/local/dosbox/capture but it will say where in the log window &lt;br /&gt;
&lt;br /&gt;
3) reach the point where it plays and let it loop or run its course, hit CTRL-ALT-F7 to stop the capture. &lt;br /&gt;
&lt;br /&gt;
4) this gives you a .DRO that you can analyze with https://www.jestarjokin.net/apps/drotrimmer/ . the analysis tool is supposed to find loops, but it didn&#039;t work well with the first tune I tried. &lt;br /&gt;
&lt;br /&gt;
5) try to find the location of your first tune&#039;s note in the main window of drotrimmer and try to start the playback from there. delete superfluous notes that might surround your tune. &lt;br /&gt;
&lt;br /&gt;
6) use dro2vgm command line tool: https://www.vgmpf.com/Wiki/index.php/DRO_to_VGM &lt;br /&gt;
&lt;br /&gt;
7) open in a hex editor and chop off the bytes from 0x00 to 0xFF (it&#039;s the header) &lt;br /&gt;
&lt;br /&gt;
8) transfer to your F256K (jr has no opl support!) &lt;br /&gt;
&lt;br /&gt;
9) bload &amp;quot;yourtrimmed.vgm&amp;quot;,$010000 &lt;br /&gt;
&lt;br /&gt;
10) run playvgm.pgx&lt;br /&gt;
|-&lt;br /&gt;
|Convert MIDI files into VGM files.&lt;br /&gt;
| https://github.com/SudoMaker/midi2vgm&lt;br /&gt;
| This is a Linux app, but does compile using Linux on windows under WSL.&lt;br /&gt;
Link to WSL install:&lt;br /&gt;
https://learn.microsoft.com/en-us/windows/wsl/install &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Link to binaries&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
https://github.com/cmassat/midi2vgm/releases/tag/V1.0.0&lt;br /&gt;
&lt;br /&gt;
libADLMIDI.a  &amp;lt;- Required Library&lt;br /&gt;
&lt;br /&gt;
midi2vgm_opl3 &amp;lt;- Executable&lt;br /&gt;
|-&lt;br /&gt;
|convert.py&lt;br /&gt;
|https://github.com/natebarney/playvgm-f256k/tree/master/util&lt;br /&gt;
|from NateBarney&lt;br /&gt;
&lt;br /&gt;
convert.py : python script to read a VGM or VGZ, decompress it if needed, and strip off the VGM header and GD3 tag&lt;br /&gt;
|-&lt;br /&gt;
|Sekaiju&lt;br /&gt;
|https://openmidiproject.opal.ne.jp/Sekaiju_en.html&lt;br /&gt;
|Easily compose and sequence MIDI music. Supports score notation, piano roll and MIDI in if you have a MIDI interface.&lt;br /&gt;
|-&lt;br /&gt;
|GoatTracker&lt;br /&gt;
|[[GoatTracker|Guide to use GoatTracker for the F256.]]&lt;br /&gt;
|A SID tracker for DOS/MAC/LINUX that can create packed binary files for playback on the F256 computers.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
*&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Tools_%26_Scripts&amp;diff=38424</id>
		<title>Tools &amp; Scripts</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Tools_%26_Scripts&amp;diff=38424"/>
		<updated>2026-01-30T04:50:31Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: Added a link to the GoatTracker guide for the F256&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== 000F256 Machines Game Development Tools ==&lt;br /&gt;
&lt;br /&gt;
=== Sprite Creation Tools &amp;amp; Scripts ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Link !! Notes&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;white-space:nowrap;&amp;quot;| Aseprite&lt;br /&gt;
| style=&amp;quot;white-space:nowrap;&amp;quot;| https://www.aseprite.org/&lt;br /&gt;
| style=&amp;quot;white-space:nowrap;&amp;quot; |Aseprite can be used to create sprites animation or Tiles Sets.&lt;br /&gt;
|-&lt;br /&gt;
|Scripts relevant to Aseprite usage&lt;br /&gt;
|&lt;br /&gt;
*[[Export Aseprite Tilemap]]&lt;br /&gt;
* [[Export Aseprite Tileset]]&lt;br /&gt;
* [[Export Aseprite Sprites]]&lt;br /&gt;
|If you use Aseprite, you can convert your tile drawings to tilesets and tilemaps using these scripts. The export to sprites will convert sprites to a 64tass compatible text file.&lt;br /&gt;
|-&lt;br /&gt;
|f256_sprite_cutter&lt;br /&gt;
|https://gist.github.com/digarok/57b096236a7fb1c76efef6cbb9f73a83&lt;br /&gt;
|Sprite cutter that cuts a PNG according to line-by-line instructions in a text file. Requires python and the PIL library, install with:&lt;br /&gt;
 python -m pip install --upgrade pip &lt;br /&gt;
&lt;br /&gt;
 python -m pip install --upgrade Pillow&lt;br /&gt;
Run with:&lt;br /&gt;
 python f256_sprite_cutter.py myimage.png mylist.txt sprites.s&lt;br /&gt;
where mylist.txt contains a series of lines containing x, y offset, width, name, where it&#039;s assumed the width is the same as the height since it&#039;s for square sprites supported for the F256xx, such as 8,16, or 32.&lt;br /&gt;
&lt;br /&gt;
The output (named sprites.s in this above example) is a series of hex instructions with a list of hex values of a color picked from the CLUT. &lt;br /&gt;
&lt;br /&gt;
In order to make it compatible with 64tass, I search replaced hex-&amp;gt; .byte and replaced every value I could find by swapping in a $ in front (ie 00 -&amp;gt; $00 and 01 -&amp;gt; $01, etc.)&lt;br /&gt;
|-&lt;br /&gt;
|Foenix Graphics Toolkit&lt;br /&gt;
|https://github.com/econtrerasd/F256-GraphicToolkit&lt;br /&gt;
|The Sprite Editor module in the Graphics Toolkit can help you draw sprites of different sizes in the F256 platform and save them as Spr files. The file format is documented in the manual&lt;br /&gt;
|-&lt;br /&gt;
|png2raw.py&lt;br /&gt;
|https://github.com/cmassat/EffenX/tree/dev/util&lt;br /&gt;
|python script by SprySloth, converts a grid png of sprite frames into individual bin (raw bitmap) and pal (palette) files, ready to be consumed by your project. A good source of these grid pngs can be from Aseprite above.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Music Tools and Scripts ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Link !! Notes&lt;br /&gt;
|-&lt;br /&gt;
|DOSBox VGM music extraction mini-guide&lt;br /&gt;
|[[Software#Music]] for playvgm.pgx&lt;br /&gt;
|DOSBox uses a YM3812 chip that outputs OPL2, this is a great, immense source of music that can leverage the OPL functionality of the F256K &lt;br /&gt;
1) run dosbox 0.74+, from the command line and mount your game as &amp;lt;code&amp;gt;dosbox -c &amp;quot;MOUNT C C:\YOURGAMEISHERE&amp;quot;&amp;lt;/code&amp;gt; avoid spaces in folder names &lt;br /&gt;
&lt;br /&gt;
2) before you get to the point where the music you want to extract plays, hit CTRL-ALT-F7 and you should see in the dosbox &#039;log&#039; window that a music capture has started. I think it dumps your captures in /username/appdata/local/dosbox/capture but it will say where in the log window &lt;br /&gt;
&lt;br /&gt;
3) reach the point where it plays and let it loop or run its course, hit CTRL-ALT-F7 to stop the capture. &lt;br /&gt;
&lt;br /&gt;
4) this gives you a .DRO that you can analyze with https://www.jestarjokin.net/apps/drotrimmer/ . the analysis tool is supposed to find loops, but it didn&#039;t work well with the first tune I tried. &lt;br /&gt;
&lt;br /&gt;
5) try to find the location of your first tune&#039;s note in the main window of drotrimmer and try to start the playback from there. delete superfluous notes that might surround your tune. &lt;br /&gt;
&lt;br /&gt;
6) use dro2vgm command line tool: https://www.vgmpf.com/Wiki/index.php/DRO_to_VGM &lt;br /&gt;
&lt;br /&gt;
7) open in a hex editor and chop off the bytes from 0x00 to 0xFF (it&#039;s the header) &lt;br /&gt;
&lt;br /&gt;
8) transfer to your F256K (jr has no opl support!) &lt;br /&gt;
&lt;br /&gt;
9) bload &amp;quot;yourtrimmed.vgm&amp;quot;,$010000 &lt;br /&gt;
&lt;br /&gt;
10) run playvgm.pgx&lt;br /&gt;
|-&lt;br /&gt;
|Convert MIDI files into VGM files.&lt;br /&gt;
| https://github.com/SudoMaker/midi2vgm&lt;br /&gt;
| This is a Linux app, but does compile using Linux on windows under WSL.&lt;br /&gt;
Link to WSL install:&lt;br /&gt;
https://learn.microsoft.com/en-us/windows/wsl/install &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Link to binaries&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
https://github.com/cmassat/midi2vgm/releases/tag/V1.0.0&lt;br /&gt;
&lt;br /&gt;
libADLMIDI.a  &amp;lt;- Required Library&lt;br /&gt;
&lt;br /&gt;
midi2vgm_opl3 &amp;lt;- Executable&lt;br /&gt;
|-&lt;br /&gt;
|convert.py&lt;br /&gt;
|https://github.com/natebarney/playvgm-f256k/tree/master/util&lt;br /&gt;
|from NateBarney&lt;br /&gt;
&lt;br /&gt;
convert.py : python script to read a VGM or VGZ, decompress it if needed, and strip off the VGM header and GD3 tag&lt;br /&gt;
|-&lt;br /&gt;
|Sekaiju&lt;br /&gt;
|https://openmidiproject.opal.ne.jp/Sekaiju_en.html&lt;br /&gt;
|Easily compose and sequence MIDI music. Supports score notation, piano roll and MIDI in if you have a MIDI interface.&lt;br /&gt;
|-&lt;br /&gt;
|GoatTracker&lt;br /&gt;
|Guide to use [[GoatTracker]] for the F256.&lt;br /&gt;
|A SID tracker for DOS/MAC/LINUX that can create packed binary files for playback on the F256 computers.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
*&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=GoatTracker&amp;diff=38423</id>
		<title>GoatTracker</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=GoatTracker&amp;diff=38423"/>
		<updated>2026-01-30T04:45:52Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: /* 3. Pitch and Timing (Important) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Using GoatTracker to Create F256K SID Music =&lt;br /&gt;
&lt;br /&gt;
This guide explains how to use &#039;&#039;&#039;GoatTracker&#039;&#039;&#039; to compose SID music and generate a packed &amp;lt;code&amp;gt;.bin&amp;lt;/code&amp;gt; file that plays correctly on the &#039;&#039;&#039;F256K / F256K2 FPGA SID&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
This document focuses on SID-only usage (no PSG or other sound chips).&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== 1. Getting GoatTracker ==&lt;br /&gt;
&lt;br /&gt;
* GoatTracker is available for &#039;&#039;&#039;Windows, macOS, and Linux&#039;&#039;&#039;.&lt;br /&gt;
* Download page: https://cadaver.github.io/&lt;br /&gt;
* The stereo version (useful for dual SIDs on F256K2) is available on SourceForge under the files tab.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== 2. Creating a Song ==&lt;br /&gt;
&lt;br /&gt;
# Create and edit your song in GoatTracker as you would for a C64.&lt;br /&gt;
# Most instruments, effects, and patterns work correctly on the F256K FPGA SID.&lt;br /&gt;
# GoatTracker was tuned for real C64 hardware, so FPGA SIDs may sound slightly different.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== 3. Pitch and Timing (Important) ==&lt;br /&gt;
&lt;br /&gt;
Pitch and playback speed are &#039;&#039;&#039;related but separate settings&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Playback speed&#039;&#039;&#039; is controlled by PAL vs NTSC timing (50 Hz vs 60 Hz).&lt;br /&gt;
* &#039;&#039;&#039;Pitch&#039;&#039;&#039; is controlled by the A-4 tuning value.&lt;br /&gt;
&lt;br /&gt;
The F256K uses &#039;&#039;&#039;NTSC (60 Hz)&#039;&#039;&#039; timing so Goattracker must be configured accordingly.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== 3.1 Editing and Previewing on Your Computer ===&lt;br /&gt;
&lt;br /&gt;
When composing music on your computer, use NTSC timing and corrected pitch.&lt;br /&gt;
&lt;br /&gt;
Recommended settings:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
goattracker -N -G424 song.sng&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;-N&amp;lt;/code&amp;gt; — NTSC timing (60 Hz)&lt;br /&gt;
* &amp;lt;code&amp;gt;-G424&amp;lt;/code&amp;gt; — Correct pitch for NTSC preview&lt;br /&gt;
&lt;br /&gt;
This setting is for &#039;&#039;&#039;editing only&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== 3.2 Packing for Playback on the F256K ===&lt;br /&gt;
&lt;br /&gt;
The F256K requires a different tuning to produce true 440 Hz pitch.&lt;br /&gt;
&lt;br /&gt;
Tested value:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;A-4 = 454 Hz&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When packing a song, always start GoatTracker with the correct tuning and the song loaded at startup:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
goattracker -G454 song.sng&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039; &amp;lt;code&amp;gt;.sng&amp;lt;/code&amp;gt; files store tuning. Loading after startup will overwrite the setting and result in an incorrectly tuned packed file.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== 4. Packing the Song ==&lt;br /&gt;
&lt;br /&gt;
Songs must be packed into a self-playing binary for use on the F256.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== Option A: Internal Pack (F9) ===&lt;br /&gt;
&lt;br /&gt;
* Press &amp;lt;code&amp;gt;F9&amp;lt;/code&amp;gt; in GoatTracker.&lt;br /&gt;
* Ensure it was started with &amp;lt;code&amp;gt;-G454&amp;lt;/code&amp;gt; and the song loaded.&lt;br /&gt;
The internal packer always uses the &#039;&#039;&#039;current tuning&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== Option B: External Packer (GT2RELOC.EXE) ===&lt;br /&gt;
&lt;br /&gt;
Recommended method.&lt;br /&gt;
&lt;br /&gt;
Example command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
GT2RELOC song.sng song.bin -N -G454 -LD400 -Wa0 -Z80&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
==== Parameter Explanation ====&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;song.sng&amp;lt;/code&amp;gt; — Input song&lt;br /&gt;
* &amp;lt;code&amp;gt;song.bin&amp;lt;/code&amp;gt; — Output binary&lt;br /&gt;
* &amp;lt;code&amp;gt;-N&amp;lt;/code&amp;gt; — NTSC timing&lt;br /&gt;
* &amp;lt;code&amp;gt;-G454&amp;lt;/code&amp;gt; — F256K tuning&lt;br /&gt;
* &amp;lt;code&amp;gt;-LD400&amp;lt;/code&amp;gt; — SID base address&lt;br /&gt;
* &amp;lt;code&amp;gt;-Wa0&amp;lt;/code&amp;gt; — Player load address ($A000)&lt;br /&gt;
* &amp;lt;code&amp;gt;-Z80&amp;lt;/code&amp;gt; — Zeropage ($80/$81)&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
==== Notes ====&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;-Wxx&amp;lt;/code&amp;gt; sets the high byte only&lt;br /&gt;
** Example:&amp;lt;code&amp;gt;-Wa0&amp;lt;/code&amp;gt; = $A000&lt;br /&gt;
* &amp;lt;code&amp;gt;-Zxx&amp;lt;/code&amp;gt; specifies the &#039;&#039;&#039;starting zeropage address&#039;&#039;&#039;&lt;br /&gt;
** uses two bytes&lt;br /&gt;
*** $80/$81 is tested and safe&lt;br /&gt;
*** Avoid $F0–$FF (kernel use)&lt;br /&gt;
* &amp;lt;code&amp;gt;-Wxx&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-Zxx&amp;lt;/code&amp;gt; are configurable based on your program&#039;s memory layout.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== 5. Playing the Music ==&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== 5.1 Initialization ===&lt;br /&gt;
&lt;br /&gt;
Call the music player&#039;s init routine once. It is located at the player load address &amp;lt;code&amp;gt;(-Wxx)&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
JSR $A000    ; initialize song&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== 5.2 Per-Frame Playback ===&lt;br /&gt;
&lt;br /&gt;
Call the playback routine &#039;&#039;&#039;once per frame&#039;&#039;&#039; (SOF / 60 Hz)&#039;&#039;&#039;.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Playback routine address = &amp;lt;code&amp;gt;init + 3&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
JSR $A003    ; play song for this frame&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Repeat this call every frame for continuous playback.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== 6. Additional Notes ==&lt;br /&gt;
&lt;br /&gt;
* Pitch and speed are &#039;&#039;&#039;not the same&#039;&#039;&#039;:&lt;br /&gt;
** &amp;lt;code&amp;gt;-N&amp;lt;/code&amp;gt; controls speed&lt;br /&gt;
** &amp;lt;code&amp;gt;-Gxx&amp;lt;/code&amp;gt; controls pitch&lt;br /&gt;
* GoatTracker adjusts pitch tables when switching PAL/NTSC, but &#039;&#039;&#039;manual A-4 correction is still required.&#039;&#039;&#039;&lt;br /&gt;
* The packed &amp;lt;code&amp;gt;.bin&amp;lt;/code&amp;gt; file is unchanged between the C64 and the F256 - compatibility comes from correct timing, tuning, and memory placement.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== Appendix: Minimal F256 SID Music Player Example ==&lt;br /&gt;
&lt;br /&gt;
The following is a minimal working music player using kernel timers.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
This example matches the configuration described in this wiki page:&lt;br /&gt;
&lt;br /&gt;
* Player loaded at &#039;&#039;&#039;$A000&#039;&#039;&#039; (&amp;lt;code&amp;gt;-Wa0&amp;lt;/code&amp;gt;)&lt;br /&gt;
* Player routine at &#039;&#039;&#039;$A003&#039;&#039;&#039;&lt;br /&gt;
* Zeropage usage at &#039;&#039;&#039;$80/$81&#039;&#039;&#039; (used internally by the player)&lt;br /&gt;
* NTSC / 60 Hz playback&amp;lt;br /&amp;gt;&lt;br /&gt;
 ; ============================================================================&lt;br /&gt;
 ; music_min.asm - Minimal Music Player for Wildbits/K &amp;amp; /Jr&lt;br /&gt;
 ; ============================================================================&lt;br /&gt;
 &lt;br /&gt;
    .cpu &amp;quot;65816&amp;quot;&lt;br /&gt;
    MMU_IO_CTRL = $01&lt;br /&gt;
    init_music = $A000&lt;br /&gt;
    play_music = init_music+3&lt;br /&gt;
    timer_cookie = $D0&lt;br /&gt;
 &lt;br /&gt;
 *=$A0&lt;br /&gt;
    .dsection zp&lt;br /&gt;
    .cerror * &amp;gt; $AF, &amp;quot;Too many zero page variables&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    .include &amp;quot;api.asm&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    .section zp&lt;br /&gt;
    event: .dstruct kernel.event.event_t&lt;br /&gt;
    .send&lt;br /&gt;
 &lt;br /&gt;
 *=$1000&lt;br /&gt;
 &lt;br /&gt;
 start:&lt;br /&gt;
    stz MMU_IO_CTRL&lt;br /&gt;
 &lt;br /&gt;
    lda #&amp;lt;event&lt;br /&gt;
    sta kernel.args.events&lt;br /&gt;
    lda #&amp;gt;event&lt;br /&gt;
    sta kernel.args.events+1&lt;br /&gt;
 &lt;br /&gt;
    jsr init_music&lt;br /&gt;
    jsr SetTimer&lt;br /&gt;
 &lt;br /&gt;
 loop:&lt;br /&gt;
    jsr handle_events&lt;br /&gt;
    bra loop&lt;br /&gt;
 &lt;br /&gt;
 handle_events:&lt;br /&gt;
    lda kernel.args.events.pending&lt;br /&gt;
    bpl done_handle_events&lt;br /&gt;
    jsr kernel.NextEvent&lt;br /&gt;
    bcs done_handle_events&lt;br /&gt;
    jsr dispatch&lt;br /&gt;
    jmp handle_events&lt;br /&gt;
 &lt;br /&gt;
 done_handle_events:&lt;br /&gt;
    rts&lt;br /&gt;
 &lt;br /&gt;
 dispatch:&lt;br /&gt;
    lda event.type&lt;br /&gt;
    cmp #kernel.event.timer.EXPIRED&lt;br /&gt;
    beq music_playback&lt;br /&gt;
    rts&lt;br /&gt;
 &lt;br /&gt;
 music_playback:&lt;br /&gt;
    jsr SetTimer&lt;br /&gt;
    jsr play_music&lt;br /&gt;
    rts&lt;br /&gt;
 &lt;br /&gt;
 SetTimer:&lt;br /&gt;
    inc timer_cookie&lt;br /&gt;
    lda timer_cookie&lt;br /&gt;
    sta kernel.args.timer.absolute&lt;br /&gt;
    sta kernel.args.timer.cookie&lt;br /&gt;
    lda #kernel.args.timer.FRAMES&lt;br /&gt;
    sta kernel.args.timer.units&lt;br /&gt;
    jsr kernel.Clock.SetTimer&lt;br /&gt;
    rts&lt;br /&gt;
 &lt;br /&gt;
 *=$A000&lt;br /&gt;
    .binary &amp;quot;testsong.bin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== Cheat Sheet ==&lt;br /&gt;
&lt;br /&gt;
=== Edit / Preview (NTSC, correct pitch) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
goattracker -N -G424 song.sng&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pack for F256K ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
GT2RELOC song.sng song.bin -N -G454 -LD400 -Wa0 -Z80&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Internal Pack ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
goattracker -G454 song.sng&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Press &amp;lt;code&amp;gt;F9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== Playback in your program ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
JSR $A000&lt;br /&gt;
&lt;br /&gt;
JSR $A003&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== Tested Defaults for the F256 ===&lt;br /&gt;
&lt;br /&gt;
* SID: $D400&lt;br /&gt;
* Player: $A000&lt;br /&gt;
* Zeropage: $80/$81&lt;br /&gt;
* Timing: NTSC (60 Hz)&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
End of document.&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=GoatTracker&amp;diff=38422</id>
		<title>GoatTracker</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=GoatTracker&amp;diff=38422"/>
		<updated>2026-01-30T04:24:19Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: /* 3. Pitch and Timing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Using GoatTracker to Create F256K SID Music =&lt;br /&gt;
&lt;br /&gt;
This guide explains how to use &#039;&#039;&#039;GoatTracker&#039;&#039;&#039; to compose SID music and generate a packed &amp;lt;code&amp;gt;.bin&amp;lt;/code&amp;gt; file that plays correctly on the &#039;&#039;&#039;F256K / F256K2 FPGA SID&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
This document focuses on SID-only usage (no PSG or other sound chips).&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== 1. Getting GoatTracker ==&lt;br /&gt;
&lt;br /&gt;
* GoatTracker is available for &#039;&#039;&#039;Windows, macOS, and Linux&#039;&#039;&#039;.&lt;br /&gt;
* Download page: https://cadaver.github.io/&lt;br /&gt;
* The stereo version (useful for dual SIDs on F256K2) is available on SourceForge under the files tab.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== 2. Creating a Song ==&lt;br /&gt;
&lt;br /&gt;
# Create and edit your song in GoatTracker as you would for a C64.&lt;br /&gt;
# Most instruments, effects, and patterns work correctly on the F256K FPGA SID.&lt;br /&gt;
# GoatTracker was tuned for real C64 hardware, so FPGA SIDs may sound slightly different.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== 3. Pitch and Timing (Important) ==&lt;br /&gt;
&lt;br /&gt;
Pitch and playback speed are &#039;&#039;&#039;separate settings&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* Playback speed is controlled by PAL vs NTSC timing (50 Hz vs 60 Hz).&lt;br /&gt;
* Pitch is controlled by the A-4 tuning value.&lt;br /&gt;
&lt;br /&gt;
The F256K uses &#039;&#039;&#039;NTSC (60 Hz)&#039;&#039;&#039; timing.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== 3.1 Editing and Previewing on Your Computer ===&lt;br /&gt;
&lt;br /&gt;
When composing music on your computer, use NTSC timing and corrected pitch.&lt;br /&gt;
&lt;br /&gt;
Recommended settings:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
goattracker -N -G424 song.sng&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;-N&amp;lt;/code&amp;gt; — NTSC timing (60 Hz)&lt;br /&gt;
* &amp;lt;code&amp;gt;-G424&amp;lt;/code&amp;gt; — Correct pitch for NTSC preview&lt;br /&gt;
&lt;br /&gt;
This setting is for &#039;&#039;&#039;editing only&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== 3.2 Packing for Playback on the F256K ===&lt;br /&gt;
&lt;br /&gt;
The F256K requires a different tuning to produce true 440 Hz pitch.&lt;br /&gt;
&lt;br /&gt;
Tested value:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;A-4 = 454 Hz&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Always start GoatTracker with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
goattracker -G454 song.sng&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039; &amp;lt;code&amp;gt;.sng&amp;lt;/code&amp;gt; files store tuning. Loading after startup will overwrite the setting.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== 4. Packing the Song ==&lt;br /&gt;
&lt;br /&gt;
Songs must be packed into a self-playing binary.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== Option A: Internal Pack (F9) ===&lt;br /&gt;
&lt;br /&gt;
* Press &amp;lt;code&amp;gt;F9&amp;lt;/code&amp;gt; in GoatTracker.&lt;br /&gt;
* Ensure it was started with &amp;lt;code&amp;gt;-G454&amp;lt;/code&amp;gt; and the song loaded.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== Option B: External Packer (GT2RELOC.EXE) ===&lt;br /&gt;
&lt;br /&gt;
Recommended method.&lt;br /&gt;
&lt;br /&gt;
Example command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
GT2RELOC song.sng song.bin -N -G454 -LD400 -Wa0 -Z80&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
==== Parameter Explanation ====&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;song.sng&amp;lt;/code&amp;gt; — Input song&lt;br /&gt;
* &amp;lt;code&amp;gt;song.bin&amp;lt;/code&amp;gt; — Output binary&lt;br /&gt;
* &amp;lt;code&amp;gt;-N&amp;lt;/code&amp;gt; — NTSC timing&lt;br /&gt;
* &amp;lt;code&amp;gt;-G454&amp;lt;/code&amp;gt; — F256K tuning&lt;br /&gt;
* &amp;lt;code&amp;gt;-LD400&amp;lt;/code&amp;gt; — SID base address&lt;br /&gt;
* &amp;lt;code&amp;gt;-Wa0&amp;lt;/code&amp;gt; — Player load address ($A000)&lt;br /&gt;
* &amp;lt;code&amp;gt;-Z80&amp;lt;/code&amp;gt; — Zeropage ($80/$81)&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
==== Notes ====&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;-Wxx&amp;lt;/code&amp;gt; sets the high byte only&lt;br /&gt;
** &amp;lt;code&amp;gt;-Wa0&amp;lt;/code&amp;gt; = $A000&lt;br /&gt;
* &amp;lt;code&amp;gt;-Zxx&amp;lt;/code&amp;gt; uses two bytes&lt;br /&gt;
** $80/$81 is tested and safe&lt;br /&gt;
** Avoid $F0–$FF (kernel use)&lt;br /&gt;
* &amp;lt;code&amp;gt;-Wxx&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-Zxx&amp;lt;/code&amp;gt; are configurable&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== 5. Playing the Music ==&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== 5.1 Initialization ===&lt;br /&gt;
&lt;br /&gt;
Call the init routine:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
JSR $A000&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== 5.2 Per-Frame Playback ===&lt;br /&gt;
&lt;br /&gt;
Call once per frame:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
JSR $A003&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== 6. Additional Notes ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;-N&amp;lt;/code&amp;gt; controls speed&lt;br /&gt;
* &amp;lt;code&amp;gt;-Gxx&amp;lt;/code&amp;gt; controls pitch&lt;br /&gt;
* Both are required&lt;br /&gt;
* The binary is C64-compatible&lt;br /&gt;
* Correct setup ensures compatibility&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== Appendix: Minimal F256 SID Music Player Example ==&lt;br /&gt;
&lt;br /&gt;
The following is a minimal working music player using kernel timers.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ; ============================================================================&lt;br /&gt;
 ; music_min.asm - Minimal Music Player for Wildbits/K &amp;amp; /Jr&lt;br /&gt;
 ; ============================================================================&lt;br /&gt;
 &lt;br /&gt;
    .cpu &amp;quot;65816&amp;quot;&lt;br /&gt;
    MMU_IO_CTRL = $01&lt;br /&gt;
    init_music = $A000&lt;br /&gt;
    play_music = init_music+3&lt;br /&gt;
    timer_cookie = $D0&lt;br /&gt;
 &lt;br /&gt;
 *=$A0&lt;br /&gt;
    .dsection zp&lt;br /&gt;
    .cerror * &amp;gt; $AF, &amp;quot;Too many zero page variables&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    .include &amp;quot;api.asm&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    .section zp&lt;br /&gt;
    event: .dstruct kernel.event.event_t&lt;br /&gt;
    .send&lt;br /&gt;
 &lt;br /&gt;
 *=$1000&lt;br /&gt;
 &lt;br /&gt;
 start:&lt;br /&gt;
    stz MMU_IO_CTRL&lt;br /&gt;
 &lt;br /&gt;
    lda #&amp;lt;event&lt;br /&gt;
    sta kernel.args.events&lt;br /&gt;
    lda #&amp;gt;event&lt;br /&gt;
    sta kernel.args.events+1&lt;br /&gt;
 &lt;br /&gt;
    jsr init_music&lt;br /&gt;
    jsr SetTimer&lt;br /&gt;
 &lt;br /&gt;
 loop:&lt;br /&gt;
    jsr handle_events&lt;br /&gt;
    bra loop&lt;br /&gt;
 &lt;br /&gt;
 handle_events:&lt;br /&gt;
    lda kernel.args.events.pending&lt;br /&gt;
    bpl done_handle_events&lt;br /&gt;
    jsr kernel.NextEvent&lt;br /&gt;
    bcs done_handle_events&lt;br /&gt;
    jsr dispatch&lt;br /&gt;
    jmp handle_events&lt;br /&gt;
 &lt;br /&gt;
 done_handle_events:&lt;br /&gt;
    rts&lt;br /&gt;
 &lt;br /&gt;
 dispatch:&lt;br /&gt;
    lda event.type&lt;br /&gt;
    cmp #kernel.event.timer.EXPIRED&lt;br /&gt;
    beq music_playback&lt;br /&gt;
    rts&lt;br /&gt;
 &lt;br /&gt;
 music_playback:&lt;br /&gt;
    jsr SetTimer&lt;br /&gt;
    jsr play_music&lt;br /&gt;
    rts&lt;br /&gt;
 &lt;br /&gt;
 SetTimer:&lt;br /&gt;
    inc timer_cookie&lt;br /&gt;
    lda timer_cookie&lt;br /&gt;
    sta kernel.args.timer.absolute&lt;br /&gt;
    sta kernel.args.timer.cookie&lt;br /&gt;
    lda #kernel.args.timer.FRAMES&lt;br /&gt;
    sta kernel.args.timer.units&lt;br /&gt;
    jsr kernel.Clock.SetTimer&lt;br /&gt;
    rts&lt;br /&gt;
 &lt;br /&gt;
 *=$A000&lt;br /&gt;
    .binary &amp;quot;testsong.bin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== Cheat Sheet ==&lt;br /&gt;
&lt;br /&gt;
=== Edit / Preview ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
goattracker -N -G424 song.sng&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pack for F256K ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
GT2RELOC song.sng song.bin -N -G454 -LD400 -Wa0 -Z80&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Internal Pack ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
goattracker -G454 song.sng&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Press &amp;lt;code&amp;gt;F9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== Playback ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
JSR $A000&lt;br /&gt;
&lt;br /&gt;
JSR $A003&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== Tested Defaults ===&lt;br /&gt;
&lt;br /&gt;
* SID: $D400&lt;br /&gt;
* Player: $A000&lt;br /&gt;
* Zeropage: $80/$81&lt;br /&gt;
* Timing: NTSC (60 Hz)&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
End of document.&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=GoatTracker&amp;diff=38421</id>
		<title>GoatTracker</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=GoatTracker&amp;diff=38421"/>
		<updated>2026-01-30T04:21:02Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: /* Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Using GoatTracker to Create F256K SID Music =&lt;br /&gt;
&lt;br /&gt;
This guide explains how to use &#039;&#039;&#039;GoatTracker&#039;&#039;&#039; to compose SID music and generate a packed &amp;lt;code&amp;gt;.bin&amp;lt;/code&amp;gt; file that plays correctly on the &#039;&#039;&#039;F256K / F256K2 FPGA SID&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
This document focuses on SID-only usage (no PSG or other sound chips).&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== 1. Getting GoatTracker ==&lt;br /&gt;
&lt;br /&gt;
* GoatTracker is available for &#039;&#039;&#039;Windows, macOS, and Linux&#039;&#039;&#039;.&lt;br /&gt;
* Download page: https://cadaver.github.io/&lt;br /&gt;
* The stereo version (useful for dual SIDs on F256K2) is available on SourceForge under the files tab.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== 2. Creating a Song ==&lt;br /&gt;
&lt;br /&gt;
# Create and edit your song in GoatTracker as you would for a C64.&lt;br /&gt;
# Most instruments, effects, and patterns work correctly on the F256K FPGA SID.&lt;br /&gt;
# GoatTracker was tuned for real C64 hardware, so FPGA SIDs may sound slightly different.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== 3. Pitch and Timing ==&lt;br /&gt;
&lt;br /&gt;
Pitch and playback speed are &#039;&#039;&#039;separate settings&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* Playback speed is controlled by PAL vs NTSC timing (50 Hz vs 60 Hz).&lt;br /&gt;
* Pitch is controlled by the A-4 tuning value.&lt;br /&gt;
&lt;br /&gt;
The F256K uses &#039;&#039;&#039;NTSC (60 Hz)&#039;&#039;&#039; timing.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== 3.1 Editing and Previewing on Your Computer ===&lt;br /&gt;
&lt;br /&gt;
When composing music on your computer, use NTSC timing and corrected pitch.&lt;br /&gt;
&lt;br /&gt;
Recommended settings:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
goattracker -N -G424 song.sng&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;-N&amp;lt;/code&amp;gt; — NTSC timing (60 Hz)&lt;br /&gt;
* &amp;lt;code&amp;gt;-G424&amp;lt;/code&amp;gt; — Correct pitch for NTSC preview&lt;br /&gt;
&lt;br /&gt;
This setting is for &#039;&#039;&#039;editing only&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== 3.2 Packing for Playback on the F256K ===&lt;br /&gt;
&lt;br /&gt;
The F256K requires a different tuning to produce true 440 Hz pitch.&lt;br /&gt;
&lt;br /&gt;
Tested value:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;A-4 = 454 Hz&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Always start GoatTracker with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
goattracker -G454 song.sng&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039; &amp;lt;code&amp;gt;.sng&amp;lt;/code&amp;gt; files store tuning. Loading after startup will overwrite the setting.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== 4. Packing the Song ==&lt;br /&gt;
&lt;br /&gt;
Songs must be packed into a self-playing binary.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== Option A: Internal Pack (F9) ===&lt;br /&gt;
&lt;br /&gt;
* Press &amp;lt;code&amp;gt;F9&amp;lt;/code&amp;gt; in GoatTracker.&lt;br /&gt;
* Ensure it was started with &amp;lt;code&amp;gt;-G454&amp;lt;/code&amp;gt; and the song loaded.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== Option B: External Packer (GT2RELOC.EXE) ===&lt;br /&gt;
&lt;br /&gt;
Recommended method.&lt;br /&gt;
&lt;br /&gt;
Example command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
GT2RELOC song.sng song.bin -N -G454 -LD400 -Wa0 -Z80&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
==== Parameter Explanation ====&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;song.sng&amp;lt;/code&amp;gt; — Input song&lt;br /&gt;
* &amp;lt;code&amp;gt;song.bin&amp;lt;/code&amp;gt; — Output binary&lt;br /&gt;
* &amp;lt;code&amp;gt;-N&amp;lt;/code&amp;gt; — NTSC timing&lt;br /&gt;
* &amp;lt;code&amp;gt;-G454&amp;lt;/code&amp;gt; — F256K tuning&lt;br /&gt;
* &amp;lt;code&amp;gt;-LD400&amp;lt;/code&amp;gt; — SID base address&lt;br /&gt;
* &amp;lt;code&amp;gt;-Wa0&amp;lt;/code&amp;gt; — Player load address ($A000)&lt;br /&gt;
* &amp;lt;code&amp;gt;-Z80&amp;lt;/code&amp;gt; — Zeropage ($80/$81)&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
==== Notes ====&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;-Wxx&amp;lt;/code&amp;gt; sets the high byte only&lt;br /&gt;
** &amp;lt;code&amp;gt;-Wa0&amp;lt;/code&amp;gt; = $A000&lt;br /&gt;
* &amp;lt;code&amp;gt;-Zxx&amp;lt;/code&amp;gt; uses two bytes&lt;br /&gt;
** $80/$81 is tested and safe&lt;br /&gt;
** Avoid $F0–$FF (kernel use)&lt;br /&gt;
* &amp;lt;code&amp;gt;-Wxx&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-Zxx&amp;lt;/code&amp;gt; are configurable&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== 5. Playing the Music ==&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== 5.1 Initialization ===&lt;br /&gt;
&lt;br /&gt;
Call the init routine:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
JSR $A000&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== 5.2 Per-Frame Playback ===&lt;br /&gt;
&lt;br /&gt;
Call once per frame:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
JSR $A003&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== 6. Additional Notes ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;-N&amp;lt;/code&amp;gt; controls speed&lt;br /&gt;
* &amp;lt;code&amp;gt;-Gxx&amp;lt;/code&amp;gt; controls pitch&lt;br /&gt;
* Both are required&lt;br /&gt;
* The binary is C64-compatible&lt;br /&gt;
* Correct setup ensures compatibility&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== Appendix: Minimal F256 SID Music Player Example ==&lt;br /&gt;
&lt;br /&gt;
The following is a minimal working music player using kernel timers.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ; ============================================================================&lt;br /&gt;
 ; music_min.asm - Minimal Music Player for Wildbits/K &amp;amp; /Jr&lt;br /&gt;
 ; ============================================================================&lt;br /&gt;
 &lt;br /&gt;
    .cpu &amp;quot;65816&amp;quot;&lt;br /&gt;
    MMU_IO_CTRL = $01&lt;br /&gt;
    init_music = $A000&lt;br /&gt;
    play_music = init_music+3&lt;br /&gt;
    timer_cookie = $D0&lt;br /&gt;
 &lt;br /&gt;
 *=$A0&lt;br /&gt;
    .dsection zp&lt;br /&gt;
    .cerror * &amp;gt; $AF, &amp;quot;Too many zero page variables&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    .include &amp;quot;api.asm&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    .section zp&lt;br /&gt;
    event: .dstruct kernel.event.event_t&lt;br /&gt;
    .send&lt;br /&gt;
 &lt;br /&gt;
 *=$1000&lt;br /&gt;
 &lt;br /&gt;
 start:&lt;br /&gt;
    stz MMU_IO_CTRL&lt;br /&gt;
 &lt;br /&gt;
    lda #&amp;lt;event&lt;br /&gt;
    sta kernel.args.events&lt;br /&gt;
    lda #&amp;gt;event&lt;br /&gt;
    sta kernel.args.events+1&lt;br /&gt;
 &lt;br /&gt;
    jsr init_music&lt;br /&gt;
    jsr SetTimer&lt;br /&gt;
 &lt;br /&gt;
 loop:&lt;br /&gt;
    jsr handle_events&lt;br /&gt;
    bra loop&lt;br /&gt;
 &lt;br /&gt;
 handle_events:&lt;br /&gt;
    lda kernel.args.events.pending&lt;br /&gt;
    bpl done_handle_events&lt;br /&gt;
    jsr kernel.NextEvent&lt;br /&gt;
    bcs done_handle_events&lt;br /&gt;
    jsr dispatch&lt;br /&gt;
    jmp handle_events&lt;br /&gt;
 &lt;br /&gt;
 done_handle_events:&lt;br /&gt;
    rts&lt;br /&gt;
 &lt;br /&gt;
 dispatch:&lt;br /&gt;
    lda event.type&lt;br /&gt;
    cmp #kernel.event.timer.EXPIRED&lt;br /&gt;
    beq music_playback&lt;br /&gt;
    rts&lt;br /&gt;
 &lt;br /&gt;
 music_playback:&lt;br /&gt;
    jsr SetTimer&lt;br /&gt;
    jsr play_music&lt;br /&gt;
    rts&lt;br /&gt;
 &lt;br /&gt;
 SetTimer:&lt;br /&gt;
    inc timer_cookie&lt;br /&gt;
    lda timer_cookie&lt;br /&gt;
    sta kernel.args.timer.absolute&lt;br /&gt;
    sta kernel.args.timer.cookie&lt;br /&gt;
    lda #kernel.args.timer.FRAMES&lt;br /&gt;
    sta kernel.args.timer.units&lt;br /&gt;
    jsr kernel.Clock.SetTimer&lt;br /&gt;
    rts&lt;br /&gt;
 &lt;br /&gt;
 *=$A000&lt;br /&gt;
    .binary &amp;quot;testsong.bin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== Cheat Sheet ==&lt;br /&gt;
&lt;br /&gt;
=== Edit / Preview ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
goattracker -N -G424 song.sng&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pack for F256K ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
GT2RELOC song.sng song.bin -N -G454 -LD400 -Wa0 -Z80&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Internal Pack ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
goattracker -G454 song.sng&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Press &amp;lt;code&amp;gt;F9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== Playback ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
JSR $A000&lt;br /&gt;
&lt;br /&gt;
JSR $A003&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== Tested Defaults ===&lt;br /&gt;
&lt;br /&gt;
* SID: $D400&lt;br /&gt;
* Player: $A000&lt;br /&gt;
* Zeropage: $80/$81&lt;br /&gt;
* Timing: NTSC (60 Hz)&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
End of document.&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=GoatTracker&amp;diff=38420</id>
		<title>GoatTracker</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=GoatTracker&amp;diff=38420"/>
		<updated>2026-01-30T04:17:39Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: Created page with &amp;quot;= Using GoatTracker to Create F256K SID Music =  This guide explains how to use &amp;#039;&amp;#039;&amp;#039;GoatTracker&amp;#039;&amp;#039;&amp;#039; to compose SID music and generate a packed &amp;lt;code&amp;gt;.bin&amp;lt;/code&amp;gt; file that plays correctly on the &amp;#039;&amp;#039;&amp;#039;F256K / F256K2 FPGA SID&amp;#039;&amp;#039;&amp;#039;.  This document focuses on SID-only usage (no PSG or other sound chips).  ---  == 1. Getting GoatTracker ==  * GoatTracker is available for &amp;#039;&amp;#039;&amp;#039;Windows, macOS, and Linux&amp;#039;&amp;#039;&amp;#039;. * Download page: https://cadaver.github.io/ * The stereo version (useful for dua...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Using GoatTracker to Create F256K SID Music =&lt;br /&gt;
&lt;br /&gt;
This guide explains how to use &#039;&#039;&#039;GoatTracker&#039;&#039;&#039; to compose SID music and generate a packed &amp;lt;code&amp;gt;.bin&amp;lt;/code&amp;gt; file that plays correctly on the &#039;&#039;&#039;F256K / F256K2 FPGA SID&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
This document focuses on SID-only usage (no PSG or other sound chips).&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== 1. Getting GoatTracker ==&lt;br /&gt;
&lt;br /&gt;
* GoatTracker is available for &#039;&#039;&#039;Windows, macOS, and Linux&#039;&#039;&#039;.&lt;br /&gt;
* Download page: https://cadaver.github.io/&lt;br /&gt;
* The stereo version (useful for dual SIDs on F256K2) is available on SourceForge under the files tab.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== 2. Creating a Song ==&lt;br /&gt;
&lt;br /&gt;
# Create and edit your song in GoatTracker as you would for a C64.&lt;br /&gt;
# Most instruments, effects, and patterns work correctly on the F256K FPGA SID.&lt;br /&gt;
# GoatTracker was tuned for real C64 hardware, so FPGA SIDs may sound slightly different.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== 3. Pitch and Timing ==&lt;br /&gt;
&lt;br /&gt;
Pitch and playback speed are &#039;&#039;&#039;separate settings&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* Playback speed is controlled by PAL vs NTSC timing (50 Hz vs 60 Hz).&lt;br /&gt;
* Pitch is controlled by the A-4 tuning value.&lt;br /&gt;
&lt;br /&gt;
The F256K uses &#039;&#039;&#039;NTSC (60 Hz)&#039;&#039;&#039; timing.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== 3.1 Editing and Previewing on Your Computer ===&lt;br /&gt;
&lt;br /&gt;
When composing music on your computer, use NTSC timing and corrected pitch.&lt;br /&gt;
&lt;br /&gt;
Recommended settings:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
goattracker -N -G424 song.sng&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;-N&amp;lt;/code&amp;gt; — NTSC timing (60 Hz)&lt;br /&gt;
* &amp;lt;code&amp;gt;-G424&amp;lt;/code&amp;gt; — Correct pitch for NTSC preview&lt;br /&gt;
&lt;br /&gt;
This setting is for &#039;&#039;&#039;editing only&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== 3.2 Packing for Playback on the F256K ===&lt;br /&gt;
&lt;br /&gt;
The F256K requires a different tuning to produce true 440 Hz pitch.&lt;br /&gt;
&lt;br /&gt;
Tested value:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;A-4 = 454 Hz&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Always start GoatTracker with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
goattracker -G454 song.sng&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039; &amp;lt;code&amp;gt;.sng&amp;lt;/code&amp;gt; files store tuning. Loading after startup will overwrite the setting.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== 4. Packing the Song ==&lt;br /&gt;
&lt;br /&gt;
Songs must be packed into a self-playing binary.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== Option A: Internal Pack (F9) ===&lt;br /&gt;
&lt;br /&gt;
* Press &amp;lt;code&amp;gt;F9&amp;lt;/code&amp;gt; in GoatTracker.&lt;br /&gt;
* Ensure it was started with &amp;lt;code&amp;gt;-G454&amp;lt;/code&amp;gt; and the song loaded.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== Option B: External Packer (GT2RELOC.EXE) ===&lt;br /&gt;
&lt;br /&gt;
Recommended method.&lt;br /&gt;
&lt;br /&gt;
Example command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
GT2RELOC song.sng song.bin -N -G454 -LD400 -Wa0 -Z80&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
==== Parameter Explanation ====&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;song.sng&amp;lt;/code&amp;gt; — Input song&lt;br /&gt;
* &amp;lt;code&amp;gt;song.bin&amp;lt;/code&amp;gt; — Output binary&lt;br /&gt;
* &amp;lt;code&amp;gt;-N&amp;lt;/code&amp;gt; — NTSC timing&lt;br /&gt;
* &amp;lt;code&amp;gt;-G454&amp;lt;/code&amp;gt; — F256K tuning&lt;br /&gt;
* &amp;lt;code&amp;gt;-LD400&amp;lt;/code&amp;gt; — SID base address&lt;br /&gt;
* &amp;lt;code&amp;gt;-Wa0&amp;lt;/code&amp;gt; — Player load address ($A000)&lt;br /&gt;
* &amp;lt;code&amp;gt;-Z80&amp;lt;/code&amp;gt; — Zeropage ($80/$81)&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
==== Notes ====&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;-Wxx&amp;lt;/code&amp;gt; sets the high byte only&lt;br /&gt;
* &amp;lt;code&amp;gt;-Wa0&amp;lt;/code&amp;gt; = $A000&lt;br /&gt;
* &amp;lt;code&amp;gt;-Zxx&amp;lt;/code&amp;gt; uses two bytes&lt;br /&gt;
* $80/$81 is tested and safe&lt;br /&gt;
* Avoid $F0–$FF (kernel use)&lt;br /&gt;
* &amp;lt;code&amp;gt;-Wxx&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-Zxx&amp;lt;/code&amp;gt; are configurable&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== 5. Playing the Music ==&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== 5.1 Initialization ===&lt;br /&gt;
&lt;br /&gt;
Call the init routine:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
JSR $A000&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== 5.2 Per-Frame Playback ===&lt;br /&gt;
&lt;br /&gt;
Call once per frame:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
JSR $A003&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== 6. Additional Notes ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;-N&amp;lt;/code&amp;gt; controls speed&lt;br /&gt;
* &amp;lt;code&amp;gt;-Gxx&amp;lt;/code&amp;gt; controls pitch&lt;br /&gt;
* Both are required&lt;br /&gt;
* The binary is C64-compatible&lt;br /&gt;
* Correct setup ensures compatibility&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== Appendix: Minimal F256 SID Music Player Example ==&lt;br /&gt;
&lt;br /&gt;
The following is a minimal working music player using kernel timers.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ; ============================================================================&lt;br /&gt;
 ; music_min.asm - Minimal Music Player for Wildbits/K &amp;amp; /Jr&lt;br /&gt;
 ; ============================================================================&lt;br /&gt;
 &lt;br /&gt;
    .cpu &amp;quot;65816&amp;quot;&lt;br /&gt;
    MMU_IO_CTRL = $01&lt;br /&gt;
    init_music = $A000&lt;br /&gt;
    play_music = init_music+3&lt;br /&gt;
    timer_cookie = $D0&lt;br /&gt;
 &lt;br /&gt;
 *=$A0&lt;br /&gt;
    .dsection zp&lt;br /&gt;
    .cerror * &amp;gt; $AF, &amp;quot;Too many zero page variables&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    .include &amp;quot;api.asm&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    .section zp&lt;br /&gt;
    event: .dstruct kernel.event.event_t&lt;br /&gt;
    .send&lt;br /&gt;
 &lt;br /&gt;
 *=$1000&lt;br /&gt;
 &lt;br /&gt;
 start:&lt;br /&gt;
    stz MMU_IO_CTRL&lt;br /&gt;
 &lt;br /&gt;
    lda #&amp;lt;event&lt;br /&gt;
    sta kernel.args.events&lt;br /&gt;
    lda #&amp;gt;event&lt;br /&gt;
    sta kernel.args.events+1&lt;br /&gt;
 &lt;br /&gt;
    jsr init_music&lt;br /&gt;
    jsr SetTimer&lt;br /&gt;
 &lt;br /&gt;
 loop:&lt;br /&gt;
    jsr handle_events&lt;br /&gt;
    bra loop&lt;br /&gt;
 &lt;br /&gt;
 handle_events:&lt;br /&gt;
    lda kernel.args.events.pending&lt;br /&gt;
    bpl done_handle_events&lt;br /&gt;
    jsr kernel.NextEvent&lt;br /&gt;
    bcs done_handle_events&lt;br /&gt;
    jsr dispatch&lt;br /&gt;
    jmp handle_events&lt;br /&gt;
 &lt;br /&gt;
 done_handle_events:&lt;br /&gt;
    rts&lt;br /&gt;
 &lt;br /&gt;
 dispatch:&lt;br /&gt;
    lda event.type&lt;br /&gt;
    cmp #kernel.event.timer.EXPIRED&lt;br /&gt;
    beq music_playback&lt;br /&gt;
    rts&lt;br /&gt;
 &lt;br /&gt;
 music_playback:&lt;br /&gt;
    jsr SetTimer&lt;br /&gt;
    jsr play_music&lt;br /&gt;
    rts&lt;br /&gt;
 &lt;br /&gt;
 SetTimer:&lt;br /&gt;
    inc timer_cookie&lt;br /&gt;
    lda timer_cookie&lt;br /&gt;
    sta kernel.args.timer.absolute&lt;br /&gt;
    sta kernel.args.timer.cookie&lt;br /&gt;
    lda #kernel.args.timer.FRAMES&lt;br /&gt;
    sta kernel.args.timer.units&lt;br /&gt;
    jsr kernel.Clock.SetTimer&lt;br /&gt;
    rts&lt;br /&gt;
 &lt;br /&gt;
 *=$A000&lt;br /&gt;
    .binary &amp;quot;testsong.bin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
== Cheat Sheet ==&lt;br /&gt;
&lt;br /&gt;
=== Edit / Preview ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
goattracker -N -G424 song.sng&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pack for F256K ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
GT2RELOC song.sng song.bin -N -G454 -LD400 -Wa0 -Z80&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Internal Pack ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
goattracker -G454 song.sng&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Press &amp;lt;code&amp;gt;F9&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== Playback ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
JSR $A000&lt;br /&gt;
&lt;br /&gt;
JSR $A003&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
=== Tested Defaults ===&lt;br /&gt;
&lt;br /&gt;
* SID: $D400&lt;br /&gt;
* Player: $A000&lt;br /&gt;
* Zeropage: $80/$81&lt;br /&gt;
* Timing: NTSC (60 Hz)&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
End of document.&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Code_Snippets&amp;diff=38184</id>
		<title>Code Snippets</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Code_Snippets&amp;diff=38184"/>
		<updated>2025-08-09T08:21:40Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: /* Calculate SIN of an angle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Index of SUPERBASIC Code Snippets (Hopefully this will be sorted by Topic when they grow)&lt;br /&gt;
&lt;br /&gt;
===== Poking and Peeking Memory in a different Bank =====&lt;br /&gt;
&amp;lt;small&amp;gt;Contributed by Ernesto (econtreras in Discord)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SUPERBASIC uses a lot of the memory available, so when you want to store data on a different Bank you want to POKE or PEEK outside the normal memory range, to do so you can use the following PROCEDURES. PLease note that these are not by any means a fast way to do it since we reconfigure the memory LUT so that the memory under the registers location ($C000-$DF00) points to the address that we want to poke or peek on the fly, after that we get or set the content of the memory address and restore the segments so that the Kernel does not blow up after returning.  Contrary to what I initially believed it works!.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;REM &amp;quot;XPEEK - value is stored in peekvalue variable&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
proc xpeek(addr)&amp;lt;br&amp;gt;    &lt;br /&gt;
local block:block=addr\8192:local prevblock&amp;lt;br&amp;gt;    &lt;br /&gt;
local offset:offset=addr&amp;amp;$1fff&amp;lt;br&amp;gt;    &lt;br /&gt;
?0=179:prevblock=?$E:?$E=block:?1=4&amp;lt;br&amp;gt;    &lt;br /&gt;
peekvalue=peek($C000+offset)&amp;lt;br&amp;gt;    &lt;br /&gt;
?1=0:?$E=prevblock&amp;lt;br&amp;gt;&lt;br /&gt;
endproc&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
REM &amp;quot;XPOKE&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
proc xpoke(addr,value)&amp;lt;br&amp;gt;&lt;br /&gt;
local block:block=addr\8192:local prevblock&amp;lt;br&amp;gt;&lt;br /&gt;
local offset:offset=addr&amp;amp;$1fff&amp;lt;br&amp;gt;&lt;br /&gt;
?0=179:prevblock=?$E:?$E=block:?1=4&amp;lt;br&amp;gt;&lt;br /&gt;
?($C000+offset)=value&amp;lt;br&amp;gt;&lt;br /&gt;
?1=0:?$E=prevblock&amp;lt;br&amp;gt;&lt;br /&gt;
endproc &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Print Text at X,Y Position =====&lt;br /&gt;
&amp;lt;small&amp;gt;Contributed by Ernesto (econtreras in Discord)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Chances are that you need to print text at a specific position in the screen, SUPERBASIC doesn&#039;t have a LOCATE command, so the best next thing is to use this routine to print at a certain X,Y coordinate onscreen. Oh you are not not using an 80 column screen mode?, don&#039;t worry the routine will compensate automagically!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;proc printat(x,y,a$)&amp;lt;br&amp;gt;&lt;br /&gt;
col=(?$D001)&amp;amp;2:if col=0 then col=1&amp;lt;br&amp;gt;&lt;br /&gt;
local pos:pos=x+y*80\col:?1=2:rem &amp;quot;Set I/O to text memory&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
for c=0 to len(a$)-1:?(pos+c+$C000)=asc(mid$(a$,c+1,1)):next&amp;lt;br&amp;gt;&lt;br /&gt;
?1=0&amp;lt;br&amp;gt;&lt;br /&gt;
endproc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Square Root =====&lt;br /&gt;
&amp;lt;small&amp;gt;Contributed by Ernesto (econtreras in Discord)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might need to calculate the square root of a number, it&#039;s very useful for a few algorithms, be aware that it will only work on numbers below 32768, square root is returned on the variable - &#039;&#039;guess#&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;REM &amp;quot;Newton&#039;s Method of Calculating Square Root&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
proc sqr(n)&amp;lt;br&amp;gt;&lt;br /&gt;
n#=n:guess#=n#&amp;lt;br&amp;gt;&lt;br /&gt;
while (0.001&amp;lt;abs(guess#*guess#-n#))&amp;lt;br&amp;gt;&lt;br /&gt;
guess#=guess#+n/guess#)/2&amp;lt;br&amp;gt;&lt;br /&gt;
wend&amp;lt;br&amp;gt;&lt;br /&gt;
endproc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Calculate SIN of an angle =====&lt;br /&gt;
&amp;lt;small&amp;gt;Contributed by Raúl SQ&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;50 input &amp;quot;Enter an angle in degrees (float): &amp;quot;;d#&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;100 sin(d#)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;150 end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;1200 proc sin(s#)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;1250 deg_to_rad#=0.01745329&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;1260 s#=s#*deg_to_rad#&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;1300 x=6: rem &amp;quot;Factorial of 3&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;1400 y=120: rem &amp;quot;Factorial of 5&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;1500 z=5040: rem &amp;quot;Factorial of 7&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;1600 pow2#=s#*s#:q#=pow2#*s#: rem &amp;quot;Power of 3&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;1700 r#=q#*pow2#: rem &amp;quot;Power of 5&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;1800 t#=r#*pow2#: rem &amp;quot;Power of 7&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;1900 sine#=s#-(q#/x)+(r#/y)-(t#/z)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;2000 print sine#&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;2100 endproc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Loading and Launching another SUPERBASIC program =====&lt;br /&gt;
&amp;lt;small&amp;gt;Contributed by Ernesto (econtreras in Discord)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say that you want to do a menu or intro in a SUPERBASIC program and then after it plays out or you select something this program loads and executes another SUPERBASIC program!, sounds impossible?, no it&#039;s not, it&#039;s actually easy, we can use the functionality of SUPERBASIC that allows you to create your BASIC program (text file) on your PC and transfer it and execute it in your Foenix computer. (I bet you didn&#039;t know you could do that!).  Use these two lines to load and execute your program, obviously this erases the current program from memory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
memcopy $28000,$8000 poke 0: rem &amp;quot;Clear transfer area for new program&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
a$=&amp;quot;Program.bas&amp;quot;:bload a$,$28000:xgo&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Renumbering a Program ====&lt;br /&gt;
&amp;lt;small&amp;gt;Contributed by Mike (mcassera in Discord)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a down and dirty basic routine you can use to renumber your program. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
1000 rem &amp;quot;SuperBASIC renum routine&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
1010 a=$2000:b=1000:c=10&amp;lt;br&amp;gt;&lt;br /&gt;
1020 while peek(a)&amp;lt;&amp;gt;0&amp;lt;br&amp;gt;&lt;br /&gt;
1030 print peekw(a+1);&amp;quot; --&amp;gt; &amp;quot;;b&amp;lt;br&amp;gt;&lt;br /&gt;
1040 pokew a+1,b&amp;lt;br&amp;gt;&lt;br /&gt;
1050 b=b+c&amp;lt;br&amp;gt;&lt;br /&gt;
1060 a=a+peek(a)&amp;lt;br&amp;gt;&lt;br /&gt;
1070 wend &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;blockquote&amp;gt;&#039;a&#039; is the memory location of the basic line&lt;br /&gt;
&lt;br /&gt;
&#039;b&#039; is the new line number&lt;br /&gt;
&lt;br /&gt;
&#039;c&#039; is the interval between new line numbers&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This little program just goes around and changes the word value that hold line numbers. This does not fix any GOTO or GOSUB statements, you&#039;ll have to update those on your own. (Use at your own risk).&lt;br /&gt;
&lt;br /&gt;
==== Getting a Directory from BASIC ====&lt;br /&gt;
&amp;lt;small&amp;gt;Contributed by Mike (mcassera in Discord)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I had written an ML program to work with BASIC to dump the directory into memory so I could then copy the filenames into an array. I&#039;ve pulled it out here for a simple basic program you could use in your program.  I&#039;ve only extracted the names because at the time I didn&#039;t need file sizes. The basic program just prints the directory to the screen but you could modify it to place the names in an array&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The machine language routine can be obtained from the following link:&lt;br /&gt;
https://github.com/mcassera/get_dir/blob/5bb017985793c89455746616493f092ef6a47045/get_dir.bin&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The sample BASIC code is here:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
10    bload &amp;quot;get_dir.bin&amp;quot;,$7F00&amp;lt;BR&amp;gt;&lt;br /&gt;
15    buffer=$7700:buffloc=$7FBB&amp;lt;BR&amp;gt;&lt;br /&gt;
20    directory(buffer,0,&amp;quot;&amp;quot;)&amp;lt;BR&amp;gt;&lt;br /&gt;
30    for n=buffer to peekw(buffloc)&amp;lt;BR&amp;gt;&lt;br /&gt;
40    cprint chr$(peek(n));&amp;lt;BR&amp;gt;&lt;br /&gt;
50    if peek(n)=0 then print &amp;lt;BR&amp;gt;&lt;br /&gt;
60    next &amp;lt;BR&amp;gt;&lt;br /&gt;
70    print &amp;lt;BR&amp;gt;&lt;br /&gt;
80    end &amp;lt;BR&amp;gt;&lt;br /&gt;
1000  proc directory(loc,len,path$)&amp;lt;BR&amp;gt;&lt;br /&gt;
1010  buffloc=$7FBB&amp;lt;BR&amp;gt;&lt;br /&gt;
1020  pathlength=$7FBD&amp;lt;BR&amp;gt;&lt;br /&gt;
1030  pathloc=$7FBE&amp;lt;BR&amp;gt;&lt;br /&gt;
1040  getdir=$7F00&amp;lt;BR&amp;gt;&lt;br /&gt;
1050  pokew buffloc,loc&amp;lt;BR&amp;gt;&lt;br /&gt;
1060  poke pathlength,len&amp;lt;BR&amp;gt;&lt;br /&gt;
1070  for n=0 to len&amp;lt;BR&amp;gt;&lt;br /&gt;
1080  poke pathloc+n,asc(mid$(path$,n+1,1))&amp;lt;BR&amp;gt;&lt;br /&gt;
1090  next &amp;lt;BR&amp;gt;&lt;br /&gt;
1100  call getdir&amp;lt;BR&amp;gt;&lt;br /&gt;
1120  endproc &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Code Explanation&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The basic program loads the binary and sets aside 2k of ram below BASIC rom for the directory buffer. &lt;br /&gt;
* Line 20 is where you call the directory routine. You send the buffer info (already set), the length of your path (if not reading the main directory) and the path.&lt;br /&gt;
* So if I was reading a directory called &#039;bitmaps&#039; the command would change to :  directory(buffer,7,&amp;quot;bitmaps&amp;quot;) &lt;br /&gt;
* Lines 30 to 60 print the directory from memory. This is where you could read the data into an array. Files are separated with a zero byte hence line 50.&lt;br /&gt;
* The file names are stored in memory $7700 to $7eff. You can change the buffer location by changing the value of buffer in line 15, but 2k of ram will be cleared out after that address. &lt;br /&gt;
* The rest of the variables are (buffloc, pathlength,pathloc,getdir) are used by the ML routine and will break it if changed&lt;br /&gt;
&lt;br /&gt;
__FORCETOC__&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Code_Snippets&amp;diff=38183</id>
		<title>Code Snippets</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Code_Snippets&amp;diff=38183"/>
		<updated>2025-08-09T08:19:11Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Index of SUPERBASIC Code Snippets (Hopefully this will be sorted by Topic when they grow)&lt;br /&gt;
&lt;br /&gt;
===== Poking and Peeking Memory in a different Bank =====&lt;br /&gt;
&amp;lt;small&amp;gt;Contributed by Ernesto (econtreras in Discord)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SUPERBASIC uses a lot of the memory available, so when you want to store data on a different Bank you want to POKE or PEEK outside the normal memory range, to do so you can use the following PROCEDURES. PLease note that these are not by any means a fast way to do it since we reconfigure the memory LUT so that the memory under the registers location ($C000-$DF00) points to the address that we want to poke or peek on the fly, after that we get or set the content of the memory address and restore the segments so that the Kernel does not blow up after returning.  Contrary to what I initially believed it works!.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;REM &amp;quot;XPEEK - value is stored in peekvalue variable&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
proc xpeek(addr)&amp;lt;br&amp;gt;    &lt;br /&gt;
local block:block=addr\8192:local prevblock&amp;lt;br&amp;gt;    &lt;br /&gt;
local offset:offset=addr&amp;amp;$1fff&amp;lt;br&amp;gt;    &lt;br /&gt;
?0=179:prevblock=?$E:?$E=block:?1=4&amp;lt;br&amp;gt;    &lt;br /&gt;
peekvalue=peek($C000+offset)&amp;lt;br&amp;gt;    &lt;br /&gt;
?1=0:?$E=prevblock&amp;lt;br&amp;gt;&lt;br /&gt;
endproc&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
REM &amp;quot;XPOKE&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
proc xpoke(addr,value)&amp;lt;br&amp;gt;&lt;br /&gt;
local block:block=addr\8192:local prevblock&amp;lt;br&amp;gt;&lt;br /&gt;
local offset:offset=addr&amp;amp;$1fff&amp;lt;br&amp;gt;&lt;br /&gt;
?0=179:prevblock=?$E:?$E=block:?1=4&amp;lt;br&amp;gt;&lt;br /&gt;
?($C000+offset)=value&amp;lt;br&amp;gt;&lt;br /&gt;
?1=0:?$E=prevblock&amp;lt;br&amp;gt;&lt;br /&gt;
endproc &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Print Text at X,Y Position =====&lt;br /&gt;
&amp;lt;small&amp;gt;Contributed by Ernesto (econtreras in Discord)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Chances are that you need to print text at a specific position in the screen, SUPERBASIC doesn&#039;t have a LOCATE command, so the best next thing is to use this routine to print at a certain X,Y coordinate onscreen. Oh you are not not using an 80 column screen mode?, don&#039;t worry the routine will compensate automagically!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;proc printat(x,y,a$)&amp;lt;br&amp;gt;&lt;br /&gt;
col=(?$D001)&amp;amp;2:if col=0 then col=1&amp;lt;br&amp;gt;&lt;br /&gt;
local pos:pos=x+y*80\col:?1=2:rem &amp;quot;Set I/O to text memory&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
for c=0 to len(a$)-1:?(pos+c+$C000)=asc(mid$(a$,c+1,1)):next&amp;lt;br&amp;gt;&lt;br /&gt;
?1=0&amp;lt;br&amp;gt;&lt;br /&gt;
endproc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Square Root =====&lt;br /&gt;
&amp;lt;small&amp;gt;Contributed by Ernesto (econtreras in Discord)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might need to calculate the square root of a number, it&#039;s very useful for a few algorithms, be aware that it will only work on numbers below 32768, square root is returned on the variable - &#039;&#039;guess#&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;REM &amp;quot;Newton&#039;s Method of Calculating Square Root&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
proc sqr(n)&amp;lt;br&amp;gt;&lt;br /&gt;
n#=n:guess#=n#&amp;lt;br&amp;gt;&lt;br /&gt;
while (0.001&amp;lt;abs(guess#*guess#-n#))&amp;lt;br&amp;gt;&lt;br /&gt;
guess#=guess#+n/guess#)/2&amp;lt;br&amp;gt;&lt;br /&gt;
wend&amp;lt;br&amp;gt;&lt;br /&gt;
endproc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Calculate SIN of an angle =====&lt;br /&gt;
&amp;lt;small&amp;gt;Contributed by Raúl SQ&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;input &amp;quot;Enter an angle in degrees (float): &amp;quot;;d#&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sin(d#)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;proc sin(s#)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;deg_to_rad#=0.01745329&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;s#=s#*deg_to_rad#&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;x=6: rem &amp;quot;Factorial of 3&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;y=120: rem &amp;quot;Factorial of 5&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;z=5040: rem &amp;quot;Factorial of 7&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;pow2#=s#*s#:q#=pow2#*s#: rem &amp;quot;Power of 3&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;r#=q#*pow2#: rem &amp;quot;Power of 5&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;t#=r#*pow2#: rem &amp;quot;Power of 7&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sine#=s#-(q#/x)+(r#/y)-(t#/z)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;print sine#&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;endproc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Loading and Launching another SUPERBASIC program =====&lt;br /&gt;
&amp;lt;small&amp;gt;Contributed by Ernesto (econtreras in Discord)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say that you want to do a menu or intro in a SUPERBASIC program and then after it plays out or you select something this program loads and executes another SUPERBASIC program!, sounds impossible?, no it&#039;s not, it&#039;s actually easy, we can use the functionality of SUPERBASIC that allows you to create your BASIC program (text file) on your PC and transfer it and execute it in your Foenix computer. (I bet you didn&#039;t know you could do that!).  Use these two lines to load and execute your program, obviously this erases the current program from memory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
memcopy $28000,$8000 poke 0: rem &amp;quot;Clear transfer area for new program&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
a$=&amp;quot;Program.bas&amp;quot;:bload a$,$28000:xgo&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Renumbering a Program ====&lt;br /&gt;
&amp;lt;small&amp;gt;Contributed by Mike (mcassera in Discord)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a down and dirty basic routine you can use to renumber your program. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
1000 rem &amp;quot;SuperBASIC renum routine&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
1010 a=$2000:b=1000:c=10&amp;lt;br&amp;gt;&lt;br /&gt;
1020 while peek(a)&amp;lt;&amp;gt;0&amp;lt;br&amp;gt;&lt;br /&gt;
1030 print peekw(a+1);&amp;quot; --&amp;gt; &amp;quot;;b&amp;lt;br&amp;gt;&lt;br /&gt;
1040 pokew a+1,b&amp;lt;br&amp;gt;&lt;br /&gt;
1050 b=b+c&amp;lt;br&amp;gt;&lt;br /&gt;
1060 a=a+peek(a)&amp;lt;br&amp;gt;&lt;br /&gt;
1070 wend &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;blockquote&amp;gt;&#039;a&#039; is the memory location of the basic line&lt;br /&gt;
&lt;br /&gt;
&#039;b&#039; is the new line number&lt;br /&gt;
&lt;br /&gt;
&#039;c&#039; is the interval between new line numbers&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This little program just goes around and changes the word value that hold line numbers. This does not fix any GOTO or GOSUB statements, you&#039;ll have to update those on your own. (Use at your own risk).&lt;br /&gt;
&lt;br /&gt;
==== Getting a Directory from BASIC ====&lt;br /&gt;
&amp;lt;small&amp;gt;Contributed by Mike (mcassera in Discord)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I had written an ML program to work with BASIC to dump the directory into memory so I could then copy the filenames into an array. I&#039;ve pulled it out here for a simple basic program you could use in your program.  I&#039;ve only extracted the names because at the time I didn&#039;t need file sizes. The basic program just prints the directory to the screen but you could modify it to place the names in an array&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The machine language routine can be obtained from the following link:&lt;br /&gt;
https://github.com/mcassera/get_dir/blob/5bb017985793c89455746616493f092ef6a47045/get_dir.bin&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The sample BASIC code is here:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
10    bload &amp;quot;get_dir.bin&amp;quot;,$7F00&amp;lt;BR&amp;gt;&lt;br /&gt;
15    buffer=$7700:buffloc=$7FBB&amp;lt;BR&amp;gt;&lt;br /&gt;
20    directory(buffer,0,&amp;quot;&amp;quot;)&amp;lt;BR&amp;gt;&lt;br /&gt;
30    for n=buffer to peekw(buffloc)&amp;lt;BR&amp;gt;&lt;br /&gt;
40    cprint chr$(peek(n));&amp;lt;BR&amp;gt;&lt;br /&gt;
50    if peek(n)=0 then print &amp;lt;BR&amp;gt;&lt;br /&gt;
60    next &amp;lt;BR&amp;gt;&lt;br /&gt;
70    print &amp;lt;BR&amp;gt;&lt;br /&gt;
80    end &amp;lt;BR&amp;gt;&lt;br /&gt;
1000  proc directory(loc,len,path$)&amp;lt;BR&amp;gt;&lt;br /&gt;
1010  buffloc=$7FBB&amp;lt;BR&amp;gt;&lt;br /&gt;
1020  pathlength=$7FBD&amp;lt;BR&amp;gt;&lt;br /&gt;
1030  pathloc=$7FBE&amp;lt;BR&amp;gt;&lt;br /&gt;
1040  getdir=$7F00&amp;lt;BR&amp;gt;&lt;br /&gt;
1050  pokew buffloc,loc&amp;lt;BR&amp;gt;&lt;br /&gt;
1060  poke pathlength,len&amp;lt;BR&amp;gt;&lt;br /&gt;
1070  for n=0 to len&amp;lt;BR&amp;gt;&lt;br /&gt;
1080  poke pathloc+n,asc(mid$(path$,n+1,1))&amp;lt;BR&amp;gt;&lt;br /&gt;
1090  next &amp;lt;BR&amp;gt;&lt;br /&gt;
1100  call getdir&amp;lt;BR&amp;gt;&lt;br /&gt;
1120  endproc &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Code Explanation&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The basic program loads the binary and sets aside 2k of ram below BASIC rom for the directory buffer. &lt;br /&gt;
* Line 20 is where you call the directory routine. You send the buffer info (already set), the length of your path (if not reading the main directory) and the path.&lt;br /&gt;
* So if I was reading a directory called &#039;bitmaps&#039; the command would change to :  directory(buffer,7,&amp;quot;bitmaps&amp;quot;) &lt;br /&gt;
* Lines 30 to 60 print the directory from memory. This is where you could read the data into an array. Files are separated with a zero byte hence line 50.&lt;br /&gt;
* The file names are stored in memory $7700 to $7eff. You can change the buffer location by changing the value of buffer in line 15, but 2k of ram will be cleared out after that address. &lt;br /&gt;
* The rest of the variables are (buffloc, pathlength,pathloc,getdir) are used by the ML routine and will break it if changed&lt;br /&gt;
&lt;br /&gt;
__FORCETOC__&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Code_Snippets&amp;diff=38182</id>
		<title>Code Snippets</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Code_Snippets&amp;diff=38182"/>
		<updated>2025-08-09T08:14:17Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: Added Sin of an angle&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Index of SUPERBASIC Code Snippets (Hopefully this will be sorted by Topic when they grow)&lt;br /&gt;
&lt;br /&gt;
===== Poking and Peeking Memory in a different Bank =====&lt;br /&gt;
&amp;lt;small&amp;gt;Contributed by Ernesto (econtreras in Discord)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SUPERBASIC uses a lot of the memory available, so when you want to store data on a different Bank you want to POKE or PEEK outside the normal memory range, to do so you can use the following PROCEDURES. PLease note that these are not by any means a fast way to do it since we reconfigure the memory LUT so that the memory under the registers location ($C000-$DF00) points to the address that we want to poke or peek on the fly, after that we get or set the content of the memory address and restore the segments so that the Kernel does not blow up after returning.  Contrary to what I initially believed it works!.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;REM &amp;quot;XPEEK - value is stored in peekvalue variable&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
proc xpeek(addr)&amp;lt;br&amp;gt;    &lt;br /&gt;
local block:block=addr\8192:local prevblock&amp;lt;br&amp;gt;    &lt;br /&gt;
local offset:offset=addr&amp;amp;$1fff&amp;lt;br&amp;gt;    &lt;br /&gt;
?0=179:prevblock=?$E:?$E=block:?1=4&amp;lt;br&amp;gt;    &lt;br /&gt;
peekvalue=peek($C000+offset)&amp;lt;br&amp;gt;    &lt;br /&gt;
?1=0:?$E=prevblock&amp;lt;br&amp;gt;&lt;br /&gt;
endproc&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
REM &amp;quot;XPOKE&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
proc xpoke(addr,value)&amp;lt;br&amp;gt;&lt;br /&gt;
local block:block=addr\8192:local prevblock&amp;lt;br&amp;gt;&lt;br /&gt;
local offset:offset=addr&amp;amp;$1fff&amp;lt;br&amp;gt;&lt;br /&gt;
?0=179:prevblock=?$E:?$E=block:?1=4&amp;lt;br&amp;gt;&lt;br /&gt;
?($C000+offset)=value&amp;lt;br&amp;gt;&lt;br /&gt;
?1=0:?$E=prevblock&amp;lt;br&amp;gt;&lt;br /&gt;
endproc &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Print Text at X,Y Position =====&lt;br /&gt;
&amp;lt;small&amp;gt;Contributed by Ernesto (econtreras in Discord)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Chances are that you need to print text at a specific position in the screen, SUPERBASIC doesn&#039;t have a LOCATE command, so the best next thing is to use this routine to print at a certain X,Y coordinate onscreen. Oh you are not not using an 80 column screen mode?, don&#039;t worry the routine will compensate automagically!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;proc printat(x,y,a$)&amp;lt;br&amp;gt;&lt;br /&gt;
col=(?$D001)&amp;amp;2:if col=0 then col=1&amp;lt;br&amp;gt;&lt;br /&gt;
local pos:pos=x+y*80\col:?1=2:rem &amp;quot;Set I/O to text memory&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
for c=0 to len(a$)-1:?(pos+c+$C000)=asc(mid$(a$,c+1,1)):next&amp;lt;br&amp;gt;&lt;br /&gt;
?1=0&amp;lt;br&amp;gt;&lt;br /&gt;
endproc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Square Root =====&lt;br /&gt;
&amp;lt;small&amp;gt;Contributed by Ernesto (econtreras in Discord)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might need to calculate the square root of a number, it&#039;s very useful for a few algorithms, be aware that it will only work on numbers below 32768, square root is returned on the variable - &#039;&#039;guess#&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;REM &amp;quot;Newton&#039;s Method of Calculating Square Root&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
proc sqr(n)&amp;lt;br&amp;gt;&lt;br /&gt;
n#=n:guess#=n#&amp;lt;br&amp;gt;&lt;br /&gt;
while (0.001&amp;lt;abs(guess#*guess#-n#))&amp;lt;br&amp;gt;&lt;br /&gt;
guess#=guess#+n/guess#)/2&amp;lt;br&amp;gt;&lt;br /&gt;
wend&amp;lt;br&amp;gt;&lt;br /&gt;
endproc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Calculate SIN of an angle =====&lt;br /&gt;
&amp;lt;small&amp;gt;Contributed by Raúl SQ&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;50    input &amp;quot;Enter an angle in degrees (float): &amp;quot;;d#&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;100   sin(d#)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;150   end&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;1200  proc sin(s#)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;1250     deg_to_rad#=0.01745329&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;1260     s#=s#*deg_to_rad#&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;1300     x=6: rem &amp;quot;Factorial of 3&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;1400     y=120: rem &amp;quot;Factorial of 5&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;1500     z=5040: rem &amp;quot;Factorial of 7&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;1600     pow2#=s#*s#:q#=pow2#*s#: rem &amp;quot;Power of 3&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;1700     r#=q#*pow2#: rem &amp;quot;Power of 5&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;1800     t#=r#*pow2#: rem &amp;quot;Power of 7&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;1900     sine#=s#-(q#/x)+(r#/y)-(t#/z)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;2000     print sine#&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;2100  endproc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Loading and Launching another SUPERBASIC program =====&lt;br /&gt;
&amp;lt;small&amp;gt;Contributed by Ernesto (econtreras in Discord)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say that you want to do a menu or intro in a SUPERBASIC program and then after it plays out or you select something this program loads and executes another SUPERBASIC program!, sounds impossible?, no it&#039;s not, it&#039;s actually easy, we can use the functionality of SUPERBASIC that allows you to create your BASIC program (text file) on your PC and transfer it and execute it in your Foenix computer. (I bet you didn&#039;t know you could do that!).  Use these two lines to load and execute your program, obviously this erases the current program from memory.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
memcopy $28000,$8000 poke 0: rem &amp;quot;Clear transfer area for new program&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
a$=&amp;quot;Program.bas&amp;quot;:bload a$,$28000:xgo&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Renumbering a Program ====&lt;br /&gt;
&amp;lt;small&amp;gt;Contributed by Mike (mcassera in Discord)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a down and dirty basic routine you can use to renumber your program. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
1000 rem &amp;quot;SuperBASIC renum routine&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
1010 a=$2000:b=1000:c=10&amp;lt;br&amp;gt;&lt;br /&gt;
1020 while peek(a)&amp;lt;&amp;gt;0&amp;lt;br&amp;gt;&lt;br /&gt;
1030 print peekw(a+1);&amp;quot; --&amp;gt; &amp;quot;;b&amp;lt;br&amp;gt;&lt;br /&gt;
1040 pokew a+1,b&amp;lt;br&amp;gt;&lt;br /&gt;
1050 b=b+c&amp;lt;br&amp;gt;&lt;br /&gt;
1060 a=a+peek(a)&amp;lt;br&amp;gt;&lt;br /&gt;
1070 wend &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;blockquote&amp;gt;&#039;a&#039; is the memory location of the basic line&lt;br /&gt;
&lt;br /&gt;
&#039;b&#039; is the new line number&lt;br /&gt;
&lt;br /&gt;
&#039;c&#039; is the interval between new line numbers&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This little program just goes around and changes the word value that hold line numbers. This does not fix any GOTO or GOSUB statements, you&#039;ll have to update those on your own. (Use at your own risk).&lt;br /&gt;
&lt;br /&gt;
==== Getting a Directory from BASIC ====&lt;br /&gt;
&amp;lt;small&amp;gt;Contributed by Mike (mcassera in Discord)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I had written an ML program to work with BASIC to dump the directory into memory so I could then copy the filenames into an array. I&#039;ve pulled it out here for a simple basic program you could use in your program.  I&#039;ve only extracted the names because at the time I didn&#039;t need file sizes. The basic program just prints the directory to the screen but you could modify it to place the names in an array&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The machine language routine can be obtained from the following link:&lt;br /&gt;
https://github.com/mcassera/get_dir/blob/5bb017985793c89455746616493f092ef6a47045/get_dir.bin&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The sample BASIC code is here:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
10    bload &amp;quot;get_dir.bin&amp;quot;,$7F00&amp;lt;BR&amp;gt;&lt;br /&gt;
15    buffer=$7700:buffloc=$7FBB&amp;lt;BR&amp;gt;&lt;br /&gt;
20    directory(buffer,0,&amp;quot;&amp;quot;)&amp;lt;BR&amp;gt;&lt;br /&gt;
30    for n=buffer to peekw(buffloc)&amp;lt;BR&amp;gt;&lt;br /&gt;
40    cprint chr$(peek(n));&amp;lt;BR&amp;gt;&lt;br /&gt;
50    if peek(n)=0 then print &amp;lt;BR&amp;gt;&lt;br /&gt;
60    next &amp;lt;BR&amp;gt;&lt;br /&gt;
70    print &amp;lt;BR&amp;gt;&lt;br /&gt;
80    end &amp;lt;BR&amp;gt;&lt;br /&gt;
1000  proc directory(loc,len,path$)&amp;lt;BR&amp;gt;&lt;br /&gt;
1010  buffloc=$7FBB&amp;lt;BR&amp;gt;&lt;br /&gt;
1020  pathlength=$7FBD&amp;lt;BR&amp;gt;&lt;br /&gt;
1030  pathloc=$7FBE&amp;lt;BR&amp;gt;&lt;br /&gt;
1040  getdir=$7F00&amp;lt;BR&amp;gt;&lt;br /&gt;
1050  pokew buffloc,loc&amp;lt;BR&amp;gt;&lt;br /&gt;
1060  poke pathlength,len&amp;lt;BR&amp;gt;&lt;br /&gt;
1070  for n=0 to len&amp;lt;BR&amp;gt;&lt;br /&gt;
1080  poke pathloc+n,asc(mid$(path$,n+1,1))&amp;lt;BR&amp;gt;&lt;br /&gt;
1090  next &amp;lt;BR&amp;gt;&lt;br /&gt;
1100  call getdir&amp;lt;BR&amp;gt;&lt;br /&gt;
1120  endproc &amp;lt;BR&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Code Explanation&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* The basic program loads the binary and sets aside 2k of ram below BASIC rom for the directory buffer. &lt;br /&gt;
* Line 20 is where you call the directory routine. You send the buffer info (already set), the length of your path (if not reading the main directory) and the path.&lt;br /&gt;
* So if I was reading a directory called &#039;bitmaps&#039; the command would change to :  directory(buffer,7,&amp;quot;bitmaps&amp;quot;) &lt;br /&gt;
* Lines 30 to 60 print the directory from memory. This is where you could read the data into an array. Files are separated with a zero byte hence line 50.&lt;br /&gt;
* The file names are stored in memory $7700 to $7eff. You can change the buffer location by changing the value of buffer in line 15, but 2k of ram will be cleared out after that address. &lt;br /&gt;
* The rest of the variables are (buffloc, pathlength,pathloc,getdir) are used by the ML routine and will break it if changed&lt;br /&gt;
&lt;br /&gt;
__FORCETOC__&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC_Memory_Map&amp;diff=37883</id>
		<title>SuperBASIC Memory Map</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC_Memory_Map&amp;diff=37883"/>
		<updated>2025-01-12T04:01:56Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: /* Memory Map under BASIC */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Memory Map under BASIC ===&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|+ Caption text&lt;br /&gt;
|-&lt;br /&gt;
! Initial Address !! End Address !! Description !! Bytes&lt;br /&gt;
|-&lt;br /&gt;
| $0000|| -|| MMU Control Register || 1&lt;br /&gt;
|-&lt;br /&gt;
| $0001|| -|| I/O Control Register || 1&lt;br /&gt;
|-&lt;br /&gt;
| $0002|| $0007|| Free Zero Page Addresses || 6&lt;br /&gt;
|-&lt;br /&gt;
| $0008|| $000F|| MMU Control Addresses || 8&lt;br /&gt;
|-&lt;br /&gt;
| $0010|| $002F|| Free Zero Page Addresses || 32&lt;br /&gt;
|-&lt;br /&gt;
| $0030|| $003F|| Used Zero Page Addresses for (xx),Y Addressing || 16&lt;br /&gt;
|-&lt;br /&gt;
| $0040|| $0041 || Current Address on screen of start of line || 2&lt;br /&gt;
|-&lt;br /&gt;
| $0042|| $004F|| Avaliable Zero Page Addresses || 14&lt;br /&gt;
|-&lt;br /&gt;
| $0050|| $00AF|| Number / Floating Point Stack for 16 numbers || 96 &lt;br /&gt;
|-&lt;br /&gt;
| $00B0||$00EF|| Available Zero Page || 64&lt;br /&gt;
|-&lt;br /&gt;
| $00F0|| $00FF|| Kernel Arguments in Zero Page* || 16&lt;br /&gt;
|-&lt;br /&gt;
| $0100|| $01FF|| Hardware Stack of 6502 || 256&lt;br /&gt;
|-&lt;br /&gt;
| $0200|| $0228|| Basic mini-Kernel memory || 40&lt;br /&gt;
|-&lt;br /&gt;
| $0229|| $03FF|| Available Low Memory | Buffer area by Sound Command in BASIC (available if not using this command) || 470&lt;br /&gt;
|-&lt;br /&gt;
| $0400|| $041F|| Control Storage first 8 bytes control syntax highlighting || 32&lt;br /&gt;
|-&lt;br /&gt;
| $0420|| $0814|| Memory Storage || 1012&lt;br /&gt;
|-&lt;br /&gt;
|$0678&lt;br /&gt;
|$067F&lt;br /&gt;
|Keyboard Buffer (8 keys max)&lt;br /&gt;
|8&lt;br /&gt;
|-&lt;br /&gt;
|$0680&lt;br /&gt;
|$0680&lt;br /&gt;
|Pending key presses in Keyboard Buffer&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|$07ea&lt;br /&gt;
|$07ea&lt;br /&gt;
|Y position of blinking cursor (***does not adjust the actual cursor position)&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|$07eb&lt;br /&gt;
|$07eb&lt;br /&gt;
|X position of blinking cursor (***does not adjust the actual cursor position)&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
| $0814|| $0FFF|| Available Low Memory || 2027&lt;br /&gt;
|-&lt;br /&gt;
| $1000|| $1FFF|| SuperBASIC Identifier Tables, allocated memory, string vars, stack || 4kb&lt;br /&gt;
|-&lt;br /&gt;
| $2000|| $77FF|| SuperBASIC Program Tokenized Code (grows Upward) || 22kb&lt;br /&gt;
|-&lt;br /&gt;
| $7800|| $7FFF|| Top 2k of SuperBASIC Program tokenize code or used for ML routines in low memory || 2kb&lt;br /&gt;
|-&lt;br /&gt;
| $8000|| $BFFF|| SUPERBASIC CODE || 16kb&lt;br /&gt;
|-&lt;br /&gt;
| $C000|| $DFFF|| I/O Memory Pages / Underlying Kernel Code (Selectable with I/O control Register)|| 8kb&lt;br /&gt;
|-&lt;br /&gt;
| $E000|| $FFEF|| KERNEL CODE || 8176&lt;br /&gt;
|-&lt;br /&gt;
| $FFF0|| $FFFF|| Reset Vectors and NMI / IRQ / BRK Vectors || 16&lt;br /&gt;
|-&lt;br /&gt;
| $01:0000|| $02:2BFF|| Default Memory used by BASIC bitmap graphics || 75kb&lt;br /&gt;
|-&lt;br /&gt;
| $02:2C00|| $02:7FFF|| Available High Memory || 21kb&lt;br /&gt;
|-&lt;br /&gt;
| $02:8000|| $02:F000|| Available High Memory | Used for BASIC Cross Development w/PC or MAC (or Available High Memory)|| 32k&lt;br /&gt;
|-&lt;br /&gt;
| $03:0000|| $03:7FFF|| Used for Sprite Data in BASIC || 32kb&lt;br /&gt;
|-&lt;br /&gt;
| $03:8000|| $03:FFFF|| Available High Memory | Unless not running from Flash, Used for ROM Images|| 32k&lt;br /&gt;
|-&lt;br /&gt;
| $04:0000|| $07:DFFF|| Available High Memory || 248kb&lt;br /&gt;
|-&lt;br /&gt;
| $07:E000|| $07:FFFF|| Available High Memory | Being considered to be Reserved for Environmental Variables || 8Kb&lt;br /&gt;
|-&lt;br /&gt;
| $10:0000|| $13:FFFF|| Cartridge Expanded Memory (addresable only by CPU) || 256kb&lt;br /&gt;
|-&lt;br /&gt;
| $14:0000|| $1F:FFFF|| Future Expansions? || 768kb&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== *Detail of Kernel Arguments in Zero Page (TBC!) ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Initial Address&lt;br /&gt;
!End Address&lt;br /&gt;
!Description&lt;br /&gt;
!bytes&lt;br /&gt;
|-&lt;br /&gt;
|$F0&lt;br /&gt;
|$F1&lt;br /&gt;
|Kernel Event Struct Pointer - points to an 8 byte buffer with a &amp;quot;kernel event&amp;quot; structure  &lt;br /&gt;
|2 bytes&lt;br /&gt;
|-&lt;br /&gt;
|$F3&lt;br /&gt;
|&lt;br /&gt;
|Kernel File stream number (Read or Write)&lt;br /&gt;
|1 byte&lt;br /&gt;
|-&lt;br /&gt;
|$F4&lt;br /&gt;
|&lt;br /&gt;
|Kernel File buffer length (Read or Write)&lt;br /&gt;
|1 byte&lt;br /&gt;
|-&lt;br /&gt;
|$F5&lt;br /&gt;
|$FA&lt;br /&gt;
|???&lt;br /&gt;
|6 bytes&lt;br /&gt;
|-&lt;br /&gt;
|$FB&lt;br /&gt;
|$FC&lt;br /&gt;
|Kernel Buffer Address Pointer - Multiple purpouse buffer area for recv/send data from Kernel Events&lt;br /&gt;
|2 bytes&lt;br /&gt;
|-&lt;br /&gt;
|$FD&lt;br /&gt;
|&lt;br /&gt;
|Kernel Buffer Length&lt;br /&gt;
|1 byte&lt;br /&gt;
|-&lt;br /&gt;
|$FE&lt;br /&gt;
|$FF&lt;br /&gt;
|Unknown&lt;br /&gt;
|2 bytes&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC_Memory_Map&amp;diff=37882</id>
		<title>SuperBASIC Memory Map</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC_Memory_Map&amp;diff=37882"/>
		<updated>2025-01-12T03:56:25Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: /* Memory Map under BASIC */  Added memory $7ea to $7eb for cursor location&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Memory Map under BASIC ===&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|+ Caption text&lt;br /&gt;
|-&lt;br /&gt;
! Initial Address !! End Address !! Description !! Bytes&lt;br /&gt;
|-&lt;br /&gt;
| $0000|| -|| MMU Control Register || 1&lt;br /&gt;
|-&lt;br /&gt;
| $0001|| -|| I/O Control Register || 1&lt;br /&gt;
|-&lt;br /&gt;
| $0002|| $0007|| Free Zero Page Addresses || 6&lt;br /&gt;
|-&lt;br /&gt;
| $0008|| $000F|| MMU Control Addresses || 8&lt;br /&gt;
|-&lt;br /&gt;
| $0010|| $002F|| Free Zero Page Addresses || 32&lt;br /&gt;
|-&lt;br /&gt;
| $0030|| $003F|| Used Zero Page Addresses for (xx),Y Addressing || 16&lt;br /&gt;
|-&lt;br /&gt;
| $0040|| $0041 || Current Address on screen of start of line || 2&lt;br /&gt;
|-&lt;br /&gt;
| $0042|| $004F|| Avaliable Zero Page Addresses || 14&lt;br /&gt;
|-&lt;br /&gt;
| $0050|| $00AF|| Number / Floating Point Stack for 16 numbers || 96 &lt;br /&gt;
|-&lt;br /&gt;
| $00B0||$00EF|| Available Zero Page || 64&lt;br /&gt;
|-&lt;br /&gt;
| $00F0|| $00FF|| Kernel Arguments in Zero Page* || 16&lt;br /&gt;
|-&lt;br /&gt;
| $0100|| $01FF|| Hardware Stack of 6502 || 256&lt;br /&gt;
|-&lt;br /&gt;
| $0200|| $0228|| Basic mini-Kernel memory || 40&lt;br /&gt;
|-&lt;br /&gt;
| $0229|| $03FF|| Available Low Memory | Buffer area by Sound Command in BASIC (available if not using this command) || 470&lt;br /&gt;
|-&lt;br /&gt;
| $0400|| $041F|| Control Storage first 8 bytes control syntax highlighting || 32&lt;br /&gt;
|-&lt;br /&gt;
| $0420|| $0814|| Memory Storage || 1012&lt;br /&gt;
|-&lt;br /&gt;
|$0678&lt;br /&gt;
|$067F&lt;br /&gt;
|Keyboard Buffer (8 keys max)&lt;br /&gt;
|8&lt;br /&gt;
|-&lt;br /&gt;
|$0680&lt;br /&gt;
|$0680&lt;br /&gt;
|Pending key presses in Keyboard Buffer&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|$07ea&lt;br /&gt;
|$07ea&lt;br /&gt;
|Y position of blinking cursor&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|$07eb&lt;br /&gt;
|$07eb&lt;br /&gt;
|X position of blinking cursor&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
| $0814|| $0FFF|| Available Low Memory || 2027&lt;br /&gt;
|-&lt;br /&gt;
| $1000|| $1FFF|| SuperBASIC Identifier Tables, allocated memory, string vars, stack || 4kb&lt;br /&gt;
|-&lt;br /&gt;
| $2000|| $77FF|| SuperBASIC Program Tokenized Code (grows Upward) || 22kb&lt;br /&gt;
|-&lt;br /&gt;
| $7800|| $7FFF|| Top 2k of SuperBASIC Program tokenize code or used for ML routines in low memory || 2kb&lt;br /&gt;
|-&lt;br /&gt;
| $8000|| $BFFF|| SUPERBASIC CODE || 16kb&lt;br /&gt;
|-&lt;br /&gt;
| $C000|| $DFFF|| I/O Memory Pages / Underlying Kernel Code (Selectable with I/O control Register)|| 8kb&lt;br /&gt;
|-&lt;br /&gt;
| $E000|| $FFEF|| KERNEL CODE || 8176&lt;br /&gt;
|-&lt;br /&gt;
| $FFF0|| $FFFF|| Reset Vectors and NMI / IRQ / BRK Vectors || 16&lt;br /&gt;
|-&lt;br /&gt;
| $01:0000|| $02:2BFF|| Default Memory used by BASIC bitmap graphics || 75kb&lt;br /&gt;
|-&lt;br /&gt;
| $02:2C00|| $02:7FFF|| Available High Memory || 21kb&lt;br /&gt;
|-&lt;br /&gt;
| $02:8000|| $02:F000|| Available High Memory | Used for BASIC Cross Development w/PC or MAC (or Available High Memory)|| 32k&lt;br /&gt;
|-&lt;br /&gt;
| $03:0000|| $03:7FFF|| Used for Sprite Data in BASIC || 32kb&lt;br /&gt;
|-&lt;br /&gt;
| $03:8000|| $03:FFFF|| Available High Memory | Unless not running from Flash, Used for ROM Images|| 32k&lt;br /&gt;
|-&lt;br /&gt;
| $04:0000|| $07:DFFF|| Available High Memory || 248kb&lt;br /&gt;
|-&lt;br /&gt;
| $07:E000|| $07:FFFF|| Available High Memory | Being considered to be Reserved for Environmental Variables || 8Kb&lt;br /&gt;
|-&lt;br /&gt;
| $10:0000|| $13:FFFF|| Cartridge Expanded Memory (addresable only by CPU) || 256kb&lt;br /&gt;
|-&lt;br /&gt;
| $14:0000|| $1F:FFFF|| Future Expansions? || 768kb&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== *Detail of Kernel Arguments in Zero Page (TBC!) ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Initial Address&lt;br /&gt;
!End Address&lt;br /&gt;
!Description&lt;br /&gt;
!bytes&lt;br /&gt;
|-&lt;br /&gt;
|$F0&lt;br /&gt;
|$F1&lt;br /&gt;
|Kernel Event Struct Pointer - points to an 8 byte buffer with a &amp;quot;kernel event&amp;quot; structure  &lt;br /&gt;
|2 bytes&lt;br /&gt;
|-&lt;br /&gt;
|$F3&lt;br /&gt;
|&lt;br /&gt;
|Kernel File stream number (Read or Write)&lt;br /&gt;
|1 byte&lt;br /&gt;
|-&lt;br /&gt;
|$F4&lt;br /&gt;
|&lt;br /&gt;
|Kernel File buffer length (Read or Write)&lt;br /&gt;
|1 byte&lt;br /&gt;
|-&lt;br /&gt;
|$F5&lt;br /&gt;
|$FA&lt;br /&gt;
|???&lt;br /&gt;
|6 bytes&lt;br /&gt;
|-&lt;br /&gt;
|$FB&lt;br /&gt;
|$FC&lt;br /&gt;
|Kernel Buffer Address Pointer - Multiple purpouse buffer area for recv/send data from Kernel Events&lt;br /&gt;
|2 bytes&lt;br /&gt;
|-&lt;br /&gt;
|$FD&lt;br /&gt;
|&lt;br /&gt;
|Kernel Buffer Length&lt;br /&gt;
|1 byte&lt;br /&gt;
|-&lt;br /&gt;
|$FE&lt;br /&gt;
|$FF&lt;br /&gt;
|Unknown&lt;br /&gt;
|2 bytes&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=554</id>
		<title>SuperBASIC</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=554"/>
		<updated>2024-11-27T02:29:09Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: /* Note */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SuperBASIC is inspired by BBC BASIC but offers quite a bit more.&lt;br /&gt;
* [https://github.com/FoenixRetro/f256-superbasic/blob/main/reference/source/f256jr_basic_ref.pdf SuperBASIC Reference Manual].&lt;br /&gt;
* [[SuperBASIC Memory Map]]&lt;br /&gt;
* Watch EMWhite&#039;s excellent intro series on YouTube: [https://www.youtube.com/playlist?list=PLeHjTvk7NPiSqGz4REMH-S4hjYpLS2YNR Full Playlist].&lt;br /&gt;
* Read EMWhite&#039;s [https://apps.emwhite.org/shared-files/885/?Foenix-Rising-Issue-18-November-2024.pdf&amp;amp;download=1 Foenix Rising Issue 18] (November 2024) which goes into detail about a few of the gotchas of superbasic.&lt;br /&gt;
&lt;br /&gt;
=== An informal list of tips, &amp;quot;gotchas&amp;quot;: ===&lt;br /&gt;
&lt;br /&gt;
===== IF, THEN, ELSE =====&lt;br /&gt;
&lt;br /&gt;
====== Source of this tip: Ernesto ======&lt;br /&gt;
* A regular &amp;lt;code&amp;gt;if then&amp;lt;/code&amp;gt; condition can&#039;t contain an &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt; statement, as in this example: &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0 then x=10&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you need to do an  &amp;lt;code&amp;gt;if then else&amp;lt;/code&amp;gt; structure,  you actually have to do an &amp;lt;code&amp;gt;if else endif&amp;lt;/code&amp;gt; structure like in the following example,  skipping the &amp;lt;code&amp;gt;then&amp;lt;/code&amp;gt; statement. &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0&amp;lt;br /&amp;gt;&lt;br /&gt;
20     x=1&amp;lt;br /&amp;gt;&lt;br /&gt;
30     else&amp;lt;br /&amp;gt;&lt;br /&gt;
40     x=2&amp;lt;br /&amp;gt;&lt;br /&gt;
50 endif&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you do it in one line it needs to have some colons added, making it look weird like this: &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0:x=1:else:x=2:endif&amp;lt;/code&amp;gt;&lt;br /&gt;
* if you dare to omit the &amp;lt;code&amp;gt;endif&amp;lt;/code&amp;gt;  thinking that the &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement won&#039;t need it, (mmm.., everything is in one line, so no need, right?) -Nope...all hell breaks loose!- &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0:x=1:else:x=2: REM &amp;quot;&amp;lt;-- Error, omited the endif&amp;quot;&amp;lt;/code&amp;gt; &lt;br /&gt;
* be careful not to add an extra  &amp;lt;code&amp;gt;then&amp;lt;/code&amp;gt; statement by mistake to an &amp;lt;code&amp;gt;if else endif&amp;lt;/code&amp;gt; structure, if you do -All hell breaks loose again!!- &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0 then  : rem &amp;quot;&amp;lt;-- Error, THEN is not needed!!!&amp;quot; &amp;lt;br /&amp;gt;&lt;br /&gt;
20     x=1 &amp;lt;br /&amp;gt;&lt;br /&gt;
30     else &amp;lt;br /&amp;gt;&lt;br /&gt;
40     x=2 &amp;lt;br /&amp;gt;&lt;br /&gt;
50 endif&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Debugging hint: If you encounter an error like &amp;quot;open structure&amp;quot; or &amp;quot;endproc without a proc&amp;quot;: do not trust the line number that you are given. The root of the problem is probably in a structure earlier on in the code.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===== Evaluating multiple conditions in IF statements =====&lt;br /&gt;
SUPERBASIC doesn&#039;t have the dedicated keywords AND , OR so you have to use the bitwise operators to evaluate multiple conditions, please consider the following examples:&lt;br /&gt;
&lt;br /&gt;
* AND  &amp;lt;code&amp;gt;if (a=1)&amp;amp;(b=2) then c=1&amp;lt;/code&amp;gt;&lt;br /&gt;
* OR   &amp;lt;code&amp;gt;if (a=1)^(b=2) then c=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should work as long as you use parenthesis in all evaluated expressions (Since parenthesis makes bitwise operators behave like logical operators).&lt;br /&gt;
&lt;br /&gt;
===== Using procedures =====&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;proc&amp;lt;/code&amp;gt; keyword is only valid if it appears after an &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt; statement.&lt;br /&gt;
* When calling a procedure use the procedure name followed by parenthesis (), even if the procedure has no parameters.&lt;br /&gt;
* Avoid any space between the procedure name and the parenthesis, else it will produce an error.&lt;br /&gt;
&lt;br /&gt;
===== Keyboard shortcuts =====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Key combination&lt;br /&gt;
!Effect&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-c&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;RUN STOP&amp;lt;/code&amp;gt; on the F256K&lt;br /&gt;
|Stops a listing or a running program&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-l&amp;lt;/code&amp;gt;&lt;br /&gt;
|Clears the screen&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-a&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLR/HOME&amp;lt;/code&amp;gt; on the F256K&lt;br /&gt;
|Move cursor to the first character in the current line&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-e&amp;lt;/code&amp;gt;&lt;br /&gt;
|Move cursor to the last character in the current line&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-i&amp;lt;/code&amp;gt;&lt;br /&gt;
|Move cursor 8 characters to the right &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-k&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes characters from cursor position to line end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Behaviour of load and bload =====&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;bload&amp;lt;/code&amp;gt; statement does not print &amp;lt;code&amp;gt;Completed&amp;lt;/code&amp;gt; when loading is successfull whereas &amp;lt;code&amp;gt;load&amp;lt;/code&amp;gt; does.&lt;br /&gt;
* bload can load anywhere on memory not just under the first 64k&lt;br /&gt;
* An exception is that bload can&#039;t load I/O parameters that reside in $C000 - $DFFF&lt;br /&gt;
&lt;br /&gt;
===== Control characters for cursor and colour control =====&lt;br /&gt;
In BASIC the following character codes can be used with &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt; to control the cursor position and colours on the screen.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Code&lt;br /&gt;
!Effect&lt;br /&gt;
|-&lt;br /&gt;
|chr$(1)&lt;br /&gt;
|Set cursor to leftmost position in current line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(2)&lt;br /&gt;
|Cursor left&lt;br /&gt;
|-&lt;br /&gt;
|chr$(5)&lt;br /&gt;
|Set cursor to righmost position in current line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(6)&lt;br /&gt;
|Cursor right&lt;br /&gt;
|-&lt;br /&gt;
|chr$(11)&lt;br /&gt;
|Deletes characters from cursor position to line end&lt;br /&gt;
|-&lt;br /&gt;
|chr$(12)&lt;br /&gt;
|Clear screen and set cursor to upper left corner&lt;br /&gt;
|-&lt;br /&gt;
|chr$(13)&lt;br /&gt;
|Move cursor to start of next line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(14)&lt;br /&gt;
|Cursor down&lt;br /&gt;
|-&lt;br /&gt;
|chr$(16)&lt;br /&gt;
|Cursor up&lt;br /&gt;
|-&lt;br /&gt;
|chr$(128) - chr$(143)&lt;br /&gt;
|Set foreground color. Code 128 is black 143 is white. The rest follows the sequence given below&lt;br /&gt;
|-&lt;br /&gt;
|chr$(144) - chr$(159)&lt;br /&gt;
|Set background color. Code 144 is black 159 is white. The rest follows the sequence given below&lt;br /&gt;
|}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Colour code&lt;br /&gt;
!Colour&lt;br /&gt;
!Colour code&lt;br /&gt;
!Colour&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Black&lt;br /&gt;
|8&lt;br /&gt;
|Dark grey&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Grey&lt;br /&gt;
|9&lt;br /&gt;
|Light grey (default foreground)&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Dark blue (default background colour)&lt;br /&gt;
|10&lt;br /&gt;
|Blue&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Green&lt;br /&gt;
|11&lt;br /&gt;
|Light green&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Purple&lt;br /&gt;
|12&lt;br /&gt;
|Light purple&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Brown&lt;br /&gt;
|13&lt;br /&gt;
|Red&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Orange&lt;br /&gt;
|14&lt;br /&gt;
|Yellow&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|Light blue&lt;br /&gt;
|15&lt;br /&gt;
|White&lt;br /&gt;
|}The background colors do not work when the bitmap layer has been turned on. They will also not work if you have returned from the bitmap layer with a &amp;lt;code&amp;gt;bitmap off&amp;lt;/code&amp;gt; command. In order to restore the background control character function you will need to make sure the MMU is set to zero by using &amp;lt;code&amp;gt;POKE 1,0&amp;lt;/code&amp;gt; and then setting the text mode again by using &amp;lt;code&amp;gt;POKE $d000,1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Character Set / Text matrix ====&lt;br /&gt;
* Access to the full character set can be obtained by using the &amp;lt;code&amp;gt;CPRINT&amp;lt;/code&amp;gt; command instead of the normal &amp;lt;code&amp;gt;PRINT&amp;lt;/code&amp;gt; command.&lt;br /&gt;
* Characters can also be set on the screen text matrix using the &amp;lt;code&amp;gt;POKE&amp;lt;/code&amp;gt; command starting at &amp;lt;code&amp;gt;$C000&amp;lt;/code&amp;gt; providing the MMU I/O control is set to 2 by executing a &amp;lt;code&amp;gt;POKE 1,2&amp;lt;/code&amp;gt; command first (remember to restore the MMU I/O once you&#039;re done).&lt;br /&gt;
[[File:Full char set.png|thumb|104x104px|F256 Character Set|none]]&lt;br /&gt;
* Color can also be set on the screen color matrix using the &amp;lt;code&amp;gt;POKE&amp;lt;/code&amp;gt; command starting at &amp;lt;code&amp;gt;$C000&amp;lt;/code&amp;gt; providing the MMU I/O control is set to 3 by executing a &amp;lt;code&amp;gt;POKE 1,3&amp;lt;/code&amp;gt; command first (remember to restore the MMU I/O once you&#039;re done).&lt;br /&gt;
* When poking colors on the screen, the high nibble is the character color and  the low nibble is the background color.&lt;br /&gt;
&lt;br /&gt;
[[File:Colormatrix.png|alt=Default Colors|thumb|100x100px|Default Colors|none]]&lt;br /&gt;
&lt;br /&gt;
===== Memcopy lockup =====&lt;br /&gt;
&lt;br /&gt;
* In certain situations the &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;memcopy&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; command can lockup.&lt;br /&gt;
* A machine language utility that performs the same function as &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; is available if &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; fails.&lt;br /&gt;
* &amp;lt;u&amp;gt;mlcopy&amp;lt;/u&amp;gt; is a short routine that replaces &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; and is more reliable. It can be loaded into memory with a BLOAD command in your program, or with a basic loader that can be added to your program.&lt;br /&gt;
* In place of the &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; command you would use 3 &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;POKEL&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; commands and a &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CALL&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; command to engage the DMA engine.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0903,data source&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0906,destination&amp;lt;/code&amp;gt; &lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0909,number of bytes to copy&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;CALL $0900&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/mcassera/F256-mlcopy mlcopy github page]&lt;br /&gt;
&lt;br /&gt;
===== Sprite Images =====&lt;br /&gt;
&lt;br /&gt;
In BASIC you can access different SPRITE shapes through the IMAGE command as part of the sprite command: &amp;lt;code&amp;gt;SPRITE 0 IMAGE 1 TO 100,100&amp;lt;/code&amp;gt;. Be aware that BASIC can only keep track of 64 Images, if you want to access and show more than 64 different shapes you need to poke the 3 bytes of the address where the image data resides into the correct sprite registers yourself.&lt;br /&gt;
&lt;br /&gt;
===== Sprite Coordinates =====&lt;br /&gt;
In BASIC all sprites are centered on the coordinate specified, this might produce some counterintuitive effects when using different size sprites, for example if you want to align the sprite edge with the top left side of the screen you would need different values depending on the sprite size&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SPRITE 0 IMAGE 1 TO 4,4: REM &amp;quot;8x8 Sprite&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;/BR&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;SPRITE 1 IMAGE 1 TO 8,8: REM &amp;quot;16x16 Sprite&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;/BR&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;SPRITE 2 IMAGE 2 TO 12,12: REM &amp;quot;24x24 Sprite&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;/BR&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;SPRITE 3 IMAGE 3 TO 16,16: REM &amp;quot;32x32 Sprite&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;/BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also, please note that you need to use the command &amp;lt;code&amp;gt;SPRITE X IMAGE Y&amp;lt;/code&amp;gt; before setting the sprite coordinates or else BASIC will not know what size is the sprite, and will misalign it, for example the following code although it seems correct will misalign the sprite:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SPRITE 1 TO 8,8&amp;lt;/code&amp;gt;&amp;lt;/BR&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;SPRITE 1 IMAGE 1: REM &amp;quot;USe a 16x16 Sprite&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;/BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=553</id>
		<title>SuperBASIC</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=553"/>
		<updated>2024-11-27T02:27:36Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: /* Note */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SuperBASIC is inspired by BBC BASIC but offers quite a bit more.&lt;br /&gt;
* [https://github.com/FoenixRetro/f256-superbasic/blob/main/reference/source/f256jr_basic_ref.pdf SuperBASIC Reference Manual].&lt;br /&gt;
* [[SuperBASIC Memory Map]]&lt;br /&gt;
* Watch EMWhite&#039;s excellent intro series on YouTube: [https://www.youtube.com/playlist?list=PLeHjTvk7NPiSqGz4REMH-S4hjYpLS2YNR Full Playlist].&lt;br /&gt;
* Read EMWhite&#039;s [https://apps.emwhite.org/shared-files/885/?Foenix-Rising-Issue-18-November-2024.pdf&amp;amp;download=1 Foenix Rising Issue 18] (November 2024) which goes into detail about a few of the gotchas of superbasic.&lt;br /&gt;
&lt;br /&gt;
=== An informal list of tips, &amp;quot;gotchas&amp;quot;: ===&lt;br /&gt;
&lt;br /&gt;
===== IF, THEN, ELSE =====&lt;br /&gt;
&lt;br /&gt;
====== Source of this tip: Ernesto ======&lt;br /&gt;
* A regular &amp;lt;code&amp;gt;if then&amp;lt;/code&amp;gt; condition can&#039;t contain an &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt; statement, as in this example: &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0 then x=10&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you need to do an  &amp;lt;code&amp;gt;if then else&amp;lt;/code&amp;gt; structure,  you actually have to do an &amp;lt;code&amp;gt;if else endif&amp;lt;/code&amp;gt; structure like in the following example,  skipping the &amp;lt;code&amp;gt;then&amp;lt;/code&amp;gt; statement. &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0&amp;lt;br /&amp;gt;&lt;br /&gt;
20     x=1&amp;lt;br /&amp;gt;&lt;br /&gt;
30     else&amp;lt;br /&amp;gt;&lt;br /&gt;
40     x=2&amp;lt;br /&amp;gt;&lt;br /&gt;
50 endif&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you do it in one line it needs to have some colons added, making it look weird like this: &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0:x=1:else:x=2:endif&amp;lt;/code&amp;gt;&lt;br /&gt;
* if you dare to omit the &amp;lt;code&amp;gt;endif&amp;lt;/code&amp;gt;  thinking that the &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement won&#039;t need it, (mmm.., everything is in one line, so no need, right?) -Nope...all hell breaks loose!- &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0:x=1:else:x=2: REM &amp;quot;&amp;lt;-- Error, omited the endif&amp;quot;&amp;lt;/code&amp;gt; &lt;br /&gt;
* be careful not to add an extra  &amp;lt;code&amp;gt;then&amp;lt;/code&amp;gt; statement by mistake to an &amp;lt;code&amp;gt;if else endif&amp;lt;/code&amp;gt; structure, if you do -All hell breaks loose again!!- &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0 then  : rem &amp;quot;&amp;lt;-- Error, THEN is not needed!!!&amp;quot; &amp;lt;br /&amp;gt;&lt;br /&gt;
20     x=1 &amp;lt;br /&amp;gt;&lt;br /&gt;
30     else &amp;lt;br /&amp;gt;&lt;br /&gt;
40     x=2 &amp;lt;br /&amp;gt;&lt;br /&gt;
50 endif&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Debugging hint: If you encounter an error like &amp;quot;open structure&amp;quot; or &amp;quot;endproc without a proc&amp;quot;: do not trust the line number that you are given. The root of the problem is probably in a structure earlier on in the code.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===== Evaluating multiple conditions in IF statements =====&lt;br /&gt;
SUPERBASIC doesn&#039;t have the dedicated keywords AND , OR so you have to use the bitwise operators to evaluate multiple conditions, please consider the following examples:&lt;br /&gt;
&lt;br /&gt;
* AND  &amp;lt;code&amp;gt;if (a=1)&amp;amp;(b=2) then c=1&amp;lt;/code&amp;gt;&lt;br /&gt;
* OR   &amp;lt;code&amp;gt;if (a=1)^(b=2) then c=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should work as long as you use parenthesis in all evaluated expressions (Since parenthesis makes bitwise operators behave like logical operators).&lt;br /&gt;
&lt;br /&gt;
===== Using procedures =====&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;proc&amp;lt;/code&amp;gt; keyword is only valid if it appears after an &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt; statement.&lt;br /&gt;
* When calling a procedure use the procedure name followed by parenthesis (), even if the procedure has no parameters.&lt;br /&gt;
* Avoid any space between the procedure name and the parenthesis, else it will produce an error.&lt;br /&gt;
&lt;br /&gt;
===== Keyboard shortcuts =====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Key combination&lt;br /&gt;
!Effect&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-c&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;RUN STOP&amp;lt;/code&amp;gt; on the F256K&lt;br /&gt;
|Stops a listing or a running program&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-l&amp;lt;/code&amp;gt;&lt;br /&gt;
|Clears the screen&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-a&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLR/HOME&amp;lt;/code&amp;gt; on the F256K&lt;br /&gt;
|Move cursor to the first character in the current line&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-e&amp;lt;/code&amp;gt;&lt;br /&gt;
|Move cursor to the last character in the current line&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-i&amp;lt;/code&amp;gt;&lt;br /&gt;
|Move cursor 8 characters to the right &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-k&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes characters from cursor position to line end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Behaviour of load and bload =====&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;bload&amp;lt;/code&amp;gt; statement does not print &amp;lt;code&amp;gt;Completed&amp;lt;/code&amp;gt; when loading is successfull whereas &amp;lt;code&amp;gt;load&amp;lt;/code&amp;gt; does.&lt;br /&gt;
* bload can load anywhere on memory not just under the first 64k&lt;br /&gt;
* An exception is that bload can&#039;t load I/O parameters that reside in $C000 - $DFFF&lt;br /&gt;
&lt;br /&gt;
===== Control characters for cursor and colour control =====&lt;br /&gt;
In BASIC the following character codes can be used with &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt; to control the cursor position and colours on the screen.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Code&lt;br /&gt;
!Effect&lt;br /&gt;
|-&lt;br /&gt;
|chr$(1)&lt;br /&gt;
|Set cursor to leftmost position in current line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(2)&lt;br /&gt;
|Cursor left&lt;br /&gt;
|-&lt;br /&gt;
|chr$(5)&lt;br /&gt;
|Set cursor to righmost position in current line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(6)&lt;br /&gt;
|Cursor right&lt;br /&gt;
|-&lt;br /&gt;
|chr$(11)&lt;br /&gt;
|Deletes characters from cursor position to line end&lt;br /&gt;
|-&lt;br /&gt;
|chr$(12)&lt;br /&gt;
|Clear screen and set cursor to upper left corner&lt;br /&gt;
|-&lt;br /&gt;
|chr$(13)&lt;br /&gt;
|Move cursor to start of next line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(14)&lt;br /&gt;
|Cursor down&lt;br /&gt;
|-&lt;br /&gt;
|chr$(16)&lt;br /&gt;
|Cursor up&lt;br /&gt;
|-&lt;br /&gt;
|chr$(128) - chr$(143)&lt;br /&gt;
|Set foreground color. Code 128 is black 143 is white. The rest follows the sequence given below&lt;br /&gt;
|-&lt;br /&gt;
|chr$(144) - chr$(159)&lt;br /&gt;
|Set background color. Code 144 is black 159 is white. The rest follows the sequence given below&lt;br /&gt;
|}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Colour code&lt;br /&gt;
!Colour&lt;br /&gt;
!Colour code&lt;br /&gt;
!Colour&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Black&lt;br /&gt;
|8&lt;br /&gt;
|Dark grey&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Grey&lt;br /&gt;
|9&lt;br /&gt;
|Light grey (default foreground)&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Dark blue (default background colour)&lt;br /&gt;
|10&lt;br /&gt;
|Blue&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Green&lt;br /&gt;
|11&lt;br /&gt;
|Light green&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Purple&lt;br /&gt;
|12&lt;br /&gt;
|Light purple&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Brown&lt;br /&gt;
|13&lt;br /&gt;
|Red&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Orange&lt;br /&gt;
|14&lt;br /&gt;
|Yellow&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|Light blue&lt;br /&gt;
|15&lt;br /&gt;
|White&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== &#039;&#039;&#039;&amp;lt;u&amp;gt;Note&amp;lt;/u&amp;gt;&#039;&#039;&#039; ====&lt;br /&gt;
The background colors do not work when the bitmap layer has been turned on. They will also not work if you have returned from the bitmap layer with a &amp;lt;code&amp;gt;bitmap off&amp;lt;/code&amp;gt; command. In order to restore the background control character function you will need to make sure the MMU is set to zero by using &amp;lt;code&amp;gt;POKE 1,0&amp;lt;/code&amp;gt; and then setting the text mode again by using &amp;lt;code&amp;gt;POKE $d000,1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Character Set / Text matrix ====&lt;br /&gt;
* Access to the full character set can be obtained by using the &amp;lt;code&amp;gt;CPRINT&amp;lt;/code&amp;gt; command instead of the normal &amp;lt;code&amp;gt;PRINT&amp;lt;/code&amp;gt; command.&lt;br /&gt;
* Characters can also be set on the screen text matrix using the &amp;lt;code&amp;gt;POKE&amp;lt;/code&amp;gt; command starting at &amp;lt;code&amp;gt;$C000&amp;lt;/code&amp;gt; providing the MMU I/O control is set to 2 by executing a &amp;lt;code&amp;gt;POKE 1,2&amp;lt;/code&amp;gt; command first (remember to restore the MMU I/O once you&#039;re done).&lt;br /&gt;
[[File:Full char set.png|thumb|104x104px|F256 Character Set|none]]&lt;br /&gt;
* Color can also be set on the screen color matrix using the &amp;lt;code&amp;gt;POKE&amp;lt;/code&amp;gt; command starting at &amp;lt;code&amp;gt;$C000&amp;lt;/code&amp;gt; providing the MMU I/O control is set to 3 by executing a &amp;lt;code&amp;gt;POKE 1,3&amp;lt;/code&amp;gt; command first (remember to restore the MMU I/O once you&#039;re done).&lt;br /&gt;
* When poking colors on the screen, the high nibble is the character color and  the low nibble is the background color.&lt;br /&gt;
&lt;br /&gt;
[[File:Colormatrix.png|alt=Default Colors|thumb|100x100px|Default Colors|none]]&lt;br /&gt;
&lt;br /&gt;
===== Memcopy lockup =====&lt;br /&gt;
&lt;br /&gt;
* In certain situations the &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;memcopy&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; command can lockup.&lt;br /&gt;
* A machine language utility that performs the same function as &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; is available if &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; fails.&lt;br /&gt;
* &amp;lt;u&amp;gt;mlcopy&amp;lt;/u&amp;gt; is a short routine that replaces &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; and is more reliable. It can be loaded into memory with a BLOAD command in your program, or with a basic loader that can be added to your program.&lt;br /&gt;
* In place of the &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; command you would use 3 &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;POKEL&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; commands and a &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CALL&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; command to engage the DMA engine.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0903,data source&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0906,destination&amp;lt;/code&amp;gt; &lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0909,number of bytes to copy&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;CALL $0900&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/mcassera/F256-mlcopy mlcopy github page]&lt;br /&gt;
&lt;br /&gt;
===== Sprite Images =====&lt;br /&gt;
&lt;br /&gt;
In BASIC you can access different SPRITE shapes through the IMAGE command as part of the sprite command: &amp;lt;code&amp;gt;SPRITE 0 IMAGE 1 TO 100,100&amp;lt;/code&amp;gt;. Be aware that BASIC can only keep track of 64 Images, if you want to access and show more than 64 different shapes you need to poke the 3 bytes of the address where the image data resides into the correct sprite registers yourself.&lt;br /&gt;
&lt;br /&gt;
===== Sprite Coordinates =====&lt;br /&gt;
In BASIC all sprites are centered on the coordinate specified, this might produce some counterintuitive effects when using different size sprites, for example if you want to align the sprite edge with the top left side of the screen you would need different values depending on the sprite size&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SPRITE 0 IMAGE 1 TO 4,4: REM &amp;quot;8x8 Sprite&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;/BR&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;SPRITE 1 IMAGE 1 TO 8,8: REM &amp;quot;16x16 Sprite&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;/BR&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;SPRITE 2 IMAGE 2 TO 12,12: REM &amp;quot;24x24 Sprite&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;/BR&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;SPRITE 3 IMAGE 3 TO 16,16: REM &amp;quot;32x32 Sprite&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;/BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also, please note that you need to use the command &amp;lt;code&amp;gt;SPRITE X IMAGE Y&amp;lt;/code&amp;gt; before setting the sprite coordinates or else BASIC will not know what size is the sprite, and will misalign it, for example the following code although it seems correct will misalign the sprite:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SPRITE 1 TO 8,8&amp;lt;/code&amp;gt;&amp;lt;/BR&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;SPRITE 1 IMAGE 1: REM &amp;quot;USe a 16x16 Sprite&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;/BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=552</id>
		<title>SuperBASIC</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=552"/>
		<updated>2024-11-27T02:24:37Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: /* Note */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SuperBASIC is inspired by BBC BASIC but offers quite a bit more.&lt;br /&gt;
* [https://github.com/FoenixRetro/f256-superbasic/blob/main/reference/source/f256jr_basic_ref.pdf SuperBASIC Reference Manual].&lt;br /&gt;
* [[SuperBASIC Memory Map]]&lt;br /&gt;
* Watch EMWhite&#039;s excellent intro series on YouTube: [https://www.youtube.com/playlist?list=PLeHjTvk7NPiSqGz4REMH-S4hjYpLS2YNR Full Playlist].&lt;br /&gt;
* Read EMWhite&#039;s [https://apps.emwhite.org/shared-files/885/?Foenix-Rising-Issue-18-November-2024.pdf&amp;amp;download=1 Foenix Rising Issue 18] (November 2024) which goes into detail about a few of the gotchas of superbasic.&lt;br /&gt;
&lt;br /&gt;
=== An informal list of tips, &amp;quot;gotchas&amp;quot;: ===&lt;br /&gt;
&lt;br /&gt;
===== IF, THEN, ELSE =====&lt;br /&gt;
&lt;br /&gt;
====== Source of this tip: Ernesto ======&lt;br /&gt;
* A regular &amp;lt;code&amp;gt;if then&amp;lt;/code&amp;gt; condition can&#039;t contain an &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt; statement, as in this example: &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0 then x=10&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you need to do an  &amp;lt;code&amp;gt;if then else&amp;lt;/code&amp;gt; structure,  you actually have to do an &amp;lt;code&amp;gt;if else endif&amp;lt;/code&amp;gt; structure like in the following example,  skipping the &amp;lt;code&amp;gt;then&amp;lt;/code&amp;gt; statement. &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0&amp;lt;br /&amp;gt;&lt;br /&gt;
20     x=1&amp;lt;br /&amp;gt;&lt;br /&gt;
30     else&amp;lt;br /&amp;gt;&lt;br /&gt;
40     x=2&amp;lt;br /&amp;gt;&lt;br /&gt;
50 endif&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you do it in one line it needs to have some colons added, making it look weird like this: &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0:x=1:else:x=2:endif&amp;lt;/code&amp;gt;&lt;br /&gt;
* if you dare to omit the &amp;lt;code&amp;gt;endif&amp;lt;/code&amp;gt;  thinking that the &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement won&#039;t need it, (mmm.., everything is in one line, so no need, right?) -Nope...all hell breaks loose!- &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0:x=1:else:x=2: REM &amp;quot;&amp;lt;-- Error, omited the endif&amp;quot;&amp;lt;/code&amp;gt; &lt;br /&gt;
* be careful not to add an extra  &amp;lt;code&amp;gt;then&amp;lt;/code&amp;gt; statement by mistake to an &amp;lt;code&amp;gt;if else endif&amp;lt;/code&amp;gt; structure, if you do -All hell breaks loose again!!- &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0 then  : rem &amp;quot;&amp;lt;-- Error, THEN is not needed!!!&amp;quot; &amp;lt;br /&amp;gt;&lt;br /&gt;
20     x=1 &amp;lt;br /&amp;gt;&lt;br /&gt;
30     else &amp;lt;br /&amp;gt;&lt;br /&gt;
40     x=2 &amp;lt;br /&amp;gt;&lt;br /&gt;
50 endif&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Debugging hint: If you encounter an error like &amp;quot;open structure&amp;quot; or &amp;quot;endproc without a proc&amp;quot;: do not trust the line number that you are given. The root of the problem is probably in a structure earlier on in the code.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===== Evaluating multiple conditions in IF statements =====&lt;br /&gt;
SUPERBASIC doesn&#039;t have the dedicated keywords AND , OR so you have to use the bitwise operators to evaluate multiple conditions, please consider the following examples:&lt;br /&gt;
&lt;br /&gt;
* AND  &amp;lt;code&amp;gt;if (a=1)&amp;amp;(b=2) then c=1&amp;lt;/code&amp;gt;&lt;br /&gt;
* OR   &amp;lt;code&amp;gt;if (a=1)^(b=2) then c=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should work as long as you use parenthesis in all evaluated expressions (Since parenthesis makes bitwise operators behave like logical operators).&lt;br /&gt;
&lt;br /&gt;
===== Using procedures =====&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;proc&amp;lt;/code&amp;gt; keyword is only valid if it appears after an &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt; statement.&lt;br /&gt;
* When calling a procedure use the procedure name followed by parenthesis (), even if the procedure has no parameters.&lt;br /&gt;
* Avoid any space between the procedure name and the parenthesis, else it will produce an error.&lt;br /&gt;
&lt;br /&gt;
===== Keyboard shortcuts =====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Key combination&lt;br /&gt;
!Effect&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-c&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;RUN STOP&amp;lt;/code&amp;gt; on the F256K&lt;br /&gt;
|Stops a listing or a running program&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-l&amp;lt;/code&amp;gt;&lt;br /&gt;
|Clears the screen&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-a&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLR/HOME&amp;lt;/code&amp;gt; on the F256K&lt;br /&gt;
|Move cursor to the first character in the current line&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-e&amp;lt;/code&amp;gt;&lt;br /&gt;
|Move cursor to the last character in the current line&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-i&amp;lt;/code&amp;gt;&lt;br /&gt;
|Move cursor 8 characters to the right &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-k&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes characters from cursor position to line end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Behaviour of load and bload =====&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;bload&amp;lt;/code&amp;gt; statement does not print &amp;lt;code&amp;gt;Completed&amp;lt;/code&amp;gt; when loading is successfull whereas &amp;lt;code&amp;gt;load&amp;lt;/code&amp;gt; does.&lt;br /&gt;
* bload can load anywhere on memory not just under the first 64k&lt;br /&gt;
* An exception is that bload can&#039;t load I/O parameters that reside in $C000 - $DFFF&lt;br /&gt;
&lt;br /&gt;
===== Control characters for cursor and colour control =====&lt;br /&gt;
In BASIC the following character codes can be used with &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt; to control the cursor position and colours on the screen.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Code&lt;br /&gt;
!Effect&lt;br /&gt;
|-&lt;br /&gt;
|chr$(1)&lt;br /&gt;
|Set cursor to leftmost position in current line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(2)&lt;br /&gt;
|Cursor left&lt;br /&gt;
|-&lt;br /&gt;
|chr$(5)&lt;br /&gt;
|Set cursor to righmost position in current line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(6)&lt;br /&gt;
|Cursor right&lt;br /&gt;
|-&lt;br /&gt;
|chr$(11)&lt;br /&gt;
|Deletes characters from cursor position to line end&lt;br /&gt;
|-&lt;br /&gt;
|chr$(12)&lt;br /&gt;
|Clear screen and set cursor to upper left corner&lt;br /&gt;
|-&lt;br /&gt;
|chr$(13)&lt;br /&gt;
|Move cursor to start of next line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(14)&lt;br /&gt;
|Cursor down&lt;br /&gt;
|-&lt;br /&gt;
|chr$(16)&lt;br /&gt;
|Cursor up&lt;br /&gt;
|-&lt;br /&gt;
|chr$(128) - chr$(143)&lt;br /&gt;
|Set foreground color. Code 128 is black 143 is white. The rest follows the sequence given below&lt;br /&gt;
|-&lt;br /&gt;
|chr$(144) - chr$(159)&lt;br /&gt;
|Set background color. Code 144 is black 159 is white. The rest follows the sequence given below&lt;br /&gt;
|}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Colour code&lt;br /&gt;
!Colour&lt;br /&gt;
!Colour code&lt;br /&gt;
!Colour&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Black&lt;br /&gt;
|8&lt;br /&gt;
|Dark grey&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Grey&lt;br /&gt;
|9&lt;br /&gt;
|Light grey (default foreground)&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Dark blue (default background colour)&lt;br /&gt;
|10&lt;br /&gt;
|Blue&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Green&lt;br /&gt;
|11&lt;br /&gt;
|Light green&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Purple&lt;br /&gt;
|12&lt;br /&gt;
|Light purple&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Brown&lt;br /&gt;
|13&lt;br /&gt;
|Red&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Orange&lt;br /&gt;
|14&lt;br /&gt;
|Yellow&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|Light blue&lt;br /&gt;
|15&lt;br /&gt;
|White&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== &#039;&#039;&#039;&amp;lt;u&amp;gt;Note&amp;lt;/u&amp;gt;&#039;&#039;&#039; ====&lt;br /&gt;
The background colors do not work when the bitmap layer has been turned on. They will also not work if you have returned from the bitmap layer with a bitmap off command. In order to restore the background control character function you will need to make sure the MMU is set to zero by using POKE 1,0 and then setting the text mode again by using POKE $d000,1.&lt;br /&gt;
&lt;br /&gt;
==== Character Set / Text matrix ====&lt;br /&gt;
* Access to the full character set can be obtained by using the &amp;lt;code&amp;gt;CPRINT&amp;lt;/code&amp;gt; command instead of the normal &amp;lt;code&amp;gt;PRINT&amp;lt;/code&amp;gt; command.&lt;br /&gt;
* Characters can also be set on the screen text matrix using the &amp;lt;code&amp;gt;POKE&amp;lt;/code&amp;gt; command starting at &amp;lt;code&amp;gt;$C000&amp;lt;/code&amp;gt; providing the MMU I/O control is set to 2 by executing a &amp;lt;code&amp;gt;POKE 1,2&amp;lt;/code&amp;gt; command first (remember to restore the MMU I/O once you&#039;re done).&lt;br /&gt;
[[File:Full char set.png|thumb|104x104px|F256 Character Set|none]]&lt;br /&gt;
* Color can also be set on the screen color matrix using the &amp;lt;code&amp;gt;POKE&amp;lt;/code&amp;gt; command starting at &amp;lt;code&amp;gt;$C000&amp;lt;/code&amp;gt; providing the MMU I/O control is set to 3 by executing a &amp;lt;code&amp;gt;POKE 1,3&amp;lt;/code&amp;gt; command first (remember to restore the MMU I/O once you&#039;re done).&lt;br /&gt;
* When poking colors on the screen, the high nibble is the character color and  the low nibble is the background color.&lt;br /&gt;
&lt;br /&gt;
[[File:Colormatrix.png|alt=Default Colors|thumb|100x100px|Default Colors|none]]&lt;br /&gt;
&lt;br /&gt;
===== Memcopy lockup =====&lt;br /&gt;
&lt;br /&gt;
* In certain situations the &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;memcopy&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; command can lockup.&lt;br /&gt;
* A machine language utility that performs the same function as &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; is available if &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; fails.&lt;br /&gt;
* &amp;lt;u&amp;gt;mlcopy&amp;lt;/u&amp;gt; is a short routine that replaces &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; and is more reliable. It can be loaded into memory with a BLOAD command in your program, or with a basic loader that can be added to your program.&lt;br /&gt;
* In place of the &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; command you would use 3 &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;POKEL&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; commands and a &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CALL&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; command to engage the DMA engine.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0903,data source&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0906,destination&amp;lt;/code&amp;gt; &lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0909,number of bytes to copy&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;CALL $0900&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/mcassera/F256-mlcopy mlcopy github page]&lt;br /&gt;
&lt;br /&gt;
===== Sprite Images =====&lt;br /&gt;
&lt;br /&gt;
In BASIC you can access different SPRITE shapes through the IMAGE command as part of the sprite command: &amp;lt;code&amp;gt;SPRITE 0 IMAGE 1 TO 100,100&amp;lt;/code&amp;gt;. Be aware that BASIC can only keep track of 64 Images, if you want to access and show more than 64 different shapes you need to poke the 3 bytes of the address where the image data resides into the correct sprite registers yourself.&lt;br /&gt;
&lt;br /&gt;
===== Sprite Coordinates =====&lt;br /&gt;
In BASIC all sprites are centered on the coordinate specified, this might produce some counterintuitive effects when using different size sprites, for example if you want to align the sprite edge with the top left side of the screen you would need different values depending on the sprite size&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SPRITE 0 IMAGE 1 TO 4,4: REM &amp;quot;8x8 Sprite&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;/BR&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;SPRITE 1 IMAGE 1 TO 8,8: REM &amp;quot;16x16 Sprite&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;/BR&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;SPRITE 2 IMAGE 2 TO 12,12: REM &amp;quot;24x24 Sprite&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;/BR&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;SPRITE 3 IMAGE 3 TO 16,16: REM &amp;quot;32x32 Sprite&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;/BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also, please note that you need to use the command &amp;lt;code&amp;gt;SPRITE X IMAGE Y&amp;lt;/code&amp;gt; before setting the sprite coordinates or else BASIC will not know what size is the sprite, and will misalign it, for example the following code although it seems correct will misalign the sprite:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SPRITE 1 TO 8,8&amp;lt;/code&amp;gt;&amp;lt;/BR&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;SPRITE 1 IMAGE 1: REM &amp;quot;USe a 16x16 Sprite&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;/BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=551</id>
		<title>SuperBASIC</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=551"/>
		<updated>2024-11-27T02:24:08Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: /* Control characters for cursor and colour control */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SuperBASIC is inspired by BBC BASIC but offers quite a bit more.&lt;br /&gt;
* [https://github.com/FoenixRetro/f256-superbasic/blob/main/reference/source/f256jr_basic_ref.pdf SuperBASIC Reference Manual].&lt;br /&gt;
* [[SuperBASIC Memory Map]]&lt;br /&gt;
* Watch EMWhite&#039;s excellent intro series on YouTube: [https://www.youtube.com/playlist?list=PLeHjTvk7NPiSqGz4REMH-S4hjYpLS2YNR Full Playlist].&lt;br /&gt;
* Read EMWhite&#039;s [https://apps.emwhite.org/shared-files/885/?Foenix-Rising-Issue-18-November-2024.pdf&amp;amp;download=1 Foenix Rising Issue 18] (November 2024) which goes into detail about a few of the gotchas of superbasic.&lt;br /&gt;
&lt;br /&gt;
=== An informal list of tips, &amp;quot;gotchas&amp;quot;: ===&lt;br /&gt;
&lt;br /&gt;
===== IF, THEN, ELSE =====&lt;br /&gt;
&lt;br /&gt;
====== Source of this tip: Ernesto ======&lt;br /&gt;
* A regular &amp;lt;code&amp;gt;if then&amp;lt;/code&amp;gt; condition can&#039;t contain an &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt; statement, as in this example: &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0 then x=10&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you need to do an  &amp;lt;code&amp;gt;if then else&amp;lt;/code&amp;gt; structure,  you actually have to do an &amp;lt;code&amp;gt;if else endif&amp;lt;/code&amp;gt; structure like in the following example,  skipping the &amp;lt;code&amp;gt;then&amp;lt;/code&amp;gt; statement. &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0&amp;lt;br /&amp;gt;&lt;br /&gt;
20     x=1&amp;lt;br /&amp;gt;&lt;br /&gt;
30     else&amp;lt;br /&amp;gt;&lt;br /&gt;
40     x=2&amp;lt;br /&amp;gt;&lt;br /&gt;
50 endif&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you do it in one line it needs to have some colons added, making it look weird like this: &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0:x=1:else:x=2:endif&amp;lt;/code&amp;gt;&lt;br /&gt;
* if you dare to omit the &amp;lt;code&amp;gt;endif&amp;lt;/code&amp;gt;  thinking that the &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement won&#039;t need it, (mmm.., everything is in one line, so no need, right?) -Nope...all hell breaks loose!- &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0:x=1:else:x=2: REM &amp;quot;&amp;lt;-- Error, omited the endif&amp;quot;&amp;lt;/code&amp;gt; &lt;br /&gt;
* be careful not to add an extra  &amp;lt;code&amp;gt;then&amp;lt;/code&amp;gt; statement by mistake to an &amp;lt;code&amp;gt;if else endif&amp;lt;/code&amp;gt; structure, if you do -All hell breaks loose again!!- &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0 then  : rem &amp;quot;&amp;lt;-- Error, THEN is not needed!!!&amp;quot; &amp;lt;br /&amp;gt;&lt;br /&gt;
20     x=1 &amp;lt;br /&amp;gt;&lt;br /&gt;
30     else &amp;lt;br /&amp;gt;&lt;br /&gt;
40     x=2 &amp;lt;br /&amp;gt;&lt;br /&gt;
50 endif&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Debugging hint: If you encounter an error like &amp;quot;open structure&amp;quot; or &amp;quot;endproc without a proc&amp;quot;: do not trust the line number that you are given. The root of the problem is probably in a structure earlier on in the code.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===== Evaluating multiple conditions in IF statements =====&lt;br /&gt;
SUPERBASIC doesn&#039;t have the dedicated keywords AND , OR so you have to use the bitwise operators to evaluate multiple conditions, please consider the following examples:&lt;br /&gt;
&lt;br /&gt;
* AND  &amp;lt;code&amp;gt;if (a=1)&amp;amp;(b=2) then c=1&amp;lt;/code&amp;gt;&lt;br /&gt;
* OR   &amp;lt;code&amp;gt;if (a=1)^(b=2) then c=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should work as long as you use parenthesis in all evaluated expressions (Since parenthesis makes bitwise operators behave like logical operators).&lt;br /&gt;
&lt;br /&gt;
===== Using procedures =====&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;proc&amp;lt;/code&amp;gt; keyword is only valid if it appears after an &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt; statement.&lt;br /&gt;
* When calling a procedure use the procedure name followed by parenthesis (), even if the procedure has no parameters.&lt;br /&gt;
* Avoid any space between the procedure name and the parenthesis, else it will produce an error.&lt;br /&gt;
&lt;br /&gt;
===== Keyboard shortcuts =====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Key combination&lt;br /&gt;
!Effect&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-c&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;RUN STOP&amp;lt;/code&amp;gt; on the F256K&lt;br /&gt;
|Stops a listing or a running program&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-l&amp;lt;/code&amp;gt;&lt;br /&gt;
|Clears the screen&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-a&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLR/HOME&amp;lt;/code&amp;gt; on the F256K&lt;br /&gt;
|Move cursor to the first character in the current line&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-e&amp;lt;/code&amp;gt;&lt;br /&gt;
|Move cursor to the last character in the current line&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-i&amp;lt;/code&amp;gt;&lt;br /&gt;
|Move cursor 8 characters to the right &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-k&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes characters from cursor position to line end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Behaviour of load and bload =====&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;bload&amp;lt;/code&amp;gt; statement does not print &amp;lt;code&amp;gt;Completed&amp;lt;/code&amp;gt; when loading is successfull whereas &amp;lt;code&amp;gt;load&amp;lt;/code&amp;gt; does.&lt;br /&gt;
* bload can load anywhere on memory not just under the first 64k&lt;br /&gt;
* An exception is that bload can&#039;t load I/O parameters that reside in $C000 - $DFFF&lt;br /&gt;
&lt;br /&gt;
===== Control characters for cursor and colour control =====&lt;br /&gt;
In BASIC the following character codes can be used with &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt; to control the cursor position and colours on the screen.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Code&lt;br /&gt;
!Effect&lt;br /&gt;
|-&lt;br /&gt;
|chr$(1)&lt;br /&gt;
|Set cursor to leftmost position in current line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(2)&lt;br /&gt;
|Cursor left&lt;br /&gt;
|-&lt;br /&gt;
|chr$(5)&lt;br /&gt;
|Set cursor to righmost position in current line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(6)&lt;br /&gt;
|Cursor right&lt;br /&gt;
|-&lt;br /&gt;
|chr$(11)&lt;br /&gt;
|Deletes characters from cursor position to line end&lt;br /&gt;
|-&lt;br /&gt;
|chr$(12)&lt;br /&gt;
|Clear screen and set cursor to upper left corner&lt;br /&gt;
|-&lt;br /&gt;
|chr$(13)&lt;br /&gt;
|Move cursor to start of next line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(14)&lt;br /&gt;
|Cursor down&lt;br /&gt;
|-&lt;br /&gt;
|chr$(16)&lt;br /&gt;
|Cursor up&lt;br /&gt;
|-&lt;br /&gt;
|chr$(128) - chr$(143)&lt;br /&gt;
|Set foreground color. Code 128 is black 143 is white. The rest follows the sequence given below&lt;br /&gt;
|-&lt;br /&gt;
|chr$(144) - chr$(159)&lt;br /&gt;
|Set background color. Code 144 is black 159 is white. The rest follows the sequence given below&lt;br /&gt;
|}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Colour code&lt;br /&gt;
!Colour&lt;br /&gt;
!Colour code&lt;br /&gt;
!Colour&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Black&lt;br /&gt;
|8&lt;br /&gt;
|Dark grey&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Grey&lt;br /&gt;
|9&lt;br /&gt;
|Light grey (default foreground)&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Dark blue (default background colour)&lt;br /&gt;
|10&lt;br /&gt;
|Blue&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Green&lt;br /&gt;
|11&lt;br /&gt;
|Light green&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Purple&lt;br /&gt;
|12&lt;br /&gt;
|Light purple&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Brown&lt;br /&gt;
|13&lt;br /&gt;
|Red&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Orange&lt;br /&gt;
|14&lt;br /&gt;
|Yellow&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|Light blue&lt;br /&gt;
|15&lt;br /&gt;
|White&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;&#039;&amp;lt;u&amp;gt;Note&amp;lt;/u&amp;gt;&#039;&#039;&#039; ===&lt;br /&gt;
The background colors do not work when the bitmap layer has been turned on. They will also not work if you have returned from the bitmap layer with a bitmap off command. In order to restore the background control character function you will need to make sure the MMU is set to zero by using POKE 1,0 and then setting the text mode again by using POKE $d000,1.&lt;br /&gt;
&lt;br /&gt;
===== Character Set / Text matrix =====&lt;br /&gt;
&lt;br /&gt;
* Access to the full character set can be obtained by using the &amp;lt;code&amp;gt;CPRINT&amp;lt;/code&amp;gt; command instead of the normal &amp;lt;code&amp;gt;PRINT&amp;lt;/code&amp;gt; command.&lt;br /&gt;
* Characters can also be set on the screen text matrix using the &amp;lt;code&amp;gt;POKE&amp;lt;/code&amp;gt; command starting at &amp;lt;code&amp;gt;$C000&amp;lt;/code&amp;gt; providing the MMU I/O control is set to 2 by executing a &amp;lt;code&amp;gt;POKE 1,2&amp;lt;/code&amp;gt; command first (remember to restore the MMU I/O once you&#039;re done).&lt;br /&gt;
[[File:Full char set.png|thumb|104x104px|F256 Character Set|none]]&lt;br /&gt;
* Color can also be set on the screen color matrix using the &amp;lt;code&amp;gt;POKE&amp;lt;/code&amp;gt; command starting at &amp;lt;code&amp;gt;$C000&amp;lt;/code&amp;gt; providing the MMU I/O control is set to 3 by executing a &amp;lt;code&amp;gt;POKE 1,3&amp;lt;/code&amp;gt; command first (remember to restore the MMU I/O once you&#039;re done).&lt;br /&gt;
* When poking colors on the screen, the high nibble is the character color and  the low nibble is the background color.&lt;br /&gt;
&lt;br /&gt;
[[File:Colormatrix.png|alt=Default Colors|thumb|100x100px|Default Colors|none]]&lt;br /&gt;
&lt;br /&gt;
===== Memcopy lockup =====&lt;br /&gt;
&lt;br /&gt;
* In certain situations the &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;memcopy&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; command can lockup.&lt;br /&gt;
* A machine language utility that performs the same function as &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; is available if &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; fails.&lt;br /&gt;
* &amp;lt;u&amp;gt;mlcopy&amp;lt;/u&amp;gt; is a short routine that replaces &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; and is more reliable. It can be loaded into memory with a BLOAD command in your program, or with a basic loader that can be added to your program.&lt;br /&gt;
* In place of the &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; command you would use 3 &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;POKEL&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; commands and a &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CALL&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; command to engage the DMA engine.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0903,data source&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0906,destination&amp;lt;/code&amp;gt; &lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0909,number of bytes to copy&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;CALL $0900&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/mcassera/F256-mlcopy mlcopy github page]&lt;br /&gt;
&lt;br /&gt;
===== Sprite Images =====&lt;br /&gt;
&lt;br /&gt;
In BASIC you can access different SPRITE shapes through the IMAGE command as part of the sprite command: &amp;lt;code&amp;gt;SPRITE 0 IMAGE 1 TO 100,100&amp;lt;/code&amp;gt;. Be aware that BASIC can only keep track of 64 Images, if you want to access and show more than 64 different shapes you need to poke the 3 bytes of the address where the image data resides into the correct sprite registers yourself.&lt;br /&gt;
&lt;br /&gt;
===== Sprite Coordinates =====&lt;br /&gt;
In BASIC all sprites are centered on the coordinate specified, this might produce some counterintuitive effects when using different size sprites, for example if you want to align the sprite edge with the top left side of the screen you would need different values depending on the sprite size&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SPRITE 0 IMAGE 1 TO 4,4: REM &amp;quot;8x8 Sprite&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;/BR&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;SPRITE 1 IMAGE 1 TO 8,8: REM &amp;quot;16x16 Sprite&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;/BR&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;SPRITE 2 IMAGE 2 TO 12,12: REM &amp;quot;24x24 Sprite&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;/BR&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;SPRITE 3 IMAGE 3 TO 16,16: REM &amp;quot;32x32 Sprite&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;/BR&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also, please note that you need to use the command &amp;lt;code&amp;gt;SPRITE X IMAGE Y&amp;lt;/code&amp;gt; before setting the sprite coordinates or else BASIC will not know what size is the sprite, and will misalign it, for example the following code although it seems correct will misalign the sprite:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SPRITE 1 TO 8,8&amp;lt;/code&amp;gt;&amp;lt;/BR&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;SPRITE 1 IMAGE 1: REM &amp;quot;USe a 16x16 Sprite&amp;quot;&amp;lt;/code&amp;gt;&amp;lt;/BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC_Memory_Map&amp;diff=459</id>
		<title>SuperBASIC Memory Map</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC_Memory_Map&amp;diff=459"/>
		<updated>2024-09-22T22:29:03Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: /* Memory Map under BASIC */  Added Keyboard Buffer info @$678-$680&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Memory Map under BASIC ===&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|+ Caption text&lt;br /&gt;
|-&lt;br /&gt;
! Initial Address !! End Address !! Description !! Bytes&lt;br /&gt;
|-&lt;br /&gt;
| $0000|| -|| MMU Control Register || 1&lt;br /&gt;
|-&lt;br /&gt;
| $0001|| -|| I/O Control Register || 1&lt;br /&gt;
|-&lt;br /&gt;
| $0002|| $0007|| Free Zero Page Addresses || 6&lt;br /&gt;
|-&lt;br /&gt;
| $0008|| $000F|| MMU Control Addresses || 8&lt;br /&gt;
|-&lt;br /&gt;
| $0010|| $002F|| Free Zero Page Addresses || 32&lt;br /&gt;
|-&lt;br /&gt;
| $0030|| $003F|| Used Zero Page Addresses for (xx),Y Addressing || 16&lt;br /&gt;
|-&lt;br /&gt;
| $0040|| $0041 || Current Address on screen of start of line || 2&lt;br /&gt;
|-&lt;br /&gt;
| $0042|| $004F|| Avaliable Zero Page Addresses || 14&lt;br /&gt;
|-&lt;br /&gt;
| $0050|| $00AF|| Number / Floating Point Stack for 16 numbers || 96 &lt;br /&gt;
|-&lt;br /&gt;
| $00B0||$00EF|| Available Zero Page || 64&lt;br /&gt;
|-&lt;br /&gt;
| $00F0|| $00FF|| Kernel Arguments in Zero Page* || 16&lt;br /&gt;
|-&lt;br /&gt;
| $0100|| $01FF|| Hardware Stack of 6502 || 256&lt;br /&gt;
|-&lt;br /&gt;
| $0200|| $0228|| Basic mini-Kernel memory || 40&lt;br /&gt;
|-&lt;br /&gt;
| $0229|| $03FF|| Available Low Memory | Buffer area by Sound Command in BASIC (available if not using this command) || 470&lt;br /&gt;
|-&lt;br /&gt;
| $0400|| $041F|| Control Storage first 8 bytes control syntax highlighting || 32&lt;br /&gt;
|-&lt;br /&gt;
| $0420|| $0814|| Memory Storage || 1012&lt;br /&gt;
|-&lt;br /&gt;
|$0678&lt;br /&gt;
|$067F&lt;br /&gt;
|Keyboard Buffer (8 keys max)&lt;br /&gt;
|8&lt;br /&gt;
|-&lt;br /&gt;
|$0680&lt;br /&gt;
|$0680&lt;br /&gt;
|Pending key presses in Keyboard Buffer&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
| $0814|| $0FFF|| Available Low Memory || 2027&lt;br /&gt;
|-&lt;br /&gt;
| $1000|| $1FFF|| SuperBASIC Identifier Tables, allocated memory, string vars, stack || 4kb&lt;br /&gt;
|-&lt;br /&gt;
| $2000|| $77FF|| SuperBASIC Program Tokenized Code (grows Upward) || 22kb&lt;br /&gt;
|-&lt;br /&gt;
| $7800|| $7FFF|| Top 2k of SuperBASIC Program tokenize code or used for ML routines in low memory || 2kb&lt;br /&gt;
|-&lt;br /&gt;
| $8000|| $BFFF|| SUPERBASIC CODE || 16kb&lt;br /&gt;
|-&lt;br /&gt;
| $C000|| $DFFF|| I/O Memory Pages / Underlying Kernel Code (Selectable with I/O control Register)|| 8kb&lt;br /&gt;
|-&lt;br /&gt;
| $E000|| $FFEF|| KERNEL CODE || 8176&lt;br /&gt;
|-&lt;br /&gt;
| $FFF0|| $FFFF|| Reset Vectors and NMI / IRQ / BRK Vectors || 16&lt;br /&gt;
|-&lt;br /&gt;
| $01:0000|| $02:2BFF|| Default Memory used by BASIC bitmap graphics || 75kb&lt;br /&gt;
|-&lt;br /&gt;
| $02:2C00|| $02:7FFF|| Available High Memory || 21kb&lt;br /&gt;
|-&lt;br /&gt;
| $02:8000|| $02:F000|| Available High Memory | Used for BASIC Cross Development w/PC or MAC (or Available High Memory)|| 32k&lt;br /&gt;
|-&lt;br /&gt;
| $03:0000|| $03:7FFF|| Used for Sprite Data in BASIC || 32kb&lt;br /&gt;
|-&lt;br /&gt;
| $03:8000|| $03:FFFF|| Available High Memory | Unless not running from Flash, Used for ROM Images|| 32k&lt;br /&gt;
|-&lt;br /&gt;
| $04:0000|| $07:DFFF|| Available High Memory || 248kb&lt;br /&gt;
|-&lt;br /&gt;
| $07:E000|| $07:FFFF|| Available High Memory | Being considered to be Reserved for Environmental Variables || 8Kb&lt;br /&gt;
|-&lt;br /&gt;
| $10:0000|| $13:FFFF|| Cartridge Expanded Memory (addresable only by CPU) || 256kb&lt;br /&gt;
|-&lt;br /&gt;
| $14:0000|| $1F:FFFF|| Future Expansions? || 768kb&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== *Detail of Kernel Arguments in Zero Page (TBC!) ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Initial Address&lt;br /&gt;
!End Address&lt;br /&gt;
!Description&lt;br /&gt;
!bytes&lt;br /&gt;
|-&lt;br /&gt;
|$F0&lt;br /&gt;
|$F1&lt;br /&gt;
|Kernel Event Struct Pointer - points to an 8 byte buffer with a &amp;quot;kernel event&amp;quot; structure  &lt;br /&gt;
|2 bytes&lt;br /&gt;
|-&lt;br /&gt;
|$F3&lt;br /&gt;
|&lt;br /&gt;
|Kernel File stream number (Read or Write)&lt;br /&gt;
|1 byte&lt;br /&gt;
|-&lt;br /&gt;
|$F4&lt;br /&gt;
|&lt;br /&gt;
|Kernel File buffer length (Read or Write)&lt;br /&gt;
|1 byte&lt;br /&gt;
|-&lt;br /&gt;
|$F5&lt;br /&gt;
|$FA&lt;br /&gt;
|???&lt;br /&gt;
|6 bytes&lt;br /&gt;
|-&lt;br /&gt;
|$FB&lt;br /&gt;
|$FC&lt;br /&gt;
|Kernel Buffer Address Pointer - Multiple purpouse buffer area for recv/send data from Kernel Events&lt;br /&gt;
|2 bytes&lt;br /&gt;
|-&lt;br /&gt;
|$FD&lt;br /&gt;
|&lt;br /&gt;
|Kernel Buffer Length&lt;br /&gt;
|1 byte&lt;br /&gt;
|-&lt;br /&gt;
|$FE&lt;br /&gt;
|$FF&lt;br /&gt;
|Unknown&lt;br /&gt;
|2 bytes&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=456</id>
		<title>SuperBASIC</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=456"/>
		<updated>2024-08-22T00:23:37Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: /* Character Set */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SuperBASIC is inspired by BBC BASIC but offers quite a bit more.&lt;br /&gt;
* [https://github.com/FoenixRetro/f256-superbasic/blob/main/reference/source/f256jr_basic_ref.pdf SuperBASIC Reference Manual].&lt;br /&gt;
* [[SuperBASIC Memory Map]]&lt;br /&gt;
* Watch EMWhite&#039;s excellent intro series on YouTube: [https://www.youtube.com/playlist?list=PLeHjTvk7NPiSqGz4REMH-S4hjYpLS2YNR Full Playlist].&lt;br /&gt;
&lt;br /&gt;
=== An informal list of tips, &amp;quot;gotchas&amp;quot;: ===&lt;br /&gt;
&lt;br /&gt;
===== IF, THEN, ELSE =====&lt;br /&gt;
&lt;br /&gt;
====== Source of this tip: Ernesto ======&lt;br /&gt;
* A regular &amp;lt;code&amp;gt;if then&amp;lt;/code&amp;gt; condition can&#039;t contain an &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt; statement, as in this example: &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0 then x=10&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you need to do an  &amp;lt;code&amp;gt;if then else&amp;lt;/code&amp;gt; structure,  you actually have to do an &amp;lt;code&amp;gt;if else endif&amp;lt;/code&amp;gt; structure like in the following example,  skipping the &amp;lt;code&amp;gt;then&amp;lt;/code&amp;gt; statement. &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0&amp;lt;br /&amp;gt;&lt;br /&gt;
20     x=1&amp;lt;br /&amp;gt;&lt;br /&gt;
30     else&amp;lt;br /&amp;gt;&lt;br /&gt;
40     x=2&amp;lt;br /&amp;gt;&lt;br /&gt;
50 endif&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you do it in one line it needs to have some colons added, making it look weird like this: &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0:x=1:else:x=2:endif&amp;lt;/code&amp;gt;&lt;br /&gt;
* if you dare to omit the &amp;lt;code&amp;gt;endif&amp;lt;/code&amp;gt;  thinking that the &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement won&#039;t need it, (mmm.., everything is in one line, so no need, right?) -Nope...all hell breaks loose!- &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0:x=1:else:x=2: REM &amp;quot;&amp;lt;-- Error, omited the endif&amp;quot;&amp;lt;/code&amp;gt; &lt;br /&gt;
* be careful not to add an extra  &amp;lt;code&amp;gt;then&amp;lt;/code&amp;gt; statement by mistake to an &amp;lt;code&amp;gt;if else endif&amp;lt;/code&amp;gt; structure, if you do -All hell breaks loose again!!- &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0 then  : rem &amp;quot;&amp;lt;-- Error, THEN is not needed!!!&amp;quot; &amp;lt;br /&amp;gt;&lt;br /&gt;
20     x=1 &amp;lt;br /&amp;gt;&lt;br /&gt;
30     else &amp;lt;br /&amp;gt;&lt;br /&gt;
40     x=2 &amp;lt;br /&amp;gt;&lt;br /&gt;
50 endif&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Debugging hint: If you encounter an error like &amp;quot;open structure&amp;quot; or &amp;quot;endproc without a proc&amp;quot;: do not trust the line number that you are given. The root of the problem is probably in a structure earlier on in the code.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===== Evaluating multiple conditions in IF statements =====&lt;br /&gt;
SUPERBASIC doesn&#039;t have the dedicated keywords AND , OR so you have to use the bitwise operators to evaluate multiple conditions, please consider the following examples:&lt;br /&gt;
&lt;br /&gt;
* AND  &amp;lt;code&amp;gt;if (a=1)&amp;amp;(b=2) then c=1&amp;lt;/code&amp;gt;&lt;br /&gt;
* OR   &amp;lt;code&amp;gt;if (a=1)^(b=2) then c=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should work as long as you use parenthesis in all evaluated expressions (Since parenthesis makes bitwise operators behave like logical operators).&lt;br /&gt;
&lt;br /&gt;
===== Using procedures =====&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;proc&amp;lt;/code&amp;gt; keyword is only valid if it appears after an &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt; statement.&lt;br /&gt;
* When calling a procedure use the procedure name followed by parenthesis (), even if the procedure has no parameters.&lt;br /&gt;
* Avoid any space between the procedure name and the parenthesis, else it will produce an error.&lt;br /&gt;
&lt;br /&gt;
===== Keyboard shortcuts =====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Key combination&lt;br /&gt;
!Effect&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-c&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;RUN STOP&amp;lt;/code&amp;gt; on the F256K&lt;br /&gt;
|Stops a listing or a running program&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-l&amp;lt;/code&amp;gt;&lt;br /&gt;
|Clears the screen&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-a&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLR/HOME&amp;lt;/code&amp;gt; on the F256K&lt;br /&gt;
|Move cursor to the first character in the current line&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-e&amp;lt;/code&amp;gt;&lt;br /&gt;
|Move cursor to the last character in the current line&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-i&amp;lt;/code&amp;gt;&lt;br /&gt;
|Move cursor 8 characters to the right &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-k&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes characters from cursor position to line end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Behaviour of load and bload =====&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;bload&amp;lt;/code&amp;gt; statement does not print &amp;lt;code&amp;gt;Completed&amp;lt;/code&amp;gt; when loading is successfull whereas &amp;lt;code&amp;gt;load&amp;lt;/code&amp;gt; does.&lt;br /&gt;
* bload can load anywhere on memory not just under the first 64k&lt;br /&gt;
* An exception is that bload can&#039;t load I/O parameters that reside in $C000 - $DFFF&lt;br /&gt;
&lt;br /&gt;
===== Control characters for cursor and colour control =====&lt;br /&gt;
In BASIC the following character codes can be used with &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt; to control the cursor position and colours on the screen.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Code&lt;br /&gt;
!Effect&lt;br /&gt;
|-&lt;br /&gt;
|chr$(12)&lt;br /&gt;
|Clear screen and set cursor to upper left corner&lt;br /&gt;
|-&lt;br /&gt;
|chr$(16)&lt;br /&gt;
|Cursor up&lt;br /&gt;
|-&lt;br /&gt;
|chr$(14)&lt;br /&gt;
|Cursor down&lt;br /&gt;
|-&lt;br /&gt;
|chr$(2)&lt;br /&gt;
|Cursor left&lt;br /&gt;
|-&lt;br /&gt;
|chr$(6)&lt;br /&gt;
|Cursor right&lt;br /&gt;
|-&lt;br /&gt;
|chr$(1)&lt;br /&gt;
|Set cursor to leftmost position in current line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(5)&lt;br /&gt;
|Set cursor to righmost position in current line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(128) - chr$(143)&lt;br /&gt;
|Set foreground color. Code 128 is black 143 is white. The rest follows the sequence given below&lt;br /&gt;
|-&lt;br /&gt;
|chr$(144) - chr$(159)&lt;br /&gt;
|Set background color. Code 144 is black 159 is white. The rest follows the sequence given below&lt;br /&gt;
|}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Colour code&lt;br /&gt;
!Colour&lt;br /&gt;
!Colour code&lt;br /&gt;
!Colour&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Black&lt;br /&gt;
|8&lt;br /&gt;
|Dark grey&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Grey&lt;br /&gt;
|9&lt;br /&gt;
|Light grey (default foreground)&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Dark blue (default background colour)&lt;br /&gt;
|10&lt;br /&gt;
|Blue&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Green&lt;br /&gt;
|11&lt;br /&gt;
|Light green&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Purple&lt;br /&gt;
|12&lt;br /&gt;
|Light purple&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Brown&lt;br /&gt;
|13&lt;br /&gt;
|Red&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Orange&lt;br /&gt;
|14&lt;br /&gt;
|Yellow&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|Light blue&lt;br /&gt;
|15&lt;br /&gt;
|White&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Character Set / Text matrix =====&lt;br /&gt;
&lt;br /&gt;
* Access to the full character set can be obtained by using the &amp;lt;code&amp;gt;CPRINT&amp;lt;/code&amp;gt; command instead of the normal &amp;lt;code&amp;gt;PRINT&amp;lt;/code&amp;gt; command.&lt;br /&gt;
* Characters can also be set on the screen text matrix using the &amp;lt;code&amp;gt;POKE&amp;lt;/code&amp;gt; command starting at &amp;lt;code&amp;gt;$C000&amp;lt;/code&amp;gt; providing the MMU I/O control is set to 2 by executing a &amp;lt;code&amp;gt;POKE 1,2&amp;lt;/code&amp;gt; command first (remember to restore the MMU I/O once you&#039;re done).&lt;br /&gt;
[[File:Full char set.png|thumb|104x104px|F256 Character Set|none]]&lt;br /&gt;
* Color can also be set on the screen color matrix using the &amp;lt;code&amp;gt;POKE&amp;lt;/code&amp;gt; command starting at &amp;lt;code&amp;gt;$C000&amp;lt;/code&amp;gt; providing the MMU I/O control is set to 3 by executing a &amp;lt;code&amp;gt;POKE 1,3&amp;lt;/code&amp;gt; command first (remember to restore the MMU I/O once you&#039;re done).&lt;br /&gt;
* When poking colors on the screen, the high nibble is the character color and  the low nibble is the background color.&lt;br /&gt;
&lt;br /&gt;
[[File:Colormatrix.png|alt=Default Colors|thumb|100x100px|Default Colors|none]]&lt;br /&gt;
&lt;br /&gt;
===== Memcopy lockup =====&lt;br /&gt;
&lt;br /&gt;
* In certain situations the &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;memcopy&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; command can lockup.&lt;br /&gt;
* A machine language utility that performs the same function as &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; is available if &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; fails.&lt;br /&gt;
* &amp;lt;u&amp;gt;mlcopy&amp;lt;/u&amp;gt; is a short routine that replaces &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; and is more reliable. It can be loaded into memory with a BLOAD command in your program, or with a basic loader that can be added to your program.&lt;br /&gt;
* In place of the &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; command you would use 3 &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;POKEL&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; commands and a &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CALL&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; command to engage the DMA engine.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0903,data source&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0906,destination&amp;lt;/code&amp;gt; &lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0909,number of bytes to copy&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;CALL $0900&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/mcassera/F256-mlcopy mlcopy github page]&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=455</id>
		<title>SuperBASIC</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=455"/>
		<updated>2024-08-22T00:17:04Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: /* Character Set */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SuperBASIC is inspired by BBC BASIC but offers quite a bit more.&lt;br /&gt;
* [https://github.com/FoenixRetro/f256-superbasic/blob/main/reference/source/f256jr_basic_ref.pdf SuperBASIC Reference Manual].&lt;br /&gt;
* [[SuperBASIC Memory Map]]&lt;br /&gt;
* Watch EMWhite&#039;s excellent intro series on YouTube: [https://www.youtube.com/playlist?list=PLeHjTvk7NPiSqGz4REMH-S4hjYpLS2YNR Full Playlist].&lt;br /&gt;
&lt;br /&gt;
=== An informal list of tips, &amp;quot;gotchas&amp;quot;: ===&lt;br /&gt;
&lt;br /&gt;
===== IF, THEN, ELSE =====&lt;br /&gt;
&lt;br /&gt;
====== Source of this tip: Ernesto ======&lt;br /&gt;
* A regular &amp;lt;code&amp;gt;if then&amp;lt;/code&amp;gt; condition can&#039;t contain an &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt; statement, as in this example: &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0 then x=10&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you need to do an  &amp;lt;code&amp;gt;if then else&amp;lt;/code&amp;gt; structure,  you actually have to do an &amp;lt;code&amp;gt;if else endif&amp;lt;/code&amp;gt; structure like in the following example,  skipping the &amp;lt;code&amp;gt;then&amp;lt;/code&amp;gt; statement. &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0&amp;lt;br /&amp;gt;&lt;br /&gt;
20     x=1&amp;lt;br /&amp;gt;&lt;br /&gt;
30     else&amp;lt;br /&amp;gt;&lt;br /&gt;
40     x=2&amp;lt;br /&amp;gt;&lt;br /&gt;
50 endif&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you do it in one line it needs to have some colons added, making it look weird like this: &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0:x=1:else:x=2:endif&amp;lt;/code&amp;gt;&lt;br /&gt;
* if you dare to omit the &amp;lt;code&amp;gt;endif&amp;lt;/code&amp;gt;  thinking that the &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement won&#039;t need it, (mmm.., everything is in one line, so no need, right?) -Nope...all hell breaks loose!- &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0:x=1:else:x=2: REM &amp;quot;&amp;lt;-- Error, omited the endif&amp;quot;&amp;lt;/code&amp;gt; &lt;br /&gt;
* be careful not to add an extra  &amp;lt;code&amp;gt;then&amp;lt;/code&amp;gt; statement by mistake to an &amp;lt;code&amp;gt;if else endif&amp;lt;/code&amp;gt; structure, if you do -All hell breaks loose again!!- &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0 then  : rem &amp;quot;&amp;lt;-- Error, THEN is not needed!!!&amp;quot; &amp;lt;br /&amp;gt;&lt;br /&gt;
20     x=1 &amp;lt;br /&amp;gt;&lt;br /&gt;
30     else &amp;lt;br /&amp;gt;&lt;br /&gt;
40     x=2 &amp;lt;br /&amp;gt;&lt;br /&gt;
50 endif&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Debugging hint: If you encounter an error like &amp;quot;open structure&amp;quot; or &amp;quot;endproc without a proc&amp;quot;: do not trust the line number that you are given. The root of the problem is probably in a structure earlier on in the code.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===== Evaluating multiple conditions in IF statements =====&lt;br /&gt;
SUPERBASIC doesn&#039;t have the dedicated keywords AND , OR so you have to use the bitwise operators to evaluate multiple conditions, please consider the following examples:&lt;br /&gt;
&lt;br /&gt;
* AND  &amp;lt;code&amp;gt;if (a=1)&amp;amp;(b=2) then c=1&amp;lt;/code&amp;gt;&lt;br /&gt;
* OR   &amp;lt;code&amp;gt;if (a=1)^(b=2) then c=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should work as long as you use parenthesis in all evaluated expressions (Since parenthesis makes bitwise operators behave like logical operators).&lt;br /&gt;
&lt;br /&gt;
===== Using procedures =====&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;proc&amp;lt;/code&amp;gt; keyword is only valid if it appears after an &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt; statement.&lt;br /&gt;
* When calling a procedure use the procedure name followed by parenthesis (), even if the procedure has no parameters.&lt;br /&gt;
* Avoid any space between the procedure name and the parenthesis, else it will produce an error.&lt;br /&gt;
&lt;br /&gt;
===== Keyboard shortcuts =====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Key combination&lt;br /&gt;
!Effect&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-c&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;RUN STOP&amp;lt;/code&amp;gt; on the F256K&lt;br /&gt;
|Stops a listing or a running program&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-l&amp;lt;/code&amp;gt;&lt;br /&gt;
|Clears the screen&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-a&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLR/HOME&amp;lt;/code&amp;gt; on the F256K&lt;br /&gt;
|Move cursor to the first character in the current line&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-e&amp;lt;/code&amp;gt;&lt;br /&gt;
|Move cursor to the last character in the current line&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-i&amp;lt;/code&amp;gt;&lt;br /&gt;
|Move cursor 8 characters to the right &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-k&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes characters from cursor position to line end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Behaviour of load and bload =====&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;bload&amp;lt;/code&amp;gt; statement does not print &amp;lt;code&amp;gt;Completed&amp;lt;/code&amp;gt; when loading is successfull whereas &amp;lt;code&amp;gt;load&amp;lt;/code&amp;gt; does.&lt;br /&gt;
* bload can load anywhere on memory not just under the first 64k&lt;br /&gt;
* An exception is that bload can&#039;t load I/O parameters that reside in $C000 - $DFFF&lt;br /&gt;
&lt;br /&gt;
===== Control characters for cursor and colour control =====&lt;br /&gt;
In BASIC the following character codes can be used with &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt; to control the cursor position and colours on the screen.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Code&lt;br /&gt;
!Effect&lt;br /&gt;
|-&lt;br /&gt;
|chr$(12)&lt;br /&gt;
|Clear screen and set cursor to upper left corner&lt;br /&gt;
|-&lt;br /&gt;
|chr$(16)&lt;br /&gt;
|Cursor up&lt;br /&gt;
|-&lt;br /&gt;
|chr$(14)&lt;br /&gt;
|Cursor down&lt;br /&gt;
|-&lt;br /&gt;
|chr$(2)&lt;br /&gt;
|Cursor left&lt;br /&gt;
|-&lt;br /&gt;
|chr$(6)&lt;br /&gt;
|Cursor right&lt;br /&gt;
|-&lt;br /&gt;
|chr$(1)&lt;br /&gt;
|Set cursor to leftmost position in current line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(5)&lt;br /&gt;
|Set cursor to righmost position in current line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(128) - chr$(143)&lt;br /&gt;
|Set foreground color. Code 128 is black 143 is white. The rest follows the sequence given below&lt;br /&gt;
|-&lt;br /&gt;
|chr$(144) - chr$(159)&lt;br /&gt;
|Set background color. Code 144 is black 159 is white. The rest follows the sequence given below&lt;br /&gt;
|}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Colour code&lt;br /&gt;
!Colour&lt;br /&gt;
!Colour code&lt;br /&gt;
!Colour&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Black&lt;br /&gt;
|8&lt;br /&gt;
|Dark grey&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Grey&lt;br /&gt;
|9&lt;br /&gt;
|Light grey (default foreground)&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Dark blue (default background colour)&lt;br /&gt;
|10&lt;br /&gt;
|Blue&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Green&lt;br /&gt;
|11&lt;br /&gt;
|Light green&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Purple&lt;br /&gt;
|12&lt;br /&gt;
|Light purple&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Brown&lt;br /&gt;
|13&lt;br /&gt;
|Red&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Orange&lt;br /&gt;
|14&lt;br /&gt;
|Yellow&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|Light blue&lt;br /&gt;
|15&lt;br /&gt;
|White&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Character Set =====&lt;br /&gt;
&lt;br /&gt;
* Access to the full character set can be obtained by using the &amp;lt;code&amp;gt;CPRINT&amp;lt;/code&amp;gt; command instead of the normal &amp;lt;code&amp;gt;PRINT&amp;lt;/code&amp;gt; command.&lt;br /&gt;
* Characters can also be set on the screen text matrix using the &amp;lt;code&amp;gt;POKE&amp;lt;/code&amp;gt; command starting at &amp;lt;code&amp;gt;$C000&amp;lt;/code&amp;gt; providing the MMU I/O control is set to 2 by executing a &amp;lt;code&amp;gt;POKE 1,2&amp;lt;/code&amp;gt; command first (remember to restore the MMU I/O once you&#039;re done).&lt;br /&gt;
[[File:Full char set.png|thumb|104x104px|F256 Character Set|none]]&lt;br /&gt;
* Color can also be set on the screen color matrix using the &amp;lt;code&amp;gt;POKE&amp;lt;/code&amp;gt; command starting at &amp;lt;code&amp;gt;$C000&amp;lt;/code&amp;gt; providing the MMU I/O control is set to 3 by executing a &amp;lt;code&amp;gt;POKE 1,3&amp;lt;/code&amp;gt; command first (remember to restore the MMU I/O once you&#039;re done).&lt;br /&gt;
* When poking colors on the screen, the high nibble is the character color and  the low nibble is the background color.&lt;br /&gt;
&lt;br /&gt;
[[File:Colormatrix.png|alt=Default Colors|thumb|100x100px|Default Colors|none]]&lt;br /&gt;
&lt;br /&gt;
===== Memcopy lockup =====&lt;br /&gt;
&lt;br /&gt;
* In certain situations the &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;memcopy&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; command can lockup.&lt;br /&gt;
* A machine language utility that performs the same function as &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; is available if &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; fails.&lt;br /&gt;
* &amp;lt;u&amp;gt;mlcopy&amp;lt;/u&amp;gt; is a short routine that replaces &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; and is more reliable. It can be loaded into memory with a BLOAD command in your program, or with a basic loader that can be added to your program.&lt;br /&gt;
* In place of the &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; command you would use 3 &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;POKEL&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; commands and a &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CALL&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; command to engage the DMA engine.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0903,data source&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0906,destination&amp;lt;/code&amp;gt; &lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0909,number of bytes to copy&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;CALL $0900&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/mcassera/F256-mlcopy mlcopy github page]&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=454</id>
		<title>SuperBASIC</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=454"/>
		<updated>2024-08-22T00:10:22Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: /* Character Set */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SuperBASIC is inspired by BBC BASIC but offers quite a bit more.&lt;br /&gt;
* [https://github.com/FoenixRetro/f256-superbasic/blob/main/reference/source/f256jr_basic_ref.pdf SuperBASIC Reference Manual].&lt;br /&gt;
* [[SuperBASIC Memory Map]]&lt;br /&gt;
* Watch EMWhite&#039;s excellent intro series on YouTube: [https://www.youtube.com/playlist?list=PLeHjTvk7NPiSqGz4REMH-S4hjYpLS2YNR Full Playlist].&lt;br /&gt;
&lt;br /&gt;
=== An informal list of tips, &amp;quot;gotchas&amp;quot;: ===&lt;br /&gt;
&lt;br /&gt;
===== IF, THEN, ELSE =====&lt;br /&gt;
&lt;br /&gt;
====== Source of this tip: Ernesto ======&lt;br /&gt;
* A regular &amp;lt;code&amp;gt;if then&amp;lt;/code&amp;gt; condition can&#039;t contain an &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt; statement, as in this example: &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0 then x=10&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you need to do an  &amp;lt;code&amp;gt;if then else&amp;lt;/code&amp;gt; structure,  you actually have to do an &amp;lt;code&amp;gt;if else endif&amp;lt;/code&amp;gt; structure like in the following example,  skipping the &amp;lt;code&amp;gt;then&amp;lt;/code&amp;gt; statement. &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0&amp;lt;br /&amp;gt;&lt;br /&gt;
20     x=1&amp;lt;br /&amp;gt;&lt;br /&gt;
30     else&amp;lt;br /&amp;gt;&lt;br /&gt;
40     x=2&amp;lt;br /&amp;gt;&lt;br /&gt;
50 endif&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you do it in one line it needs to have some colons added, making it look weird like this: &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0:x=1:else:x=2:endif&amp;lt;/code&amp;gt;&lt;br /&gt;
* if you dare to omit the &amp;lt;code&amp;gt;endif&amp;lt;/code&amp;gt;  thinking that the &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement won&#039;t need it, (mmm.., everything is in one line, so no need, right?) -Nope...all hell breaks loose!- &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0:x=1:else:x=2: REM &amp;quot;&amp;lt;-- Error, omited the endif&amp;quot;&amp;lt;/code&amp;gt; &lt;br /&gt;
* be careful not to add an extra  &amp;lt;code&amp;gt;then&amp;lt;/code&amp;gt; statement by mistake to an &amp;lt;code&amp;gt;if else endif&amp;lt;/code&amp;gt; structure, if you do -All hell breaks loose again!!- &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0 then  : rem &amp;quot;&amp;lt;-- Error, THEN is not needed!!!&amp;quot; &amp;lt;br /&amp;gt;&lt;br /&gt;
20     x=1 &amp;lt;br /&amp;gt;&lt;br /&gt;
30     else &amp;lt;br /&amp;gt;&lt;br /&gt;
40     x=2 &amp;lt;br /&amp;gt;&lt;br /&gt;
50 endif&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Debugging hint: If you encounter an error like &amp;quot;open structure&amp;quot; or &amp;quot;endproc without a proc&amp;quot;: do not trust the line number that you are given. The root of the problem is probably in a structure earlier on in the code.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===== Evaluating multiple conditions in IF statements =====&lt;br /&gt;
SUPERBASIC doesn&#039;t have the dedicated keywords AND , OR so you have to use the bitwise operators to evaluate multiple conditions, please consider the following examples:&lt;br /&gt;
&lt;br /&gt;
* AND  &amp;lt;code&amp;gt;if (a=1)&amp;amp;(b=2) then c=1&amp;lt;/code&amp;gt;&lt;br /&gt;
* OR   &amp;lt;code&amp;gt;if (a=1)^(b=2) then c=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should work as long as you use parenthesis in all evaluated expressions (Since parenthesis makes bitwise operators behave like logical operators).&lt;br /&gt;
&lt;br /&gt;
===== Using procedures =====&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;proc&amp;lt;/code&amp;gt; keyword is only valid if it appears after an &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt; statement.&lt;br /&gt;
* When calling a procedure use the procedure name followed by parenthesis (), even if the procedure has no parameters.&lt;br /&gt;
* Avoid any space between the procedure name and the parenthesis, else it will produce an error.&lt;br /&gt;
&lt;br /&gt;
===== Keyboard shortcuts =====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Key combination&lt;br /&gt;
!Effect&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-c&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;RUN STOP&amp;lt;/code&amp;gt; on the F256K&lt;br /&gt;
|Stops a listing or a running program&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-l&amp;lt;/code&amp;gt;&lt;br /&gt;
|Clears the screen&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-a&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLR/HOME&amp;lt;/code&amp;gt; on the F256K&lt;br /&gt;
|Move cursor to the first character in the current line&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-e&amp;lt;/code&amp;gt;&lt;br /&gt;
|Move cursor to the last character in the current line&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-i&amp;lt;/code&amp;gt;&lt;br /&gt;
|Move cursor 8 characters to the right &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-k&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes characters from cursor position to line end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Behaviour of load and bload =====&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;bload&amp;lt;/code&amp;gt; statement does not print &amp;lt;code&amp;gt;Completed&amp;lt;/code&amp;gt; when loading is successfull whereas &amp;lt;code&amp;gt;load&amp;lt;/code&amp;gt; does.&lt;br /&gt;
* bload can load anywhere on memory not just under the first 64k&lt;br /&gt;
* An exception is that bload can&#039;t load I/O parameters that reside in $C000 - $DFFF&lt;br /&gt;
&lt;br /&gt;
===== Control characters for cursor and colour control =====&lt;br /&gt;
In BASIC the following character codes can be used with &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt; to control the cursor position and colours on the screen.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Code&lt;br /&gt;
!Effect&lt;br /&gt;
|-&lt;br /&gt;
|chr$(12)&lt;br /&gt;
|Clear screen and set cursor to upper left corner&lt;br /&gt;
|-&lt;br /&gt;
|chr$(16)&lt;br /&gt;
|Cursor up&lt;br /&gt;
|-&lt;br /&gt;
|chr$(14)&lt;br /&gt;
|Cursor down&lt;br /&gt;
|-&lt;br /&gt;
|chr$(2)&lt;br /&gt;
|Cursor left&lt;br /&gt;
|-&lt;br /&gt;
|chr$(6)&lt;br /&gt;
|Cursor right&lt;br /&gt;
|-&lt;br /&gt;
|chr$(1)&lt;br /&gt;
|Set cursor to leftmost position in current line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(5)&lt;br /&gt;
|Set cursor to righmost position in current line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(128) - chr$(143)&lt;br /&gt;
|Set foreground color. Code 128 is black 143 is white. The rest follows the sequence given below&lt;br /&gt;
|-&lt;br /&gt;
|chr$(144) - chr$(159)&lt;br /&gt;
|Set background color. Code 144 is black 159 is white. The rest follows the sequence given below&lt;br /&gt;
|}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Colour code&lt;br /&gt;
!Colour&lt;br /&gt;
!Colour code&lt;br /&gt;
!Colour&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Black&lt;br /&gt;
|8&lt;br /&gt;
|Dark grey&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Grey&lt;br /&gt;
|9&lt;br /&gt;
|Light grey (default foreground)&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Dark blue (default background colour)&lt;br /&gt;
|10&lt;br /&gt;
|Blue&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Green&lt;br /&gt;
|11&lt;br /&gt;
|Light green&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Purple&lt;br /&gt;
|12&lt;br /&gt;
|Light purple&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Brown&lt;br /&gt;
|13&lt;br /&gt;
|Red&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Orange&lt;br /&gt;
|14&lt;br /&gt;
|Yellow&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|Light blue&lt;br /&gt;
|15&lt;br /&gt;
|White&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Character Set =====&lt;br /&gt;
&lt;br /&gt;
* Access to the full character set can be obtained by using the &amp;lt;code&amp;gt;CPRINT&amp;lt;/code&amp;gt; command instead of the normal &amp;lt;code&amp;gt;PRINT&amp;lt;/code&amp;gt; command.&lt;br /&gt;
* Characters can also be set on the screen text matrix using the &amp;lt;code&amp;gt;POKE&amp;lt;/code&amp;gt; command starting at &amp;lt;code&amp;gt;$C000&amp;lt;/code&amp;gt; providing the MMU I/O control is set to 2 by executing a &amp;lt;code&amp;gt;POKE 1,2&amp;lt;/code&amp;gt; command first (remember to restore the MMU I/O once you&#039;re done).&lt;br /&gt;
[[File:Full char set.png|thumb|104x104px|F256 Character Set|none]]&lt;br /&gt;
* Color can also be set on the screen color matrix using the &amp;lt;code&amp;gt;POKE&amp;lt;/code&amp;gt; command starting at &amp;lt;code&amp;gt;$C000&amp;lt;/code&amp;gt; providing the MMU I/O control is set to 3 by executing a &amp;lt;code&amp;gt;POKE 1,3&amp;lt;/code&amp;gt; command first (remember to restore the MMU I/O once you&#039;re done).&lt;br /&gt;
* When poking colors on the screen, the low nibble is the background color and the high nibble is the character color.&lt;br /&gt;
&lt;br /&gt;
[[File:Colormatrix.png|alt=Default Colors|thumb|100x100px|Default Colors|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Memcopy lockup =====&lt;br /&gt;
&lt;br /&gt;
* In certain situations the &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;memcopy&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; command can lockup.&lt;br /&gt;
* A machine language utility that performs the same function as &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; is available if &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; fails.&lt;br /&gt;
* &amp;lt;u&amp;gt;mlcopy&amp;lt;/u&amp;gt; is a short routine that replaces &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; and is more reliable. It can be loaded into memory with a BLOAD command in your program, or with a basic loader that can be added to your program.&lt;br /&gt;
* In place of the &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; command you would use 3 &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;POKEL&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; commands and a &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CALL&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; command to engage the DMA engine.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0903,data source&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0906,destination&amp;lt;/code&amp;gt; &lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0909,number of bytes to copy&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;CALL $0900&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/mcassera/F256-mlcopy mlcopy github page]&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=453</id>
		<title>SuperBASIC</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=453"/>
		<updated>2024-08-22T00:08:51Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SuperBASIC is inspired by BBC BASIC but offers quite a bit more.&lt;br /&gt;
* [https://github.com/FoenixRetro/f256-superbasic/blob/main/reference/source/f256jr_basic_ref.pdf SuperBASIC Reference Manual].&lt;br /&gt;
* [[SuperBASIC Memory Map]]&lt;br /&gt;
* Watch EMWhite&#039;s excellent intro series on YouTube: [https://www.youtube.com/playlist?list=PLeHjTvk7NPiSqGz4REMH-S4hjYpLS2YNR Full Playlist].&lt;br /&gt;
&lt;br /&gt;
=== An informal list of tips, &amp;quot;gotchas&amp;quot;: ===&lt;br /&gt;
&lt;br /&gt;
===== IF, THEN, ELSE =====&lt;br /&gt;
&lt;br /&gt;
====== Source of this tip: Ernesto ======&lt;br /&gt;
* A regular &amp;lt;code&amp;gt;if then&amp;lt;/code&amp;gt; condition can&#039;t contain an &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt; statement, as in this example: &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0 then x=10&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you need to do an  &amp;lt;code&amp;gt;if then else&amp;lt;/code&amp;gt; structure,  you actually have to do an &amp;lt;code&amp;gt;if else endif&amp;lt;/code&amp;gt; structure like in the following example,  skipping the &amp;lt;code&amp;gt;then&amp;lt;/code&amp;gt; statement. &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0&amp;lt;br /&amp;gt;&lt;br /&gt;
20     x=1&amp;lt;br /&amp;gt;&lt;br /&gt;
30     else&amp;lt;br /&amp;gt;&lt;br /&gt;
40     x=2&amp;lt;br /&amp;gt;&lt;br /&gt;
50 endif&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you do it in one line it needs to have some colons added, making it look weird like this: &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0:x=1:else:x=2:endif&amp;lt;/code&amp;gt;&lt;br /&gt;
* if you dare to omit the &amp;lt;code&amp;gt;endif&amp;lt;/code&amp;gt;  thinking that the &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement won&#039;t need it, (mmm.., everything is in one line, so no need, right?) -Nope...all hell breaks loose!- &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0:x=1:else:x=2: REM &amp;quot;&amp;lt;-- Error, omited the endif&amp;quot;&amp;lt;/code&amp;gt; &lt;br /&gt;
* be careful not to add an extra  &amp;lt;code&amp;gt;then&amp;lt;/code&amp;gt; statement by mistake to an &amp;lt;code&amp;gt;if else endif&amp;lt;/code&amp;gt; structure, if you do -All hell breaks loose again!!- &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0 then  : rem &amp;quot;&amp;lt;-- Error, THEN is not needed!!!&amp;quot; &amp;lt;br /&amp;gt;&lt;br /&gt;
20     x=1 &amp;lt;br /&amp;gt;&lt;br /&gt;
30     else &amp;lt;br /&amp;gt;&lt;br /&gt;
40     x=2 &amp;lt;br /&amp;gt;&lt;br /&gt;
50 endif&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Debugging hint: If you encounter an error like &amp;quot;open structure&amp;quot; or &amp;quot;endproc without a proc&amp;quot;: do not trust the line number that you are given. The root of the problem is probably in a structure earlier on in the code.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===== Evaluating multiple conditions in IF statements =====&lt;br /&gt;
SUPERBASIC doesn&#039;t have the dedicated keywords AND , OR so you have to use the bitwise operators to evaluate multiple conditions, please consider the following examples:&lt;br /&gt;
&lt;br /&gt;
* AND  &amp;lt;code&amp;gt;if (a=1)&amp;amp;(b=2) then c=1&amp;lt;/code&amp;gt;&lt;br /&gt;
* OR   &amp;lt;code&amp;gt;if (a=1)^(b=2) then c=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should work as long as you use parenthesis in all evaluated expressions (Since parenthesis makes bitwise operators behave like logical operators).&lt;br /&gt;
&lt;br /&gt;
===== Using procedures =====&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;proc&amp;lt;/code&amp;gt; keyword is only valid if it appears after an &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt; statement.&lt;br /&gt;
* When calling a procedure use the procedure name followed by parenthesis (), even if the procedure has no parameters.&lt;br /&gt;
* Avoid any space between the procedure name and the parenthesis, else it will produce an error.&lt;br /&gt;
&lt;br /&gt;
===== Keyboard shortcuts =====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Key combination&lt;br /&gt;
!Effect&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-c&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;RUN STOP&amp;lt;/code&amp;gt; on the F256K&lt;br /&gt;
|Stops a listing or a running program&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-l&amp;lt;/code&amp;gt;&lt;br /&gt;
|Clears the screen&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-a&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLR/HOME&amp;lt;/code&amp;gt; on the F256K&lt;br /&gt;
|Move cursor to the first character in the current line&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-e&amp;lt;/code&amp;gt;&lt;br /&gt;
|Move cursor to the last character in the current line&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-i&amp;lt;/code&amp;gt;&lt;br /&gt;
|Move cursor 8 characters to the right &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-k&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes characters from cursor position to line end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Behaviour of load and bload =====&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;bload&amp;lt;/code&amp;gt; statement does not print &amp;lt;code&amp;gt;Completed&amp;lt;/code&amp;gt; when loading is successfull whereas &amp;lt;code&amp;gt;load&amp;lt;/code&amp;gt; does.&lt;br /&gt;
* bload can load anywhere on memory not just under the first 64k&lt;br /&gt;
* An exception is that bload can&#039;t load I/O parameters that reside in $C000 - $DFFF&lt;br /&gt;
&lt;br /&gt;
===== Control characters for cursor and colour control =====&lt;br /&gt;
In BASIC the following character codes can be used with &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt; to control the cursor position and colours on the screen.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Code&lt;br /&gt;
!Effect&lt;br /&gt;
|-&lt;br /&gt;
|chr$(12)&lt;br /&gt;
|Clear screen and set cursor to upper left corner&lt;br /&gt;
|-&lt;br /&gt;
|chr$(16)&lt;br /&gt;
|Cursor up&lt;br /&gt;
|-&lt;br /&gt;
|chr$(14)&lt;br /&gt;
|Cursor down&lt;br /&gt;
|-&lt;br /&gt;
|chr$(2)&lt;br /&gt;
|Cursor left&lt;br /&gt;
|-&lt;br /&gt;
|chr$(6)&lt;br /&gt;
|Cursor right&lt;br /&gt;
|-&lt;br /&gt;
|chr$(1)&lt;br /&gt;
|Set cursor to leftmost position in current line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(5)&lt;br /&gt;
|Set cursor to righmost position in current line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(128) - chr$(143)&lt;br /&gt;
|Set foreground color. Code 128 is black 143 is white. The rest follows the sequence given below&lt;br /&gt;
|-&lt;br /&gt;
|chr$(144) - chr$(159)&lt;br /&gt;
|Set background color. Code 144 is black 159 is white. The rest follows the sequence given below&lt;br /&gt;
|}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Colour code&lt;br /&gt;
!Colour&lt;br /&gt;
!Colour code&lt;br /&gt;
!Colour&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Black&lt;br /&gt;
|8&lt;br /&gt;
|Dark grey&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Grey&lt;br /&gt;
|9&lt;br /&gt;
|Light grey (default foreground)&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Dark blue (default background colour)&lt;br /&gt;
|10&lt;br /&gt;
|Blue&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Green&lt;br /&gt;
|11&lt;br /&gt;
|Light green&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Purple&lt;br /&gt;
|12&lt;br /&gt;
|Light purple&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Brown&lt;br /&gt;
|13&lt;br /&gt;
|Red&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Orange&lt;br /&gt;
|14&lt;br /&gt;
|Yellow&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|Light blue&lt;br /&gt;
|15&lt;br /&gt;
|White&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Character Set =====&lt;br /&gt;
&lt;br /&gt;
* Access to the full character set can be obtained by using the &amp;lt;code&amp;gt;CPRINT&amp;lt;/code&amp;gt; command instead of the normal &amp;lt;code&amp;gt;PRINT&amp;lt;/code&amp;gt; command.&lt;br /&gt;
* Characters can also be set on the screen text matrix using the &amp;lt;code&amp;gt;POKE&amp;lt;/code&amp;gt; command starting at &amp;lt;code&amp;gt;$C000&amp;lt;/code&amp;gt; providing the MMU I/O control is set to 2 by executing a &amp;lt;code&amp;gt;POKE 1,2&amp;lt;/code&amp;gt; command first (remember to restore the MMU I/O once you&#039;re done).&lt;br /&gt;
[[File:Full char set.png|thumb|104x104px|F256 Character Set|none]]&lt;br /&gt;
* Color can also be set on the screen color matrix using the &amp;lt;code&amp;gt;POKE&amp;lt;/code&amp;gt; command starting at &amp;lt;code&amp;gt;$C000&amp;lt;/code&amp;gt; providing the MMU I?O control is set to 3 by executing a &amp;lt;code&amp;gt;POKE 1,3&amp;lt;/code&amp;gt; command first (remember to restore the MMU I/O once you&#039;re done).&lt;br /&gt;
* When poking colors on the screen, the low nibble is the background color and the high nibble is the character color.&lt;br /&gt;
&lt;br /&gt;
[[File:Colormatrix.png|alt=Default Colors|thumb|100x100px|Default Colors|none]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Memcopy lockup =====&lt;br /&gt;
&lt;br /&gt;
* In certain situations the &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;memcopy&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; command can lockup.&lt;br /&gt;
* A machine language utility that performs the same function as &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; is available if &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; fails.&lt;br /&gt;
* &amp;lt;u&amp;gt;mlcopy&amp;lt;/u&amp;gt; is a short routine that replaces &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; and is more reliable. It can be loaded into memory with a BLOAD command in your program, or with a basic loader that can be added to your program.&lt;br /&gt;
* In place of the &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; command you would use 3 &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;POKEL&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; commands and a &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CALL&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; command to engage the DMA engine.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0903,data source&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0906,destination&amp;lt;/code&amp;gt; &lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0909,number of bytes to copy&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;CALL $0900&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/mcassera/F256-mlcopy mlcopy github page]&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=452</id>
		<title>SuperBASIC</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=452"/>
		<updated>2024-08-22T00:04:06Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: Added Character set information&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SuperBASIC is inspired by BBC BASIC but offers quite a bit more.&lt;br /&gt;
* [https://github.com/FoenixRetro/f256-superbasic/blob/main/reference/source/f256jr_basic_ref.pdf SuperBASIC Reference Manual].&lt;br /&gt;
* [[SuperBASIC Memory Map]]&lt;br /&gt;
* Watch EMWhite&#039;s excellent intro series on YouTube: [https://www.youtube.com/playlist?list=PLeHjTvk7NPiSqGz4REMH-S4hjYpLS2YNR Full Playlist].&lt;br /&gt;
&lt;br /&gt;
=== An informal list of tips, &amp;quot;gotchas&amp;quot;: ===&lt;br /&gt;
&lt;br /&gt;
===== IF, THEN, ELSE =====&lt;br /&gt;
&lt;br /&gt;
====== Source of this tip: Ernesto ======&lt;br /&gt;
* A regular &amp;lt;code&amp;gt;if then&amp;lt;/code&amp;gt; condition can&#039;t contain an &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt; statement, as in this example: &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0 then x=10&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you need to do an  &amp;lt;code&amp;gt;if then else&amp;lt;/code&amp;gt; structure,  you actually have to do an &amp;lt;code&amp;gt;if else endif&amp;lt;/code&amp;gt; structure like in the following example,  skipping the &amp;lt;code&amp;gt;then&amp;lt;/code&amp;gt; statement. &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0&amp;lt;br /&amp;gt;&lt;br /&gt;
20     x=1&amp;lt;br /&amp;gt;&lt;br /&gt;
30     else&amp;lt;br /&amp;gt;&lt;br /&gt;
40     x=2&amp;lt;br /&amp;gt;&lt;br /&gt;
50 endif&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you do it in one line it needs to have some colons added, making it look weird like this: &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0:x=1:else:x=2:endif&amp;lt;/code&amp;gt;&lt;br /&gt;
* if you dare to omit the &amp;lt;code&amp;gt;endif&amp;lt;/code&amp;gt;  thinking that the &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement won&#039;t need it, (mmm.., everything is in one line, so no need, right?) -Nope...all hell breaks loose!- &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0:x=1:else:x=2: REM &amp;quot;&amp;lt;-- Error, omited the endif&amp;quot;&amp;lt;/code&amp;gt; &lt;br /&gt;
* be careful not to add an extra  &amp;lt;code&amp;gt;then&amp;lt;/code&amp;gt; statement by mistake to an &amp;lt;code&amp;gt;if else endif&amp;lt;/code&amp;gt; structure, if you do -All hell breaks loose again!!- &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0 then  : rem &amp;quot;&amp;lt;-- Error, THEN is not needed!!!&amp;quot; &amp;lt;br /&amp;gt;&lt;br /&gt;
20     x=1 &amp;lt;br /&amp;gt;&lt;br /&gt;
30     else &amp;lt;br /&amp;gt;&lt;br /&gt;
40     x=2 &amp;lt;br /&amp;gt;&lt;br /&gt;
50 endif&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Debugging hint: If you encounter an error like &amp;quot;open structure&amp;quot; or &amp;quot;endproc without a proc&amp;quot;: do not trust the line number that you are given. The root of the problem is probably in a structure earlier on in the code.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===== Evaluating multiple conditions in IF statements =====&lt;br /&gt;
SUPERBASIC doesn&#039;t have the dedicated keywords AND , OR so you have to use the bitwise operators to evaluate multiple conditions, please consider the following examples:&lt;br /&gt;
&lt;br /&gt;
* AND  &amp;lt;code&amp;gt;if (a=1)&amp;amp;(b=2) then c=1&amp;lt;/code&amp;gt;&lt;br /&gt;
* OR   &amp;lt;code&amp;gt;if (a=1)^(b=2) then c=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should work as long as you use parenthesis in all evaluated expressions (Since parenthesis makes bitwise operators behave like logical operators).&lt;br /&gt;
&lt;br /&gt;
===== Using procedures =====&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;proc&amp;lt;/code&amp;gt; keyword is only valid if it appears after an &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt; statement.&lt;br /&gt;
* When calling a procedure use the procedure name followed by parenthesis (), even if the procedure has no parameters.&lt;br /&gt;
* Avoid any space between the procedure name and the parenthesis, else it will produce an error.&lt;br /&gt;
&lt;br /&gt;
===== Keyboard shortcuts =====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Key combination&lt;br /&gt;
!Effect&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-c&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;RUN STOP&amp;lt;/code&amp;gt; on the F256K&lt;br /&gt;
|Stops a listing or a running program&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-l&amp;lt;/code&amp;gt;&lt;br /&gt;
|Clears the screen&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-a&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLR/HOME&amp;lt;/code&amp;gt; on the F256K&lt;br /&gt;
|Move cursor to the first character in the current line&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-e&amp;lt;/code&amp;gt;&lt;br /&gt;
|Move cursor to the last character in the current line&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-i&amp;lt;/code&amp;gt;&lt;br /&gt;
|Move cursor 8 characters to the right &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-k&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes characters from cursor position to line end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Behaviour of load and bload =====&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;bload&amp;lt;/code&amp;gt; statement does not print &amp;lt;code&amp;gt;Completed&amp;lt;/code&amp;gt; when loading is successfull whereas &amp;lt;code&amp;gt;load&amp;lt;/code&amp;gt; does.&lt;br /&gt;
* bload can load anywhere on memory not just under the first 64k&lt;br /&gt;
* An exception is that bload can&#039;t load I/O parameters that reside in $C000 - $DFFF&lt;br /&gt;
&lt;br /&gt;
===== Control characters for cursor and colour control =====&lt;br /&gt;
In BASIC the following character codes can be used with &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt; to control the cursor position and colours on the screen.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Code&lt;br /&gt;
!Effect&lt;br /&gt;
|-&lt;br /&gt;
|chr$(12)&lt;br /&gt;
|Clear screen and set cursor to upper left corner&lt;br /&gt;
|-&lt;br /&gt;
|chr$(16)&lt;br /&gt;
|Cursor up&lt;br /&gt;
|-&lt;br /&gt;
|chr$(14)&lt;br /&gt;
|Cursor down&lt;br /&gt;
|-&lt;br /&gt;
|chr$(2)&lt;br /&gt;
|Cursor left&lt;br /&gt;
|-&lt;br /&gt;
|chr$(6)&lt;br /&gt;
|Cursor right&lt;br /&gt;
|-&lt;br /&gt;
|chr$(1)&lt;br /&gt;
|Set cursor to leftmost position in current line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(5)&lt;br /&gt;
|Set cursor to righmost position in current line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(128) - chr$(143)&lt;br /&gt;
|Set foreground color. Code 128 is black 143 is white. The rest follows the sequence given below&lt;br /&gt;
|-&lt;br /&gt;
|chr$(144) - chr$(159)&lt;br /&gt;
|Set background color. Code 144 is black 159 is white. The rest follows the sequence given below&lt;br /&gt;
|}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Colour code&lt;br /&gt;
!Colour&lt;br /&gt;
!Colour code&lt;br /&gt;
!Colour&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Black&lt;br /&gt;
|8&lt;br /&gt;
|Dark grey&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Grey&lt;br /&gt;
|9&lt;br /&gt;
|Light grey (default foreground)&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Dark blue (default background colour)&lt;br /&gt;
|10&lt;br /&gt;
|Blue&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Green&lt;br /&gt;
|11&lt;br /&gt;
|Light green&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Purple&lt;br /&gt;
|12&lt;br /&gt;
|Light purple&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Brown&lt;br /&gt;
|13&lt;br /&gt;
|Red&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Orange&lt;br /&gt;
|14&lt;br /&gt;
|Yellow&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|Light blue&lt;br /&gt;
|15&lt;br /&gt;
|White&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Character Set =====&lt;br /&gt;
&lt;br /&gt;
* Access to the full character set can be obtained by using the &amp;lt;code&amp;gt;CPRINT&amp;lt;/code&amp;gt; command instead of the normal &amp;lt;code&amp;gt;PRINT&amp;lt;/code&amp;gt; command.&lt;br /&gt;
* Characters can also be set on the screen text matrix using the &amp;lt;code&amp;gt;POKE&amp;lt;/code&amp;gt; command starting at $C000 providing the MMU I/O control is set to 2 by executing a POKE 1,2 command first (remember to restore the MMU I/O once you&#039;re done).[[File:Full char set.png|left|thumb|104x104px|F256 Character Set]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Color can also be set on the screen color matrix using the POKE command starting at $C000 providing the MMU I?O control is set to 3 by executing a POKE 1,3 command first (remember to restore the MMU I/O once you&#039;re done).&lt;br /&gt;
* When poking colors on the screen, the high nibble is the background color and the low nibble is the character color.&lt;br /&gt;
&lt;br /&gt;
[[File:Colormatrix.png|alt=Default Colors|left|thumb|100x100px|Default Colors]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===== Memcopy lockup =====&lt;br /&gt;
&lt;br /&gt;
* In certain situations the &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;memcopy&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; command can lockup.&lt;br /&gt;
* A machine language utility that performs the same function as &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; is available if &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; fails.&lt;br /&gt;
* &amp;lt;u&amp;gt;mlcopy&amp;lt;/u&amp;gt; is a short routine that replaces &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; and is more reliable. It can be loaded into memory with a BLOAD command in your program, or with a basic loader that can be added to your program.&lt;br /&gt;
* In place of the &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; command you would use 3 &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;POKEL&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; commands and a &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CALL&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; command to engage the DMA engine.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0903,data source&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0906,destination&amp;lt;/code&amp;gt; &lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0909,number of bytes to copy&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;CALL $0900&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/mcassera/F256-mlcopy mlcopy github page]&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=File:Colormatrix.png&amp;diff=451</id>
		<title>File:Colormatrix.png</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=File:Colormatrix.png&amp;diff=451"/>
		<updated>2024-08-22T00:01:19Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Color matrix of the default colors on the F256 computer&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=File:Full_char_set.png&amp;diff=450</id>
		<title>File:Full char set.png</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=File:Full_char_set.png&amp;diff=450"/>
		<updated>2024-08-21T23:40:49Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;F256 Character set&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=449</id>
		<title>SuperBASIC</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=449"/>
		<updated>2024-08-21T23:39:28Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SuperBASIC is inspired by BBC BASIC but offers quite a bit more.&lt;br /&gt;
* [https://github.com/FoenixRetro/f256-superbasic/blob/main/reference/source/f256jr_basic_ref.pdf SuperBASIC Reference Manual].&lt;br /&gt;
* [[SuperBASIC Memory Map]]&lt;br /&gt;
* Watch EMWhite&#039;s excellent intro series on YouTube: [https://www.youtube.com/playlist?list=PLeHjTvk7NPiSqGz4REMH-S4hjYpLS2YNR Full Playlist].&lt;br /&gt;
&lt;br /&gt;
=== An informal list of tips, &amp;quot;gotchas&amp;quot;: ===&lt;br /&gt;
&lt;br /&gt;
===== IF, THEN, ELSE =====&lt;br /&gt;
&lt;br /&gt;
====== Source of this tip: Ernesto ======&lt;br /&gt;
* A regular &amp;lt;code&amp;gt;if then&amp;lt;/code&amp;gt; condition can&#039;t contain an &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt; statement, as in this example: &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0 then x=10&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you need to do an  &amp;lt;code&amp;gt;if then else&amp;lt;/code&amp;gt; structure,  you actually have to do an &amp;lt;code&amp;gt;if else endif&amp;lt;/code&amp;gt; structure like in the following example,  skipping the &amp;lt;code&amp;gt;then&amp;lt;/code&amp;gt; statement. &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0&amp;lt;br /&amp;gt;&lt;br /&gt;
20     x=1&amp;lt;br /&amp;gt;&lt;br /&gt;
30     else&amp;lt;br /&amp;gt;&lt;br /&gt;
40     x=2&amp;lt;br /&amp;gt;&lt;br /&gt;
50 endif&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you do it in one line it needs to have some colons added, making it look weird like this: &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0:x=1:else:x=2:endif&amp;lt;/code&amp;gt;&lt;br /&gt;
* if you dare to omit the &amp;lt;code&amp;gt;endif&amp;lt;/code&amp;gt;  thinking that the &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement won&#039;t need it, (mmm.., everything is in one line, so no need, right?) -Nope...all hell breaks loose!- &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0:x=1:else:x=2: REM &amp;quot;&amp;lt;-- Error, omited the endif&amp;quot;&amp;lt;/code&amp;gt; &lt;br /&gt;
* be careful not to add an extra  &amp;lt;code&amp;gt;then&amp;lt;/code&amp;gt; statement by mistake to an &amp;lt;code&amp;gt;if else endif&amp;lt;/code&amp;gt; structure, if you do -All hell breaks loose again!!- &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0 then  : rem &amp;quot;&amp;lt;-- Error, THEN is not needed!!!&amp;quot; &amp;lt;br /&amp;gt;&lt;br /&gt;
20     x=1 &amp;lt;br /&amp;gt;&lt;br /&gt;
30     else &amp;lt;br /&amp;gt;&lt;br /&gt;
40     x=2 &amp;lt;br /&amp;gt;&lt;br /&gt;
50 endif&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Debugging hint: If you encounter an error like &amp;quot;open structure&amp;quot; or &amp;quot;endproc without a proc&amp;quot;: do not trust the line number that you are given. The root of the problem is probably in a structure earlier on in the code.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===== Evaluating multiple conditions in IF statements =====&lt;br /&gt;
SUPERBASIC doesn&#039;t have the dedicated keywords AND , OR so you have to use the bitwise operators to evaluate multiple conditions, please consider the following examples:&lt;br /&gt;
&lt;br /&gt;
* AND  &amp;lt;code&amp;gt;if (a=1)&amp;amp;(b=2) then c=1&amp;lt;/code&amp;gt;&lt;br /&gt;
* OR   &amp;lt;code&amp;gt;if (a=1)^(b=2) then c=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should work as long as you use parenthesis in all evaluated expressions (Since parenthesis makes bitwise operators behave like logical operators).&lt;br /&gt;
&lt;br /&gt;
===== Using procedures =====&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;proc&amp;lt;/code&amp;gt; keyword is only valid if it appears after an &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt; statement.&lt;br /&gt;
* When calling a procedure use the procedure name followed by parenthesis (), even if the procedure has no parameters.&lt;br /&gt;
* Avoid any space between the procedure name and the parenthesis, else it will produce an error.&lt;br /&gt;
&lt;br /&gt;
===== Keyboard shortcuts =====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Key combination&lt;br /&gt;
!Effect&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-c&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;RUN STOP&amp;lt;/code&amp;gt; on the F256K&lt;br /&gt;
|Stops a listing or a running program&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-l&amp;lt;/code&amp;gt;&lt;br /&gt;
|Clears the screen&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-a&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLR/HOME&amp;lt;/code&amp;gt; on the F256K&lt;br /&gt;
|Move cursor to the first character in the current line&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-e&amp;lt;/code&amp;gt;&lt;br /&gt;
|Move cursor to the last character in the current line&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-i&amp;lt;/code&amp;gt;&lt;br /&gt;
|Move cursor 8 characters to the right &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-k&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes characters from cursor position to line end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Behaviour of load and bload =====&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;bload&amp;lt;/code&amp;gt; statement does not print &amp;lt;code&amp;gt;Completed&amp;lt;/code&amp;gt; when loading is successfull whereas &amp;lt;code&amp;gt;load&amp;lt;/code&amp;gt; does.&lt;br /&gt;
* bload can load anywhere on memory not just under the first 64k&lt;br /&gt;
* An exception is that bload can&#039;t load I/O parameters that reside in $C000 - $DFFF&lt;br /&gt;
&lt;br /&gt;
===== Control characters for cursor and colour control =====&lt;br /&gt;
In BASIC the following character codes can be used with &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt; to control the cursor position and colours on the screen.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Code&lt;br /&gt;
!Effect&lt;br /&gt;
|-&lt;br /&gt;
|chr$(12)&lt;br /&gt;
|Clear screen and set cursor to upper left corner&lt;br /&gt;
|-&lt;br /&gt;
|chr$(16)&lt;br /&gt;
|Cursor up&lt;br /&gt;
|-&lt;br /&gt;
|chr$(14)&lt;br /&gt;
|Cursor down&lt;br /&gt;
|-&lt;br /&gt;
|chr$(2)&lt;br /&gt;
|Cursor left&lt;br /&gt;
|-&lt;br /&gt;
|chr$(6)&lt;br /&gt;
|Cursor right&lt;br /&gt;
|-&lt;br /&gt;
|chr$(1)&lt;br /&gt;
|Set cursor to leftmost position in current line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(5)&lt;br /&gt;
|Set cursor to righmost position in current line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(128) - chr$(143)&lt;br /&gt;
|Set foreground color. Code 128 is black 143 is white. The rest follows the sequence given below&lt;br /&gt;
|-&lt;br /&gt;
|chr$(144) - chr$(159)&lt;br /&gt;
|Set background color. Code 144 is black 159 is white. The rest follows the sequence given below&lt;br /&gt;
|}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Colour code&lt;br /&gt;
!Colour&lt;br /&gt;
!Colour code&lt;br /&gt;
!Colour&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Black&lt;br /&gt;
|8&lt;br /&gt;
|Dark grey&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Grey&lt;br /&gt;
|9&lt;br /&gt;
|Light grey (default foreground)&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Dark blue (default background colour)&lt;br /&gt;
|10&lt;br /&gt;
|Blue&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Green&lt;br /&gt;
|11&lt;br /&gt;
|Light green&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Purple&lt;br /&gt;
|12&lt;br /&gt;
|Light purple&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Brown&lt;br /&gt;
|13&lt;br /&gt;
|Red&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Orange&lt;br /&gt;
|14&lt;br /&gt;
|Yellow&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|Light blue&lt;br /&gt;
|15&lt;br /&gt;
|White&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Character Set =====&lt;br /&gt;
&lt;br /&gt;
===== Memcopy lockup =====&lt;br /&gt;
&lt;br /&gt;
* In certain situations the &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;memcopy&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; command can lockup.&lt;br /&gt;
* A machine language utility that performs the same function as &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; is available if &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; fails.&lt;br /&gt;
* &amp;lt;u&amp;gt;mlcopy&amp;lt;/u&amp;gt; is a short routine that replaces &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; and is more reliable. It can be loaded into memory with a BLOAD command in your program, or with a basic loader that can be added to your program.&lt;br /&gt;
* In place of the &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; command you would use 3 &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;POKEL&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; commands and a &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CALL&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; command to engage the DMA engine.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0903,data source&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0906,destination&amp;lt;/code&amp;gt; &lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0909,number of bytes to copy&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;CALL $0900&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/mcassera/F256-mlcopy mlcopy github page]&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=448</id>
		<title>SuperBASIC</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=448"/>
		<updated>2024-08-21T19:49:32Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SuperBASIC is inspired by BBC BASIC but offers quite a bit more.&lt;br /&gt;
* [https://github.com/FoenixRetro/f256-superbasic/blob/main/reference/source/f256jr_basic_ref.pdf SuperBASIC Reference Manual].&lt;br /&gt;
* [[SuperBASIC Memory Map]]&lt;br /&gt;
* Watch EMWhite&#039;s excellent intro series on YouTube: [https://www.youtube.com/playlist?list=PLeHjTvk7NPiSqGz4REMH-S4hjYpLS2YNR Full Playlist].&lt;br /&gt;
&lt;br /&gt;
=== An informal list of tips, &amp;quot;gotchas&amp;quot;: ===&lt;br /&gt;
&lt;br /&gt;
===== IF, THEN, ELSE =====&lt;br /&gt;
&lt;br /&gt;
====== Source of this tip: Ernesto ======&lt;br /&gt;
* A regular &amp;lt;code&amp;gt;if then&amp;lt;/code&amp;gt; condition can&#039;t contain an &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt; statement, as in this example: &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0 then x=10&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you need to do an  &amp;lt;code&amp;gt;if then else&amp;lt;/code&amp;gt; structure,  you actually have to do an &amp;lt;code&amp;gt;if else endif&amp;lt;/code&amp;gt; structure like in the following example,  skipping the &amp;lt;code&amp;gt;then&amp;lt;/code&amp;gt; statement. &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0&amp;lt;br /&amp;gt;&lt;br /&gt;
20     x=1&amp;lt;br /&amp;gt;&lt;br /&gt;
30     else&amp;lt;br /&amp;gt;&lt;br /&gt;
40     x=2&amp;lt;br /&amp;gt;&lt;br /&gt;
50 endif&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you do it in one line it needs to have some colons added, making it look weird like this: &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0:x=1:else:x=2:endif&amp;lt;/code&amp;gt;&lt;br /&gt;
* if you dare to omit the &amp;lt;code&amp;gt;endif&amp;lt;/code&amp;gt;  thinking that the &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement won&#039;t need it, (mmm.., everything is in one line, so no need, right?) -Nope...all hell breaks loose!- &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0:x=1:else:x=2: REM &amp;quot;&amp;lt;-- Error, omited the endif&amp;quot;&amp;lt;/code&amp;gt; &lt;br /&gt;
* be careful not to add an extra  &amp;lt;code&amp;gt;then&amp;lt;/code&amp;gt; statement by mistake to an &amp;lt;code&amp;gt;if else endif&amp;lt;/code&amp;gt; structure, if you do -All hell breaks loose again!!- &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0 then  : rem &amp;quot;&amp;lt;-- Error, THEN is not needed!!!&amp;quot; &amp;lt;br /&amp;gt;&lt;br /&gt;
20     x=1 &amp;lt;br /&amp;gt;&lt;br /&gt;
30     else &amp;lt;br /&amp;gt;&lt;br /&gt;
40     x=2 &amp;lt;br /&amp;gt;&lt;br /&gt;
50 endif&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Debugging hint: If you encounter an error like &amp;quot;open structure&amp;quot; or &amp;quot;endproc without a proc&amp;quot;: do not trust the line number that you are given. The root of the problem is probably in a structure earlier on in the code.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===== Evaluating multiple conditions in IF statements =====&lt;br /&gt;
SUPERBASIC doesn&#039;t have the dedicated keywords AND , OR so you have to use the bitwise operators to evaluate multiple conditions, please consider the following examples:&lt;br /&gt;
&lt;br /&gt;
* AND  &amp;lt;code&amp;gt;if (a=1)&amp;amp;(b=2) then c=1&amp;lt;/code&amp;gt;&lt;br /&gt;
* OR   &amp;lt;code&amp;gt;if (a=1)^(b=2) then c=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should work as long as you use parenthesis in all evaluated expressions (Since parenthesis makes bitwise operators behave like logical operators).&lt;br /&gt;
&lt;br /&gt;
===== Using procedures =====&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;proc&amp;lt;/code&amp;gt; keyword is only valid if it appears after an &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt; statement.&lt;br /&gt;
* When calling a procedure use the procedure name followed by parenthesis (), even if the procedure has no parameters.&lt;br /&gt;
* Avoid any space between the procedure name and the parenthesis, else it will produce an error.&lt;br /&gt;
&lt;br /&gt;
===== Keyboard shortcuts =====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Key combination&lt;br /&gt;
!Effect&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-c&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;RUN STOP&amp;lt;/code&amp;gt; on the F256K&lt;br /&gt;
|Stops a listing or a running program&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-l&amp;lt;/code&amp;gt;&lt;br /&gt;
|Clears the screen&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-a&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLR/HOME&amp;lt;/code&amp;gt; on the F256K&lt;br /&gt;
|Move cursor to the first character in the current line&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-e&amp;lt;/code&amp;gt;&lt;br /&gt;
|Move cursor to the last character in the current line&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-i&amp;lt;/code&amp;gt;&lt;br /&gt;
|Move cursor 8 characters to the right &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-k&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes characters from cursor position to line end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Behaviour of load and bload =====&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;bload&amp;lt;/code&amp;gt; statement does not print &amp;lt;code&amp;gt;Completed&amp;lt;/code&amp;gt; when loading is successfull whereas &amp;lt;code&amp;gt;load&amp;lt;/code&amp;gt; does.&lt;br /&gt;
* bload can load anywhere on memory not just under the first 64k&lt;br /&gt;
* An exception is that bload can&#039;t load I/O parameters that reside in $C000 - $DFFF&lt;br /&gt;
&lt;br /&gt;
===== Control characters for cursor and colour control =====&lt;br /&gt;
In BASIC the following character codes can be used with &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt; to control the cursor position and colours on the screen.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Code&lt;br /&gt;
!Effect&lt;br /&gt;
|-&lt;br /&gt;
|chr$(12)&lt;br /&gt;
|Clear screen and set cursor to upper left corner&lt;br /&gt;
|-&lt;br /&gt;
|chr$(16)&lt;br /&gt;
|Cursor up&lt;br /&gt;
|-&lt;br /&gt;
|chr$(14)&lt;br /&gt;
|Cursor down&lt;br /&gt;
|-&lt;br /&gt;
|chr$(2)&lt;br /&gt;
|Cursor left&lt;br /&gt;
|-&lt;br /&gt;
|chr$(6)&lt;br /&gt;
|Cursor right&lt;br /&gt;
|-&lt;br /&gt;
|chr$(1)&lt;br /&gt;
|Set cursor to leftmost position in current line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(5)&lt;br /&gt;
|Set cursor to righmost position in current line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(128) - chr$(143)&lt;br /&gt;
|Set foreground color. Code 128 is black 143 is white. The rest follows the sequence given below&lt;br /&gt;
|-&lt;br /&gt;
|chr$(144) - chr$(159)&lt;br /&gt;
|Set background color. Code 144 is black 159 is white. The rest follows the sequence given below&lt;br /&gt;
|}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Colour code&lt;br /&gt;
!Colour&lt;br /&gt;
!Colour code&lt;br /&gt;
!Colour&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Black&lt;br /&gt;
|8&lt;br /&gt;
|Dark grey&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Grey&lt;br /&gt;
|9&lt;br /&gt;
|Light grey (default foreground)&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Dark blue (default background colour)&lt;br /&gt;
|10&lt;br /&gt;
|Blue&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Green&lt;br /&gt;
|11&lt;br /&gt;
|Light green&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Purple&lt;br /&gt;
|12&lt;br /&gt;
|Light purple&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Brown&lt;br /&gt;
|13&lt;br /&gt;
|Red&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Orange&lt;br /&gt;
|14&lt;br /&gt;
|Yellow&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|Light blue&lt;br /&gt;
|15&lt;br /&gt;
|White&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Memcopy lockup =====&lt;br /&gt;
&lt;br /&gt;
* In certain situations the &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;memcopy&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; command can lockup.&lt;br /&gt;
* A machine language utility that performs the same function as &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; is available if &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; fails.&lt;br /&gt;
* &amp;lt;u&amp;gt;mlcopy&amp;lt;/u&amp;gt; is a short routine that replaces &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; and is more reliable. It can be loaded into memory with a BLOAD command in your program, or with a basic loader that can be added to your program.&lt;br /&gt;
* In place of the &amp;lt;code&amp;gt;memcopy&amp;lt;/code&amp;gt; command you would use 3 &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;POKEL&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; commands and a &amp;lt;code&amp;gt;&amp;lt;big&amp;gt;CALL&amp;lt;/big&amp;gt;&amp;lt;/code&amp;gt; command to engage the DMA engine.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0903,data source&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0906,destination&amp;lt;/code&amp;gt; &lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0909,number of bytes to copy&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;CALL $0900&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/mcassera/F256-mlcopy mlcopy github page]&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=447</id>
		<title>SuperBASIC</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=447"/>
		<updated>2024-08-21T19:44:37Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: Added memcopy lockup section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SuperBASIC is inspired by BBC BASIC but offers quite a bit more.&lt;br /&gt;
* [https://github.com/FoenixRetro/f256-superbasic/blob/main/reference/source/f256jr_basic_ref.pdf SuperBASIC Reference Manual].&lt;br /&gt;
* [[SuperBASIC Memory Map]]&lt;br /&gt;
* Watch EMWhite&#039;s excellent intro series on YouTube: [https://www.youtube.com/playlist?list=PLeHjTvk7NPiSqGz4REMH-S4hjYpLS2YNR Full Playlist].&lt;br /&gt;
&lt;br /&gt;
=== An informal list of tips, &amp;quot;gotchas&amp;quot;: ===&lt;br /&gt;
&lt;br /&gt;
===== IF, THEN, ELSE =====&lt;br /&gt;
&lt;br /&gt;
====== Source of this tip: Ernesto ======&lt;br /&gt;
* A regular &amp;lt;code&amp;gt;if then&amp;lt;/code&amp;gt; condition can&#039;t contain an &amp;lt;code&amp;gt;else&amp;lt;/code&amp;gt; statement, as in this example: &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0 then x=10&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you need to do an  &amp;lt;code&amp;gt;if then else&amp;lt;/code&amp;gt; structure,  you actually have to do an &amp;lt;code&amp;gt;if else endif&amp;lt;/code&amp;gt; structure like in the following example,  skipping the &amp;lt;code&amp;gt;then&amp;lt;/code&amp;gt; statement. &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0&amp;lt;br /&amp;gt;&lt;br /&gt;
20     x=1&amp;lt;br /&amp;gt;&lt;br /&gt;
30     else&amp;lt;br /&amp;gt;&lt;br /&gt;
40     x=2&amp;lt;br /&amp;gt;&lt;br /&gt;
50 endif&amp;lt;/code&amp;gt;&lt;br /&gt;
* If you do it in one line it needs to have some colons added, making it look weird like this: &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0:x=1:else:x=2:endif&amp;lt;/code&amp;gt;&lt;br /&gt;
* if you dare to omit the &amp;lt;code&amp;gt;endif&amp;lt;/code&amp;gt;  thinking that the &amp;lt;code&amp;gt;if&amp;lt;/code&amp;gt; statement won&#039;t need it, (mmm.., everything is in one line, so no need, right?) -Nope...all hell breaks loose!- &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0:x=1:else:x=2: REM &amp;quot;&amp;lt;-- Error, omited the endif&amp;quot;&amp;lt;/code&amp;gt; &lt;br /&gt;
* be careful not to add an extra  &amp;lt;code&amp;gt;then&amp;lt;/code&amp;gt; statement by mistake to an &amp;lt;code&amp;gt;if else endif&amp;lt;/code&amp;gt; structure, if you do -All hell breaks loose again!!- &lt;br /&gt;
&amp;lt;code&amp;gt;10 if a=0 then  : rem &amp;quot;&amp;lt;-- Error, THEN is not needed!!!&amp;quot; &amp;lt;br /&amp;gt;&lt;br /&gt;
20     x=1 &amp;lt;br /&amp;gt;&lt;br /&gt;
30     else &amp;lt;br /&amp;gt;&lt;br /&gt;
40     x=2 &amp;lt;br /&amp;gt;&lt;br /&gt;
50 endif&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Debugging hint: If you encounter an error like &amp;quot;open structure&amp;quot; or &amp;quot;endproc without a proc&amp;quot;: do not trust the line number that you are given. The root of the problem is probably in a structure earlier on in the code.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===== Evaluating multiple conditions in IF statements =====&lt;br /&gt;
SUPERBASIC doesn&#039;t have the dedicated keywords AND , OR so you have to use the bitwise operators to evaluate multiple conditions, please consider the following examples:&lt;br /&gt;
&lt;br /&gt;
* AND  &amp;lt;code&amp;gt;if (a=1)&amp;amp;(b=2) then c=1&amp;lt;/code&amp;gt;&lt;br /&gt;
* OR   &amp;lt;code&amp;gt;if (a=1)^(b=2) then c=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should work as long as you use parenthesis in all evaluated expressions (Since parenthesis makes bitwise operators behave like logical operators).&lt;br /&gt;
&lt;br /&gt;
===== Using procedures =====&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;proc&amp;lt;/code&amp;gt; keyword is only valid if it appears after an &amp;lt;code&amp;gt;end&amp;lt;/code&amp;gt; statement.&lt;br /&gt;
* When calling a procedure use the procedure name followed by parenthesis (), even if the procedure has no parameters.&lt;br /&gt;
* Avoid any space between the procedure name and the parenthesis, else it will produce an error.&lt;br /&gt;
&lt;br /&gt;
===== Keyboard shortcuts =====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Key combination&lt;br /&gt;
!Effect&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-c&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;RUN STOP&amp;lt;/code&amp;gt; on the F256K&lt;br /&gt;
|Stops a listing or a running program&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-l&amp;lt;/code&amp;gt;&lt;br /&gt;
|Clears the screen&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-a&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;CLR/HOME&amp;lt;/code&amp;gt; on the F256K&lt;br /&gt;
|Move cursor to the first character in the current line&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-e&amp;lt;/code&amp;gt;&lt;br /&gt;
|Move cursor to the last character in the current line&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-i&amp;lt;/code&amp;gt;&lt;br /&gt;
|Move cursor 8 characters to the right &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ctrl-k&amp;lt;/code&amp;gt;&lt;br /&gt;
|Deletes characters from cursor position to line end&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Behaviour of load and bload =====&lt;br /&gt;
&lt;br /&gt;
* The &amp;lt;code&amp;gt;bload&amp;lt;/code&amp;gt; statement does not print &amp;lt;code&amp;gt;Completed&amp;lt;/code&amp;gt; when loading is successfull whereas &amp;lt;code&amp;gt;load&amp;lt;/code&amp;gt; does.&lt;br /&gt;
* bload can load anywhere on memory not just under the first 64k&lt;br /&gt;
* An exception is that bload can&#039;t load I/O parameters that reside in $C000 - $DFFF&lt;br /&gt;
&lt;br /&gt;
===== Control characters for cursor and colour control =====&lt;br /&gt;
In BASIC the following character codes can be used with &amp;lt;code&amp;gt;print&amp;lt;/code&amp;gt; to control the cursor position and colours on the screen.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Code&lt;br /&gt;
!Effect&lt;br /&gt;
|-&lt;br /&gt;
|chr$(12)&lt;br /&gt;
|Clear screen and set cursor to upper left corner&lt;br /&gt;
|-&lt;br /&gt;
|chr$(16)&lt;br /&gt;
|Cursor up&lt;br /&gt;
|-&lt;br /&gt;
|chr$(14)&lt;br /&gt;
|Cursor down&lt;br /&gt;
|-&lt;br /&gt;
|chr$(2)&lt;br /&gt;
|Cursor left&lt;br /&gt;
|-&lt;br /&gt;
|chr$(6)&lt;br /&gt;
|Cursor right&lt;br /&gt;
|-&lt;br /&gt;
|chr$(1)&lt;br /&gt;
|Set cursor to leftmost position in current line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(5)&lt;br /&gt;
|Set cursor to righmost position in current line&lt;br /&gt;
|-&lt;br /&gt;
|chr$(128) - chr$(143)&lt;br /&gt;
|Set foreground color. Code 128 is black 143 is white. The rest follows the sequence given below&lt;br /&gt;
|-&lt;br /&gt;
|chr$(144) - chr$(159)&lt;br /&gt;
|Set background color. Code 144 is black 159 is white. The rest follows the sequence given below&lt;br /&gt;
|}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Colour code&lt;br /&gt;
!Colour&lt;br /&gt;
!Colour code&lt;br /&gt;
!Colour&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Black&lt;br /&gt;
|8&lt;br /&gt;
|Dark grey&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|Grey&lt;br /&gt;
|9&lt;br /&gt;
|Light grey (default foreground)&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|Dark blue (default background colour)&lt;br /&gt;
|10&lt;br /&gt;
|Blue&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|Green&lt;br /&gt;
|11&lt;br /&gt;
|Light green&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Purple&lt;br /&gt;
|12&lt;br /&gt;
|Light purple&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Brown&lt;br /&gt;
|13&lt;br /&gt;
|Red&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Orange&lt;br /&gt;
|14&lt;br /&gt;
|Yellow&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|Light blue&lt;br /&gt;
|15&lt;br /&gt;
|White&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Memcopy lockup =====&lt;br /&gt;
&lt;br /&gt;
* In certain situations the memcopy command can lockup.&lt;br /&gt;
* A machine language utility that performs the same function as memcopy is available if memcopy fails.&lt;br /&gt;
* mlcopy is a short routine that replaces memcopy and is more reliable. It can be loaded into memory with a bload command in your program, or with a basic loader that can be added to your program.&lt;br /&gt;
* In place of the memcopy command you would use 3 pokel cammand and a call command to engage the DMA engine.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0903,data source&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0906,destination&amp;lt;/code&amp;gt; &lt;br /&gt;
 &amp;lt;code&amp;gt;POKEL $0909,number of bytes to copy&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;CALL $0900&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/mcassera/F256-mlcopy mlcopy github page]&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Tools_%26_Scripts&amp;diff=332</id>
		<title>Tools &amp; Scripts</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Tools_%26_Scripts&amp;diff=332"/>
		<updated>2024-04-10T00:32:59Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== F256 Machines Game Development Tools ==&lt;br /&gt;
&lt;br /&gt;
=== Sprite Creation Tools &amp;amp; Scripts ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Link &lt;br /&gt;
! --- !! Notes&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;white-space:nowrap;&amp;quot;| Aseprite&lt;br /&gt;
| style=&amp;quot;white-space:nowrap;&amp;quot;| https://www.aseprite.org/&lt;br /&gt;
| &lt;br /&gt;
| style=&amp;quot;white-space:nowrap;&amp;quot; |Aseprite can be used to create sprites animation or Tiles Sets.&lt;br /&gt;
|-&lt;br /&gt;
|f256_sprite_cutter&lt;br /&gt;
|https://gist.github.com/digarok/57b096236a7fb1c76efef6cbb9f73a83&lt;br /&gt;
|&lt;br /&gt;
|Sprite cutter that cuts a PNG according to line-by-line instructions in a text file. Requires python and the PIL library, install with:&lt;br /&gt;
 python -m pip install --upgrade pip &lt;br /&gt;
&lt;br /&gt;
 python -m pip install --upgrade Pillow&lt;br /&gt;
Run with:&lt;br /&gt;
 python f256_sprite_cutter.py myimage.png mylist.txt sprites.s&lt;br /&gt;
where mylist.txt contains a series of lines containing x, y offset, width, name, where it&#039;s assumed the width is the same as the height since it&#039;s for square sprites supported for the F256xx, such as 8,16, or 32.&lt;br /&gt;
&lt;br /&gt;
The output (named sprites.s in this above example) is a series of hex instructions with a list of hex values of a color picked from the CLUT. &lt;br /&gt;
&lt;br /&gt;
In order to make it compatible with 64tass, I search replaced hex-&amp;gt; .byte and replaced every value I could find by swapping in a $ in front (ie 00 -&amp;gt; $00 and 01 -&amp;gt; $01, etc.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Scripts ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sprite &amp;amp; Tile Creation Tools &amp;amp; Scripts ===&lt;br /&gt;
If you use Aseprite, you can convert your tile drawings to tilesets and tilemaps using the following scripts:&lt;br /&gt;
&lt;br /&gt;
* [[Export Aseprite Tilemap]]&lt;br /&gt;
* [[Export Aseprite Tileset]]&lt;br /&gt;
* [[Export Aseprite Sprites]] - Will convert sprites to 64tass compatible text file.&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Tools_%26_Scripts&amp;diff=331</id>
		<title>Tools &amp; Scripts</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Tools_%26_Scripts&amp;diff=331"/>
		<updated>2024-04-10T00:29:58Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== F256 Machines Game Development Tools ==&lt;br /&gt;
&lt;br /&gt;
=== Sprite Creation Tools &amp;amp; Scripts ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Link &lt;br /&gt;
! --- !! Notes&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;white-space:nowrap;&amp;quot;| Aseprite&lt;br /&gt;
| style=&amp;quot;white-space:nowrap;&amp;quot;| https://www.aseprite.org/&lt;br /&gt;
| &lt;br /&gt;
| style=&amp;quot;white-space:nowrap;&amp;quot; |Aseprite can be used to create sprites animation or Tiles Sets.&lt;br /&gt;
|-&lt;br /&gt;
|f256_sprite_cutter&lt;br /&gt;
|https://gist.github.com/digarok/57b096236a7fb1c76efef6cbb9f73a83&lt;br /&gt;
|&lt;br /&gt;
|Sprite cutter that cuts a PNG according to line-by-line instructions in a text file. Requires python and the PIL library, install with:&lt;br /&gt;
 python -m pip install --upgrade pip &lt;br /&gt;
&lt;br /&gt;
 python -m pip install --upgrade Pillow&lt;br /&gt;
Run with:&lt;br /&gt;
 python f256_sprite_cutter.py myimage.png mylist.txt sprites.s&lt;br /&gt;
where mylist.txt contains a series of lines containing x, y offset, width, name, where it&#039;s assumed the width is the same as the height since it&#039;s for square sprites supported for the F256xx, such as 8,16, or 32.&lt;br /&gt;
&lt;br /&gt;
The output (named sprites.s in this above example) is a series of hex instructions with a list of hex values of a color picked from the CLUT. &lt;br /&gt;
&lt;br /&gt;
In order to make it compatible with 64tass, I search replaced hex-&amp;gt; .byte and replaced every value I could find by swapping in a $ in front (ie 00 -&amp;gt; $00 and 01 -&amp;gt; $01, etc.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Scripts ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sprite &amp;amp; Tile Creation Tools &amp;amp; Scripts ===&lt;br /&gt;
If you use Aseprite, you can convert your tile drawings to tilesets and tilemaps using the following scripts:&lt;br /&gt;
&lt;br /&gt;
* [[Export Aseprite Tilemap]]&lt;br /&gt;
* [[Export Aseprite Tileset]]&lt;br /&gt;
* [[Export Aseprite Sprites]] - Will convert sprites to 64Tass compatible text file.&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Tools_%26_Scripts&amp;diff=330</id>
		<title>Tools &amp; Scripts</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Tools_%26_Scripts&amp;diff=330"/>
		<updated>2024-04-10T00:27:37Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== F256 Machines Game Development Tools ==&lt;br /&gt;
&lt;br /&gt;
=== Sprite Creation Tools &amp;amp; Scripts ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Link &lt;br /&gt;
! --- !! Notes&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;white-space:nowrap;&amp;quot;| Aseprite&lt;br /&gt;
| style=&amp;quot;white-space:nowrap;&amp;quot;| https://www.aseprite.org/&lt;br /&gt;
| &lt;br /&gt;
| style=&amp;quot;white-space:nowrap;&amp;quot; |Aseprite can be used to create sprites animation or Tiles Sets.&lt;br /&gt;
|-&lt;br /&gt;
|f256_sprite_cutter&lt;br /&gt;
|https://gist.github.com/digarok/57b096236a7fb1c76efef6cbb9f73a83&lt;br /&gt;
|&lt;br /&gt;
|Sprite cutter that cuts a PNG according to line-by-line instructions in a text file. Requires python and the PIL library, install with:&lt;br /&gt;
 python -m pip install --upgrade pip &lt;br /&gt;
&lt;br /&gt;
 python -m pip install --upgrade Pillow&lt;br /&gt;
Run with:&lt;br /&gt;
 python f256_sprite_cutter.py myimage.png mylist.txt sprites.s&lt;br /&gt;
where mylist.txt contains a series of lines containing x, y offset, width, name, where it&#039;s assumed the width is the same as the height since it&#039;s for square sprites supported for the F256xx, such as 8,16, or 32.&lt;br /&gt;
&lt;br /&gt;
The output (named sprites.s in this above example) is a series of hex instructions with a list of hex values of a color picked from the CLUT. &lt;br /&gt;
&lt;br /&gt;
In order to make it compatible with 64tass, I search replaced hex-&amp;gt; .byte and replaced every value I could find by swapping in a $ in front (ie 00 -&amp;gt; $00 and 01 -&amp;gt; $01, etc.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Scripts ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sprite &amp;amp; Tile Creation Tools &amp;amp; Scripts ===&lt;br /&gt;
If you use Aseprite, you can convert your tile drawings to tilesets and tilemaps using the following scripts:&lt;br /&gt;
&lt;br /&gt;
* [[Export Aseprite Tilemap]]&lt;br /&gt;
* [[Export Aseprite Tileset]]&lt;br /&gt;
* [[Export Aseprite Sprites]]&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Export_Aseprite_Sprites&amp;diff=329</id>
		<title>Export Aseprite Sprites</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Export_Aseprite_Sprites&amp;diff=329"/>
		<updated>2024-04-10T00:19:21Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;====== &#039;&#039;&#039;This LUA script file needs to be placed in Aseprite&#039;s &amp;quot;scripts&amp;quot; folder.&#039;&#039;&#039; ======&lt;br /&gt;
 -- export_sprite_256.lua&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;local sprite = app.sprite&lt;br /&gt;
  &lt;br /&gt;
  -- Check constraints&lt;br /&gt;
  if sprite == nil then&lt;br /&gt;
    app.alert(&amp;quot;No Sprite...&amp;quot;)&lt;br /&gt;
    return&lt;br /&gt;
  end&lt;br /&gt;
  if sprite.colorMode ~= ColorMode.INDEXED then&lt;br /&gt;
    app.alert(&amp;quot;Sprite needs to be indexed&amp;quot;)&lt;br /&gt;
    return&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  local function getPaletteData(palette)&lt;br /&gt;
      local ncolors = #palette&lt;br /&gt;
      local res = string.format(&amp;quot;;%i\n&amp;quot;, ncolors)&lt;br /&gt;
  &lt;br /&gt;
      for i=0, ncolors-1 do&lt;br /&gt;
          local color = palette:getColor(i)&lt;br /&gt;
          res = res .. &amp;quot;  .byte   &amp;quot; .. string.format(&amp;quot;$%x,$%x,$%x,$%x\n&amp;quot;, color.blue, color.green, color.red, color.alpha)  &lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      return res&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  local function getIndexData(img, x, y, w, h)&lt;br /&gt;
      local res = &amp;quot;&amp;quot;&lt;br /&gt;
      for y = 0,h-1 do&lt;br /&gt;
          res = res .. &amp;quot;  .byte   &amp;quot;&lt;br /&gt;
          for x = 0, w-1 do&lt;br /&gt;
              if x &amp;gt; 0 then&lt;br /&gt;
                  res = res ..&amp;quot;,&amp;quot;&lt;br /&gt;
              end&lt;br /&gt;
              px = img:getPixel(x, y)&lt;br /&gt;
              res = res .. string.format(&amp;quot;$%x&amp;quot;, px)&lt;br /&gt;
          end&lt;br /&gt;
          res = res .. &amp;quot;\n&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
     return res&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  local function exportFrame(frm,sFlag)&lt;br /&gt;
      if frm == nil then&lt;br /&gt;
          frm = 1&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      local img = Image(sprite.spec)&lt;br /&gt;
      img:drawSprite(sprite, frm)&lt;br /&gt;
  &lt;br /&gt;
      if frm == 1 or frm == nil or sFlag == 1 then&lt;br /&gt;
          io.write(&amp;quot;;Palette Indexed Picture\n&amp;quot;)&lt;br /&gt;
          io.write(&amp;quot;CLUT:\n&amp;quot;)&lt;br /&gt;
          io.write(&amp;quot;;begin palette\n&amp;quot;)&lt;br /&gt;
          io.write(getPaletteData(sprite.palettes[1]))&lt;br /&gt;
          io.write(&amp;quot;;end palette\n\n&amp;quot;)&lt;br /&gt;
      end&lt;br /&gt;
      io.write(&amp;quot;sprite&amp;quot;)&lt;br /&gt;
      io.write(frm)&lt;br /&gt;
      io.write(&amp;quot;:\n&amp;quot;)&lt;br /&gt;
      io.write(&amp;quot;;begin Sprite\n&amp;quot;)&lt;br /&gt;
      io.write(getIndexData(img, x, y, sprite.width, sprite.height))&lt;br /&gt;
      io.write(&amp;quot;;end Sprite\n\n&amp;quot;)&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  local dlg = Dialog()&lt;br /&gt;
  dlg:file{ id = &amp;quot;exportFile&amp;quot;,&lt;br /&gt;
            label = &amp;quot;File&amp;quot;,&lt;br /&gt;
            open = false,&lt;br /&gt;
            save = true,&lt;br /&gt;
          --filename= p .. fn .. &amp;quot;pip&amp;quot;,&lt;br /&gt;
            filetypes = {&amp;quot;txt&amp;quot;, &amp;quot;pip&amp;quot; }}&lt;br /&gt;
  dlg:check{ id=&amp;quot;onlyCurrentFrame&amp;quot;,&lt;br /&gt;
             text=&amp;quot;Export only current frame&amp;quot;,&lt;br /&gt;
             selected=false }&lt;br /&gt;
  dlg:modify{ title = &amp;quot;F256 Export Sprite&amp;quot; }&lt;br /&gt;
  dlg:button{ id=&amp;quot;ok&amp;quot;, text=&amp;quot;OK&amp;quot; }&lt;br /&gt;
  dlg:button{ id=&amp;quot;cancel&amp;quot;, text=&amp;quot;Cancel&amp;quot; }&lt;br /&gt;
  dlg:show()&lt;br /&gt;
  local data = dlg.data&lt;br /&gt;
  if data.ok then&lt;br /&gt;
      local f = io.open(data.exportFile, &amp;quot;w&amp;quot;)&lt;br /&gt;
      io.output(f)&lt;br /&gt;
  &lt;br /&gt;
      if data.onlyCurrentFrame then&lt;br /&gt;
          exportFrame(app.frame.frameNumber,1)&lt;br /&gt;
      else&lt;br /&gt;
          for i = 1,#sprite.frames do&lt;br /&gt;
              exportFrame(i,0)&lt;br /&gt;
          end&lt;br /&gt;
      end&lt;br /&gt;
  &lt;br /&gt;
      io.close(f)&lt;br /&gt;
  end&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Export_Aseprite_Sprites&amp;diff=328</id>
		<title>Export Aseprite Sprites</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Export_Aseprite_Sprites&amp;diff=328"/>
		<updated>2024-04-10T00:16:41Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;====== &#039;&#039;&#039;This LUA script file needs to be placed in Aseprite&#039;s &amp;quot;scripts&amp;quot; folder.&#039;&#039;&#039; ======&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;local sprite = app.sprite&lt;br /&gt;
 &lt;br /&gt;
 -- Check constraints&lt;br /&gt;
 if sprite == nil then&lt;br /&gt;
   app.alert(&amp;quot;No Sprite...&amp;quot;)&lt;br /&gt;
   return&lt;br /&gt;
 end&lt;br /&gt;
 if sprite.colorMode ~= ColorMode.INDEXED then&lt;br /&gt;
   app.alert(&amp;quot;Sprite needs to be indexed&amp;quot;)&lt;br /&gt;
   return&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 local function getPaletteData(palette)&lt;br /&gt;
     local ncolors = #palette&lt;br /&gt;
     local res = string.format(&amp;quot;;%i\n&amp;quot;, ncolors)&lt;br /&gt;
 &lt;br /&gt;
     for i=0, ncolors-1 do&lt;br /&gt;
         local color = palette:getColor(i)&lt;br /&gt;
         res = res .. &amp;quot;  .byte   &amp;quot; .. string.format(&amp;quot;$%x,$%x,$%x,$%x\n&amp;quot;, color.blue, color.green, color.red, color.alpha)  &lt;br /&gt;
     end&lt;br /&gt;
 &lt;br /&gt;
     return res&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 local function getIndexData(img, x, y, w, h)&lt;br /&gt;
     local res = &amp;quot;&amp;quot;&lt;br /&gt;
     for y = 0,h-1 do&lt;br /&gt;
         res = res .. &amp;quot;  .byte   &amp;quot;&lt;br /&gt;
         for x = 0, w-1 do&lt;br /&gt;
             if x &amp;gt; 0 then&lt;br /&gt;
                 res = res ..&amp;quot;,&amp;quot;&lt;br /&gt;
             end&lt;br /&gt;
             px = img:getPixel(x, y)&lt;br /&gt;
             res = res .. string.format(&amp;quot;$%x&amp;quot;, px)&lt;br /&gt;
         end&lt;br /&gt;
         res = res .. &amp;quot;\n&amp;quot;&lt;br /&gt;
     end&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
    return res&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 local function exportFrame(frm,sFlag)&lt;br /&gt;
     if frm == nil then&lt;br /&gt;
         frm = 1&lt;br /&gt;
     end&lt;br /&gt;
 &lt;br /&gt;
     local img = Image(sprite.spec)&lt;br /&gt;
     img:drawSprite(sprite, frm)&lt;br /&gt;
 &lt;br /&gt;
     if frm == 1 or frm == nil or sFlag == 1 then&lt;br /&gt;
         io.write(&amp;quot;;Palette Indexed Picture\n&amp;quot;)&lt;br /&gt;
         io.write(&amp;quot;CLUT:\n&amp;quot;)&lt;br /&gt;
         io.write(&amp;quot;;begin palette\n&amp;quot;)&lt;br /&gt;
         io.write(getPaletteData(sprite.palettes[1]))&lt;br /&gt;
         io.write(&amp;quot;;end palette\n\n&amp;quot;)&lt;br /&gt;
     end&lt;br /&gt;
     io.write(&amp;quot;sprite&amp;quot;)&lt;br /&gt;
     io.write(frm)&lt;br /&gt;
     io.write(&amp;quot;:\n&amp;quot;)&lt;br /&gt;
     io.write(&amp;quot;;begin Sprite\n&amp;quot;)&lt;br /&gt;
     io.write(getIndexData(img, x, y, sprite.width, sprite.height))&lt;br /&gt;
     io.write(&amp;quot;;end Sprite\n\n&amp;quot;)&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 local dlg = Dialog()&lt;br /&gt;
 dlg:file{ id = &amp;quot;exportFile&amp;quot;,&lt;br /&gt;
           label = &amp;quot;File&amp;quot;,&lt;br /&gt;
           open = false,&lt;br /&gt;
           save = true,&lt;br /&gt;
         --filename= p .. fn .. &amp;quot;pip&amp;quot;,&lt;br /&gt;
           filetypes = {&amp;quot;txt&amp;quot;, &amp;quot;pip&amp;quot; }}&lt;br /&gt;
 dlg:check{ id=&amp;quot;onlyCurrentFrame&amp;quot;,&lt;br /&gt;
            text=&amp;quot;Export only current frame&amp;quot;,&lt;br /&gt;
            selected=false }&lt;br /&gt;
 dlg:modify{ title = &amp;quot;F256 Export Sprite&amp;quot; }&lt;br /&gt;
 dlg:button{ id=&amp;quot;ok&amp;quot;, text=&amp;quot;OK&amp;quot; }&lt;br /&gt;
 dlg:button{ id=&amp;quot;cancel&amp;quot;, text=&amp;quot;Cancel&amp;quot; }&lt;br /&gt;
 dlg:show()&lt;br /&gt;
 local data = dlg.data&lt;br /&gt;
 if data.ok then&lt;br /&gt;
     local f = io.open(data.exportFile, &amp;quot;w&amp;quot;)&lt;br /&gt;
     io.output(f)&lt;br /&gt;
 &lt;br /&gt;
     if data.onlyCurrentFrame then&lt;br /&gt;
         exportFrame(app.frame.frameNumber,1)&lt;br /&gt;
     else&lt;br /&gt;
         for i = 1,#sprite.frames do&lt;br /&gt;
             exportFrame(i,0)&lt;br /&gt;
         end&lt;br /&gt;
     end&lt;br /&gt;
 &lt;br /&gt;
     io.close(f)&lt;br /&gt;
 end&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Export_Aseprite_Sprites&amp;diff=327</id>
		<title>Export Aseprite Sprites</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Export_Aseprite_Sprites&amp;diff=327"/>
		<updated>2024-04-10T00:15:04Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: The Aseprite export script.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;local sprite = app.sprite&lt;br /&gt;
 &lt;br /&gt;
 -- Check constraints&lt;br /&gt;
 if sprite == nil then&lt;br /&gt;
   app.alert(&amp;quot;No Sprite...&amp;quot;)&lt;br /&gt;
   return&lt;br /&gt;
 end&lt;br /&gt;
 if sprite.colorMode ~= ColorMode.INDEXED then&lt;br /&gt;
   app.alert(&amp;quot;Sprite needs to be indexed&amp;quot;)&lt;br /&gt;
   return&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 local function getPaletteData(palette)&lt;br /&gt;
     local ncolors = #palette&lt;br /&gt;
     local res = string.format(&amp;quot;;%i\n&amp;quot;, ncolors)&lt;br /&gt;
 &lt;br /&gt;
     for i=0, ncolors-1 do&lt;br /&gt;
         local color = palette:getColor(i)&lt;br /&gt;
         res = res .. &amp;quot;  .byte   &amp;quot; .. string.format(&amp;quot;$%x,$%x,$%x,$%x\n&amp;quot;, color.blue, color.green, color.red, color.alpha)  &lt;br /&gt;
     end&lt;br /&gt;
 &lt;br /&gt;
     return res&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 local function getIndexData(img, x, y, w, h)&lt;br /&gt;
     local res = &amp;quot;&amp;quot;&lt;br /&gt;
     for y = 0,h-1 do&lt;br /&gt;
         res = res .. &amp;quot;  .byte   &amp;quot;&lt;br /&gt;
         for x = 0, w-1 do&lt;br /&gt;
             if x &amp;gt; 0 then&lt;br /&gt;
                 res = res ..&amp;quot;,&amp;quot;&lt;br /&gt;
             end&lt;br /&gt;
             px = img:getPixel(x, y)&lt;br /&gt;
             res = res .. string.format(&amp;quot;$%x&amp;quot;, px)&lt;br /&gt;
         end&lt;br /&gt;
         res = res .. &amp;quot;\n&amp;quot;&lt;br /&gt;
     end&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
    return res&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 local function exportFrame(frm,sFlag)&lt;br /&gt;
     if frm == nil then&lt;br /&gt;
         frm = 1&lt;br /&gt;
     end&lt;br /&gt;
 &lt;br /&gt;
     local img = Image(sprite.spec)&lt;br /&gt;
     img:drawSprite(sprite, frm)&lt;br /&gt;
 &lt;br /&gt;
     if frm == 1 or frm == nil or sFlag == 1 then&lt;br /&gt;
         io.write(&amp;quot;;Palette Indexed Picture\n&amp;quot;)&lt;br /&gt;
         io.write(&amp;quot;CLUT:\n&amp;quot;)&lt;br /&gt;
         io.write(&amp;quot;;begin palette\n&amp;quot;)&lt;br /&gt;
         io.write(getPaletteData(sprite.palettes[1]))&lt;br /&gt;
         io.write(&amp;quot;;end palette\n\n&amp;quot;)&lt;br /&gt;
     end&lt;br /&gt;
     io.write(&amp;quot;sprite&amp;quot;)&lt;br /&gt;
     io.write(frm)&lt;br /&gt;
     io.write(&amp;quot;:\n&amp;quot;)&lt;br /&gt;
     io.write(&amp;quot;;begin Sprite\n&amp;quot;)&lt;br /&gt;
     io.write(getIndexData(img, x, y, sprite.width, sprite.height))&lt;br /&gt;
     io.write(&amp;quot;;end Sprite\n\n&amp;quot;)&lt;br /&gt;
 end&lt;br /&gt;
 &lt;br /&gt;
 local dlg = Dialog()&lt;br /&gt;
 dlg:file{ id = &amp;quot;exportFile&amp;quot;,&lt;br /&gt;
           label = &amp;quot;File&amp;quot;,&lt;br /&gt;
           open = false,&lt;br /&gt;
           save = true,&lt;br /&gt;
         --filename= p .. fn .. &amp;quot;pip&amp;quot;,&lt;br /&gt;
           filetypes = {&amp;quot;txt&amp;quot;, &amp;quot;pip&amp;quot; }}&lt;br /&gt;
 dlg:check{ id=&amp;quot;onlyCurrentFrame&amp;quot;,&lt;br /&gt;
            text=&amp;quot;Export only current frame&amp;quot;,&lt;br /&gt;
            selected=false }&lt;br /&gt;
 dlg:modify{ title = &amp;quot;F256 Export Sprite&amp;quot; }&lt;br /&gt;
 dlg:button{ id=&amp;quot;ok&amp;quot;, text=&amp;quot;OK&amp;quot; }&lt;br /&gt;
 dlg:button{ id=&amp;quot;cancel&amp;quot;, text=&amp;quot;Cancel&amp;quot; }&lt;br /&gt;
 dlg:show()&lt;br /&gt;
 local data = dlg.data&lt;br /&gt;
 if data.ok then&lt;br /&gt;
     local f = io.open(data.exportFile, &amp;quot;w&amp;quot;)&lt;br /&gt;
     io.output(f)&lt;br /&gt;
 &lt;br /&gt;
     if data.onlyCurrentFrame then&lt;br /&gt;
         exportFrame(app.frame.frameNumber,1)&lt;br /&gt;
     else&lt;br /&gt;
         for i = 1,#sprite.frames do&lt;br /&gt;
             exportFrame(i,0)&lt;br /&gt;
         end&lt;br /&gt;
     end&lt;br /&gt;
 &lt;br /&gt;
     io.close(f)&lt;br /&gt;
 end&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Tools_%26_Scripts&amp;diff=326</id>
		<title>Tools &amp; Scripts</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Tools_%26_Scripts&amp;diff=326"/>
		<updated>2024-04-09T23:50:14Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: Added a link to the Aseprite export sprites script&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== F256 Machines Game Development Tools ==&lt;br /&gt;
&lt;br /&gt;
=== Sprite Creation Tools &amp;amp; Scripts ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Link &lt;br /&gt;
! --- !! Notes&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;white-space:nowrap;&amp;quot;| Aseprite&lt;br /&gt;
| style=&amp;quot;white-space:nowrap;&amp;quot;| https://www.aseprite.org/&lt;br /&gt;
| &lt;br /&gt;
| style=&amp;quot;white-space:nowrap;&amp;quot; |Aseprite can be used to create sprites animation or Tiles Sets.&lt;br /&gt;
|-&lt;br /&gt;
|f256_sprite_cutter&lt;br /&gt;
|https://gist.github.com/digarok/57b096236a7fb1c76efef6cbb9f73a83&lt;br /&gt;
|&lt;br /&gt;
|Sprite cutter that cuts a PNG according to line-by-line instructions in a text file. Requires python and the PIL library, install with:&lt;br /&gt;
 python -m pip install --upgrade pip &lt;br /&gt;
&lt;br /&gt;
 python -m pip install --upgrade Pillow&lt;br /&gt;
Run with:&lt;br /&gt;
 python f256_sprite_cutter.py myimage.png mylist.txt sprites.s&lt;br /&gt;
where mylist.txt contains a series of lines containing x, y offset, width, name, where it&#039;s assumed the width is the same as the height since it&#039;s for square sprites supported for the F256xx, such as 8,16, or 32.&lt;br /&gt;
&lt;br /&gt;
The output (named sprites.s in this above example) is a series of hex instructions with a list of hex values of a color picked from the CLUT. &lt;br /&gt;
&lt;br /&gt;
In order to make it compatible with 64tass, I search replaced hex-&amp;gt; .byte and replaced every value I could find by swapping in a $ in front (ie 00 -&amp;gt; $00 and 01 -&amp;gt; $01, etc.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Scripts ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Tile Creation Tools &amp;amp; Scripts ===&lt;br /&gt;
If you use Aseprite, you can convert your tile drawings to tilesets and tilemaps using the following scripts:&lt;br /&gt;
&lt;br /&gt;
* [[Export Aseprite Tilemap]]&lt;br /&gt;
* [[Export Aseprite Tileset]]&lt;br /&gt;
* [[Export Aseprite Sprites]]&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Getting_Started&amp;diff=264</id>
		<title>Getting Started</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Getting_Started&amp;diff=264"/>
		<updated>2024-02-11T18:19:51Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: /* SD Card */ Added note to Linux bullet&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Getting Powered Up ==&lt;br /&gt;
&lt;br /&gt;
=== Powering your F256K ===&lt;br /&gt;
&lt;br /&gt;
The F256K is powered via a standard 2.5mm DC Connector, which takes a centre-positive 12V 2A capable Power Supply.&lt;br /&gt;
&lt;br /&gt;
This type of power supply is quite common.  [https://www.amazon.com/Adapter-100-240V-Transformer-Charger-Security/dp/B091XSVV1Y Example 12V 2A capable power supply] (#)&lt;br /&gt;
&lt;br /&gt;
(#) &#039;&#039;This specific power supply has not been verified (by the author) for use with the F256K.  Please update this page with verified options!&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Powering your F256Jr ===&lt;br /&gt;
&lt;br /&gt;
The F256Jr is supplied as a Mini-ITX form factor mainboard, with a standard 24 pin ATX power supply connector for power connectivity.&lt;br /&gt;
&lt;br /&gt;
Since the F256Jr needs relatively little power, compared to a mini-ATX PC, a popular DC 12V 24pin Pico ATX PSU works well and is a compact solution.&lt;br /&gt;
&lt;br /&gt;
* [https://www.amazon.com/dp/B08F57GKCL Pico PSU] - You power the Pico PSU via a 12V DC center-positive Power Supply source.&lt;br /&gt;
* [https://www.amazon.com/dp/B07MXXXBV8 12V DC center-positive A/C Adapter] - Commonly used to power the Pico PSU.&lt;br /&gt;
&lt;br /&gt;
== Getting programs onto the F256 ==&lt;br /&gt;
&lt;br /&gt;
=== SD Card === &lt;br /&gt;
&lt;br /&gt;
Both the F256K and F256JR have an SD card slot.  The device software to read the SD card is a bit touchy (it&#039;s inherited from the Commander X16 project) and doesn&#039;t work with all SD cards&lt;br /&gt;
&lt;br /&gt;
* Cards should support the V2 protocol (HC or XC); older cards that only support the V1 protocol (typically 2GB or less) won&#039;t work. By contrast, the kernels for the C256 machines generally only work with V1 cards.  Note that, in both cases, this is a software limitation -- all of the Foenix machines are electrically capable of using both kinds of cards.&lt;br /&gt;
* Cards *MUST* be formatted FAT32 -- **NOT: FAT, FAT12, FAT16, or exFAT**.   &lt;br /&gt;
* Formatting with Windows 10/11 works fine, but make sure to force FAT32 (or use the command line: &amp;lt;code&amp;gt;format /FS:FAT32 H:&amp;lt;/code&amp;gt;)&lt;br /&gt;
* Formatting with MacOS will only work using the &amp;lt;code&amp;gt;diskutil&amp;lt;/code&amp;gt; command line utility. An example usage looks like this: &amp;lt;code&amp;gt;sudo diskutil eraseDisk FAT32 [DiskName] MBRFormat /dev/[DiskNumber]&amp;lt;/code&amp;gt;.  You can use &amp;lt;code&amp;gt;diskutil list&amp;lt;/code&amp;gt; to get the disk number for the SD Card.&lt;br /&gt;
* Formatting and partitioning SD cards with Linux can be done using the &amp;lt;code&amp;gt;gnome-disk-utility&amp;lt;/code&amp;gt; (known simply as &amp;lt;u&amp;gt;Disks&amp;lt;/u&amp;gt;) and is installed on most mainstream distributions of Linux. &amp;lt;u&amp;gt;Disks&amp;lt;/u&amp;gt; will access all the drives on the computer so be sure you have the SD card selected when editing. [https://wiki.gnome.org/Apps/Disks Gnome/Disks wiki]&lt;br /&gt;
* FAT32 only supports a maximum partition size of 32Gb, on larger cards you will need to create multiple partitions -- however, only the first is recognized by DOS.&lt;br /&gt;
* Some folks have had luck formatting cards with the [https://www.sdcard.org/downloads/formatter/sd-memory-card-formatter-for-windows-download/ Official SD Association formatter for Windows].&lt;br /&gt;
&lt;br /&gt;
=== Demos Archive ===&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/FoenixRetro/Documentation/blob/main/f256/archive Download the most recent demos archive] and expand it to the root of the flash card.&lt;br /&gt;
&lt;br /&gt;
=== Debug USB port ===&lt;br /&gt;
&lt;br /&gt;
* This is what most developers use as it&#039;s the most convenient.  Connect the debug USB port to your PC or Mac&lt;br /&gt;
&lt;br /&gt;
* You can use:&lt;br /&gt;
** [https://github.com/pweingar/FoenixMgr FoenixMgr] - works on Windows, Mac, Linux&lt;br /&gt;
*** A Python script to manage the Foenix series of retro style computers through their USB debug ports. This tool allows uploading files of various formats to system RAM, and displaying memory through various means.&lt;br /&gt;
&lt;br /&gt;
** [https://github.com/Trinity-11/FoenixIDE FoenixIDE] (Windows only)&lt;br /&gt;
*** Development and Debugging Suite for the C256 Foenix Family of Computers.&lt;br /&gt;
&lt;br /&gt;
=== wget ===&lt;br /&gt;
If you have the [[wifi]] configured, you can use [https://github.com/ghackwrench/F256_wget wget] to pull programs and data right off the web!&lt;br /&gt;
&lt;br /&gt;
== SuperBASIC ==&lt;br /&gt;
&lt;br /&gt;
The machine boots to SuperBASIC.  SuperBASIC is inspired by BBC BASIC but offers quite a bit more.&lt;br /&gt;
&lt;br /&gt;
* Read the [https://github.com/FoenixRetro/f256-superbasic/blob/main/reference/source/f256jr_basic_ref.pdf SuperBASIC Reference Manual].&lt;br /&gt;
&lt;br /&gt;
* Watch EMWhite&#039;s excellent intro series on Youtube:&lt;br /&gt;
** Full Playlist here: [https://www.youtube.com/playlist?list=PLeHjTvk7NPiSqGz4REMH-S4hjYpLS2YNR EMWhite&#039;s Intro Series - Full Playlist].&lt;br /&gt;
** Part 1 can be viewed here:&lt;br /&gt;
&amp;lt;youtube&amp;gt;G_S2c_MsqYA&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get started, you can type in a sample program at the command prompt:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 for i=1 to 5&lt;br /&gt;
20 print &amp;quot;Hello world&amp;quot;&lt;br /&gt;
30 next&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SuperBASIC is similar to CBM (Microsoft) BASIC but has some differences.  For example, note in the sample above it&#039;s just &amp;lt;code&amp;gt;next&amp;lt;/code&amp;gt; not &amp;lt;code&amp;gt;next i&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The first 15 or so pages of the [https://github.com/FoenixRetro/f256-superbasic/blob/main/reference/source/f256jr_basic_ref.pdf SuperBASIC Reference Manual] are quite instructive.  &lt;br /&gt;
&lt;br /&gt;
SuperBASIC is actually much more powerful and supports structured programming (procedures, blocks etc.) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;dir&amp;lt;/code&amp;gt; - Run this to display directory of SD card&lt;br /&gt;
&lt;br /&gt;
Loading &amp;amp; running programs off of the SD card is similarly easy:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
load &amp;quot;JrWordl.bas&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similar to the C64, you can save time in loading programs from the &amp;lt;code&amp;gt;dir&amp;lt;/code&amp;gt; listing by using your cursor keys to go up to the entry, typing &amp;lt;code&amp;gt;load &amp;quot;&amp;lt;/code&amp;gt; (insert mode is active by default) etc.  You can use &amp;lt;code&amp;gt;CTRL+E&amp;lt;/code&amp;gt; to jump to the end of the line and use &amp;lt;code&amp;gt;CTRL+K&amp;lt;/code&amp;gt; to delete any text from the cursor to the end of the line.  Correctly place the closing &amp;lt;code&amp;gt;&amp;quot;&amp;lt;/code&amp;gt; and hit &amp;lt;code&amp;gt;ENTER&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;CTRL+C&amp;lt;/code&amp;gt; acts as a &amp;quot;break&amp;quot; command and stops any running SuperBASIC program or &amp;lt;code&amp;gt;LIST&amp;lt;/code&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
Read built-in help/reference:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;/help&amp;lt;/code&amp;gt; : But &#039;&#039;&#039;NOTE&#039;&#039;&#039;, this erases BASIC memory!  Use Backspace key to go back in menus and to exit.&lt;br /&gt;
&lt;br /&gt;
Explore the included demo SuperBASIC programs:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Program !! Notes !! Source&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;JrWordl.bas&amp;lt;/code&amp;gt; || Wordle game, guess 5 letter word ||&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;mandel.bas&amp;lt;/code&amp;gt; || Draws Mandlebrot set in graphics mode, takes between 2 and 3 hours || [https://github.com/Mu0n/F256KbasicBASICdoodles @Mu0n]&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;rpg-demo.bas&amp;lt;/code&amp;gt; || UI sample that shows Zelda like RPG game.  Control the character with an Atari-joystick connected to JoyPort1 || @econtrerasd&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;Problematic_Code.bas&amp;lt;/code&amp;gt; || Displays scrolling starfield ||&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;noelrl.bas&amp;lt;/code&amp;gt; || Simple integer BASIC bench mark from Noel&#039;s retro lab.  Completes &amp;lt; 3.5 seconds, compares very favourably to other retro systems! || [https://www.youtube.com/watch?v=H05hM_Guoqk Youtube]&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;dance.bas&amp;lt;/code&amp;gt; || Animates sprite of dancer || [https://github.com/Mu0n/F256KbasicBASICdoodles @Mu0n]&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;luna.bas&amp;lt;/code&amp;gt; || Displays simple scene ||&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;blink.bas&amp;lt;/code&amp;gt; || Blinks drive access light || [https://github.com/Mu0n/F256KbasicBASICdoodles @Mu0n]&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;piano.bas&amp;lt;/code&amp;gt; || Play some notes with the PSG || [https://github.com/Mu0n/F256KbasicBASICdoodles @Mu0n]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Running PGZ Files ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/- &amp;quot;file.pgz&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== More Resources ===&lt;br /&gt;
=== This Wiki ===&lt;br /&gt;
&lt;br /&gt;
Explore all of the content of this Wiki, to expand your F256 series knowledge!&lt;br /&gt;
&lt;br /&gt;
=== Discord ===&lt;br /&gt;
&lt;br /&gt;
The [https://discord.com/invite/aAEQXZHXgM Foenix Retro Systems Discord] is the primary place to get questions answered.&lt;br /&gt;
&lt;br /&gt;
Also, if you resolve your question, and you didn&#039;t find the answer here on the Wiki, &#039;&#039;&#039;&#039;&#039;please consider contributing to the Wiki&#039;&#039;&#039;&#039;&#039;, for the benefit of others with the same question!&lt;br /&gt;
&lt;br /&gt;
=== Foenix Retro Systems Newletter ===&lt;br /&gt;
&lt;br /&gt;
Read back issues [http://apps.emwhite.org/foenixmarketplace/ here] (also a great source for sample programs).   &lt;br /&gt;
&lt;br /&gt;
Issues starting at #4 cover the F256 line.  Issues 1-3 cover the previous version of the hardware (C256), although there are still many salient points.&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Getting_Started&amp;diff=263</id>
		<title>Getting Started</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Getting_Started&amp;diff=263"/>
		<updated>2024-02-11T18:13:34Z</updated>

		<summary type="html">&lt;p&gt;Mcassera: /* SD Card */  - Added Linux utility that will partition and format SD cards.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Getting Powered Up ==&lt;br /&gt;
&lt;br /&gt;
=== Powering your F256K ===&lt;br /&gt;
&lt;br /&gt;
The F256K is powered via a standard 2.5mm DC Connector, which takes a centre-positive 12V 2A capable Power Supply.&lt;br /&gt;
&lt;br /&gt;
This type of power supply is quite common.  [https://www.amazon.com/Adapter-100-240V-Transformer-Charger-Security/dp/B091XSVV1Y Example 12V 2A capable power supply] (#)&lt;br /&gt;
&lt;br /&gt;
(#) &#039;&#039;This specific power supply has not been verified (by the author) for use with the F256K.  Please update this page with verified options!&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Powering your F256Jr ===&lt;br /&gt;
&lt;br /&gt;
The F256Jr is supplied as a Mini-ITX form factor mainboard, with a standard 24 pin ATX power supply connector for power connectivity.&lt;br /&gt;
&lt;br /&gt;
Since the F256Jr needs relatively little power, compared to a mini-ATX PC, a popular DC 12V 24pin Pico ATX PSU works well and is a compact solution.&lt;br /&gt;
&lt;br /&gt;
* [https://www.amazon.com/dp/B08F57GKCL Pico PSU] - You power the Pico PSU via a 12V DC center-positive Power Supply source.&lt;br /&gt;
* [https://www.amazon.com/dp/B07MXXXBV8 12V DC center-positive A/C Adapter] - Commonly used to power the Pico PSU.&lt;br /&gt;
&lt;br /&gt;
== Getting programs onto the F256 ==&lt;br /&gt;
&lt;br /&gt;
=== SD Card === &lt;br /&gt;
&lt;br /&gt;
Both the F256K and F256JR have an SD card slot.  The device software to read the SD card is a bit touchy (it&#039;s inherited from the Commander X16 project) and doesn&#039;t work with all SD cards&lt;br /&gt;
&lt;br /&gt;
* Cards should support the V2 protocol (HC or XC); older cards that only support the V1 protocol (typically 2GB or less) won&#039;t work. By contrast, the kernels for the C256 machines generally only work with V1 cards.  Note that, in both cases, this is a software limitation -- all of the Foenix machines are electrically capable of using both kinds of cards.&lt;br /&gt;
* Cards *MUST* be formatted FAT32 -- **NOT: FAT, FAT12, FAT16, or exFAT**.   &lt;br /&gt;
* Formatting with Windows 10/11 works fine, but make sure to force FAT32 (or use the command line: &amp;lt;code&amp;gt;format /FS:FAT32 H:&amp;lt;/code&amp;gt;)&lt;br /&gt;
* Formatting with MacOS will only work using the &amp;lt;code&amp;gt;diskutil&amp;lt;/code&amp;gt; command line utility. An example usage looks like this: &amp;lt;code&amp;gt;sudo diskutil eraseDisk FAT32 [DiskName] MBRFormat /dev/[DiskNumber]&amp;lt;/code&amp;gt;.  You can use &amp;lt;code&amp;gt;diskutil list&amp;lt;/code&amp;gt; to get the disk number for the SD Card.&lt;br /&gt;
* Formatting and partitioning SD cards with Linux can be done using the &amp;lt;code&amp;gt;gnome-disk-utility&amp;lt;/code&amp;gt; (known simply as Disks) and is installed on most mainstream distributions of Linux. [https://wiki.gnome.org/Apps/Disks Gnome/Disks wiki]&lt;br /&gt;
* FAT32 only supports a maximum partition size of 32Gb, on larger cards you will need to create multiple partitions -- however, only the first is recognized by DOS.&lt;br /&gt;
* Some folks have had luck formatting cards with the [https://www.sdcard.org/downloads/formatter/sd-memory-card-formatter-for-windows-download/ Official SD Association formatter for Windows].&lt;br /&gt;
&lt;br /&gt;
=== Demos Archive ===&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/FoenixRetro/Documentation/blob/main/f256/archive Download the most recent demos archive] and expand it to the root of the flash card.&lt;br /&gt;
&lt;br /&gt;
=== Debug USB port ===&lt;br /&gt;
&lt;br /&gt;
* This is what most developers use as it&#039;s the most convenient.  Connect the debug USB port to your PC or Mac&lt;br /&gt;
&lt;br /&gt;
* You can use:&lt;br /&gt;
** [https://github.com/pweingar/FoenixMgr FoenixMgr] - works on Windows, Mac, Linux&lt;br /&gt;
*** A Python script to manage the Foenix series of retro style computers through their USB debug ports. This tool allows uploading files of various formats to system RAM, and displaying memory through various means.&lt;br /&gt;
&lt;br /&gt;
** [https://github.com/Trinity-11/FoenixIDE FoenixIDE] (Windows only)&lt;br /&gt;
*** Development and Debugging Suite for the C256 Foenix Family of Computers.&lt;br /&gt;
&lt;br /&gt;
=== wget ===&lt;br /&gt;
If you have the [[wifi]] configured, you can use [https://github.com/ghackwrench/F256_wget wget] to pull programs and data right off the web!&lt;br /&gt;
&lt;br /&gt;
== SuperBASIC ==&lt;br /&gt;
&lt;br /&gt;
The machine boots to SuperBASIC.  SuperBASIC is inspired by BBC BASIC but offers quite a bit more.&lt;br /&gt;
&lt;br /&gt;
* Read the [https://github.com/FoenixRetro/f256-superbasic/blob/main/reference/source/f256jr_basic_ref.pdf SuperBASIC Reference Manual].&lt;br /&gt;
&lt;br /&gt;
* Watch EMWhite&#039;s excellent intro series on Youtube:&lt;br /&gt;
** Full Playlist here: [https://www.youtube.com/playlist?list=PLeHjTvk7NPiSqGz4REMH-S4hjYpLS2YNR EMWhite&#039;s Intro Series - Full Playlist].&lt;br /&gt;
** Part 1 can be viewed here:&lt;br /&gt;
&amp;lt;youtube&amp;gt;G_S2c_MsqYA&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get started, you can type in a sample program at the command prompt:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 for i=1 to 5&lt;br /&gt;
20 print &amp;quot;Hello world&amp;quot;&lt;br /&gt;
30 next&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SuperBASIC is similar to CBM (Microsoft) BASIC but has some differences.  For example, note in the sample above it&#039;s just &amp;lt;code&amp;gt;next&amp;lt;/code&amp;gt; not &amp;lt;code&amp;gt;next i&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The first 15 or so pages of the [https://github.com/FoenixRetro/f256-superbasic/blob/main/reference/source/f256jr_basic_ref.pdf SuperBASIC Reference Manual] are quite instructive.  &lt;br /&gt;
&lt;br /&gt;
SuperBASIC is actually much more powerful and supports structured programming (procedures, blocks etc.) &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;dir&amp;lt;/code&amp;gt; - Run this to display directory of SD card&lt;br /&gt;
&lt;br /&gt;
Loading &amp;amp; running programs off of the SD card is similarly easy:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
load &amp;quot;JrWordl.bas&amp;quot;&lt;br /&gt;
run&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similar to the C64, you can save time in loading programs from the &amp;lt;code&amp;gt;dir&amp;lt;/code&amp;gt; listing by using your cursor keys to go up to the entry, typing &amp;lt;code&amp;gt;load &amp;quot;&amp;lt;/code&amp;gt; (insert mode is active by default) etc.  You can use &amp;lt;code&amp;gt;CTRL+E&amp;lt;/code&amp;gt; to jump to the end of the line and use &amp;lt;code&amp;gt;CTRL+K&amp;lt;/code&amp;gt; to delete any text from the cursor to the end of the line.  Correctly place the closing &amp;lt;code&amp;gt;&amp;quot;&amp;lt;/code&amp;gt; and hit &amp;lt;code&amp;gt;ENTER&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;CTRL+C&amp;lt;/code&amp;gt; acts as a &amp;quot;break&amp;quot; command and stops any running SuperBASIC program or &amp;lt;code&amp;gt;LIST&amp;lt;/code&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
Read built-in help/reference:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;/help&amp;lt;/code&amp;gt; : But &#039;&#039;&#039;NOTE&#039;&#039;&#039;, this erases BASIC memory!  Use Backspace key to go back in menus and to exit.&lt;br /&gt;
&lt;br /&gt;
Explore the included demo SuperBASIC programs:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Program !! Notes !! Source&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;JrWordl.bas&amp;lt;/code&amp;gt; || Wordle game, guess 5 letter word ||&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;mandel.bas&amp;lt;/code&amp;gt; || Draws Mandlebrot set in graphics mode, takes between 2 and 3 hours || [https://github.com/Mu0n/F256KbasicBASICdoodles @Mu0n]&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;rpg-demo.bas&amp;lt;/code&amp;gt; || UI sample that shows Zelda like RPG game.  Control the character with an Atari-joystick connected to JoyPort1 || @econtrerasd&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;Problematic_Code.bas&amp;lt;/code&amp;gt; || Displays scrolling starfield ||&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;noelrl.bas&amp;lt;/code&amp;gt; || Simple integer BASIC bench mark from Noel&#039;s retro lab.  Completes &amp;lt; 3.5 seconds, compares very favourably to other retro systems! || [https://www.youtube.com/watch?v=H05hM_Guoqk Youtube]&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;dance.bas&amp;lt;/code&amp;gt; || Animates sprite of dancer || [https://github.com/Mu0n/F256KbasicBASICdoodles @Mu0n]&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;luna.bas&amp;lt;/code&amp;gt; || Displays simple scene ||&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;blink.bas&amp;lt;/code&amp;gt; || Blinks drive access light || [https://github.com/Mu0n/F256KbasicBASICdoodles @Mu0n]&lt;br /&gt;
|- &lt;br /&gt;
| &amp;lt;code&amp;gt;piano.bas&amp;lt;/code&amp;gt; || Play some notes with the PSG || [https://github.com/Mu0n/F256KbasicBASICdoodles @Mu0n]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Running PGZ Files ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/- &amp;quot;file.pgz&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
=== More Resources ===&lt;br /&gt;
=== This Wiki ===&lt;br /&gt;
&lt;br /&gt;
Explore all of the content of this Wiki, to expand your F256 series knowledge!&lt;br /&gt;
&lt;br /&gt;
=== Discord ===&lt;br /&gt;
&lt;br /&gt;
The [https://discord.com/invite/aAEQXZHXgM Foenix Retro Systems Discord] is the primary place to get questions answered.&lt;br /&gt;
&lt;br /&gt;
Also, if you resolve your question, and you didn&#039;t find the answer here on the Wiki, &#039;&#039;&#039;&#039;&#039;please consider contributing to the Wiki&#039;&#039;&#039;&#039;&#039;, for the benefit of others with the same question!&lt;br /&gt;
&lt;br /&gt;
=== Foenix Retro Systems Newletter ===&lt;br /&gt;
&lt;br /&gt;
Read back issues [http://apps.emwhite.org/foenixmarketplace/ here] (also a great source for sample programs).   &lt;br /&gt;
&lt;br /&gt;
Issues starting at #4 cover the F256 line.  Issues 1-3 cover the previous version of the hardware (C256), although there are still many salient points.&lt;/div&gt;</summary>
		<author><name>Mcassera</name></author>
	</entry>
</feed>