<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.temlib.org/AtariForumWiki/index.php?action=history&amp;feed=atom&amp;title=CW_CHAPTER_2</id>
	<title>CW CHAPTER 2 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.temlib.org/AtariForumWiki/index.php?action=history&amp;feed=atom&amp;title=CW_CHAPTER_2"/>
	<link rel="alternate" type="text/html" href="https://www.temlib.org/AtariForumWiki/index.php?title=CW_CHAPTER_2&amp;action=history"/>
	<updated>2026-05-13T16:57:23Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.2</generator>
	<entry>
		<id>https://www.temlib.org/AtariForumWiki/index.php?title=CW_CHAPTER_2&amp;diff=11611&amp;oldid=prev</id>
		<title>&gt;Wongck at 15:35, 12 October 2011</title>
		<link rel="alternate" type="text/html" href="https://www.temlib.org/AtariForumWiki/index.php?title=CW_CHAPTER_2&amp;diff=11611&amp;oldid=prev"/>
		<updated>2011-10-12T15:35:43Z</updated>

		<summary type="html">&lt;p&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 11:35, 12 October 2011&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-l313&quot;&gt;Line 313:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 313:&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;Back to [[Assembly_language_tutorials]]&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;Back to [[Assembly_language_tutorials]]&lt;/div&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;[[Category:&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Programming&lt;/del&gt;]]&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;[[Category:&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Assembly Language Workshop&lt;/ins&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>&gt;Wongck</name></author>
	</entry>
	<entry>
		<id>https://www.temlib.org/AtariForumWiki/index.php?title=CW_CHAPTER_2&amp;diff=11610&amp;oldid=prev</id>
		<title>&gt;Silver Surfer: Added category</title>
		<link rel="alternate" type="text/html" href="https://www.temlib.org/AtariForumWiki/index.php?title=CW_CHAPTER_2&amp;diff=11610&amp;oldid=prev"/>
		<updated>2009-05-02T17:22:44Z</updated>

		<summary type="html">&lt;p&gt;Added category&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 13:22, 2 May 2009&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-l313&quot;&gt;Line 313:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 313:&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;Back to [[Assembly_language_tutorials]]&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;Back to [[Assembly_language_tutorials]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&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;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Programming]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>&gt;Silver Surfer</name></author>
	</entry>
	<entry>
		<id>https://www.temlib.org/AtariForumWiki/index.php?title=CW_CHAPTER_2&amp;diff=11609&amp;oldid=prev</id>
		<title>&gt;Zorro 2 at 13:47, 24 October 2006</title>
		<link rel="alternate" type="text/html" href="https://www.temlib.org/AtariForumWiki/index.php?title=CW_CHAPTER_2&amp;diff=11609&amp;oldid=prev"/>
		<updated>2006-10-24T13:47:32Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CHAPTER 2: HANDLING THE FILE SELECTOR&lt;br /&gt;
--------------------------------------&lt;br /&gt;
&lt;br /&gt;
[NOTE: Words enclosed in asterisks (i.e. *word*) should be &lt;br /&gt;
read as italicized text. This text file is copyright 1993 by &lt;br /&gt;
Clayton Walnum. All rights reserved.]&lt;br /&gt;
&lt;br /&gt;
As we said in the previous chapter, the AES supplies us with &lt;br /&gt;
several ready-made forms that we can use in our programs. &lt;br /&gt;
Now that we know how to use one of the simpler forms, the &lt;br /&gt;
alert box, we can move on to one of GEM's most frequently &lt;br /&gt;
used form, the file selector. In this chapter, we'll learn &lt;br /&gt;
to call up a file selector and to use the information it &lt;br /&gt;
returns to create a full pathname for any file the user &lt;br /&gt;
selects.&lt;br /&gt;
&lt;br /&gt;
--What Is a File Selector?--&lt;br /&gt;
&lt;br /&gt;
If you've used your ST at all, there's no doubt that you're &lt;br /&gt;
already familiar with the file selector. Virtually every GEM &lt;br /&gt;
program written for the ST uses the file selector to get &lt;br /&gt;
file information from users. The file selector's basic &lt;br /&gt;
function is simple: it allows the user to select a file. &lt;br /&gt;
However, because selecting a file requires the ability to &lt;br /&gt;
move from one directory to another, as well as scroll &lt;br /&gt;
through a list of filenames too large to fit into the &lt;br /&gt;
selector's window, things are a little more complicated.&lt;br /&gt;
	Figure 2.1 shows a typical file selector. At the top is &lt;br /&gt;
the directory line, which shows the directory the user is &lt;br /&gt;
currently logged into. In the figure, the user is logged &lt;br /&gt;
into the DEVPAC folder of the D: drive. Notice the *.* &lt;br /&gt;
following the path. These wild cards mean that the file &lt;br /&gt;
selector should show every file listed in the directory. If &lt;br /&gt;
the file portion of the path was changed by the programmer &lt;br /&gt;
to, say, *.PRG, only programs with a .PRG extension would &lt;br /&gt;
appear in the file selector's window, as shown in figure &lt;br /&gt;
2.2.&lt;br /&gt;
&lt;br /&gt;
[INSERT FIGURES 2.1 AND 2.2 HERE]&lt;br /&gt;
&lt;br /&gt;
	The user cannot change the file-filter portion of the &lt;br /&gt;
pathname, but he can change the directory. There are three &lt;br /&gt;
ways to do this: 1) by clicking the directory line, typing &lt;br /&gt;
the new path, and then clicking the top of the file window; &lt;br /&gt;
2) by clicking a directory in the file window to move to &lt;br /&gt;
that directory; or 3) by clicking the button in the upper-&lt;br /&gt;
left corner of the file window to move back one directory.&lt;br /&gt;
	To the right of the file window is the filename field. &lt;br /&gt;
