<?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=Jfed</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=Jfed"/>
	<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Special:Contributions/Jfed"/>
	<updated>2026-05-30T21:05:14Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Template:Main2/How_To&amp;diff=38514</id>
		<title>Template:Main2/How To</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Template:Main2/How_To&amp;diff=38514"/>
		<updated>2026-03-13T05:29:13Z</updated>

		<summary type="html">&lt;p&gt;Jfed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[Use the CODEC]]&lt;br /&gt;
* [[Use the K2 LCD]]&lt;br /&gt;
* [[Use the LEDs]]&lt;br /&gt;
* [[Use the OPL3 YMF262]]&lt;br /&gt;
* [[Use the PS/2 Mouse]]&lt;br /&gt;
* [[Use the PSG]]&lt;br /&gt;
* [[Use the Sam2695 Dream MIDI chip]]&lt;br /&gt;
* [[Use the SNES/NES controllers]]&lt;br /&gt;
* [[Use the VS1053b chip]]&lt;br /&gt;
* [[Use the Core2x]]&lt;br /&gt;
* [[Use the W6100]]&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=W6100&amp;diff=38513</id>
		<title>W6100</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=W6100&amp;diff=38513"/>
		<updated>2026-03-13T05:27:47Z</updated>

		<summary type="html">&lt;p&gt;Jfed: Jfed moved page W6100 to Use the W6100: Needed to match other names in the HowTo Section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Use the W6100]]&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Use_the_W6100&amp;diff=38512</id>
		<title>Use the W6100</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Use_the_W6100&amp;diff=38512"/>
		<updated>2026-03-13T05:27:47Z</updated>

		<summary type="html">&lt;p&gt;Jfed: Jfed moved page W6100 to Use the W6100: Needed to match other names in the HowTo Section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= W6100 Registers =&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Bit 3:1 for Control Register&lt;br /&gt;
!Bit [3:1]&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|000&lt;br /&gt;
|Write single Transfer&lt;br /&gt;
|-&lt;br /&gt;
|001&lt;br /&gt;
|Write Burst Transfer&lt;br /&gt;
|-&lt;br /&gt;
|010&lt;br /&gt;
|Write MR Register&lt;br /&gt;
|-&lt;br /&gt;
|011&lt;br /&gt;
|RESERVED&lt;br /&gt;
|-&lt;br /&gt;
|100&lt;br /&gt;
|Read Single Transfer&lt;br /&gt;
|-&lt;br /&gt;
|101&lt;br /&gt;
|Read Burst Transfer&lt;br /&gt;
|-&lt;br /&gt;
|110&lt;br /&gt;
|Read MR Register&lt;br /&gt;
|-&lt;br /&gt;
|111&lt;br /&gt;
|RESERVED&lt;br /&gt;
|}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Control Register&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Enable - 0: Block is disabled - 1: Block is Enabled&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|See Above for value&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|See Above for value&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|See Above for value&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Reset FIFOs&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Start Transfer&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Enable FIFO Empty/FIFO Full Interrupt&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|Transfer in Progress&lt;br /&gt;
|}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+W6100 Registers&lt;br /&gt;
!Address&lt;br /&gt;
!R&lt;br /&gt;
!Read Description&lt;br /&gt;
!W&lt;br /&gt;
!Write Description&lt;br /&gt;
|-&lt;br /&gt;
|$F018C0&lt;br /&gt;
|RW&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |Control Register&lt;br /&gt;
|-&lt;br /&gt;
|$F018C1&lt;br /&gt;
|RW&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |MR VAlue&lt;br /&gt;
|-&lt;br /&gt;
|$F018C2&lt;br /&gt;
|&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |&lt;br /&gt;
|-&lt;br /&gt;
|$F018C3&lt;br /&gt;
|RW&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |Single Access Port&lt;br /&gt;
|-&lt;br /&gt;
|$F018C4&lt;br /&gt;
|RW&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |WizNet Address Lo&lt;br /&gt;
|-&lt;br /&gt;
|$F018C5&lt;br /&gt;
|RW&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |WizNet Address Hi&lt;br /&gt;
|-&lt;br /&gt;
|$F018C6&lt;br /&gt;
|R&lt;br /&gt;
|Rx FIFO Quanity Lo&lt;br /&gt;
|W&lt;br /&gt;
|WizNet Transfer Size Lo&lt;br /&gt;
|-&lt;br /&gt;
|$F018C7&lt;br /&gt;
|R&lt;br /&gt;
|Rx FIFO Quanity Hi&lt;br /&gt;
|W&lt;br /&gt;
|WizNet Transfer Size Hi&lt;br /&gt;
|-&lt;br /&gt;
|$F018C8&lt;br /&gt;
|RW&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |FIFO Port&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Use_the_W6100&amp;diff=38511</id>
		<title>Use the W6100</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Use_the_W6100&amp;diff=38511"/>
		<updated>2026-03-13T05:07:29Z</updated>

		<summary type="html">&lt;p&gt;Jfed: Initial Page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= W6100 Registers =&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Bit 3:1 for Control Register&lt;br /&gt;
!Bit [3:1]&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|000&lt;br /&gt;
|Write single Transfer&lt;br /&gt;
|-&lt;br /&gt;
|001&lt;br /&gt;
|Write Burst Transfer&lt;br /&gt;
|-&lt;br /&gt;
|010&lt;br /&gt;
|Write MR Register&lt;br /&gt;
|-&lt;br /&gt;
|011&lt;br /&gt;
|RESERVED&lt;br /&gt;
|-&lt;br /&gt;
|100&lt;br /&gt;
|Read Single Transfer&lt;br /&gt;
|-&lt;br /&gt;
|101&lt;br /&gt;
|Read Burst Transfer&lt;br /&gt;
|-&lt;br /&gt;
|110&lt;br /&gt;
|Read MR Register&lt;br /&gt;
|-&lt;br /&gt;
|111&lt;br /&gt;
|RESERVED&lt;br /&gt;
|}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Control Register&lt;br /&gt;
!Bit&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|Enable - 0: Block is disabled - 1: Block is Enabled&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|See Above for value&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|See Above for value&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|See Above for value&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|Reset FIFOs&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|Start Transfer&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|Enable FIFO Empty/FIFO Full Interrupt&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|Transfer in Progress&lt;br /&gt;
|}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+W6100 Registers&lt;br /&gt;
!Address&lt;br /&gt;
!R&lt;br /&gt;
!Read Description&lt;br /&gt;
!W&lt;br /&gt;
!Write Description&lt;br /&gt;
|-&lt;br /&gt;
|$F018C0&lt;br /&gt;
|RW&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |Control Register&lt;br /&gt;
|-&lt;br /&gt;
|$F018C1&lt;br /&gt;
|RW&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |MR VAlue&lt;br /&gt;
|-&lt;br /&gt;
|$F018C2&lt;br /&gt;
|&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |&lt;br /&gt;
|-&lt;br /&gt;
|$F018C3&lt;br /&gt;
|RW&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |Single Access Port&lt;br /&gt;
|-&lt;br /&gt;
|$F018C4&lt;br /&gt;
|RW&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |WizNet Address Lo&lt;br /&gt;
|-&lt;br /&gt;
|$F018C5&lt;br /&gt;
|RW&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |WizNet Address Hi&lt;br /&gt;
|-&lt;br /&gt;
|$F018C6&lt;br /&gt;
|R&lt;br /&gt;
|Rx FIFO Quanity Lo&lt;br /&gt;
|W&lt;br /&gt;
|WizNet Transfer Size Lo&lt;br /&gt;
|-&lt;br /&gt;
|$F018C7&lt;br /&gt;
|R&lt;br /&gt;
|Rx FIFO Quanity Hi&lt;br /&gt;
|W&lt;br /&gt;
|WizNet Transfer Size Hi&lt;br /&gt;
|-&lt;br /&gt;
|$F018C8&lt;br /&gt;
|RW&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |FIFO Port&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Use_the_K2_LCD&amp;diff=38510</id>
		<title>Use the K2 LCD</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Use_the_K2_LCD&amp;diff=38510"/>
		<updated>2026-03-13T01:34:17Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Registers */   Added CTRL  Register&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== The LCD is part of the F256K2 enclosure ==&lt;br /&gt;
&lt;br /&gt;
The LCD embedded in the enclosure is Sitronix ST7789. &lt;br /&gt;
The full resolution is 240 pixels wide, 320 pixels high. However, there&#039;s a 20 pixel high band at the top and a 20 pixel high band at the bottom which are covered, so the visible usable part is 240x280.&lt;br /&gt;
&lt;br /&gt;
Its datasheet can be found in a goodies github repo: https://github.com/Mu0n/F256MiscGoodies/blob/main/datasheets/ST7789V.pdf&lt;br /&gt;
&lt;br /&gt;
=== Registers ===&lt;br /&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;
|LCD_CMD_CMD&lt;br /&gt;
|0xDD40&lt;br /&gt;
|Write Command Here&lt;br /&gt;
|-&lt;br /&gt;
|LCD_CMD_DTA&lt;br /&gt;
|0xDD41&lt;br /&gt;
|Write Data (For Command) Here; Always Write in pairs (to LCD_PIX_LO and LCD_PIX_HI), otherwise the State Machine will Lock&lt;br /&gt;
|-&lt;br /&gt;
|LCD_PIX_LO&lt;br /&gt;
|0xDD42&lt;br /&gt;
|{G[2:0], B[4:0]} (see below in the Compatible image format section for clarity)&lt;br /&gt;
|-&lt;br /&gt;
|LCD_PIX_HI&lt;br /&gt;
|0xDD43&lt;br /&gt;
|{R[4:0], G[5:3]}&lt;br /&gt;
|-&lt;br /&gt;
|LCD_CTRL_REG&lt;br /&gt;
|0xDD44&lt;br /&gt;
|CTRL Register&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Sending a command using LCD_CMD_CMD ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Command Name&lt;br /&gt;
!Value&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|LCD_RST&lt;br /&gt;
|0x10&lt;br /&gt;
|0 to Reset (RSTn)&lt;br /&gt;
|-&lt;br /&gt;
|LCD_BL&lt;br /&gt;
|0x20&lt;br /&gt;
|1 = ON, 0 = OFF &lt;br /&gt;
|-&lt;br /&gt;
|LCD_WIN_X&lt;br /&gt;
|0x2A&lt;br /&gt;
|define window X &lt;br /&gt;
|-&lt;br /&gt;
|LCD_WIN_Y&lt;br /&gt;
|0x2B&lt;br /&gt;
|define window Y &lt;br /&gt;
|-&lt;br /&gt;
|LCD_WRI&lt;br /&gt;
|0x2C&lt;br /&gt;
|put in memory write mode (pixel writing)&lt;br /&gt;
|-&lt;br /&gt;
|LCD_RD&lt;br /&gt;
|0x2E&lt;br /&gt;
|put in memory read mode&lt;br /&gt;
|-&lt;br /&gt;
|LCD_MAD&lt;br /&gt;
|0x36&lt;br /&gt;
|MADCTL register, which controls in which direction pixel writing occurs&lt;br /&gt;
|-&lt;br /&gt;
|LCD_TE&lt;br /&gt;
|0x40&lt;br /&gt;
|Enable tear mode - avoid updating the display while the controller reads its value&lt;br /&gt;
|}&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+MADCTL Value Bits&lt;br /&gt;
!Bit&lt;br /&gt;
!Mask&lt;br /&gt;
!Name&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|$01&lt;br /&gt;
|&lt;br /&gt;
|Always 0&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|$02&lt;br /&gt;
|&lt;br /&gt;
|Always 0&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|$04&lt;br /&gt;
|MH&lt;br /&gt;
|Scan right to left&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|$08&lt;br /&gt;
|RGB&lt;br /&gt;
|0 = RGB order, 1 = BGR&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|$10&lt;br /&gt;
|ML&lt;br /&gt;
|Scan bottom to top&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|$20&lt;br /&gt;
|MV&lt;br /&gt;
|Rotate display scan by 90°&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|$40&lt;br /&gt;
|MX&lt;br /&gt;
|Read/write right to left&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|$80&lt;br /&gt;
|MY&lt;br /&gt;
|Read/write bottom to top&lt;br /&gt;
|}&lt;br /&gt;
The process for sending a command goes as:&lt;br /&gt;
&lt;br /&gt;
1) send the appropriate command byte to LCD_CMD_CMD &lt;br /&gt;
&lt;br /&gt;
2) write all of your appropriate data byte, in the correct sequence according to the documentation, to LCD_CMD_DTA &lt;br /&gt;
&lt;br /&gt;
Example 1, setting a rectangular region on the LCD to receive pixel writes and managing how &#039;pixel write carriage returns&#039; behave:&amp;lt;pre&amp;gt;&lt;br /&gt;
//assuming an 8-bit value x and width and a 16-bit value y and height	&lt;br /&gt;
POKE(LCD_CMD_CMD, LCD_WIN_X);&lt;br /&gt;
POKE(LCD_CMD_DTA, 0); //xstart high, this will always be 0 since the width is 240 pixels wide&lt;br /&gt;
POKE(LCD_CMD_DTA, x); //xstart low&lt;br /&gt;
POKE(LCD_CMD_DTA, 0); //xend high&lt;br /&gt;
POKE(LCD_CMD_DTA, x+width); //xend low&lt;br /&gt;
	&lt;br /&gt;
