<?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=Device_access_in_TIC</id>
	<title>Device access in TIC - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://www.ninerpedia.org/index.php?action=history&amp;feed=atom&amp;title=Device_access_in_TIC"/>
	<link rel="alternate" type="text/html" href="http://www.ninerpedia.org/index.php?title=Device_access_in_TIC&amp;action=history"/>
	<updated>2026-04-24T23:10:51Z</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=Device_access_in_TIC&amp;diff=51072&amp;oldid=prev</id>
		<title>Stefan Haubenthal: /* Reading and writing disk sectors */</title>
		<link rel="alternate" type="text/html" href="http://www.ninerpedia.org/index.php?title=Device_access_in_TIC&amp;diff=51072&amp;oldid=prev"/>
		<updated>2026-01-28T12:06:27Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Reading and writing disk sectors&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:06, 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;== Reading and writing disk sectors ==&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;== Reading and writing disk sectors ==&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;The following code demonstrates how level-2 file access can be used in a TIC program. It copies a file, independent of the file format, by reading a sector and writing to a target file. Each sector is allocated when written.  &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;The following code demonstrates how level-2 file access can be used in a &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;program. It copies a file, independent of the file format, by reading a sector and writing to a target file. Each sector is allocated when written.  &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;This sample code is certainly not the best way to copy files (wasting a lot of time by repeatedly and writing single sectors); it is only intended to illustrate the level-2 access.&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;This sample code is certainly not the best way to copy files (wasting a lot of time by repeatedly and writing single sectors); it is only intended to illustrate the level-2 access.&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=Device_access_in_TIC&amp;diff=47978&amp;oldid=prev</id>
		<title>Mizapf: Created page with &quot;== Reading and writing disk sectors ==  The following code demonstrates how level-2 file access can be used in a TIC program. It copies a file, independent of the file format, by...&quot;</title>
		<link rel="alternate" type="text/html" href="http://www.ninerpedia.org/index.php?title=Device_access_in_TIC&amp;diff=47978&amp;oldid=prev"/>
		<updated>2011-11-05T23:25:52Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Reading and writing disk sectors ==  The following code demonstrates how level-2 file access can be used in a TIC program. It copies a file, independent of the file format, by...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Reading and writing disk sectors ==&lt;br /&gt;
&lt;br /&gt;
The following code demonstrates how level-2 file access can be used in a TIC program. It copies a file, independent of the file format, by reading a sector and writing to a target file. Each sector is allocated when written. &lt;br /&gt;
&lt;br /&gt;
This sample code is certainly not the best way to copy files (wasting a lot of time by repeatedly and writing single sectors); it is only intended to illustrate the level-2 access.&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio_h&amp;gt;&lt;br /&gt;
 #include &amp;lt;stdlib_h&amp;gt; &lt;br /&gt;
 &lt;br /&gt;
 main(argc, argv)&lt;br /&gt;
 int argc; char *argv[];&lt;br /&gt;
 {&lt;br /&gt;
    int  res, sect, i;&lt;br /&gt;
    char rbuf[256];&lt;br /&gt;
    int  *ibuf;&lt;br /&gt;
 &lt;br /&gt;
    if (argc&amp;lt;2)&lt;br /&gt;
    {&lt;br /&gt;
        printf(&amp;quot;Syntax: filecopy &amp;lt;from_file&amp;gt; &amp;lt;to_file&amp;gt;\n&amp;quot;);&lt;br /&gt;
        return;&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    /* First we get the metadata */&lt;br /&gt;
    res = bread(argv[1], 0, 0, rbuf);&lt;br /&gt;
    check(res);&lt;br /&gt;
 &lt;br /&gt;
    /* write the old metadata as new metadata */&lt;br /&gt;
    res = bwrite(argv[2], 0, 0, rbuf);&lt;br /&gt;
    check(res);&lt;br /&gt;
 &lt;br /&gt;
    /* copy the file sector by sector */&lt;br /&gt;
    ibuf = rbuf;&lt;br /&gt;
    sect = ibuf[2];&lt;br /&gt;
    for (i=0; i &amp;lt; sect; i++)&lt;br /&gt;
    {&lt;br /&gt;
        printf(&amp;quot;Copying sector %d of %d\r&amp;quot;, i+1, sect);&lt;br /&gt;
        res = bread(argv[1], i, 1, rbuf);&lt;br /&gt;
        check(res);&lt;br /&gt;
        res = bwrite(argv[2], i, 1, rbuf);&lt;br /&gt;
        check(res);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void check(code)&lt;br /&gt;
 int code;&lt;br /&gt;
 {&lt;br /&gt;
    if (code != 0)&lt;br /&gt;
    {&lt;br /&gt;
        printf(&amp;quot;Error, code = %d\n&amp;quot;, code);&lt;br /&gt;
        exit(7);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Programming]]&lt;br /&gt;
[[Category:MDOS]]&lt;/div&gt;</summary>
		<author><name>Mizapf</name></author>
	</entry>
</feed>