This field is usually blank until the user selects a file. &lt;br /&gt;
However, the programmer can give GEM a default filename to &lt;br /&gt;
display when he calls the file selector box. The user can &lt;br /&gt;
select a file three ways: 1) by typing the file into the &lt;br /&gt;
filename field and then clicking the OK button; 2) by &lt;br /&gt;
clicking the filename in the file window and then selecting &lt;br /&gt;
the OK button; or 3) by simply double-clicking the filename &lt;br /&gt;
in the file window.&lt;br /&gt;
	Besides its button and file bar, the file window also &lt;br /&gt;
contains scroll bars, which allow the user to see files that &lt;br /&gt;
are not currently displayed in the window. This scroll bar &lt;br /&gt;
is operated by clicking it with the mouse pointer.&lt;br /&gt;
&lt;br /&gt;
--The Program--&lt;br /&gt;
&lt;br /&gt;
In the CHAP2 folder of your *ST Assembly Language Workshop* &lt;br /&gt;
disk, you'll find two files. PROG2.S is the source code for &lt;br /&gt;
this chapter's sample program, which is reprinted at the end &lt;br /&gt;
of this chapter. PROG2.PRG is the assembled, runnable &lt;br /&gt;
program file. If you would like to assemble the program &lt;br /&gt;
yourself, please consult your assembler's manual or refer to &lt;br /&gt;
this book's Appendix A.&lt;br /&gt;
	When you run the program, a file selector box appears &lt;br /&gt;
on the screen. Use the file selector to move from one &lt;br /&gt;
directory to another. Finally, select a file, and then click &lt;br /&gt;
the OK or Cancel button. If you select the cancel button the &lt;br /&gt;
program will return to the desktop. If you select the OK &lt;br /&gt;
button, the program will display the full pathname for the &lt;br /&gt;
file you chose. Press Return to return to the desktop.&lt;br /&gt;
&lt;br /&gt;
--Getting the Current Drive--&lt;br /&gt;
&lt;br /&gt;
Now, let's look at the program's code, to see what's &lt;br /&gt;
happening. The program begins just like our previous one, by &lt;br /&gt;
setting up a stack, releasing unused memory, and &lt;br /&gt;
initializing the GEM application with a call to *appl_init*. &lt;br /&gt;
After that, the fun begins.&lt;br /&gt;
	When you call the file selector box, you need to give &lt;br /&gt;
it a path for its pathname line. This could be any path you &lt;br /&gt;
like. However, it is standard practice to have the file &lt;br /&gt;
selector already set to the currently active path, usually &lt;br /&gt;
the path from which the program was run. To get this &lt;br /&gt;
information for the file selector, we must first get the &lt;br /&gt;
current drive letter and the current path. Then we must &lt;br /&gt;
combine these into a single string.&lt;br /&gt;
	Right after our call to *appl_init*, you'll see the &lt;br /&gt;