POKE(LCD_CMD_CMD, LCD_WIN_Y);&lt;br /&gt;
POKE(LCD_CMD_DTA, (y&amp;amp;0xFF00)); //ystart high&lt;br /&gt;
POKE(LCD_CMD_DTA, 20 + (y&amp;amp;0x00FF)); //ystart low&lt;br /&gt;
POKE(LCD_CMD_DTA, (y+height)&amp;amp;0x00FF); //yend high&lt;br /&gt;
POKE(LCD_CMD_DTA, (y+height)&amp;amp;0x00FF); //yend low&lt;br /&gt;
&amp;lt;/pre&amp;gt;Example 2, set pixel writing in reverse in the Y direction&amp;lt;pre&amp;gt;&lt;br /&gt;
POKE(LCD_CMD_CMD, LCD_MAD);&lt;br /&gt;
POKE(LCD_CMD_DTA, 0x80);&lt;br /&gt;
&amp;lt;/pre&amp;gt;Example 3, writing pixels&amp;lt;pre&amp;gt;&lt;br /&gt;
POKE(LCD_CMD_CMD, LCD_WRI); //only set this once at the start of writing pixel data and redo it if you needed to get sidetracked and did other types of commands&lt;br /&gt;
//start of your loop&lt;br /&gt;
POKEW(LCD_PIX_LO,PIXEL_IN_R5G6B5); //send a word at once&lt;br /&gt;
//end of your loop, only the pixels declared in the rectangular region from example 1 will be affected&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Compatible image format ===&lt;br /&gt;
&lt;br /&gt;
You can send in a .bmp image exported in R5 G6 B5 color palette, converted into a raw 2 byte/per/pixel binary file.&lt;br /&gt;
The R5 G6 B5 palette expects color information in this format: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!High byte&lt;br /&gt;
!Low byte&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;R4 R3 R2 R1 R0 G5 G4 G3&amp;lt;/code&amp;gt;&lt;br /&gt;
|&amp;lt;code&amp;gt;G2 G1 G0 B4 B3 B2 B1 B0&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
The process goes as:&lt;br /&gt;
&lt;br /&gt;
1) Use gimp (or equivalent alternative) and export your image that&#039;s using Indexed color mode as a &#039;Windows BMP Image&#039; &lt;br /&gt;
&lt;br /&gt;
2) During the export process, go to advanced options and select 16 bit, R5 G6 B5 for the color &lt;br /&gt;
&lt;br /&gt;
3) run my python script &#039;bmp2LCD.py&#039; to convert it to a raw binary found at https://github.com/Mu0n/F256MiscGoodies/tree/main in /tools/ &lt;br /&gt;
&lt;br /&gt;
4) for every pixel, send 2 bytes of data to the LCD_PIX_LO and LCD_PIX_HI registers found in the table above &lt;br /&gt;
&lt;br /&gt;
5) you can find some example code from my [https://github.com/Mu0n/F256KsimpleCdoodles/blob/main/lcd/src/lcd.c C github repo here], which sends an image to the LCD screen and then idles.&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_GraphicsVTIOCalls&amp;diff=38401</id>
		<title>FNX6809 GraphicsVTIOCalls</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_GraphicsVTIOCalls&amp;diff=38401"/>
		<updated>2026-01-16T17:34:01Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Basic09 Calls (via the Foenix module) */ Change FOENIX calls to WILD&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Graphics Summary ==&lt;br /&gt;
Use the &amp;lt;code&amp;gt;fstatus&amp;lt;/code&amp;gt; command in Level 2 to see the current status of the graphics registers.&lt;br /&gt;
&lt;br /&gt;
There is a default clut memory module included called &amp;lt;code&amp;gt;xtclut&amp;lt;/code&amp;gt; in CMDS.  This has the xterm colors according to [https://www.ditig.com/publications/256-colors-cheat-sheet this chart]&lt;br /&gt;
&lt;br /&gt;
== Basic09 Calls (via the WILD module) ==&lt;br /&gt;
&lt;br /&gt;
=== INKEY ===&lt;br /&gt;
calling syntax: RUN WILD([path,],&amp;quot;INKEY&amp;quot;,keyval)&lt;br /&gt;
&lt;br /&gt;
=== MouseHR ===&lt;br /&gt;
returns 640x480 XY&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN WILD([path,],&amp;quot;MouseHR&amp;quot;,X,Y,Button)&lt;br /&gt;
&lt;br /&gt;
=== Mouse ===&lt;br /&gt;
returns 320x240 XY&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN WILD([path,],&amp;quot;Mouse&amp;quot;,X,Y,Button)&lt;br /&gt;
&lt;br /&gt;
=== Graphics On ===&lt;br /&gt;
calling syntax: RUN WILD([path,],&amp;quot;Gon&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== Graphics Off ===&lt;br /&gt;
calling syntax: RUN WILD([path,],&amp;quot;Goff&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== BMLoad ===&lt;br /&gt;
Load Bitmap file into allocated Bitmap&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN WILD([path,],&amp;quot;BMLoad&amp;quot;,bmblock,bitmappath)&lt;br /&gt;
&lt;br /&gt;
=== BMClear ===&lt;br /&gt;
Clear image of allocated Bitmap&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN WILD([path,],&amp;quot;BMClear&amp;quot;,bmblock, color)&lt;br /&gt;
&lt;br /&gt;
=== Bitmap ===&lt;br /&gt;
Allocate bitmap&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN WILD([path,],&amp;quot;Bitmap&amp;quot;,bitmap#,screenmode,bmblock,layer,clut#,clutname)&lt;br /&gt;
&lt;br /&gt;
=== BMSave ===&lt;br /&gt;
Save current Bitmap&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN WILD([path,],&amp;quot;BMClear&amp;quot;,bmblock, filename)&lt;br /&gt;
&lt;br /&gt;
=== Bitmap Status ===&lt;br /&gt;
Returns 0 bm(x) if disabled, returns 1 bm(x) enabled&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN WILD([path,],&amp;quot;BMstatus&amp;quot;,bm0,bm1,bm2)&lt;br /&gt;
&lt;br /&gt;
=== Bitmap Off/Free ===&lt;br /&gt;
Disables bitmap and frees bitmap memory&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN WILD([path,],&amp;quot;BMoff&amp;quot;,bitmap#)&lt;br /&gt;
&lt;br /&gt;
=== GFree ===&lt;br /&gt;
Calling syntax: RUN WILD([path,],&amp;quot;GFree&amp;quot;,bitmap#)   &lt;br /&gt;
&lt;br /&gt;
=== ClutFree ===&lt;br /&gt;
Clut Unlink&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN WILD([path,],&amp;quot;ClutFree&amp;quot;,clutheader)&lt;br /&gt;
&lt;br /&gt;
=== Pixel ===&lt;br /&gt;
Draw Pixel&lt;br /&gt;
&lt;br /&gt;
takes X,Y and color and puts it in the bitmap bmblock&lt;br /&gt;
&lt;br /&gt;
x=X, y=Y, a=color&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN WILD([path,],&amp;quot;Pixel&amp;quot;,X,Y,Color,bmblock)&lt;br /&gt;
&lt;br /&gt;
=== GetPixel ===&lt;br /&gt;
Return the color of pixel at x,y&lt;br /&gt;
&lt;br /&gt;
takes X,Y and color and puts it in the bitmap bmblock&lt;br /&gt;
&lt;br /&gt;
x=X, y=Y, a=color&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN WILD([path,],&amp;quot;GetPixel&amp;quot;,X,Y,Color,bmblock)&lt;br /&gt;
&lt;br /&gt;
=== Line ===&lt;br /&gt;
draw line between 2 coordinates&lt;br /&gt;
&lt;br /&gt;
x=16 bit value, y=8 bit value&lt;br /&gt;
&lt;br /&gt;
pc=01 x=23 y=4 x=56 y=7 c=8&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN WILD([path,],&amp;quot;Line&amp;quot;,X1,Y1,X2,Y2,color,bmblock)&lt;br /&gt;
&lt;br /&gt;
=== Multiply ===&lt;br /&gt;
Multiply 2 16 bit integers&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN WILD([path,],&amp;quot;MULTIPLY&amp;quot;, integer_A, integer_B,result_REAL)&lt;br /&gt;
&lt;br /&gt;
=== GetDow ===&lt;br /&gt;
Get Day of week&lt;br /&gt;
&lt;br /&gt;
Returns integer day of week&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN WILD([path,] &amp;quot;GetDow&amp;quot;, dow)&lt;br /&gt;
&lt;br /&gt;
=== GetTime ===&lt;br /&gt;
Get the current time.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN WILD([path,] &amp;quot;GetTime&amp;quot;, hour,minute,seconds)&lt;br /&gt;
&lt;br /&gt;
=== GetDate ===&lt;br /&gt;
Get the current time.&lt;br /&gt;
&lt;br /&gt;
RTC.Base $FE40&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN WILD([path,] &amp;quot;GetDate&amp;quot;, month,day,year)&lt;br /&gt;
&lt;br /&gt;
=== WINFO ===&lt;br /&gt;
Get window information.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN WILD([path,] &amp;quot;WINFO&amp;quot;, format, width, height, foreground, background, border)&lt;br /&gt;
&lt;br /&gt;
=== DWSET ===&lt;br /&gt;
Define a device window.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN WILD([path,] &amp;quot;DWSET&amp;quot;, format, xcor, ycor, width, height, foreground, background, border)&lt;br /&gt;
&lt;br /&gt;
=== COLOR ===&lt;br /&gt;
Set the window colors.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN WILD([path,] &amp;quot;COLOR&amp;quot;, foreground [,background] [,border])&lt;br /&gt;
&lt;br /&gt;
=== SEED ===&lt;br /&gt;
Seeds the hardware-based random number.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN WILD([path,] &amp;quot;SEED&amp;quot; ,value)&lt;br /&gt;
&lt;br /&gt;
=== RANDOM ===&lt;br /&gt;
Returns a hardware-based random number.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN WILD([path,] &amp;quot;RANDOM&amp;quot; ,value)&lt;br /&gt;
&lt;br /&gt;
=== CURHOME ===&lt;br /&gt;
Home the cursor.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN WILD([path,] &amp;quot;CURHOME&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== CURXY ===&lt;br /&gt;
Move the cursor to a column and row.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN WILD([path,] &amp;quot;CURXY&amp;quot;, column, row)&lt;br /&gt;
&lt;br /&gt;
=== ERLINE ===&lt;br /&gt;
Delete the line of text the cursor is on.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN WILD([path,] &amp;quot;ERLINE&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== EREOLINE ===&lt;br /&gt;
Delete text from the cursor to the end of the current line.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN WILD([path,] &amp;quot;EREOLINE&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== CUROFF ===&lt;br /&gt;
Make the cursor invisible&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN WILD([path,] &amp;quot;CUROFF&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== CURRGT ===&lt;br /&gt;
Move the cursor one character to the right.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN WILD([path,] &amp;quot;CURRGT&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== BELL ===&lt;br /&gt;
Produce a beep through the terminal&#039;s speaker.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN WILD([path,] &amp;quot;BELL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== CURLFT ===&lt;br /&gt;
Move the cursor one character to the left.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN WILD([path,] &amp;quot;CURLFT&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== CURUP ===&lt;br /&gt;
Move the cursor one line up.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN WILD([path,] &amp;quot;CURUP&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== CURDWN ===&lt;br /&gt;
Move the cursor one line down.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN WILD([path,] &amp;quot;CURDWN&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== EREOWNDW ===&lt;br /&gt;
Delete text from the current cursor position to the end of the window.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN WILD([path,] &amp;quot;EREOWNDW&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== Clear ===&lt;br /&gt;
Calling syntax: RUN WILD([path,] &amp;quot;CLEAR&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== CRRTN ===&lt;br /&gt;
Send a carriage return.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN WILD([path,] &amp;quot;CRRTN&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== INSLIN ===&lt;br /&gt;
Insert a blank line at the current cursor.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN WILD([path,] &amp;quot;INSLIN&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== DELLIN ===&lt;br /&gt;
Delete the line at the current cursor.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN WILD([path,] &amp;quot;DELLIN&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== DEFCOL ===&lt;br /&gt;
Set palette registers to the default values.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN WILD([path,] &amp;quot;DEFCOL&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== vtio Get/Set Stat Calls ==&lt;br /&gt;
&lt;br /&gt;
=== SS.AScrn ===&lt;br /&gt;
&lt;br /&gt;
Allocate a bitmap screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$Y = bitmap# (0-2)&lt;br /&gt;
        R$X = screentype (0=320x240, 1=320x200)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
        X = Starting Page# of bitmap address&lt;br /&gt;
&lt;br /&gt;
=== SS.DScrn ===&lt;br /&gt;
Display Screen Settings&lt;br /&gt;
&lt;br /&gt;
Set MCR to display text or graphics or both&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = Vicky_MCR Low Byte&lt;br /&gt;
        R$Y = Vicky_MCR High Byte&lt;br /&gt;
&lt;br /&gt;
 Exit:  Nothing. This just sets the register and updates driver variables&lt;br /&gt;
&lt;br /&gt;
VICKY MASTER CONTROL REGISTER to enable graphics and capabilities&lt;br /&gt;
 | 7 |   6   |    5   |   4  |    3   |   2   |   1   |   0  |&lt;br /&gt;
 | X | GAMMA | SPRITE | TILE | BITMAP | GRAPH | OVRLY | TEXT |&lt;br /&gt;
 |   -----   | FON_SET|FON_OV| MON_SLP| DBL_Y | DBL_X | CLK70|&lt;br /&gt;
 $FFC0 MASTER_CTRL_REG_L, MASTER_CTRL_REG_H&lt;br /&gt;
 &lt;br /&gt;
 ********************************************************************&lt;br /&gt;
 * vtio graphics constants (in f256.d)&lt;br /&gt;
 ********************************************************************&lt;br /&gt;
 * Constants used in SS.DScrn to set the display screen type&lt;br /&gt;
&lt;br /&gt;
 FX_GAM             equ       %01000000              Gamma Correction On&lt;br /&gt;
 FX_SPR             equ       %00100000              Sprites On&lt;br /&gt;
 FX_TIL             equ       %00010000              Tile Maps On&lt;br /&gt;
 FX_BM              equ       %00001000              Bitmaps On&lt;br /&gt;
 FX_GRF             equ       %00000100              Graphics Mode On&lt;br /&gt;
 FX_OVR             equ       %00000010              Overlay Text on Graphics&lt;br /&gt;
 FX_TXT             equ       %00000001              Text Mode On&lt;br /&gt;
 FT_FSET            equ       %00100000              Font Set 1 On (0=Font Set 0)&lt;br /&gt;
 FT_FOVR            equ       %00010000              FG and BG colors displayed when overlay text 0=transparent&lt;br /&gt;
 FT_MON             equ       %00001000              Turn off monitor sync and sleep monitor&lt;br /&gt;
 FT_DBX             equ       %00000100              Double-wide text mode characters&lt;br /&gt;
 FT_DBY             equ       %00000010              Double-high text mode characters&lt;br /&gt;
 FT_CLK70           equ       %00000001              70 Hz screen (640x400 txt,320x200 grf)&lt;br /&gt;
 FX_OMIT            equ       %11111111              Setting for SS.DScrn don&#039;t change first byte in MCR&lt;br /&gt;
 FT_OMIT            equ       %11111111              Setting for SS.DScrn don&#039;t change second byte in MCR &lt;br /&gt;
&lt;br /&gt;
=== SS.PScrn ===&lt;br /&gt;
Position Screen Layers&lt;br /&gt;
&lt;br /&gt;
Set layer to display a screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = layer (0-2)&lt;br /&gt;
        R$Y = bitmap# (0-2), tilemap (4-6)&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
&lt;br /&gt;
=== SS.FScrn ===&lt;br /&gt;
&lt;br /&gt;
Free a bitmap screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$Y = bitmap# (0-2)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
&lt;br /&gt;
=== SS.DfPal ===&lt;br /&gt;
Define Palette and populate a CLUT from Memory Module&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = CLUT # (0-3)&lt;br /&gt;
        R$Y = pointer to location of data in caller process&lt;br /&gt;
        (Caller must load data module)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_Manuals&amp;diff=38213</id>
		<title>FNX6809 Manuals</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_Manuals&amp;diff=38213"/>
		<updated>2025-08-29T15:19:05Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Memory Map */ add new memory map to wiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== MMU Registers ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center;&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Address&lt;br /&gt;
!R/W&lt;br /&gt;
!Name&lt;br /&gt;
!7&lt;br /&gt;
!6&lt;br /&gt;
!5&lt;br /&gt;
!4&lt;br /&gt;
!3&lt;br /&gt;
!2&lt;br /&gt;
!1&lt;br /&gt;
!0&lt;br /&gt;
|-&lt;br /&gt;
|$FFA0&lt;br /&gt;
|RW&lt;br /&gt;
|MMU_MEM_CTRL&lt;br /&gt;
| - &lt;br /&gt;
| - &lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |EDIT_LUT&lt;br /&gt;
| - &lt;br /&gt;
| - &lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |ACT_LUT&lt;br /&gt;
|-&lt;br /&gt;
|$FFA1&lt;br /&gt;
|RW&lt;br /&gt;
|MMU_IO_CTRL&lt;br /&gt;
| - &lt;br /&gt;
| - &lt;br /&gt;
| - &lt;br /&gt;
| - &lt;br /&gt;
| - &lt;br /&gt;
|&lt;br /&gt;
|$FFF0-$FFFF&lt;br /&gt;
Enable&lt;br /&gt;
|$FD00-$FDFF&lt;br /&gt;
Enable&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
There are 4 MLUTs (MMU Lookup Tables). &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;ACT_LUT&#039;&#039;&#039; these two bits specify which MLUT (0–3) is used to translate CPU bus address to system bus addresses.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;EDIT_LUT&#039;&#039;&#039; these two bits will specify which MLUT (0 - 3) is being edited and will appear in memory addresses $FFA8-$FFAF.&lt;br /&gt;
&lt;br /&gt;
These locations are defined in nitros9/defs/f256.d:&lt;br /&gt;
&lt;br /&gt;
MMU_MEM_CTRL    equ       $FFA0&lt;br /&gt;
&lt;br /&gt;
MMU_IO_CTRL        equ       $FFA1&lt;br /&gt;
&lt;br /&gt;
MMU_SLOT_0          equ       $FFA8               $0000-$1FFF&lt;br /&gt;
&lt;br /&gt;
MMU_SLOT_1          equ       $FFA9               $2000-$3FFF&lt;br /&gt;
&lt;br /&gt;
MMU_SLOT_2          equ       $FFAA               $4000-$5FFF&lt;br /&gt;
&lt;br /&gt;
MMU_SLOT_3          equ       $FFAB               $6000-$7FFF&lt;br /&gt;
&lt;br /&gt;
MMU_SLOT_4          equ       $FFAC               $8000-$9FFF&lt;br /&gt;
&lt;br /&gt;
MMU_SLOT_5          equ       $FFAD               $A000-$BFFF&lt;br /&gt;
&lt;br /&gt;
MMU_SLOT_6          equ       $FFAE               $C000-$DFFF&lt;br /&gt;
&lt;br /&gt;
MMU_SLOT_7          equ       $FFAF               $E000-$FFFF&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; MMU_IO_CTRL bits&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; $FFA1 has 2 bits:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;    FFA1[0] =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;        1 = Enable internal RAM for segment $FD00-$FDFF.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;        0 = Disable; RAM/FLASH is accessible.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;    FFA1[1] =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;        1 = Enable internal RAM for segment $FFF0-$FFFF&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;        0 = Disable; RAM/FLASH is accessible.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; When enabled, the areas supersede RAM/flash, but will be disabled by RESET. When the system resets,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; those regions revert to RAM/flash. Also at RESET, the contents of RAM retain the old values until the&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; system powers off.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039;  If you are writing an OS-9 program, use &amp;lt;code&amp;gt;F$MapBlk&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;F$ClrBlk&amp;lt;/code&amp;gt; instead of directly accessing these addresses. NitrOS-9 keeps track of each process&#039; MMU LUT (but only if you use &amp;lt;code&amp;gt;F$MapBlk&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;F$ClrBlk&amp;lt;/code&amp;gt;). Addressing the MMU directly can create unpredictable results.&lt;br /&gt;
&lt;br /&gt;
== Memory Map ==&lt;br /&gt;
[[File:K2MemoryMap.png|frameless|818x818px]]&lt;br /&gt;
&lt;br /&gt;
== Memory Model ==&lt;br /&gt;
[[File:FNX6809-MemoryModel Page 1.png|thumb|430x430px|FNX6809 Memory Model Page 1|none]]&lt;br /&gt;
[[File:FNX6809-MemoryModel Page 2.png|none|thumb|430x430px|FNX6809 Memory Model Page 2]]&lt;br /&gt;
__FORCETOC__&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=File:K2MemoryMap.png&amp;diff=38212</id>
		<title>File:K2MemoryMap.png</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=File:K2MemoryMap.png&amp;diff=38212"/>
		<updated>2025-08-29T15:14:09Z</updated>

		<summary type="html">&lt;p&gt;Jfed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Memory Map as of 2025-08&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Wiznet&amp;diff=38197</id>
		<title>Wiznet</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Wiznet&amp;diff=38197"/>
		<updated>2025-08-16T19:56:35Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Updating the firmware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== WIZnet WizFi360 ==&lt;br /&gt;
This chip for wireless and wired networking is found in both the F256Jr.2 and F256K2.&lt;br /&gt;
&lt;br /&gt;
== Updating the firmware ==&lt;br /&gt;
&lt;br /&gt;
Note from Stef: apparently not all modules are updated equal (one thought that by buying the latest module would ==  Latest Firmware) but unfortunately it isn&#039;t the case. &lt;br /&gt;
&lt;br /&gt;
1) Get a cable like this (USB to Serial Interface, DTECH 3ft 3.3V USB to TTL Serial Adapter Debug Cable TX RX Signal 4 Pin Female Socket PL2303 Prolific Chip Windows 10 8 7 XP Vista) https://www.amazon.ca/dp/B08G1JTN4N?ref_=ppx_hzsearch_conn_dt_b_fed_asin_title_1&amp;amp;th=1&lt;br /&gt;
&lt;br /&gt;
2) Connect the cable the following way: &amp;lt;gallery&amp;gt;&lt;br /&gt;
File:Wizfi360 pins.png|The firmware updating pins near the CR2032 battery on the F256K2 (black revision) board&lt;br /&gt;
File:Wiznet connected.png|3 leads from USB cable connected on the SP2 pin header adjacent to the Wiznet chip&lt;br /&gt;
File:Jrjr-wizfi360-pins.png|Pins for the WizFi360 on the Jr.Jr.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Download the latest firmware from here: https://github.com/wizfi/Release/tree/master/Binary&lt;br /&gt;
&lt;br /&gt;
4) Download the wizfi360 manual from: https://github.com/Mu0n/F256MiscGoodies/tree/main/datasheets&lt;br /&gt;
&lt;br /&gt;
5) Download Tera Term 5 from: https://github.com/TeraTermProject/teraterm/releases&lt;br /&gt;
&lt;br /&gt;
6) Follow the instruction in the manual page (page 4 and on)&lt;br /&gt;
&lt;br /&gt;
Connect your cable&lt;br /&gt;
* White Lead to the SP2 3 pins Header (RxD) (next to the CR2032 battery)&lt;br /&gt;
* Black Lead to the middle post (gnd)&lt;br /&gt;
* Green lead to the third pin (TxD)&lt;br /&gt;
* Short the J16 empty header footprint and leave it there (CN1 on the Jr.Jr. - just below the WizFi header pins)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
wizfi360_J16.png|The J16 header footprints are near the WizFi360 chip.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In Tera Term, establish a Serial connection (according to the right COM port that is associated with this USB cable) and set it to 115,200&lt;br /&gt;
* In Tera Term, press and hold ESC&lt;br /&gt;
* Power On the unit&lt;br /&gt;
* You should see some &#039;CCCCC...&#039; in Tera Term, let go of ESC when you do and remove the shorting cable from the J16 header footprint.&lt;br /&gt;
* then do a Xmodem transfer with latest firmware, wait until it tells you that the module is ready...&lt;br /&gt;
* Power off the unit&lt;br /&gt;
* Disconnect the cable&lt;br /&gt;
* It should be updated!&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Wiznet&amp;diff=38196</id>
		<title>Wiznet</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Wiznet&amp;diff=38196"/>
		<updated>2025-08-16T19:53:47Z</updated>

		<summary type="html">&lt;p&gt;Jfed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== WIZnet WizFi360 ==&lt;br /&gt;
This chip for wireless and wired networking is found in both the F256Jr.2 and F256K2.&lt;br /&gt;
&lt;br /&gt;
== Updating the firmware ==&lt;br /&gt;
&lt;br /&gt;
Note from Stef: apparently not all modules are updated equal (one thought that by buying the latest module would ==  Latest Firmware) but unfortunately it isn&#039;t the case. &lt;br /&gt;
&lt;br /&gt;
1) Get a cable like this (USB to Serial Interface, DTECH 3ft 3.3V USB to TTL Serial Adapter Debug Cable TX RX Signal 4 Pin Female Socket PL2303 Prolific Chip Windows 10 8 7 XP Vista) https://www.amazon.ca/dp/B08G1JTN4N?ref_=ppx_hzsearch_conn_dt_b_fed_asin_title_1&amp;amp;th=1&lt;br /&gt;
&lt;br /&gt;
2) Connect the cable the following way: &amp;lt;gallery&amp;gt;&lt;br /&gt;
File:Wizfi360 pins.png|The firmware updating pins near the CR2032 battery on the F256K2 (black revision) board&lt;br /&gt;
File:Wiznet connected.png|3 leads from USB cable connected on the SP2 pin header adjacent to the Wiznet chip&lt;br /&gt;
File:Jrjr-wizfi360-pins.png|Pins for the WizFi360 on the Jr.Jr.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Download the latest firmware from here: https://github.com/wizfi/Release/tree/master/Binary&lt;br /&gt;
&lt;br /&gt;
4) Download the wizfi360 manual from: https://github.com/Mu0n/F256MiscGoodies/tree/main/datasheets&lt;br /&gt;
&lt;br /&gt;
5) Download Tera Term 5 from: https://github.com/TeraTermProject/teraterm/releases&lt;br /&gt;
&lt;br /&gt;
6) Follow the instruction in the manual page (page 4 and on)&lt;br /&gt;
&lt;br /&gt;
Connect your cable&lt;br /&gt;
* White Lead to the SP2 3 pins Header (RxD) (next to the CR2032 battery)&lt;br /&gt;
* Black Lead to the middle post (gnd)&lt;br /&gt;
* Green lead to the third pin (TxD)&lt;br /&gt;
* Short the J16 empty header footprint and leave it there&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
wizfi360_J16.png|The J16 header footprints are near the WizFi360 chip.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In Tera Term, establish a Serial connection (according to the right COM port that is associated with this USB cable) and set it to 115,200&lt;br /&gt;
* In Tera Term, press and hold ESC&lt;br /&gt;
* Power On the unit&lt;br /&gt;
* You should see some &#039;CCCCC...&#039; in Tera Term, let go of ESC when you do and remove the shorting cable from the J16 header footprint.&lt;br /&gt;
* then do a Xmodem transfer with latest firmware, wait until it tells you that the module is ready...&lt;br /&gt;
* Power off the unit&lt;br /&gt;
* Disconnect the cable&lt;br /&gt;
* It should be updated!&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Wiznet&amp;diff=38195</id>
		<title>Wiznet</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Wiznet&amp;diff=38195"/>
		<updated>2025-08-16T19:50:09Z</updated>

		<summary type="html">&lt;p&gt;Jfed: Added picture for pins for Jr.Jr.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== WIZnet WizFi360 ==&lt;br /&gt;
This chip for wireless and wired networking is found in both the F256Jr.2 and F256K2.&lt;br /&gt;
&lt;br /&gt;
== Updating the firmware ==&lt;br /&gt;
&lt;br /&gt;
Note from Stef: apparently not all modules are updated equal (one thought that by buying the latest module would ==  Latest Firmware) but unfortunately it isn&#039;t the case. &lt;br /&gt;
&lt;br /&gt;
1) Get a cable like this (USB to Serial Interface, DTECH 3ft 3.3V USB to TTL Serial Adapter Debug Cable TX RX Signal 4 Pin Female Socket PL2303 Prolific Chip Windows 10 8 7 XP Vista) https://www.amazon.ca/dp/B08G1JTN4N?ref_=ppx_hzsearch_conn_dt_b_fed_asin_title_1&amp;amp;th=1&lt;br /&gt;
&lt;br /&gt;
2) Connect the cable the following way: &amp;lt;gallery&amp;gt;&lt;br /&gt;
File:Index.php?title=File:Wizfi360 pins.png|The firmware updating pins near the CR2032 battery on the F256K2 (black revision) board&lt;br /&gt;
File:Index.php?title=File:Wiznet connected.png|3 leads from USB cable connected on the SP2 pin header adjacent to the Wiznet chip&lt;br /&gt;
File:Jrjr-wizfi360-pins.png|Pins for the WizFi360 on the Jr.Jr.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Download the latest firmware from here: https://github.com/wizfi/Release/tree/master/Binary&lt;br /&gt;
&lt;br /&gt;
4) Download the wizfi360 manual from: https://github.com/Mu0n/F256MiscGoodies/tree/main/datasheets&lt;br /&gt;
&lt;br /&gt;
5) Download Tera Term 5 from: https://github.com/TeraTermProject/teraterm/releases&lt;br /&gt;
&lt;br /&gt;
6) Follow the instruction in the manual page (page 4 and on)&lt;br /&gt;
&lt;br /&gt;
Connect your cable&lt;br /&gt;
* White Lead to the SP2 3 pins Header (RxD) (next to the CR2032 battery)&lt;br /&gt;
* Black Lead to the middle post (gnd)&lt;br /&gt;
* Green lead to the third pin (TxD)&lt;br /&gt;
* Short the J16 empty header footprint and leave it there&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
wizfi360_J16.png|The J16 header footprints are near the WizFi360 chip.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* In Tera Term, establish a Serial connection (according to the right COM port that is associated with this USB cable) and set it to 115,200&lt;br /&gt;
* In Tera Term, press and hold ESC&lt;br /&gt;
* Power On the unit&lt;br /&gt;
* You should see some &#039;CCCCC...&#039; in Tera Term, let go of ESC when you do and remove the shorting cable from the J16 header footprint.&lt;br /&gt;
* then do a Xmodem transfer with latest firmware, wait until it tells you that the module is ready...&lt;br /&gt;
* Power off the unit&lt;br /&gt;
* Disconnect the cable&lt;br /&gt;
* It should be updated!&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=File:Jrjr-wizfi360-pins.png&amp;diff=38194</id>
		<title>File:Jrjr-wizfi360-pins.png</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=File:Jrjr-wizfi360-pins.png&amp;diff=38194"/>
		<updated>2025-08-16T19:47:19Z</updated>

		<summary type="html">&lt;p&gt;Jfed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=OS-9&amp;diff=38075</id>
		<title>OS-9</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=OS-9&amp;diff=38075"/>
		<updated>2025-05-18T13:46:10Z</updated>

		<summary type="html">&lt;p&gt;Jfed: Changes to add FoenixMgr configuration instructions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The FNX6809 combined with the F256 makes a great system for running OS-9/6809. [[wikipedia:OS-9|OS-9]] is a real-time, embedded operating system created by [[wikipedia:Microware|Microware Systems Corporation]]. While it was used in many areas of industry, home computer users know it best for its implementation on the [[wikipedia:TRS-80_Color_Computer|Tandy Color Computer]] sold by Radio Shack&lt;br /&gt;
&lt;br /&gt;
Today, a community effort has led to the creation of [https://github.com/nitros9project/nitros9 NitrOS-9], an open source version of the OS-9 operating system. Throughout this page, I&#039;ll refer to NitrOS-9 as OS-9.&lt;br /&gt;
&lt;br /&gt;
== A word about platforms ==&lt;br /&gt;
This page assumes you&#039;re running on Linux or macOS. If you&#039;re using Windows, these instructions don&#039;t apply, and someone will have to step up and write steps to develop on that platform.&lt;br /&gt;
&lt;br /&gt;
== Tooling ==&lt;br /&gt;
Cross-hosted development is the fastest way to develop for the F256. For this you need the following:&lt;br /&gt;
&lt;br /&gt;
* [http://www.lwtools.ca lwtools] - an assembler/linker package&lt;br /&gt;
* [https://github.com/nitros9project/toolshed ToolShed] - a set of tools for creating disk images&lt;br /&gt;
* [https://github.com/nitros9project/nitros9 NitrOS-9] - the NitrOS-9 operating system in source form&lt;br /&gt;
* [https://github.com/pweingar/FoenixMgr FoenixMgr] - tools to load code into RAM or Flash of the F256.&lt;br /&gt;
&lt;br /&gt;
You can pull these down individually, or better yet, use [https://github.com/strickyak @strickyak]&#039;s great [https://github.com/strickyak/coco-shelf/ CoCo Shelf repository]. It has a &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; which gets all of the above and puts it in a convenient location (note that you&#039;ll have to update your shell script of choice to include the locations of the binaries in the &amp;lt;code&amp;gt;PATH&amp;lt;/code&amp;gt; environment variable).&lt;br /&gt;
&lt;br /&gt;
Here are the terminal commands for Linux and macOS to pull down all the required software:&lt;br /&gt;
 cd&lt;br /&gt;
 git clone &amp;lt;nowiki&amp;gt;https://github.com/strickyak/coco-shelf.git&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 cd coco-shelf&lt;br /&gt;
 export PATH=&amp;quot;$PATH:$HOME/coco-shelf/bin&amp;quot;&lt;br /&gt;
 make ANON=1 nitros9/done FoenixMgr/done&lt;br /&gt;
&lt;br /&gt;
(If you have a github account and your github ssh key is loaded,&lt;br /&gt;
you can omit `ANON=1` on the last command,&lt;br /&gt;
so it will check out git repositories using your github username,&lt;br /&gt;
in case you want to push changes.)&lt;br /&gt;
&lt;br /&gt;
There is a special Make target for re-flashing the F256Jr or F256K,&lt;br /&gt;
but first time you run this command, it should fail.  &lt;br /&gt;
Then you have to edit the `port=` line in `FoenixMgr/foenixmgr.ini`&lt;br /&gt;
and run the command again (with the cable plugged in): &lt;br /&gt;
 make ANON=1 run-f256-flash        # Old command for F256Jr that works?&lt;br /&gt;
or&lt;br /&gt;
 make ANON=1 run-f256jr-flash      # TODO fix this&lt;br /&gt;
or&lt;br /&gt;
 make ANON=1 run-f256k-flash       # TODO fix this&lt;br /&gt;
&lt;br /&gt;
=== Configure FoenixMgr ===&lt;br /&gt;
The makefiles for f256 NitrOS-9 use the &amp;lt;code&amp;gt;bulk-flash&amp;lt;/code&amp;gt; command from FoenixMgr.  This command is in the &amp;lt;code&amp;gt;bin&amp;lt;/code&amp;gt; directory of coco-shelf.  The &amp;lt;code&amp;gt;bin&amp;lt;/code&amp;gt; directory must be in your &amp;lt;code&amp;gt;PATH&amp;lt;/code&amp;gt; in order for the flash procedure to work from the NitrOS-9 makefile. On linux, add a line to your &amp;lt;code&amp;gt;.profile&amp;lt;/code&amp;gt; similar to:&lt;br /&gt;
&lt;br /&gt;
 PATH=&amp;quot;$HOME/coco-shelf/bin:$PATH&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FoenixMgr&#039;s &amp;lt;code&amp;gt;foenixmgr.ini&amp;lt;/code&amp;gt; file must also be configured with the correct port to flash the f256.  The F256 Jr.Jr. and F256 K2 both have a USB-C serial port that requires no additional drivers.  The F256 Jr. and F256-K have a USB debug port which requires a special driver to work.  The procedure for the F256 Jr.Jr. and F256 K2:  plug the usb cable to your computer and the F256 and turn on the F256. On linux, type lsusb to verify the connection.  The output should show an FT4232 UART:&lt;br /&gt;
&lt;br /&gt;
 ~/coco-shelf/FoenixMgr $ lsusb&lt;br /&gt;
 &lt;br /&gt;
 Bus 002 Device 002: ID 174c:55aa ASMedia Technology Inc. ASM1051E SATA 6Gb/s bridge, ASM1053E SATA 6Gb/s bridge, ASM1153 SATA 3Gb/s bridge, ASM1153E SATA 6Gb/s bridge&lt;br /&gt;
 Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub&lt;br /&gt;
 &#039;&#039;&#039;Bus 001 Device 017: ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC&#039;&#039;&#039;&lt;br /&gt;
 Bus 001 Device 003: ID 248a:8367 Maxxter Telink Wireless Receiver&lt;br /&gt;
 Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub&lt;br /&gt;
&lt;br /&gt;
Next change directory to coco-shelf/FoenixMgr and run python &amp;lt;code&amp;gt;FoenixMgr/FoenixMgr.py --list-ports&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 ~/coco-shelf/FoenixMgr $ python FoenixMgr/fnxmgr.py --list-ports&lt;br /&gt;
  &lt;br /&gt;
 ++ python3 FoenixMgr/fnxmgr.py --list-ports&lt;br /&gt;
   Description: n/a&lt;br /&gt;
   Manufacturer: None&lt;br /&gt;
   Product: None&lt;br /&gt;
 /dev/ttyUSB3&lt;br /&gt;
   Description: New Retro Computer - New Retro Computer&lt;br /&gt;
   Manufacturer: Xilinx&lt;br /&gt;
   Product: New Retro Computer&lt;br /&gt;
 /dev/ttyUSB2&lt;br /&gt;
   Description: New Retro Computer - New Retro Computer&lt;br /&gt;
   Manufacturer: Xilinx&lt;br /&gt;
   Product: New Retro Computer&lt;br /&gt;
 /dev/ttyUSB1&lt;br /&gt;
   Description: New Retro Computer - New Retro Computer&lt;br /&gt;
   Manufacturer: Xilinx&lt;br /&gt;
   Product: New Retro Computer&lt;br /&gt;
 /dev/ttyUSB0&amp;lt;/code&amp;gt;&lt;br /&gt;
   Description: New Retro Computer - New Retro Computer&lt;br /&gt;
   Manufacturer: Xilinx&lt;br /&gt;
   Product: New Retro Computer&lt;br /&gt;
&lt;br /&gt;
The second port,&amp;lt;code&amp;gt;/dev/ttyUSB1&amp;lt;/code&amp;gt;, should be the correct port.  Change the port line in &amp;lt;code&amp;gt;foenixmgr.ini&amp;lt;/code&amp;gt; to this port and save it (you don&#039;t have to worry about the other settings):&lt;br /&gt;
&lt;br /&gt;
 ~/coco-shelf/FoenixMgr/foenixmgr.ini&lt;br /&gt;
 &lt;br /&gt;
 [DEFAULT]&lt;br /&gt;
 &#039;&#039;&#039;port=/dev/ttyUSB1&#039;&#039;&#039;&lt;br /&gt;
 labels=sample.lbl&lt;br /&gt;
 flash_address=380000&lt;br /&gt;
 chunk_size=1024&lt;br /&gt;
 cpu=65816&lt;br /&gt;
&lt;br /&gt;
FoenixMgr should now be configured to flash the &amp;lt;code&amp;gt;FEU&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Building FEU and OS-9 Level 1 from scratch ==&lt;br /&gt;
FEU is the Foenix Executive Utility. It resides in flash and hosts a debugger and booters that can bring up operating systems like OS-9. FEU runs under OS-9 Level 1, so go ahead and build the entire operating system:&lt;br /&gt;
 cd nitros9&lt;br /&gt;
 export NITROS9DIR=$PWD&lt;br /&gt;
 cd level1/f256&lt;br /&gt;
 make &lt;br /&gt;
 cd feu&lt;br /&gt;
Now you can flash the image into the F256. You must have a USB cable connected to the system from your computer. Note: if you&#039;re using a Mac, you won&#039;t be able to upload code into the F256 due to the [https://www.maxlinear.com/support/design-tools/software-drivers driver manufacturer] being so behind on updates. You can use a Linux VM and FoenixMgr tools in bridge mode on the Mac.&lt;br /&gt;
&lt;br /&gt;
There are distinct builds of FEU for the F256 Jr and the F256K. Power up the machine, then select the correct command:&lt;br /&gt;
 cd feu&lt;br /&gt;
 make flash_f256jr&lt;br /&gt;
or&lt;br /&gt;
 cd feu&lt;br /&gt;
 make flash_f256k&lt;br /&gt;
&lt;br /&gt;
Then (this is in addition to make flash_f256jr or make flash_f256k):&lt;br /&gt;
&lt;br /&gt;
 make flash_f0&lt;br /&gt;
&lt;br /&gt;
Once the flash completes, restart the machine and FEU should come up.&lt;br /&gt;
&lt;br /&gt;
== Building OS-9 Level 2 ==&lt;br /&gt;
To build OS-9 Level 2, run these commands (this assumes you have added the NITROS9DIR environment variable as above:  export NITROS9DIR=$PWD from the top level nitros9 directory):&lt;br /&gt;
 cd ../../level2/f256&lt;br /&gt;
 make dsk&lt;br /&gt;
&lt;br /&gt;
This produces the following disk images for the F256 Jr and the F256K:&lt;br /&gt;
&lt;br /&gt;
 NOS9_6809_L2_v030300_f256jr_dw.dsk&lt;br /&gt;
 NOS9_6809_L2_v030300_f256jr_sd.dsk&lt;br /&gt;
 NOS9_6809_L2_v030300_f256k_dw.dsk&lt;br /&gt;
 NOS9_6809_L2_v030300_f256k_sd.dsk&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;dw&#039;&#039; disk images are for booting from DriveWire. The &#039;&#039;sd&#039;&#039; disk image are for booting from the SD card. You need to write the images onto an SD card, then insert the SD card into the F256 and restart.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s how to image the SD card.&lt;br /&gt;
&lt;br /&gt;
==== Linux ====&lt;br /&gt;
On Linux, insert the SD card into your computer. Ttype &amp;lt;code&amp;gt;lsblk&amp;lt;/code&amp;gt; to find the correct device and replace &#039;&#039;sdx&#039;&#039; on the command line below with it:&lt;br /&gt;
&lt;br /&gt;
 dd if=NOS9_6809_L2_v030300_f256k_sd.dsk of=/dev/&#039;&#039;sdx&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== macOS ====&lt;br /&gt;
On macOS, insert the SD card into your Mac. A dialog will likely appear telling you that the disk you attached isn&#039;t readable. Click the &amp;quot;ignore&amp;quot; button, then type &amp;lt;code&amp;gt;diskutil list external&amp;lt;/code&amp;gt; to obtain the device name of the SD card and replace &#039;&#039;diskx&#039;&#039; on the command line below with it:&lt;br /&gt;
 sudo dd if=NOS9_6809_L2_v030300_f256k_sd.dsk of=/dev/&#039;&#039;diskx&#039;&#039;&lt;br /&gt;
Once the command completes, type:&lt;br /&gt;
 diskutil eject /dev/&#039;&#039;diskx&#039;&#039;&lt;br /&gt;
You can then safely remove the SD card.&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=OS-9&amp;diff=38074</id>
		<title>OS-9</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=OS-9&amp;diff=38074"/>
		<updated>2025-05-18T13:23:40Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Tooling */ Add configuring FoenixMgr&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The FNX6809 combined with the F256 makes a great system for running OS-9/6809. [[wikipedia:OS-9|OS-9]] is a real-time, embedded operating system created by [[wikipedia:Microware|Microware Systems Corporation]]. While it was used in many areas of industry, home computer users know it best for its implementation on the [[wikipedia:TRS-80_Color_Computer|Tandy Color Computer]] sold by Radio Shack&lt;br /&gt;
&lt;br /&gt;
Today, a community effort has led to the creation of [https://github.com/nitros9project/nitros9 NitrOS-9], an open source version of the OS-9 operating system. Throughout this page, I&#039;ll refer to NitrOS-9 as OS-9.&lt;br /&gt;
&lt;br /&gt;
== A word about platforms ==&lt;br /&gt;
This page assumes you&#039;re running on Linux or macOS. If you&#039;re using Windows, these instructions don&#039;t apply, and someone will have to step up and write steps to develop on that platform.&lt;br /&gt;
&lt;br /&gt;
== Tooling ==&lt;br /&gt;
Cross-hosted development is the fastest way to develop for the F256. For this you need the following:&lt;br /&gt;
&lt;br /&gt;
* [http://www.lwtools.ca lwtools] - an assembler/linker package&lt;br /&gt;
* [https://github.com/nitros9project/toolshed ToolShed] - a set of tools for creating disk images&lt;br /&gt;
* [https://github.com/nitros9project/nitros9 NitrOS-9] - the NitrOS-9 operating system in source form&lt;br /&gt;
* [https://github.com/pweingar/FoenixMgr FoenixMgr] - tools to load code into RAM or Flash of the F256.&lt;br /&gt;
&lt;br /&gt;
You can pull these down individually, or better yet, use [https://github.com/strickyak @strickyak]&#039;s great [https://github.com/strickyak/coco-shelf/ CoCo Shelf repository]. It has a &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; which gets all of the above and puts it in a convenient location (note that you&#039;ll have to update your shell script of choice to include the locations of the binaries in the &amp;lt;code&amp;gt;PATH&amp;lt;/code&amp;gt; environment variable).&lt;br /&gt;
&lt;br /&gt;
Here are the terminal commands for Linux and macOS to pull down all the required software:&lt;br /&gt;
 cd&lt;br /&gt;
 git clone &amp;lt;nowiki&amp;gt;https://github.com/strickyak/coco-shelf.git&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 cd coco-shelf&lt;br /&gt;
 export PATH=&amp;quot;$PATH:$HOME/coco-shelf/bin&amp;quot;&lt;br /&gt;
 make ANON=1 nitros9/done FoenixMgr/done&lt;br /&gt;
&lt;br /&gt;
(If you have a github account and your github ssh key is loaded,&lt;br /&gt;
you can omit `ANON=1` on the last command,&lt;br /&gt;
so it will check out git repositories using your github username,&lt;br /&gt;
in case you want to push changes.)&lt;br /&gt;
&lt;br /&gt;
There is a special Make target for re-flashing the F256Jr or F256K,&lt;br /&gt;
but first time you run this command, it should fail.  &lt;br /&gt;
Then you have to edit the `port=` line in `FoenixMgr/foenixmgr.ini`&lt;br /&gt;
and run the command again (with the cable plugged in): &lt;br /&gt;
 make ANON=1 run-f256-flash        # Old command for F256Jr that works?&lt;br /&gt;
or&lt;br /&gt;
 make ANON=1 run-f256jr-flash      # TODO fix this&lt;br /&gt;
or&lt;br /&gt;
 make ANON=1 run-f256k-flash       # TODO fix this&lt;br /&gt;
&lt;br /&gt;
=== Configure FoenixMgr ===&lt;br /&gt;
The makefiles for f256 NitrOS-9 use the &amp;lt;code&amp;gt;bulk-flash&amp;lt;/code&amp;gt; command from FoenixMgr.  This command is in the &amp;lt;code&amp;gt;bin&amp;lt;/code&amp;gt; directory of coco-shelf.  The &amp;lt;code&amp;gt;bin&amp;lt;/code&amp;gt; directory must be in your &amp;lt;code&amp;gt;PATH&amp;lt;/code&amp;gt; in order for the flash procedure to work from the NitrOS-9 makefile. On linux, you can add a line to your &amp;lt;code&amp;gt;.profile&amp;lt;/code&amp;gt; similar to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PATH=&amp;quot;$HOME/coco-shelf/bin:$PATH&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
FoenixMgr&#039;s &amp;lt;code&amp;gt;foenixmgr.ini&amp;lt;/code&amp;gt; file must also be configured with the correct port to flash the f256.  The F256 Jr.Jr. and F256 K2 both have a USB-C serial port that requires no additional drivers.  The F256 Jr. and F256-K have a USB debug port which requires a special driver to work.  The procedure for the F256 Jr.Jr. and F256 K2:  plug the usb cable to your computer and the F256 and turn on the F256. On linux, type lsusb to verify the connection.  The output should show an FT4232 UART:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;~/coco-shelf/FoenixMgr $ lsusb&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Bus 002 Device 002: ID 174c:55aa ASMedia Technology Inc. ASM1051E SATA 6Gb/s bridge, ASM1053E SATA 6Gb/s bridge, ASM1153 SATA 3Gb/s bridge, ASM1153E SATA 6Gb/s bridge&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;B&#039;&#039;&#039;us 001 Device 017: ID 0403:6011 Future Technology Devices International, Ltd FT4232H Quad HS USB-UART/FIFO IC&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Bus 001 Device 003: ID 248a:8367 Maxxter Telink Wireless Receiver&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next change directory to coco-shelf/FoenixMgr and run python &amp;lt;code&amp;gt;FoenixMgr/FoenixMgr.py --list-ports&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;~/projects/coco-shelf/FoenixMgr $ python FoenixMgr/fnxmgr.py --list-ports&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;++ python3 FoenixMgr/fnxmgr.py --list-ports&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;   Description: n/a&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;   Manufacturer: None&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;   Product: None&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;/dev/ttyUSB3&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;   Description: New Retro Computer - New Retro Computer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;   Manufacturer: Xilinx&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;   Product: New Retro Computer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;/dev/ttyUSB2&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;   Description: New Retro Computer - New Retro Computer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;   Manufacturer: Xilinx&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;   Product: New Retro Computer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;/dev/ttyUSB1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;   Description: New Retro Computer - New Retro Computer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;   Manufacturer: Xilinx&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;   Product: New Retro Computer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;/dev/ttyUSB0&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;   Description: New Retro Computer - New Retro Computer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;   Manufacturer: Xilinx&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;   Product: New Retro Computer&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The second port,&amp;lt;code&amp;gt;/dev/ttyUSB1&amp;lt;/code&amp;gt;, should be the correct port.  Change the port line in &amp;lt;code&amp;gt;foenixmgr.ini&amp;lt;/code&amp;gt; to this port and save it (you don&#039;t have to worry about the other settings):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;~/coco-shelf/FoenixMgr/foenixmgr.ini&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[DEFAULT]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;port=/dev/ttyUSB1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;labels=sample.lbl&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;flash_address=380000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;chunk_size=1024&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cpu=65816&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
FoenixMgr should now be configured to flash the &amp;lt;code&amp;gt;FEU&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Building FEU and OS-9 Level 1 from scratch ==&lt;br /&gt;
FEU is the Foenix Executive Utility. It resides in flash and hosts a debugger and booters that can bring up operating systems like OS-9. FEU runs under OS-9 Level 1, so go ahead and build the entire operating system:&lt;br /&gt;
 cd nitros9&lt;br /&gt;
 export NITROS9DIR=$PWD&lt;br /&gt;
 cd level1/f256&lt;br /&gt;
 make &lt;br /&gt;
 cd feu&lt;br /&gt;
Now you can flash the image into the F256. You must have a USB cable connected to the system from your computer. Note: if you&#039;re using a Mac, you won&#039;t be able to upload code into the F256 due to the [https://www.maxlinear.com/support/design-tools/software-drivers driver manufacturer] being so behind on updates. You can use a Linux VM and FoenixMgr tools in bridge mode on the Mac.&lt;br /&gt;
&lt;br /&gt;
There are distinct builds of FEU for the F256 Jr and the F256K. Power up the machine, then select the correct command:&lt;br /&gt;
 cd feu&lt;br /&gt;
 make flash_f256jr&lt;br /&gt;
or&lt;br /&gt;
 cd feu&lt;br /&gt;
 make flash_f256k&lt;br /&gt;
&lt;br /&gt;
Then (this is in addition to make flash_f256jr or make flash_f256k):&lt;br /&gt;
&lt;br /&gt;
 make flash_f0&lt;br /&gt;
&lt;br /&gt;
Once the flash completes, restart the machine and FEU should come up.&lt;br /&gt;
&lt;br /&gt;
== Building OS-9 Level 2 ==&lt;br /&gt;
To build OS-9 Level 2, run these commands (this assumes you have added the NITROS9DIR environment variable as above:  export NITROS9DIR=$PWD from the top level nitros9 directory):&lt;br /&gt;
 cd ../../level2/f256&lt;br /&gt;
 make dsk&lt;br /&gt;
&lt;br /&gt;
This produces the following disk images for the F256 Jr and the F256K:&lt;br /&gt;
&lt;br /&gt;
 NOS9_6809_L2_v030300_f256jr_dw.dsk&lt;br /&gt;
 NOS9_6809_L2_v030300_f256jr_sd.dsk&lt;br /&gt;
 NOS9_6809_L2_v030300_f256k_dw.dsk&lt;br /&gt;
 NOS9_6809_L2_v030300_f256k_sd.dsk&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;dw&#039;&#039; disk images are for booting from DriveWire. The &#039;&#039;sd&#039;&#039; disk image are for booting from the SD card. You need to write the images onto an SD card, then insert the SD card into the F256 and restart.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s how to image the SD card.&lt;br /&gt;
&lt;br /&gt;
==== Linux ====&lt;br /&gt;
On Linux, insert the SD card into your computer. Ttype &amp;lt;code&amp;gt;lsblk&amp;lt;/code&amp;gt; to find the correct device and replace &#039;&#039;sdx&#039;&#039; on the command line below with it:&lt;br /&gt;
&lt;br /&gt;
 dd if=NOS9_6809_L2_v030300_f256k_sd.dsk of=/dev/&#039;&#039;sdx&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== macOS ====&lt;br /&gt;
On macOS, insert the SD card into your Mac. A dialog will likely appear telling you that the disk you attached isn&#039;t readable. Click the &amp;quot;ignore&amp;quot; button, then type &amp;lt;code&amp;gt;diskutil list external&amp;lt;/code&amp;gt; to obtain the device name of the SD card and replace &#039;&#039;diskx&#039;&#039; on the command line below with it:&lt;br /&gt;
 sudo dd if=NOS9_6809_L2_v030300_f256k_sd.dsk of=/dev/&#039;&#039;diskx&#039;&#039;&lt;br /&gt;
Once the command completes, type:&lt;br /&gt;
 diskutil eject /dev/&#039;&#039;diskx&#039;&#039;&lt;br /&gt;
You can then safely remove the SD card.&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_GraphicsVTIOCalls&amp;diff=37930</id>
		<title>FNX6809 GraphicsVTIOCalls</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_GraphicsVTIOCalls&amp;diff=37930"/>
		<updated>2025-01-25T20:51:17Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Bitmap Off/Free */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Graphics Summary ==&lt;br /&gt;
Use the &amp;lt;code&amp;gt;fstatus&amp;lt;/code&amp;gt; command in Level 2 to see the current status of the graphics registers.&lt;br /&gt;
&lt;br /&gt;
There is a default clut memory module included called &amp;lt;code&amp;gt;xtclut&amp;lt;/code&amp;gt; in CMDS.  This has the xterm colors according to [https://www.ditig.com/publications/256-colors-cheat-sheet this chart]&lt;br /&gt;
&lt;br /&gt;
== Basic09 Calls (via the Foenix module) ==&lt;br /&gt;
&lt;br /&gt;
=== INKEY ===&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;INKEY&amp;quot;,keyval)&lt;br /&gt;
&lt;br /&gt;
=== MouseHR ===&lt;br /&gt;
returns 640x480 XY&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;MouseHR&amp;quot;,X,Y,Button)&lt;br /&gt;
&lt;br /&gt;
=== Mouse ===&lt;br /&gt;
returns 320x240 XY&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;Mouse&amp;quot;,X,Y,Button)&lt;br /&gt;
&lt;br /&gt;
=== Graphics On ===&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;Gon&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== Graphics Off ===&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;Goff&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== BMLoad ===&lt;br /&gt;
Load Bitmap file into allocated Bitmap&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;BMLoad&amp;quot;,bmblock,bitmappath)&lt;br /&gt;
&lt;br /&gt;
=== BMClear ===&lt;br /&gt;
Clear image of allocated Bitmap&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;BMClear&amp;quot;,bmblock, color)&lt;br /&gt;
&lt;br /&gt;
=== Bitmap ===&lt;br /&gt;
Allocate bitmap&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;Bitmap&amp;quot;,bitmap#,screenmode,bmblock,layer,clut#,clutname)&lt;br /&gt;
&lt;br /&gt;
=== BMSave ===&lt;br /&gt;
Save current Bitmap&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;BMClear&amp;quot;,bmblock, filename)&lt;br /&gt;
&lt;br /&gt;
=== Bitmap Status ===&lt;br /&gt;
Returns 0 bm(x) if disabled, returns 1 bm(x) enabled&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;BMstatus&amp;quot;,bm0,bm1,bm2)&lt;br /&gt;
&lt;br /&gt;
=== Bitmap Off/Free ===&lt;br /&gt;
Disables bitmap and frees bitmap memory&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;BMoff&amp;quot;,bitmap#)&lt;br /&gt;
&lt;br /&gt;
=== GFree ===&lt;br /&gt;
Calling syntax: RUN FOENIX([path,],&amp;quot;GFree&amp;quot;,bitmap#)   &lt;br /&gt;
&lt;br /&gt;
=== ClutFree ===&lt;br /&gt;
Clut Unlink&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;ClutFree&amp;quot;,clutheader)&lt;br /&gt;
&lt;br /&gt;
=== Pixel ===&lt;br /&gt;
Draw Pixel&lt;br /&gt;
&lt;br /&gt;
takes X,Y and color and puts it in the bitmap bmblock&lt;br /&gt;
&lt;br /&gt;
x=X, y=Y, a=color&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;Pixel&amp;quot;,X,Y,Color,bmblock)&lt;br /&gt;
&lt;br /&gt;
=== GetPixel ===&lt;br /&gt;
Return the color of pixel at x,y&lt;br /&gt;
&lt;br /&gt;
takes X,Y and color and puts it in the bitmap bmblock&lt;br /&gt;
&lt;br /&gt;
x=X, y=Y, a=color&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;GetPixel&amp;quot;,X,Y,Color,bmblock)&lt;br /&gt;
&lt;br /&gt;
=== Line ===&lt;br /&gt;
draw line between 2 coordinates&lt;br /&gt;
&lt;br /&gt;
x=16 bit value, y=8 bit value&lt;br /&gt;
&lt;br /&gt;
pc=01 x=23 y=4 x=56 y=7 c=8&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;Line&amp;quot;,X1,Y1,X2,Y2,color,bmblock)&lt;br /&gt;
&lt;br /&gt;
=== Multiply ===&lt;br /&gt;
Multiply 2 16 bit integers&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,],&amp;quot;MULTIPLY&amp;quot;, integer_A, integer_B,result_REAL)&lt;br /&gt;
&lt;br /&gt;
=== GetDow ===&lt;br /&gt;
Get Day of week&lt;br /&gt;
&lt;br /&gt;
Returns integer day of week&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;GetDow&amp;quot;, dow)&lt;br /&gt;
&lt;br /&gt;
=== GetTime ===&lt;br /&gt;
Get the current time.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;GetTime&amp;quot;, hour,minute,seconds)&lt;br /&gt;
&lt;br /&gt;
=== GetDate ===&lt;br /&gt;
Get the current time.&lt;br /&gt;
&lt;br /&gt;
RTC.Base $FE40&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;GetDate&amp;quot;, month,day,year)&lt;br /&gt;
&lt;br /&gt;
=== WINFO ===&lt;br /&gt;
Get window information.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;WINFO&amp;quot;, format, width, height, foreground, background, border)&lt;br /&gt;
&lt;br /&gt;
=== DWSET ===&lt;br /&gt;
Define a device window.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;DWSET&amp;quot;, format, xcor, ycor, width, height, foreground, background, border)&lt;br /&gt;
&lt;br /&gt;
=== COLOR ===&lt;br /&gt;
Set the window colors.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;COLOR&amp;quot;, foreground [,background] [,border])&lt;br /&gt;
&lt;br /&gt;
=== SEED ===&lt;br /&gt;
Seeds the hardware-based random number.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;SEED&amp;quot; ,value)&lt;br /&gt;
&lt;br /&gt;
=== RANDOM ===&lt;br /&gt;
Returns a hardware-based random number.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;RANDOM&amp;quot; ,value)&lt;br /&gt;
&lt;br /&gt;
=== CURHOME ===&lt;br /&gt;
Home the cursor.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;CURHOME&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== CURXY ===&lt;br /&gt;
Move the cursor to a column and row.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;CURXY&amp;quot;, column, row)&lt;br /&gt;
&lt;br /&gt;
=== ERLINE ===&lt;br /&gt;
Delete the line of text the cursor is on.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;ERLINE&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== EREOLINE ===&lt;br /&gt;
Delete text from the cursor to the end of the current line.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;EREOLINE&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== CUROFF ===&lt;br /&gt;
Make the cursor invisible&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;CUROFF&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== CURRGT ===&lt;br /&gt;
Move the cursor one character to the right.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;CURRGT&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== BELL ===&lt;br /&gt;
Produce a beep through the terminal&#039;s speaker.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;BELL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== CURLFT ===&lt;br /&gt;
Move the cursor one character to the left.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;CURLFT&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== CURUP ===&lt;br /&gt;
Move the cursor one line up.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;CURUP&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== CURDWN ===&lt;br /&gt;
Move the cursor one line down.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;CURDWN&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== EREOWNDW ===&lt;br /&gt;
Delete text from the current cursor position to the end of the window.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;EREOWNDW&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== Clear ===&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;CLEAR&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== CRRTN ===&lt;br /&gt;
Send a carriage return.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;CRRTN&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== INSLIN ===&lt;br /&gt;
Insert a blank line at the current cursor.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;INSLIN&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== DELLIN ===&lt;br /&gt;
Delete the line at the current cursor.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;DELLIN&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== DEFCOL ===&lt;br /&gt;
Set palette registers to the default values.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;DEFCOL&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== vtio Get/Set Stat Calls ==&lt;br /&gt;
&lt;br /&gt;
=== SS.AScrn ===&lt;br /&gt;
&lt;br /&gt;
Allocate a bitmap screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$Y = bitmap# (0-2)&lt;br /&gt;
        R$X = screentype (0=320x240, 1=320x200)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
        X = Starting Page# of bitmap address&lt;br /&gt;
