<?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=Minstrel+Dragon</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=Minstrel+Dragon"/>
	<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Special:Contributions/Minstrel_Dragon"/>
	<updated>2026-04-16T05:20:50Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Use_the_Core2x&amp;diff=38312</id>
		<title>Use the Core2x</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Use_the_Core2x&amp;diff=38312"/>
		<updated>2025-12-27T08:26:22Z</updated>

		<summary type="html">&lt;p&gt;Minstrel Dragon: Added link to Core2X introduction video&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;New Features Documentation for the Core2x for K2 and Jr2&lt;br /&gt;
&lt;br /&gt;
[https://256-foenix.us-east-1.linodeobjects.com/F256K2x_Cores%2FCore2x_ShortFormSpec_Aug7th.pdf Core2x_ShortForm_Documentation]&lt;br /&gt;
&lt;br /&gt;
Stefany Allaire&#039;s video on the Core2x features:&lt;br /&gt;
&lt;br /&gt;
https://www.youtube.com/watch?v=ECu1Z3AwZEw&lt;/div&gt;</summary>
		<author><name>Minstrel Dragon</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Use_the_Sam2695_Dream_MIDI_chip&amp;diff=38150</id>
		<title>Use the Sam2695 Dream MIDI chip</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Use_the_Sam2695_Dream_MIDI_chip&amp;diff=38150"/>
		<updated>2025-07-04T11:18:52Z</updated>

		<summary type="html">&lt;p&gt;Minstrel Dragon: Add examples for panning MIDI channels to left and right of stereo field&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Sam2695 Dream IC is in the F256K2 and F256Jr2 only ==&lt;br /&gt;
&lt;br /&gt;
The SAM2695 datasheet can be found in this goodies github repo: https://github.com/Mu0n/F256MiscGoodies/blob/main/datasheets/SAM2695.pdf&lt;br /&gt;
&lt;br /&gt;
The MIDI specification from MIDI.org can be found in the organization&#039;s website https://midi.org/specs &lt;br /&gt;
&lt;br /&gt;
There are many tutorials and overview of useful MIDI commands, here is one of them: https://www.cs.cmu.edu/~music/cmsip/readings/MIDI%20tutorial%20for%20programmers.html &lt;br /&gt;
&lt;br /&gt;
Here&#039;s a reference list of General MIDI instruments by number: https://www.ccarh.org/courses/253/handout/gminstruments/ &amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Register Name&lt;br /&gt;
!Address&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|MIDI_STATUS&lt;br /&gt;
|0xDDA0 &lt;br /&gt;
|Read: Bit[1] = Rx_empty, Bit[2] = Tx_empty&lt;br /&gt;
|-&lt;br /&gt;
|MIDI_FIFO_DATA_PORT &lt;br /&gt;
|0xDDA1 &lt;br /&gt;
|read and write Data Port &lt;br /&gt;
|-&lt;br /&gt;
|MIDI_RXD_COUNT_LOW  &lt;br /&gt;
|0xDDA2 &lt;br /&gt;
|Rx FIFO Data Count LOW&lt;br /&gt;
|-&lt;br /&gt;
|MIDI_RXD_COUNT_HI   &lt;br /&gt;
|0xDDA3 &lt;br /&gt;
|Rx FIFO Data Count Hi - Only the 4 first bit are valid &lt;br /&gt;
|-&lt;br /&gt;
|MIDI_TXD_COUNT_LOW  &lt;br /&gt;
|0xDDA4 &lt;br /&gt;
|Tx FIFO Data Count LOW&lt;br /&gt;
|-&lt;br /&gt;
|MIDI_TXD_COUNT_HI   &lt;br /&gt;
|0xDDA5 &lt;br /&gt;
|Tx FIFO Data Count Hi - Only the 4 first bit are valid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Steps in order to use MIDI OUT ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MIDI OUT picks data from your program and sends it out to the SAM2695 chip as well as the MIDI Out port to an external device.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Send a MIDI command to 0xDDA1 by writing all the bytes of the MIDI command in rapid sequence.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Note On as a moderately heavy middle C to channel 0: 0x90, 0x3C, 0x40&amp;lt;br&amp;gt;&lt;br /&gt;
Note Off as a softly released middle C to channel 0: 0x80, 0x3C, 0x00&amp;lt;br&amp;gt;&lt;br /&gt;
Panning channel 0 to the left of the stereo field: 0xB0, 0x0A, 0x00&amp;lt;br&amp;gt;&lt;br /&gt;
Panning channel 2 to the right of the stereo field: 0xB2, 0x0A, 0x7F&amp;lt;br&amp;gt;&lt;br /&gt;
Changing the instrument of channel 2 to a Slap Bass 1: 0xC2, 0x24&amp;lt;br&amp;gt;&lt;br /&gt;
Shut the 6th channel off: 0xB5, 0x7B, 0x00&lt;br /&gt;
&lt;br /&gt;
=== Steps in order to use MIDI IN ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MIDI IN refers to an external MIDI controller (i.e. piano keyboard) that sends MIDI formatted bytes into the Foenix&#039; MIDI in port&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
First, verify if there are bytes pending in the FIFO buffer by checking if MIDI_STATUS register bit 0 is set to 1 - if so, then create the following loop with steps 2,3,4&amp;lt;br&amp;gt;&lt;br /&gt;
Second, read MIDI_RXD_COUNT_LOW as the low byte of a 16-bit value and MIDI_RXD_COUNT_HI as the high byte of the same value to see how many loop iterations must be done&amp;lt;br&amp;gt;&lt;br /&gt;
Third, read a byte from MIDI_FIFO_DATA_PORT. Keep in mind that reading a byte from the buffer &#039;consumes &amp;amp; removes it&#039; and will reduce the FIFO count by one.&amp;lt;br&amp;gt;&lt;br /&gt;
Fourth, if you just want to blindly send the bytes to the SAM2695, then write each byte back to MIDI_FIFO_DATA_PORT as they are parsed&amp;lt;br&amp;gt;&lt;br /&gt;
Optionally, you may want to react to the bytes, analyze them, modify them before sending them off to MIDI_FIFO_DATA_PORT&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Minstrel Dragon</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=IRQ_Programming&amp;diff=38149</id>
		<title>IRQ Programming</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=IRQ_Programming&amp;diff=38149"/>
		<updated>2025-07-02T16:42:47Z</updated>

		<summary type="html">&lt;p&gt;Minstrel Dragon: Custom IRQ Handling by User Programs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Basic IRQ handling on the 6502 ===&lt;br /&gt;
The 65C02 processor (or 65816 in compatibility mode) contains an interrupt system which allows for code to be executed outside the normal program flow on the occurrence of an external event. Such event can be the start of a new frame, the expiration of a VIA timer, reception of data on a serial input line etc.&lt;br /&gt;
&lt;br /&gt;
Here is a short explanation of how an interrupt is handled:&lt;br /&gt;
&lt;br /&gt;
==== &#039;&#039;&#039;1. IRQ Line Goes Low&#039;&#039;&#039; ====&lt;br /&gt;
&lt;br /&gt;
* The &#039;&#039;&#039;IRQ pin&#039;&#039;&#039; on the 6502 is &#039;&#039;&#039;active low&#039;&#039;&#039;.&lt;br /&gt;
* When the IRQ pin is pulled low by a device and &#039;&#039;&#039;interrupts are enabled&#039;&#039;&#039;, the CPU will respond.&lt;br /&gt;
&lt;br /&gt;
==== &#039;&#039;&#039;2. IRQ Timing&#039;&#039;&#039; ====&lt;br /&gt;
&lt;br /&gt;
* The CPU checks for IRQ at the &#039;&#039;&#039;end of each instruction cycle&#039;&#039;&#039;.&lt;br /&gt;
* If IRQ is active and not masked, the CPU starts the &#039;&#039;&#039;interrupt sequence&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== &#039;&#039;&#039;3. Interrupt Sequence&#039;&#039;&#039; ====&lt;br /&gt;
When an IRQ is accepted:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Complete the current instruction.&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Push the Program Counter (PC)&#039;&#039;&#039; to the stack (2 bytes, high byte first).&lt;br /&gt;
# &#039;&#039;&#039;Push the Processor Status Register (P)&#039;&#039;&#039; to the stack.&lt;br /&gt;
# &#039;&#039;&#039;Set the Interrupt Disable (I) flag&#039;&#039;&#039; in the status register (to prevent nested IRQs).&lt;br /&gt;
# &#039;&#039;&#039;Read the IRQ vector&#039;&#039;&#039; from memory address &amp;lt;code&amp;gt;$FFFE&amp;lt;/code&amp;gt; (low byte) and &amp;lt;code&amp;gt;$FFFF&amp;lt;/code&amp;gt; (high byte).&lt;br /&gt;
# &#039;&#039;&#039;Jump to the address fetched from the IRQ vector.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== &#039;&#039;&#039;4. Returning from Interrupt&#039;&#039;&#039; ====&lt;br /&gt;
&lt;br /&gt;
* The interrupt handler ends with the &#039;&#039;&#039;RTI (Return from Interrupt)&#039;&#039;&#039; instruction.&lt;br /&gt;
* RTI does the reverse:&lt;br /&gt;
** Pulls the status register from the stack.&lt;br /&gt;
** Pulls the program counter (2 bytes) from the stack.&lt;br /&gt;
** Resumes execution where it left off.&lt;br /&gt;
&lt;br /&gt;
=== Standard IRQ Handling by MicroKernel ===&lt;br /&gt;
By default, the interrupts in the F256 machines are handled by the MicroKernel:&lt;br /&gt;
&lt;br /&gt;
* Since the MicroKernel is mapped into memory space at $e000-$ffff, the IRQ vector is defined by the MicroKernel.&lt;br /&gt;
* Therefore, whenever an interrupt condition occurs, the 6502 jumps into the IRQ service routine located within the MicroKernel.&lt;br /&gt;
* The Kernel does the appropriate event handling within the IRQ.&lt;br /&gt;
* It clears the interrupt source that triggered the IRQ.&lt;br /&gt;
* Finally, it returns control back to normal program execution.&lt;br /&gt;
&lt;br /&gt;
=== Custom IRQ Handling by User Programs ===&lt;br /&gt;
&lt;br /&gt;
Sometimes it is useful for user programs to intercept interrupt handling in order to have minimal latency in handling events. Possible reasons for this include:&lt;br /&gt;
&lt;br /&gt;
* Precise music playback in the background of normal program execution.&lt;br /&gt;
* Timing game play at timing intervals different from the start of frame.&lt;br /&gt;
* Graphics effects like sprite reuse.&lt;br /&gt;
* ...&lt;br /&gt;
&lt;br /&gt;
In order to handle interrupts within user land roughly requires the following steps:&lt;br /&gt;
&lt;br /&gt;
# Disable interrupts during the following steps in order to avoid interrupt processing while we are reconfiguring the interrupt handling.&lt;br /&gt;
# Set up the interrupt source. This typically includes something like configuring a timer counter interval, and start the timer. A good source for timer interrupts is the VIA chip which has a timer that runs on a 6 MHz timer clock.&lt;br /&gt;
# Copy the Kernel memory to a suitable location in RAM. This step is necessary because by default the Kernel is running from Read-Only flash memory. However, we need to modify the IRQ vector at $fffe/$ffff in order to re-route the interrupt service routine to our own custom routine.&lt;br /&gt;
# Reconfigure the Memory Management Unit (MMU) in order to access the Kernel in RAM rather than in ROM. While the memory is still being addressed through the address window at $e000-$ffff, the physical memory accessed by the MMU will be pointed to our RAM copy of the Kernel rather than the ROM version.&lt;br /&gt;
# Install our custom Interrupt Service Routine (ISR). This step ensures that our own interrupt routine resides in a location in memory that is accessible when the Interrupt occurs, which may be almost any time, i.e. either when the user program runs, or when the kernel is being executed. In particular this means, we need to be able to access the ISR even if our main program memory is banked out by the Kernel!&lt;br /&gt;
# Enable our custom interrupt source. For example, this may include setting various registers in the VIA chip which trigger the timer to raise an interrupt.&lt;br /&gt;
# Re-enable interrupts, kicking off our interrupt processing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Minstrel Dragon</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=IRQ_Programming&amp;diff=38148</id>
		<title>IRQ Programming</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=IRQ_Programming&amp;diff=38148"/>
		<updated>2025-07-02T16:22:59Z</updated>

		<summary type="html">&lt;p&gt;Minstrel Dragon: added section on standard IRQ Handling by MicroKernel&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Basic IRQ handling on the 6502 ===&lt;br /&gt;
The 65C02 processor (or 65816 in compatibility mode) contains an interrupt system which allows for code to be executed outside the normal program flow on the occurrence of an external event. Such event can be the start of a new frame, the expiration of a VIA timer, reception of data on a serial input line etc.&lt;br /&gt;
&lt;br /&gt;
Here is a short explanation of how an interrupt is handled:&lt;br /&gt;
&lt;br /&gt;
==== &#039;&#039;&#039;1. IRQ Line Goes Low&#039;&#039;&#039; ====&lt;br /&gt;
&lt;br /&gt;
* The &#039;&#039;&#039;IRQ pin&#039;&#039;&#039; on the 6502 is &#039;&#039;&#039;active low&#039;&#039;&#039;.&lt;br /&gt;
* When the IRQ pin is pulled low by a device and &#039;&#039;&#039;interrupts are enabled&#039;&#039;&#039;, the CPU will respond.&lt;br /&gt;
&lt;br /&gt;
==== &#039;&#039;&#039;2. IRQ Timing&#039;&#039;&#039; ====&lt;br /&gt;
&lt;br /&gt;
* The CPU checks for IRQ at the &#039;&#039;&#039;end of each instruction cycle&#039;&#039;&#039;.&lt;br /&gt;
* If IRQ is active and not masked, the CPU starts the &#039;&#039;&#039;interrupt sequence&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== &#039;&#039;&#039;3. Interrupt Sequence&#039;&#039;&#039; ====&lt;br /&gt;
When an IRQ is accepted:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Complete the current instruction.&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Push the Program Counter (PC)&#039;&#039;&#039; to the stack (2 bytes, high byte first).&lt;br /&gt;
# &#039;&#039;&#039;Push the Processor Status Register (P)&#039;&#039;&#039; to the stack.&lt;br /&gt;
# &#039;&#039;&#039;Set the Interrupt Disable (I) flag&#039;&#039;&#039; in the status register (to prevent nested IRQs).&lt;br /&gt;
# &#039;&#039;&#039;Read the IRQ vector&#039;&#039;&#039; from memory address &amp;lt;code&amp;gt;$FFFE&amp;lt;/code&amp;gt; (low byte) and &amp;lt;code&amp;gt;$FFFF&amp;lt;/code&amp;gt; (high byte).&lt;br /&gt;
# &#039;&#039;&#039;Jump to the address fetched from the IRQ vector.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== &#039;&#039;&#039;4. Returning from Interrupt&#039;&#039;&#039; ====&lt;br /&gt;
&lt;br /&gt;
* The interrupt handler ends with the &#039;&#039;&#039;RTI (Return from Interrupt)&#039;&#039;&#039; instruction.&lt;br /&gt;
* RTI does the reverse:&lt;br /&gt;
** Pulls the status register from the stack.&lt;br /&gt;
** Pulls the program counter (2 bytes) from the stack.&lt;br /&gt;
** Resumes execution where it left off.&lt;br /&gt;
&lt;br /&gt;
=== Standard IRQ Handling by MicroKernel ===&lt;br /&gt;
By default, the interrupts in the F256 machines are handled by the MicroKernel:&lt;br /&gt;
&lt;br /&gt;
* Since the MicroKernel is mapped into memory space at $e000-$ffff, the IRQ vector is defined by the MicroKernel.&lt;br /&gt;
* Therefore, whenever an interrupt condition occurs, the 6502 jumps into the IRQ service routine located within the MicroKernel.&lt;br /&gt;
* The Kernel does the appropriate event handling within the IRQ.&lt;br /&gt;
* It clears the interrupt source that triggered the IRQ.&lt;br /&gt;
* Finally, it returns control back to normal program execution.&lt;br /&gt;
&lt;br /&gt;
=== Custom IRQ Handling by User Programs ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Minstrel Dragon</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=IRQ_Programming&amp;diff=38147</id>
		<title>IRQ Programming</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=IRQ_Programming&amp;diff=38147"/>
		<updated>2025-07-02T15:25:26Z</updated>

		<summary type="html">&lt;p&gt;Minstrel Dragon: Basic IRQ handling (with the help of ChatGPT, some details may need additional reviewing)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Basic IRQ handling on the 6502 ===&lt;br /&gt;
The 65C02 processor (or 65816 in compatibility mode) contains an interrupt system which allows for code to be executed outside the normal program flow on the occurrence of an external event. Such event can be the start of a new frame, the expiration of a VIA timer, reception of data on a serial input line etc.&lt;br /&gt;
&lt;br /&gt;
Here is a short explanation of how an interrupt is handled:&lt;br /&gt;
&lt;br /&gt;
==== &#039;&#039;&#039;1. IRQ Line Goes Low&#039;&#039;&#039; ====&lt;br /&gt;
&lt;br /&gt;
* The &#039;&#039;&#039;IRQ pin&#039;&#039;&#039; on the 6502 is &#039;&#039;&#039;active low&#039;&#039;&#039;.&lt;br /&gt;
* When the IRQ pin is pulled low by a device and &#039;&#039;&#039;interrupts are enabled&#039;&#039;&#039;, the CPU will respond.&lt;br /&gt;
&lt;br /&gt;
==== &#039;&#039;&#039;2. IRQ Timing&#039;&#039;&#039; ====&lt;br /&gt;
&lt;br /&gt;
* The CPU checks for IRQ at the &#039;&#039;&#039;end of each instruction cycle&#039;&#039;&#039;.&lt;br /&gt;
* If IRQ is active and not masked, the CPU starts the &#039;&#039;&#039;interrupt sequence&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== &#039;&#039;&#039;3. Interrupt Sequence&#039;&#039;&#039; ====&lt;br /&gt;
When an IRQ is accepted:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Complete the current instruction.&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Push the Program Counter (PC)&#039;&#039;&#039; to the stack (2 bytes, high byte first).&lt;br /&gt;
# &#039;&#039;&#039;Push the Processor Status Register (P)&#039;&#039;&#039; to the stack.&lt;br /&gt;
# &#039;&#039;&#039;Set the Interrupt Disable (I) flag&#039;&#039;&#039; in the status register (to prevent nested IRQs).&lt;br /&gt;
# &#039;&#039;&#039;Read the IRQ vector&#039;&#039;&#039; from memory address &amp;lt;code&amp;gt;$FFFE&amp;lt;/code&amp;gt; (low byte) and &amp;lt;code&amp;gt;$FFFF&amp;lt;/code&amp;gt; (high byte).&lt;br /&gt;
# &#039;&#039;&#039;Jump to the address fetched from the IRQ vector.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== &#039;&#039;&#039;4. Returning from Interrupt&#039;&#039;&#039; ====&lt;br /&gt;
&lt;br /&gt;
* The interrupt handler ends with the &#039;&#039;&#039;RTI (Return from Interrupt)&#039;&#039;&#039; instruction.&lt;br /&gt;
* RTI does the reverse:&lt;br /&gt;
** Pulls the status register from the stack.&lt;br /&gt;
** Pulls the program counter (2 bytes) from the stack.&lt;br /&gt;
** Resumes execution where it left off.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Minstrel Dragon</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Use_the_Sam2695_Dream_MIDI_chip&amp;diff=38102</id>
		<title>Use the Sam2695 Dream MIDI chip</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Use_the_Sam2695_Dream_MIDI_chip&amp;diff=38102"/>
		<updated>2025-06-11T12:16:23Z</updated>

		<summary type="html">&lt;p&gt;Minstrel Dragon: corrected middle C in Note On to 0x3C (decimal 60)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Sam2695 Dream IC is in the F256K2 and F256Jr2 only ==&lt;br /&gt;
&lt;br /&gt;
The SAM2695 datasheet can be found in this goodies github repo: https://github.com/Mu0n/F256MiscGoodies/blob/main/datasheets/SAM2695.pdf&lt;br /&gt;
&lt;br /&gt;
The MIDI specification from MIDI.org can be found in the organization&#039;s website https://midi.org/specs &lt;br /&gt;
&lt;br /&gt;
There are many tutorials and overview of useful MIDI commands, here is one of them: https://www.cs.cmu.edu/~music/cmsip/readings/MIDI%20tutorial%20for%20programmers.html &lt;br /&gt;
&lt;br /&gt;
Here&#039;s a reference list of General MIDI instruments by number: https://www.ccarh.org/courses/253/handout/gminstruments/ &amp;lt;br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Register Name&lt;br /&gt;
!Address&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|MIDI_STATUS&lt;br /&gt;
|0xDDA0 &lt;br /&gt;
|Read: Bit[1] = Rx_empty, Bit[2] = Tx_empty&lt;br /&gt;
|-&lt;br /&gt;
|MIDI_FIFO_DATA_PORT &lt;br /&gt;
|0xDDA1 &lt;br /&gt;
|read and write Data Port &lt;br /&gt;
|-&lt;br /&gt;
|MIDI_RXD_COUNT_LOW  &lt;br /&gt;
|0xDDA2 &lt;br /&gt;
|Rx FIFO Data Count LOW&lt;br /&gt;
|-&lt;br /&gt;
|MIDI_RXD_COUNT_HI   &lt;br /&gt;
|0xDDA3 &lt;br /&gt;
|Rx FIFO Data Count Hi - Only the 4 first bit are valid &lt;br /&gt;
|-&lt;br /&gt;
|MIDI_TXD_COUNT_LOW  &lt;br /&gt;
|0xDDA4 &lt;br /&gt;
|Tx FIFO Data Count LOW&lt;br /&gt;
|-&lt;br /&gt;
|MIDI_TXD_COUNT_HI   &lt;br /&gt;
|0xDDA5 &lt;br /&gt;
|Tx FIFO Data Count Hi - Only the 4 first bit are valid&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Steps in order to use MIDI OUT ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MIDI OUT picks data from your program and sends it out to the SAM2695 chip as well as the MIDI Out port to an external device.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Send a MIDI command to 0xDDA1 by writing all the bytes of the MIDI command in rapid sequence.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Note On as a moderately heavy middle C to channel 0: 0x90, 0x3C, 0x40&amp;lt;br&amp;gt;&lt;br /&gt;
Note Off as a softly released middle C to channel 0: 0x80, 0x3C, 0x00&amp;lt;br&amp;gt;&lt;br /&gt;
Changing the instrument of channel 2 to a Slap Bass 1: 0xC2, 0x24&amp;lt;br&amp;gt;&lt;br /&gt;
Shut the 6th channel off: 0xB5, 0x7B, 0x00&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Steps in order to use MIDI IN ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;MIDI IN refers to an external MIDI controller (i.e. piano keyboard) that sends MIDI formatted bytes into the Foenix&#039; MIDI in port&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
First, verify if there are bytes pending in the FIFO buffer by checking if MIDI_STATUS register bit 0 is set to 1 - if so, then create the following loop with steps 2,3,4&amp;lt;br&amp;gt;&lt;br /&gt;
Second, read MIDI_RXD_COUNT_LOW as the low byte of a 16-bit value and MIDI_RXD_COUNT_HI as the high byte of the same value to see how many loop iterations must be done&amp;lt;br&amp;gt;&lt;br /&gt;
Third, read a byte from MIDI_FIFO_DATA_PORT. Keep in mind that reading a byte from the buffer &#039;consumes &amp;amp; removes it&#039; and will reduce the FIFO count by one.&amp;lt;br&amp;gt;&lt;br /&gt;
Fourth, if you just want to blindly send the bytes to the SAM2695, then write each byte back to MIDI_FIFO_DATA_PORT as they are parsed&amp;lt;br&amp;gt;&lt;br /&gt;
Optionally, you may want to react to the bytes, analyze them, modify them before sending them off to MIDI_FIFO_DATA_PORT&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Minstrel Dragon</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Memory_Management&amp;diff=255</id>
		<title>Memory Management</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Memory_Management&amp;diff=255"/>
		<updated>2024-02-11T09:48:22Z</updated>

		<summary type="html">&lt;p&gt;Minstrel Dragon: corrected start of Flash (old: $80:0000 new: $08:0000)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The F256 line comes with 512 KB of RAM and 512 KB of flash memory. Up to 256 KB additional Memory, either RAM or Flash, can be added through the [[Expansion Port]].&lt;br /&gt;
&lt;br /&gt;
=== Physical Memory Layout ===&lt;br /&gt;
&lt;br /&gt;
The address bus is 21 bits wide, allowing a total of 2&amp;lt;sup&amp;gt;21&amp;lt;/sup&amp;gt; = 2 MB to be addressed.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Address!!Purpose&lt;br /&gt;
|-&lt;br /&gt;
|$00:0000 - $07:FFFF||RAM &lt;br /&gt;
|-&lt;br /&gt;
|$08:0000 - $0F:FFFF||Flash&lt;br /&gt;
|-&lt;br /&gt;
|$10:0000 - $13:FFFF||Expansion Memory&lt;br /&gt;
|-&lt;br /&gt;
|$14:0000 - $1F:FFFF||Reserved&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Memory Management Unit (MMU) ===&lt;br /&gt;
&lt;br /&gt;
While the address bus is generally 21 bits wide, the CPU address bus of the 65c02 and the FNX6809 is only 16 bits wide. Even though the 65816 does have a 24 bit wide address bus, it is currently not used. However, this might change with a future update.&lt;br /&gt;
&lt;br /&gt;
To allow the addressing of the whole address space, 4 Memory Management Units (MMU) are provided, that translate the CPU logical address space to physical addresses.&lt;br /&gt;
&lt;br /&gt;
To achieve this, each MMU has 8 &amp;lt;em&amp;gt;slots&amp;lt;/em&amp;gt;, each representing an 8 KB block of the CPU addressable memory space.&lt;br /&gt;
&lt;br /&gt;
The physical address space is also divided into 8 KB blocks, dividing the available 2 MB into 256 blocks.&lt;br /&gt;
&lt;br /&gt;
To &amp;lt;em&amp;gt;map&amp;lt;/em&amp;gt; a block of physical addresses into CPU address space, the block number is written into the according slot register of the MMU.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Slot!!CPU Address Space!!Slot Register Address&lt;br /&gt;
|-&lt;br /&gt;
|0||$0000 - $1FFF|| $0008&lt;br /&gt;
|-&lt;br /&gt;
|1||$2000 - $3FFF|| $0009&lt;br /&gt;
|-&lt;br /&gt;
|2||$4000 - $5FFF|| $000A&lt;br /&gt;
|-&lt;br /&gt;
|3||$6000 - $7FFF|| $000B&lt;br /&gt;
|-&lt;br /&gt;
|4||$8000 - $9FFF|| $000C&lt;br /&gt;
|-&lt;br /&gt;
|5||$A000 - $BFFF|| $000D&lt;br /&gt;
|-&lt;br /&gt;
|6||$C000 - $DFFF|| $000E&lt;br /&gt;
|-&lt;br /&gt;
|7||$E000 - $FFFF|| $000F&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Only one MMU is active at any one time. To select the active MMU, the lower two bits of address $0000 (MMU_MEM_CTRL) are used.&lt;br /&gt;
&lt;br /&gt;
Editing of MMUs is also controlled by MMU_MEM_CTRL ($0000): Bits 4 and 5 determine which set of MMU registers is to be edited, while bit 7 has to be set to 1 to enable editing.&lt;br /&gt;
When editing is enable, the block number of a physical memory area can be written to the slot register address to map that area to the address in CPU address space. If editing is not enabled (bit 7 of $0000 is 0), the slot register addresses act as ordinary memory with no side effect.&lt;br /&gt;
&lt;br /&gt;
=== Memory Block Tables ===&lt;br /&gt;
The following table shows which block number has to be written into a slot register to make the each 8 KB block of memory available to the CPU.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;border: none; background: none;&amp;quot;&lt;br /&gt;
! colspan=2 scope=col| RAM&lt;br /&gt;
| rowspan=66 style=&amp;quot;border: none; background: none;&amp;quot; |&lt;br /&gt;
! colspan=2 scope=col| Flash&lt;br /&gt;
| rowspan=66 style=&amp;quot;border: none; background: none;&amp;quot; |&lt;br /&gt;
! colspan=2 scope=col| Expansion&lt;br /&gt;
|-&lt;br /&gt;
! scope=col | Block Number&lt;br /&gt;
! scope=col | Physical Address&lt;br /&gt;
&lt;br /&gt;
! scope=col | Block Number&lt;br /&gt;
! scope=col | Physical Address&lt;br /&gt;
&lt;br /&gt;
! scope=col | Block Number&lt;br /&gt;
! scope=col | Physical Address&lt;br /&gt;
|-&lt;br /&gt;
|$00||$00:0000 - $00:1FFF||$40||$08:0000 - $08:1FFF||$80||$10:0000 - $10:1FFF&lt;br /&gt;
|-&lt;br /&gt;
|$01||$00:2000 - $00:3FFF||$41||$08:2000 - $08:3FFF||$81||$10:2000 - $10:3FFF&lt;br /&gt;
|-&lt;br /&gt;
|$02||$00:4000 - $00:5FFF||$42||$08:4000 - $08:5FFF||$82||$10:4000 - $10:5FFF&lt;br /&gt;
|-&lt;br /&gt;
|$03||$00:6000 - $00:7FFF||$43||$08:6000 - $08:7FFF||$83||$10:6000 - $10:7FFF&lt;br /&gt;
|-&lt;br /&gt;
|$04||$00:8000 - $00:9FFF||$44||$08:8000 - $08:9FFF||$84||$10:8000 - $10:9FFF&lt;br /&gt;
|-&lt;br /&gt;
|$05||$00:A000 - $00:BFFF||$45||$08:A000 - $08:BFFF||$85||$10:A000 - $10:BFFF&lt;br /&gt;
|-&lt;br /&gt;
|$06||$00:C000 - $00:DFFF||$46||$08:C000 - $08:DFFF||$86||$10:C000 - $10:DFFF&lt;br /&gt;
|-&lt;br /&gt;
|$07||$00:E000 - $00:FFFF||$47||$08:E000 - $08:FFFF||$87||$10:E000 - $10:FFFF&lt;br /&gt;
|-&lt;br /&gt;
|$08||$01:0000 - $01:1FFF||$48||$09:0000 - $09:1FFF||$88||$11:0000 - $11:1FFF&lt;br /&gt;
|-&lt;br /&gt;
|$09||$01:2000 - $01:3FFF||$49||$09:2000 - $09:3FFF||$89||$11:2000 - $11:3FFF&lt;br /&gt;
|-&lt;br /&gt;
|$0A||$01:4000 - $01:5FFF||$4A||$09:4000 - $09:5FFF||$8A||$11:4000 - $11:5FFF&lt;br /&gt;
|-&lt;br /&gt;
|$0B||$01:6000 - $01:7FFF||$4B||$09:6000 - $09:7FFF||$8B||$11:6000 - $11:7FFF&lt;br /&gt;
|-&lt;br /&gt;
|$0C||$01:8000 - $01:9FFF||$4C||$09:8000 - $09:9FFF||$8C||$11:8000 - $11:9FFF&lt;br /&gt;
|-&lt;br /&gt;
|$0D||$01:A000 - $01:BFFF||$4D||$09:A000 - $09:BFFF||$8D||$11:A000 - $11:BFFF&lt;br /&gt;
|-&lt;br /&gt;
|$0E||$01:C000 - $01:DFFF||$4E||$09:C000 - $09:DFFF||$8E||$11:C000 - $11:DFFF&lt;br /&gt;
|-&lt;br /&gt;
|$0F||$01:E000 - $01:FFFF||$4F||$09:E000 - $09:FFFF||$8F||$11:E000 - $11:FFFF&lt;br /&gt;
|-&lt;br /&gt;
|$10||$02:0000 - $02:1FFF||$50||$0A:0000 - $0A:1FFF||$90||$12:0000 - $12:1FFF&lt;br /&gt;
|-&lt;br /&gt;
|$11||$02:2000 - $02:3FFF||$51||$0A:2000 - $0A:3FFF||$91||$12:2000 - $12:3FFF&lt;br /&gt;
|-&lt;br /&gt;
|$12||$02:4000 - $02:5FFF||$52||$0A:4000 - $0A:5FFF||$92||$12:4000 - $12:5FFF&lt;br /&gt;
|-&lt;br /&gt;
|$13||$02:6000 - $02:7FFF||$53||$0A:6000 - $0A:7FFF||$93||$12:6000 - $12:7FFF&lt;br /&gt;
|-&lt;br /&gt;
|$14||$02:8000 - $02:9FFF||$54||$0A:8000 - $0A:9FFF||$94||$12:8000 - $12:9FFF&lt;br /&gt;
|-&lt;br /&gt;
|$15||$02:A000 - $02:BFFF||$55||$0A:A000 - $0A:BFFF||$95||$12:A000 - $12:BFFF&lt;br /&gt;
|-&lt;br /&gt;
|$16||$02:C000 - $02:DFFF||$56||$0A:C000 - $0A:DFFF||$96||$12:C000 - $12:DFFF&lt;br /&gt;
|-&lt;br /&gt;
|$17||$02:E000 - $02:FFFF||$57||$0A:E000 - $0A:FFFF||$97||$12:E000 - $12:FFFF&lt;br /&gt;
|-&lt;br /&gt;
|$18||$03:0000 - $03:1FFF||$58||$0B:0000 - $0B:1FFF||$98||$13:0000 - $13:1FFF&lt;br /&gt;
|-&lt;br /&gt;
|$19||$03:2000 - $03:3FFF||$59||$0B:2000 - $0B:3FFF||$99||$13:2000 - $13:3FFF&lt;br /&gt;
|-&lt;br /&gt;
|$1A||$03:4000 - $03:5FFF||$5A||$0B:4000 - $0B:5FFF||$9A||$13:4000 - $13:5FFF&lt;br /&gt;
|-&lt;br /&gt;
|$1B||$03:6000 - $03:7FFF||$5B||$0B:6000 - $0B:7FFF||$9B||$13:6000 - $13:7FFF&lt;br /&gt;
|-&lt;br /&gt;
|$1C||$03:8000 - $03:9FFF||$5C||$0B:8000 - $0B:9FFF||$9C||$13:8000 - $13:9FFF&lt;br /&gt;
|-&lt;br /&gt;
|$1D||$03:A000 - $03:BFFF||$5D||$0B:A000 - $0B:BFFF||$9D||$13:A000 - $13:BFFF&lt;br /&gt;
|-&lt;br /&gt;
|$1E||$03:C000 - $03:DFFF||$5E||$0B:C000 - $0B:DFFF||$9E||$13:C000 - $13:DFFF&lt;br /&gt;
|-&lt;br /&gt;
|$1F||$03:E000 - $03:FFFF||$5F||$0B:E000 - $0B:FFFF||$9F||$13:E000 - $13:FFFF&lt;br /&gt;
|-&lt;br /&gt;
|$20||$04:0000 - $04:1FFF||$60||$0C:0000 - $0C:1FFF	&lt;br /&gt;
|-&lt;br /&gt;
|$21||$04:2000 - $04:3FFF||$61||$0C:2000 - $0C:3FFF	&lt;br /&gt;
|-&lt;br /&gt;
|$22||$04:4000 - $04:5FFF||$62||$0C:4000 - $0C:5FFF	&lt;br /&gt;
|-&lt;br /&gt;
|$23||$04:6000 - $04:7FFF||$63||$0C:6000 - $0C:7FFF	&lt;br /&gt;
|-&lt;br /&gt;
|$24||$04:8000 - $04:9FFF||$64||$0C:8000 - $0C:9FFF	&lt;br /&gt;
|-&lt;br /&gt;
|$25||$04:A000 - $04:BFFF||$65||$0C:A000 - $0C:BFFF	&lt;br /&gt;
|-&lt;br /&gt;
|$26||$04:C000 - $04:DFFF||$66||$0C:C000 - $0C:DFFF	&lt;br /&gt;
|-&lt;br /&gt;
|$27||$04:E000 - $04:FFFF||$67||$0C:E000 - $0C:FFFF	&lt;br /&gt;
|-&lt;br /&gt;
|$28||$05:0000 - $05:1FFF||$68||$0D:0000 - $0D:1FFF	&lt;br /&gt;
|-&lt;br /&gt;
|$29||$05:2000 - $05:3FFF||$69||$0D:2000 - $0D:3FFF	&lt;br /&gt;
|-&lt;br /&gt;
|$2A||$05:4000 - $05:5FFF||$6A||$0D:4000 - $0D:5FFF	&lt;br /&gt;
|-&lt;br /&gt;
|$2B||$05:6000 - $05:7FFF||$6B||$0D:6000 - $0D:7FFF	&lt;br /&gt;
|-&lt;br /&gt;
|$2C||$05:8000 - $05:9FFF||$6C||$0D:8000 - $0D:9FFF	&lt;br /&gt;
|-&lt;br /&gt;
|$2D||$05:A000 - $05:BFFF||$6D||$0D:A000 - $0D:BFFF	&lt;br /&gt;
|-&lt;br /&gt;
|$2E||$05:C000 - $05:DFFF||$6E||$0D:C000 - $0D:DFFF	&lt;br /&gt;
|-&lt;br /&gt;
|$2F||$05:E000 - $05:FFFF||$6F||$0D:E000 - $0D:FFFF	&lt;br /&gt;
|-&lt;br /&gt;
|$30||$06:0000 - $06:1FFF||$70||$0E:0000 - $0E:1FFF	&lt;br /&gt;
|-&lt;br /&gt;
|$31||$06:2000 - $06:3FFF||$71||$0E:2000 - $0E:3FFF	&lt;br /&gt;
|-&lt;br /&gt;
|$32||$06:4000 - $06:5FFF||$72||$0E:4000 - $0E:5FFF	&lt;br /&gt;
|-&lt;br /&gt;
|$33||$06:6000 - $06:7FFF||$73||$0E:6000 - $0E:7FFF	&lt;br /&gt;
|-&lt;br /&gt;
|$34||$06:8000 - $06:9FFF||$74||$0E:8000 - $0E:9FFF	&lt;br /&gt;
|-&lt;br /&gt;
|$35||$06:A000 - $06:BFFF||$75||$0E:A000 - $0E:BFFF	&lt;br /&gt;
|-&lt;br /&gt;
|$36||$06:C000 - $06:DFFF||$76||$0E:C000 - $0E:DFFF	&lt;br /&gt;
|-&lt;br /&gt;
|$37||$06:E000 - $06:FFFF||$77||$0E:E000 - $0E:FFFF	&lt;br /&gt;
|-&lt;br /&gt;
|$38||$07:0000 - $07:1FFF||$78||$0F:0000 - $0F:1FFF	&lt;br /&gt;
|-&lt;br /&gt;
|$39||$07:2000 - $07:3FFF||$79||$0F:2000 - $0F:3FFF	&lt;br /&gt;
|-&lt;br /&gt;
|$3A||$07:4000 - $07:5FFF||$7A||$0F:4000 - $0F:5FFF	&lt;br /&gt;
|-&lt;br /&gt;
|$3B||$07:6000 - $07:7FFF||$7B||$0F:6000 - $0F:7FFF	&lt;br /&gt;
|-&lt;br /&gt;
|$3C||$07:8000 - $07:9FFF||$7C||$0F:8000 - $0F:9FFF	&lt;br /&gt;
|-&lt;br /&gt;
|$3D||$07:A000 - $07:BFFF||$7D||$0F:A000 - $0F:BFFF	&lt;br /&gt;
|-&lt;br /&gt;
|$3E||$07:C000 - $07:DFFF||$7E||$0F:C000 - $0F:DFFF	&lt;br /&gt;
|-&lt;br /&gt;
|$3F||$07:E000 - $07:FFFF||$7F||$0F:E000 - $0F:FFFF	&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minstrel Dragon</name></author>
	</entry>
</feed>