code in which we get the current drive letter. It looks like &lt;br /&gt;
this:&lt;br /&gt;
&lt;br /&gt;
move    #DGETDRV,-(sp)&lt;br /&gt;
trap    #1&lt;br /&gt;
addq.l  #2,sp&lt;br /&gt;
add     #'A',d0&lt;br /&gt;
move.b  d0,pathname&lt;br /&gt;
move.b  #':',pathname+1&lt;br /&gt;
&lt;br /&gt;
The first three lines are a call to GEMDOS function #25, &lt;br /&gt;
*Dgetdrv*, which returns in D0 a number representing the &lt;br /&gt;
currently active drive. A 0 indicates drive A, a 1 indicates &lt;br /&gt;
drive B, a 2 indicates drive C, and so on.&lt;br /&gt;
	Once we have the drive number in D0, we need to convert &lt;br /&gt;
it to an ASCII character for our path string. We do this in &lt;br /&gt;
line 4 above. The *#'A'* is just another way of representing &lt;br /&gt;
the ASCII value of &amp;quot;A.&amp;quot; By adding the ASCII value of &amp;quot;A&amp;quot; to &lt;br /&gt;
the drive number, we end up with the drive letter we want. &lt;br /&gt;
We did this type of conversion in volume 1 of *The Assembly &lt;br /&gt;
Language Workshop*.&lt;br /&gt;
	The last step is to move the drive letter to the first &lt;br /&gt;
byte of our pathname string, and place a colon in the second &lt;br /&gt;
byte of the pathname string. This is accomplished in the &lt;br /&gt;
last two lines above. Note that the label *pathname* &lt;br /&gt;
represents the address of a 128-byte string. You can find &lt;br /&gt;
this string in the program's BSS. Why do we need 128 bytes? &lt;br /&gt;
Because the file selector will use this area to return the &lt;br /&gt;
user's selected path to us. Because paths can be long, we &lt;br /&gt;
must be sure to provide plenty of space. Otherwise, other &lt;br /&gt;
data may get overwritten by the pathname string returned by &lt;br /&gt;
the file selector.&lt;br /&gt;
&lt;br /&gt;
--Getting the Current Path--&lt;br /&gt;
&lt;br /&gt;
Now that we have the current drive letter, we need to get &lt;br /&gt;
the current path. The five lines of code following the call &lt;br /&gt;
to *Dgetdrv* accomplish this task. The code looks like this:&lt;br /&gt;
&lt;br /&gt;
move    #0,-(sp)&lt;br /&gt;
move.l  #pathname+2,-(sp)&lt;br /&gt;
move    #DGETPATH,-(sp)&lt;br /&gt;
trap    #1&lt;br /&gt;
addq.l  #8,sp&lt;br /&gt;
&lt;br /&gt;
	The above is a call to GEMDOS function #71, *Dgetpath*. &lt;br /&gt;
As you can see, the call requires that three parameters be &lt;br /&gt;
placed on the stack. The first is the number of the drive &lt;br /&gt;
for which you want to retrieve the path. For this word &lt;br /&gt;
value, 0 represents drive A, 1 represents drive B, and so &lt;br /&gt;
on. The second parameter is the address of the buffer where &lt;br /&gt;
*Dgetdrv* should store the path string. In the second line &lt;br /&gt;
above, we're giving the function the address of the third &lt;br /&gt;
byte of our pathname string. Why? Because we've already got &lt;br /&gt;
the drive letter and a colon on the first two bytes. By &lt;br /&gt;
giving the function the address of the third byte, it'll not &lt;br /&gt;
only return the path string to us, but will also &lt;br /&gt;
automatically tack it onto our drive specifier. The third &lt;br /&gt;
and final parameter is the function number.&lt;br /&gt;
&lt;br /&gt;
--Pathnames, File Selector Style--&lt;br /&gt;
&lt;br /&gt;
Even after we've got the entire pathname, we're still not &lt;br /&gt;
ready to call up the file selector. We need to add a default &lt;br /&gt;
file specification to the end of the path. The usual default &lt;br /&gt;
is \*.*, which will allow the file selector to show every &lt;br /&gt;
file in the current directory. However, you could use any &lt;br /&gt;
default. For example, if you were asking the user for a &lt;br /&gt;
DEGAS picture file, you'd probably want to use the default &lt;br /&gt;
of \*.PI?, which filters out all files except those with &lt;br /&gt;
extensions starting with PI.&lt;br /&gt;
	If you look at the sample program, right after the call &lt;br /&gt;