&lt;br /&gt;
=== SS.DScrn ===&lt;br /&gt;
Display Screen Settings&lt;br /&gt;
&lt;br /&gt;
Set MCR to display text or graphics or both&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = Vicky_MCR Low Byte&lt;br /&gt;
        R$Y = Vicky_MCR High Byte&lt;br /&gt;
&lt;br /&gt;
 Exit:  Nothing. This just sets the register and updates driver variables&lt;br /&gt;
&lt;br /&gt;
VICKY MASTER CONTROL REGISTER to enable graphics and capabilities&lt;br /&gt;
 | 7 |   6   |    5   |   4  |    3   |   2   |   1   |   0  |&lt;br /&gt;
 | X | GAMMA | SPRITE | TILE | BITMAP | GRAPH | OVRLY | TEXT |&lt;br /&gt;
 |   -----   | FON_SET|FON_OV| MON_SLP| DBL_Y | DBL_X | CLK70|&lt;br /&gt;
 $FFC0 MASTER_CTRL_REG_L, MASTER_CTRL_REG_H&lt;br /&gt;
 &lt;br /&gt;
 ********************************************************************&lt;br /&gt;
 * vtio graphics constants (in f256.d)&lt;br /&gt;
 ********************************************************************&lt;br /&gt;
 * Constants used in SS.DScrn to set the display screen type&lt;br /&gt;
&lt;br /&gt;
 FX_GAM             equ       %01000000              Gamma Correction On&lt;br /&gt;
 FX_SPR             equ       %00100000              Sprites On&lt;br /&gt;
 FX_TIL             equ       %00010000              Tile Maps On&lt;br /&gt;
 FX_BM              equ       %00001000              Bitmaps On&lt;br /&gt;
 FX_GRF             equ       %00000100              Graphics Mode On&lt;br /&gt;
 FX_OVR             equ       %00000010              Overlay Text on Graphics&lt;br /&gt;
 FX_TXT             equ       %00000001              Text Mode On&lt;br /&gt;
 FT_FSET            equ       %00100000              Font Set 1 On (0=Font Set 0)&lt;br /&gt;
 FT_FOVR            equ       %00010000              FG and BG colors displayed when overlay text 0=transparent&lt;br /&gt;
 FT_MON             equ       %00001000              Turn off monitor sync and sleep monitor&lt;br /&gt;
 FT_DBX             equ       %00000100              Double-wide text mode characters&lt;br /&gt;
 FT_DBY             equ       %00000010              Double-high text mode characters&lt;br /&gt;
 FT_CLK70           equ       %00000001              70 Hz screen (640x400 txt,320x200 grf)&lt;br /&gt;
 FX_OMIT            equ       %11111111              Setting for SS.DScrn don&#039;t change first byte in MCR&lt;br /&gt;
 FT_OMIT            equ       %11111111              Setting for SS.DScrn don&#039;t change second byte in MCR &lt;br /&gt;
&lt;br /&gt;
=== SS.PScrn ===&lt;br /&gt;
Position Screen Layers&lt;br /&gt;
&lt;br /&gt;
Set layer to display a screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = layer (0-2)&lt;br /&gt;
        R$Y = bitmap# (0-2), tilemap (4-6)&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
&lt;br /&gt;
=== SS.FScrn ===&lt;br /&gt;
&lt;br /&gt;
Free a bitmap screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$Y = bitmap# (0-2)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
&lt;br /&gt;
=== SS.DfPal ===&lt;br /&gt;
Define Palette and populate a CLUT from Memory Module&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = CLUT # (0-3)&lt;br /&gt;
        R$Y = pointer to location of data in caller process&lt;br /&gt;
        (Caller must load data module)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_GraphicsVTIOCalls&amp;diff=37929</id>
		<title>FNX6809 GraphicsVTIOCalls</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_GraphicsVTIOCalls&amp;diff=37929"/>
		<updated>2025-01-25T20:09:43Z</updated>

		<summary type="html">&lt;p&gt;Jfed: Added additional B09 calls&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Graphics Summary ==&lt;br /&gt;
Use the &amp;lt;code&amp;gt;fstatus&amp;lt;/code&amp;gt; command in Level 2 to see the current status of the graphics registers.&lt;br /&gt;
&lt;br /&gt;
There is a default clut memory module included called &amp;lt;code&amp;gt;xtclut&amp;lt;/code&amp;gt; in CMDS.  This has the xterm colors according to [https://www.ditig.com/publications/256-colors-cheat-sheet this chart]&lt;br /&gt;
&lt;br /&gt;
== Basic09 Calls (via the Foenix module) ==&lt;br /&gt;
&lt;br /&gt;
=== INKEY ===&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;INKEY&amp;quot;,keyval)&lt;br /&gt;
&lt;br /&gt;
=== MouseHR ===&lt;br /&gt;
returns 640x480 XY&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;MouseHR&amp;quot;,X,Y,Button)&lt;br /&gt;
&lt;br /&gt;
=== Mouse ===&lt;br /&gt;
returns 320x240 XY&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;Mouse&amp;quot;,X,Y,Button)&lt;br /&gt;
&lt;br /&gt;
=== Graphics On ===&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;Gon&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== Graphics Off ===&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;Goff&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== BMLoad ===&lt;br /&gt;
Load Bitmap file into allocated Bitmap&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;BMLoad&amp;quot;,bmblock,bitmappath)&lt;br /&gt;
&lt;br /&gt;
=== BMClear ===&lt;br /&gt;
Clear image of allocated Bitmap&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;BMClear&amp;quot;,bmblock, color)&lt;br /&gt;
&lt;br /&gt;
=== Bitmap ===&lt;br /&gt;
Allocate bitmap&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;Bitmap&amp;quot;,bitmap#,screenmode,bmblock,layer,clut#,clutname)&lt;br /&gt;
&lt;br /&gt;
=== BMSave ===&lt;br /&gt;
Save current Bitmap&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;BMClear&amp;quot;,bmblock, filename)&lt;br /&gt;
&lt;br /&gt;
=== Bitmap Status ===&lt;br /&gt;
Returns 0 bm(x) if disabled, returns 1 bm(x) enabled&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;BMstatus&amp;quot;,bm0,bm1,bm2)&lt;br /&gt;
&lt;br /&gt;
=== Bitmap Off/Free ===&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;BMoff&amp;quot;,bitmap#)&lt;br /&gt;
&lt;br /&gt;
=== GFree ===&lt;br /&gt;
Calling syntax: RUN FOENIX([path,],&amp;quot;GFree&amp;quot;,bitmap#)   &lt;br /&gt;
&lt;br /&gt;
=== ClutFree ===&lt;br /&gt;
Clut Unlink&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;ClutFree&amp;quot;,clutheader)&lt;br /&gt;
&lt;br /&gt;
=== Pixel ===&lt;br /&gt;
Draw Pixel&lt;br /&gt;
&lt;br /&gt;
takes X,Y and color and puts it in the bitmap bmblock&lt;br /&gt;
&lt;br /&gt;
x=X, y=Y, a=color&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;Pixel&amp;quot;,X,Y,Color,bmblock)&lt;br /&gt;
&lt;br /&gt;
=== GetPixel ===&lt;br /&gt;
Return the color of pixel at x,y&lt;br /&gt;
&lt;br /&gt;
takes X,Y and color and puts it in the bitmap bmblock&lt;br /&gt;
&lt;br /&gt;
x=X, y=Y, a=color&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;GetPixel&amp;quot;,X,Y,Color,bmblock)&lt;br /&gt;
&lt;br /&gt;
=== Line ===&lt;br /&gt;
draw line between 2 coordinates&lt;br /&gt;
&lt;br /&gt;
x=16 bit value, y=8 bit value&lt;br /&gt;
&lt;br /&gt;
pc=01 x=23 y=4 x=56 y=7 c=8&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;Line&amp;quot;,X1,Y1,X2,Y2,color,bmblock)&lt;br /&gt;
&lt;br /&gt;
=== Multiply ===&lt;br /&gt;
Multiply 2 16 bit integers&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,],&amp;quot;MULTIPLY&amp;quot;, integer_A, integer_B,result_REAL)&lt;br /&gt;
&lt;br /&gt;
=== GetDow ===&lt;br /&gt;
Get Day of week&lt;br /&gt;
&lt;br /&gt;
Returns integer day of week&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;GetDow&amp;quot;, dow)&lt;br /&gt;
&lt;br /&gt;
=== GetTime ===&lt;br /&gt;
Get the current time.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;GetTime&amp;quot;, hour,minute,seconds)&lt;br /&gt;
&lt;br /&gt;
=== GetDate ===&lt;br /&gt;
Get the current time.&lt;br /&gt;
&lt;br /&gt;
RTC.Base $FE40&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;GetDate&amp;quot;, month,day,year)&lt;br /&gt;
&lt;br /&gt;
=== WINFO ===&lt;br /&gt;
Get window information.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;WINFO&amp;quot;, format, width, height, foreground, background, border)&lt;br /&gt;
&lt;br /&gt;
=== DWSET ===&lt;br /&gt;
Define a device window.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;DWSET&amp;quot;, format, xcor, ycor, width, height, foreground, background, border)&lt;br /&gt;
&lt;br /&gt;
=== COLOR ===&lt;br /&gt;
Set the window colors.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;COLOR&amp;quot;, foreground [,background] [,border])&lt;br /&gt;
&lt;br /&gt;
=== SEED ===&lt;br /&gt;
Seeds the hardware-based random number.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;SEED&amp;quot; ,value)&lt;br /&gt;
&lt;br /&gt;
=== RANDOM ===&lt;br /&gt;
Returns a hardware-based random number.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;RANDOM&amp;quot; ,value)&lt;br /&gt;
&lt;br /&gt;
=== CURHOME ===&lt;br /&gt;
Home the cursor.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;CURHOME&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== CURXY ===&lt;br /&gt;
Move the cursor to a column and row.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;CURXY&amp;quot;, column, row)&lt;br /&gt;
&lt;br /&gt;
=== ERLINE ===&lt;br /&gt;
Delete the line of text the cursor is on.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;ERLINE&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== EREOLINE ===&lt;br /&gt;
Delete text from the cursor to the end of the current line.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;EREOLINE&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== CUROFF ===&lt;br /&gt;
Make the cursor invisible&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;CUROFF&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== CURRGT ===&lt;br /&gt;
Move the cursor one character to the right.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;CURRGT&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== BELL ===&lt;br /&gt;
Produce a beep through the terminal&#039;s speaker.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;BELL&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== CURLFT ===&lt;br /&gt;
Move the cursor one character to the left.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;CURLFT&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== CURUP ===&lt;br /&gt;
Move the cursor one line up.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;CURUP&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== CURDWN ===&lt;br /&gt;
Move the cursor one line down.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;CURDWN&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== EREOWNDW ===&lt;br /&gt;
Delete text from the current cursor position to the end of the window.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;EREOWNDW&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== Clear ===&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;CLEAR&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== CRRTN ===&lt;br /&gt;
Send a carriage return.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;CRRTN&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== INSLIN ===&lt;br /&gt;
Insert a blank line at the current cursor.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;INSLIN&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== DELLIN ===&lt;br /&gt;
Delete the line at the current cursor.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;DELLIN&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== DEFCOL ===&lt;br /&gt;
Set palette registers to the default values.&lt;br /&gt;
&lt;br /&gt;
Calling syntax: RUN FOENIX([path,] &amp;quot;DEFCOL&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== vtio Get/Set Stat Calls ==&lt;br /&gt;
&lt;br /&gt;
=== SS.AScrn ===&lt;br /&gt;
&lt;br /&gt;
Allocate a bitmap screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$Y = bitmap# (0-2)&lt;br /&gt;
        R$X = screentype (0=320x240, 1=320x200)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
        X = Starting Page# of bitmap address&lt;br /&gt;
&lt;br /&gt;
=== SS.DScrn ===&lt;br /&gt;
Display Screen Settings&lt;br /&gt;
&lt;br /&gt;
Set MCR to display text or graphics or both&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = Vicky_MCR Low Byte&lt;br /&gt;
        R$Y = Vicky_MCR High Byte&lt;br /&gt;
&lt;br /&gt;
 Exit:  Nothing. This just sets the register and updates driver variables&lt;br /&gt;
&lt;br /&gt;
VICKY MASTER CONTROL REGISTER to enable graphics and capabilities&lt;br /&gt;
 | 7 |   6   |    5   |   4  |    3   |   2   |   1   |   0  |&lt;br /&gt;
 | X | GAMMA | SPRITE | TILE | BITMAP | GRAPH | OVRLY | TEXT |&lt;br /&gt;
 |   -----   | FON_SET|FON_OV| MON_SLP| DBL_Y | DBL_X | CLK70|&lt;br /&gt;
 $FFC0 MASTER_CTRL_REG_L, MASTER_CTRL_REG_H&lt;br /&gt;
 &lt;br /&gt;
 ********************************************************************&lt;br /&gt;
 * vtio graphics constants (in f256.d)&lt;br /&gt;
 ********************************************************************&lt;br /&gt;
 * Constants used in SS.DScrn to set the display screen type&lt;br /&gt;
&lt;br /&gt;
 FX_GAM             equ       %01000000              Gamma Correction On&lt;br /&gt;
 FX_SPR             equ       %00100000              Sprites On&lt;br /&gt;
 FX_TIL             equ       %00010000              Tile Maps On&lt;br /&gt;
 FX_BM              equ       %00001000              Bitmaps On&lt;br /&gt;
 FX_GRF             equ       %00000100              Graphics Mode On&lt;br /&gt;
 FX_OVR             equ       %00000010              Overlay Text on Graphics&lt;br /&gt;
 FX_TXT             equ       %00000001              Text Mode On&lt;br /&gt;
 FT_FSET            equ       %00100000              Font Set 1 On (0=Font Set 0)&lt;br /&gt;
 FT_FOVR            equ       %00010000              FG and BG colors displayed when overlay text 0=transparent&lt;br /&gt;
 FT_MON             equ       %00001000              Turn off monitor sync and sleep monitor&lt;br /&gt;
 FT_DBX             equ       %00000100              Double-wide text mode characters&lt;br /&gt;
 FT_DBY             equ       %00000010              Double-high text mode characters&lt;br /&gt;
 FT_CLK70           equ       %00000001              70 Hz screen (640x400 txt,320x200 grf)&lt;br /&gt;
 FX_OMIT            equ       %11111111              Setting for SS.DScrn don&#039;t change first byte in MCR&lt;br /&gt;
 FT_OMIT            equ       %11111111              Setting for SS.DScrn don&#039;t change second byte in MCR &lt;br /&gt;
&lt;br /&gt;
=== SS.PScrn ===&lt;br /&gt;
Position Screen Layers&lt;br /&gt;
&lt;br /&gt;
Set layer to display a screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = layer (0-2)&lt;br /&gt;
        R$Y = bitmap# (0-2), tilemap (4-6)&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
&lt;br /&gt;
=== SS.FScrn ===&lt;br /&gt;
&lt;br /&gt;
Free a bitmap screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$Y = bitmap# (0-2)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
&lt;br /&gt;
=== SS.DfPal ===&lt;br /&gt;
Define Palette and populate a CLUT from Memory Module&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = CLUT # (0-3)&lt;br /&gt;
        R$Y = pointer to location of data in caller process&lt;br /&gt;
        (Caller must load data module)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_GraphicsVTIOCalls&amp;diff=37928</id>
		<title>FNX6809 GraphicsVTIOCalls</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_GraphicsVTIOCalls&amp;diff=37928"/>
		<updated>2025-01-25T19:53:07Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* GFRee */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Graphics Summary ==&lt;br /&gt;
Use the &amp;lt;code&amp;gt;fstatus&amp;lt;/code&amp;gt; command in Level 2 to see the current status of the graphics registers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is a default clut memory module included called &amp;lt;code&amp;gt;xtclut&amp;lt;/code&amp;gt; in CMDS.  This has the xterm colors according to [https://www.ditig.com/publications/256-colors-cheat-sheet this chart]&lt;br /&gt;
&lt;br /&gt;
== Basic09 Calls (via the Foenix module) ==&lt;br /&gt;
&lt;br /&gt;
=== INKEY ===&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;INKEY&amp;quot;,keyval)&lt;br /&gt;
&lt;br /&gt;
=== MouseHR ===&lt;br /&gt;
returns 640x480 XY&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;MouseHR&amp;quot;,X,Y,Button)&lt;br /&gt;
&lt;br /&gt;
=== Mouse ===&lt;br /&gt;
returns 320x240 XY&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;Mouse&amp;quot;,X,Y,Button)&lt;br /&gt;
&lt;br /&gt;
=== Graphics On ===&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;Gon&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== Graphics Off ===&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;Goff&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== BMLoad ===&lt;br /&gt;
Load Bitmap file into allocated Bitmap&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;BMLoad&amp;quot;,bmblock,bitmappath)&lt;br /&gt;
&lt;br /&gt;
=== BMClear ===&lt;br /&gt;
Clear image of allocated Bitmap&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;BMClear&amp;quot;,bmblock, color)&lt;br /&gt;
&lt;br /&gt;
=== Bitmap ===&lt;br /&gt;
Allocate bitmap&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;Bitmap&amp;quot;,bitmap#,screenmode,bmblock,layer,clut#,clutname)&lt;br /&gt;
&lt;br /&gt;
=== BMSave ===&lt;br /&gt;
Save current Bitmap&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;BMClear&amp;quot;,bmblock, filename)&lt;br /&gt;
&lt;br /&gt;
=== Bitmap Status ===&lt;br /&gt;
Returns 0 bm(x) if disabled, returns 1 bm(x) enabled&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;BMstatus&amp;quot;,bm0,bm1,bm2)&lt;br /&gt;
&lt;br /&gt;
=== Bitmap Off/Free ===&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;BMoff&amp;quot;,bitmap#)&lt;br /&gt;
&lt;br /&gt;
=== GFree ===&lt;br /&gt;
Calling syntax: RUN FOENIX([path,],&amp;quot;GFree&amp;quot;,bitmap#)   &lt;br /&gt;
&lt;br /&gt;
=== ClutFree ===&lt;br /&gt;
Clut Unlink&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;ClutFree&amp;quot;,clutheader)&lt;br /&gt;
&lt;br /&gt;
== vtio Get/Set Stat Calls ==&lt;br /&gt;
&lt;br /&gt;
=== SS.AScrn ===&lt;br /&gt;
&lt;br /&gt;
Allocate a bitmap screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$Y = bitmap# (0-2)&lt;br /&gt;
        R$X = screentype (0=320x240, 1=320x200)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
        X = Starting Page# of bitmap address&lt;br /&gt;
&lt;br /&gt;
=== SS.DScrn ===&lt;br /&gt;
Display Screen Settings&lt;br /&gt;
&lt;br /&gt;
Set MCR to display text or graphics or both&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = Vicky_MCR Low Byte&lt;br /&gt;
        R$Y = Vicky_MCR High Byte&lt;br /&gt;
&lt;br /&gt;
 Exit:  Nothing. This just sets the register and updates driver variables&lt;br /&gt;
&lt;br /&gt;
VICKY MASTER CONTROL REGISTER to enable graphics and capabilities&lt;br /&gt;
 | 7 |   6   |    5   |   4  |    3   |   2   |   1   |   0  |&lt;br /&gt;
 | X | GAMMA | SPRITE | TILE | BITMAP | GRAPH | OVRLY | TEXT |&lt;br /&gt;
 |   -----   | FON_SET|FON_OV| MON_SLP| DBL_Y | DBL_X | CLK70|&lt;br /&gt;
 $FFC0 MASTER_CTRL_REG_L, MASTER_CTRL_REG_H&lt;br /&gt;
 &lt;br /&gt;
 ********************************************************************&lt;br /&gt;
 * vtio graphics constants (in f256.d)&lt;br /&gt;
 ********************************************************************&lt;br /&gt;
 * Constants used in SS.DScrn to set the display screen type&lt;br /&gt;
