<?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=Cibee</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=Cibee"/>
	<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Special:Contributions/Cibee"/>
	<updated>2026-04-20T10:08:45Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Raspberry_Pi_Pico_Update&amp;diff=38464</id>
		<title>Raspberry Pi Pico Update</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Raspberry_Pi_Pico_Update&amp;diff=38464"/>
		<updated>2026-02-14T23:14:22Z</updated>

		<summary type="html">&lt;p&gt;Cibee: Corrected filename for gzip compressed fpga cores&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Raspberry Pi Pico Update ==&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
There is an onboard RP2040 chip (pi pico). It is NOT PRESENT on the Jr2. It&#039;s only present on the K2. It&#039;s responsible for the following things:&lt;br /&gt;
&lt;br /&gt;
* the bootloader procedure that loads the right core while booting the K2. &lt;br /&gt;
* it is also known as the &amp;quot;FPGA Manager&amp;quot;&lt;br /&gt;
* Has modifiable code that can invite more features and possibly a faster bootup&lt;br /&gt;
&lt;br /&gt;
=== Preparing new pico flash files ===&lt;br /&gt;
&lt;br /&gt;
Check this [https://github.com/wildbitscomputing/fpga-manager fpga manager] repo from Cibee which can tweak and compile such files into .uf2. This project uses VSCode, the pico sdk and openocd in order to do everything.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a summary of the booting time gains that were accomplished by Cibee (see the benchmark table on the side)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
bit bang (slowest): was the old method, at launch of the K2, of sending a core file to the FPGA. &lt;br /&gt;
&lt;br /&gt;
pio (faster): is the new method tried by Cibee&lt;br /&gt;
&lt;br /&gt;
SD raw (slowest): was the old way of storing the core file, uncompressed, as .bin files. See [[FPGA_Releases#How_to_Upgrade_the_FPGA_for_the_F256K2]] for the exact file structure needed inside the internal &amp;quot;left&amp;quot; uSD card.&lt;br /&gt;
&lt;br /&gt;
SD gzip (faster): is a new method of individually storing those same core files as .bin.gz, reducing the amount of bytes to send dramatically&lt;br /&gt;
&lt;br /&gt;
FLASH LZ4 (fastest): is embedding the core files inside the pi pico flash memory so that the core manager carries its own data and sends it to the fpga during bootup. This no longer involves the internal &amp;quot;left&amp;quot; uSD card at all.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When a recent enough fpga manager (January 2026) is flashed into the pi pico, it will try to prepare the fpga with this following sequence:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; Reads a 2-bit context DIP switch to select one of four FPGA slots.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; Attempts SD card programming first (LZ4 blocks, gzip, then raw .bin).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; Falls back to LZ4 images stored in fixed flash slots if SD is unavailable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; Prints the chosen method and timing over USB stdio if enabled.&lt;br /&gt;
[[File:FPGA Manager Benchmark.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
=== Opening the case ===&lt;br /&gt;
&lt;br /&gt;
You can refer to this section to learn how you can be [[Opening_the_F256K_case]]&lt;br /&gt;
&lt;br /&gt;
=== Flashing using the onboard USB Header ===&lt;br /&gt;
&lt;br /&gt;
Here are the steps to follow:&lt;br /&gt;
[[File:Rp2040-cable.jpeg|thumb|Connector location for the pico USB pin header, Switch S3 on the left, and cable orientation]]&lt;br /&gt;
Installation step:&lt;br /&gt;
&lt;br /&gt;
* Install Cable as above (F256K2 Powered Off). &#039;&#039;&#039;WARNING&#039;&#039;&#039;, with &#039;&#039;&#039;VERY LITTLE&#039;&#039;&#039; cable tension, this pin header can snap off [from Mu0n] and force you onto the next method of flashing using the SWD header, as seen in the next section.&lt;br /&gt;
* Plug Cable in any PC that holds the new programming file.&lt;br /&gt;
* Keep 1 finger on the button&lt;br /&gt;
* Power the F256K2&lt;br /&gt;
* A new folder will appear on the PC&#039;s Desktop&lt;br /&gt;
* Drop the new .uf2 file in the newly appeared folder.&lt;br /&gt;
* Power off F256K2&lt;br /&gt;
* Remove cable&lt;br /&gt;
* Reinstall the system as your heart&#039;s desire&lt;br /&gt;
* Power On the unit&lt;br /&gt;
* RP2040 is updated and running (because you need it to boot the unit)&lt;br /&gt;
* Bob&#039;s your uncle!&lt;br /&gt;
&lt;br /&gt;
=== Flashing using the onboard SWD Header ===&lt;br /&gt;
&lt;br /&gt;
SWD: Serial Wire Debug. This other pin header is a second way to update your flash and gives a little more flexibility to do it piece by piece by flashing .bin at specific flash locations or .elf in one go.&lt;br /&gt;
[[File:Swd connector.png|thumb|Connector location for the SWD pin header, near the FPGA]]&lt;br /&gt;
&lt;br /&gt;
You&#039;ll need either:&lt;br /&gt;
&lt;br /&gt;
* a [https://www.raspberrypi.com/documentation/microcontrollers/debug-probe.html Pi Debug Probe] which comes with the necessary cable that leads to 3 female Dupont endings needed here&lt;br /&gt;
* openocd tool from PicoSDK v1.5.1 or more recent&lt;br /&gt;
* a prepared .bin file with updated code. &lt;br /&gt;
* a conversion tool to convert .uf2 to .bin, you can use this website https://polpo.org/tmp/uf2-to-bin.html or other known tools in the pico community&lt;br /&gt;
* the key step is to use openocd like so: openocd -s scripts -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c &amp;quot;adapter speed 5000; program NewFirmware.bin verify reset exit 0x10000000&amp;quot;&lt;/div&gt;</summary>
		<author><name>Cibee</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Glossary&amp;diff=38415</id>
		<title>Glossary</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Glossary&amp;diff=38415"/>
		<updated>2026-01-27T12:34:25Z</updated>

		<summary type="html">&lt;p&gt;Cibee: A comprehensive glossary of terms, acronyms, and concepts from the F256 ecosystem.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Wildbits / Foenix F256 Glossary =&lt;br /&gt;
&lt;br /&gt;
{{Short description|Reference guide to F256 hardware, software, and technical terminology}}&lt;br /&gt;
&lt;br /&gt;
A comprehensive glossary of terms, acronyms, and concepts from the F256 ecosystem.&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Computer Models ==&lt;br /&gt;
&lt;br /&gt;
; F256Jr&lt;br /&gt;
: First-generation &amp;quot;Junior&amp;quot; model featuring WDC 65C02 CPU, 512KB SRAM, Cyclone IV FPGA, and [[TinyVicky]] graphics.&lt;br /&gt;
&lt;br /&gt;
; F256Jr2 (Jr.Jr.)&lt;br /&gt;
: Second-generation Junior model with WDC 65C816 CPU, 2MB SRAM, Artix 7 FPGA, and TinyVicky II graphics. See [[Product_Specifications]].&lt;br /&gt;
&lt;br /&gt;
; F256K&lt;br /&gt;
: First-generation keyboard-integrated model with same specs as F256Jr plus built-in mechanical keyboard.&lt;br /&gt;
&lt;br /&gt;
; F256K2&lt;br /&gt;
: Second-generation keyboard model with 65816, 2MB SRAM, 128MB DDR3 DRAM, Artix 7 XC7A200T FPGA, and Vicky &amp;quot;The Fourth&amp;quot; graphics.&lt;br /&gt;
&lt;br /&gt;
; Foenix&lt;br /&gt;
: Brand name for the retro computer line created by Stefany Allaire.&lt;br /&gt;
&lt;br /&gt;
; Wildbits&lt;br /&gt;
: Alternative/associated brand name for the F256 computer line.&lt;br /&gt;
&lt;br /&gt;
== Processors ==&lt;br /&gt;
&lt;br /&gt;
; 6502&lt;br /&gt;
: Classic 8-bit CPU from MOS Technology (1975), the foundation architecture for the F256 series.&lt;br /&gt;
&lt;br /&gt;
; WDC 65C02&lt;br /&gt;
: Western Design Center&#039;s CMOS version of the 6502 with lower power consumption and additional instructions. Default CPU in first-gen F256 models.&lt;br /&gt;
&lt;br /&gt;
; WDC 65C816 (65816)&lt;br /&gt;
: 16-bit upgrade to the 65C02 with 24-bit addressing (up to 16MB) and selectable 8/16-bit registers. See [[65816_Overview]].&lt;br /&gt;
&lt;br /&gt;
; FNX6809&lt;br /&gt;
: FPGA-based implementation of the Motorola 6809 CPU that can run on F256 hardware. See [[FNX6809_Overview]].&lt;br /&gt;
&lt;br /&gt;
; Emulation Mode&lt;br /&gt;
: Default 65816 startup mode that behaves like a 65C02 for backwards compatibility.&lt;br /&gt;
&lt;br /&gt;
; Native Mode&lt;br /&gt;
: 65816 mode enabling 16-bit registers, movable direct page, and full 24-bit addressing.&lt;br /&gt;
&lt;br /&gt;
; Rockwell Instructions&lt;br /&gt;
: Extended 6502 instructions (BBS, BBR, RMB, SMB) supported by 65C02 but &#039;&#039;&#039;NOT&#039;&#039;&#039; by 65816. Avoid these for 65816 compatibility.&lt;br /&gt;
&lt;br /&gt;
== FPGA &amp;amp; Hardware ==&lt;br /&gt;
&lt;br /&gt;
; FPGA&lt;br /&gt;
: Field-Programmable Gate Array; reconfigurable chip implementing the F256&#039;s custom logic, graphics, and sound.&lt;br /&gt;
&lt;br /&gt;
; Cyclone IV (EP4CE15)&lt;br /&gt;
: Intel/Altera FPGA used in first-gen F256 models (15,408 logic elements, 504kb BRAM).&lt;br /&gt;
&lt;br /&gt;
; Artix 7 (XC7A35T)&lt;br /&gt;
: Xilinx FPGA used in F256Jr2 (33,280 logic cells, 1,800kb BRAM).&lt;br /&gt;
&lt;br /&gt;
; Artix 7 (XC7A200T)&lt;br /&gt;
: Larger Xilinx FPGA used in F256K2 (215,360 logic cells, 13,140kb BRAM).&lt;br /&gt;
&lt;br /&gt;
; Core&lt;br /&gt;
: FPGA configuration/bitstream that defines the computer&#039;s behavior. See [[FPGA_Releases]].&lt;br /&gt;
&lt;br /&gt;
; Core2x&lt;br /&gt;
: Enhanced FPGA core with 2× CPU speed (12MHz), 24-bit flat addressing, 64 additional sprites, and hardware line drawing.&lt;br /&gt;
&lt;br /&gt;
; JTAG&lt;br /&gt;
: Joint Test Action Group; interface for programming the FPGA on first-gen models.&lt;br /&gt;
&lt;br /&gt;
; USB Blaster&lt;br /&gt;
: Hardware programmer used to flash FPGA via JTAG on F256Jr and F256K.&lt;br /&gt;
&lt;br /&gt;
; RP2040&lt;br /&gt;
: Raspberry Pi microcontroller that initializes the FPGA and uploads cores on second-gen models.&lt;br /&gt;
&lt;br /&gt;
; Context (CNTX)&lt;br /&gt;
: On F256K2, one of four FPGA core slots (CNTX1-CNTX4) selectable via [[DIP_switches]].&lt;br /&gt;
&lt;br /&gt;
; Sii9022&lt;br /&gt;
: HDMI encoder chip used on black K2 boards; removed in purple K2 boards where HDMI encoding moved to FPGA.&lt;br /&gt;
&lt;br /&gt;
== Graphics ==&lt;br /&gt;
&lt;br /&gt;
; TinyVicky&lt;br /&gt;
: Graphics subsystem in first-gen F256 models (F256Jr, F256K).&lt;br /&gt;
&lt;br /&gt;
; TinyVicky II&lt;br /&gt;
: Enhanced graphics subsystem in F256Jr2.&lt;br /&gt;
&lt;br /&gt;
; Vicky &amp;quot;The Fourth&amp;quot;&lt;br /&gt;
: Advanced graphics subsystem in F256K2.&lt;br /&gt;
&lt;br /&gt;
; VICKY&lt;br /&gt;
: General name for the Foenix graphics/video controller family.&lt;br /&gt;
&lt;br /&gt;
; Bitmap&lt;br /&gt;
: Graphics layer displaying pixel-mapped images directly from SRAM. Up to 3 bitmap layers available.&lt;br /&gt;
&lt;br /&gt;
; Tilemap&lt;br /&gt;
: Graphics layer displaying tiles from tilesets for efficient scrolling graphics. Up to 3 tilemap layers available.&lt;br /&gt;
&lt;br /&gt;
; Tileset&lt;br /&gt;
: Collection of tile graphics (8×8 or 16×16 pixels) referenced by tilemaps. Up to 8 tilesets supported.&lt;br /&gt;
&lt;br /&gt;
; Sprite&lt;br /&gt;
: Hardware-accelerated moveable graphic object. Sizes: 8×8, 16×16, 24×24, or 32×32 pixels. 64 sprites standard, 128 with Core2x.&lt;br /&gt;
&lt;br /&gt;
; CLUT&lt;br /&gt;
: Color Look-Up Table; palette mapping 8-bit index values to BGR colors. 4 graphics CLUTs available.&lt;br /&gt;
&lt;br /&gt;
; Gamma Correction&lt;br /&gt;
: Color brightness adjustment via lookup tables at $C000-$C8FF in IO Page 0.&lt;br /&gt;
&lt;br /&gt;
; DMA&lt;br /&gt;
: Direct Memory Access; hardware-accelerated memory copying that runs during VBlank at 100MHz.&lt;br /&gt;
&lt;br /&gt;
; Layer&lt;br /&gt;
: Graphics compositing priority. Bitmaps and tilemaps can be assigned to layers 0-2.&lt;br /&gt;
&lt;br /&gt;
== Memory ==&lt;br /&gt;
&lt;br /&gt;
; SRAM&lt;br /&gt;
: Static RAM; main system memory. 512KB on gen1 models, 2MB on gen2 models.&lt;br /&gt;
&lt;br /&gt;
; DDR3 DRAM&lt;br /&gt;
: 128MB dynamic RAM on F256K2 (support planned but not yet implemented).&lt;br /&gt;
&lt;br /&gt;
; Flash&lt;br /&gt;
: 512KB non-volatile memory storing [[Firmware]] and programs. Each K2 core context has its own 512KB flash area.&lt;br /&gt;
&lt;br /&gt;
; MMU&lt;br /&gt;
: Memory Management Unit; maps 8KB blocks of physical memory into the CPU&#039;s 64KB address space. See [[Memory_Management]].&lt;br /&gt;
&lt;br /&gt;
; MLUT&lt;br /&gt;
: Memory Lookup Table; one of four MMU configurations (MLUT 0-3) for quick switching between memory mapping states.&lt;br /&gt;
&lt;br /&gt;
; Slot&lt;br /&gt;
: One of eight 8KB regions in the CPU&#039;s 64KB address space:&lt;br /&gt;
:* Slot 0: $0000-$1FFF&lt;br /&gt;
:* Slot 1: $2000-$3FFF&lt;br /&gt;
:* Slot 2: $4000-$5FFF&lt;br /&gt;
:* Slot 3: $6000-$7FFF&lt;br /&gt;
:* Slot 4: $8000-$9FFF&lt;br /&gt;
:* Slot 5: $A000-$BFFF&lt;br /&gt;
:* Slot 6: $C000-$DFFF (IO Pages overlay this)&lt;br /&gt;
:* Slot 7: $E000-$FFFF&lt;br /&gt;
&lt;br /&gt;
; Block&lt;br /&gt;
: 8KB chunk of physical memory that can be mapped into a slot via the MMU.&lt;br /&gt;
&lt;br /&gt;
; IO Page&lt;br /&gt;
: Memory-mapped I/O region at $C000-$DFFF. Six pages available (0-5). See [[IO_Pages]].&lt;br /&gt;
&lt;br /&gt;
; Expansion Port&lt;br /&gt;
: Slot for 256KB RAM or Flash expansion cartridge. Uses PCI-Express x1 socket form factor.&lt;br /&gt;
&lt;br /&gt;
; Flat Memory&lt;br /&gt;
: Direct 24-bit addressing without MMU banking. Available in Core2x with SRAM_EN bit enabled.&lt;br /&gt;
&lt;br /&gt;
; Zero Page / Direct Page&lt;br /&gt;
: First 256 bytes of memory used for fast addressing. Moveable anywhere in first 64KB in 65816 native mode.&lt;br /&gt;
&lt;br /&gt;
== Audio ==&lt;br /&gt;
&lt;br /&gt;
; SID&lt;br /&gt;
: Sound Interface Device; Commodore 64&#039;s famous sound chip. FPGA emulated on gen2; real chip sockets available on F256Jr.&lt;br /&gt;
&lt;br /&gt;
; PSG&lt;br /&gt;
: Programmable Sound Generator; AY-3-8910-style chip (FPGA emulated). Directly accessible at $D600. See [[Use_the_PSG]].&lt;br /&gt;
&lt;br /&gt;
; OPL3 (YMF262)&lt;br /&gt;
: Yamaha FM synthesis chip. Real chip on F256K; FPGA emulated on other models. See [[Use_the_OPL3_YMF262]].&lt;br /&gt;
&lt;br /&gt;
; CODEC&lt;br /&gt;
: Audio codec chip for digital audio output. See [[Use_the_CODEC]].&lt;br /&gt;
&lt;br /&gt;
; SAM2695&lt;br /&gt;
: Dream MIDI wavetable synthesis chip (gen2 only). See [[Use_the_Sam2695_Dream_MIDI_chip]].&lt;br /&gt;
&lt;br /&gt;
; VS1053b&lt;br /&gt;
: VLSI audio decoder/encoder chip supporting MP3, AAC, Ogg Vorbis, and more (gen2 only). See [[Use_the_VS1053b_chip]].&lt;br /&gt;
&lt;br /&gt;
; MIDI&lt;br /&gt;
: Musical Instrument Digital Interface; supported via SAM2695 and hardware MIDI in/out ports on gen2 models.&lt;br /&gt;
&lt;br /&gt;
== Input/Output ==&lt;br /&gt;
&lt;br /&gt;
; PS/2&lt;br /&gt;
: Keyboard/mouse interface standard. Single port supports both keyboard and mouse. See [[Use_the_PS/2_Mouse]].&lt;br /&gt;
&lt;br /&gt;
; IEC&lt;br /&gt;
: Commodore serial bus for connecting disk drives, printers, and other peripherals.&lt;br /&gt;
&lt;br /&gt;
; VIA&lt;br /&gt;
: Versatile Interface Adapter (WDC 65C22). VIA0 handles Atari joysticks; VIA1 handles keyboard matrix on F256K series.&lt;br /&gt;
&lt;br /&gt;
; UART&lt;br /&gt;
: Universal Asynchronous Receiver-Transmitter; serial communication interface at $D630.&lt;br /&gt;
&lt;br /&gt;
; RTC&lt;br /&gt;
: Real-Time Clock; battery-backed timekeeping chip at $D690.&lt;br /&gt;
&lt;br /&gt;
; SD Card&lt;br /&gt;
: Storage medium for programs and data. Gen1 has one slot; gen2 has internal and external slots.&lt;br /&gt;
&lt;br /&gt;
; DVI&lt;br /&gt;
: Digital Visual Interface; video output on first-gen models (supports both digital and analog signals).&lt;br /&gt;
&lt;br /&gt;
; HDMI&lt;br /&gt;
: High-Definition Multimedia Interface; video output using digital TMDS signaling.&lt;br /&gt;
&lt;br /&gt;
; ESP32 Feather&lt;br /&gt;
: WiFi module for first-gen models (internal installation).&lt;br /&gt;
&lt;br /&gt;
; Wiznet&lt;br /&gt;
: Ethernet/WiFi module for second-gen models with external antenna connector. See [[Wiznet]].&lt;br /&gt;
&lt;br /&gt;
; NES/SNES Controllers&lt;br /&gt;
: Supported game controllers via dedicated pin header or Mini-DIN9 connector. See [[Use_the_SNES/NES_controllers]].&lt;br /&gt;
&lt;br /&gt;
== Software &amp;amp; Firmware ==&lt;br /&gt;
&lt;br /&gt;
; MicroKernel&lt;br /&gt;
: Primary event-based, near real-time kernel for F256 (developed by Gadget). Supports 65c02 and 65816 in emulation mode. See [[Kernels]].&lt;br /&gt;
&lt;br /&gt;
; OpenFNXKernal&lt;br /&gt;
: Community-developed CBM-style kernal alternative with SD Card I/O support. See [[Kernels]].&lt;br /&gt;
&lt;br /&gt;
; SuperBASIC&lt;br /&gt;
: BBC BASIC-inspired interpreter; default F256 programming environment. See [[SuperBASIC]].&lt;br /&gt;
&lt;br /&gt;
; DOS&lt;br /&gt;
: Minimalistic file management and information shell stored in flash.&lt;br /&gt;
&lt;br /&gt;
; F/Manager (fm)&lt;br /&gt;
: Feature-rich file manager, program launcher, and memory exploration software. See [[Firmware]].&lt;br /&gt;
&lt;br /&gt;
; Moreorless (mless)&lt;br /&gt;
: Built-in text editor stored in flash. See [[Moreorless]].&lt;br /&gt;
&lt;br /&gt;
; FoenixMgr&lt;br /&gt;
: Python scripts for uploading code, flashing firmware, and managing the F256 from a PC or Mac.&lt;br /&gt;
&lt;br /&gt;
; xdev&lt;br /&gt;
: Development trampoline firmware component that reacts to FoenixMgr commands (pcopy, runpgz, runpgx).&lt;br /&gt;
&lt;br /&gt;
; CartFlasher (fcart)&lt;br /&gt;
: Utility for programming the 256KB Flash Cartridge with 8KB prepared blocks.&lt;br /&gt;
&lt;br /&gt;
; pexec&lt;br /&gt;
: Kernel routine for loading and executing PGX/PGZ format programs.&lt;br /&gt;
&lt;br /&gt;
== File Formats ==&lt;br /&gt;
&lt;br /&gt;
; KUP&lt;br /&gt;
: Kernel User Program; simple executable format for flash-resident or disk-loaded programs. Header contains signature ($F256), size, slot, and entry point. See [[File_Formats]].&lt;br /&gt;
&lt;br /&gt;
; PGX&lt;br /&gt;
: Single-segment executable with 8-byte header. Similar to MS-DOS COM or Commodore PRG format. See [[File_Formats]].&lt;br /&gt;
&lt;br /&gt;
; PGZ&lt;br /&gt;
: Multi-segment executable format; can load code/data to multiple memory locations. Supports both 24-bit (&#039;Z&#039;) and 32-bit (&#039;z&#039;) addressing. See [[File_Formats]].&lt;br /&gt;
&lt;br /&gt;
; Binary&lt;br /&gt;
: Raw memory image requiring known load address and boot-to-RAM mode. Development use only.&lt;br /&gt;
&lt;br /&gt;
; .bin&lt;br /&gt;
: FPGA core file extension used on F256K2&#039;s FPGA load SD card.&lt;br /&gt;
&lt;br /&gt;
; .uf2&lt;br /&gt;
: RP2040 firmware file format for second-gen models.&lt;br /&gt;
&lt;br /&gt;
== Technical Terms ==&lt;br /&gt;
&lt;br /&gt;
; IRQ&lt;br /&gt;
: Interrupt Request; hardware signal for event-driven programming. See [[IRQ]] and [[IRQ_Programming]].&lt;br /&gt;
&lt;br /&gt;
; NMI&lt;br /&gt;
: Non-Maskable Interrupt; cannot be disabled by software.&lt;br /&gt;
&lt;br /&gt;
; SOF&lt;br /&gt;
: Start of Frame interrupt; triggered at beginning of VSYNC.&lt;br /&gt;
&lt;br /&gt;
; SOL&lt;br /&gt;
: Start of Line interrupt; triggered at configurable scanline.&lt;br /&gt;
&lt;br /&gt;
; VBlank&lt;br /&gt;
: Vertical blanking interval; period between video frames when DMA runs.&lt;br /&gt;
&lt;br /&gt;
; PHI2&lt;br /&gt;
: CPU clock signal phase 2; active high when CPU is accessing the bus.&lt;br /&gt;
&lt;br /&gt;
; R/W&lt;br /&gt;
: Read/Write signal line (Read = high, Write = low).&lt;br /&gt;
&lt;br /&gt;
; BGR / BGRx&lt;br /&gt;
: Color format: Blue, Green, Red byte order. BGRx adds unused padding byte for 4-byte alignment.&lt;br /&gt;
&lt;br /&gt;
; Little Endian&lt;br /&gt;
: Byte ordering with least significant byte at lowest address. Used throughout the F256.&lt;br /&gt;
&lt;br /&gt;
; BCD&lt;br /&gt;
: Binary-Coded Decimal; number encoding where each nibble represents a decimal digit (0-9). Used in RTC.&lt;br /&gt;
&lt;br /&gt;
== DIP Switch Settings ==&lt;br /&gt;
&lt;br /&gt;
DIP switches configure boot behavior and hardware options. See [[DIP_switches]].&lt;br /&gt;
&lt;br /&gt;
; Boot-from-RAM&lt;br /&gt;
: When enabled, kernel searches first 48KB of RAM for programs before checking flash.&lt;br /&gt;
&lt;br /&gt;
; Gamma Enable&lt;br /&gt;
: Enables color gamma correction.&lt;br /&gt;
&lt;br /&gt;
; Core Select (K2)&lt;br /&gt;
: Two switches select which FPGA context (1-4) to load on F256K2.&lt;br /&gt;
&lt;br /&gt;
== Key Register Addresses ==&lt;br /&gt;
&lt;br /&gt;
; $0000 (MMU_MEM_CTRL)&lt;br /&gt;
: MMU Memory Control Register; selects active MLUT and enables editing.&lt;br /&gt;
&lt;br /&gt;
; $0001 (MMU_IO_CTRL)&lt;br /&gt;
: MMU I/O Control Register; selects IO page and controls memory mapping flags.&lt;br /&gt;
&lt;br /&gt;
; $D000 (MSTR_CTRL)&lt;br /&gt;
: VICKY Master Control Register; enables text, graphics, sprites, tiles, bitmaps.&lt;br /&gt;
&lt;br /&gt;
; $D660 (INT_PENDING)&lt;br /&gt;
: Interrupt Pending flags (24-bit).&lt;br /&gt;
&lt;br /&gt;
; $D66C (INT_MASK)&lt;br /&gt;
: Interrupt Mask register (24-bit).&lt;br /&gt;
&lt;br /&gt;
; $D6A0 (SYS0)&lt;br /&gt;
: System Control Register; controls LEDs, reset, and reads SD card status.&lt;br /&gt;
&lt;br /&gt;
== Development Tools ==&lt;br /&gt;
&lt;br /&gt;
; Calypsi&lt;br /&gt;
: C compiler supporting 6502, 65816, and 6809 for F256 development.&lt;br /&gt;
&lt;br /&gt;
; 64tass&lt;br /&gt;
: Popular cross-assembler for 6502/65816.&lt;br /&gt;
&lt;br /&gt;
; cc65&lt;br /&gt;
: C compiler and toolchain for 6502.&lt;br /&gt;
&lt;br /&gt;
; Quartus Prime Lite&lt;br /&gt;
: Intel FPGA programming software. Version 18.1 required for Cyclone IV on gen1 models.&lt;br /&gt;
&lt;br /&gt;
; openFPGALoader&lt;br /&gt;
: Open-source FPGA programming tool for Linux and macOS.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[Hardware]]&lt;br /&gt;
* [[Memory_Management]]&lt;br /&gt;
* [[IO_Pages]]&lt;br /&gt;
* [[Firmware]]&lt;br /&gt;
* [[SuperBASIC]]&lt;br /&gt;
* [[FPGA_Releases]]&lt;br /&gt;
* [[Getting_Started]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Reference]]&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>Cibee</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=DIP_switches&amp;diff=38217</id>
		<title>DIP switches</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=DIP_switches&amp;diff=38217"/>
		<updated>2025-09-14T08:15:39Z</updated>

		<summary type="html">&lt;p&gt;Cibee: Updated FPGA load table&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== F256K DIP switches ==&lt;br /&gt;
&lt;br /&gt;
The following might be slightly outdated. [[File:F256k DIP switches.png|thumb]]&#039;&#039;&#039;Source&#039;&#039;&#039;: https://github.com/ghackwrench/F256_MicroKernel/tree/master/docs#dip-switches&lt;br /&gt;
&lt;br /&gt;
# Enable boot-from-RAM &#039;&#039;&#039;AND&#039;&#039;&#039; don&#039;t prioritize the cart to autoboot a kernel compatible KUP header program &lt;br /&gt;
# Reserved (potentially for SNES gamepad support)&lt;br /&gt;
# Enable SLIP based networking&lt;br /&gt;
# Feather board installed (eg Huzzah 8266 WiFi)&lt;br /&gt;
# SIDs are installed&lt;br /&gt;
# F256: CBM keyboard installed; F256k: reduced TCP window size.&lt;br /&gt;
# ON: 640x480, OFF: 640x400 (&#039;&#039;not yet implemented&#039;&#039;)&lt;br /&gt;
# Enable gamma color correction&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When boot-from-RAM is enabled, the kernel will search the first 48k of RAM for pre-loaded programs before starting the first program on the expansion cartridge or the first program in flash.&lt;br /&gt;
&lt;br /&gt;
== F256K2 Core Select DIP switch ==&lt;br /&gt;
&lt;br /&gt;
[[File:F256k2ds.png|thumb]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
|-&lt;br /&gt;
! Switch !! Binary Value !! Context&lt;br /&gt;
|-&lt;br /&gt;
| 1- ON/ 2- ON || 0 0 || Load 0 - F256K2c&lt;br /&gt;
|-&lt;br /&gt;
| 1- OFF/ 2- ON   || 1 0 || Load 1 - F256K2e&lt;br /&gt;
|-&lt;br /&gt;
| 1- ON/ 2- OFF  || 0 1 || Load 2 - F256K2 FNX6809&lt;br /&gt;
|-&lt;br /&gt;
| 1- OFF/ 2- OFF|| 1 1 || Load 3 - F256K2x&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Cibee</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=38215</id>
		<title>SuperBASIC</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=38215"/>
		<updated>2025-09-13T11:44:53Z</updated>

		<summary type="html">&lt;p&gt;Cibee: Minor formatting changes&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;
* SuperBASIC Mix Bag of [[Code Snippets]]&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;
 10 if a=0 then x=10&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;
 10 if a=0&lt;br /&gt;
 20     x=1&lt;br /&gt;
 30     else&lt;br /&gt;
 40     x=2&lt;br /&gt;
 50 endif&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;
 10 if a=0:x=1:else:x=2:endif&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;
 10 if a=0:x=1:else:x=2: REM &amp;quot;&amp;lt;-- Error, omited the endif&amp;quot;&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;
 10 if a=0 then  : rem &amp;quot;&amp;lt;-- Error, THEN is not needed!!!&amp;quot; &amp;lt;br /&amp;gt;20     x=1 &amp;lt;br /&amp;gt;30     else &amp;lt;br /&amp;gt;40     x=2 &amp;lt;br /&amp;gt;50 endif&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;
 POKEL $0903,data source&lt;br /&gt;
 POKEL $0906,destination &lt;br /&gt;
 POKEL $0909,number of bytes to copy&lt;br /&gt;
 CALL $0900&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;
 SPRITE 0 IMAGE 1 TO 4,4: REM &amp;quot;8x8 Sprite&amp;quot;&lt;br /&gt;
 SPRITE 1 IMAGE 1 TO 8,8: REM &amp;quot;16x16 Sprite&amp;quot;&lt;br /&gt;
 SPRITE 2 IMAGE 2 TO 12,12: REM &amp;quot;24x24 Sprite&amp;quot;&lt;br /&gt;
 SPRITE 3 IMAGE 3 TO 16,16: REM &amp;quot;32x32 Sprite&amp;quot;&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;
 SPRITE 1 TO 8,8&lt;br /&gt;
 SPRITE 1 IMAGE 1: REM &amp;quot;USe a 16x16 Sprite&amp;quot;&lt;/div&gt;</summary>
		<author><name>Cibee</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=38214</id>
		<title>SuperBASIC</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=SuperBASIC&amp;diff=38214"/>
		<updated>2025-09-13T11:42:58Z</updated>

		<summary type="html">&lt;p&gt;Cibee: Reformatted code sections&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;
* SuperBASIC Mix Bag of [[Code Snippets]]&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;
 10 if a=0 then x=10&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;
 10 if a=0&lt;br /&gt;
 20     x=1&lt;br /&gt;
 30     else&lt;br /&gt;
 40     x=2&lt;br /&gt;
 50 endif&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;
 10 if a=0:x=1:else:x=2:endif&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;
 10 if a=0:x=1:else:x=2: REM &amp;quot;&amp;lt;-- Error, omited the endif&amp;quot;&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;
 10 if a=0 then  : rem &amp;quot;&amp;lt;-- Error, THEN is not needed!!!&amp;quot; &amp;lt;br /&amp;gt;20     x=1 &amp;lt;br /&amp;gt;30     else &amp;lt;br /&amp;gt;40     x=2 &amp;lt;br /&amp;gt;50 endif&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;
 SPRITE 0 IMAGE 1 TO 4,4: REM &amp;quot;8x8 Sprite&amp;quot;&lt;br /&gt;
 SPRITE 1 IMAGE 1 TO 8,8: REM &amp;quot;16x16 Sprite&amp;quot;&lt;br /&gt;
 SPRITE 2 IMAGE 2 TO 12,12: REM &amp;quot;24x24 Sprite&amp;quot;&lt;br /&gt;
 SPRITE 3 IMAGE 3 TO 16,16: REM &amp;quot;32x32 Sprite&amp;quot;&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;
 SPRITE 1 TO 8,8&amp;lt;BR&amp;gt;&lt;br /&gt;
 SPRITE 1 IMAGE 1: REM &amp;quot;USe a 16x16 Sprite&amp;quot;&amp;lt;BR&amp;gt;&lt;/div&gt;</summary>
		<author><name>Cibee</name></author>
	</entry>
</feed>