to *Dgetpath*, you'll see where we add the \*.* to our path &lt;br /&gt;
string. First, we must search for the end of the string. We &lt;br /&gt;
do this by scanning the string from the beginning until we &lt;br /&gt;
find a null. Once we've found the position of the null &lt;br /&gt;
character, we simply tack on the \*.* characters.&lt;br /&gt;
&lt;br /&gt;
--Calling the File Selector--&lt;br /&gt;
&lt;br /&gt;
Now, our pathname string is ready for the file selector box. &lt;br /&gt;
We now bring up the file selector and let the user choose &lt;br /&gt;
the file. The code in our sample program that brings up the &lt;br /&gt;
file selector box looks like this:&lt;br /&gt;
&lt;br /&gt;
move    #FSEL_INPUT,control0&lt;br /&gt;
move    #0,control1&lt;br /&gt;
move    #2,control2&lt;br /&gt;
move    #2,control3&lt;br /&gt;
move    #0,control4&lt;br /&gt;
move.l  #pathname,addr_in&lt;br /&gt;
move.l  #filename,addr_in+4&lt;br /&gt;
jsr     aes&lt;br /&gt;
&lt;br /&gt;
Because the file selector is an AES call (function #90, &lt;br /&gt;
*fsel_input*), we must initialize the control array, as well &lt;br /&gt;
as place the necessary values in the other arrays. With this &lt;br /&gt;
call, the only other arrays we use are addr_in and int_out. &lt;br /&gt;
We use the addr_in array to tell the file selector where the &lt;br /&gt;
pathname and filename strings are. The file selector will &lt;br /&gt;
also use these two strings to return the selected filename &lt;br /&gt;
and pathname to us.&lt;br /&gt;
	The file selector will use the first two words of the &lt;br /&gt;
int_out array to return an error code and a button code, &lt;br /&gt;
respectively. The error code will be 0 if an error occurred &lt;br /&gt;
or greater than 0 if no error occurred. The button code will &lt;br /&gt;
be 0 for the cancel button and 1 for the OK button.&lt;br /&gt;
	Note that there is a slightly modified version of the &lt;br /&gt;
*fsel_input* call for newer versions of GEM (Rainbow TOS) &lt;br /&gt;
This new call, named *fsel_exinput*, allows the programmer &lt;br /&gt;
to replace the &amp;quot;Item Selector&amp;quot; string that appears at the &lt;br /&gt;
top of the file selector box with something more meaningful, &lt;br /&gt;
such as &amp;quot;Choose file to load.&amp;quot; A typical call to the new &lt;br /&gt;
file selector looks like this:&lt;br /&gt;
&lt;br /&gt;
move    #FSEL_EXINPUT,control0&lt;br /&gt;
move    #0,control1&lt;br /&gt;
move    #2,control2&lt;br /&gt;
move    #3,control3&lt;br /&gt;
move    #0,control4&lt;br /&gt;
move.l  #pathname,addr_in&lt;br /&gt;
move.l  #filename,addr_in+4&lt;br /&gt;
move.l  #string,addr_in+8&lt;br /&gt;
jsr     aes&lt;br /&gt;
&lt;br /&gt;
There are only three differences between the *fsel_exinput* &lt;br /&gt;
and the older *fsel_input* call. First, the function number &lt;br /&gt;
for the new call, represented above by the constant &lt;br /&gt;
FSEL_EXINPUT, is 91. Second, you must indicate that your &lt;br /&gt;
addr_in array is three elements long by loading a 3 into &lt;br /&gt;
control3. Finally, you need to store into the third element &lt;br /&gt;
of addr_in the address of the string you want at the top of &lt;br /&gt;
the file selector. Note that, on TOS versions earlier than &lt;br /&gt;
1.4, the *fsel_exinput* will generate a run-time error (bad &lt;br /&gt;
function number). If you want to use this call safely, you &lt;br /&gt;
must, within your program, check for the version of TOS &lt;br /&gt;
under which your program is currently running. If the &lt;br /&gt;
version is earlier than 1.4, you must stick with the old &lt;br /&gt;
*fsel_input* function.&lt;br /&gt;
&lt;br /&gt;
--Constructing the Selected Path--&lt;br /&gt;
&lt;br /&gt;
After the user selects a path and filename with the file &lt;br /&gt;
selector, he closes the file selector by clicking the OK or &lt;br /&gt;
Cancel buttons. If the value stored in the second element of &lt;br /&gt;
int_out indicates that the OK button was pressed, we must &lt;br /&gt;
build the final, complete pathname, using the information &lt;br /&gt;
returned by the file selector. The chosen pathname will be &lt;br /&gt;
in the *pathname* string, and the chosen filename will be in &lt;br /&gt;
the *filename* string.&lt;br /&gt;
	The first step in constructing the final pathname is to &lt;br /&gt;