&lt;br /&gt;
 FX_GAM             equ       %01000000              Gamma Correction On&lt;br /&gt;
 FX_SPR             equ       %00100000              Sprites On&lt;br /&gt;
 FX_TIL             equ       %00010000              Tile Maps On&lt;br /&gt;
 FX_BM              equ       %00001000              Bitmaps On&lt;br /&gt;
 FX_GRF             equ       %00000100              Graphics Mode On&lt;br /&gt;
 FX_OVR             equ       %00000010              Overlay Text on Graphics&lt;br /&gt;
 FX_TXT             equ       %00000001              Text Mode On&lt;br /&gt;
 FT_FSET            equ       %00100000              Font Set 1 On (0=Font Set 0)&lt;br /&gt;
 FT_FOVR            equ       %00010000              FG and BG colors displayed when overlay text 0=transparent&lt;br /&gt;
 FT_MON             equ       %00001000              Turn off monitor sync and sleep monitor&lt;br /&gt;
 FT_DBX             equ       %00000100              Double-wide text mode characters&lt;br /&gt;
 FT_DBY             equ       %00000010              Double-high text mode characters&lt;br /&gt;
 FT_CLK70           equ       %00000001              70 Hz screen (640x400 txt,320x200 grf)&lt;br /&gt;
 FX_OMIT            equ       %11111111              Setting for SS.DScrn don&#039;t change first byte in MCR&lt;br /&gt;
 FT_OMIT            equ       %11111111              Setting for SS.DScrn don&#039;t change second byte in MCR &lt;br /&gt;
&lt;br /&gt;
=== SS.PScrn ===&lt;br /&gt;
Position Screen Layers&lt;br /&gt;
&lt;br /&gt;
Set layer to display a screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = layer (0-2)&lt;br /&gt;
        R$Y = bitmap# (0-2), tilemap (4-6)&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
&lt;br /&gt;
=== SS.FScrn ===&lt;br /&gt;
&lt;br /&gt;
Free a bitmap screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$Y = bitmap# (0-2)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
&lt;br /&gt;
=== SS.DfPal ===&lt;br /&gt;
Define Palette and populate a CLUT from Memory Module&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = CLUT # (0-3)&lt;br /&gt;
        R$Y = pointer to location of data in caller process&lt;br /&gt;
        (Caller must load data module)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_GraphicsVTIOCalls&amp;diff=37927</id>
		<title>FNX6809 GraphicsVTIOCalls</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_GraphicsVTIOCalls&amp;diff=37927"/>
		<updated>2025-01-25T19:50:46Z</updated>

		<summary type="html">&lt;p&gt;Jfed: Add Basic09 calls&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Graphics Summary ==&lt;br /&gt;
