<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://www.ninerpedia.org/index.php?action=history&amp;feed=atom&amp;title=MDOS_command_line</id>
	<title>MDOS command line - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://www.ninerpedia.org/index.php?action=history&amp;feed=atom&amp;title=MDOS_command_line"/>
	<link rel="alternate" type="text/html" href="http://www.ninerpedia.org/index.php?title=MDOS_command_line&amp;action=history"/>
	<updated>2026-04-24T18:34:01Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>http://www.ninerpedia.org/index.php?title=MDOS_command_line&amp;diff=51073&amp;oldid=prev</id>
		<title>Stefan Haubenthal: /* Getting the arguments from the MDOS command line */</title>
		<link rel="alternate" type="text/html" href="http://www.ninerpedia.org/index.php?title=MDOS_command_line&amp;diff=51073&amp;oldid=prev"/>
		<updated>2026-01-28T12:07:13Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Getting the arguments from the MDOS command line&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:07, 28 January 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Getting the arguments from the MDOS command line ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Getting the arguments from the MDOS command line ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;There is only little documentation on the MDOS environment. One of the most interesting questions is how to retrieve the command line arguments in order to process them in the own program. TIC seems to be able to do, so our assembly language program should as well.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;There is only little documentation on the MDOS environment. One of the most interesting questions is how to retrieve the command line arguments in order to process them in the own program. &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[&lt;/ins&gt;TIC&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]] &lt;/ins&gt;seems to be able to do, so our assembly language program should as well.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The answer is that the command line arguments are stored as a single string (with leading length byte) in a linked list of chunks of 6 bytes each. The pointer to this list is at address &amp;gt;0128 of the memory page at 0000-1FFF that was set when the program was started (so take care when you change the mapper). Here is an illustration:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The answer is that the command line arguments are stored as a single string (with leading length byte) in a linked list of chunks of 6 bytes each. The pointer to this list is at address &amp;gt;0128 of the memory page at 0000-1FFF that was set when the program was started (so take care when you change the mapper). Here is an illustration:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Stefan Haubenthal</name></author>
	</entry>
	<entry>
		<id>http://www.ninerpedia.org/index.php?title=MDOS_command_line&amp;diff=47976&amp;oldid=prev</id>
		<title>Mizapf: Created page with &quot;== Getting the arguments from the MDOS command line ==  There is only little documentation on the MDOS environment. One of the most interesting questions is how to retrieve the c...&quot;</title>
		<link rel="alternate" type="text/html" href="http://www.ninerpedia.org/index.php?title=MDOS_command_line&amp;diff=47976&amp;oldid=prev"/>
		<updated>2011-11-05T23:23:14Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Getting the arguments from the MDOS command line ==  There is only little documentation on the MDOS environment. One of the most interesting questions is how to retrieve the c...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Getting the arguments from the MDOS command line ==&lt;br /&gt;
&lt;br /&gt;
There is only little documentation on the MDOS environment. One of the most interesting questions is how to retrieve the command line arguments in order to process them in the own program. TIC seems to be able to do, so our assembly language program should as well.&lt;br /&gt;
&lt;br /&gt;
The answer is that the command line arguments are stored as a single string (with leading length byte) in a linked list of chunks of 6 bytes each. The pointer to this list is at address &amp;gt;0128 of the memory page at 0000-1FFF that was set when the program was started (so take care when you change the mapper). Here is an illustration:&lt;br /&gt;
&lt;br /&gt;
[[File:args.png|300px]]&lt;br /&gt;
&lt;br /&gt;
The command line arguments do not contain the program name, and they are not parsed, that is, you have to analyze the string in your application program. The memory location at &amp;gt;0128 contains a 0000 when there are no arguments. The end of the list is indicated by a next pointer that is set to 0000. Be aware that the last chunk may have arbitrary content after the end of the string. The pointers are 2 bytes each and start at word boundaries.&lt;br /&gt;
&lt;br /&gt;
The following code is an example how to retrieve the list contents:&lt;br /&gt;
&lt;br /&gt;
 BUF    BSS  80           Reserve 80 bytes of space&lt;br /&gt;
 &lt;br /&gt;
 START  MOV  @&amp;gt;0128,R0    Get pointer to list&lt;br /&gt;
        JEQ  NOARGS       If it is 0, skip all &lt;br /&gt;
 &lt;br /&gt;
 ST1    LI   R3,BUF       Pointer to buffer&lt;br /&gt;
        MOV  *R0+,R1      Store next pointer in R1&lt;br /&gt;
        LI   R5,6         Number of bytes in chunk&lt;br /&gt;
        MOVB *R0+,R2      Get length byte&lt;br /&gt;
        DEC  R5           Count down one for that byte&lt;br /&gt;
        SRL  R2,8         Move length byte to the low byte&lt;br /&gt;
        MOV  R2,*R3+      and write it at the head of the buffer&lt;br /&gt;
 &lt;br /&gt;
 GL1    MOVB *R0+,*R3+    Copy the current byte to the buffer&lt;br /&gt;
        DEC  R2           Count down remaining string bytes&lt;br /&gt;
        JEQ  GOTALL       Done?&lt;br /&gt;
 GL2    DEC  R5           No, count down chunk counter&lt;br /&gt;
        JNE  GL1          Chunk done? &lt;br /&gt;
 GL3    MOV  R1,R0        Yes, put the next address in R0&lt;br /&gt;
        JEQ  DONE         Is it null? &lt;br /&gt;
        MOV  *R0+,R1      No, so there is another chunk&lt;br /&gt;
        LI   R5,6         Reset chunk counter&lt;br /&gt;
        JMP  GL1          End of loop&lt;br /&gt;
 &lt;br /&gt;
 DONE ...&lt;br /&gt;
 NOARGS ...&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:MDOS]]&lt;/div&gt;</summary>
		<author><name>Mizapf</name></author>
	</entry>
</feed>