scan the path string for the null that marks the end of the &lt;br /&gt;
string. Once we've found the null, we must scan backward &lt;br /&gt;
until we find a backslash character. We need to do this &lt;br /&gt;
because the path, as returned from the file selector, still &lt;br /&gt;
includes the default file specification. For example, the &lt;br /&gt;
path may look like C:\UTILITY\*.*. We of course must replace &lt;br /&gt;
the *.* with the actual file selected.&lt;br /&gt;
	Once we've found the backslash character, we tack the &lt;br /&gt;
filename on. Using the example path above, our final path &lt;br /&gt;
should look something like C:\UTILITY\FILECOPY.PRG. This &lt;br /&gt;
final pathname contains all the information we need to &lt;br /&gt;
access the chosen file.&lt;br /&gt;
	In the sample program, the code that creates the final &lt;br /&gt;
pathname is fairly straight forward and heavily commented. &lt;br /&gt;
You should have little trouble seeing how it works.&lt;br /&gt;
	After constructing the final pathname, the sample &lt;br /&gt;
program simply displays the path on the screen and waits for &lt;br /&gt;
the user to press a key, after which the application &lt;br /&gt;
terminates and the program returns control to the desktop.&lt;br /&gt;
&lt;br /&gt;
--Conclusion--&lt;br /&gt;
&lt;br /&gt;
The file selector is typical of most GEM forms: It provides &lt;br /&gt;
a convenient way for users to give information to a program. &lt;br /&gt;
Likewise, it makes it easy for the programmer to request &lt;br /&gt;
this information, by using an device with which the user is &lt;br /&gt;
already familiar. Every GEM program you write should use the &lt;br /&gt;
file selector wherever it's necessary for the user to choose &lt;br /&gt;
a file.&lt;br /&gt;
&lt;br /&gt;
--Summary--&lt;br /&gt;
&lt;br /&gt;
* The GEMDOS function #25, *Dgetdrv*, returns the currently &lt;br /&gt;
active drive in D0.&lt;br /&gt;
&lt;br /&gt;
* The GEMDOS function #71, *Dgetpath*, returns the currently &lt;br /&gt;
selected path into a string whose address is one of the &lt;br /&gt;
function's parameters.&lt;br /&gt;
&lt;br /&gt;
* The AES call #90, *fsel_input*, brings the file selector &lt;br /&gt;
box up onto the screen.&lt;br /&gt;
&lt;br /&gt;
* On TOS version 1.4 or newer, the AES call #91, &lt;br /&gt;
*fsel_exinput*, lets you bring up a file selector and &lt;br /&gt;
replace the standard &amp;quot;Item Selector&amp;quot; string with a string of &lt;br /&gt;
your own.&lt;br /&gt;
&lt;br /&gt;
* When the file selector returns the chosen pathname and &lt;br /&gt;
filename, it's up to the programmer to use them to create &lt;br /&gt;
the complete path.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[CW_PROG2MAC.S]] (Source of the chapiter)&lt;br /&gt;
&lt;br /&gt;
[[CW_PROG2.S]] (Source of the chapiter)&lt;br /&gt;
&lt;br /&gt;
Back to [[Assembly_language_tutorials]]&lt;/div&gt;</summary>
		<author><name>&gt;Zorro 2</name></author>
	</entry>
</feed>