Use the &amp;lt;code&amp;gt;fstatus&amp;lt;/code&amp;gt; command in Level 2 to see the current status of the graphics registers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is a default clut memory module included called &amp;lt;code&amp;gt;xtclut&amp;lt;/code&amp;gt; in CMDS.  This has the xterm colors according to [https://www.ditig.com/publications/256-colors-cheat-sheet this chart]&lt;br /&gt;
&lt;br /&gt;
== Basic09 Calls (via the Foenix module) ==&lt;br /&gt;
&lt;br /&gt;
=== INKEY ===&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;INKEY&amp;quot;,keyval)&lt;br /&gt;
&lt;br /&gt;
=== MouseHR ===&lt;br /&gt;
returns 640x480 XY&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;MouseHR&amp;quot;,X,Y,Button)&lt;br /&gt;
&lt;br /&gt;
=== Mouse ===&lt;br /&gt;
returns 320x240 XY&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;Mouse&amp;quot;,X,Y,Button)&lt;br /&gt;
&lt;br /&gt;
=== Graphics On ===&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;Gon&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== Graphics Off ===&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;Goff&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
=== BMLoad ===&lt;br /&gt;
Load Bitmap file into allocated Bitmap&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;BMLoad&amp;quot;,bmblock,bitmappath)&lt;br /&gt;
&lt;br /&gt;
=== BMClear ===&lt;br /&gt;
Clear image of allocated Bitmap&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;BMClear&amp;quot;,bmblock, color)&lt;br /&gt;
&lt;br /&gt;
=== Bitmap ===&lt;br /&gt;
Allocate bitmap&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;Bitmap&amp;quot;,bitmap#,screenmode,bmblock,layer,clut#,clutname)&lt;br /&gt;
&lt;br /&gt;
=== BMSave ===&lt;br /&gt;
Save current Bitmap&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;BMClear&amp;quot;,bmblock, filename)&lt;br /&gt;
&lt;br /&gt;
=== Bitmap Status ===&lt;br /&gt;
Returns 0 bm(x) if disabled, returns 1 bm(x) enabled&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;BMstatus&amp;quot;,bm0,bm1,bm2)&lt;br /&gt;
&lt;br /&gt;
=== Bitmap Off/Free ===&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;BMoff&amp;quot;,bitmap#)&lt;br /&gt;
&lt;br /&gt;
=== GFRee ===&lt;br /&gt;
Calling syntax: RUN FOENIX([path,],&amp;quot;GFree&amp;quot;,bitmap#)   &lt;br /&gt;
&lt;br /&gt;
=== ClutFree ===&lt;br /&gt;
Clut Unlink&lt;br /&gt;
&lt;br /&gt;
calling syntax: RUN FOENIX([path,],&amp;quot;ClutFree&amp;quot;,clutheader)&lt;br /&gt;
&lt;br /&gt;
== vtio Get/Set Stat Calls ==&lt;br /&gt;
&lt;br /&gt;
=== SS.AScrn ===&lt;br /&gt;
&lt;br /&gt;
Allocate a bitmap screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$Y = bitmap# (0-2)&lt;br /&gt;
        R$X = screentype (0=320x240, 1=320x200)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
        X = Starting Page# of bitmap address&lt;br /&gt;
&lt;br /&gt;
=== SS.DScrn ===&lt;br /&gt;
Display Screen Settings&lt;br /&gt;
&lt;br /&gt;
Set MCR to display text or graphics or both&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = Vicky_MCR Low Byte&lt;br /&gt;
        R$Y = Vicky_MCR High Byte&lt;br /&gt;
&lt;br /&gt;
 Exit:  Nothing. This just sets the register and updates driver variables&lt;br /&gt;
&lt;br /&gt;
VICKY MASTER CONTROL REGISTER to enable graphics and capabilities&lt;br /&gt;
 | 7 |   6   |    5   |   4  |    3   |   2   |   1   |   0  |&lt;br /&gt;
 | X | GAMMA | SPRITE | TILE | BITMAP | GRAPH | OVRLY | TEXT |&lt;br /&gt;
 |   -----   | FON_SET|FON_OV| MON_SLP| DBL_Y | DBL_X | CLK70|&lt;br /&gt;
 $FFC0 MASTER_CTRL_REG_L, MASTER_CTRL_REG_H&lt;br /&gt;
 &lt;br /&gt;
 ********************************************************************&lt;br /&gt;
 * vtio graphics constants (in f256.d)&lt;br /&gt;
 ********************************************************************&lt;br /&gt;
 * Constants used in SS.DScrn to set the display screen type&lt;br /&gt;
&lt;br /&gt;
 FX_GAM             equ       %01000000              Gamma Correction On&lt;br /&gt;
 FX_SPR             equ       %00100000              Sprites On&lt;br /&gt;
 FX_TIL             equ       %00010000              Tile Maps On&lt;br /&gt;
 FX_BM              equ       %00001000              Bitmaps On&lt;br /&gt;
 FX_GRF             equ       %00000100              Graphics Mode On&lt;br /&gt;
 FX_OVR             equ       %00000010              Overlay Text on Graphics&lt;br /&gt;
 FX_TXT             equ       %00000001              Text Mode On&lt;br /&gt;
 FT_FSET            equ       %00100000              Font Set 1 On (0=Font Set 0)&lt;br /&gt;
 FT_FOVR            equ       %00010000              FG and BG colors displayed when overlay text 0=transparent&lt;br /&gt;
 FT_MON             equ       %00001000              Turn off monitor sync and sleep monitor&lt;br /&gt;
 FT_DBX             equ       %00000100              Double-wide text mode characters&lt;br /&gt;
 FT_DBY             equ       %00000010              Double-high text mode characters&lt;br /&gt;
 FT_CLK70           equ       %00000001              70 Hz screen (640x400 txt,320x200 grf)&lt;br /&gt;
 FX_OMIT            equ       %11111111              Setting for SS.DScrn don&#039;t change first byte in MCR&lt;br /&gt;
 FT_OMIT            equ       %11111111              Setting for SS.DScrn don&#039;t change second byte in MCR &lt;br /&gt;
&lt;br /&gt;
=== SS.PScrn ===&lt;br /&gt;
Position Screen Layers&lt;br /&gt;
&lt;br /&gt;
Set layer to display a screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = layer (0-2)&lt;br /&gt;
        R$Y = bitmap# (0-2), tilemap (4-6)&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
&lt;br /&gt;
=== SS.FScrn ===&lt;br /&gt;
&lt;br /&gt;
Free a bitmap screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$Y = bitmap# (0-2)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
&lt;br /&gt;
=== SS.DfPal ===&lt;br /&gt;
Define Palette and populate a CLUT from Memory Module&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = CLUT # (0-3)&lt;br /&gt;
        R$Y = pointer to location of data in caller process&lt;br /&gt;
        (Caller must load data module)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_DisplayCodes&amp;diff=581</id>
		<title>FNX6809 DisplayCodes</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_DisplayCodes&amp;diff=581"/>
		<updated>2024-12-14T22:34:02Z</updated>

		<summary type="html">&lt;p&gt;Jfed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Current List of Display Code for Nitros9 vtio: ==&lt;br /&gt;
&lt;br /&gt;
* $00: NO-OP (null)&lt;br /&gt;
* $01: HOME cursor&lt;br /&gt;
* $02: CURSOR XY&lt;br /&gt;
* $03: ERASE LINE&lt;br /&gt;
* $04: CLEAR TO EOL&lt;br /&gt;
* $05: CURSOR ON/OFF/CHARACTER/RATE ($05 $21 / $05 $20 / $05 $22 XX / $05 $23 XX)&lt;br /&gt;
* $06: CURSOR RIGHT&lt;br /&gt;
* $07: BELL&lt;br /&gt;
* $08: CURSOR LEFT&lt;br /&gt;
* $09: CURSOR UP&lt;br /&gt;
* $0A: CURSOR DOWN&lt;br /&gt;
* $0B: ERASE TO EOS&lt;br /&gt;
* $0C: CLEAR SCREEN&lt;br /&gt;
* $0D: RETURN&lt;br /&gt;
&lt;br /&gt;
* 1F 20	Turns on reverse video&lt;br /&gt;
* 1F 21	Turns off reverse video&lt;br /&gt;
&lt;br /&gt;
== Escape Codes ==&lt;br /&gt;
&lt;br /&gt;
* 1B 20 DW Set&lt;br /&gt;
* 1B 21 DW Select&lt;br /&gt;
* 1B 24 DW End&lt;br /&gt;
* 1B 30 DefColr&lt;br /&gt;
* 1B 32 Foreground Color&lt;br /&gt;
* 1B 33 Background Color&lt;br /&gt;
* 1B 34 Border Color&lt;br /&gt;
* 1B 60 Change Foreground Palette&lt;br /&gt;
* 1B 61 Change Background Palette&lt;br /&gt;
* 1B 62 Change to Font0&lt;br /&gt;
* 1B 63 Change to Font1&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_DisplayCodes&amp;diff=580</id>
		<title>FNX6809 DisplayCodes</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_DisplayCodes&amp;diff=580"/>
		<updated>2024-12-14T22:30:20Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Current List of Display Code for Nitros9 vtio: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Current List of Display Code for Nitros9 vtio: ==&lt;br /&gt;
&lt;br /&gt;
* $00: NO-OP (null)&lt;br /&gt;
* $01: HOME cursor&lt;br /&gt;
* $02: CURSOR XY&lt;br /&gt;
* $03: ERASE LINE&lt;br /&gt;
* $04: CLEAR TO EOL&lt;br /&gt;
* $05: CURSOR ON/OFF ($05 $21 / $05 $20)&lt;br /&gt;
* $06: CURSOR RIGHT&lt;br /&gt;
* $07: BELL&lt;br /&gt;
* $08: CURSOR LEFT&lt;br /&gt;
* $09: CURSOR UP&lt;br /&gt;
* $0A: CURSOR DOWN&lt;br /&gt;
* $0B: ERASE TO EOS&lt;br /&gt;
* $0C: CLEAR SCREEN&lt;br /&gt;
* $0D: RETURN&lt;br /&gt;
&lt;br /&gt;
* 1F 20	Turns on reverse video&lt;br /&gt;
* 1F 21	Turns off reverse video&lt;br /&gt;
&lt;br /&gt;
== Escape Codes ==&lt;br /&gt;
&lt;br /&gt;
* 1B 20 DW Set&lt;br /&gt;
* 1B 21 DW Select&lt;br /&gt;
* 1B 24 DW End&lt;br /&gt;
* 1B 30 DefColr&lt;br /&gt;
* 1B 32 Foreground Color&lt;br /&gt;
* 1B 33 Background Color&lt;br /&gt;
* 1B 34 Border Color&lt;br /&gt;
* 1B 60 Change Foreground Palette&lt;br /&gt;
* 1B 61 Change Background Palette&lt;br /&gt;
* 1B 62 Change to Font0&lt;br /&gt;
* 1B 63 Change to Font1&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_DisplayCodes&amp;diff=579</id>
		<title>FNX6809 DisplayCodes</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_DisplayCodes&amp;diff=579"/>
		<updated>2024-12-14T22:29:34Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Current List of Display Code for Nitros9 vtio: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Current List of Display Code for Nitros9 vtio: ==&lt;br /&gt;
&lt;br /&gt;
* $00: NO-OP (null)&lt;br /&gt;
* $01: HOME cursor&lt;br /&gt;
* $02: CURSOR XY&lt;br /&gt;
* $03: ERASE LINE&lt;br /&gt;
* $04: CLEAR TO EOL&lt;br /&gt;
* $05: CURSOR ON/OFF&lt;br /&gt;
* $06: CURSOR RIGHT&lt;br /&gt;
* $07: BELL&lt;br /&gt;
* $08: CURSOR LEFT&lt;br /&gt;
* $09: CURSOR UP&lt;br /&gt;
* $0A: CURSOR DOWN&lt;br /&gt;
* $0B: ERASE TO EOS&lt;br /&gt;
* $0C: CLEAR SCREEN&lt;br /&gt;
* $0D: RETURN&lt;br /&gt;
&lt;br /&gt;
* 1F 20	Turns on reverse video&lt;br /&gt;
* 1F 21	Turns off reverse video&lt;br /&gt;
&lt;br /&gt;
== Escape Codes ==&lt;br /&gt;
&lt;br /&gt;
* 1B 20 DW Set&lt;br /&gt;
* 1B 21 DW Select&lt;br /&gt;
* 1B 24 DW End&lt;br /&gt;
* 1B 30 DefColr&lt;br /&gt;
* 1B 32 Foreground Color&lt;br /&gt;
* 1B 33 Background Color&lt;br /&gt;
* 1B 34 Border Color&lt;br /&gt;
* 1B 60 Change Foreground Palette&lt;br /&gt;
* 1B 61 Change Background Palette&lt;br /&gt;
* 1B 62 Change to Font0&lt;br /&gt;
* 1B 63 Change to Font1&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_DisplayCodes&amp;diff=578</id>
		<title>FNX6809 DisplayCodes</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_DisplayCodes&amp;diff=578"/>
		<updated>2024-12-14T22:28:04Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Current List of Display Code for Nitros9 vtio: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Current List of Display Code for Nitros9 vtio: ==&lt;br /&gt;
&lt;br /&gt;
* $00: NO-OP (null)&lt;br /&gt;
* $01: HOME cursor&lt;br /&gt;
* $02: CURSOR XY&lt;br /&gt;
* $03: ERASE LINE&lt;br /&gt;
* $04: CLEAR TO EOL&lt;br /&gt;
* $05: CURSOR CONTROL&lt;br /&gt;
* $06: CURSOR RIGHT&lt;br /&gt;
* $07: BELL&lt;br /&gt;
* $08: CURSOR LEFT&lt;br /&gt;
* $09: CURSOR UP&lt;br /&gt;
* $0A: CURSOR DOWN&lt;br /&gt;
* $0B: ERASE TO EOS&lt;br /&gt;
* $0C: CLEAR SCREEN&lt;br /&gt;
* $0D: RETURN&lt;br /&gt;
&lt;br /&gt;
* 1F 20	Turns on reverse video&lt;br /&gt;
* 1F 21	Turns off reverse video&lt;br /&gt;
&lt;br /&gt;
== Escape Codes ==&lt;br /&gt;
&lt;br /&gt;
* 1B 20 DW Set&lt;br /&gt;
* 1B 21 DW Select&lt;br /&gt;
* 1B 24 DW End&lt;br /&gt;
* 1B 30 DefColr&lt;br /&gt;
* 1B 32 Foreground Color&lt;br /&gt;
* 1B 33 Background Color&lt;br /&gt;
* 1B 34 Border Color&lt;br /&gt;
* 1B 60 Change Foreground Palette&lt;br /&gt;
* 1B 61 Change Background Palette&lt;br /&gt;
* 1B 62 Change to Font0&lt;br /&gt;
* 1B 63 Change to Font1&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Template:Main2/FNX6809_Processor&amp;diff=577</id>
		<title>Template:Main2/FNX6809 Processor</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Template:Main2/FNX6809_Processor&amp;diff=577"/>
		<updated>2024-12-14T21:25:43Z</updated>

		<summary type="html">&lt;p&gt;Jfed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;FNX6809 Processor&#039;&#039;&#039;&lt;br /&gt;
* [[FNX6809 Overview]]&lt;br /&gt;
* [[OS-9]]&lt;br /&gt;
* [[OS-9 Assembly Code Development]]&lt;br /&gt;
* [[OS-9_C_Code_Development|OS-9 C Code Development]]&lt;br /&gt;
* [[FNX6809_Manuals|FNX6809 Manuals]]&lt;br /&gt;
* [[FNX6809_GraphicsVTIOCalls|FNX6809 Graphics vtio calls]]&lt;br /&gt;
* [[FNX6809_DisplayCodes|FNX6809 Display Codes]]&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_DisplayCodes&amp;diff=576</id>
		<title>FNX6809 DisplayCodes</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_DisplayCodes&amp;diff=576"/>
		<updated>2024-12-14T21:20:51Z</updated>

		<summary type="html">&lt;p&gt;Jfed: Created page with &amp;quot;== Current List of Display Code for Nitros9 vtio: ==  * $00: NO-OP (null) * $01: HOME cursor * $02: CURSOR XY * $03: ERASE LINE * $04: CLEAR TO EOL * $05: CURSOR CONTROL * $06: CURSOR RIGHT * $07: BELL * $08: CURSOR LEFT * $09: CURSOR UP * $0A: CURSOR DOWN * $0B: ERASE TO EOS * $0C: CLEAR SCREEN * $0D: RETURN  * 1F 20	Turns on reverse video * 1F 21	Turns off reverse video * 1F 22	Turns on underlining. * 1F 23	Turns off underlining. * 1F 24	Turns on blinking. * 1F 25	Turn...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Current List of Display Code for Nitros9 vtio: ==&lt;br /&gt;
&lt;br /&gt;
* $00: NO-OP (null)&lt;br /&gt;
* $01: HOME cursor&lt;br /&gt;
* $02: CURSOR XY&lt;br /&gt;
* $03: ERASE LINE&lt;br /&gt;
* $04: CLEAR TO EOL&lt;br /&gt;
* $05: CURSOR CONTROL&lt;br /&gt;
* $06: CURSOR RIGHT&lt;br /&gt;
* $07: BELL&lt;br /&gt;
* $08: CURSOR LEFT&lt;br /&gt;
* $09: CURSOR UP&lt;br /&gt;
* $0A: CURSOR DOWN&lt;br /&gt;
* $0B: ERASE TO EOS&lt;br /&gt;
* $0C: CLEAR SCREEN&lt;br /&gt;
* $0D: RETURN&lt;br /&gt;
&lt;br /&gt;
* 1F 20	Turns on reverse video&lt;br /&gt;
* 1F 21	Turns off reverse video&lt;br /&gt;
* 1F 22	Turns on underlining.&lt;br /&gt;
* 1F 23	Turns off underlining.&lt;br /&gt;
* 1F 24	Turns on blinking.&lt;br /&gt;
* 1F 25	Turns off blinking.&lt;br /&gt;
* 1F 30	Inserts a line at the current cursor position.&lt;br /&gt;
* 1F 31	Deletes the current line.&lt;br /&gt;
&lt;br /&gt;
== Escape Codes ==&lt;br /&gt;
&lt;br /&gt;
* 1B 20 DW Set&lt;br /&gt;
* 1B 21 DW Select&lt;br /&gt;
* 1B 24 DW End&lt;br /&gt;
* 1B 30 DefColr&lt;br /&gt;
* 1B 32 Foreground Color&lt;br /&gt;
* 1B 33 Background Color&lt;br /&gt;
* 1B 34 Border Color&lt;br /&gt;
* 1B 60 Change Foreground Palette&lt;br /&gt;
* 1B 61 Change Background Palette&lt;br /&gt;
* 1B 62 Change to Font0&lt;br /&gt;
* 1B 63 Change to Font1&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=OS-9&amp;diff=488</id>
		<title>OS-9</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=OS-9&amp;diff=488"/>
		<updated>2024-10-22T13:01:10Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Building OS-9 Level 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The FNX6809 combined with the F256 makes a great system for running OS-9/6809. [[wikipedia:OS-9|OS-9]] is a real-time, embedded operating system created by [[wikipedia:Microware|Microware Systems Corporation]]. While it was used in many areas of industry, home computer users know it best for its implementation on the [[wikipedia:TRS-80_Color_Computer|Tandy Color Computer]] sold by Radio Shack&lt;br /&gt;
&lt;br /&gt;
Today, a community effort has led to the creation of [https://github.com/nitros9project/nitros9 NitrOS-9], an open source version of the OS-9 operating system. Throughout this page, I&#039;ll refer to NitrOS-9 as OS-9.&lt;br /&gt;
&lt;br /&gt;
== A word about platforms ==&lt;br /&gt;
This page assumes you&#039;re running on Linux or macOS. If you&#039;re using Windows, these instructions don&#039;t apply, and someone will have to step up and write steps to develop on that platform.&lt;br /&gt;
&lt;br /&gt;
== Tooling ==&lt;br /&gt;
Cross-hosted development is the fastest way to develop for the F256. For this you need the following:&lt;br /&gt;
&lt;br /&gt;
* [http://www.lwtools.ca lwtools] - an assembler/linker package&lt;br /&gt;
* [https://github.com/nitros9project/toolshed ToolShed] - a set of tools for creating disk images&lt;br /&gt;
* [https://github.com/nitros9project/nitros9 NitrOS-9] - the NitrOS-9 operating system in source form&lt;br /&gt;
* [https://github.com/pweingar/FoenixMgr FoenixMgr] - tools to load code into RAM or Flash of the F256.&lt;br /&gt;
&lt;br /&gt;
You can pull these down individually, or better yet, use [https://github.com/strickyak @strickyak]&#039;s great [https://github.com/strickyak/coco-shelf/ CoCo Shelf repository]. It has a &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; which gets all of the above and puts it in a convenient location (note that you&#039;ll have to update your shell script of choice to include the locations of the binaries in the &amp;lt;code&amp;gt;PATH&amp;lt;/code&amp;gt; environment variable).&lt;br /&gt;
&lt;br /&gt;
Here are the terminal commands for Linux and macOS to pull down all the required software:&lt;br /&gt;
 cd&lt;br /&gt;
 git clone &amp;lt;nowiki&amp;gt;https://github.com/strickyak/coco-shelf.git&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 cd coco-shelf&lt;br /&gt;
 export PATH=&amp;quot;$PATH:$HOME/coco-shelf/bin&amp;quot;&lt;br /&gt;
 make ANON=1 nitros9/done FoenixMgr/done&lt;br /&gt;
&lt;br /&gt;
(If you have a github account and your github ssh key is loaded,&lt;br /&gt;
you can omit `ANON=1` on the last command,&lt;br /&gt;
so it will check out git repositories using your github username,&lt;br /&gt;
in case you want to push changes.)&lt;br /&gt;
&lt;br /&gt;
There is a special Make target for re-flashing the F256Jr or F256K,&lt;br /&gt;
but first time you run this command, it should fail.  &lt;br /&gt;
Then you have to edit the `port=` line in `FoenixMgr/foenixmgr.ini`&lt;br /&gt;
and run the command again (with the cable plugged in): &lt;br /&gt;
 make ANON=1 run-f256-flash        # Old command for F256Jr that works?&lt;br /&gt;
or&lt;br /&gt;
 make ANON=1 run-f256jr-flash      # TODO fix this&lt;br /&gt;
or&lt;br /&gt;
 make ANON=1 run-f256k-flash       # TODO fix this&lt;br /&gt;
&lt;br /&gt;
== Building FEU and OS-9 Level 1 from scratch ==&lt;br /&gt;
FEU is the Foenix Executive Utility. It resides in flash and hosts a debugger and booters that can bring up operating systems like OS-9. FEU runs under OS-9 Level 1, so go ahead and build the entire operating system:&lt;br /&gt;
 cd nitros9&lt;br /&gt;
 export NITROS9DIR=$PWD&lt;br /&gt;
 cd level1/f256&lt;br /&gt;
 make &lt;br /&gt;
 cd feu&lt;br /&gt;
Now you can flash the image into the F256. You must have a USB cable connected to the system from your computer. Note: if you&#039;re using a Mac, you won&#039;t be able to upload code into the F256 due to the [https://www.maxlinear.com/support/design-tools/software-drivers driver manufacturer] being so behind on updates. You can use a Linux VM and FoenixMgr tools in bridge mode on the Mac.&lt;br /&gt;
&lt;br /&gt;
There are distinct builds of FEU for the F256 Jr and the F256K. Power up the machine, then select the correct command:&lt;br /&gt;
 cd feu&lt;br /&gt;
 make flash_f256jr&lt;br /&gt;
or&lt;br /&gt;
 cd feu&lt;br /&gt;
 make flash_f256k&lt;br /&gt;
&lt;br /&gt;
Then (this is in addition to make flash_f256jr or make flash_f256k):&lt;br /&gt;
&lt;br /&gt;
 make flash_f0&lt;br /&gt;
&lt;br /&gt;
Once the flash completes, restart the machine and FEU should come up.&lt;br /&gt;
&lt;br /&gt;
== Building OS-9 Level 2 ==&lt;br /&gt;
To build OS-9 Level 2, run these commands (this assumes you have added the NITROS9DIR environment variable as above:  export NITROS9DIR=$PWD from the top level nitros9 directory):&lt;br /&gt;
 cd ../../level2/f256&lt;br /&gt;
 make dsk&lt;br /&gt;
&lt;br /&gt;
This produces the following disk images for the F256 Jr and the F256K:&lt;br /&gt;
&lt;br /&gt;
 NOS9_6809_L2_v030300_f256jr_dw.dsk&lt;br /&gt;
 NOS9_6809_L2_v030300_f256jr_sd.dsk&lt;br /&gt;
 NOS9_6809_L2_v030300_f256k_dw.dsk&lt;br /&gt;
 NOS9_6809_L2_v030300_f256k_sd.dsk&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;dw&#039;&#039; disk images are for booting from DriveWire. The &#039;&#039;sd&#039;&#039; disk image are for booting from the SD card. You need to write the images onto an SD card, then insert the SD card into the F256 and restart.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s how to image the SD card.&lt;br /&gt;
&lt;br /&gt;
==== Linux ====&lt;br /&gt;
On Linux, insert the SD card into your computer. Ttype &amp;lt;code&amp;gt;lsblk&amp;lt;/code&amp;gt; to find the correct device and replace &#039;&#039;sdx&#039;&#039; on the command line below with it:&lt;br /&gt;
&lt;br /&gt;
 dd if=NOS9_6809_L2_v030300_f256k_sd.dsk of=/dev/&#039;&#039;sdx&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== macOS ====&lt;br /&gt;
On macOS, insert the SD card into your Mac. A dialog will likely appear telling you that the disk you attached isn&#039;t readable. Click the &amp;quot;ignore&amp;quot; button, then type &amp;lt;code&amp;gt;diskutil list external&amp;lt;/code&amp;gt; to obtain the device name of the SD card and replace &#039;&#039;diskx&#039;&#039; on the command line below with it:&lt;br /&gt;
 sudo dd if=NOS9_6809_L2_v030300_f256k_sd.dsk of=/dev/&#039;&#039;diskx&#039;&#039;&lt;br /&gt;
Once the command completes, type:&lt;br /&gt;
 diskutil eject /dev/&#039;&#039;diskx&#039;&#039;&lt;br /&gt;
You can then safely remove the SD card.&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=OS-9&amp;diff=487</id>
		<title>OS-9</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=OS-9&amp;diff=487"/>
		<updated>2024-10-22T13:00:31Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Building OS-9 Level 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The FNX6809 combined with the F256 makes a great system for running OS-9/6809. [[wikipedia:OS-9|OS-9]] is a real-time, embedded operating system created by [[wikipedia:Microware|Microware Systems Corporation]]. While it was used in many areas of industry, home computer users know it best for its implementation on the [[wikipedia:TRS-80_Color_Computer|Tandy Color Computer]] sold by Radio Shack&lt;br /&gt;
&lt;br /&gt;
Today, a community effort has led to the creation of [https://github.com/nitros9project/nitros9 NitrOS-9], an open source version of the OS-9 operating system. Throughout this page, I&#039;ll refer to NitrOS-9 as OS-9.&lt;br /&gt;
&lt;br /&gt;
== A word about platforms ==&lt;br /&gt;
This page assumes you&#039;re running on Linux or macOS. If you&#039;re using Windows, these instructions don&#039;t apply, and someone will have to step up and write steps to develop on that platform.&lt;br /&gt;
&lt;br /&gt;
== Tooling ==&lt;br /&gt;
Cross-hosted development is the fastest way to develop for the F256. For this you need the following:&lt;br /&gt;
&lt;br /&gt;
* [http://www.lwtools.ca lwtools] - an assembler/linker package&lt;br /&gt;
* [https://github.com/nitros9project/toolshed ToolShed] - a set of tools for creating disk images&lt;br /&gt;
* [https://github.com/nitros9project/nitros9 NitrOS-9] - the NitrOS-9 operating system in source form&lt;br /&gt;
* [https://github.com/pweingar/FoenixMgr FoenixMgr] - tools to load code into RAM or Flash of the F256.&lt;br /&gt;
&lt;br /&gt;
You can pull these down individually, or better yet, use [https://github.com/strickyak @strickyak]&#039;s great [https://github.com/strickyak/coco-shelf/ CoCo Shelf repository]. It has a &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; which gets all of the above and puts it in a convenient location (note that you&#039;ll have to update your shell script of choice to include the locations of the binaries in the &amp;lt;code&amp;gt;PATH&amp;lt;/code&amp;gt; environment variable).&lt;br /&gt;
&lt;br /&gt;
Here are the terminal commands for Linux and macOS to pull down all the required software:&lt;br /&gt;
 cd&lt;br /&gt;
 git clone &amp;lt;nowiki&amp;gt;https://github.com/strickyak/coco-shelf.git&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 cd coco-shelf&lt;br /&gt;
 export PATH=&amp;quot;$PATH:$HOME/coco-shelf/bin&amp;quot;&lt;br /&gt;
 make ANON=1 nitros9/done FoenixMgr/done&lt;br /&gt;
&lt;br /&gt;
(If you have a github account and your github ssh key is loaded,&lt;br /&gt;
you can omit `ANON=1` on the last command,&lt;br /&gt;
so it will check out git repositories using your github username,&lt;br /&gt;
in case you want to push changes.)&lt;br /&gt;
&lt;br /&gt;
There is a special Make target for re-flashing the F256Jr or F256K,&lt;br /&gt;
but first time you run this command, it should fail.  &lt;br /&gt;
Then you have to edit the `port=` line in `FoenixMgr/foenixmgr.ini`&lt;br /&gt;
and run the command again (with the cable plugged in): &lt;br /&gt;
 make ANON=1 run-f256-flash        # Old command for F256Jr that works?&lt;br /&gt;
or&lt;br /&gt;
 make ANON=1 run-f256jr-flash      # TODO fix this&lt;br /&gt;
or&lt;br /&gt;
 make ANON=1 run-f256k-flash       # TODO fix this&lt;br /&gt;
&lt;br /&gt;
== Building FEU and OS-9 Level 1 from scratch ==&lt;br /&gt;
FEU is the Foenix Executive Utility. It resides in flash and hosts a debugger and booters that can bring up operating systems like OS-9. FEU runs under OS-9 Level 1, so go ahead and build the entire operating system:&lt;br /&gt;
 cd nitros9&lt;br /&gt;
 export NITROS9DIR=$PWD&lt;br /&gt;
 cd level1/f256&lt;br /&gt;
 make &lt;br /&gt;
 cd feu&lt;br /&gt;
Now you can flash the image into the F256. You must have a USB cable connected to the system from your computer. Note: if you&#039;re using a Mac, you won&#039;t be able to upload code into the F256 due to the [https://www.maxlinear.com/support/design-tools/software-drivers driver manufacturer] being so behind on updates. You can use a Linux VM and FoenixMgr tools in bridge mode on the Mac.&lt;br /&gt;
&lt;br /&gt;
There are distinct builds of FEU for the F256 Jr and the F256K. Power up the machine, then select the correct command:&lt;br /&gt;
 cd feu&lt;br /&gt;
 make flash_f256jr&lt;br /&gt;
or&lt;br /&gt;
 cd feu&lt;br /&gt;
 make flash_f256k&lt;br /&gt;
&lt;br /&gt;
Then (this is in addition to make flash_f256jr or make flash_f256k):&lt;br /&gt;
&lt;br /&gt;
 make flash_f0&lt;br /&gt;
&lt;br /&gt;
Once the flash completes, restart the machine and FEU should come up.&lt;br /&gt;
&lt;br /&gt;
== Building OS-9 Level 2 ==&lt;br /&gt;
To build OS-9 Level 2, run these commands (this assumes you have added the NITROS9DIR environment variable as above:  export NITROS9DIR=$PWD):&lt;br /&gt;
 cd ../../level2/f256&lt;br /&gt;
 make dsk&lt;br /&gt;
&lt;br /&gt;
This produces the following disk images for the F256 Jr and the F256K:&lt;br /&gt;
&lt;br /&gt;
 NOS9_6809_L2_v030300_f256jr_dw.dsk&lt;br /&gt;
 NOS9_6809_L2_v030300_f256jr_sd.dsk&lt;br /&gt;
 NOS9_6809_L2_v030300_f256k_dw.dsk&lt;br /&gt;
 NOS9_6809_L2_v030300_f256k_sd.dsk&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;dw&#039;&#039; disk images are for booting from DriveWire. The &#039;&#039;sd&#039;&#039; disk image are for booting from the SD card. You need to write the images onto an SD card, then insert the SD card into the F256 and restart.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s how to image the SD card.&lt;br /&gt;
&lt;br /&gt;
==== Linux ====&lt;br /&gt;
On Linux, insert the SD card into your computer. Ttype &amp;lt;code&amp;gt;lsblk&amp;lt;/code&amp;gt; to find the correct device and replace &#039;&#039;sdx&#039;&#039; on the command line below with it:&lt;br /&gt;
&lt;br /&gt;
 dd if=NOS9_6809_L2_v030300_f256k_sd.dsk of=/dev/&#039;&#039;sdx&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== macOS ====&lt;br /&gt;
On macOS, insert the SD card into your Mac. A dialog will likely appear telling you that the disk you attached isn&#039;t readable. Click the &amp;quot;ignore&amp;quot; button, then type &amp;lt;code&amp;gt;diskutil list external&amp;lt;/code&amp;gt; to obtain the device name of the SD card and replace &#039;&#039;diskx&#039;&#039; on the command line below with it:&lt;br /&gt;
 sudo dd if=NOS9_6809_L2_v030300_f256k_sd.dsk of=/dev/&#039;&#039;diskx&#039;&#039;&lt;br /&gt;
Once the command completes, type:&lt;br /&gt;
 diskutil eject /dev/&#039;&#039;diskx&#039;&#039;&lt;br /&gt;
You can then safely remove the SD card.&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=OS-9&amp;diff=486</id>
		<title>OS-9</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=OS-9&amp;diff=486"/>
		<updated>2024-10-22T12:53:51Z</updated>

		<summary type="html">&lt;p&gt;Jfed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The FNX6809 combined with the F256 makes a great system for running OS-9/6809. [[wikipedia:OS-9|OS-9]] is a real-time, embedded operating system created by [[wikipedia:Microware|Microware Systems Corporation]]. While it was used in many areas of industry, home computer users know it best for its implementation on the [[wikipedia:TRS-80_Color_Computer|Tandy Color Computer]] sold by Radio Shack&lt;br /&gt;
&lt;br /&gt;
Today, a community effort has led to the creation of [https://github.com/nitros9project/nitros9 NitrOS-9], an open source version of the OS-9 operating system. Throughout this page, I&#039;ll refer to NitrOS-9 as OS-9.&lt;br /&gt;
&lt;br /&gt;
== A word about platforms ==&lt;br /&gt;
This page assumes you&#039;re running on Linux or macOS. If you&#039;re using Windows, these instructions don&#039;t apply, and someone will have to step up and write steps to develop on that platform.&lt;br /&gt;
&lt;br /&gt;
== Tooling ==&lt;br /&gt;
Cross-hosted development is the fastest way to develop for the F256. For this you need the following:&lt;br /&gt;
&lt;br /&gt;
* [http://www.lwtools.ca lwtools] - an assembler/linker package&lt;br /&gt;
* [https://github.com/nitros9project/toolshed ToolShed] - a set of tools for creating disk images&lt;br /&gt;
* [https://github.com/nitros9project/nitros9 NitrOS-9] - the NitrOS-9 operating system in source form&lt;br /&gt;
* [https://github.com/pweingar/FoenixMgr FoenixMgr] - tools to load code into RAM or Flash of the F256.&lt;br /&gt;
&lt;br /&gt;
You can pull these down individually, or better yet, use [https://github.com/strickyak @strickyak]&#039;s great [https://github.com/strickyak/coco-shelf/ CoCo Shelf repository]. It has a &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; which gets all of the above and puts it in a convenient location (note that you&#039;ll have to update your shell script of choice to include the locations of the binaries in the &amp;lt;code&amp;gt;PATH&amp;lt;/code&amp;gt; environment variable).&lt;br /&gt;
&lt;br /&gt;
Here are the terminal commands for Linux and macOS to pull down all the required software:&lt;br /&gt;
 cd&lt;br /&gt;
 git clone &amp;lt;nowiki&amp;gt;https://github.com/strickyak/coco-shelf.git&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 cd coco-shelf&lt;br /&gt;
 export PATH=&amp;quot;$PATH:$HOME/coco-shelf/bin&amp;quot;&lt;br /&gt;
 make ANON=1 nitros9/done FoenixMgr/done&lt;br /&gt;
&lt;br /&gt;
(If you have a github account and your github ssh key is loaded,&lt;br /&gt;
you can omit `ANON=1` on the last command,&lt;br /&gt;
so it will check out git repositories using your github username,&lt;br /&gt;
in case you want to push changes.)&lt;br /&gt;
&lt;br /&gt;
There is a special Make target for re-flashing the F256Jr or F256K,&lt;br /&gt;
but first time you run this command, it should fail.  &lt;br /&gt;
Then you have to edit the `port=` line in `FoenixMgr/foenixmgr.ini`&lt;br /&gt;
and run the command again (with the cable plugged in): &lt;br /&gt;
 make ANON=1 run-f256-flash        # Old command for F256Jr that works?&lt;br /&gt;
or&lt;br /&gt;
 make ANON=1 run-f256jr-flash      # TODO fix this&lt;br /&gt;
or&lt;br /&gt;
 make ANON=1 run-f256k-flash       # TODO fix this&lt;br /&gt;
&lt;br /&gt;
== Building FEU and OS-9 Level 1 from scratch ==&lt;br /&gt;
FEU is the Foenix Executive Utility. It resides in flash and hosts a debugger and booters that can bring up operating systems like OS-9. FEU runs under OS-9 Level 1, so go ahead and build the entire operating system:&lt;br /&gt;
 cd nitros9&lt;br /&gt;
 export NITROS9DIR=$PWD&lt;br /&gt;
 cd level1/f256&lt;br /&gt;
 make &lt;br /&gt;
 cd feu&lt;br /&gt;
Now you can flash the image into the F256. You must have a USB cable connected to the system from your computer. Note: if you&#039;re using a Mac, you won&#039;t be able to upload code into the F256 due to the [https://www.maxlinear.com/support/design-tools/software-drivers driver manufacturer] being so behind on updates. You can use a Linux VM and FoenixMgr tools in bridge mode on the Mac.&lt;br /&gt;
&lt;br /&gt;
There are distinct builds of FEU for the F256 Jr and the F256K. Power up the machine, then select the correct command:&lt;br /&gt;
 cd feu&lt;br /&gt;
 make flash_f256jr&lt;br /&gt;
or&lt;br /&gt;
 cd feu&lt;br /&gt;
 make flash_f256k&lt;br /&gt;
&lt;br /&gt;
Then (this is in addition to make flash_f256jr or make flash_f256k):&lt;br /&gt;
&lt;br /&gt;
 make flash_f0&lt;br /&gt;
&lt;br /&gt;
Once the flash completes, restart the machine and FEU should come up.&lt;br /&gt;
&lt;br /&gt;
== Building OS-9 Level 2 ==&lt;br /&gt;
To build OS-9 Level 2, run these commands:&lt;br /&gt;
 cd ../../level2/f256&lt;br /&gt;
 make dsk&lt;br /&gt;
&lt;br /&gt;
This produces the following disk images for the F256 Jr and the F256K:&lt;br /&gt;
&lt;br /&gt;
 NOS9_6809_L2_v030300_f256jr_dw.dsk&lt;br /&gt;
 NOS9_6809_L2_v030300_f256jr_sd.dsk&lt;br /&gt;
 NOS9_6809_L2_v030300_f256k_dw.dsk&lt;br /&gt;
 NOS9_6809_L2_v030300_f256k_sd.dsk&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;dw&#039;&#039; disk images are for booting from DriveWire. The &#039;&#039;sd&#039;&#039; disk image are for booting from the SD card. You need to write the images onto an SD card, then insert the SD card into the F256 and restart.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s how to image the SD card.&lt;br /&gt;
&lt;br /&gt;
==== Linux ====&lt;br /&gt;
On Linux, insert the SD card into your computer. Ttype &amp;lt;code&amp;gt;lsblk&amp;lt;/code&amp;gt; to find the correct device and replace &#039;&#039;sdx&#039;&#039; on the command line below with it:&lt;br /&gt;
&lt;br /&gt;
 dd if=NOS9_6809_L2_v030300_f256k_sd.dsk of=/dev/&#039;&#039;sdx&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== macOS ====&lt;br /&gt;
On macOS, insert the SD card into your Mac. A dialog will likely appear telling you that the disk you attached isn&#039;t readable. Click the &amp;quot;ignore&amp;quot; button, then type &amp;lt;code&amp;gt;diskutil list external&amp;lt;/code&amp;gt; to obtain the device name of the SD card and replace &#039;&#039;diskx&#039;&#039; on the command line below with it:&lt;br /&gt;
 sudo dd if=NOS9_6809_L2_v030300_f256k_sd.dsk of=/dev/&#039;&#039;diskx&#039;&#039;&lt;br /&gt;
Once the command completes, type:&lt;br /&gt;
 diskutil eject /dev/&#039;&#039;diskx&#039;&#039;&lt;br /&gt;
You can then safely remove the SD card.&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=OS-9&amp;diff=485</id>
		<title>OS-9</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=OS-9&amp;diff=485"/>
		<updated>2024-10-22T12:52:16Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Building FEU and OS-9 Level 1 from scratch */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The FNX6809 combined with the F256 makes a great system for running OS-9/6809. [[wikipedia:OS-9|OS-9]] is a real-time, embedded operating system created by [[wikipedia:Microware|Microware Systems Corporation]]. While it was used in many areas of industry, home computer users know it best for its implementation on the [[wikipedia:TRS-80_Color_Computer|Tandy Color Computer]] sold by Radio Shack&lt;br /&gt;
&lt;br /&gt;
Today, a community effort has led to the creation of [https://github.com/nitros9project/nitros9 NitrOS-9], an open source version of the OS-9 operating system. Throughout this page, I&#039;ll refer to NitrOS-9 as OS-9.&lt;br /&gt;
&lt;br /&gt;
== A word about platforms ==&lt;br /&gt;
This page assumes you&#039;re running on Linux or macOS. If you&#039;re using Windows, these instructions don&#039;t apply, and someone will have to step up and write steps to develop on that platform.&lt;br /&gt;
&lt;br /&gt;
== Tooling ==&lt;br /&gt;
Cross-hosted development is the fastest way to develop for the F256. For this you need the following:&lt;br /&gt;
&lt;br /&gt;
* [http://www.lwtools.ca lwtools] - an assembler/linker package&lt;br /&gt;
* [https://github.com/nitros9project/toolshed ToolShed] - a set of tools for creating disk images&lt;br /&gt;
* [https://github.com/nitros9project/nitros9 NitrOS-9] - the NitrOS-9 operating system in source form&lt;br /&gt;
* [https://github.com/pweingar/FoenixMgr FoenixMgr] - tools to load code into RAM or Flash of the F256.&lt;br /&gt;
&lt;br /&gt;
You can pull these down individually, or better yet, use [https://github.com/strickyak @strickyak]&#039;s great [https://github.com/strickyak/coco-shelf/ CoCo Shelf repository]. It has a &amp;lt;code&amp;gt;Makefile&amp;lt;/code&amp;gt; which gets all of the above and puts it in a convenient location (note that you&#039;ll have to update your shell script of choice to include the locations of the binaries in the &amp;lt;code&amp;gt;PATH&amp;lt;/code&amp;gt; environment variable).&lt;br /&gt;
&lt;br /&gt;
Here are the terminal commands for Linux and macOS to pull down all the required software:&lt;br /&gt;
 cd&lt;br /&gt;
 git clone &amp;lt;nowiki&amp;gt;https://github.com/strickyak/coco-shelf.git&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 cd coco-shelf&lt;br /&gt;
 export PATH=&amp;quot;$PATH:$HOME/coco-shelf/bin&amp;quot;&lt;br /&gt;
 make ANON=1 nitros9/done FoenixMgr/done&lt;br /&gt;
&lt;br /&gt;
(If you have a github account and your github ssh key is loaded,&lt;br /&gt;
you can omit `ANON=1` on the last command,&lt;br /&gt;
so it will check out git repositories using your github username,&lt;br /&gt;
in case you want to push changes.)&lt;br /&gt;
&lt;br /&gt;
There is a special Make target for re-flashing the F256Jr or F256K,&lt;br /&gt;
but first time you run this command, it should fail.  &lt;br /&gt;
Then you have to edit the `port=` line in `FoenixMgr/foenixmgr.ini`&lt;br /&gt;
and run the command again (with the cable plugged in): &lt;br /&gt;
 make ANON=1 run-f256-flash        # Old command for F256Jr that works?&lt;br /&gt;
or&lt;br /&gt;
 make ANON=1 run-f256jr-flash      # TODO fix this&lt;br /&gt;
or&lt;br /&gt;
 make ANON=1 run-f256k-flash       # TODO fix this&lt;br /&gt;
&lt;br /&gt;
== Building FEU and OS-9 Level 1 from scratch ==&lt;br /&gt;
FEU is the Foenix Executive Utility. It resides in flash and hosts a debugger and booters that can bring up operating systems like OS-9. FEU runs under OS-9 Level 1, so go ahead and build the entire operating system:&lt;br /&gt;
 cd nitros9&lt;br /&gt;
 export NITROS9DIR=$PWD&lt;br /&gt;
 cd level1/f256&lt;br /&gt;
 make &lt;br /&gt;
 cd feu&lt;br /&gt;
Now you can flash the image into the F256. You must have a USB cable connected to the system from your computer. Note: if you&#039;re using a Mac, you won&#039;t be able to upload code into the F256 due to the [https://www.maxlinear.com/support/design-tools/software-drivers driver manufacturer] being so behind on updates. You can use a Linux VM and FoenixMgr tools in bridge mode on the Mac.&lt;br /&gt;
&lt;br /&gt;
There are distinct builds of FEU for the F256 Jr and the F256K. Power up the machine, then select the correct command:&lt;br /&gt;
 cd feu&lt;br /&gt;
 make flash_f256jr&lt;br /&gt;
or&lt;br /&gt;
 cd feu&lt;br /&gt;
 make flash_f256k&lt;br /&gt;
&lt;br /&gt;
Then:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;make flash_f0&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the flash completes, restart the machine and FEU should come up.&lt;br /&gt;
&lt;br /&gt;
== Building OS-9 Level 2 ==&lt;br /&gt;
To build OS-9 Level 2, run these commands:&lt;br /&gt;
 cd ../../level2/f256&lt;br /&gt;
 make dsk&lt;br /&gt;
&lt;br /&gt;
This produces the following disk images for the F256 Jr and the F256K:&lt;br /&gt;
&lt;br /&gt;
 NOS9_6809_L2_v030300_f256jr_dw.dsk&lt;br /&gt;
 NOS9_6809_L2_v030300_f256jr_sd.dsk&lt;br /&gt;
 NOS9_6809_L2_v030300_f256k_dw.dsk&lt;br /&gt;
 NOS9_6809_L2_v030300_f256k_sd.dsk&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;dw&#039;&#039; disk images are for booting from DriveWire. The &#039;&#039;sd&#039;&#039; disk image are for booting from the SD card. You need to write the images onto an SD card, then insert the SD card into the F256 and restart.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s how to image the SD card.&lt;br /&gt;
&lt;br /&gt;
==== Linux ====&lt;br /&gt;
On Linux, insert the SD card into your computer. Ttype &amp;lt;code&amp;gt;lsblk&amp;lt;/code&amp;gt; to find the correct device and replace &#039;&#039;sdx&#039;&#039; on the command line below with it:&lt;br /&gt;
&lt;br /&gt;
 dd if=NOS9_6809_L2_v030300_f256k_sd.dsk of=/dev/&#039;&#039;sdx&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== macOS ====&lt;br /&gt;
On macOS, insert the SD card into your Mac. A dialog will likely appear telling you that the disk you attached isn&#039;t readable. Click the &amp;quot;ignore&amp;quot; button, then type &amp;lt;code&amp;gt;diskutil list external&amp;lt;/code&amp;gt; to obtain the device name of the SD card and replace &#039;&#039;diskx&#039;&#039; on the command line below with it:&lt;br /&gt;
 sudo dd if=NOS9_6809_L2_v030300_f256k_sd.dsk of=/dev/&#039;&#039;diskx&#039;&#039;&lt;br /&gt;
Once the command completes, type:&lt;br /&gt;
 diskutil eject /dev/&#039;&#039;diskx&#039;&#039;&lt;br /&gt;
You can then safely remove the SD card.&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=484</id>
		<title>OS-9 Assembly Code Development</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=484"/>
		<updated>2024-10-08T11:43:35Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Single Source File Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
Each process in NitrOS-9 is allocated its own 64K address space.  When run, the program object code is loaded into the end of the memory space, and the variables and data structures are loaded into the beginning.  In addition, NitrOS-9 keeps an separate per-process MMU table (DAT Image), so you must use &amp;lt;code&amp;gt;F$MapBlk&amp;lt;/code&amp;gt; to map and &amp;lt;code&amp;gt;F$ClrBlk&amp;lt;/code&amp;gt; to unmap 8K blocks in your process&#039; address space. The operating system has its own 64K address space as well.  &lt;br /&gt;
&lt;br /&gt;
When a new process is created, registers U, Y, DP and SP are set with U = start of data area, Y = end of data area, DP = page # of beginning page, SP = end of data area + 1.   Each process includes its own execution and data directories, along with &amp;lt;code&amp;gt;std in&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;std out&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;std err&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Memory and DAT Image ===&lt;br /&gt;
&amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; output the current status of the memory in the system. &amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; shows which memory blocks are currently in use.  &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; shows the blocks that are mapped in the DAT Image for a particular process.&lt;br /&gt;
[[File:Mmappmap.png|none|thumb]]&lt;br /&gt;
&lt;br /&gt;
== Program and Data Module Structure ==&lt;br /&gt;
&lt;br /&gt;
There are 9 different types of modules in 4 possible languages:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
! colspan=&amp;quot;3&amp;quot; |Module Types&lt;br /&gt;
!&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; |Language&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Module Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Name&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Language&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|$1x&lt;br /&gt;
|Program Module&lt;br /&gt;
|Prgm&lt;br /&gt;
|&lt;br /&gt;
|$x0&lt;br /&gt;
|Data (non-executable)&lt;br /&gt;
|-&lt;br /&gt;
|$2x&lt;br /&gt;
|Subroutine Module&lt;br /&gt;
|Sbrtn&lt;br /&gt;
|&lt;br /&gt;
|$x1&lt;br /&gt;
|6809 Object Code&lt;br /&gt;
|-&lt;br /&gt;
|$3x&lt;br /&gt;
|Multi-module&lt;br /&gt;
|Multi&lt;br /&gt;
|&lt;br /&gt;
|$x2&lt;br /&gt;
|BASIC09 I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$4x&lt;br /&gt;
|Data Module&lt;br /&gt;
|Data&lt;br /&gt;
|&lt;br /&gt;
|$x3&lt;br /&gt;
|PASCAL I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$5x-$Bx&lt;br /&gt;
|User-definable module&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|$x4-$xF&lt;br /&gt;
|Reserved for Future Use&lt;br /&gt;
|-&lt;br /&gt;
|$Cx&lt;br /&gt;
|OS-9 System Module&lt;br /&gt;
|Systm&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Dx&lt;br /&gt;
|OS-9 File Manager Module&lt;br /&gt;
|FlMgr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Ex&lt;br /&gt;
|OS-9 Device Driver Module&lt;br /&gt;
|Drivr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Fx&lt;br /&gt;
|OS-9 Device Descriptor Module&lt;br /&gt;
|Devic&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
The two most used will be Program Modules and Data Modules.&lt;br /&gt;
&lt;br /&gt;
=== Program Modules ===&lt;br /&gt;
The format of a program module varies depending on whether you have a single source file for your program or multiple source files.  &lt;br /&gt;
&lt;br /&gt;
Note: multiple source files format cannot use direct page addressing due to the way they are compiled.&lt;br /&gt;
&lt;br /&gt;
==== Single Source File Format ====&lt;br /&gt;
The following is a skeleton for a single source file memory module (program).&lt;br /&gt;
 &amp;lt;code&amp;gt;********************************************************************&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* [Program Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* [Description]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* by [Author Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* Edt/Rev  YYYY/MM/DD  Modified by&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* Comment&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* ------------------------------------------------------------------&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               nam       [executablename]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               ttl       [Full Program Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;               ifp1&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               endc&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;tylg           set       Prgrm+Objct&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;rev            set       $00&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;edition        set       1&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;               &#039;&#039;&#039;mod       eom,name,tylg,atrv,start,size&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;        [Data Section - Variables and Data Structures Here]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;size           equ       .&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;name           fcs       /[executablename]/&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               fcb       edition&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;        [Program Section - Program Code Here]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;        &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               os9       F$Exit&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;               &#039;&#039;&#039;emod&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;eom            equ *&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               end&amp;lt;/code&amp;gt;&lt;br /&gt;
OS9 can load programs (modules) only if they are in module header format.  A module (program) is defined between the &#039;&#039;&#039;mod&#039;&#039;&#039; and &#039;&#039;&#039;emod&#039;&#039;&#039; pseudo instructions.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;mod:&#039;&#039;&#039; Creates the module header and starts CRC check. &#039;&#039;&#039;mod&#039;&#039;&#039; has 6 attributes:&lt;br /&gt;
&lt;br /&gt;
# Module size (computed from the &#039;&#039;&amp;lt;u&amp;gt;eom&amp;lt;/u&amp;gt;&#039;&#039; label at the end of the code - 2 bytes)&lt;br /&gt;
# Module name offset (offset where the string of the name is contained, here that is defined at the &#039;&#039;&amp;lt;u&amp;gt;name&amp;lt;/u&amp;gt;&#039;&#039; label with the &#039;&#039;fcs&#039;&#039; pseudo instruction - 2 bytes&lt;br /&gt;
# Module type &amp;amp; language (in this case a Program in 6809 object code - 1 byte)&lt;br /&gt;
# Module attribute-revision (1 byte).  Attributes are reentrant (ReEnt) or not reentrant  (0).  Revision is a number 0-15.  If two or more modules with the same name are in the module directory, then OS-9 only keeps the highest revision number module.&lt;br /&gt;
# Module execution offset (here that is defined with the &#039;&#039;&amp;lt;u&amp;gt;start&amp;lt;/u&amp;gt;&#039;&#039; label - 2 bytes)&lt;br /&gt;
# Module variable storage size (defined by the &#039;&#039;&amp;lt;u&amp;gt;size&amp;lt;/u&amp;gt;&#039;&#039; label immediately after the variable area, includes stack space - 2 bytes)&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;emod&#039;&#039;&#039;: Outputs the correct 3 byte CRC.  This is generated by the assembler over the entire module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information about memory modules, see OS-9 Fundamentals:&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=YpoqTyrty8k OS-9 Fundamentals on YouTube by Boisy Pitre]&lt;br /&gt;
&lt;br /&gt;
==== Multiple Source File Format ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Data Modules ===&lt;br /&gt;
Here is a portion of the font module, which is a data module in NitrOS-9.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;               nam       font&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               ttl       F256 font&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;tylg           set       Data&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;rev            set       $01&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               mod       eom,name,tylg,atrv,start,0&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;name           fcs       /font/&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;L0000          fcb   $00,$00,$00,$00,$00,$00,$00,$00 &amp;lt;/code&amp;gt; &lt;br /&gt;
 &amp;lt;code&amp;gt;L0008          fcb   $7C,$82,$AA,$82,$BA,$92,$82,$7C &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*More data here&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               emod&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;eom            equ       *&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Writing Position Independent Code ==&lt;br /&gt;
All code in NitrOS-9 must be position independent.  Addresses are not known until a program module is loaded and executed.  All addressing must be &amp;quot;program counter relative addressing&amp;quot;.  All branch and long branch instructions are program counter relative. &lt;br /&gt;
&lt;br /&gt;
Rules: &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BRA&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBRA&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JMP&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BSR&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBSR&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JSR&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use program counter relative indexed addressing for all load, store, arithmetic and logical instructions. &lt;br /&gt;
&lt;br /&gt;
== Accessing Variables and Data Structures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Accessing Table Data with PCR ==&lt;br /&gt;
__FORCETOC__&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_C_Code_Development&amp;diff=483</id>
		<title>OS-9 C Code Development</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_C_Code_Development&amp;diff=483"/>
		<updated>2024-10-08T11:13:48Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Cross-Compiler Development */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cross-Compiler Development=&lt;br /&gt;
&lt;br /&gt;
See also the NitrOS-9 wiki on [https://github.com/nitros9project/nitros9/wiki/Writing-your-first-C-Program-for-NitrOS%E2%80%909 Writing your first C Program].&lt;br /&gt;
=Native Development=&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Template:Main2/FNX6809_Processor&amp;diff=482</id>
		<title>Template:Main2/FNX6809 Processor</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Template:Main2/FNX6809_Processor&amp;diff=482"/>
		<updated>2024-10-08T11:07:46Z</updated>

		<summary type="html">&lt;p&gt;Jfed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;FNX6809 Processor&#039;&#039;&#039;&lt;br /&gt;
* [[FNX6809 Overview]]&lt;br /&gt;
* [[OS-9]]&lt;br /&gt;
* [[OS-9 Assembly Code Development]]&lt;br /&gt;
* [[OS-9_C_Code_Development|OS-9 C Code Development]]&lt;br /&gt;
* [[FNX6809_Manuals|FNX6809 Manuals]]&lt;br /&gt;
* [[FNX6809_GraphicsVTIOCalls|FNX6809 Graphics vtio calls]]&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_C_Code_Development&amp;diff=481</id>
		<title>OS-9 C Code Development</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_C_Code_Development&amp;diff=481"/>
		<updated>2024-10-08T11:05:48Z</updated>

		<summary type="html">&lt;p&gt;Jfed: Created page with &amp;quot;=Cross-Compiler Development=   =Native Development=&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Cross-Compiler Development=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Native Development=&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_GraphicsVTIOCalls&amp;diff=480</id>
		<title>FNX6809 GraphicsVTIOCalls</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_GraphicsVTIOCalls&amp;diff=480"/>
		<updated>2024-10-06T16:51:16Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Graphics Summary */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Graphics Summary ==&lt;br /&gt;
Use the &amp;lt;code&amp;gt;fstatus&amp;lt;/code&amp;gt; command in Level 2 to see the current status of the graphics registers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is a default clut memory module included called &amp;lt;code&amp;gt;xtclut&amp;lt;/code&amp;gt; in CMDS.  This has the xterm colors according to [https://www.ditig.com/publications/256-colors-cheat-sheet this chart]&lt;br /&gt;
&lt;br /&gt;
== vtio Get/Set Stat Calls ==&lt;br /&gt;
&lt;br /&gt;
=== SS.AScrn ===&lt;br /&gt;
&lt;br /&gt;
Allocate a bitmap screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$Y = bitmap# (0-2)&lt;br /&gt;
        R$X = screentype (0=320x240, 1=320x200)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
        X = Starting Page# of bitmap address&lt;br /&gt;
&lt;br /&gt;
=== SS.DScrn ===&lt;br /&gt;
Display Screen Settings&lt;br /&gt;
&lt;br /&gt;
Set MCR to display text or graphics or both&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = Vicky_MCR Low Byte&lt;br /&gt;
        R$Y = Vicky_MCR High Byte&lt;br /&gt;
&lt;br /&gt;
 Exit:  Nothing. This just sets the register and updates driver variables&lt;br /&gt;
&lt;br /&gt;
VICKY MASTER CONTROL REGISTER to enable graphics and capabilities&lt;br /&gt;
 | 7 |   6   |    5   |   4  |    3   |   2   |   1   |   0  |&lt;br /&gt;
 | X | GAMMA | SPRITE | TILE | BITMAP | GRAPH | OVRLY | TEXT |&lt;br /&gt;
 |   -----   | FON_SET|FON_OV| MON_SLP| DBL_Y | DBL_X | CLK70|&lt;br /&gt;
 $FFC0 MASTER_CTRL_REG_L, MASTER_CTRL_REG_H&lt;br /&gt;
 &lt;br /&gt;
 ********************************************************************&lt;br /&gt;
 * vtio graphics constants (in f256.d)&lt;br /&gt;
 ********************************************************************&lt;br /&gt;
 * Constants used in SS.DScrn to set the display screen type&lt;br /&gt;
&lt;br /&gt;
 FX_GAM             equ       %01000000              Gamma Correction On&lt;br /&gt;
 FX_SPR             equ       %00100000              Sprites On&lt;br /&gt;
 FX_TIL             equ       %00010000              Tile Maps On&lt;br /&gt;
 FX_BM              equ       %00001000              Bitmaps On&lt;br /&gt;
 FX_GRF             equ       %00000100              Graphics Mode On&lt;br /&gt;
 FX_OVR             equ       %00000010              Overlay Text on Graphics&lt;br /&gt;
 FX_TXT             equ       %00000001              Text Mode On&lt;br /&gt;
 FT_FSET            equ       %00100000              Font Set 1 On (0=Font Set 0)&lt;br /&gt;
 FT_FOVR            equ       %00010000              FG and BG colors displayed when overlay text 0=transparent&lt;br /&gt;
 FT_MON             equ       %00001000              Turn off monitor sync and sleep monitor&lt;br /&gt;
 FT_DBX             equ       %00000100              Double-wide text mode characters&lt;br /&gt;
 FT_DBY             equ       %00000010              Double-high text mode characters&lt;br /&gt;
 FT_CLK70           equ       %00000001              70 Hz screen (640x400 txt,320x200 grf)&lt;br /&gt;
 FX_OMIT            equ       %11111111              Setting for SS.DScrn don&#039;t change first byte in MCR&lt;br /&gt;
 FT_OMIT            equ       %11111111              Setting for SS.DScrn don&#039;t change second byte in MCR &lt;br /&gt;
&lt;br /&gt;
=== SS.PScrn ===&lt;br /&gt;
Position Screen Layers&lt;br /&gt;
&lt;br /&gt;
Set layer to display a screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = layer (0-2)&lt;br /&gt;
        R$Y = bitmap# (0-2), tilemap (4-6)&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
&lt;br /&gt;
=== SS.FScrn ===&lt;br /&gt;
&lt;br /&gt;
Free a bitmap screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$Y = bitmap# (0-2)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
&lt;br /&gt;
=== SS.DfPal ===&lt;br /&gt;
Define Palette and populate a CLUT from Memory Module&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = CLUT # (0-3)&lt;br /&gt;
        R$Y = pointer to location of data in caller process&lt;br /&gt;
        (Caller must load data module)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_GraphicsVTIOCalls&amp;diff=479</id>
		<title>FNX6809 GraphicsVTIOCalls</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_GraphicsVTIOCalls&amp;diff=479"/>
		<updated>2024-10-06T16:42:13Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Graphics Summary */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Graphics Summary ==&lt;br /&gt;
Use the &amp;lt;code&amp;gt;fstatus&amp;lt;/code&amp;gt; command in Level 2 to see the current status of the graphics registers.&lt;br /&gt;
&lt;br /&gt;
== vtio Get/Set Stat Calls ==&lt;br /&gt;
&lt;br /&gt;
=== SS.AScrn ===&lt;br /&gt;
&lt;br /&gt;
Allocate a bitmap screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$Y = bitmap# (0-2)&lt;br /&gt;
        R$X = screentype (0=320x240, 1=320x200)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
        X = Starting Page# of bitmap address&lt;br /&gt;
&lt;br /&gt;
=== SS.DScrn ===&lt;br /&gt;
Display Screen Settings&lt;br /&gt;
&lt;br /&gt;
Set MCR to display text or graphics or both&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = Vicky_MCR Low Byte&lt;br /&gt;
        R$Y = Vicky_MCR High Byte&lt;br /&gt;
&lt;br /&gt;
 Exit:  Nothing. This just sets the register and updates driver variables&lt;br /&gt;
&lt;br /&gt;
VICKY MASTER CONTROL REGISTER to enable graphics and capabilities&lt;br /&gt;
 | 7 |   6   |    5   |   4  |    3   |   2   |   1   |   0  |&lt;br /&gt;
 | X | GAMMA | SPRITE | TILE | BITMAP | GRAPH | OVRLY | TEXT |&lt;br /&gt;
 |   -----   | FON_SET|FON_OV| MON_SLP| DBL_Y | DBL_X | CLK70|&lt;br /&gt;
 $FFC0 MASTER_CTRL_REG_L, MASTER_CTRL_REG_H&lt;br /&gt;
 &lt;br /&gt;
 ********************************************************************&lt;br /&gt;
 * vtio graphics constants (in f256.d)&lt;br /&gt;
 ********************************************************************&lt;br /&gt;
 * Constants used in SS.DScrn to set the display screen type&lt;br /&gt;
&lt;br /&gt;
 FX_GAM             equ       %01000000              Gamma Correction On&lt;br /&gt;
 FX_SPR             equ       %00100000              Sprites On&lt;br /&gt;
 FX_TIL             equ       %00010000              Tile Maps On&lt;br /&gt;
 FX_BM              equ       %00001000              Bitmaps On&lt;br /&gt;
 FX_GRF             equ       %00000100              Graphics Mode On&lt;br /&gt;
 FX_OVR             equ       %00000010              Overlay Text on Graphics&lt;br /&gt;
 FX_TXT             equ       %00000001              Text Mode On&lt;br /&gt;
 FT_FSET            equ       %00100000              Font Set 1 On (0=Font Set 0)&lt;br /&gt;
 FT_FOVR            equ       %00010000              FG and BG colors displayed when overlay text 0=transparent&lt;br /&gt;
 FT_MON             equ       %00001000              Turn off monitor sync and sleep monitor&lt;br /&gt;
 FT_DBX             equ       %00000100              Double-wide text mode characters&lt;br /&gt;
 FT_DBY             equ       %00000010              Double-high text mode characters&lt;br /&gt;
 FT_CLK70           equ       %00000001              70 Hz screen (640x400 txt,320x200 grf)&lt;br /&gt;
 FX_OMIT            equ       %11111111              Setting for SS.DScrn don&#039;t change first byte in MCR&lt;br /&gt;
 FT_OMIT            equ       %11111111              Setting for SS.DScrn don&#039;t change second byte in MCR &lt;br /&gt;
&lt;br /&gt;
=== SS.PScrn ===&lt;br /&gt;
Position Screen Layers&lt;br /&gt;
&lt;br /&gt;
Set layer to display a screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = layer (0-2)&lt;br /&gt;
        R$Y = bitmap# (0-2), tilemap (4-6)&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
&lt;br /&gt;
=== SS.FScrn ===&lt;br /&gt;
&lt;br /&gt;
Free a bitmap screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$Y = bitmap# (0-2)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
&lt;br /&gt;
=== SS.DfPal ===&lt;br /&gt;
Define Palette and populate a CLUT from Memory Module&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = CLUT # (0-3)&lt;br /&gt;
        R$Y = pointer to location of data in caller process&lt;br /&gt;
        (Caller must load data module)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Template:Main2/FNX6809_Processor&amp;diff=478</id>
		<title>Template:Main2/FNX6809 Processor</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Template:Main2/FNX6809_Processor&amp;diff=478"/>
		<updated>2024-10-06T16:32:27Z</updated>

		<summary type="html">&lt;p&gt;Jfed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;FNX6809 Processor&#039;&#039;&#039;&lt;br /&gt;
* [[FNX6809 Overview]]&lt;br /&gt;
* [[OS-9]]&lt;br /&gt;
* [[OS-9 Assembly Code Development]]&lt;br /&gt;
* [[FNX6809_Manuals|FNX6809 Manuals]]&lt;br /&gt;
* [[FNX6809_GraphicsVTIOCalls|FNX6809 Graphics vtio calls]]&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_GraphicsVTIOCalls&amp;diff=477</id>
		<title>FNX6809 GraphicsVTIOCalls</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_GraphicsVTIOCalls&amp;diff=477"/>
		<updated>2024-10-06T16:19:06Z</updated>

		<summary type="html">&lt;p&gt;Jfed: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Graphics Summary ==&lt;br /&gt;
&lt;br /&gt;
== vtio Get/Set Stat Calls ==&lt;br /&gt;
&lt;br /&gt;
=== SS.AScrn ===&lt;br /&gt;
&lt;br /&gt;
Allocate a bitmap screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$Y = bitmap# (0-2)&lt;br /&gt;
        R$X = screentype (0=320x240, 1=320x200)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
        X = Starting Page# of bitmap address&lt;br /&gt;
&lt;br /&gt;
=== SS.DScrn ===&lt;br /&gt;
Display Screen Settings&lt;br /&gt;
&lt;br /&gt;
Set MCR to display text or graphics or both&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = Vicky_MCR Low Byte&lt;br /&gt;
        R$Y = Vicky_MCR High Byte&lt;br /&gt;
&lt;br /&gt;
 Exit:  Nothing. This just sets the register and updates driver variables&lt;br /&gt;
&lt;br /&gt;
VICKY MASTER CONTROL REGISTER to enable graphics and capabilities&lt;br /&gt;
 | 7 |   6   |    5   |   4  |    3   |   2   |   1   |   0  |&lt;br /&gt;
 | X | GAMMA | SPRITE | TILE | BITMAP | GRAPH | OVRLY | TEXT |&lt;br /&gt;
 |   -----   | FON_SET|FON_OV| MON_SLP| DBL_Y | DBL_X | CLK70|&lt;br /&gt;
 $FFC0 MASTER_CTRL_REG_L, MASTER_CTRL_REG_H&lt;br /&gt;
 &lt;br /&gt;
 ********************************************************************&lt;br /&gt;
 * vtio graphics constants (in f256.d)&lt;br /&gt;
 ********************************************************************&lt;br /&gt;
 * Constants used in SS.DScrn to set the display screen type&lt;br /&gt;
&lt;br /&gt;
 FX_GAM             equ       %01000000              Gamma Correction On&lt;br /&gt;
 FX_SPR             equ       %00100000              Sprites On&lt;br /&gt;
 FX_TIL             equ       %00010000              Tile Maps On&lt;br /&gt;
 FX_BM              equ       %00001000              Bitmaps On&lt;br /&gt;
 FX_GRF             equ       %00000100              Graphics Mode On&lt;br /&gt;
 FX_OVR             equ       %00000010              Overlay Text on Graphics&lt;br /&gt;
 FX_TXT             equ       %00000001              Text Mode On&lt;br /&gt;
 FT_FSET            equ       %00100000              Font Set 1 On (0=Font Set 0)&lt;br /&gt;
 FT_FOVR            equ       %00010000              FG and BG colors displayed when overlay text 0=transparent&lt;br /&gt;
 FT_MON             equ       %00001000              Turn off monitor sync and sleep monitor&lt;br /&gt;
 FT_DBX             equ       %00000100              Double-wide text mode characters&lt;br /&gt;
 FT_DBY             equ       %00000010              Double-high text mode characters&lt;br /&gt;
 FT_CLK70           equ       %00000001              70 Hz screen (640x400 txt,320x200 grf)&lt;br /&gt;
 FX_OMIT            equ       %11111111              Setting for SS.DScrn don&#039;t change first byte in MCR&lt;br /&gt;
 FT_OMIT            equ       %11111111              Setting for SS.DScrn don&#039;t change second byte in MCR &lt;br /&gt;
&lt;br /&gt;
=== SS.PScrn ===&lt;br /&gt;
Position Screen Layers&lt;br /&gt;
&lt;br /&gt;
Set layer to display a screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = layer (0-2)&lt;br /&gt;
        R$Y = bitmap# (0-2), tilemap (4-6)&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
&lt;br /&gt;
=== SS.FScrn ===&lt;br /&gt;
&lt;br /&gt;
Free a bitmap screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$Y = bitmap# (0-2)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
&lt;br /&gt;
=== SS.DfPal ===&lt;br /&gt;
Define Palette and populate a CLUT from Memory Module&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = CLUT # (0-3)&lt;br /&gt;
        R$Y = pointer to location of data in caller process&lt;br /&gt;
        (Caller must load data module)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_GraphicsVTIOCalls&amp;diff=476</id>
		<title>FNX6809 GraphicsVTIOCalls</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=FNX6809_GraphicsVTIOCalls&amp;diff=476"/>
		<updated>2024-10-06T16:17:35Z</updated>

		<summary type="html">&lt;p&gt;Jfed: Created page with &amp;quot;== Graphics Summary ==  == vtio Get/Set Stat Calls ==  === SS.AScrn ===  Allocate a bitmap screen   Entry: R$Y = bitmap# (0-2)         R$X = screentype (0=320x240, 1=320x200)   Exit:  B = A non-zero error code.        CC = Carry flag clear to indicate success         X = Starting Page# of bitmap address  === SS.DScrn === Display Screen Settings  Set MCR to display text or graphics or both   Entry: R$X = Vicky_MCR Low Byte         R$Y = Vicky_MCR High Byte   Exit:  Nothin...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Graphics Summary ==&lt;br /&gt;
&lt;br /&gt;
== vtio Get/Set Stat Calls ==&lt;br /&gt;
&lt;br /&gt;
=== SS.AScrn ===&lt;br /&gt;
&lt;br /&gt;
Allocate a bitmap screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$Y = bitmap# (0-2)&lt;br /&gt;
        R$X = screentype (0=320x240, 1=320x200)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
        X = Starting Page# of bitmap address&lt;br /&gt;
&lt;br /&gt;
=== SS.DScrn ===&lt;br /&gt;
Display Screen Settings&lt;br /&gt;
&lt;br /&gt;
Set MCR to display text or graphics or both&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = Vicky_MCR Low Byte&lt;br /&gt;
        R$Y = Vicky_MCR High Byte&lt;br /&gt;
&lt;br /&gt;
 Exit:  Nothing. This just sets the register and updates driver variables&lt;br /&gt;
&lt;br /&gt;
VICKY MASTER CONTROL REGISTER to enable graphics and capabilities&lt;br /&gt;
 | 7 |   6   |    5   |   4  |    3   |   2   |   1   |   0  |&lt;br /&gt;
 | X | GAMMA | SPRITE | TILE | BITMAP | GRAPH | OVRLY | TEXT |&lt;br /&gt;
 |   -----   | FON_SET|FON_OV| MON_SLP| DBL_Y | DBL_X | CLK70|&lt;br /&gt;
 $FFC0 MASTER_CTRL_REG_L, MASTER_CTRL_REG_H&lt;br /&gt;
 &lt;br /&gt;
********************************************************************&lt;br /&gt;
* vtio graphics constants (in f256.d)&lt;br /&gt;
********************************************************************&lt;br /&gt;
* Constants used in SS.DScrn to set the display screen type&lt;br /&gt;
&lt;br /&gt;
FX_GAM             equ       %01000000              Gamma Correction On&lt;br /&gt;
FX_SPR             equ       %00100000              Sprites On&lt;br /&gt;
FX_TIL             equ       %00010000              Tile Maps On&lt;br /&gt;
FX_BM              equ       %00001000              Bitmaps On&lt;br /&gt;
FX_GRF             equ       %00000100              Graphics Mode On&lt;br /&gt;
FX_OVR             equ       %00000010              Overlay Text on Graphics&lt;br /&gt;
FX_TXT             equ       %00000001              Text Mode On&lt;br /&gt;
FT_FSET            equ       %00100000              Font Set 1 On (0=Font Set 0)&lt;br /&gt;
FT_FOVR            equ       %00010000              FG and BG colors displayed when overlay text 0=transparent&lt;br /&gt;
FT_MON             equ       %00001000              Turn off monitor sync and sleep monitor&lt;br /&gt;
FT_DBX             equ       %00000100              Double-wide text mode characters&lt;br /&gt;
FT_DBY             equ       %00000010              Double-high text mode characters&lt;br /&gt;
FT_CLK70           equ       %00000001              70 Hz screen (640x400 txt,320x200 grf)&lt;br /&gt;
FX_OMIT            equ       %11111111              Setting for SS.DScrn don&#039;t change first byte in MCR&lt;br /&gt;
FT_OMIT            equ       %11111111              Setting for SS.DScrn don&#039;t change second byte in MCR&lt;br /&gt;
&lt;br /&gt;
=== SS.PScrn ===&lt;br /&gt;
Position Screen Layers&lt;br /&gt;
&lt;br /&gt;
Set layer to display a screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = layer (0-2)&lt;br /&gt;
        R$Y = bitmap# (0-2), tilemap (4-6)&lt;br /&gt;
        &lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
&lt;br /&gt;
=== SS.FScrn ===&lt;br /&gt;
&lt;br /&gt;
Free a bitmap screen&lt;br /&gt;
&lt;br /&gt;
 Entry: R$Y = bitmap# (0-2)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;br /&gt;
&lt;br /&gt;
=== SS.DfPal ===&lt;br /&gt;
Define Palette and populate a CLUT from Memory Module&lt;br /&gt;
&lt;br /&gt;
 Entry: R$X = CLUT # (0-3)&lt;br /&gt;
        R$Y = pointer to location of data in caller process&lt;br /&gt;
        (Caller must load data module)&lt;br /&gt;
&lt;br /&gt;
 Exit:  B = A non-zero error code.&lt;br /&gt;
       CC = Carry flag clear to indicate success&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=473</id>
		<title>OS-9 Assembly Code Development</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=473"/>
		<updated>2024-10-01T04:18:33Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Single Source File Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
Each process in NitrOS-9 is allocated its own 64K address space.  When run, the program object code is loaded into the end of the memory space, and the variables and data structures are loaded into the beginning.  In addition, NitrOS-9 keeps an separate per-process MMU table (DAT Image), so you must use &amp;lt;code&amp;gt;F$MapBlk&amp;lt;/code&amp;gt; to map and &amp;lt;code&amp;gt;F$ClrBlk&amp;lt;/code&amp;gt; to unmap 8K blocks in your process&#039; address space. The operating system has its own 64K address space as well.  &lt;br /&gt;
&lt;br /&gt;
When a new process is created, registers U, Y, DP and SP are set with U = start of data area, Y = end of data area, DP = page # of beginning page, SP = end of data area + 1.   Each process includes its own execution and data directories, along with &amp;lt;code&amp;gt;std in&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;std out&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;std err&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Memory and DAT Image ===&lt;br /&gt;
&amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; output the current status of the memory in the system. &amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; shows which memory blocks are currently in use.  &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; shows the blocks that are mapped in the DAT Image for a particular process.&lt;br /&gt;
[[File:Mmappmap.png|none|thumb]]&lt;br /&gt;
&lt;br /&gt;
== Program and Data Module Structure ==&lt;br /&gt;
&lt;br /&gt;
There are 9 different types of modules in 4 possible languages:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
! colspan=&amp;quot;3&amp;quot; |Module Types&lt;br /&gt;
!&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; |Language&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Module Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Name&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Language&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|$1x&lt;br /&gt;
|Program Module&lt;br /&gt;
|Prgm&lt;br /&gt;
|&lt;br /&gt;
|$x0&lt;br /&gt;
|Data (non-executable)&lt;br /&gt;
|-&lt;br /&gt;
|$2x&lt;br /&gt;
|Subroutine Module&lt;br /&gt;
|Sbrtn&lt;br /&gt;
|&lt;br /&gt;
|$x1&lt;br /&gt;
|6809 Object Code&lt;br /&gt;
|-&lt;br /&gt;
|$3x&lt;br /&gt;
|Multi-module&lt;br /&gt;
|Multi&lt;br /&gt;
|&lt;br /&gt;
|$x2&lt;br /&gt;
|BASIC09 I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$4x&lt;br /&gt;
|Data Module&lt;br /&gt;
|Data&lt;br /&gt;
|&lt;br /&gt;
|$x3&lt;br /&gt;
|PASCAL I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$5x-$Bx&lt;br /&gt;
|User-definable module&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|$x4-$xF&lt;br /&gt;
|Reserved for Future Use&lt;br /&gt;
|-&lt;br /&gt;
|$Cx&lt;br /&gt;
|OS-9 System Module&lt;br /&gt;
|Systm&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Dx&lt;br /&gt;
|OS-9 File Manager Module&lt;br /&gt;
|FlMgr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Ex&lt;br /&gt;
|OS-9 Device Driver Module&lt;br /&gt;
|Drivr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Fx&lt;br /&gt;
|OS-9 Device Descriptor Module&lt;br /&gt;
|Devic&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
The two most used will be Program Modules and Data Modules.&lt;br /&gt;
&lt;br /&gt;
=== Program Modules ===&lt;br /&gt;
The format of a program module varies depending on whether you have a single source file for your program or multiple source files.  &lt;br /&gt;
&lt;br /&gt;
Note: multiple source files format cannot use direct page addressing due to the way they are compiled.&lt;br /&gt;
&lt;br /&gt;
==== Single Source File Format ====&lt;br /&gt;
The following is a skeleton for a single source file memory module (program).&lt;br /&gt;
 &amp;lt;code&amp;gt;********************************************************************&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* [Program Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* [Description]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* by [Author Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* Edt/Rev  YYYY/MM/DD  Modified by&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* Comment&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* ------------------------------------------------------------------&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               nam       [executablename]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               ttl       [Full Program Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;               ifp1&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               endc&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;tylg           set       Prgrm+Objct&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;rev            set       $00&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;edition        set       1&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;               &#039;&#039;&#039;mod       eom,name,tylg,atrv,start,size&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;        [Data Section - Variables and Data Structures Here]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;size           equ       .&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;name           fcs       /[executablename]/&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               fcb       edition&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;        [Program Section - Program Code Here]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;        &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               os9       F$Exit&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;               &#039;&#039;&#039;emod&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;eom            equ *&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               end&amp;lt;/code&amp;gt;&lt;br /&gt;
OS9 can load programs (modules) only if they are in module header format.  A module (program) is defined between the &#039;&#039;&#039;mod&#039;&#039;&#039; and &#039;&#039;&#039;emod&#039;&#039;&#039; pseudo instructions.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;mod:&#039;&#039;&#039; Creates the module header and starts CRC check. &#039;&#039;&#039;mod&#039;&#039;&#039; has 6 attributes:&lt;br /&gt;
&lt;br /&gt;
# Module size (computed from the &#039;&#039;eom&#039;&#039; label at the end of the code - 2 bytes)&lt;br /&gt;
# Module name offset (offset where the string of the name is contained, here that is defined at the name label with the &#039;&#039;fcs&#039;&#039; pseudo instruction - 2 bytes&lt;br /&gt;
# Module type &amp;amp; language (in this case a Program in 6809 object code - 1 byte)&lt;br /&gt;
# Module attribute-revision (1 byte).  Attributes are reentrant (ReEnt) or not reentrant  (0).  Revision is a number 0-15.  If two or more modules with the same name are in the module directory, then OS-9 only keeps the highest revision number module.&lt;br /&gt;
# Module execution offset (here that is defined with the start label - 2 bytes)&lt;br /&gt;
# Module variable storage size (defined by the &#039;&#039;&amp;lt;u&amp;gt;size&amp;lt;/u&amp;gt;&#039;&#039; label immediately after the variable area, includes stack space - 2 bytes)&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;emod&#039;&#039;&#039;: Outputs the correct 3 byte CRC.  This is generated by the assembler over the entire module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information about memory modules, see OS-9 Fundamentals:&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=YpoqTyrty8k OS-9 Fundamentals on YouTube by Boisy Pitre]&lt;br /&gt;
&lt;br /&gt;
==== Multiple Source File Format ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Data Modules ===&lt;br /&gt;
Here is a portion of the font module, which is a data module in NitrOS-9.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;               nam       font&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               ttl       F256 font&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;tylg           set       Data&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;rev            set       $01&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               mod       eom,name,tylg,atrv,start,0&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;name           fcs       /font/&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;L0000          fcb   $00,$00,$00,$00,$00,$00,$00,$00 &amp;lt;/code&amp;gt; &lt;br /&gt;
 &amp;lt;code&amp;gt;L0008          fcb   $7C,$82,$AA,$82,$BA,$92,$82,$7C &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*More data here&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               emod&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;eom            equ       *&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Writing Position Independent Code ==&lt;br /&gt;
All code in NitrOS-9 must be position independent.  Addresses are not known until a program module is loaded and executed.  All addressing must be &amp;quot;program counter relative addressing&amp;quot;.  All branch and long branch instructions are program counter relative. &lt;br /&gt;
&lt;br /&gt;
Rules: &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BRA&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBRA&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JMP&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BSR&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBSR&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JSR&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use program counter relative indexed addressing for all load, store, arithmetic and logical instructions. &lt;br /&gt;
&lt;br /&gt;
== Accessing Variables and Data Structures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Accessing Table Data with PCR ==&lt;br /&gt;
__FORCETOC__&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=472</id>
		<title>OS-9 Assembly Code Development</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=472"/>
		<updated>2024-10-01T03:49:51Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Single Source File Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
Each process in NitrOS-9 is allocated its own 64K address space.  When run, the program object code is loaded into the end of the memory space, and the variables and data structures are loaded into the beginning.  In addition, NitrOS-9 keeps an separate per-process MMU table (DAT Image), so you must use &amp;lt;code&amp;gt;F$MapBlk&amp;lt;/code&amp;gt; to map and &amp;lt;code&amp;gt;F$ClrBlk&amp;lt;/code&amp;gt; to unmap 8K blocks in your process&#039; address space. The operating system has its own 64K address space as well.  &lt;br /&gt;
&lt;br /&gt;
When a new process is created, registers U, Y, DP and SP are set with U = start of data area, Y = end of data area, DP = page # of beginning page, SP = end of data area + 1.   Each process includes its own execution and data directories, along with &amp;lt;code&amp;gt;std in&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;std out&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;std err&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Memory and DAT Image ===&lt;br /&gt;
&amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; output the current status of the memory in the system. &amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; shows which memory blocks are currently in use.  &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; shows the blocks that are mapped in the DAT Image for a particular process.&lt;br /&gt;
[[File:Mmappmap.png|none|thumb]]&lt;br /&gt;
&lt;br /&gt;
== Program and Data Module Structure ==&lt;br /&gt;
&lt;br /&gt;
There are 9 different types of modules in 4 possible languages:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
! colspan=&amp;quot;3&amp;quot; |Module Types&lt;br /&gt;
!&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; |Language&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Module Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Name&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Language&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|$1x&lt;br /&gt;
|Program Module&lt;br /&gt;
|Prgm&lt;br /&gt;
|&lt;br /&gt;
|$x0&lt;br /&gt;
|Data (non-executable)&lt;br /&gt;
|-&lt;br /&gt;
|$2x&lt;br /&gt;
|Subroutine Module&lt;br /&gt;
|Sbrtn&lt;br /&gt;
|&lt;br /&gt;
|$x1&lt;br /&gt;
|6809 Object Code&lt;br /&gt;
|-&lt;br /&gt;
|$3x&lt;br /&gt;
|Multi-module&lt;br /&gt;
|Multi&lt;br /&gt;
|&lt;br /&gt;
|$x2&lt;br /&gt;
|BASIC09 I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$4x&lt;br /&gt;
|Data Module&lt;br /&gt;
|Data&lt;br /&gt;
|&lt;br /&gt;
|$x3&lt;br /&gt;
|PASCAL I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$5x-$Bx&lt;br /&gt;
|User-definable module&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|$x4-$xF&lt;br /&gt;
|Reserved for Future Use&lt;br /&gt;
|-&lt;br /&gt;
|$Cx&lt;br /&gt;
|OS-9 System Module&lt;br /&gt;
|Systm&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Dx&lt;br /&gt;
|OS-9 File Manager Module&lt;br /&gt;
|FlMgr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Ex&lt;br /&gt;
|OS-9 Device Driver Module&lt;br /&gt;
|Drivr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Fx&lt;br /&gt;
|OS-9 Device Descriptor Module&lt;br /&gt;
|Devic&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
The two most used will be Program Modules and Data Modules.&lt;br /&gt;
&lt;br /&gt;
=== Program Modules ===&lt;br /&gt;
The format of a program module varies depending on whether you have a single source file for your program or multiple source files.  &lt;br /&gt;
&lt;br /&gt;
Note: multiple source files format cannot use direct page addressing due to the way they are compiled.&lt;br /&gt;
&lt;br /&gt;
==== Single Source File Format ====&lt;br /&gt;
The following is a skeleton for a single source file memory module (program).&lt;br /&gt;
 &amp;lt;code&amp;gt;********************************************************************&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* [Program Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* [Description]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* by [Author Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* Edt/Rev  YYYY/MM/DD  Modified by&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* Comment&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* ------------------------------------------------------------------&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               nam       [executablename]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               ttl       [Full Program Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;               ifp1&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               endc&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;tylg           set       Prgrm+Objct&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;rev            set       $00&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;edition        set       1&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;               &#039;&#039;&#039;mod       eom,name,tylg,atrv,start,size&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;        [Data Section - Variables and Data Structures Here]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;size           equ       .&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;name           fcs       /[executablename]/&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               fcb       edition&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;        [Program Section - Program Code Here]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;        &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               os9 F$Exit&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;               &#039;&#039;&#039;emod&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;eom            equ *&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               end&amp;lt;/code&amp;gt;&lt;br /&gt;
OS9 can load programs (modules) only if they are in module header format.  A module (program) is defined between the &#039;&#039;&#039;mod&#039;&#039;&#039; and &#039;&#039;&#039;emod&#039;&#039;&#039; pseudo instructions.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;mod:&#039;&#039;&#039; Creates the module header and starts CRC check. &#039;&#039;&#039;mod&#039;&#039;&#039; has 6 attributes:&lt;br /&gt;
&lt;br /&gt;
# Module size (computed from the &#039;&#039;eom&#039;&#039; label at the end of the code - 2 bytes)&lt;br /&gt;
# Module name offset (offset where the string of the name is contained, here that is defined at the name label with the &#039;&#039;fcs&#039;&#039; pseudo instruction - 2 bytes&lt;br /&gt;
# Module type &amp;amp; language (in this case a Program in 6809 object code - 1 byte)&lt;br /&gt;
# Module attribute-revision (1 byte).  Attributes are reentrant (ReEnt) or not reentrant  (0).  Revision is a number 0-15.  If two or more modules with the same name are in the module directory, then OS-9 only keeps the highest revision number module.&lt;br /&gt;
# Module execution offset (here that is defined with the start label - 2 bytes)&lt;br /&gt;
# Module variable storage size (defined by the &#039;&#039;&amp;lt;u&amp;gt;size&amp;lt;/u&amp;gt;&#039;&#039; label immediately after the variable area, includes stack space - 2 bytes)&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;emod&#039;&#039;&#039;: Outputs the correct 3 byte CRC.  This is generated by the assembler over the entire module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information about memory modules, see OS-9 Fundamentals:&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=YpoqTyrty8k OS-9 Fundamentals on YouTube by Boisy Pitre]&lt;br /&gt;
&lt;br /&gt;
==== Multiple Source File Format ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Data Modules ===&lt;br /&gt;
Here is a portion of the font module, which is a data module in NitrOS-9.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;               nam       font&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               ttl       F256 font&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;tylg           set       Data&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;rev            set       $01&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               mod       eom,name,tylg,atrv,start,0&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;name           fcs       /font/&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;L0000          fcb   $00,$00,$00,$00,$00,$00,$00,$00 &amp;lt;/code&amp;gt; &lt;br /&gt;
 &amp;lt;code&amp;gt;L0008          fcb   $7C,$82,$AA,$82,$BA,$92,$82,$7C &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*More data here&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               emod&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;eom            equ       *&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Writing Position Independent Code ==&lt;br /&gt;
All code in NitrOS-9 must be position independent.  Addresses are not known until a program module is loaded and executed.  All addressing must be &amp;quot;program counter relative addressing&amp;quot;.  All branch and long branch instructions are program counter relative. &lt;br /&gt;
&lt;br /&gt;
Rules: &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BRA&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBRA&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JMP&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BSR&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBSR&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JSR&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use program counter relative indexed addressing for all load, store, arithmetic and logical instructions. &lt;br /&gt;
&lt;br /&gt;
== Accessing Variables and Data Structures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Accessing Table Data with PCR ==&lt;br /&gt;
__FORCETOC__&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=471</id>
		<title>OS-9 Assembly Code Development</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=471"/>
		<updated>2024-09-30T02:59:46Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Program Modules */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
Each process in NitrOS-9 is allocated its own 64K address space.  When run, the program object code is loaded into the end of the memory space, and the variables and data structures are loaded into the beginning.  In addition, NitrOS-9 keeps an separate per-process MMU table (DAT Image), so you must use &amp;lt;code&amp;gt;F$MapBlk&amp;lt;/code&amp;gt; to map and &amp;lt;code&amp;gt;F$ClrBlk&amp;lt;/code&amp;gt; to unmap 8K blocks in your process&#039; address space. The operating system has its own 64K address space as well.  &lt;br /&gt;
&lt;br /&gt;
When a new process is created, registers U, Y, DP and SP are set with U = start of data area, Y = end of data area, DP = page # of beginning page, SP = end of data area + 1.   Each process includes its own execution and data directories, along with &amp;lt;code&amp;gt;std in&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;std out&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;std err&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Memory and DAT Image ===&lt;br /&gt;
&amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; output the current status of the memory in the system. &amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; shows which memory blocks are currently in use.  &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; shows the blocks that are mapped in the DAT Image for a particular process.&lt;br /&gt;
[[File:Mmappmap.png|none|thumb]]&lt;br /&gt;
&lt;br /&gt;
== Program and Data Module Structure ==&lt;br /&gt;
&lt;br /&gt;
There are 9 different types of modules in 4 possible languages:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
! colspan=&amp;quot;3&amp;quot; |Module Types&lt;br /&gt;
!&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; |Language&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Module Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Name&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Language&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|$1x&lt;br /&gt;
|Program Module&lt;br /&gt;
|Prgm&lt;br /&gt;
|&lt;br /&gt;
|$x0&lt;br /&gt;
|Data (non-executable)&lt;br /&gt;
|-&lt;br /&gt;
|$2x&lt;br /&gt;
|Subroutine Module&lt;br /&gt;
|Sbrtn&lt;br /&gt;
|&lt;br /&gt;
|$x1&lt;br /&gt;
|6809 Object Code&lt;br /&gt;
|-&lt;br /&gt;
|$3x&lt;br /&gt;
|Multi-module&lt;br /&gt;
|Multi&lt;br /&gt;
|&lt;br /&gt;
|$x2&lt;br /&gt;
|BASIC09 I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$4x&lt;br /&gt;
|Data Module&lt;br /&gt;
|Data&lt;br /&gt;
|&lt;br /&gt;
|$x3&lt;br /&gt;
|PASCAL I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$5x-$Bx&lt;br /&gt;
|User-definable module&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|$x4-$xF&lt;br /&gt;
|Reserved for Future Use&lt;br /&gt;
|-&lt;br /&gt;
|$Cx&lt;br /&gt;
|OS-9 System Module&lt;br /&gt;
|Systm&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Dx&lt;br /&gt;
|OS-9 File Manager Module&lt;br /&gt;
|FlMgr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Ex&lt;br /&gt;
|OS-9 Device Driver Module&lt;br /&gt;
|Drivr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Fx&lt;br /&gt;
|OS-9 Device Descriptor Module&lt;br /&gt;
|Devic&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
The two most used will be Program Modules and Data Modules.&lt;br /&gt;
&lt;br /&gt;
=== Program Modules ===&lt;br /&gt;
The format of a program module varies depending on whether you have a single source file for your program or multiple source files.  &lt;br /&gt;
&lt;br /&gt;
Note: multiple source files format cannot use direct page addressing due to the way they are compiled.&lt;br /&gt;
&lt;br /&gt;
==== Single Source File Format ====&lt;br /&gt;
The following is a skeleton for a single source file memory module (program).&lt;br /&gt;
 &amp;lt;code&amp;gt;********************************************************************&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* [Program Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* [Description]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* by [Author Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* Edt/Rev  YYYY/MM/DD  Modified by&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* Comment&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* ------------------------------------------------------------------&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               nam       [executablename]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               ttl       [Full Program Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;               ifp1&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               endc&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;tylg           set       Prgrm+Objct&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;rev            set       $00&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;edition        set       1&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;               &#039;&#039;&#039;mod       eom,name,tylg,atrv,start,size&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;        [Data Section - Variables and Data Structures Here]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;size           equ       .&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;name           fcs       /[executablename]/&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               fcb       edition&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;        [Program Section - Program Code Here]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;        &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               os9 F$Exit&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;               &#039;&#039;&#039;emod&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;eom            equ *&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               end&amp;lt;/code&amp;gt;&lt;br /&gt;
OS9 can load programs (modules) only if they are in module header format.  A module (program) is defined between the &#039;&#039;&#039;mod&#039;&#039;&#039; and &#039;&#039;&#039;emod&#039;&#039;&#039; pseudo instructions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;mod:&#039;&#039;&#039; Creates the module header and starts CRC check. &#039;&#039;&#039;mod&#039;&#039;&#039; has 6 attributes:&lt;br /&gt;
&lt;br /&gt;
# Module size (computed from the &#039;&#039;eom&#039;&#039; label at the end of the code - 2 bytes)&lt;br /&gt;
# Module name offset (offset where the string of the name is contained, here that is defined at the name label with the &#039;&#039;fcs&#039;&#039; pseudo instruction - 2 bytes&lt;br /&gt;
# Module type &amp;amp; language (in this case a Program in 6809 object code - 1 byte)&lt;br /&gt;
# Module attribute-revision (1 byte).  Attributes are reentrant (ReEnt) or not reentrant  (0).  Revision is a number 0-15.  If two or more modules with the same name are in the module directory, then OS-9 only keeps the highest revision number module.&lt;br /&gt;
# Module execution offset (here that is defined with the start label - 2 bytes)&lt;br /&gt;
# Module variable storage size (defined by the &#039;&#039;&amp;lt;u&amp;gt;size&amp;lt;/u&amp;gt;&#039;&#039; label immediately after the variable area, includes stack space - 2 bytes)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;emod&#039;&#039;&#039;: Outputs the correct 3 byte CRC.  This is generated by the assembler over the entire module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information about memory modules, see OS-9 Fundamentals:&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=YpoqTyrty8k OS-9 Fundamentals on YouTube by Boisy Pitre]&lt;br /&gt;
&lt;br /&gt;
==== Multiple Source File Format ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Data Modules ===&lt;br /&gt;
Here is a portion of the font module, which is a data module in NitrOS-9.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;               nam       font&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               ttl       F256 font&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;tylg           set       Data&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;rev            set       $01&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               mod       eom,name,tylg,atrv,start,0&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;name           fcs       /font/&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;L0000          fcb   $00,$00,$00,$00,$00,$00,$00,$00 &amp;lt;/code&amp;gt; &lt;br /&gt;
 &amp;lt;code&amp;gt;L0008          fcb   $7C,$82,$AA,$82,$BA,$92,$82,$7C &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*More data here&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               emod&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;eom            equ       *&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Writing Position Independent Code ==&lt;br /&gt;
All code in NitrOS-9 must be position independent.  Addresses are not known until a program module is loaded and executed.  All addressing must be &amp;quot;program counter relative addressing&amp;quot;.  All branch and long branch instructions are program counter relative. &lt;br /&gt;
&lt;br /&gt;
Rules: &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BRA&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBRA&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JMP&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BSR&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBSR&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JSR&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use program counter relative indexed addressing for all load, store, arithmetic and logical instructions. &lt;br /&gt;
&lt;br /&gt;
== Accessing Variables and Data Structures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Accessing Table Data with PCR ==&lt;br /&gt;
__FORCETOC__&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=470</id>
		<title>OS-9 Assembly Code Development</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=470"/>
		<updated>2024-09-30T02:53:57Z</updated>

		<summary type="html">&lt;p&gt;Jfed: Added intro sentence.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
Each process in NitrOS-9 is allocated its own 64K address space.  When run, the program object code is loaded into the end of the memory space, and the variables and data structures are loaded into the beginning.  In addition, NitrOS-9 keeps an separate per-process MMU table (DAT Image), so you must use &amp;lt;code&amp;gt;F$MapBlk&amp;lt;/code&amp;gt; to map and &amp;lt;code&amp;gt;F$ClrBlk&amp;lt;/code&amp;gt; to unmap 8K blocks in your process&#039; address space. The operating system has its own 64K address space as well.  &lt;br /&gt;
&lt;br /&gt;
When a new process is created, registers U, Y, DP and SP are set with U = start of data area, Y = end of data area, DP = page # of beginning page, SP = end of data area + 1.   Each process includes its own execution and data directories, along with &amp;lt;code&amp;gt;std in&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;std out&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;std err&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Memory and DAT Image ===&lt;br /&gt;
&amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; output the current status of the memory in the system. &amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; shows which memory blocks are currently in use.  &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; shows the blocks that are mapped in the DAT Image for a particular process.&lt;br /&gt;
[[File:Mmappmap.png|none|thumb]]&lt;br /&gt;
&lt;br /&gt;
== Program and Data Module Structure ==&lt;br /&gt;
&lt;br /&gt;
There are 9 different types of modules in 4 possible languages:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
! colspan=&amp;quot;3&amp;quot; |Module Types&lt;br /&gt;
!&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; |Language&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Module Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Name&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Language&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|$1x&lt;br /&gt;
|Program Module&lt;br /&gt;
|Prgm&lt;br /&gt;
|&lt;br /&gt;
|$x0&lt;br /&gt;
|Data (non-executable)&lt;br /&gt;
|-&lt;br /&gt;
|$2x&lt;br /&gt;
|Subroutine Module&lt;br /&gt;
|Sbrtn&lt;br /&gt;
|&lt;br /&gt;
|$x1&lt;br /&gt;
|6809 Object Code&lt;br /&gt;
|-&lt;br /&gt;
|$3x&lt;br /&gt;
|Multi-module&lt;br /&gt;
|Multi&lt;br /&gt;
|&lt;br /&gt;
|$x2&lt;br /&gt;
|BASIC09 I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$4x&lt;br /&gt;
|Data Module&lt;br /&gt;
|Data&lt;br /&gt;
|&lt;br /&gt;
|$x3&lt;br /&gt;
|PASCAL I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$5x-$Bx&lt;br /&gt;
|User-definable module&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|$x4-$xF&lt;br /&gt;
|Reserved for Future Use&lt;br /&gt;
|-&lt;br /&gt;
|$Cx&lt;br /&gt;
|OS-9 System Module&lt;br /&gt;
|Systm&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Dx&lt;br /&gt;
|OS-9 File Manager Module&lt;br /&gt;
|FlMgr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Ex&lt;br /&gt;
|OS-9 Device Driver Module&lt;br /&gt;
|Drivr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Fx&lt;br /&gt;
|OS-9 Device Descriptor Module&lt;br /&gt;
|Devic&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
The two most used will be Program Modules and Data Modules.&lt;br /&gt;
&lt;br /&gt;
=== Program Modules ===&lt;br /&gt;
The format of the program module varies depending on whether you have a single source file for your program or multiple source files.  &lt;br /&gt;
&lt;br /&gt;
Note: multiple source files format cannot use direct page addressing due to the way they are compiled.&lt;br /&gt;
&lt;br /&gt;
==== Single Source File Format ====&lt;br /&gt;
The following is a skeleton for a single source file memory module (program).&lt;br /&gt;
 &amp;lt;code&amp;gt;********************************************************************&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* [Program Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* [Description]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* by [Author Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* Edt/Rev  YYYY/MM/DD  Modified by&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* Comment&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* ------------------------------------------------------------------&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               nam       [executablename]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               ttl       [Full Program Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;               ifp1&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               endc&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;tylg           set       Prgrm+Objct&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;rev            set       $00&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;edition        set       1&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;               &#039;&#039;&#039;mod       eom,name,tylg,atrv,start,size&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;        [Data Section - Variables and Data Structures Here]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;size           equ       .&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;name           fcs       /[executablename]/&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               fcb       edition&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;        [Program Section - Program Code Here]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;        &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               os9 F$Exit&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;               &#039;&#039;&#039;emod&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;eom            equ *&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               end&amp;lt;/code&amp;gt;&lt;br /&gt;
OS9 can load programs (modules) only if they are in module header format.  A module (program) is defined between the &#039;&#039;&#039;mod&#039;&#039;&#039; and &#039;&#039;&#039;emod&#039;&#039;&#039; pseudo instructions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;mod:&#039;&#039;&#039; Creates the module header and starts CRC check. &#039;&#039;&#039;mod&#039;&#039;&#039; has 6 attributes:&lt;br /&gt;
&lt;br /&gt;
# Module size (computed from the &#039;&#039;eom&#039;&#039; label at the end of the code - 2 bytes)&lt;br /&gt;
# Module name offset (offset where the string of the name is contained, here that is defined at the name label with the &#039;&#039;fcs&#039;&#039; pseudo instruction - 2 bytes&lt;br /&gt;
# Module type &amp;amp; language (in this case a Program in 6809 object code - 1 byte)&lt;br /&gt;
# Module attribute-revision (1 byte).  Attributes are reentrant (ReEnt) or not reentrant  (0).  Revision is a number 0-15.  If two or more modules with the same name are in the module directory, then OS-9 only keeps the highest revision number module.&lt;br /&gt;
# Module execution offset (here that is defined with the start label - 2 bytes)&lt;br /&gt;
# Module variable storage size (defined by the &#039;&#039;&amp;lt;u&amp;gt;size&amp;lt;/u&amp;gt;&#039;&#039; label immediately after the variable area, includes stack space - 2 bytes)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;emod&#039;&#039;&#039;: Outputs the correct 3 byte CRC.  This is generated by the assembler over the entire module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information about memory modules, see OS-9 Fundamentals:&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=YpoqTyrty8k OS-9 Fundamentals on YouTube by Boisy Pitre]&lt;br /&gt;
&lt;br /&gt;
==== Multiple Source File Format ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Data Modules ===&lt;br /&gt;
Here is a portion of the font module, which is a data module in NitrOS-9.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;               nam       font&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               ttl       F256 font&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;tylg           set       Data&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;rev            set       $01&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               mod       eom,name,tylg,atrv,start,0&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;name           fcs       /font/&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;L0000          fcb   $00,$00,$00,$00,$00,$00,$00,$00 &amp;lt;/code&amp;gt; &lt;br /&gt;
 &amp;lt;code&amp;gt;L0008          fcb   $7C,$82,$AA,$82,$BA,$92,$82,$7C &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*More data here&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               emod&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;eom            equ       *&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Writing Position Independent Code ==&lt;br /&gt;
All code in NitrOS-9 must be position independent.  Addresses are not known until a program module is loaded and executed.  All addressing must be &amp;quot;program counter relative addressing&amp;quot;.  All branch and long branch instructions are program counter relative. &lt;br /&gt;
&lt;br /&gt;
Rules: &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BRA&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBRA&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JMP&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BSR&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBSR&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JSR&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use program counter relative indexed addressing for all load, store, arithmetic and logical instructions. &lt;br /&gt;
&lt;br /&gt;
== Accessing Variables and Data Structures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Accessing Table Data with PCR ==&lt;br /&gt;
__FORCETOC__&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=469</id>
		<title>OS-9 Assembly Code Development</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=469"/>
		<updated>2024-09-30T02:49:22Z</updated>

		<summary type="html">&lt;p&gt;Jfed: Added information about assembly pseudo instructions.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
Each process in NitrOS-9 is allocated its own 64K address space.  When run, the program object code is loaded into the end of the memory space, and the variables and data structures are loaded into the beginning.  In addition, NitrOS-9 keeps an separate per-process MMU table (DAT Image), so you must use &amp;lt;code&amp;gt;F$MapBlk&amp;lt;/code&amp;gt; to map and &amp;lt;code&amp;gt;F$ClrBlk&amp;lt;/code&amp;gt; to unmap 8K blocks in your process&#039; address space. The operating system has its own 64K address space as well.  &lt;br /&gt;
&lt;br /&gt;
When a new process is created, registers U, Y, DP and SP are set with U = start of data area, Y = end of data area, DP = page # of beginning page, SP = end of data area + 1.   Each process includes its own execution and data directories, along with &amp;lt;code&amp;gt;std in&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;std out&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;std err&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Memory and DAT Image ===&lt;br /&gt;
&amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; output the current status of the memory in the system. &amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; shows which memory blocks are currently in use.  &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; shows the blocks that are mapped in the DAT Image for a particular process.&lt;br /&gt;
[[File:Mmappmap.png|none|thumb]]&lt;br /&gt;
&lt;br /&gt;
== Program and Data Module Structure ==&lt;br /&gt;
&lt;br /&gt;
There are 9 different types of modules in 4 possible languages:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
! colspan=&amp;quot;3&amp;quot; |Module Types&lt;br /&gt;
!&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; |Language&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Module Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Name&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Language&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|$1x&lt;br /&gt;
|Program Module&lt;br /&gt;
|Prgm&lt;br /&gt;
|&lt;br /&gt;
|$x0&lt;br /&gt;
|Data (non-executable)&lt;br /&gt;
|-&lt;br /&gt;
|$2x&lt;br /&gt;
|Subroutine Module&lt;br /&gt;
|Sbrtn&lt;br /&gt;
|&lt;br /&gt;
|$x1&lt;br /&gt;
|6809 Object Code&lt;br /&gt;
|-&lt;br /&gt;
|$3x&lt;br /&gt;
|Multi-module&lt;br /&gt;
|Multi&lt;br /&gt;
|&lt;br /&gt;
|$x2&lt;br /&gt;
|BASIC09 I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$4x&lt;br /&gt;
|Data Module&lt;br /&gt;
|Data&lt;br /&gt;
|&lt;br /&gt;
|$x3&lt;br /&gt;
|PASCAL I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$5x-$Bx&lt;br /&gt;
|User-definable module&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|$x4-$xF&lt;br /&gt;
|Reserved for Future Use&lt;br /&gt;
|-&lt;br /&gt;
|$Cx&lt;br /&gt;
|OS-9 System Module&lt;br /&gt;
|Systm&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Dx&lt;br /&gt;
|OS-9 File Manager Module&lt;br /&gt;
|FlMgr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Ex&lt;br /&gt;
|OS-9 Device Driver Module&lt;br /&gt;
|Drivr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Fx&lt;br /&gt;
|OS-9 Device Descriptor Module&lt;br /&gt;
|Devic&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
The two most used will be Program Modules and Data Modules.&lt;br /&gt;
&lt;br /&gt;
=== Program Modules ===&lt;br /&gt;
The format of the program module varies depending on whether you have a single source file for your program or multiple source files.  &lt;br /&gt;
&lt;br /&gt;
Note: multiple source files format cannot use direct page addressing due to the way they are compiled.&lt;br /&gt;
&lt;br /&gt;
==== Single Source File Format ====&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;********************************************************************&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* [Program Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* [Description]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* by [Author Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* Edt/Rev  YYYY/MM/DD  Modified by&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* Comment&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* ------------------------------------------------------------------&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               nam       [executablename]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               ttl       [Full Program Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;               ifp1&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               endc&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;tylg           set       Prgrm+Objct&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;rev            set       $00&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;edition        set       1&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;               &#039;&#039;&#039;mod       eom,name,tylg,atrv,start,size&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;        [Data Section - Variables Here]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;size           equ       .&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;name           fcs       /[executablename]/&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               fcb       edition&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;        [Program Section - Program Code Here]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;        &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               os9 F$Exit&amp;lt;/code&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;code&amp;gt;               &#039;&#039;&#039;emod&#039;&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;eom            equ *&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               end&amp;lt;/code&amp;gt;&lt;br /&gt;
OS9 can load programs (modules) only if they are in module header format.  A module (program) is defined between the &#039;&#039;&#039;mod&#039;&#039;&#039; and &#039;&#039;&#039;emod&#039;&#039;&#039; pseudo instructions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;mod:&#039;&#039;&#039; Creates the module header and starts CRC check. &#039;&#039;&#039;mod&#039;&#039;&#039; has 6 attributes:&lt;br /&gt;
&lt;br /&gt;
# Module size (computed from the &#039;&#039;eom&#039;&#039; label at the end of the code - 2 bytes)&lt;br /&gt;
# Module name offset (offset where the string of the name is contained, here that is defined at the name label with the &#039;&#039;fcs&#039;&#039; pseudo instruction - 2 bytes&lt;br /&gt;
# Module type &amp;amp; language (in this case a Program in 6809 object code - 1 byte)&lt;br /&gt;
# Module attribute-revision (1 byte).  Attributes are reentrant (ReEnt) or not reentrant  (0).  Revision is a number 0-15.  If two or more modules with the same name are in the module directory, then OS-9 only keeps the highest revision number module.&lt;br /&gt;
# Module execution offset (here that is defined with the start label - 2 bytes)&lt;br /&gt;
# Module variable storage size (defined by the &#039;&#039;&amp;lt;u&amp;gt;size&amp;lt;/u&amp;gt;&#039;&#039; label immediately after the variable area, includes stack space - 2 bytes)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;emod&#039;&#039;&#039;: Outputs the correct 3 byte CRC.  This is generated by the assembler over the entire module.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information about memory modules, see OS-9 Fundamentals:&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=YpoqTyrty8k OS-9 Fundamentals on YouTube by Boisy Pitre]&lt;br /&gt;
&lt;br /&gt;
==== Multiple Source File Format ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Data Modules ===&lt;br /&gt;
Here is a portion of the font module, which is a data module in NitrOS-9.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;               nam       font&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               ttl       F256 font&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;tylg           set       Data&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;rev            set       $01&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               mod       eom,name,tylg,atrv,start,0&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;name           fcs       /font/&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;L0000          fcb   $00,$00,$00,$00,$00,$00,$00,$00 &amp;lt;/code&amp;gt; &lt;br /&gt;
 &amp;lt;code&amp;gt;L0008          fcb   $7C,$82,$AA,$82,$BA,$92,$82,$7C &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*More data here&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               emod&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;eom            equ       *&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Writing Position Independent Code ==&lt;br /&gt;
All code in NitrOS-9 must be position independent.  Addresses are not known until a program module is loaded and executed.  All addressing must be &amp;quot;program counter relative addressing&amp;quot;.  All branch and long branch instructions are program counter relative. &lt;br /&gt;
&lt;br /&gt;
Rules: &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BRA&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBRA&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JMP&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BSR&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBSR&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JSR&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use program counter relative indexed addressing for all load, store, arithmetic and logical instructions. &lt;br /&gt;
&lt;br /&gt;
== Accessing Variables and Data Structures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Accessing Table Data with PCR ==&lt;br /&gt;
__FORCETOC__&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=468</id>
		<title>OS-9 Assembly Code Development</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=468"/>
		<updated>2024-09-29T21:55:30Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Data Modules */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
Each process in NitrOS-9 is allocated its own 64K address space.  When run, the program object code is loaded into the end of the memory space, and the variables and data structures are loaded into the beginning.  In addition, NitrOS-9 keeps an separate per-process MMU table (DAT Image), so you must use &amp;lt;code&amp;gt;F$MapBlk&amp;lt;/code&amp;gt; to map and &amp;lt;code&amp;gt;F$ClrBlk&amp;lt;/code&amp;gt; to unmap 8K blocks in your process&#039; address space. The operating system has its own 64K address space as well.  &lt;br /&gt;
&lt;br /&gt;
When a new process is created, registers U, Y, DP and SP are set with U = start of data area, Y = end of data area, DP = page # of beginning page, SP = end of data area + 1.   Each process includes its own execution and data directories, along with &amp;lt;code&amp;gt;std in&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;std out&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;std err&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Memory and DAT Image ===&lt;br /&gt;
&amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; output the current status of the memory in the system. &amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; shows which memory blocks are currently in use.  &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; shows the blocks that are mapped in the DAT Image for a particular process.&lt;br /&gt;
[[File:Mmappmap.png|none|thumb]]&lt;br /&gt;
&lt;br /&gt;
== Program and Data Module Structure ==&lt;br /&gt;
&lt;br /&gt;
There are 9 different types of modules in 4 possible languages:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
! colspan=&amp;quot;3&amp;quot; |Module Types&lt;br /&gt;
!&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; |Language&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Module Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Name&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Language&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|$1x&lt;br /&gt;
|Program Module&lt;br /&gt;
|Prgm&lt;br /&gt;
|&lt;br /&gt;
|$x0&lt;br /&gt;
|Data (non-executable)&lt;br /&gt;
|-&lt;br /&gt;
|$2x&lt;br /&gt;
|Subroutine Module&lt;br /&gt;
|Sbrtn&lt;br /&gt;
|&lt;br /&gt;
|$x1&lt;br /&gt;
|6809 Object Code&lt;br /&gt;
|-&lt;br /&gt;
|$3x&lt;br /&gt;
|Multi-module&lt;br /&gt;
|Multi&lt;br /&gt;
|&lt;br /&gt;
|$x2&lt;br /&gt;
|BASIC09 I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$4x&lt;br /&gt;
|Data Module&lt;br /&gt;
|Data&lt;br /&gt;
|&lt;br /&gt;
|$x3&lt;br /&gt;
|PASCAL I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$5x-$Bx&lt;br /&gt;
|User-definable module&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|$x4-$xF&lt;br /&gt;
|Reserved for Future Use&lt;br /&gt;
|-&lt;br /&gt;
|$Cx&lt;br /&gt;
|OS-9 System Module&lt;br /&gt;
|Systm&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Dx&lt;br /&gt;
|OS-9 File Manager Module&lt;br /&gt;
|FlMgr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Ex&lt;br /&gt;
|OS-9 Device Driver Module&lt;br /&gt;
|Drivr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Fx&lt;br /&gt;
|OS-9 Device Descriptor Module&lt;br /&gt;
|Devic&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
The two most used will be Program Modules and Data Modules.&lt;br /&gt;
&lt;br /&gt;
=== Program Modules ===&lt;br /&gt;
The format of the program module varies depending on whether you have a single source file for your program or multiple source files.  &lt;br /&gt;
&lt;br /&gt;
Note: multiple source files format cannot use direct page addressing due to the way they are compiled.&lt;br /&gt;
&lt;br /&gt;
==== Single Source File Format ====&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;********************************************************************&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* [Program Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* [Description]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* by [Author Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* Edt/Rev  YYYY/MM/DD  Modified by&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* Comment&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* ------------------------------------------------------------------&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               nam       [executablename]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               ttl       [Full Program Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               ifp1&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               endc&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;tylg           set       Prgrm+Objct&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;rev            set       $00&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;edition        set       1&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               mod       eom,name,tylg,atrv,start,size&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;        [Variables Here]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;size           equ       .&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;name           fcs       /executablename/&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               fcb       edition&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;        [Program Code Here]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;        &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               os9 F$Exit&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               emod&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;eom            equ *&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Multiple Source File Format ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Data Modules ===&lt;br /&gt;
Here is a portion of the font module, which is a data module in NitrOS-9.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;               nam       font&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               ttl       F256 font&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;tylg           set       Data&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;rev            set       $01&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               mod       eom,name,tylg,atrv,start,0&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;name           fcs       /font/&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;L0000          fcb   $00,$00,$00,$00,$00,$00,$00,$00 &amp;lt;/code&amp;gt; &lt;br /&gt;
 &amp;lt;code&amp;gt;L0008          fcb   $7C,$82,$AA,$82,$BA,$92,$82,$7C &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*More data here&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               emod&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;eom            equ       *&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Writing Position Independent Code ==&lt;br /&gt;
All code in NitrOS-9 must be position independent.  Addresses are not known until a program module is loaded and executed.  All addressing must be &amp;quot;program counter relative addressing&amp;quot;.  All branch and long branch instructions are program counter relative. &lt;br /&gt;
&lt;br /&gt;
Rules: &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BRA&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBRA&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JMP&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BSR&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBSR&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JSR&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use program counter relative indexed addressing for all load, store, arithmetic and logical instructions. &lt;br /&gt;
&lt;br /&gt;
== Accessing Variables and Data Structures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Accessing Table Data with PCR ==&lt;br /&gt;
__FORCETOC__&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=467</id>
		<title>OS-9 Assembly Code Development</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=467"/>
		<updated>2024-09-29T21:51:34Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Single Source File Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
Each process in NitrOS-9 is allocated its own 64K address space.  When run, the program object code is loaded into the end of the memory space, and the variables and data structures are loaded into the beginning.  In addition, NitrOS-9 keeps an separate per-process MMU table (DAT Image), so you must use &amp;lt;code&amp;gt;F$MapBlk&amp;lt;/code&amp;gt; to map and &amp;lt;code&amp;gt;F$ClrBlk&amp;lt;/code&amp;gt; to unmap 8K blocks in your process&#039; address space. The operating system has its own 64K address space as well.  &lt;br /&gt;
&lt;br /&gt;
When a new process is created, registers U, Y, DP and SP are set with U = start of data area, Y = end of data area, DP = page # of beginning page, SP = end of data area + 1.   Each process includes its own execution and data directories, along with &amp;lt;code&amp;gt;std in&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;std out&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;std err&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Memory and DAT Image ===&lt;br /&gt;
&amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; output the current status of the memory in the system. &amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; shows which memory blocks are currently in use.  &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; shows the blocks that are mapped in the DAT Image for a particular process.&lt;br /&gt;
[[File:Mmappmap.png|none|thumb]]&lt;br /&gt;
&lt;br /&gt;
== Program and Data Module Structure ==&lt;br /&gt;
&lt;br /&gt;
There are 9 different types of modules in 4 possible languages:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
! colspan=&amp;quot;3&amp;quot; |Module Types&lt;br /&gt;
!&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; |Language&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Module Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Name&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Language&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|$1x&lt;br /&gt;
|Program Module&lt;br /&gt;
|Prgm&lt;br /&gt;
|&lt;br /&gt;
|$x0&lt;br /&gt;
|Data (non-executable)&lt;br /&gt;
|-&lt;br /&gt;
|$2x&lt;br /&gt;
|Subroutine Module&lt;br /&gt;
|Sbrtn&lt;br /&gt;
|&lt;br /&gt;
|$x1&lt;br /&gt;
|6809 Object Code&lt;br /&gt;
|-&lt;br /&gt;
|$3x&lt;br /&gt;
|Multi-module&lt;br /&gt;
|Multi&lt;br /&gt;
|&lt;br /&gt;
|$x2&lt;br /&gt;
|BASIC09 I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$4x&lt;br /&gt;
|Data Module&lt;br /&gt;
|Data&lt;br /&gt;
|&lt;br /&gt;
|$x3&lt;br /&gt;
|PASCAL I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$5x-$Bx&lt;br /&gt;
|User-definable module&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|$x4-$xF&lt;br /&gt;
|Reserved for Future Use&lt;br /&gt;
|-&lt;br /&gt;
|$Cx&lt;br /&gt;
|OS-9 System Module&lt;br /&gt;
|Systm&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Dx&lt;br /&gt;
|OS-9 File Manager Module&lt;br /&gt;
|FlMgr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Ex&lt;br /&gt;
|OS-9 Device Driver Module&lt;br /&gt;
|Drivr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Fx&lt;br /&gt;
|OS-9 Device Descriptor Module&lt;br /&gt;
|Devic&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
The two most used will be Program Modules and Data Modules.&lt;br /&gt;
&lt;br /&gt;
=== Program Modules ===&lt;br /&gt;
The format of the program module varies depending on whether you have a single source file for your program or multiple source files.  &lt;br /&gt;
&lt;br /&gt;
Note: multiple source files format cannot use direct page addressing due to the way they are compiled.&lt;br /&gt;
&lt;br /&gt;
==== Single Source File Format ====&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;********************************************************************&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* [Program Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* [Description]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* by [Author Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* Edt/Rev  YYYY/MM/DD  Modified by&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* Comment&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* ------------------------------------------------------------------&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               nam       [executablename]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               ttl       [Full Program Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               ifp1&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               endc&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;tylg           set       Prgrm+Objct&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;rev            set       $00&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;edition        set       1&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               mod       eom,name,tylg,atrv,start,size&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;        [Variables Here]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;size           equ       .&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;name           fcs       /executablename/&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               fcb       edition&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;        [Program Code Here]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;        &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               os9 F$Exit&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               emod&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;eom            equ *&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Multiple Source File Format ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Data Modules ===&lt;br /&gt;
Here is a portion of the font module, which is a data module in NitrOS-9.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               nam       font&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               ttl       F256 font&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tylg           set       Data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;rev            set       $01&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               mod       eom,name,tylg,atrv,start,0&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;name           fcs       /font/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;L0000          fcb   $00,$00,$00,$00,$00,$00,$00,$00 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;L0008          fcb   $7C,$82,$AA,$82,$BA,$92,$82,$7C &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;More data here&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               emod&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;eom            equ       *&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;
== Writing Position Independent Code ==&lt;br /&gt;
All code in NitrOS-9 must be position independent.  Addresses are not known until a program module is loaded and executed.  All addressing must be &amp;quot;program counter relative addressing&amp;quot;.  All branch and long branch instructions are program counter relative. &lt;br /&gt;
&lt;br /&gt;
Rules: &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BRA&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBRA&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JMP&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BSR&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBSR&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JSR&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use program counter relative indexed addressing for all load, store, arithmetic and logical instructions. &lt;br /&gt;
&lt;br /&gt;
== Accessing Variables and Data Structures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Accessing Table Data with PCR ==&lt;br /&gt;
__FORCETOC__&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=466</id>
		<title>OS-9 Assembly Code Development</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=466"/>
		<updated>2024-09-29T21:50:34Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Single Source File Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
Each process in NitrOS-9 is allocated its own 64K address space.  When run, the program object code is loaded into the end of the memory space, and the variables and data structures are loaded into the beginning.  In addition, NitrOS-9 keeps an separate per-process MMU table (DAT Image), so you must use &amp;lt;code&amp;gt;F$MapBlk&amp;lt;/code&amp;gt; to map and &amp;lt;code&amp;gt;F$ClrBlk&amp;lt;/code&amp;gt; to unmap 8K blocks in your process&#039; address space. The operating system has its own 64K address space as well.  &lt;br /&gt;
&lt;br /&gt;
When a new process is created, registers U, Y, DP and SP are set with U = start of data area, Y = end of data area, DP = page # of beginning page, SP = end of data area + 1.   Each process includes its own execution and data directories, along with &amp;lt;code&amp;gt;std in&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;std out&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;std err&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Memory and DAT Image ===&lt;br /&gt;
&amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; output the current status of the memory in the system. &amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; shows which memory blocks are currently in use.  &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; shows the blocks that are mapped in the DAT Image for a particular process.&lt;br /&gt;
[[File:Mmappmap.png|none|thumb]]&lt;br /&gt;
&lt;br /&gt;
== Program and Data Module Structure ==&lt;br /&gt;
&lt;br /&gt;
There are 9 different types of modules in 4 possible languages:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
! colspan=&amp;quot;3&amp;quot; |Module Types&lt;br /&gt;
!&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; |Language&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Module Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Name&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Language&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|$1x&lt;br /&gt;
|Program Module&lt;br /&gt;
|Prgm&lt;br /&gt;
|&lt;br /&gt;
|$x0&lt;br /&gt;
|Data (non-executable)&lt;br /&gt;
|-&lt;br /&gt;
|$2x&lt;br /&gt;
|Subroutine Module&lt;br /&gt;
|Sbrtn&lt;br /&gt;
|&lt;br /&gt;
|$x1&lt;br /&gt;
|6809 Object Code&lt;br /&gt;
|-&lt;br /&gt;
|$3x&lt;br /&gt;
|Multi-module&lt;br /&gt;
|Multi&lt;br /&gt;
|&lt;br /&gt;
|$x2&lt;br /&gt;
|BASIC09 I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$4x&lt;br /&gt;
|Data Module&lt;br /&gt;
|Data&lt;br /&gt;
|&lt;br /&gt;
|$x3&lt;br /&gt;
|PASCAL I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$5x-$Bx&lt;br /&gt;
|User-definable module&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|$x4-$xF&lt;br /&gt;
|Reserved for Future Use&lt;br /&gt;
|-&lt;br /&gt;
|$Cx&lt;br /&gt;
|OS-9 System Module&lt;br /&gt;
|Systm&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Dx&lt;br /&gt;
|OS-9 File Manager Module&lt;br /&gt;
|FlMgr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Ex&lt;br /&gt;
|OS-9 Device Driver Module&lt;br /&gt;
|Drivr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Fx&lt;br /&gt;
|OS-9 Device Descriptor Module&lt;br /&gt;
|Devic&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
The two most used will be Program Modules and Data Modules.&lt;br /&gt;
&lt;br /&gt;
=== Program Modules ===&lt;br /&gt;
The format of the program module varies depending on whether you have a single source file for your program or multiple source files.  &lt;br /&gt;
&lt;br /&gt;
Note: multiple source files format cannot use direct page addressing due to the way they are compiled.&lt;br /&gt;
&lt;br /&gt;
==== Single Source File Format ====&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;code&amp;gt;********************************************************************&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* [Program Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* [Description]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* by [Author Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* Edt/Rev  YYYY/MM/DD  Modified by&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* Comment&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;* ------------------------------------------------------------------&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               nam       [executablename]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               ttl       [Full Program Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               ifp1&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               endc&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;tylg           set       Prgrm+Objct&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;rev            set       $00&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;edition        set       1&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               mod       eom,name,tylg,atrv,start,size&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;        [Variables go here]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;size           equ       .&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;name           fcs       /executablename/&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               fcb       edition&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;        [Program Code Here]&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;        &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               os9 F$Exit&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               emod&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;eom            equ *&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code&amp;gt;               end&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Multiple Source File Format ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Data Modules ===&lt;br /&gt;
Here is a portion of the font module, which is a data module in NitrOS-9.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               nam       font&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               ttl       F256 font&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tylg           set       Data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;rev            set       $01&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               mod       eom,name,tylg,atrv,start,0&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;name           fcs       /font/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;L0000          fcb   $00,$00,$00,$00,$00,$00,$00,$00 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;L0008          fcb   $7C,$82,$AA,$82,$BA,$92,$82,$7C &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;More data here&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               emod&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;eom            equ       *&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;
== Writing Position Independent Code ==&lt;br /&gt;
All code in NitrOS-9 must be position independent.  Addresses are not known until a program module is loaded and executed.  All addressing must be &amp;quot;program counter relative addressing&amp;quot;.  All branch and long branch instructions are program counter relative. &lt;br /&gt;
&lt;br /&gt;
Rules: &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BRA&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBRA&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JMP&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BSR&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBSR&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JSR&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use program counter relative indexed addressing for all load, store, arithmetic and logical instructions. &lt;br /&gt;
&lt;br /&gt;
== Accessing Variables and Data Structures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Accessing Table Data with PCR ==&lt;br /&gt;
__FORCETOC__&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=465</id>
		<title>OS-9 Assembly Code Development</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=465"/>
		<updated>2024-09-29T21:41:45Z</updated>

		<summary type="html">&lt;p&gt;Jfed: formatting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
Each process in NitrOS-9 is allocated its own 64K address space.  When run, the program object code is loaded into the end of the memory space, and the variables and data structures are loaded into the beginning.  In addition, NitrOS-9 keeps an separate per-process MMU table (DAT Image), so you must use &amp;lt;code&amp;gt;F$MapBlk&amp;lt;/code&amp;gt; to map and &amp;lt;code&amp;gt;F$ClrBlk&amp;lt;/code&amp;gt; to unmap 8K blocks in your process&#039; address space. The operating system has its own 64K address space as well.  &lt;br /&gt;
&lt;br /&gt;
When a new process is created, registers U, Y, DP and SP are set with U = start of data area, Y = end of data area, DP = page # of beginning page, SP = end of data area + 1.   Each process includes its own execution and data directories, along with &amp;lt;code&amp;gt;std in&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;std out&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;std err&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Memory and DAT Image ===&lt;br /&gt;
&amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; output the current status of the memory in the system. &amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; shows which memory blocks are currently in use.  &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; shows the blocks that are mapped in the DAT Image for a particular process.&lt;br /&gt;
[[File:Mmappmap.png|none|thumb]]&lt;br /&gt;
&lt;br /&gt;
== Program and Data Module Structure ==&lt;br /&gt;
&lt;br /&gt;
There are 9 different types of modules in 4 possible languages:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
! colspan=&amp;quot;3&amp;quot; |Module Types&lt;br /&gt;
!&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; |Language&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Module Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Name&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Language&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|$1x&lt;br /&gt;
|Program Module&lt;br /&gt;
|Prgm&lt;br /&gt;
|&lt;br /&gt;
|$x0&lt;br /&gt;
|Data (non-executable)&lt;br /&gt;
|-&lt;br /&gt;
|$2x&lt;br /&gt;
|Subroutine Module&lt;br /&gt;
|Sbrtn&lt;br /&gt;
|&lt;br /&gt;
|$x1&lt;br /&gt;
|6809 Object Code&lt;br /&gt;
|-&lt;br /&gt;
|$3x&lt;br /&gt;
|Multi-module&lt;br /&gt;
|Multi&lt;br /&gt;
|&lt;br /&gt;
|$x2&lt;br /&gt;
|BASIC09 I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$4x&lt;br /&gt;
|Data Module&lt;br /&gt;
|Data&lt;br /&gt;
|&lt;br /&gt;
|$x3&lt;br /&gt;
|PASCAL I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$5x-$Bx&lt;br /&gt;
|User-definable module&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|$x4-$xF&lt;br /&gt;
|Reserved for Future Use&lt;br /&gt;
|-&lt;br /&gt;
|$Cx&lt;br /&gt;
|OS-9 System Module&lt;br /&gt;
|Systm&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Dx&lt;br /&gt;
|OS-9 File Manager Module&lt;br /&gt;
|FlMgr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Ex&lt;br /&gt;
|OS-9 Device Driver Module&lt;br /&gt;
|Drivr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Fx&lt;br /&gt;
|OS-9 Device Descriptor Module&lt;br /&gt;
|Devic&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
The two most used will be Program Modules and Data Modules.&lt;br /&gt;
&lt;br /&gt;
=== Program Modules ===&lt;br /&gt;
The format of the program module varies depending on whether you have a single source file for your program or multiple source files.  &lt;br /&gt;
&lt;br /&gt;
Note: multiple source files format cannot use direct page addressing due to the way they are compiled.&lt;br /&gt;
&lt;br /&gt;
==== Single Source File Format ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;********************************************************************&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;* [Program Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;* [Description]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;* by [Author Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;* Edt/Rev  YYYY/MM/DD  Modified by&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;* Comment&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;* ------------------------------------------------------------------&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               nam       [executablename]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               ttl       [Full Program Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;               ifp1&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;               endc&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;tylg           set       Prgrm+Objct&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;rev            set       $00&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;edition        set       1&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;               mod       eom,name,tylg,atrv,start,size&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;[Variables go here]&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;size           equ       .&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;name           fcs       /executablename/&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;               fcb       edition&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;        [Program Code Here]&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;        &amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;               os9 F$Exit&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;               emod&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;eom            equ *&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;               end&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Multiple Source File Format ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Data Modules ===&lt;br /&gt;
Here is a portion of the font module, which is a data module in NitrOS-9.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               nam       font&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               ttl       F256 font&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tylg           set       Data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;rev            set       $01&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               mod       eom,name,tylg,atrv,start,0&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;name           fcs       /font/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;L0000          fcb   $00,$00,$00,$00,$00,$00,$00,$00 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;L0008          fcb   $7C,$82,$AA,$82,$BA,$92,$82,$7C &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;More data here&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               emod&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;eom            equ       *&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;
== Writing Position Independent Code ==&lt;br /&gt;
All code in NitrOS-9 must be position independent.  Addresses are not known until a program module is loaded and executed.  All addressing must be &amp;quot;program counter relative addressing&amp;quot;.  All branch and long branch instructions are program counter relative. &lt;br /&gt;
&lt;br /&gt;
Rules: &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BRA&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBRA&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JMP&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BSR&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBSR&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JSR&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use program counter relative indexed addressing for all load, store, arithmetic and logical instructions. &lt;br /&gt;
&lt;br /&gt;
== Accessing Variables and Data Structures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Accessing Table Data with PCR ==&lt;br /&gt;
__FORCETOC__&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=464</id>
		<title>OS-9 Assembly Code Development</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=464"/>
		<updated>2024-09-29T21:39:10Z</updated>

		<summary type="html">&lt;p&gt;Jfed: format source code&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
Each process in NitrOS-9 is allocated its own 64K address space.  When run, the program object code is loaded into the end of the memory space, and the variables and data structures are loaded into the beginning.  In addition, NitrOS-9 keeps an separate per-process MMU table (DAT Image), so you must use &amp;lt;code&amp;gt;F$MapBlk&amp;lt;/code&amp;gt; to map and &amp;lt;code&amp;gt;F$ClrBlk&amp;lt;/code&amp;gt; to unmap 8K blocks in your process&#039; address space. The operating system has its own 64K address space as well.  &lt;br /&gt;
&lt;br /&gt;
When a new process is created, registers U, Y, DP and SP are set with U = start of data area, Y = end of data area, DP = page # of beginning page, SP = end of data area + 1.   Each process includes its own execution and data directories, along with &amp;lt;code&amp;gt;std in&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;std out&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;std err&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Memory and DAT Image ===&lt;br /&gt;
&amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; output the current status of the memory in the system. &amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; shows which memory blocks are currently in use.  &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; shows the blocks that are mapped in the DAT Image for a particular process.&lt;br /&gt;
[[File:Mmappmap.png|none|thumb]]&lt;br /&gt;
&lt;br /&gt;
== Program and Data Module Structure ==&lt;br /&gt;
&lt;br /&gt;
There are 9 different types of modules in 4 possible languages:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
! colspan=&amp;quot;3&amp;quot; |Module Types&lt;br /&gt;
!&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; |Language&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Module Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Name&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Language&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|$1x&lt;br /&gt;
|Program Module&lt;br /&gt;
|Prgm&lt;br /&gt;
|&lt;br /&gt;
|$x0&lt;br /&gt;
|Data (non-executable)&lt;br /&gt;
|-&lt;br /&gt;
|$2x&lt;br /&gt;
|Subroutine Module&lt;br /&gt;
|Sbrtn&lt;br /&gt;
|&lt;br /&gt;
|$x1&lt;br /&gt;
|6809 Object Code&lt;br /&gt;
|-&lt;br /&gt;
|$3x&lt;br /&gt;
|Multi-module&lt;br /&gt;
|Multi&lt;br /&gt;
|&lt;br /&gt;
|$x2&lt;br /&gt;
|BASIC09 I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$4x&lt;br /&gt;
|Data Module&lt;br /&gt;
|Data&lt;br /&gt;
|&lt;br /&gt;
|$x3&lt;br /&gt;
|PASCAL I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$5x-$Bx&lt;br /&gt;
|User-definable module&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|$x4-$xF&lt;br /&gt;
|Reserved for Future Use&lt;br /&gt;
|-&lt;br /&gt;
|$Cx&lt;br /&gt;
|OS-9 System Module&lt;br /&gt;
|Systm&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Dx&lt;br /&gt;
|OS-9 File Manager Module&lt;br /&gt;
|FlMgr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Ex&lt;br /&gt;
|OS-9 Device Driver Module&lt;br /&gt;
|Drivr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Fx&lt;br /&gt;
|OS-9 Device Descriptor Module&lt;br /&gt;
|Devic&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
The two most used will be Program Modules and Data Modules.&lt;br /&gt;
&lt;br /&gt;
=== Program Modules ===&lt;br /&gt;
The format of the program module varies depending on whether you have a single source file for your program or multiple source files.  &lt;br /&gt;
&lt;br /&gt;
Note: multiple source files format cannot use direct page addressing due to the way they are compiled.&lt;br /&gt;
&lt;br /&gt;
==== Single Source File Format ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;********************************************************************&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;* [Program Name]&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;* [Description]&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;* by [Author Name]&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;*&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;* Edt/Rev  YYYY/MM/DD  Modified by&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;* Comment&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;* ------------------------------------------------------------------&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;nam       [executablename]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;               ttl       [Full Program Name]&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;               ifp1&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;               endc&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;tylg           set       Prgrm+Objct&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;rev            set       $00&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;edition        set       1&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;               mod       eom,name,tylg,atrv,start,size&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;[Variables go here]&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;size           equ       .&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;name           fcs       /executablename/&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;               fcb       edition&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;        [Program Code Here]&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;        &amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;               os9 F$Exit&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;               emod&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;eom            equ *&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;               end&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Multiple Source File Format ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Data Modules ===&lt;br /&gt;
Here is a portion of the font module, which is a data module in NitrOS-9.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               nam       font&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               ttl       F256 font&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tylg           set       Data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;rev            set       $01&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               mod       eom,name,tylg,atrv,start,0&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;name           fcs       /font/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;L0000          fcb   $00,$00,$00,$00,$00,$00,$00,$00 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;L0008          fcb   $7C,$82,$AA,$82,$BA,$92,$82,$7C &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;More data here&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               emod&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;eom            equ       *&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;
== Writing Position Independent Code ==&lt;br /&gt;
All code in NitrOS-9 must be position independent.  Addresses are not known until a program module is loaded and executed.  All addressing must be &amp;quot;program counter relative addressing&amp;quot;.  All branch and long branch instructions are program counter relative. &lt;br /&gt;
&lt;br /&gt;
Rules: &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BRA&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBRA&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JMP&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BSR&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBSR&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JSR&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use program counter relative indexed addressing for all load, store, arithmetic and logical instructions. &lt;br /&gt;
&lt;br /&gt;
== Accessing Variables and Data Structures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Accessing Table Data with PCR ==&lt;br /&gt;
__FORCETOC__&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=463</id>
		<title>OS-9 Assembly Code Development</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=463"/>
		<updated>2024-09-29T21:32:25Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Single Source File Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
Each process in NitrOS-9 is allocated its own 64K address space.  When run, the program object code is loaded into the end of the memory space, and the variables and data structures are loaded into the beginning.  In addition, NitrOS-9 keeps an separate per-process MMU table (DAT Image), so you must use &amp;lt;code&amp;gt;F$MapBlk&amp;lt;/code&amp;gt; to map and &amp;lt;code&amp;gt;F$ClrBlk&amp;lt;/code&amp;gt; to unmap 8K blocks in your process&#039; address space. The operating system has its own 64K address space as well.  &lt;br /&gt;
&lt;br /&gt;
When a new process is created, registers U, Y, DP and SP are set with U = start of data area, Y = end of data area, DP = page # of beginning page, SP = end of data area + 1.   Each process includes its own execution and data directories, along with &amp;lt;code&amp;gt;std in&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;std out&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;std err&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Memory and DAT Image ===&lt;br /&gt;
&amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; output the current status of the memory in the system. &amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; shows which memory blocks are currently in use.  &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; shows the blocks that are mapped in the DAT Image for a particular process.&lt;br /&gt;
[[File:Mmappmap.png|none|thumb]]&lt;br /&gt;
&lt;br /&gt;
== Program and Data Module Structure ==&lt;br /&gt;
&lt;br /&gt;
There are 9 different types of modules in 4 possible languages:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
! colspan=&amp;quot;3&amp;quot; |Module Types&lt;br /&gt;
!&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; |Language&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Module Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Name&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Language&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|$1x&lt;br /&gt;
|Program Module&lt;br /&gt;
|Prgm&lt;br /&gt;
|&lt;br /&gt;
|$x0&lt;br /&gt;
|Data (non-executable)&lt;br /&gt;
|-&lt;br /&gt;
|$2x&lt;br /&gt;
|Subroutine Module&lt;br /&gt;
|Sbrtn&lt;br /&gt;
|&lt;br /&gt;
|$x1&lt;br /&gt;
|6809 Object Code&lt;br /&gt;
|-&lt;br /&gt;
|$3x&lt;br /&gt;
|Multi-module&lt;br /&gt;
|Multi&lt;br /&gt;
|&lt;br /&gt;
|$x2&lt;br /&gt;
|BASIC09 I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$4x&lt;br /&gt;
|Data Module&lt;br /&gt;
|Data&lt;br /&gt;
|&lt;br /&gt;
|$x3&lt;br /&gt;
|PASCAL I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$5x-$Bx&lt;br /&gt;
|User-definable module&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|$x4-$xF&lt;br /&gt;
|Reserved for Future Use&lt;br /&gt;
|-&lt;br /&gt;
|$Cx&lt;br /&gt;
|OS-9 System Module&lt;br /&gt;
|Systm&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Dx&lt;br /&gt;
|OS-9 File Manager Module&lt;br /&gt;
|FlMgr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Ex&lt;br /&gt;
|OS-9 Device Driver Module&lt;br /&gt;
|Drivr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Fx&lt;br /&gt;
|OS-9 Device Descriptor Module&lt;br /&gt;
|Devic&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
The two most used will be Program Modules and Data Modules.&lt;br /&gt;
&lt;br /&gt;
=== Program Modules ===&lt;br /&gt;
The format of the program module varies depending on whether you have a single source file for your program or multiple source files.  &lt;br /&gt;
&lt;br /&gt;
Note: multiple source files format cannot use direct page addressing due to the way they are compiled.&lt;br /&gt;
&lt;br /&gt;
==== Single Source File Format ====&lt;br /&gt;
&lt;br /&gt;
==== Multiple Source File Format ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Data Modules ===&lt;br /&gt;
Here is a portion of the font module, which is a data module in NitrOS-9.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               nam       font&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               ttl       F256 font&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tylg           set       Data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;rev            set       $01&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               mod       eom,name,tylg,atrv,start,0&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;name           fcs       /font/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;L0000          fcb   $00,$00,$00,$00,$00,$00,$00,$00 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;L0008          fcb   $7C,$82,$AA,$82,$BA,$92,$82,$7C &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;More data here&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               emod&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;eom            equ       *&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;
== Writing Position Independent Code ==&lt;br /&gt;
All code in NitrOS-9 must be position independent.  Addresses are not known until a program module is loaded and executed.  All addressing must be &amp;quot;program counter relative addressing&amp;quot;.  All branch and long branch instructions are program counter relative. &lt;br /&gt;
&lt;br /&gt;
Rules: &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BRA&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBRA&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JMP&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BSR&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBSR&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JSR&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use program counter relative indexed addressing for all load, store, arithmetic and logical instructions. &lt;br /&gt;
&lt;br /&gt;
== Accessing Variables and Data Structures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Accessing Table Data with PCR ==&lt;br /&gt;
__FORCETOC__&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=462</id>
		<title>OS-9 Assembly Code Development</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=462"/>
		<updated>2024-09-29T21:21:13Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Single Source File Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
Each process in NitrOS-9 is allocated its own 64K address space.  When run, the program object code is loaded into the end of the memory space, and the variables and data structures are loaded into the beginning.  In addition, NitrOS-9 keeps an separate per-process MMU table (DAT Image), so you must use &amp;lt;code&amp;gt;F$MapBlk&amp;lt;/code&amp;gt; to map and &amp;lt;code&amp;gt;F$ClrBlk&amp;lt;/code&amp;gt; to unmap 8K blocks in your process&#039; address space. The operating system has its own 64K address space as well.  &lt;br /&gt;
&lt;br /&gt;
When a new process is created, registers U, Y, DP and SP are set with U = start of data area, Y = end of data area, DP = page # of beginning page, SP = end of data area + 1.   Each process includes its own execution and data directories, along with &amp;lt;code&amp;gt;std in&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;std out&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;std err&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Memory and DAT Image ===&lt;br /&gt;
&amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; output the current status of the memory in the system. &amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; shows which memory blocks are currently in use.  &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; shows the blocks that are mapped in the DAT Image for a particular process.&lt;br /&gt;
[[File:Mmappmap.png|none|thumb]]&lt;br /&gt;
&lt;br /&gt;
== Program and Data Module Structure ==&lt;br /&gt;
&lt;br /&gt;
There are 9 different types of modules in 4 possible languages:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
! colspan=&amp;quot;3&amp;quot; |Module Types&lt;br /&gt;
!&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; |Language&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Module Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Name&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Language&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|$1x&lt;br /&gt;
|Program Module&lt;br /&gt;
|Prgm&lt;br /&gt;
|&lt;br /&gt;
|$x0&lt;br /&gt;
|Data (non-executable)&lt;br /&gt;
|-&lt;br /&gt;
|$2x&lt;br /&gt;
|Subroutine Module&lt;br /&gt;
|Sbrtn&lt;br /&gt;
|&lt;br /&gt;
|$x1&lt;br /&gt;
|6809 Object Code&lt;br /&gt;
|-&lt;br /&gt;
|$3x&lt;br /&gt;
|Multi-module&lt;br /&gt;
|Multi&lt;br /&gt;
|&lt;br /&gt;
|$x2&lt;br /&gt;
|BASIC09 I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$4x&lt;br /&gt;
|Data Module&lt;br /&gt;
|Data&lt;br /&gt;
|&lt;br /&gt;
|$x3&lt;br /&gt;
|PASCAL I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$5x-$Bx&lt;br /&gt;
|User-definable module&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|$x4-$xF&lt;br /&gt;
|Reserved for Future Use&lt;br /&gt;
|-&lt;br /&gt;
|$Cx&lt;br /&gt;
|OS-9 System Module&lt;br /&gt;
|Systm&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Dx&lt;br /&gt;
|OS-9 File Manager Module&lt;br /&gt;
|FlMgr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Ex&lt;br /&gt;
|OS-9 Device Driver Module&lt;br /&gt;
|Drivr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Fx&lt;br /&gt;
|OS-9 Device Descriptor Module&lt;br /&gt;
|Devic&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
The two most used will be Program Modules and Data Modules.&lt;br /&gt;
&lt;br /&gt;
=== Program Modules ===&lt;br /&gt;
The format of the program module varies depending on whether you have a single source file for your program or multiple source files.  &lt;br /&gt;
&lt;br /&gt;
Note: multiple source files format cannot use direct page addressing due to the way they are compiled.&lt;br /&gt;
&lt;br /&gt;
==== Single Source File Format ====&lt;br /&gt;
&amp;lt;nowiki&amp;gt;********************************************************************&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; [Program Name]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; test for mouse&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; by [Author Name]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; Edt/Rev  YYYY/MM/DD  Modified by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; Comment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; ------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               nam       [ExecutableName]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               ttl       [Full Program Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               ifp1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               endc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tylg           set       Prgrm+Objct&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;atrv             set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;rev            set       $00&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;edition        set       1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               mod       eom,name,tylg,atrv,start,size&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[Variables go here]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;size           equ       .&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;name           fcs       /drawtest/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               fcb       edition&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;start&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[Program Code Here]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;              os9       F$Exit&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               emod&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;eom           equ       *&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;
==== Multiple Source File Format ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Data Modules ===&lt;br /&gt;
Here is a portion of the font module, which is a data module in NitrOS-9.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               nam       font&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               ttl       F256 font&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tylg           set       Data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;rev            set       $01&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               mod       eom,name,tylg,atrv,start,0&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;name           fcs       /font/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;L0000          fcb   $00,$00,$00,$00,$00,$00,$00,$00 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;L0008          fcb   $7C,$82,$AA,$82,$BA,$92,$82,$7C &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;More data here&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               emod&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;eom            equ       *&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;
== Writing Position Independent Code ==&lt;br /&gt;
All code in NitrOS-9 must be position independent.  Addresses are not known until a program module is loaded and executed.  All addressing must be &amp;quot;program counter relative addressing&amp;quot;.  All branch and long branch instructions are program counter relative. &lt;br /&gt;
&lt;br /&gt;
Rules: &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BRA&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBRA&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JMP&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BSR&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBSR&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JSR&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use program counter relative indexed addressing for all load, store, arithmetic and logical instructions. &lt;br /&gt;
&lt;br /&gt;
== Accessing Variables and Data Structures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Accessing Table Data with PCR ==&lt;br /&gt;
__FORCETOC__&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=461</id>
		<title>OS-9 Assembly Code Development</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=OS-9_Assembly_Code_Development&amp;diff=461"/>
		<updated>2024-09-29T21:14:49Z</updated>

		<summary type="html">&lt;p&gt;Jfed: /* Single Source File Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
Each process in NitrOS-9 is allocated its own 64K address space.  When run, the program object code is loaded into the end of the memory space, and the variables and data structures are loaded into the beginning.  In addition, NitrOS-9 keeps an separate per-process MMU table (DAT Image), so you must use &amp;lt;code&amp;gt;F$MapBlk&amp;lt;/code&amp;gt; to map and &amp;lt;code&amp;gt;F$ClrBlk&amp;lt;/code&amp;gt; to unmap 8K blocks in your process&#039; address space. The operating system has its own 64K address space as well.  &lt;br /&gt;
&lt;br /&gt;
When a new process is created, registers U, Y, DP and SP are set with U = start of data area, Y = end of data area, DP = page # of beginning page, SP = end of data area + 1.   Each process includes its own execution and data directories, along with &amp;lt;code&amp;gt;std in&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;std out&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;std err&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Memory and DAT Image ===&lt;br /&gt;
&amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; output the current status of the memory in the system. &amp;lt;code&amp;gt;mmap&amp;lt;/code&amp;gt; shows which memory blocks are currently in use.  &amp;lt;code&amp;gt;pmap&amp;lt;/code&amp;gt; shows the blocks that are mapped in the DAT Image for a particular process.&lt;br /&gt;
[[File:Mmappmap.png|none|thumb]]&lt;br /&gt;
&lt;br /&gt;
== Program and Data Module Structure ==&lt;br /&gt;
&lt;br /&gt;
There are 9 different types of modules in 4 possible languages:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
! colspan=&amp;quot;3&amp;quot; |Module Types&lt;br /&gt;
!&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot; |Language&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Module Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Name&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
|&#039;&#039;&#039;Code&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Language&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|$1x&lt;br /&gt;
|Program Module&lt;br /&gt;
|Prgm&lt;br /&gt;
|&lt;br /&gt;
|$x0&lt;br /&gt;
|Data (non-executable)&lt;br /&gt;
|-&lt;br /&gt;
|$2x&lt;br /&gt;
|Subroutine Module&lt;br /&gt;
|Sbrtn&lt;br /&gt;
|&lt;br /&gt;
|$x1&lt;br /&gt;
|6809 Object Code&lt;br /&gt;
|-&lt;br /&gt;
|$3x&lt;br /&gt;
|Multi-module&lt;br /&gt;
|Multi&lt;br /&gt;
|&lt;br /&gt;
|$x2&lt;br /&gt;
|BASIC09 I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$4x&lt;br /&gt;
|Data Module&lt;br /&gt;
|Data&lt;br /&gt;
|&lt;br /&gt;
|$x3&lt;br /&gt;
|PASCAL I-Code&lt;br /&gt;
|-&lt;br /&gt;
|$5x-$Bx&lt;br /&gt;
|User-definable module&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|$x4-$xF&lt;br /&gt;
|Reserved for Future Use&lt;br /&gt;
|-&lt;br /&gt;
|$Cx&lt;br /&gt;
|OS-9 System Module&lt;br /&gt;
|Systm&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Dx&lt;br /&gt;
|OS-9 File Manager Module&lt;br /&gt;
|FlMgr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Ex&lt;br /&gt;
|OS-9 Device Driver Module&lt;br /&gt;
|Drivr&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|$Fx&lt;br /&gt;
|OS-9 Device Descriptor Module&lt;br /&gt;
|Devic&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
The two most used will be Program Modules and Data Modules.&lt;br /&gt;
&lt;br /&gt;
=== Program Modules ===&lt;br /&gt;
The format of the program module varies depending on whether you have a single source file for your program or multiple source files.  &lt;br /&gt;
&lt;br /&gt;
Note: multiple source files format cannot use direct page addressing due to the way they are compiled.&lt;br /&gt;
&lt;br /&gt;
==== Single Source File Format ====&lt;br /&gt;
&amp;lt;nowiki&amp;gt;********************************************************************&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; [Program Name]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; test for mouse&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; by [Author Name]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; Edt/Rev  YYYY/MM/DD  Modified by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; Comment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; ------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               nam       [ExecutableName]&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;               ttl       [Full Program Name]&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;               ifp1&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;               endc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tylg                set       Prgrm+Objct&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;atrv                set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;rev                 set       $00&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;edition             set       1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               mod       eom,name,tylg,atrv,start,size&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[Variables go here]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;size                equ       .&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;name                fcs       /drawtest/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               fcb       edition&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;start&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;[Program Code Here]&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               os9       F$Exit&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               emod&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;eom                 equ       *&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;
==== Multiple Source File Format ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Data Modules ===&lt;br /&gt;
Here is a portion of the font module, which is a data module in NitrOS-9.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               nam       font&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               ttl       F256 font&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               use       defsfile&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;tylg           set       Data&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;atrv           set       ReEnt+rev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;rev            set       $01&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               mod       eom,name,tylg,atrv,start,0&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;name           fcs       /font/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;L0000          fcb   $00,$00,$00,$00,$00,$00,$00,$00 &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;L0008          fcb   $7C,$82,$AA,$82,$BA,$92,$82,$7C &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;More data here&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;               emod&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;eom            equ       *&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;
== Writing Position Independent Code ==&lt;br /&gt;
All code in NitrOS-9 must be position independent.  Addresses are not known until a program module is loaded and executed.  All addressing must be &amp;quot;program counter relative addressing&amp;quot;.  All branch and long branch instructions are program counter relative. &lt;br /&gt;
&lt;br /&gt;
Rules: &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BRA&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBRA&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JMP&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;BSR&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LBSR&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;JSR&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Use program counter relative indexed addressing for all load, store, arithmetic and logical instructions. &lt;br /&gt;
&lt;br /&gt;
== Accessing Variables and Data Structures ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Accessing Table Data with PCR ==&lt;br /&gt;
__FORCETOC__&lt;/div&gt;</summary>
		<author><name>Jfed</name></author>
	</entry>
</feed>