mirror of
https://github.com/marketideas/qasm.git
synced 2026-10-24 22:02:28 +00:00
Move the assembler to src/qasm. qlink links OMF 1.0 and 2.0 from a script. makeBin flattens a load file, qomf dumps OMF, and qpro builds ProDOS volumes. APW and MPW assemble through the ORCA front end. Relocatable modules emit OMF objects. Listings stay off unless -l is set. make boot assembles the GS/OS 6.0.1 ProDOS 8 kernel and BASIC.SYSTEM into an 800K volume. BASIC.SYSTEM accepts ls and pfx, and its splash reports PRODOS BASIC 2.0, copyright 1983-2026. IIGS.601.SRC is the source and the BASIC.SYSTEM oracle that image is built from.
1 line
218 KiB
NASM
1 line
218 KiB
NASM
TITLE 'sf.asm'
|
|
**********************************************************************
|
|
* Standard File, version 2
|
|
*
|
|
* Created: 6/01/1988
|
|
*
|
|
*
|
|
* Copyright (c) Apple Computer, Inc. 1988-1992
|
|
* All Rights Reserved
|
|
*
|
|
* Ideas from original Standard File but all code has been rewritten
|
|
* from the ground up. The code now makes use of system tools which were
|
|
* not available at the first writing of standard file. Additional tool
|
|
* calls to support GS/OS have been added.
|
|
*
|
|
* 7/01/88 - Got new dialog routines written
|
|
* 7/25/88 - Completed interface to the list manager
|
|
* 8/01/88 - Completed mamory management calls to build file data
|
|
* 8/08/88 - Completed building list of file names for a folder
|
|
* 8/16/88 - Custom draw routine for file names added
|
|
* 8/22/88 - Completed code to move up and down folder levels.
|
|
* 8/29/88 - Corrections to memory allocation problems.
|
|
* 9/02/88 - Added code for path name display
|
|
* 9/03/88 - Completed code for custom display of path name and extra long names.
|
|
* 9/05/88 - Added icons to path names and file name displays
|
|
* 9/09/88 - Break to write 0.1 through 0.3 ERS
|
|
* 9/19/88 - Added code for button highlites and flashing.
|
|
* 9/21/88 - Complete button highlights and interaction with other dialog parts.
|
|
* 9/23/88 - Start code for volume switch. (and documentation update)
|
|
* 9/27/88 - Volume button works. Beginning debug on all code.
|
|
* 9/27/88 - Adding new icons for devices!
|
|
* 9/28/88 - Add color to icons. Start support for AppleShare (privilege voilations)
|
|
* 9/30/88 - Select first list element, button highlight control, prefix "juggling".
|
|
* 10/03/88 - Start on Put Dialog and associated code.
|
|
* 10/07/88 - Start re-write on ERS.
|
|
* 10/09/88 - Start code on moving dialog into allocated memory. (have to MUNG old dialog formats)
|
|
* 10/12/88 - Completed all above. Add grey out list items.
|
|
* 10/13/88 - Re-write code for open button disable/enable (based on greyed out item code)
|
|
* 10/15/88 - Add code to handle key equiv. Fix calls into tools.
|
|
* 10/20/88 - Add code for save and New Folder button highlight
|
|
* 10/24/88 - Add New Folder code and error alerts.
|
|
* 10/27/88 - Cleanup and add entries for main calls
|
|
* 10/28/88 - Add fliterProc hooks and TypeList checking (old style)
|
|
* 11/02/88 - Fix Open/Close bug on folders (caused eventual crash)
|
|
* 11/05/88 - General fixes. Correct custom template bug.
|
|
* 11/09/88 - Start on building Reply Record. Fix some items from code review.
|
|
* 11/11/88 - Continue debugging as tool. Add code for file replacement for existing files.
|
|
* 11/28/88 - Add code to support new type lists.
|
|
* 11/29/88 - Change TRUE to $FFFF. Change input parameters to conform to ERS 0.7
|
|
* 12/01/88 - Clean up code. Add entry error checking.
|
|
* 12/09/88 - Fix 320 die error. Remove QDAux calls for icons. (changed to PPtoPort)
|
|
* 12/13/88 - Add new call: SFRescan to allow the list to be redrawn with new filters and procs.
|
|
* 12/15/88 - Begin multifile selection support
|
|
* 12/17/88 - stop above, begin debug cycle.
|
|
* 1/08/89 - start multifile (again)
|
|
* 1/20/89 - complete multifile (first pass)
|
|
* 1/23/89 - remove Alert windows and replace with ErrorWindow calls.
|
|
* 1/25/89 - Save button status change. No save or folder to write protected disks.
|
|
* 1/27/89 - Added a locked icon to the pathname display for write disabled disks.
|
|
* 2/09/89 - Check in misc fixes for bugs reported:
|
|
* PutFile modes failed on nil OrigNameStr
|
|
* bit# instruction was missing # on an instruction causing strange error
|
|
* edit field max length error on new PutFile calls
|
|
* 2/10/89 - Add hook to allow Claris to modify the icon for each file displayed
|
|
* 4/28/89 - Fix DTS reported bugs with in old calls. 1). Status did not return high bit set.
|
|
* 2). ':' instead of '/' were returned in path names.
|
|
* 3). First character in file name being blasted in old filter proc records.
|
|
* 5/15/89 - Fix reported bugs: 1). 320 Get dialog was incorrect and has been corrected.
|
|
* 2). The New Reply record contained false File and Aux types. This is fixed.
|
|
* 3). The Multi Reply Record had incorrect File and Aux types. This is fixed.
|
|
* 5/17/89 - Yet more fixes: 1). Save & Folder button sometimes light even if string is empty. Fixed.
|
|
* 2). Releasing of resources was done incorrectly which caused the prompt
|
|
* string to display incorrectly on subsequent calls. Fixed.
|
|
* 3). New calls default name didn't show up. Fixed
|
|
* 4). Pressing CR or ENTER if the save field was empty caused the char
|
|
* to be put into the Line text field. Fixed
|
|
*
|
|
* 6/8/89 - Mensch Fix scrambler bug when using promptref is handle setitext kept derefed
|
|
*
|
|
* 6/28/89 - Bug fix to correct problem of AuxType not getting passed onto custom draw proc.
|
|
* 7/24/89 - Fixes and additions (ORR):
|
|
* Added new sort routine so lower case sorts correctly.
|
|
* Now call _errorwindow if a disk error occures on return_file.
|
|
*
|
|
* 7/26/89 - some recent changes no-op'ed out to minimize checking for intermediate results.
|
|
* Error window and sort routine removed. Disk errors will switch to next
|
|
* volume.
|
|
*
|
|
* 7/27/89 - sort routine added back in but this time as a List Manager proc passed
|
|
* to the toolbox routine _SortList. The routine added in this file
|
|
* is called 'CompareRoutine' and uses no local storage or variables.
|
|
*
|
|
* 8/25/89 - Harry. Make disk button into volumes popup. Added source file CustomPopup.aii
|
|
* which contains all the routines to create the popup, track it and
|
|
* keeps popup updated. (i.e. monitors disk switch events).
|
|
* Disk switch event are now handled. (disk inserted becomes current volume and
|
|
* the current volume that is ejected just goes to the next drive).
|
|
* Routine MoveDialogToMemory was modified to handle custom dialogs.
|
|
* Added two new bit definitions to FGetPutFlag (bits 2 and 3 now defined)
|
|
* Fixed bug where in 320 mode the lock icon would not appear in the pathname.
|
|
*
|
|
* 9/14/89 - Harry Added new entry point NextDrive1. This routine is called by CheckDiskSwitch.
|
|
* It is a subset of routine NextDrive. Instead of going to the next drive
|
|
* we just rescan the volume in device <curDev.
|
|
*
|
|
* 10/05/89 - Harry Fix bug in SFReScan. This call does not work in 320 mode. Error $1706 is
|
|
* always returned. The wrong bits were being masked off when making the check
|
|
* to see if it was OK to make the call. We were always masking out the high
|
|
* nibble when all we really wanted was bits 15 and 13 ($A000). Fixed.
|
|
*
|
|
* Fix bug in all the "Save" calls. When an illegal filename was entered by
|
|
* the user they were never notified that it was bad. Instead Std File would
|
|
* just skip to the next volume. Fixed.
|
|
*
|
|
* 11/08/89 - Harry Fix bug in Save dialogs in 320 mode.The volume popup was not being drawn.
|
|
* Fix bug in Custom dialogs that use the volume popup. A check was being
|
|
* made to see if the item descriptor field (of the NextBut item) was zero,
|
|
* if it was then I assumed that the item was a useritem. Now I just check
|
|
* the type of item field to determine whether to use the volume popup or
|
|
* create the "Disk" button.
|
|
*
|
|
* 11/13/89 - Harry Fix BRC #53450. Limited the no. of chars that can be entered into any
|
|
* "SAVE" dialog to 35 (Previous values were 255 in the case of SFPutFile2 and
|
|
* SFPPutFile2. For SFPutFile the limit was whatever the user inputed. This is
|
|
* also limited to 35) Routine GetFilter was calling GetIText with a buffer
|
|
* limit of 36 (therefore anything exceeding this value trashed the stack)
|
|
*
|
|
* The default text for edit line items in "SAVE" dialogs are now selected.
|
|
*
|
|
* 01/02/90 - Harry The fix for no volumes on-line was not complete. There were instances where
|
|
* a disk was being inserted and not recognized. This was a problem in routine
|
|
* GetFirst and has been fixed.
|
|
*
|
|
* 01/15/90 - Harry Take out the volumes popup and put in "Volumes" button that now displays
|
|
* the list of volumes in the file list.
|
|
*
|
|
* 01/17/90 - Harry Fix bug in new "PUT" calls where defining the OrigName as a resource
|
|
* would not work if the middle byte of the resource ID was zero. For some
|
|
* reason the previous author checked the middle byte of the OrigNameRef
|
|
* and if it was zero it would assume the OrigName was null. In the old "PUT"
|
|
* calls it must have been valid to push a 0 ptr as the OrigName to indicate
|
|
* there was none??????
|
|
*
|
|
* 02/13/90 - Harry In the "PUT" dialogs, selecting the "NEWFOLDER" button now puts the user
|
|
* into that newly created directory.
|
|
* 02/14/90 - Harry I now install myself into the OS notification queue. So whenever a disk
|
|
* switch event occurrs I now get called. This makes life much simpler.
|
|
* 02/19/90 - Harry Fixed bug where selecting a folder on a server volume that you didn't have
|
|
* privileges for would advance you to the next volume on-line. WS #MTLRAF009.
|
|
* 02/20/90 - Harry If StdFile encounters a disk that GS/OS does not recognize, an alert is
|
|
* put up and the disk is ejected.
|
|
* 03/01/90 - Harry On AppleShare volumes, folders are now greyed if you do not have access
|
|
* to that folder.(fixed in routine ValidEntry) BRC #60861.
|
|
* 04/04/90 - Harry Fix bug in SFMultiGet2. No matter how many files you selected it would
|
|
* always return 1 as the number of files selected. Introduced in 1/15/90.
|
|
* WorkSheet #MTLRAF015.
|
|
* 04/25/90 - Harry Fix bug in GetFilter routine, which would pass <return> key hits even if
|
|
* the default button was inactive. This only caused problem in PUT dialogs
|
|
* because the <return> would then get passed to edit line items instead.
|
|
* BRC #65378.
|
|
* 04/26/90 - Harry Fixed bug where multiple volumes could be selected in "MULTI" dialogs.
|
|
* Worksheet #MTLRAF020.
|
|
* Fixed bug in routine Convert_To_K. X-reg was suppose to contain the high
|
|
* byte of least significant 32 bit result and low byte of most significant
|
|
* 32 bit result, instead we were getting middle byte of most significant
|
|
* 32 bit result. Worksheet #MTLRAF019.
|
|
* 05/02/90 - Harry If prefix 8 or 0 (depending on whether we were making an old of new call)
|
|
* had a valid filename in it (i.e. not a directory name), StdFile would
|
|
* fail even though there were valid volume names around. Fixed.
|
|
* If an error occurred such that a "generic" error was generated this
|
|
* would cause the stack to become imbalanced. Routine GetErrorMessage was
|
|
* jsr'ed to but would not always rts. Fixed.
|
|
* 06/04/90 - Harry Fixed bug BRC #65271. If an unformatted disk is inserted I now put up
|
|
* a dialog saying GS/OS does recognize this file system and then the disk
|
|
* is ejected. Also fixed BRC #67012, word occurred was misspelled.
|
|
* 06/27/90 - Harry Fix problem with custom dialogs. Patching the user's dialog template causes
|
|
* problems if someone happens to unload std file and then load it again, but
|
|
* at a different memory location. The patched addresses are now no longer
|
|
* valid. (Iduna found bug)
|
|
* 07/26/90 - Harry Re-fix, fix put in on 6/27/90. The wrong item was being unpatched.
|
|
* 08/06/90 - Harry Superfluous error dialog comes up when a 5.25" drive is scanned and there is
|
|
* no disk in it. Fixed (RAF005). In PUT dialogs if the user enters a name
|
|
* with a colon embedded in it std file just goes to the next volume instead
|
|
* of putting up an error message. Fixed (RAF004).
|
|
* The volume list is now sorted alphabetically and selecting the first letter
|
|
* of a file in the list will now select that item in the list (RAF003).
|
|
* The CompareRoutine was modified to also do a sort on the volume list. This
|
|
* change involved the sort routine ignoring the first character of the name
|
|
* which is always a "." or a ":" (since these are volume names).
|
|
*
|
|
* BEGIN 6.0 (???)
|
|
*
|
|
* 18-Nov-90 Dave Lyons
|
|
* Disallowed colons in the edit line field.
|
|
* Prevent Letter-key shortcut from moving to a dimmed item (except possibly
|
|
* the last one).
|
|
* 26-Nov-90 Dave Lyons
|
|
* Now uses ListKey to allow arbitrarily-long prefix strings in Get dialogs.
|
|
* When we set the default text in a Put dialog, now I reverse the
|
|
* selection direction to be right-to-left for the benefit of AWGS 1.1
|
|
* (see comment at ReverseSelection).
|
|
* 4-Dec-90 Dave Lyons
|
|
* Uses ListKey for arrow-key movements, too.
|
|
* 21-Dec-90 Dave Lyons
|
|
* Found and fixed that Really Annoying repeating-entry bug! The problem
|
|
* was we weren't bumping the high word of ListPointerPtr when we added
|
|
* 5 to point at the next entry.
|
|
* (At that point, we were storing *offsets* in the list, which are later
|
|
* translated into pointers. If the handle, which was pre-zeroed, started
|
|
* near the end of a bank, then some of the offsets would get stored in
|
|
* the wrong place. The ones that got "missed" this way stayed 0, so they
|
|
* were translated into pointers to the first item read, and then the whole
|
|
* list got sorted alphabetically.)
|
|
* 6-Jan-91 Dave Lyons
|
|
* Added Apple-D, Apple-V and Apple-ESC as key equivalents for the
|
|
* Volumes button.
|
|
* When you insert a disk & get a duplicate volume error, Std File
|
|
* used to do nothing. Now you get ErrorWindow($57) and it ejects.
|
|
* 12-Jan-91 Dave Lyons
|
|
* Adding a framed down-arrow icon at the left of the path item.
|
|
* Clicking this pops up a menu that lets you move up as many levels
|
|
* as you want, all the way to the Volumes/Desktop level.
|
|
* Fixing key equivalents for Open and Volumes so they honor the
|
|
* inactive status of the corresponding buttons.
|
|
* 14-Jan-91 Dave Lyons
|
|
* Finished the SeeIfItemEnabled routine use by CommonKey so the
|
|
* Open and Volumes key equivalents don't work when the buttons
|
|
* are dimmed.
|
|
* Added a paranoia check on CloseA (never closes refnum 0).
|
|
* Prettied up the source a bit.
|
|
* Padlock icon is now drawn *after* the pathname.
|
|
* All the little icons now come from GetSysIcon & are drawn with
|
|
* DrawIcon.
|
|
* Fixed a bug in CustomPopUp.aii (the Volume List stuff) where
|
|
* having more than 20 volumes would hang. (There was no code
|
|
* to grow the list. Now it handles 64 volumes.)
|
|
* 6-Feb-91 Dave Lyons
|
|
* Added new device number parameter to InsertPathMItems call.
|
|
* 5-Mar-91 Dave Lyons
|
|
* Set bit 30 of the FilterProc pointer in the ModalDialog call, so
|
|
* that the Dialog Manager will automatically track the cursor and
|
|
* make it an I-Beam & Arrow at the right times.
|
|
* 14-Mar-91 Dave Lyons
|
|
* Removed Apple-V = "Volumes" because that usually means Paste.
|
|
* 25-Mar-91 Dave Lyons
|
|
* New routine PollForInsertions calls the GS/OS service to scan
|
|
* removable-media devices for new insertions. I call this before
|
|
* installing the notify-proc, so that old insertions that haven't
|
|
* been noticed yet don't make SF bop to a volume unexpectedly.
|
|
* The filter proc now receives all 17 GetDirEntry parameters, including
|
|
* the option list.
|
|
* When we're not in the volume list, sorting is done with SortList(#1)
|
|
* for international-friendly string comparisons.
|
|
* 28-Mar-91 DAL Preserved an error code in ReDoList.
|
|
* Defined new bit in <FGetPutFlag: PutFileListActive if we're in a
|
|
* PutFile call and keystrokes should be directed to the file list.
|
|
* 29-Mar-91 DAL In custompopup.aii, fixed it so 5.25 drives are always added to the
|
|
* don't-poll list, even if they seem to be offline.
|
|
* 1-Apr-91 DAL Replaced call to DO_INSERT_SCAN with Misc Tools call ScanDevices.
|
|
* Finished the type-keys-into-the-PutFile-list stuff. Apple-Tab
|
|
* switches you between the edit-line and the list; clicking on either
|
|
* item makes that the "target".
|
|
* 2-Apr-91 DAL Added JudgeTheName routine to call JudgeName and put up an
|
|
* AlertWindow. Called from DoSave and DoCreate.
|
|
* 7-Apr-91 DAL At Common2, added code to load and start QDAux if it isn't started.
|
|
* Defined new error sfNotStarted, $17FF; most calls check for WAP<>0.
|
|
* SFStartUp returns the error if you pass WAP=0.
|
|
* 15-Apr-91 DAL Now calls HandleDiskInsert to do disk formatting/erasing.
|
|
* 21-Apr-91 DAL For error $57 (duplicate volume), call HandleDiskInsert.
|
|
* 8-May-91 DAL Added an InitCursor before the ErrorWindow for Replace/etc dialogs.
|
|
* 10-Jun-91 DAL ¥Added check before NewModalDialog to see if both prefixes 0 and 8
|
|
* are null, and set 0 to "*:" if they are. Avoids infinite loop!
|
|
* ¥Swapped Tab and Apple-Tab. Tab goes between target controls, and
|
|
* Apple-Tab switches volumes.
|
|
* ¥Moved list control up one pixel for Put dialogs.
|
|
* 8-Jul-91 DAL
|
|
* ¥When tabbing to the Edit Line in a put file, we now select the text.
|
|
* 31-Jul-91 DAL
|
|
* ¥Experimentally removed restriction on when you can call SFReScan.
|
|
* Should always work now.
|
|
* 10-Aug-91 DAL
|
|
* ¥Use substitution string for "No Change" in bad-name dialog.
|
|
* 26-Aug-91 DAL
|
|
* ¥Standard Draw routine checks for 640 mode & an odd window position;
|
|
* if needed, it draws the GetSysIcon icon at an odd local coordinate
|
|
* to make the colors come out right.
|
|
* 3-Sep-91 DAL
|
|
* ¥JudgeName dialog now calls InitCursor.
|
|
* 15-Sep-91 DAL
|
|
* ¥Fix the 26-Aug fix, I need to check the pen position, too. No
|
|
* more green folders. Really, this time!
|
|
* ¥DoUnPatch was not working right (at least not in all cases) becuase
|
|
* it thought it was working with the user's original dialog template,
|
|
* when it was actually working with a template computed from the
|
|
* original (by MoveDialogToMemory), where the items were in a confusing
|
|
* order. Added OrigDialogTempPtr so I can unpatch correctly.
|
|
* ¥Fixed the "inifinite please format your HFS partition problem" by
|
|
* marking non-removable devices as don't-poll, even in the case that
|
|
* the Volume call fails.
|
|
* 21-Oct-91 DAL
|
|
* ¥Avoid constantly flickering the cursor: focus frame update only for
|
|
* my own update events, not for any pending update event.
|
|
* 1-Nov-91 DAL
|
|
* ¥In VerbCheck, verify the SF2-style Reply Record only if it's not a
|
|
* SFMultiGet2 call! This was causing occasional flakey $1705 errors
|
|
* for some folks (or at least for Bryan P at Softdisk). It was trying
|
|
* to validate fields that were beyond the end of the 6-byte multi reply
|
|
* record.
|
|
* 18-Dec-91 DAL
|
|
* ¥Added FunkyPutFile bit--special handling for PutFile dialogs with
|
|
* the Line Edit box outside the window (always direct keys to the list,
|
|
* but never draw the focus frame around the list). Also, don't fudge
|
|
* the List upwards by a pixel when it's a FunkyPutFile.
|
|
* ¥JudgeTheName does not rely on FrontWindow to get the dialog ptr
|
|
* (because Bryan P has already hidden the window!).
|
|
* ¥In DoPathDraw, now we set the clip region so we don't draw outside
|
|
* the path item rectangle.
|
|
* ¥DoPathDraw now stores the right edge of what we drew, and DoPath
|
|
* ignores any clicks to the right of this position.
|
|
* ¥SFRescan takes no action if you're at the Volumes list (no error).
|
|
* ¥Up and Down arrows in PutFile volume list now update the K free/used
|
|
* for the correct disk.
|
|
* 29-Jan-92 DAL (for 6.0d68)
|
|
* ¥Fixed convert_time to respect the 1940..2039 definition of a class-0
|
|
* date value (out-of-range dates are returned as all-zero date/time).
|
|
* ¥Mess with sys prefs around GetDevNumber in GetThePrefix, to avoid
|
|
* prompting for offline disk (if the prefix happens to be set to one).
|
|
* ¥If we get an error building the file list, now we call ErrorWindow,
|
|
* and then try again with the root level of the boot volume.
|
|
* 6-Feb-92 DAL (for 6.0d70)
|
|
* ¥Drawing the padlock in the path item adjusts the pen position so it
|
|
* won't get overwritten by the file system text.
|
|
* ¥You can click on the FST name to pop down the path menu (moved one
|
|
* line).
|
|
*
|
|
****************************************************************************************
|
|
*
|
|
* BEGIN 6.0.1
|
|
*
|
|
* 17-Feb-92 DAL
|
|
* ¥Make Command-left and Command-right cycle volumes?
|
|
*
|
|
* 5-Mar-92 DAL (for 6.1d2)
|
|
* ¥Change Long2Dec calls to set bit 31 of stringPtr for "zero K"
|
|
* (net savings of 31 bytes by consolidating into Long2DecTen)
|
|
*
|
|
* 16-Mar-92 DAL
|
|
* ¥Regular item-draw uses DrawStringWidth instead of manually
|
|
* setting charExtra.
|
|
*
|
|
* 25-Mar-92 DAL
|
|
* ¥Updated messages to read "Disks" instead of "Volumes".
|
|
*
|
|
* 27-Apr-92 DAL
|
|
* ¥Volume name comparison in NextDrive is now case-insensitive.
|
|
*
|
|
* 5-Oct-92 DAL
|
|
* ¥Passes real auxiliary type to GetSysIcon (was always passing zero).
|
|
*
|
|
* 17-19-Mar-93 SS
|
|
* ¥Fixed SFReScan to update _all_ controls when called.
|
|
* ¥Added key equivalent: Cmd-Shift-Up = Cmd-D = hit in Disks button.
|
|
* ¥Added key equivalent: Cmd-Rt-Arrow = Cmd-Tab = fwd to next drive.
|
|
* ¥Added new key support: Cmd-Lt-Arrow = backward to previous drive.
|
|
* Defined new bit in <FGetPutFlag: TabBackwards for NextDrive to know
|
|
* which direction to go through the devices. Set = go backwards (duh!).
|
|
* ¥Added a content draw proc to update the dlg window if something moves
|
|
* across in front.
|
|
* ¥Added call to UpdateWindow to attempt to update windows behind us.
|
|
* ¥Made several changes to try to handle multiple editlines in PutFile.
|
|
* Un-hard-coded references to Item#10 (previously the only editline).
|
|
* Added a fake off-screen editline item #8 to represent the List.
|
|
*
|
|
* 22-Mar-93 SS
|
|
* ¥Fixed PromptDesc error check in VerbCheck. A 'BadVerbPrompt' error
|
|
* was never being reported! This also allowed removing several occurances
|
|
* of 'and #3' that are no longer needed after the range checking is done.
|
|
* Need a reminder in the doc that PromptRefDesc >3 is invalid.
|
|
* 23-Mar-93 SS
|
|
* ¥Added remainder of code to support multiple edit lines in PutFile.
|
|
* 25-Mar-93 SS
|
|
* ¥Made SFReScan work in the volume list (as well as the file list).
|
|
*
|
|
* 2-Apr-93 SS
|
|
* ¥Fixed DoExit - it was not properly releasing the prompt if it was a resource.
|
|
*
|
|
* 6-May-93 DAL/SS ¥Changed NextDrive1 to avoid an infinite loop if Seperator (sic) was not set
|
|
* up yet. This happened if prefix 0 was empty on an SFGetFile call.
|
|
*
|
|
*****************************************************************************************
|
|
|
|
print push
|
|
print off
|
|
|
|
INCLUDE 'all.macros'
|
|
Include 'Dave.Macros'
|
|
INCLUDE 'E16.Event'
|
|
INCLUDE 'E16.Dialog'
|
|
INCLUDE 'E16.List'
|
|
INCLUDE 'E16.Menu'
|
|
INCLUDE 'E16.Control'
|
|
INCLUDE '::sys.equs.asm'
|
|
|
|
print pop
|
|
string asis
|
|
|
|
ENTRY DerefandLock
|
|
ENTRY SaveAndZeroRefCons
|
|
ENTRY GetLocInfo
|
|
|
|
ENTRY BuildList
|
|
ENTRY GetFirst
|
|
ENTRY DirectoryUp
|
|
ENTRY DirectoryDown
|
|
ENTRY ReadDirSize
|
|
ENTRY GetNewHandle
|
|
ENTRY GetSmallHandle
|
|
ENTRY KillHandle
|
|
ENTRY ExtendHandle
|
|
ENTRY GetThePrefix
|
|
ENTRY OpenPrefix
|
|
ENTRY ClosePrefix
|
|
ENTRY SetThePrefix
|
|
ENTRY CloseA
|
|
ENTRY ReadNextDirEntry
|
|
ENTRY PathDraw
|
|
ENTRY DoPathDraw
|
|
ENTRY GetSelected
|
|
ENTRY DoDInfoCall
|
|
ENTRY PutAdjust
|
|
ENTRY CommonOpen
|
|
ENTRY DeRefHandle
|
|
ENTRY MoveDialogToMemory
|
|
ENTRY KillPointer
|
|
|
|
|
|
INCLUDE 'GlobalEqu.aii'
|
|
**********************************************************************
|
|
* Dialog Record files
|
|
**********************************************************************
|
|
INCLUDE 'Dialogs.aii'
|
|
INCLUDE 'CustomPopUp.aii'
|
|
|
|
SFGet PROC
|
|
EXPORT SFGetFile2
|
|
EXPORT SFGetFile
|
|
EXPORT SFPGetFile2
|
|
EXPORT SFPGetFile
|
|
EXPORT SFMultiGet2
|
|
EXPORT SFPMultiGet2
|
|
rtl
|
|
**********************************************************************
|
|
*
|
|
* StdGetFile
|
|
*
|
|
* Entry to Get.
|
|
*
|
|
* The stack: Different for each entry point.
|
|
*
|
|
* This is the define stack for SFGetFile2
|
|
*
|
|
**********************************************************************
|
|
DefineStack
|
|
origD word
|
|
origB byte ;reserve word on stack
|
|
Rtl1 block 3 ;(like r long but adds space for 3 bytes)
|
|
Rtl2 block 3
|
|
|
|
SGReplyPtr2 long ;POINTER to a reply record (see calling routine for def).
|
|
SGTypeListPtr2 long ;POINTER to typelist record; NIL to display all files.
|
|
SGFilterProcPtr2 long ;POINTER to filter procedure; NIL for none.
|
|
SGPromptPtr2 long ;POINTER to string to display at top of dialog.
|
|
SGPromptVerb2 word ;Prompt string verb.
|
|
SGWhereY2 word ;Y corrdinate of upper left corner.
|
|
SGWhereX2 word ;X coordinate of upper left corner.
|
|
SGStack2 equ DummyPC-10 ;stack size
|
|
*
|
|
* The folowing is the define stack for SFPGetFile2
|
|
*
|
|
DSect 10
|
|
SGReplyPtrP2 long ;POINTER to a reply record (see calling routine for def).
|
|
SGDilgHookPtrP2 long ;POINTER to a routine called every time ModalDialog returns a hit
|
|
SGDilgPtrP2 long ;POINTER to a dialog template in memory.
|
|
SGTypeListPtrP2 long ;POINTER to typelist record; NIL to display all files.
|
|
SGFilterProcPtrP2 long ;POINTER to filter procedure; NIL for none.
|
|
SGPromptPtrP2 long ;POINTER to string to display at top of dialog.
|
|
SGPromptVerbP2 word ;Prompt string verb.
|
|
SGItemDrawPtrP2 long ;POINTER to a list member draw routine.
|
|
SGWhereYP2 word ;Y corrdinate of upper left corner.
|
|
SGWhereXP2 word ;X coordinate of upper left corner.
|
|
SGPStack2 equ DummyPC-10 ;stack size
|
|
|
|
*
|
|
* This is the define stack for the old SFGetFile
|
|
*
|
|
DSect 10
|
|
SGReplyPtr long ;POINTER to a reply record (see calling routine for def).
|
|
SGTypeListPtr long ;POINTER to typelist record; NIL to display all files.
|
|
SGFilterProcPtr long ;POINTER to filter procedure; NIL for none.
|
|
SGPromptPtr long ;POINTER to string to display at top of dialog.
|
|
SGWhereY word ;Y corrdinate of upper left corner.
|
|
SGWhereX word ;X coordinate of upper left corner.
|
|
SGStack equ DummyPC-10 ;stack size
|
|
*
|
|
* The folowing is the define stack for the old SFPGetFile
|
|
*
|
|
DSect 10
|
|
SGReplyPtrP long ;POINTER to a reply record (see calling routine for def).
|
|
SGDilgHookPtrP long ;POINTER to a routine called every time ModalDialog returns a hit
|
|
SGDilgPtrP long ;POINTER to a dialog template in memory.
|
|
SGTypeListPtrP long ;POINTER to typelist record; NIL to display all files.
|
|
SGFilterProcPtrP long ;POINTER to filter procedure; NIL for none.
|
|
SGPromptPtrP long ;POINTER to string to display at top of dialog.
|
|
SGWhereYP word ;Y corrdinate of upper left corner.
|
|
SGWhereXP word ;X coordinate of upper left corner.
|
|
SGPStack equ DummyPC-10 ;stack size
|
|
*
|
|
* Exit: Errors returned in A, carry set.
|
|
* The stack: empty.
|
|
*
|
|
**********************************************************************
|
|
*
|
|
* Entry SFMultiGet2
|
|
*
|
|
SFMultiGet2 phd ; Save Direct Page Register.
|
|
tcd ; Put ours.
|
|
phb ; Save Data Bank register.
|
|
phk ; Put ours.
|
|
plb
|
|
lda #MultiFileMode
|
|
bra GetFile2
|
|
|
|
**********************************************************************
|
|
*
|
|
* Entry for SFGetFile2
|
|
*
|
|
SFGetFile2 phd ; Save Direct Page Register.
|
|
tcd ; Put ours.
|
|
phb ; Save Data Bank register.
|
|
phk ; Put ours.
|
|
plb
|
|
lda #0000 ;GET, NEW
|
|
GetFile2
|
|
sta ztemp1 ;flags here
|
|
jsr reset_vars
|
|
*
|
|
* Move all incomming parameters off the stack and into zero-page.
|
|
*
|
|
lda SGReplyPtr2,s ; Transfer parameters on
|
|
sta ReplyPtr ; the stack to zero-page.
|
|
lda SGReplyPtr2+2,s
|
|
sta ReplyPtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SGTypeListPtr2,s
|
|
sta TypeList
|
|
lda SGTypeListPtr2+2,s
|
|
sta TypeList+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SGFilterProcPtr2,s
|
|
sta FilterProcPtr
|
|
lda SGFilterProcPtr2+2,s
|
|
sta FilterProcPtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SGPromptVerb2,s
|
|
sta PromptVerb
|
|
lda SGPromptPtr2,s
|
|
sta PromptPtr
|
|
lda SGPromptPtr2+2,s
|
|
sta PromptPtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SGWhereX2,s
|
|
sta WhereX
|
|
lda SGWhereY2,s
|
|
sta WhereY
|
|
|
|
lda #SGStack2 ;stack size
|
|
sta stacksize ;bytes need removing
|
|
|
|
brl common
|
|
|
|
|
|
**********************************************************************
|
|
*
|
|
* Entry SFPMultiGet2
|
|
*
|
|
SFPMultiGet2
|
|
phd ; Save Direct Page Register.
|
|
tcd ; Put ours.
|
|
phb ; Save Data Bank register.
|
|
phk ; Put ours.
|
|
plb
|
|
lda #PatchedFlag+MultiFIleMode
|
|
bra PGetFile2
|
|
|
|
**********************************************************************
|
|
*
|
|
* Entry for SFPGetFile2
|
|
*
|
|
SFPGetFile2 phd ; Save Direct Page Register.
|
|
tcd ; Put ours.
|
|
phb ; Save Data Bank register.
|
|
phk ; Put ours.
|
|
plb
|
|
lda #PatchedFlag ;GET, NEW
|
|
PGetFile2
|
|
sta ztemp1 ;flags here
|
|
jsr reset_vars
|
|
|
|
lda SGReplyPtrP2,s ; Transfer parameters on
|
|
sta ReplyPtr ; the stack to zero-page.
|
|
lda SGReplyPtrP2+2,s
|
|
sta ReplyPtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SGDilgHookPtrP2,s ; Transfer parameters on
|
|
sta DilgHook ; the stack to zero-page.
|
|
lda SGDilgHookPtrP2+2,s
|
|
sta DilgHook+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SGDilgPtrP2,s ; Transfer parameters on
|
|
sta DialogTemplatePtr ; the stack to zero-page.
|
|
lda SGDilgPtrP2+2,s
|
|
sta DialogTemplatePtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SGTypeListPtrP2,s
|
|
sta TypeList
|
|
lda SGTypeListPtrP2+2,s
|
|
sta TypeList+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SGFilterProcPtrP2,s
|
|
sta FilterProcPtr
|
|
lda SGFilterProcPtrP2+2,s
|
|
sta FilterProcPtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SGPromptVerbP2,s
|
|
sta PromptVerb
|
|
lda SGPromptPtrP2,s
|
|
sta PromptPtr
|
|
lda SGPromptPtrP2+2,s
|
|
sta PromptPtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SGItemDrawPtrP2,s
|
|
sta IconHookPtr
|
|
lda SGItemDrawPtrP2+2,s
|
|
sta IconHookPtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SGWhereXP2,s
|
|
sta WhereX
|
|
lda SGWhereYP2,s
|
|
sta WhereY
|
|
|
|
lda #SGPStack2 ;stack size
|
|
sta stacksize ;34 bytes need removing
|
|
|
|
brl common
|
|
SFGetFile
|
|
**********************************************************************
|
|
*
|
|
* Entry for SFGetFile
|
|
*
|
|
**********************************************************************
|
|
phd ; Save Direct Page Register.
|
|
tcd ; Put ours.
|
|
phb ; Save Data Bank register.
|
|
phk ; Put ours.
|
|
plb
|
|
|
|
jsr reset_vars
|
|
|
|
*
|
|
* Move all incomming parameters off the stack and into zero-page.
|
|
*
|
|
lda SGReplyPtr,s ; Transfer parameters on
|
|
sta ReplyPtr ; the stack to zero-page.
|
|
lda SGReplyPtr+2,s
|
|
sta ReplyPtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SGTypeListPtr,s
|
|
sta TypeList
|
|
lda SGTypeListPtr+2,s
|
|
sta TypeList+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SGFilterProcPtr,s
|
|
sta FilterProcPtr
|
|
lda SGFilterProcPtr+2,s
|
|
sta FilterProcPtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SGPromptPtr,s
|
|
sta PromptPtr
|
|
lda SGPromptPtr+2,s
|
|
sta PromptPtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SGWhereX,s
|
|
sta WhereX
|
|
lda SGWhereY,s
|
|
sta WhereY
|
|
|
|
lda #SGStack ;stack size
|
|
sta stacksize ;20 bytes need removing
|
|
|
|
lda #OldStyleFlag ;OLD GET
|
|
brl common2
|
|
|
|
SFPGetFile
|
|
**********************************************************************
|
|
*
|
|
* Entry for SFPGetFile
|
|
*
|
|
**********************************************************************
|
|
phd ; Save Direct Page Register.
|
|
tcd ; Put ours.
|
|
phb ; Save Data Bank register.
|
|
phk ; Put ours.
|
|
plb
|
|
|
|
jsr reset_vars
|
|
|
|
lda SGReplyPtrP,s ; Transfer parameters on
|
|
sta ReplyPtr ; the stack to zero-page.
|
|
lda SGReplyPtrP+2,s
|
|
sta ReplyPtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SGDilgHookPtrP,s ; Transfer parameters on
|
|
sta DilgHook ; the stack to zero-page.
|
|
lda SGDilgHookPtrP+2,s
|
|
sta DilgHook+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SGDilgPtrP,s ; Transfer parameters on
|
|
sta DialogTemplatePtr ; the stack to zero-page.
|
|
lda SGDilgPtrP+2,s
|
|
sta DialogTemplatePtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SGTypeListPtrP,s
|
|
sta TypeList
|
|
lda SGTypeListPtrP+2,s
|
|
sta TypeList+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SGFilterProcPtrP,s
|
|
sta FilterProcPtr
|
|
lda SGFilterProcPtrP+2,s
|
|
sta FilterProcPtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SGPromptPtrP,s
|
|
sta PromptPtr
|
|
lda SGPromptPtrP+2,s
|
|
sta PromptPtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SGWhereXP,s
|
|
sta WhereX
|
|
lda SGWhereYP,s
|
|
sta WhereY
|
|
|
|
lda #SGPStack ;stack size
|
|
sta stacksize ;28 bytes need removing
|
|
lda #PatchedFlag+OldStyleFlag ;OLD GET, Custom dialog
|
|
brl common2
|
|
|
|
ENDP
|
|
|
|
|
|
SFReScan2 PROC EXPORT
|
|
*
|
|
* The folowing is the define stack for the old SFReScan2 entry
|
|
DSect 10
|
|
SRTypeListPtr long ;POINTER to typelist record; NIL to display all files.
|
|
SRFilterProcPtr long ;POINTER to filter procedure; NIL for none.
|
|
SFRStack equ DummyPC-10 ;stack size
|
|
|
|
**********************************************************************
|
|
*
|
|
* Entry for SFReScan2
|
|
*
|
|
**********************************************************************
|
|
phd ; Save Direct Page Register.
|
|
tcd ; Put ours.
|
|
phb ; Save Data Bank register.
|
|
phk ; Put ours.
|
|
plb
|
|
*--------------------------------------------------------------------------------
|
|
|
|
*** let it happen at the volume level also 25-Mar-93 SS
|
|
;*** added 18-Dec-91 DAL -- If we're at the Volume level, do nothing
|
|
; lda FGetPutFlag
|
|
; and #inVolumeList
|
|
; bne @exit
|
|
|
|
*** 31-Jul-91 DAL -- Remove restrictions and see if this works for everything
|
|
; lda FGetPutFlag
|
|
; and #$A000 ;only necessary bits 15 and 13. HY 10/5/89
|
|
; cmp #$2000 ;patched gets only
|
|
; beq @1 ;not ok
|
|
; ldx #$1706 ;bad call error
|
|
; ldy #SFRStack ;stack size
|
|
; brl ErrorEscape2 ;good bye!
|
|
*--------------------------------------------------------------------------------
|
|
@1
|
|
lda SRTypeListPtr+1,s ;zero?
|
|
beq @2
|
|
lda SRTypeListPtr,s
|
|
sta TypeList
|
|
lda SRTypeListPtr+2,s
|
|
sta TypeList+2
|
|
*--------------------------------------------------------------------------------
|
|
@2
|
|
lda SRFilterProcPtr+1,s
|
|
beq @3
|
|
lda SRFilterProcPtr,s
|
|
sta FilterProcPtr
|
|
lda SRFilterProcPtr+2,s
|
|
sta FilterProcPtr+2
|
|
*--------------------------------------------------------------------------------
|
|
@3
|
|
*** Added to force all controls to update in case pfx8 is on another drive. 17-Mar-93 SS
|
|
lda #8
|
|
jsr GetThePrefix
|
|
jsr DoDInfoCall
|
|
jsr DoVolumeCall
|
|
lda FGetPutFlag
|
|
bit #PutFlag
|
|
beq @inGet
|
|
|
|
PushZLong DialogPtr
|
|
_SetPort ;make sure the port is set.
|
|
PushZLong DialogPtr
|
|
PushWord #11 ;kbFreeStr item
|
|
PushZPtr tempRect
|
|
_GetDItemBox
|
|
PushZPtr tempRect
|
|
_InvalRect ;rect is invalid and should redraw
|
|
@inGet
|
|
*** end 17-Mar-93 SS
|
|
lda #$8000
|
|
sta FRedraw
|
|
|
|
@exit ldx #0000
|
|
ldy #SFRStack ;stack size
|
|
brl ErrorEscape2 ;and leave
|
|
|
|
ENDP
|
|
|
|
|
|
|
|
SFPutFile2 PROC EXPORT
|
|
EXPORT SFPutFile
|
|
EXPORT SFPPutFile
|
|
EXPORT SFPPutFile2
|
|
**********************************************************************
|
|
*
|
|
* StdPutFile entries: SFPutFile, SFPPutFile, SFPutFile2, SFPPutFile2
|
|
*
|
|
* Entry to Put.
|
|
* The stack: Different for each entry point
|
|
*
|
|
* This is the define stack for SFPutFile2
|
|
*
|
|
**********************************************************************
|
|
DefineStack
|
|
origD word
|
|
origB byte ;reserve word on stack
|
|
Rtl1 block 3 ;(like r long but adds space for 3 bytes)
|
|
Rtl2 block 3
|
|
SReplyPtr2 long ;POINTER to a reply record (see calling routine for def).
|
|
SorigNamePtr2 long ;POINTER to string that holds default name for text edit field.
|
|
SorigNameVerb2 word ;Default name string verb.
|
|
SPromptPtr2 long ;POINTER to prompt string.
|
|
SPromptVerb2 word ;Prompt string verb.
|
|
SWhereY2 word ;Y corrdinate of upper left corner.
|
|
SWhereX2 word ;X coordinate of upper left corner.
|
|
SPStack2 equ DummyPC-10 ;stack size
|
|
*
|
|
*
|
|
* This is the define stack for SFPPutFile2
|
|
*
|
|
DSect 10
|
|
SReplyPtrP2 long ;POINTER to a reply record (see calling routine for def).
|
|
SDilgHookPtrP2 long ;POINTER to a routine called every time ModalDialog returns a hit
|
|
SDilgPtrP2 long ;POINTER to a dialog template in memory.
|
|
SorigNamePtrP2 long ;POINTER to string that holds default name for text edit field.
|
|
SorigNameVerbP2 word ;Default name string verb.
|
|
SPromptPtrP2 long ;POINTER to prompt string.
|
|
SPromptVerbP2 word ;Prompt string verb.
|
|
SPItemDrawPtrP2 long ;POINTER to a list member draw routine.
|
|
SWhereYP2 word ;Y corrdinate of upper left corner.
|
|
SWhereXP2 word ;X coordinate of upper left corner.
|
|
SPStackP2 equ DummyPC-10 ;stack size
|
|
*
|
|
*
|
|
* This is the define stack for the old SFPutFile
|
|
*
|
|
DSect 10
|
|
SReplyPtr long
|
|
SMaxLen word ;max length user may type
|
|
SorigNamePtr long
|
|
SPromptPtr long
|
|
SWhereY word
|
|
SWhereX word
|
|
SPStack equ DummyPC-10 ;stack size
|
|
*
|
|
*
|
|
* This is the define stack for the old SFPPutFile
|
|
*
|
|
DSect 10
|
|
SReplyPtrP long ;POINTER to a reply record (see calling routine for def).
|
|
SDilgHookPtrP long ;POINTER to a routine called every time ModalDialog returns a hit
|
|
SDilgPtrP long ;POINTER to a dialog template in memory.
|
|
SMaxLenP word ;max length user may type
|
|
SorigNamePtrP long
|
|
SPromptPtrP long
|
|
SWhereYP word
|
|
SWhereXP word
|
|
SPStackP equ DummyPC-10 ;stack size
|
|
*
|
|
*
|
|
* Exit: Errors returned in A, carry set.
|
|
*
|
|
* The stack: empty.
|
|
*
|
|
**********************************************************************
|
|
*
|
|
* entry for SFPutFile2
|
|
*
|
|
phd ; Save Direct Page Register.
|
|
tcd ; Put ours.
|
|
phb ; Save Data Bank register.
|
|
phk ; Put ours.
|
|
plb
|
|
|
|
jsr reset_vars
|
|
*
|
|
* Move all incomming parameters off the stack and into zero-page.
|
|
*
|
|
lda SReplyPtr2,s ; Transfer parameters on
|
|
sta ReplyPtr ; the stack to zero-page.
|
|
lda SReplyPtr2+2,s
|
|
sta ReplyPtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SorigNameVerb2,s
|
|
sta OrigNameVerb
|
|
lda SorigNamePtr2,s
|
|
sta OrigName
|
|
lda SorigNamePtr2+2,s ;can use typlist here.
|
|
sta OrigName+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SPromptVerb2,s
|
|
sta PromptVerb
|
|
lda SPromptPtr2,s
|
|
sta PromptPtr
|
|
lda SPromptPtr2+2,s
|
|
sta PromptPtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda #32 ;real long names ok
|
|
sta MaxLen ;no max len passed here
|
|
*--------------------------------------------------------------------------------
|
|
lda SWhereX2,s
|
|
sta WhereX
|
|
lda SWhereY2,s
|
|
sta WhereY
|
|
|
|
lda #SPStack2 ;stack size
|
|
sta stacksize ;24 bytes need removing
|
|
|
|
lda #PutFlag ;PUT
|
|
brl common2
|
|
|
|
*
|
|
* entry for SFPPutFile2
|
|
*
|
|
SFPPutFile2 phd ; Save Direct Page Register.
|
|
tcd ; Put ours.
|
|
phb ; Save Data Bank register.
|
|
phk ; Put ours.
|
|
plb
|
|
|
|
jsr reset_vars
|
|
|
|
*
|
|
* Move all incomming parameters off the stack and into zero-page.
|
|
*
|
|
lda SReplyPtrP2,s ; Transfer parameters on
|
|
sta ReplyPtr ; the stack to zero-page.
|
|
lda SReplyPtrP2+2,s
|
|
sta ReplyPtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SDilgHookPtrP2,s ; Transfer parameters on
|
|
sta DilgHook ; the stack to zero-page.
|
|
lda SDilgHookPtrP2+2,s
|
|
sta DilgHook+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SDilgPtrP2,s ; Transfer parameters on
|
|
sta DialogTemplatePtr ; the stack to zero-page.
|
|
lda SDilgPtrP2+2,s
|
|
sta DialogTemplatePtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SorigNameVerbP2,s
|
|
sta OrigNameVerb
|
|
lda SorigNamePtrP2,s
|
|
sta OrigName
|
|
lda SorigNamePtrP2+2,s
|
|
sta OrigName+2
|
|
*--------------------------------------------------------------------------------
|
|
lda #32 ;real long names ok
|
|
sta MaxLen ;no max len passed here
|
|
*--------------------------------------------------------------------------------
|
|
lda SPromptVerbP2,s
|
|
sta PromptVerb
|
|
lda SPromptPtrP2,s
|
|
sta PromptPtr
|
|
lda SPromptPtrP2+2,s
|
|
sta PromptPtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SPItemDrawPtrP2,s
|
|
sta IconHookPtr
|
|
lda SPItemDrawPtrP2+2,s
|
|
sta IconHookPtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SWhereXP2,s
|
|
sta WhereX
|
|
lda SWhereYP2,s
|
|
sta WhereY
|
|
*--------------------------------------------------------------------------------
|
|
lda #SPStackP2
|
|
sta stacksize ;33 bytes need removing
|
|
|
|
lda #PutFlag+PatchedFlag ;PUT, Custom dialog (#$A000)
|
|
brl common2
|
|
|
|
SFPutFile
|
|
*
|
|
* entry for original SFPutFile
|
|
*
|
|
phd ; Save Direct Page Register.
|
|
tcd ; Put ours.
|
|
phb ; Save Data Bank register.
|
|
phk ; Put ours.
|
|
plb
|
|
|
|
jsr reset_vars
|
|
|
|
*
|
|
* Move all incomming parameters off the stack and into zero-page.
|
|
*
|
|
lda SReplyPtr,s ; Transfer parameters on
|
|
sta ReplyPtr ; the stack to zero-page.
|
|
lda SReplyPtr+2,s
|
|
sta ReplyPtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SMaxLen,s
|
|
cmp #33 ; make sure that max chars. that can be
|
|
bcc StoreIt ; entered into edit line item does not
|
|
lda #32 ; exceed 36.
|
|
StoreIt sta MaxLen
|
|
*--------------------------------------------------------------------------------
|
|
lda SorigNamePtr,s
|
|
sta OrigName
|
|
lda SorigNamePtr+2,s ;can use typlist here.
|
|
sta OrigName+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SPromptPtr,s
|
|
sta PromptPtr
|
|
lda SPromptPtr+2,s
|
|
sta PromptPtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SWhereX,s
|
|
sta WhereX
|
|
lda SWhereY,s
|
|
sta WhereY
|
|
|
|
lda #SPStack
|
|
sta stacksize ;18 bytes need removing
|
|
|
|
lda #PutFlag+OldSTyleFlag ;PUT, OLD (#$8001)
|
|
bra common2
|
|
|
|
*
|
|
* entry for SFPPutFile
|
|
*
|
|
SFPPutFile
|
|
phd ; Save Direct Page Register.
|
|
tcd ; Put ours.
|
|
phb ; Save Data Bank register.
|
|
phk ; Put ours.
|
|
plb
|
|
|
|
jsr reset_vars
|
|
|
|
*
|
|
* Move all incomming parameters off the stack and into zero-page.
|
|
*
|
|
lda SReplyPtrP,s ; Transfer parameters on
|
|
sta ReplyPtr ; the stack to zero-page.
|
|
lda SReplyPtrP+2,s
|
|
sta ReplyPtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SDilgHookPtrP,s ; Transfer parameters on
|
|
sta DilgHook ; the stack to zero-page.
|
|
lda SDilgHookPtrP+2,s
|
|
sta DilgHook+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SDilgPtrP,s ; Transfer parameters on
|
|
sta DialogTemplatePtr ; the stack to zero-page.
|
|
lda SDilgPtrP+2,s
|
|
sta DialogTemplatePtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SMaxLenP,s
|
|
cmp #33
|
|
bcc @StoreIt
|
|
lda #32
|
|
@StoreIt sta MaxLen
|
|
*--------------------------------------------------------------------------------
|
|
lda SorigNamePtrP,s
|
|
sta OrigName
|
|
lda SorigNamePtrP+2,s ;can use typlist here.
|
|
sta OrigName+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SPromptPtrP,s
|
|
sta PromptPtr
|
|
lda SPromptPtrP+2,s
|
|
sta PromptPtr+2
|
|
*--------------------------------------------------------------------------------
|
|
lda SWhereXP,s
|
|
sta WhereX
|
|
lda SWhereYP,s
|
|
sta WhereY
|
|
|
|
lda #SPStackP
|
|
sta stacksize ;26 bytes need removing
|
|
|
|
lda #PutFlag+PatchedFlag+OldStyleFlag ;#$A001 ;PUT, OLD, Custom dialog
|
|
bra common2 ;safe way to fall through
|
|
ENDP
|
|
|
|
|
|
**********************************************************************
|
|
*
|
|
* Common point for all of above entries. A = FGetPutFlag value.
|
|
*
|
|
**********************************************************************
|
|
common PROC EXPORT
|
|
EXPORT common2
|
|
EXPORT ErrorEscape
|
|
EXPORT ErrorEscape2
|
|
EXPORT Main_Exit
|
|
|
|
lda ztemp1 ;temp storage for flags
|
|
common2
|
|
sta FGetPutFlag ;Flags
|
|
sta closeButStat ;a state it can't be
|
|
sta saveButStat ;another impossible state!
|
|
stz CurError ;No error (so far!!)
|
|
lsr a ;old style call in d0 now in carry
|
|
bcs @1 ;no error check in verbs in old calls
|
|
jsr VerbCheck ;check verbs on new calls
|
|
bcc @1 ;no errors
|
|
sta CurError ;what error
|
|
tax ;ErrorEscape need this in x
|
|
brl ErrorEscape ;and leave quickly
|
|
@1
|
|
|
|
*** added 7-Apr-91 DAL -- make sure we're actually started up!
|
|
*** (If we're not, we already trashed some zero page, but tough shit.)
|
|
tdc
|
|
bne @started
|
|
ldx #sfNotStarted
|
|
brl ErrorEscape
|
|
@started
|
|
*** end of 7-Apr-91 DAL
|
|
|
|
*** added 7-Apr-91 DAL -- make sure QD Aux is available!
|
|
pea 0
|
|
_QDAuxStatus
|
|
pla
|
|
bne @gotQDAux
|
|
|
|
pea $0012 ;QuickDraw II Auxiliary
|
|
pea $0304 ;minimum QDAux version $0304
|
|
_LoadOneTool
|
|
bcc @loadedQDAux
|
|
tax
|
|
brl ErrorEscape
|
|
@loadedQDAux _QDAuxStartUp
|
|
@gotQDAux
|
|
*** end of 7-Apr-91 DAL
|
|
|
|
PushLongSpace
|
|
_GetPort
|
|
*******************will leave this on the stack and remove it later*********
|
|
*
|
|
* Now allocate most of the needed memory
|
|
*
|
|
* get a zero length handle (gets killed and reallocated upon first entry to BuildList
|
|
* but I needed something for BuildLIst to be able to kill.
|
|
*
|
|
lda #0
|
|
jsr GetSmallHandle
|
|
bcc No_memError
|
|
Mem_Error_brl
|
|
brl Main_Exit ;a place to branch (will save error)
|
|
No_memError
|
|
stax ListPointerHandle
|
|
*
|
|
* Allocate a parameter buffer in memory to save the current working prefix
|
|
*
|
|
lda #512 ;512 bytes for handle
|
|
jsr GetSmallHandle
|
|
bcs Mem_Error_brl
|
|
PushAx ;push for the derefandlock
|
|
jsr DerefAndLock ;returns a pointer to memory
|
|
stax PrefixPtr
|
|
lda #508 ;length of this buffer (-4 to CYA)
|
|
sta [PrefixPtr]
|
|
*
|
|
* a place in memory for the list of file name strings
|
|
*
|
|
lda #512 ;512 bytes to start
|
|
jsr GetSmallHandle
|
|
bcs Mem_Error_brl
|
|
stax StringsHandle ;a place to start saving strings
|
|
PushAx ;push for the derefandlock
|
|
jsr DerefAndLock ;returns a pointer to memory
|
|
stax StringsPtr
|
|
*
|
|
* Allocate a buffer in memory for the GetDirectory call to use for the
|
|
* name string returned. This will grow later if a larger area is needed.
|
|
* This area can also be used for temp storage when not doing directory calls.
|
|
*
|
|
lda #256+4 ;256 bytes for handle (+ 4 overhead)
|
|
jsr GetSmallHandle ;should be plenty (will grow if needed)
|
|
bcs Mem_Error_brl
|
|
stax NameHandle
|
|
PushAx ;push for the derefandlock
|
|
jsr DerefAndLock ;returns a pointer to memory
|
|
stax NamePtr
|
|
lda #256 ;length of this buffer (-4 to CYA)
|
|
sta [NamePtr]
|
|
*
|
|
* This memory is used by the DInfo call as a place to put its results
|
|
* Actually, I think I'll make this even larger and use the area for temp storage as well (12/19/88)
|
|
*
|
|
lda #135 ;35 bytes for handle +100 for temps
|
|
jsr GetSmallHandle
|
|
bcs Mem_Error_brl
|
|
PushAx ;push for the deref
|
|
jsr DerefandLock ;returns a pointer to memory
|
|
stax DinfoPtr
|
|
lda #131 ;length of this buffer (-4 to CYA)
|
|
sta [DinfoPtr]
|
|
*
|
|
* This memory is used to put the list manager record into.
|
|
*
|
|
lda #40 ;40 bytes for the record
|
|
jsr GetSmallHandle ;handle of memory
|
|
bcs Mem_Error_brl
|
|
stax ListRecHandle
|
|
PushAx ;push for the deref
|
|
jsr DerefandLock ;returns a pointer to memory
|
|
stax ListRecPtr
|
|
*
|
|
* now some memory for Get to display drive's stat (need to make them strings)
|
|
*
|
|
lda #32 ;32 bytes for the record
|
|
* (see globalequ.aii for allocation and use of this block)
|
|
jsr GetSmallHandle ;handle of memory
|
|
bcs Main_Exit
|
|
PushAx ;push for the deref
|
|
jsr DerefandLock ;returns a pointer to memory
|
|
stax SizeInfoPtr
|
|
*
|
|
* a small buffer for GetDirEntry conversion to old ProDos call style for Filter Procs
|
|
*
|
|
lda FGetPutFlag
|
|
bmi skipBuffer ;not needed for Put
|
|
lsr a ;see if an old call
|
|
bcc skipBuffer ;only for an old call
|
|
*
|
|
* Cheat: instead of lda and ora a long address, check second and third byte. Not likely
|
|
* both will be 0.
|
|
lda FilterProcPtr+1 ;is there a User Hook ?
|
|
beq skipBuffer ;not needed if no hook
|
|
|
|
lda #40 ;approx 38 bytes for the record
|
|
jsr GetSmallHandle ;handle of memory
|
|
bcs Main_Exit
|
|
PushAx ;push for the deref
|
|
jsr DerefandLock ;returns a pointer to memory
|
|
stax ProDosDirEntry ;save the pointer
|
|
skipBuffer
|
|
*
|
|
* we have all the memory we need!
|
|
*
|
|
* now some last minute set up stuff
|
|
*
|
|
stz lastSelected
|
|
stz lastSelected+2 ;lastselected item init
|
|
lda #$FFFF
|
|
sta openButStat ;init to impossible state (so it detects a change!)
|
|
|
|
jsr GetLocInfo ;Need to know which size we are in?
|
|
bne @1
|
|
lda #Size320Flag
|
|
ora FGetPutFlag
|
|
sta FGetPutFlag ;d15 = 1 is 320 mode
|
|
@1
|
|
*
|
|
* Set up near done.....FGetPutFlag contains size info and Get/Put info
|
|
*
|
|
* Select proper dialog
|
|
*
|
|
lda FGetPutFlag
|
|
bit #PatchedFlag ;see if custom dialog
|
|
beq Not_patched
|
|
ldax DialogTemplatePtr
|
|
bra Patched_move
|
|
Not_patched
|
|
and #$C000 ;keep only dialog type bits
|
|
xba ;d15/16 to d7/8
|
|
lsr a ;d7/8 to d6/7
|
|
lsr a ;d7/8 to d5/6
|
|
lsr a ;d7/8 to d4/5
|
|
lsr a ;d7/8 to d3/4
|
|
tax
|
|
|
|
lda DialogTable,x
|
|
pha
|
|
inx
|
|
inx
|
|
lda DialogTable,x
|
|
tax
|
|
pla
|
|
Patched_move
|
|
jsr MoveDialogtoMemory ;pass pointer in a,x, returns pointer to new template
|
|
sta DialogTemplatePtr ;return template in memory
|
|
stx DialogTemplatePtr+2
|
|
do_custom
|
|
jsr Common_Patched ;Do GetFile or PutFile.
|
|
*
|
|
* return point and exit (carry = error if set, a = error code (I hope I didn't miss any)
|
|
*
|
|
Main_exit
|
|
bcc @3
|
|
pha
|
|
lda #0
|
|
sta [ReplyPtr] ;if error, turn off Good
|
|
pla
|
|
sta CurError ;save any error if one!
|
|
cmp #$0201 ;memory error
|
|
bne @3 ;skip the rest
|
|
*
|
|
* if a memory error, find out how much space is left BEFORE getting rid of the handles
|
|
*
|
|
PushLongSpace
|
|
_MaxBlock ;ask the system whats avaliable
|
|
*
|
|
* total free is on the stack
|
|
*
|
|
ldax SizeInfoPtr
|
|
clc
|
|
adc #totalSizeStr ;point to place for string
|
|
bcc @1
|
|
inx
|
|
@1
|
|
PushAX
|
|
stax [SizeInfoPtr],totalSize ;save as a "mini table"
|
|
; PushWord #0010 ;10 characters
|
|
; PushWord #False ;unsigned
|
|
; _Long2Dec ;string set up
|
|
jsr Long2DecTen ;5-Mar-92 DAL
|
|
*
|
|
* What did we request
|
|
*
|
|
PushLong LastRequest ;size last requested
|
|
ldax SizeInfoPtr
|
|
clc
|
|
adc #totalFreeStr ;point to place for string
|
|
bcc @2
|
|
inx
|
|
@2
|
|
PushAX ;destination of string 2
|
|
stax [SizeInfoPtr],totalFree ;second "mini table" entry
|
|
; PushWord #0010 ;10 characters
|
|
; PushWord #False ;unsigned
|
|
; _Long2Dec ;string set up 2
|
|
jsr Long2DecTen ;5-Mar-92 DAL
|
|
@3
|
|
*
|
|
*******************the original port was left on the stack above*******************
|
|
*
|
|
_SetPort
|
|
*
|
|
* the exit from get file
|
|
*
|
|
lda FGetPutFlag
|
|
and #PathDrawPatched
|
|
beq NotPatched
|
|
|
|
jsr DoUnPatch
|
|
NotPatched
|
|
lda #1
|
|
sta ParBlock
|
|
lda #NotificationPROC ;de-install ourselves from the
|
|
sta procPointer ;OS notification queue
|
|
lda #^NotificationPROC
|
|
sta procPointer+2
|
|
PushZPtr ParBlock ;pointer to parameter block
|
|
PushWord #$2035 ;_DelNotifyProc
|
|
jsl ProDos_Stack_Entry ;stack based call
|
|
|
|
ldax ListPointerHandle
|
|
jsr KillHandle
|
|
|
|
ldax StringsHandle ;a place to start saving strings
|
|
jsr KillHandle
|
|
|
|
ldax NameHandle
|
|
jsr KillHandle
|
|
|
|
ldax ListRecHandle
|
|
jsr KillHandle ; release memory
|
|
|
|
ldax PrefixPtr
|
|
jsr KillPointer
|
|
|
|
ldax DinfoPtr
|
|
jsr KillPointer ; release memory
|
|
|
|
ldax DialogTemplatePtr
|
|
jsr KillPointer
|
|
|
|
lda FGetPutFlag
|
|
bmi skipremove ;not done if Put
|
|
lsr a ;see if an old call
|
|
bcc skipremove ;only for an old call
|
|
lda FilterProcPtr+1 ;is there a User Hook ? (cheat check)
|
|
beq skipremove ;not needed if no hook
|
|
|
|
ldax ProDosDirEntry ;save the pointer
|
|
jsr KillPointer
|
|
skipremove
|
|
lda CurError
|
|
beq @1 ;forget check if error
|
|
cmp #$0201 ;memory error
|
|
bne @1 ;skip the rest
|
|
ldy #TotalSizeStr+10 ;where the string starts
|
|
lda #0
|
|
sta [SizeInfoPtr],y ;make a c string
|
|
ldy #TotalFreeStr+10
|
|
sta [SizeInfoPtr],y
|
|
PushWordSpace ;results for alert window
|
|
PushWord #0 ;indicate C string
|
|
PushLong SizeInfoPtr ;substitution array
|
|
PushLong #MemoryMessage ;tell them error
|
|
_AlertWindow
|
|
pla ;don't care what comes back
|
|
lda CurError ;and pass back the error
|
|
@1
|
|
pha ;save current error to kill one more handle
|
|
|
|
ldax SizeInfoPtr
|
|
jsr KillPointer ;last one that may have been needed
|
|
plx ;put error in x for ToStrip
|
|
stz FGetPutFlag ;clear the flag when we leave!
|
|
ErrorEscape
|
|
ldy stacksize
|
|
ErrorEscape2
|
|
*
|
|
* better have stack size in Y and error code in X
|
|
*
|
|
plb
|
|
pld
|
|
jml ToStrip
|
|
|
|
|
|
**********************************************************************
|
|
* There is a problem with patching the user's dialog template with an
|
|
* address that points to a routine in Standard File. If standard file
|
|
* happens to get unloaded and then loaded again but in a different
|
|
* memory location then this address is no longer valid the next time
|
|
* this dialog template is used. Therefore to make sure standard file
|
|
* always patches out this field we reset it to zero.
|
|
**********************************************************************
|
|
doUnPatch
|
|
;;; lda DialogTemplatePtr ;move ptr to dialog template to another
|
|
lda >origDialogTempPtr ;15-Sep-91 DAL
|
|
sta pointer2 ;dpage location
|
|
;;; lda DialogTemplatePtr+2
|
|
lda >origDialogTempPtr+2 ;15-Sep-91 DAL
|
|
sta pointer2+2
|
|
|
|
bit FGetPutFlag ;find out if it's Get or Put dialog
|
|
bmi @ItsPut
|
|
|
|
ldy #34 ;offset for get dialog header to path item (item 6)
|
|
bra @doit
|
|
|
|
@ItsPut ldy #38 ;offset for put dialog header to path item (item 7)
|
|
|
|
@doit lda [<pointer2],y ;get ptr to dialog item
|
|
tax ;and put ptr in dpage location
|
|
iny
|
|
iny
|
|
lda [<pointer2],y
|
|
sta <pointer2+2
|
|
stx <pointer2
|
|
|
|
ldy #12 ;offset to refdescriptor field
|
|
lda #0 ;Zero this location out so that std file will patch
|
|
sta [<pointer2],y ;this out the next time the template is used.
|
|
iny
|
|
iny
|
|
sta [<pointer2],y
|
|
|
|
rts
|
|
|
|
export OrigDialogTempPtr
|
|
OrigDialogTempPtr dc.l 0
|
|
|
|
ENDP
|
|
|
|
**********************************************************************
|
|
*
|
|
* Check incomming verbs for valid values and set carry and return error
|
|
* if any one is bad. Note that we stop checking as soon as one bad verb
|
|
* is found.
|
|
*
|
|
**********************************************************************
|
|
VerbCheck PROC EXPORT
|
|
import ffListHandle ;DAL
|
|
|
|
*** added 1-Nov-91 DAL -- SFMultiGet2 does NOT have this kind of reply record to check!
|
|
lda <fGetPutFlag
|
|
and #MultiFileMode
|
|
bne @itsMultiFile
|
|
*** end 1-Nov-91 DAL
|
|
*
|
|
* Check reply record name verb
|
|
*
|
|
ldy #NewReplyRecord.NnameVerb ;name verb
|
|
*
|
|
* legit values for this verb are 0, 1, & 3
|
|
*
|
|
lda [ReplyPtr],y ;verb value
|
|
cmp #2 ;not allowed in a reply record
|
|
bne @1 ;it's OK
|
|
sec
|
|
lda #BadVerbRRName ;bad verb
|
|
rts ;return error
|
|
@1
|
|
*
|
|
* check reply record path verb
|
|
*
|
|
ldy #NewReplyRecord.NpathVerb ;path verb
|
|
*
|
|
* legit values for this verb are 0, 1, & 3
|
|
*
|
|
lda [ReplyPtr],y ;verb value
|
|
cmp #2 ;not allowed in a reply record
|
|
bne @2
|
|
sec
|
|
lda #BadVerbRRPath ;bad verb
|
|
rts ;return error
|
|
@2
|
|
@itsMultiFile
|
|
*
|
|
* Check incomming parameters: First Prompt as all calls have a prompt
|
|
*
|
|
lda PromptVerb ;legit values 0,1,2
|
|
; and #$0003 ;*** removed to allow error to be reported! 22-Mar-93 SS
|
|
cmp #0003 ;bad values
|
|
bcc @3 ;ok value
|
|
lda #BadVerbPrompt
|
|
sec
|
|
rts
|
|
@3
|
|
*
|
|
* Name string on Put files
|
|
*
|
|
bit FGetPutFlag ;if put, check default name string
|
|
bpl @4
|
|
lda OrigNameVerb
|
|
cmp #0003 ;bad values
|
|
bcc @4 ;ok value
|
|
lda #BadVerbName
|
|
sec
|
|
rts
|
|
@4
|
|
clc
|
|
rts
|
|
|
|
|
|
|
|
**********************************************************************
|
|
* Common code section for Get and Put File calls
|
|
**********************************************************************
|
|
Common_Patched PROC EXPORT
|
|
with PopUpGlobals
|
|
with OldReplyRecord
|
|
with NewReplyRecord
|
|
|
|
IMPORT BuildVolumeList
|
|
IMPORT VolumesOnLine
|
|
IMPORT PollDevices
|
|
IMPORT ServiceDiskSwitch
|
|
IMPORT NotificationPROC
|
|
IMPORT PutUpAlert
|
|
import PollForInsertions ;25-Mar-91 DAL
|
|
import PathItemRightEdge ;18-Dec-91 DAL
|
|
import UpdateTheDialog ;19-Mar-93 SS
|
|
|
|
EXPORT DoVolumeCall
|
|
EXPORT DoDInfoCall
|
|
EXPORT DoGetFileInfo
|
|
EXPORT ReDoList
|
|
EXPORT NextDrive
|
|
EXPORT DoExit
|
|
EXPORT CheckVolume
|
|
EXPORT NextDrive1
|
|
EXPORT NextDrive2
|
|
EXPORT VolumeOK1
|
|
|
|
|
|
ldy #06 ;Move dialog to position that caller
|
|
clc ;has specified.
|
|
Loop0 ;WhereX and WhereY are the callers inputs.
|
|
tyx
|
|
lda [DialogTemplatePtr],y ;add the position to the dialog information
|
|
adc WhereX
|
|
sta [DialogTemplatePtr],Y
|
|
dey
|
|
dey
|
|
tyx
|
|
lda [DialogTemplatePtr],Y
|
|
adc WhereY
|
|
sta [DialogTemplatePtr],Y
|
|
dey
|
|
dey
|
|
bpl Loop0
|
|
|
|
stz TickCount ;initialize count that keeps track of when we poll
|
|
stz TickCount+2 ;disk switch events
|
|
stz TypeOfSwitch ;Clear out some variables that tell us whether
|
|
stz DeviceSwitched ;a disk switch event occurred or not.
|
|
stz CurrentEjected
|
|
|
|
jsr PollForInsertions ;25-Mar-91 DAL (ignore pending inserts)
|
|
|
|
lda #1
|
|
sta ParBlock
|
|
|
|
lda #NotificationPROC
|
|
sta procPointer
|
|
lda #^NotificationPROC
|
|
sta procPointer+2
|
|
PushZPtr ParBlock ;pointer to parameter block
|
|
PushWord #$2034 ;_AddNotifyProc
|
|
jsl ProDos_Stack_Entry ;stack based call
|
|
|
|
*** added 10-Jun-91 DAL -- if prefixes 0 and 8 are null, set prefix 0 to the boot volume
|
|
stz chkpfxnum
|
|
pushlong #pfxCheckParms
|
|
pea $200A
|
|
jsl $e100b0
|
|
bcs prefixCheckDone ;good, it failed
|
|
lda #8
|
|
sta chkpfxnum
|
|
pushlong #pfxCheckParms
|
|
pea $200A
|
|
jsl $e100b0
|
|
bcs prefixCheckDone ;good, it failed
|
|
|
|
jsr Set0and8ToBoot
|
|
bra prefixCheckDone
|
|
|
|
pfxCheckParms dc.w 2
|
|
chkpfxnum dc.w 0
|
|
dc.l tinyOutBuffer
|
|
tinyOutBuffer dc.w 4,0
|
|
|
|
pfxSetParms dc.w 2
|
|
dc.w 0
|
|
dc.l setToBootVol
|
|
|
|
pfxSet8Parms dc.w 2
|
|
dc.w 8 ;prefix number
|
|
dc.l setToBootVol
|
|
|
|
setToBootVol dc.w 2
|
|
dc.b '*:'
|
|
|
|
*** 29-Jan-29 DAL
|
|
Set0and8ToBoot pushlong #pfxSetParms
|
|
pea $2009 ;SetPrefixGS
|
|
jsl $e100b0
|
|
pushlong #pfxSet8Parms
|
|
pea $2009 ;SetPrefixGS
|
|
jsl $e100b0
|
|
rts
|
|
|
|
prefixCheckDone
|
|
*** end of 10-Jun-91 DAL
|
|
|
|
;
|
|
; ----- Create the dialog ------------------------------------------------------
|
|
;
|
|
PushLongSpace ;Space for pointer to newly created dialog.
|
|
PushZLong DialogTemplatePtr ;Dialog to draw.
|
|
_GetNewModalDialog
|
|
|
|
pla
|
|
sta DialogPtr ;save pointer to Dialog
|
|
pla
|
|
sta DialogPtr+2
|
|
|
|
lda FGetPutFlag
|
|
bit #MultiFileMode
|
|
beq @notMulti
|
|
PushWord #0005 ;If MultiMode dialog, make the ACCEPT
|
|
PushZLong DialogPtr ;button the default button.
|
|
_SetDefButton
|
|
@notMulti
|
|
|
|
*** added a content draw proc 19-Mar-93 SS
|
|
pushlong #UpdateTheDialog+$80000000
|
|
pushZlong DialogPtr
|
|
_SetContentDraw
|
|
*** end 19-Mar-93 SS
|
|
|
|
*** added 18-Dec-91 DAL -- If PutFile Line Edit is outside window, set the FunkyPutFile bit
|
|
lda <FGetPutFlag
|
|
bmi @inPut
|
|
brl @notPutFile ;not a PutFile
|
|
|
|
@inPut pha
|
|
pha
|
|
_GetPort
|
|
pushzlong <dialogPtr
|
|
_SetPort
|
|
pea DlgPortRect>>16
|
|
pea DlgPortRect
|
|
_GetPortRect
|
|
_SetPort
|
|
|
|
pushzlong <dialogPtr
|
|
pea 10 ;edit line ditem
|
|
pea @leRect>>16
|
|
pea @leRect
|
|
_GetDItemBox
|
|
|
|
ldy #@leRect>>16
|
|
ldx #@leRect
|
|
jsr ChkSectRect
|
|
bne @notFunky
|
|
|
|
lda #FunkyPutFile
|
|
tsb <FGetPutFlag
|
|
@notFunky
|
|
*** added 22-Mar-93 SS -- continue checking for any visible edit lines, set HaveVisibleEdit bit
|
|
@chkVisEdits pha
|
|
pha
|
|
pushzlong <dialogPtr
|
|
_GetWControls ;get first ctl handle
|
|
plx
|
|
ply
|
|
stx <handle
|
|
sty <handle+2
|
|
|
|
@nextCtl lda <handle+1 ;if NIL, we're done.
|
|
beq @rectChkDone
|
|
|
|
ldy #2 ;deref the ctl handle
|
|
lda [<handle],y
|
|
sta <pointer+2
|
|
lda [<handle]
|
|
sta <pointer
|
|
|
|
pha
|
|
pha
|
|
pushzlong <handle
|
|
_GetCtlRefCon ;see if it's an edit line
|
|
plx
|
|
pla
|
|
and #$7fff
|
|
cmp #$0011
|
|
bne @notEditLine
|
|
|
|
lda <pointer
|
|
clc
|
|
adc #8
|
|
tax
|
|
lda <pointer+2
|
|
adc #0
|
|
tay
|
|
jsr ChkSectRect ;is it visible?
|
|
beq @notVisible ; no, next
|
|
lda #HaveVisibleEdit ; yes, set flag and exit
|
|
tsb <FGetPutFlag
|
|
bra @rectChkDone
|
|
@notVisible
|
|
@notEditLine ldy #2
|
|
lda [<pointer],y ;get the next ctl handle
|
|
sta <handle+2
|
|
lda [<pointer]
|
|
sta <handle
|
|
bra @nextCtl
|
|
|
|
@leRect ds.b 8
|
|
@rectChkDone
|
|
*** end 22-Mar-93 SS
|
|
@notPutFile
|
|
|
|
PushZLong DialogPtr ;set up for SetIText
|
|
ldy #8 ;prompt for get
|
|
jsr PutAdjust ;proper y value
|
|
phy ;dialog item id on stack for SetIText call
|
|
jsr get_prompt_ptr ;pointer returned in A & X
|
|
bcc @PromptOK
|
|
ply ;clean up stack, get dialog item id off of stack.
|
|
ply ;get dialogptr off stack
|
|
ply
|
|
brl doCancel
|
|
;
|
|
; Begin patch here to fix up resource usage
|
|
;
|
|
@PromptOK stax pointer ; save a copy of the pointer
|
|
PushAX ;(promptptr) on the stack for call
|
|
_SetIText ;set up the prompt
|
|
* added comment:
|
|
* from here to @12_5, we are trying to leave the handle locked, but mark it purgeable if it's a resource.
|
|
|
|
*** rearranged slightly - PromptVerb is already ranged 0-3 22-Mar-93 SS
|
|
; lda PromptVerb
|
|
; and #$0003
|
|
; tay
|
|
ldax pointer ; recover the text pointer
|
|
; cpy #$0000
|
|
ldy PromptVerb
|
|
*** end 22-Mar-93 SS
|
|
beq @12_5 ;if a pointer, we don't unlock it even
|
|
;
|
|
;6/8/89 Mensch
|
|
; Insert fix here, code was causing the handle to be unlocked at this point, something that
|
|
; you should not do after the above setIText (it keeps your pointer...). Instead, if it
|
|
; is a resource simply release it and then continue it will be fixed later...
|
|
|
|
cpy #$0001
|
|
beq @12_5
|
|
;
|
|
; old code was...
|
|
; pha ;space for results
|
|
; pha
|
|
; PushAX
|
|
; _FindHandle
|
|
; _HUnLock
|
|
;
|
|
; if resource simply do this...
|
|
jsr prompt_release
|
|
bcc @12_5 ;branch out of range so cheat to get to @2
|
|
brl doCancel
|
|
@12_5
|
|
clc ; clear the carry cause getNamePtr screws up a
|
|
; test if the carry is not set...
|
|
bit FGetPutFlag ; If put, move in the default text for
|
|
bmi @ItsPut ; edit line item.
|
|
brl @1
|
|
@ItsPut lda OrigName+2 ; Check if user has entered zero for the
|
|
ora OrigName ; name ref. If it is then skip SetIText stuff.
|
|
bne @GotAName
|
|
brl @1
|
|
@GotAName PushZLong DialogPtr
|
|
PushWord #10 ;always 10 as we are in put
|
|
jsr get_name_ptr ;returns pointer in A and X
|
|
bcc @OrigNameOK
|
|
ply ;Got an error trying to load the origname
|
|
ply ;resource, so clean up stack and exit.
|
|
ply
|
|
brl doCancel
|
|
@OrigNameOK
|
|
stax pointer ;save it for later release if resource
|
|
stax ztemp1 ;hold it
|
|
lda pointer+1
|
|
beq @1
|
|
stz ztemp2 ;0 will indicate unused (so no change back will occure below)
|
|
lda FgetPutFlag
|
|
bit #OldStyleFlag ;old style uses PString
|
|
beq @10
|
|
ldax ztemp1 ;use string as is
|
|
bra @19
|
|
@10
|
|
*
|
|
* OrigName is a C1InputString and SetIText wants a PString so we will hack it here
|
|
*
|
|
lda [ztemp1] ;size word
|
|
sta ztemp2 ;save a copy of original length
|
|
and #$FF ;max size allowed in a SetIText
|
|
xba ;into the "lower byte of a P-String
|
|
sta [ztemp1] ;put back modified size
|
|
clc
|
|
ldax ztemp1
|
|
adc #1 ;bump pointer to make a pstring
|
|
bcc @19
|
|
inx
|
|
@19
|
|
PushAX ;pointer to the string (OrigName)
|
|
_SetIText ;set the default name
|
|
|
|
; Select the default text in the edit line item
|
|
;
|
|
PushLong DialogPtr
|
|
PushWord #10 ;edit item ID
|
|
PushWord #0 ;start of selection
|
|
PushWord #255 ;end of selection (just use max length)
|
|
_SelectIText
|
|
|
|
jsr ReverseSelection ;added 26-Nov-90 DAL
|
|
|
|
lda ztemp2
|
|
beq @20 ;if 0, we didn't change anything
|
|
sta [ztemp1] ;put back original length
|
|
@20
|
|
ldax pointer ; recover the text pointer
|
|
ldy OrigNameVerb
|
|
beq @1 ;if a pointer, we don't unlock it even
|
|
pha ;space for results
|
|
pha
|
|
PushAX
|
|
_FindHandle
|
|
_HUnLock
|
|
jsr name_release
|
|
bcs @2
|
|
@1
|
|
|
|
*
|
|
* We need to build a list of file names.
|
|
*
|
|
@again
|
|
_WaitCursor
|
|
jsl VolumesOnLine ;Calculate how many volumes we have on-line. (NUMVOLUMES contains
|
|
; ;the number of volumes on-line)
|
|
jsr BuildList ;allocate memory and build a list (sorted)
|
|
php ;save status of carry
|
|
pha ;29-Jan-92 DAL
|
|
_InitCursor
|
|
pla ;29-Jan-92 DAL
|
|
plp
|
|
bcc @3 ;If we couldn't build list then it means
|
|
; ;we couldn't find any volumes.
|
|
|
|
*** added 29-Jan-92 DAL -- Or, we found a damaged directory. Ouch.
|
|
ldx #0
|
|
phx ;space for result
|
|
phx ;flags
|
|
phx
|
|
phx ;substitution string
|
|
pha ;error number
|
|
_ErrorWindow
|
|
plx
|
|
*** now set prefix 0 to the boot disk, so hopefully we won't get stuck
|
|
*** on the same damaged directory next time
|
|
jsr Set0and8ToBoot
|
|
bra @again
|
|
*** end 29-Jan-92
|
|
|
|
@2 brl DoCancel ;return with error (oh no)
|
|
@3 jsr DoDinfoCall
|
|
jsr DoVolumeCall ;init variables and strings needed.
|
|
*
|
|
* now init the list
|
|
*
|
|
PushLongSpace ;space for results
|
|
PushZLong DialogPtr ;Pointer to which dialog it should appear
|
|
PushZLong ListRecPtr ;pointer to list record
|
|
|
|
*** begin 10-Jun-91 DAL -- make the list one pixel higher for put to avoid
|
|
*** having the focus frame collide with the prompt
|
|
lda fGetPutFlag
|
|
bpl @notPut1
|
|
*** added 18-Dec-91 DAL -- see if Edit Line is outside the window. If so, don't fudge list position.
|
|
and #FunkyPutFile
|
|
bne @noFudge
|
|
*** end 18-Dec-91
|
|
ldy #4
|
|
lda [<listRecPtr],y
|
|
dec a
|
|
sta [<listRecPtr],y
|
|
lda [<listRecPtr]
|
|
dec a
|
|
sta [<listRecPtr]
|
|
@noFudge
|
|
@notPut1
|
|
*** end 10-Jun-91 DAL
|
|
|
|
_CreateList ;ok, do it!
|
|
|
|
*** not needed 22-Mar-93 SS
|
|
;*** begin 10-Jun-91 DAL -- restore the list record if we messed with it
|
|
; bit fGetPutFlag
|
|
; bpl @notPut2
|
|
; ldy #4
|
|
; lda [<listRecPtr],y
|
|
; inc a
|
|
; sta [<listRecPtr],y
|
|
; lda [<listRecPtr]
|
|
; inc a
|
|
; sta [<listRecPtr]
|
|
;@notPut2
|
|
;*** end 10-Jun-91 DAL
|
|
|
|
pla
|
|
sta ListControl1
|
|
sta ffListHandle ;added 1-Apr-91 DAL
|
|
pla
|
|
sta ListControl1+2
|
|
sta ffListHandle+2 ;added 1-Apr-91 DAL
|
|
|
|
*
|
|
* need handle to scroll bar items
|
|
*
|
|
PushZLong ListControl1 ;List Control Handle
|
|
jsr DerefandLock ;returns a pointer to list control record
|
|
sta pointer
|
|
stx pointer+2 ;need a zero page loc for indirect
|
|
ldy #octlflag
|
|
lda [pointer],y
|
|
ora #test_mem_never ;check mem_never flag in List Manager
|
|
sta [pointer],y
|
|
ldy #octlListBar ;offset to list control's scroll bar control
|
|
lda [pointer],y
|
|
sta ScrollControl1
|
|
iny
|
|
iny
|
|
lda [pointer],y
|
|
sta ScrollControl1+2
|
|
*
|
|
* list manager requires zeroing the RefCons (sheesh!!!)
|
|
*
|
|
jsr SaveAndZeroRefCons ; no prob, the filter proc will set them back
|
|
|
|
*** add a dummy off-screen edit item to sense hits in the list 19-Mar-93 SS
|
|
lda FGetPutFlag ;skip if not in Put
|
|
bpl LoopModal
|
|
|
|
pushZLong DialogPtr
|
|
pushlong #FakeItemTemplate
|
|
_GetNewDItem
|
|
bra LoopModal
|
|
|
|
FakeItemTemplate
|
|
FakeItemID dc.w 8 ;item #
|
|
dc.w 0,0,0,0 ;drect
|
|
dc.w EditLine+ItemDisable ;type
|
|
dc.l 0 ;Item descriptor
|
|
dc.w 0 ;size of text max
|
|
dc.w 0 ;Bit flags
|
|
dc.l 0 ;color table
|
|
*** end 19-Mar-93 SS
|
|
|
|
**********************************************************************
|
|
|
|
LoopModal
|
|
clc ; no error going in
|
|
*
|
|
* jumps to LoopModalReturn from the below routines may set carry indicarting an error.
|
|
* This error is most likely a memory manager error. We need to abort on an error.
|
|
*
|
|
LoopModalReturn
|
|
bcc @1 ;carry is error status
|
|
brl DoCancel ;close dialog and return
|
|
@1
|
|
jsr SetClose ;check on close button
|
|
|
|
PushWord #0 ; result
|
|
*** PushLong #GetFilter+$80000000
|
|
PushLong #GetFilter+$C0000000 ;set bit 30 for I-Beams (5-Mar-91 DAL)
|
|
_ModalDialog
|
|
pla ;find out what user has clicked on
|
|
sta ItemHit ;save incase we do a FilterProc
|
|
;
|
|
; If there are no volumes on-line and we're not in the mode where we're displaying the volumes online then
|
|
; it means that an alert dialog was already put up to prompt the user to insert a disk, and they declined
|
|
; to insert a disk. Therefore we just cancel.
|
|
;
|
|
; If we are in the displaying volumes mode and someone ejects a disk so that there are no more volumes online
|
|
; then we need to put up the alert dialog.
|
|
;
|
|
lda NumVolumes ;Check if there are any volumes currently on-line.
|
|
bne itsOK
|
|
brl doCancel
|
|
itsOK
|
|
|
|
lda FGetPutFlag
|
|
and #PatchedFlag ;see if a patched dialog
|
|
beq NotCustom ;patched dialog
|
|
jsr DoHook ;let them handle their own items
|
|
NotCustom
|
|
lda FRedraw ;demand for a new list
|
|
beq @1 ;nope!
|
|
stz FRedraw
|
|
brl ListChange ;redraw the list
|
|
@1
|
|
lda ItemHit
|
|
bne @somethingHit
|
|
brl LoopModal ;nothing happened or FilterProc took care of it!
|
|
@somethingHit cmp #(ModalTablePut-ModalTableGet)/2 ;skip if not one of ours
|
|
bcc @weTakeIt
|
|
brl LoopModal ;skip it!
|
|
@weTakeIt asl a
|
|
tax
|
|
bit FGetPutFlag
|
|
bmi PutTable
|
|
jmp (ModalTableGet,x) ; execute the appropriate item
|
|
PutTable jmp (ModalTablePut,x)
|
|
|
|
ModalTableGet dc.w 0
|
|
dc.w DoOpen
|
|
dc.w DoClose
|
|
dc.w DoVolume
|
|
dc.w DoCancel
|
|
dc.w DoAccept ; ACCEPT button or scroll place holder
|
|
dc.w DoPath
|
|
dc.w Nothing ;files place holder
|
|
dc.w Nothing ;Prompt string
|
|
dc.w Nothing ;so both tables are the same size
|
|
dc.w Nothing ;so both tables are the same size
|
|
dc.w Nothing ;so both tables are the same size
|
|
dc.w Nothing ;so both tables are the same size
|
|
|
|
ModalTablePut dc.w 0
|
|
dc.w DoSave
|
|
dc.w DoOpen
|
|
dc.w DoClose
|
|
dc.w DoVolume
|
|
dc.w DoCancel
|
|
dc.w Nothing ;scroll place holder never happens
|
|
dc.w DoPath
|
|
dc.w Nothing ;files box
|
|
dc.w Nothing ;prompt string
|
|
dc.w Nothing ;edit text string
|
|
dc.w Nothing ;stat text string
|
|
dc.w DoCreate
|
|
dc.w Nothing
|
|
|
|
**********************************************************************
|
|
ChkSectRect pha
|
|
phy
|
|
phx
|
|
pea DlgPortRect>>16
|
|
pea DlgPortRect
|
|
pea @destRect>>16
|
|
pea @destRect ;dest rect (who cares)
|
|
_SectRect
|
|
pla
|
|
rts
|
|
|
|
@destRect ds.b 8
|
|
DlgPortRect ds.b 8
|
|
|
|
**********************************************************************
|
|
ReverseSelection
|
|
***
|
|
*** added 26-Nov-90 DAL
|
|
*** AppleWorks GS 1.1 has a workaround for the 5.0..5.0.2 screwiness where the default text
|
|
*** was not selected (the insertion point followed the text, instead). Their solution was to
|
|
*** post a fake Apple-Shift-LeftArrow to extend the selection all the way to the left.
|
|
*** Unfortunately, in 5.0.3 that *kills* the selection and leaves you with an insertion point
|
|
*** at the *left* of the text.
|
|
***
|
|
*** To make their fix work again in 6.0 (without breaking anything else), I will check the
|
|
*** selection--if it is a left-to-right selection, I will change it to a right-to-left
|
|
*** selection (leSelStart >= leSelEnd).
|
|
***
|
|
pha
|
|
pha ;space for GetCtlTitle
|
|
pha
|
|
pha ;space for edit line control handle
|
|
pushlong DialogPtr
|
|
pea 10 ;edit item ID
|
|
_GetControlDItem
|
|
_GetCtlTitle ;get the line edit record
|
|
phd
|
|
tsc
|
|
tcd
|
|
* deref line edit record handle into line edit record pointer
|
|
ldy #2
|
|
lda [3],y
|
|
tax
|
|
lda [3]
|
|
sta 3
|
|
stx 5
|
|
* check start vs. end of selection
|
|
ldy #$20 ;beginning of selection
|
|
lda [3],y
|
|
iny
|
|
iny ;end of selection
|
|
cmp [3],y
|
|
bcs @okay ;it's already a right-to-left selection
|
|
* reverse beginning/end
|
|
tax ;keep beginning in X for a sec
|
|
lda [3],y ;A = end of selection
|
|
dey
|
|
dey
|
|
sta [3],y ;store old end as new beginning
|
|
iny
|
|
iny
|
|
txa
|
|
sta [3],y ;store old beginning as new end
|
|
|
|
@okay pld
|
|
pla
|
|
pla
|
|
rts
|
|
*** end of 26-Nov-90 DAL
|
|
|
|
|
|
**********************************************************************
|
|
*
|
|
* Handler to see if an Appletalk volume has changed.
|
|
*
|
|
**********************************************************************
|
|
CheckVolume phd ;save current d
|
|
PushLongSpace ;results
|
|
PushWord #0 ;system tool
|
|
PushWord #$0017 ;Standard File tool set
|
|
_GetWap
|
|
pld ;set DP to old direct page for this routine
|
|
pla ;toss upper
|
|
|
|
lda FileSysID
|
|
cmp #AppleShareID
|
|
bne exit ;only care about apple share now.
|
|
PushLongSpace
|
|
_GetTick
|
|
PullAX ;results
|
|
and #$01FF ;8 seconds
|
|
bne exit ;not time
|
|
jsr DoGetFileInfo ;get the file info into the ParBlock
|
|
*
|
|
* see if the data changed (or was never there!)
|
|
*
|
|
ldx #6 ;move 4 words
|
|
ldy #FileModInfo+6 ;destination
|
|
@4
|
|
lda ParmodTD_GFI,x ;mod date and time in a holding location.
|
|
cmp [DInfoPtr],y ;see if it changed
|
|
bne change ;got a change
|
|
dey
|
|
dey
|
|
dex
|
|
dex
|
|
bpl @4
|
|
bra exit ;leave
|
|
change
|
|
lda ParmodTD_GFI,x ;move mod date and time into a holding location.
|
|
sta [DInfoPtr],y ;copy over the change and the rest
|
|
dey
|
|
dey
|
|
dex
|
|
dex
|
|
bpl change
|
|
|
|
sec
|
|
ror ztemp3
|
|
jsr ReDoList ;force a redraw
|
|
exit
|
|
pld
|
|
rts
|
|
|
|
|
|
**********************************************************************
|
|
*
|
|
* Dialog Hook Proc. call
|
|
*
|
|
**********************************************************************
|
|
DoHook
|
|
lda DilgHook+1 ;cheat: not likely both will be 0 if neither word 0
|
|
beq ReturnHook ;skip if empty
|
|
PushLong DialogPtr
|
|
PushZPtr ItemHit
|
|
lda #(ReturnHook-1)>>8
|
|
pha
|
|
lda #ReturnHook-1
|
|
and #$00FF
|
|
xba
|
|
ora DilgHook+2
|
|
pha
|
|
lda DilgHook
|
|
dec a
|
|
pha
|
|
rtl
|
|
ReturnHook
|
|
rts
|
|
|
|
|
|
DoCreate
|
|
**********************************************************************
|
|
*
|
|
* Create a folder with the passed name
|
|
*
|
|
**********************************************************************
|
|
lda writeProtect ;if write protected, button no good
|
|
bnel LoopModal
|
|
|
|
*** 2-Apr-91 DAL -- call JudgeTheName
|
|
lda #2 ;tell JudgeName it's a folder name
|
|
jsr JudgeTheName
|
|
bcc @ok
|
|
brl LoopModal
|
|
@ok
|
|
*** end of 2-Apr-91 DAL
|
|
|
|
jsr GetTextItem ;leaves pointer to text in 'pointer2' & NamePtr
|
|
lda [pointer2] ; the length is here.
|
|
and #$00FF
|
|
beql LoopModal ; skip this if nothing in the string
|
|
* the above check is not really needed as should never be here if the length was 0 as the button is disabled
|
|
* size of new string in A
|
|
*
|
|
|
|
inc a
|
|
inc a ;+2 for 8 and :
|
|
ldy #$0002 ;put it into the length WORD of NamePtr
|
|
sta [NamePtr],y
|
|
iny
|
|
iny
|
|
shortm
|
|
lda #'8'
|
|
sta [NamePtr],y
|
|
iny
|
|
lda Seperator ;add 8: or 8/ or whatever
|
|
sta [NamePtr],y
|
|
longm
|
|
lda NamePtr
|
|
clc
|
|
adc #$0002 ;a pointer to a GS/OS string now.
|
|
sta ParName_Create
|
|
lda NamePtr+2
|
|
adc #0
|
|
sta ParName_Create+2 ;path name string pointer
|
|
lda #$0005 ;5 parmeters
|
|
sta ParBlock ;uses $0F bytes in Parblock
|
|
lda #$00C3
|
|
sta ParAccess_Create ;normal access type
|
|
lda #$000F ;folder
|
|
sta ParType_Create
|
|
stzl ParAux_Create ;aux type 0
|
|
lda #$000D
|
|
sta ParStorage_Create
|
|
|
|
PushZPtr ParBlock ;pointer to parameter block
|
|
PushWord #$2001 ;_Create_C1
|
|
jsl ProDos_Stack_Entry ;stack based call
|
|
bcc CreateOK
|
|
jsr GetErrorMessage ;puts reason string address in 'pointer'
|
|
|
|
PushWordSpace ;results for alert window
|
|
PushWord #0 ;indicate C string
|
|
PushZLong pointer ;substitution string address
|
|
PushWord #$80 ;error creating folder....
|
|
_ErrorWindow
|
|
pla ;don't care what comes back
|
|
|
|
brl LoopModal ;for now, skip it!
|
|
|
|
CreateOK
|
|
;
|
|
; Once the folder has been created drop into this directory.
|
|
|
|
ldy #2 ;Pointer2 pts to the name of the folder.
|
|
lda [NamePtr],y ;Unfortunately this has been munged above
|
|
and #$00FF ;in the create call.
|
|
sec
|
|
sbc #2 ;buffer word -> length word -> 8: -> string
|
|
ldy #4 ;we need just a length word w/o the 8: and
|
|
xba ;then the string itself
|
|
sta [NamePtr],y
|
|
ldax NamePtr
|
|
clc
|
|
adc #5
|
|
bcc @nocarry
|
|
inx
|
|
@nocarry
|
|
jsr AddToPrefix ;a & x contain the name of folder created
|
|
sec
|
|
ror topflg
|
|
jsr SetThePrefix
|
|
|
|
brl ListChange
|
|
|
|
GetErrorMessage
|
|
*
|
|
* A = error number
|
|
* scan a table of error numbers and get an error message (returned in pointer)
|
|
*
|
|
ldx #genErr>>16
|
|
stx pointer+2
|
|
ldx #genErr ;default error message
|
|
stx pointer
|
|
ldx #-6
|
|
errorloop
|
|
inx
|
|
inx
|
|
inx
|
|
inx
|
|
inx
|
|
inx
|
|
cpx #(endValue-valueTable) ;see if done
|
|
bcs @done
|
|
cmp valueTable,x ;this error?
|
|
bne errorloop
|
|
*
|
|
* error found, get the error value to place in the string
|
|
*
|
|
inx
|
|
inx
|
|
lda valueTable,x ;get the error number
|
|
sta pointer
|
|
inx
|
|
inx
|
|
lda valueTable,x
|
|
sta pointer+2
|
|
@done rts
|
|
|
|
|
|
Nothing
|
|
*
|
|
* Common return point with no error and empty list item handler
|
|
*
|
|
brl LoopModal
|
|
|
|
**********************************************************************
|
|
*
|
|
* Save pressed. Get the text in the text item from the dialog and
|
|
* pass it back to the caller. "Is the caller there?" -PD
|
|
*
|
|
**********************************************************************
|
|
DoSave
|
|
lda writeProtect ;if write protected, button no good
|
|
bne Nothing
|
|
|
|
*** 2-Apr-91 DAL -- call JudgeTheName
|
|
lda #3 ;tell JudgeName it's a file name
|
|
jsr JudgeTheName
|
|
bcs Nothing
|
|
*** end of 2-Apr-91 DAL
|
|
|
|
jsr GetTextItem ;leaves pointer to text string in 'pointer2'
|
|
brl Return_File ;return the name
|
|
|
|
**********************************************************************
|
|
*
|
|
* an open eh? Perhaps an accept? Well if it's a file we will just return it.
|
|
* if it's a folder, I guess we get to start all over again!
|
|
* If it's multiGet, we return the data record desired in the handle as needed.
|
|
*
|
|
**********************************************************************
|
|
DoAccept
|
|
lda #$FFFF
|
|
sta ztemp2 ;indicate Accept
|
|
bra ContinueOpen
|
|
|
|
DoOpen
|
|
stz ztemp2 ;indicate Open
|
|
ContinueOpen
|
|
stz ztemp1
|
|
jsr GetSelected ;get first selected (count items)
|
|
beq Nothing ;forget this if nothing selected
|
|
tay ;Remember a & x still contain the ptr to the last selected
|
|
lda FGetPutFlag ;list member found. We're about to trash a so save it in y for now.
|
|
bit #InVolumeList
|
|
bne @GotVolumeList
|
|
|
|
tya
|
|
bra @1
|
|
@GotVolumeList
|
|
ldy #2
|
|
lda [ztemp3],y
|
|
tax
|
|
lda [ztemp3]
|
|
sta ztemp3
|
|
stx ztemp3+2
|
|
lda [ztemp3]
|
|
and #$00FF
|
|
clc
|
|
adc #3
|
|
tay
|
|
lda [ztemp3],y
|
|
and #$00FF
|
|
sta curDev
|
|
|
|
jsr DoDInfoCall
|
|
bcs @error
|
|
jsr DoVolumeCall
|
|
bcs @error
|
|
jsr VolumeOK1
|
|
bra ListChange
|
|
@error pha ; space for result
|
|
PushWord #0
|
|
PushLong #0
|
|
pha ; push error code
|
|
_ErrorWindow ; put up error message for illegal pathname
|
|
pla ; toss return value
|
|
brl LoopModal ; go back to _modaldialog
|
|
|
|
@1
|
|
*
|
|
* A&X contain currently selected item
|
|
*
|
|
inc ztemp1 ;count item
|
|
jsr GetNextSelected ;see if any more items
|
|
bne @1 ;keep counting
|
|
*
|
|
* ztemp1 has number of items selected. ztemp2 is flag indicating button hit.
|
|
*
|
|
lda openButStat ;if called by item hit and NOT button hit
|
|
cmp #0002 ;need to light button
|
|
bne @no
|
|
dec a ;a = 1
|
|
jsr CommonOpen ;a 1 to this routine will hilight button!
|
|
@no
|
|
|
|
jsr GetSelected ;only one item, go get it again
|
|
PushAX
|
|
jsr DerefHandle ;deref handle
|
|
stax pointer2 ;pointer to the string
|
|
lda ztemp2 ;return via accept?
|
|
beq @notReturn1
|
|
brl Return_file ;allows a folder to be returned
|
|
@notReturn1 lda ztemp1 ;if only one item, check for folder
|
|
dec a ;will be 0 if was only 1
|
|
beq @notReturn2
|
|
brl Return_file ;just continue, can't be a folder...it's multi
|
|
@notReturn2 lda [pointer2] ;size of string
|
|
and #$00FF ;offset
|
|
tay
|
|
iny
|
|
lda [pointer2],y ;this member's file type
|
|
cmp #$000F ;Folder?
|
|
bne Return_File ;if a file, return it!
|
|
jsr DirectoryDown ;step into the directory
|
|
bcs ListChange ;if carry clear, nothing picked
|
|
brl Nothing
|
|
*
|
|
* if here, the list changed and we need to re-build and re-display the list
|
|
*
|
|
* This will also be an entry point to re-build the list at any time.
|
|
*
|
|
ListChange
|
|
stz ztemp3 ;flag to indicate re-draw on error
|
|
jsr ReDoList
|
|
brl LoopModalReturn
|
|
**********************************************************************
|
|
* Re-Do the list. Called above and inside re-scan appleshare
|
|
**********************************************************************
|
|
ReDoList
|
|
_WaitCursor
|
|
jsr BuildList ;re-build the list
|
|
php
|
|
pha ;added 28-Mar-91 DAL
|
|
_InitCursor
|
|
pla ;added 28-Mar-91 DAL
|
|
plp
|
|
bcc @1
|
|
cmp #$004E ;no access error?
|
|
beq @AccessError
|
|
sec
|
|
bra PassBackError
|
|
@AccessError
|
|
bit ztemp3
|
|
bmi ReDoList ;if from re-scan, try again
|
|
clc ;no error if access
|
|
bra PassBackError ;send back error
|
|
@1
|
|
jsr SetClose ;incase the close button changed
|
|
|
|
PushZLong DialogPtr
|
|
_SetPort ;restore port!
|
|
|
|
lda FGetPutFlag ;if not multi then the selection bits
|
|
and #MultiFileMode ;are still setup correctly
|
|
beq NoMulti
|
|
|
|
PushZLong ListControl1 ;List Control Handle
|
|
jsr DerefandLock ;returns a pointer to list control record
|
|
sta pointer
|
|
stx pointer+2 ;need a zero page loc for indirect
|
|
ldy #octlflag
|
|
lda [pointer],y
|
|
and #$FFFD ;reset the list selection bits for multiple selections,
|
|
sta [pointer],y ;just in case they were changed by the "Volumes" list.
|
|
|
|
NoMulti PushZLong selectedptr ;selected item
|
|
PushZLong ListRecPtr ;pointer to list record
|
|
_NewList ;ok, do it!
|
|
|
|
jsr DoPathDraw ;redraw the path too
|
|
clc ;no error
|
|
PassBackError
|
|
rts
|
|
|
|
**********************************************************************
|
|
*
|
|
* Return_File: Will set the Parameters and return the select file.
|
|
* 'pointer2' points to the name Pstring. (Entry from DoSave or DoOpen).
|
|
*
|
|
**********************************************************************
|
|
Return_File
|
|
lda FGetPutFlag
|
|
bit #MultiFIleMode ;multi file return
|
|
beq NotMulti
|
|
brl FinishMulti ;we know how many now.
|
|
NotMulti
|
|
ldy #$0002
|
|
lda [PrefixPtr],y ;length of original string (with seperator)
|
|
sta ztemp1 ;save original path length for restore.
|
|
ldax pointer2 ;name of file pointed to by this string
|
|
jsr AddToPrefix ;PrefixPtr contains a string of entite path
|
|
ldy #$0002 ;add to prefix puts a seperator on the end
|
|
lda [PrefixPtr],y ;length of original string (with seperator)
|
|
dec a ;forget the seperator
|
|
sta [PrefixPtr],y ;new length without seperator
|
|
*
|
|
* CAUTION: Could the string be too long after this operation?
|
|
*
|
|
* PrefixPtr now contains a full path name INCLUDING file (the prefix has NOT been updated).
|
|
* Get the file info.
|
|
*
|
|
lda #4
|
|
sta parBlock ;need to get the file info ($0D bytes)
|
|
ldax PrefixPtr
|
|
clc
|
|
adc #0002
|
|
bcc @01
|
|
inx
|
|
@01
|
|
stax ParPath_GFI
|
|
PushZPtr ParBlock ;pointer to parameter block
|
|
PushWord #$2006 ;_GetFileInfo_C1
|
|
jsl ProDos_Stack_Entry ;stack based call
|
|
|
|
bcc @02 ;check for errors
|
|
cmp #$46 ;file not found possible
|
|
beq @02 ;could be file not found as we expect!
|
|
bra @PutUpError
|
|
@02
|
|
*
|
|
* on save, check file status
|
|
*
|
|
bit FGetPutFlag ;if Get, just continue
|
|
bpl Continue_Return
|
|
bcc @10 ;No error, something with that name is there!
|
|
cmp #$46 ;no file with this name?
|
|
beq Continue_Return
|
|
@PutUpError tay ;save error
|
|
PushWordSpace
|
|
PushWord #0
|
|
PushLong #0
|
|
phy
|
|
_ErrorWindow ; put up error message for illegal pathname
|
|
pla ; toss return value
|
|
@9
|
|
ldy #$0002
|
|
lda ztemp1 ;restore prefix
|
|
sta [PrefixPtr],y ;length of original string (with seperator)
|
|
|
|
brl LoopModal ;let them try again!
|
|
@10
|
|
* set up for alert window
|
|
PushWordSpace ;results for alert window
|
|
PushWord #0 ;indicate C string
|
|
PushLong #0 ;no substitution array
|
|
lda ParFileType_GFI ;see if a folder
|
|
cmp #$000F
|
|
bne @15 ;it's a file
|
|
PushWord #$84 ;can't replace a folder with a file.
|
|
bra @20
|
|
@15
|
|
PushWord #$85 ;Already Exists: Replace?
|
|
@20
|
|
_InitCursor ;added 8-May-91 DAL
|
|
_ErrorWindow
|
|
pla
|
|
cmp #1 ;will get a 2 if pushed Replace!
|
|
bne @9 ;leave now!
|
|
Continue_Return
|
|
*
|
|
* return with all needed information
|
|
*
|
|
jsr CommonReply ;start reply record for both calls.
|
|
bcs FinishOld ;Carry returned 1 for old calls
|
|
|
|
*-----------------------------------------------------------
|
|
* complete new calls
|
|
*
|
|
jsr FinishNew
|
|
brl DoExit ;get out now
|
|
*-----------------------------------------------------------
|
|
*
|
|
* Build the name and path for an old call. Return P-String. Pointer2 points to item name Pstring.
|
|
*
|
|
FinishOld
|
|
ldax ReplyPtr
|
|
clc
|
|
adc #Oname ;get a pointer to the destination
|
|
bcc @10
|
|
inx
|
|
@10
|
|
stax pointer ;output pointer into reply record
|
|
*
|
|
* copy name to output ReplyPtr
|
|
*
|
|
ldy #0015 ;move length + 15 characters
|
|
shortm ;into short mode
|
|
@20
|
|
lda [pointer2],y
|
|
cmp #'/'
|
|
bne @21
|
|
dec ztemp1 ;flag says we have a / in name
|
|
@21
|
|
sta [pointer],y
|
|
dey
|
|
bne @20 ;all but byte containing length
|
|
lda [pointer2]
|
|
and #$0F ;limit length to 15 characters
|
|
sta [pointer]
|
|
longm
|
|
*
|
|
* copy Prefix & name to output ReplyPtr. Convert to P string.
|
|
*
|
|
ldax ReplyPtr
|
|
clc
|
|
adc #OPath ;get a pointer to the destination
|
|
bcc @30
|
|
inx
|
|
@30
|
|
stax pointer ;destination pointer into reply record
|
|
|
|
ldax PrefixPtr
|
|
clc
|
|
adc #$0003 ;first byte of string - 1
|
|
bcc @35 ;(-1 is WORD length compensation)
|
|
inx
|
|
@35
|
|
stax pointer2 ;source pointer
|
|
|
|
ldy #0002 ;length of source
|
|
lda [PrefixPtr],y ;get length
|
|
and #$7F ;128 characters max
|
|
tay ;length
|
|
pha ;save a copy of the length
|
|
@40
|
|
*
|
|
* need to prescan the name for '/' characters
|
|
*
|
|
lda [pointer2]
|
|
and #$FF00 ;if already '/'. skip this check
|
|
cmp #$2F00 ;'/' in high byte
|
|
beq @41 ;just do it if already /
|
|
stz ztemp1 ;scan flag < 0 if '/' exists in name.
|
|
|
|
phy ;save the y
|
|
@42
|
|
lda [pointer2],y ;prescan for '/''s
|
|
and #$00FF ;if already '/'. skip this check
|
|
cmp #'/'
|
|
bne @43
|
|
dec ztemp1
|
|
@43
|
|
dey
|
|
bne @42
|
|
@41
|
|
ply
|
|
@45
|
|
shortm
|
|
lda [pointer2],y
|
|
cmp #':' ;colons become '/'
|
|
bne @44 ;ok if not a ':'
|
|
bit ztemp1
|
|
bmi @44 if '/' in name, skip translation
|
|
lda #'/'
|
|
@44
|
|
sta [pointer],y
|
|
dey
|
|
bne @45
|
|
ply ;recall length
|
|
tya ;recall length
|
|
sta [pointer] ;save length in Pstring
|
|
longm
|
|
|
|
clc ;no error
|
|
brl DoExit ;get out now
|
|
|
|
|
|
**********************************************************************
|
|
*
|
|
* Finsih Multi select by building the desired data record needed.
|
|
* ztemp1 contain number of items selected, known not to be 0.
|
|
* This routine will allocate a handle, lock it and grow it as needed
|
|
* to return the file data record.
|
|
*
|
|
**********************************************************************
|
|
FinishMulti
|
|
lda #2 ;beginning handle size (for size only)
|
|
jsr GetSmallHandle
|
|
bcsl Main_exit ;damn, just leave.
|
|
stax handle
|
|
PushAx ;push for the derefandlock
|
|
jsr DerefandLock ;returns a pointer to memory
|
|
stax pointer ;use temp pointer
|
|
lda #0002 ;length of this buffer (-4 to CYA)
|
|
sta [pointer]
|
|
|
|
lda ztemp1 ;number of items returned
|
|
sta [ReplyPtr]
|
|
ldy #0002
|
|
sty ztemp2 ;output buffer index
|
|
|
|
PushLong #0 ;start with first item
|
|
multiloop
|
|
PullAX ;next item
|
|
jsr GetNextSelected
|
|
beql MultiDone ;got them all
|
|
PushAX ;save item that came back for loop
|
|
PushAX ;push member for deref call (too)
|
|
jsr DerefHandle ;deref member to a string pointer
|
|
stax pointer2 ;pointer to the string
|
|
*
|
|
* Need a full path name so I can get the file info with a system call
|
|
*
|
|
ldy #$0002 ;add to prefix puts a seperator on the end
|
|
lda [PrefixPtr],y ;length of original string (with seperator)
|
|
pha ;save original path length for restore.
|
|
ldax pointer2 ;name of file pointed to by this string
|
|
jsr AddToPrefix ;PrefixPtr contains a string of entite path
|
|
ldy #$0002 ;add to prefix puts a seperator on the end
|
|
lda [PrefixPtr],y ;length of original string (with seperator)
|
|
dec a ;forget the seperator
|
|
sta [PrefixPtr],y ;new length without seperator
|
|
*
|
|
* CAUTION: Could the string be too long after this operation?
|
|
*
|
|
* PrefixPtr now contains a full path name INCLUDING file (the prefix has NOT been updated).
|
|
* Get the file info.
|
|
*
|
|
lda #4
|
|
sta parBlock ;need to get the file info ($0D Bytes)
|
|
ldax PrefixPtr
|
|
clc
|
|
adc #0002
|
|
bcc @01
|
|
inx
|
|
@01
|
|
stax ParPath_GFI
|
|
PushZPtr ParBlock ;pointer to parameter block
|
|
PushWord #$2006 ;_GetFileInfo_C1
|
|
jsl ProDos_Stack_Entry ;stack based call
|
|
*
|
|
* now that we have the file information put the prefix back!
|
|
*
|
|
pla
|
|
ldy #0002
|
|
sta [PrefixPtr],y ;restore prefix
|
|
*
|
|
* re-size the handle to include this next entry
|
|
*
|
|
ldy #4
|
|
lda [handle],y
|
|
and #$7FFF ;drop lock bit
|
|
sta [handle],y ;unlocked
|
|
ldx #0000 ;max handle size here 65k
|
|
lda [pointer2] ;size of name string
|
|
and #$00FF ;256 character max
|
|
clc
|
|
adc [pointer] ;current size
|
|
adc #9 ;space for prefix, type aux type, string length, string prefix
|
|
pha ;save a copy of the "real size
|
|
PushAX ;new size
|
|
PushZLong handle
|
|
_SetHandleSize ;resize handle
|
|
* bcsl MainExit
|
|
PushZLong handle
|
|
jsr DerefandLock ;relock handle
|
|
stax pointer
|
|
pla ;was the size
|
|
sta [pointer] ;current size
|
|
|
|
ldy ztemp2 ;next space
|
|
lda ParFileType_GFI
|
|
sta [pointer],y ;save file type
|
|
iny
|
|
iny
|
|
ldax ParAuxType_GFI
|
|
sta [pointer],y
|
|
iny
|
|
iny
|
|
txa
|
|
sta [pointer],y ;file auxtype
|
|
iny
|
|
iny ;next location
|
|
lda [pointer2] ;length of string
|
|
and #$00FF ;256 characters max
|
|
tax ;save length in x
|
|
clc
|
|
adc #02 ;account for 8:
|
|
sta [pointer],y ;string length
|
|
iny
|
|
lda #':8' ;prefix number (it swaps during the store)
|
|
sta [pointer],y
|
|
iny
|
|
iny ;next place does not really exists yet.
|
|
@2
|
|
longm
|
|
incl pointer2 ;next character
|
|
shortm ;length of string in x
|
|
lda [pointer2]
|
|
sta [pointer],y
|
|
iny
|
|
dex
|
|
bne @2
|
|
longm
|
|
sty ztemp2
|
|
brl multiloop
|
|
MultiDone
|
|
ldy #0002 ;place for handle
|
|
ldax handle ;return the handle
|
|
sta [ReplyPtr],y
|
|
iny
|
|
iny
|
|
txa
|
|
sta [ReplyPtr],y
|
|
|
|
clc ;no error
|
|
brl DoExit ;get out now
|
|
|
|
**********************************************************************
|
|
*
|
|
* Get text from text edit item in PUT dialog. Puts text in memory area
|
|
* 'NamePtr' and returns a pointer to that text in 'pointer2'
|
|
*
|
|
**********************************************************************
|
|
GetTextItem
|
|
PushZLong DialogPtr ; the dialog pointer
|
|
PushWord #0010 ; item 10 = edit box
|
|
ldax NamePtr
|
|
clc ; put the string where the : will go (over the size)
|
|
adc #$0005 ; you have to see the picture to understand
|
|
bcc @1
|
|
inx
|
|
@1
|
|
PushAX ; temp location for file name
|
|
stax pointer2 ; also into a temp to use later
|
|
_GetIText ; get the string
|
|
rts
|
|
|
|
|
|
**********************************************************************
|
|
*
|
|
* Set up the common part of the reply record for both old an new calls.
|
|
* Will fille in the Boolean TRUE value, the File type and Aux type entries.
|
|
*
|
|
* On Exit: Y pointing to the next available slot in the reply record
|
|
* (filename for old calls, nameVerb for new calls) and CARRY set for OLD calls.
|
|
*
|
|
* Uses; A,X,Y
|
|
*
|
|
**********************************************************************
|
|
CommonReply
|
|
lda FGetPutFlag ;set carry for call type
|
|
lsr a ;carry = 0 for new call
|
|
ldy #Ngood ;index into reply record
|
|
lda #TRUE
|
|
sta [ReplyPtr],y ;all calls same location in record
|
|
iny
|
|
iny ;point to FileType
|
|
bit FGetPutFlag ;don't change these for put
|
|
bmi @2 ;skip file type and aux type for put.
|
|
lda ParFileType_GFI
|
|
sta [ReplyPtr],y
|
|
iny
|
|
iny ;point to AuxType
|
|
ldax ParAuxType_GFI
|
|
sta [ReplyPtr],y ;low byte always
|
|
bcs @1 ;carry set on entry
|
|
txa
|
|
iny
|
|
iny
|
|
sta [ReplyPtr],y
|
|
bra @1 ;and exit
|
|
@2
|
|
*
|
|
* Adjust y for items not changed
|
|
*
|
|
iny
|
|
iny ;point to AuxType
|
|
iny
|
|
iny ;point to AuxType 2nd
|
|
@1
|
|
iny ;point to next record
|
|
iny
|
|
rts
|
|
|
|
**********************************************************************
|
|
*
|
|
* FinishNew: called to create the output record and fill it with the
|
|
* necessary information.
|
|
*
|
|
* INPUT: from various records and d-page variables.
|
|
* It is assumed that ztemp1 contains the original length of
|
|
* the path in PrefixPtr.
|
|
*
|
|
* ASSUMPTION: Reply record verbs have already been checked for bad values.
|
|
*
|
|
* EXIT: If an error occured, CurError contains the error value.
|
|
* Uses d-page temps: ztemp2, pointer
|
|
* Carry set if errors. Clear otherwise.
|
|
*
|
|
**********************************************************************
|
|
FinishNew
|
|
*
|
|
* First the name. Pointer2 is a pointer to a PString of less than 256 characters.
|
|
*
|
|
ldax [ReplyPtr],NewReplyRecord.NnameRef ;name reference value
|
|
stax pointer ;destination
|
|
ldy #NewReplyRecord.NnameVerb ;name verb
|
|
*
|
|
* legit values for this verb are 0, 1, & 3
|
|
*
|
|
lda [ReplyPtr],y ;verb value
|
|
beq @5 ;it's a pointer, use it as is
|
|
dec a ;1?
|
|
bne @2 ;ne = new handle please
|
|
*
|
|
* passed a handle...size it accordingly
|
|
*
|
|
lda [pointer2] ;size of name string
|
|
and #$00FF ;byte of size
|
|
clc
|
|
adc #4 ;buffer size and string size words
|
|
pha ;save extra copy
|
|
ldx #0 ;msb of size = 0
|
|
PushAX ;push size of handle (long)
|
|
PushZLong pointer ;the handle
|
|
_SetHandleSize
|
|
*
|
|
* This could return an error but I will skip it because NameCopy will set the error for me if
|
|
* it can't fit.
|
|
*
|
|
php ;save carry
|
|
PushZLong pointer ;handle for the deref
|
|
jsr DerefHandle
|
|
stax pointer ;save destination over copy of handle
|
|
plp
|
|
pla
|
|
bcs @5
|
|
sta [pointer]
|
|
bra @5
|
|
@2
|
|
*
|
|
* If here, only original values left are 2 and 3 (now 1 and 2), and 2 was eliminated so
|
|
* they want a new handle. Go make one the right size.
|
|
*
|
|
lda [pointer2] ;size of string
|
|
and #$00FF ;byte of size
|
|
clc
|
|
adc #4 ;buffer size and string size words
|
|
pha ;save size
|
|
jsr GetZeroHandle
|
|
PushAX ;deref it to use it!
|
|
stax [ReplyPtr],NewReplyRecord.NnameRef ;give it back to them here
|
|
jsr DerefHandle
|
|
stax pointer ;save pointer
|
|
pla ;size back
|
|
sta [pointer] ;save buffer size
|
|
@5
|
|
*
|
|
* now copy the name from pointer2 to pointer. Make sure there is enough room too
|
|
*
|
|
lda [pointer2] ;source
|
|
and #$00FF ;source length
|
|
tay ;guess to # of characters to copy
|
|
jsr Name_copy ;copy the string
|
|
beq Path_return ;everything is ok!
|
|
lda #BadVerbRRName ;name buffer too small
|
|
sta CurError ;save error
|
|
Path_return
|
|
*
|
|
* Now the path return. PrefixPtr is a pointer to a C1OutputString much like what
|
|
* I need here so for the most part this will be just a copy. But first restore PrefixPtr
|
|
* to its original length.
|
|
*
|
|
ldax [ReplyPtr],NewReplyRecord.NpathRef ;path reference value
|
|
stax pointer ;destination
|
|
ldy #NewReplyRecord.NpathVerb ;path verb
|
|
*
|
|
* legit values for this verb are 0, 1, & 3
|
|
*
|
|
lda [ReplyPtr],y ;verb value
|
|
beq @5 ;it's a pointer, use it as is
|
|
dec a ;1?
|
|
bne @2
|
|
|
|
|
|
*
|
|
* passed a handle...size it accordingly
|
|
*
|
|
ldy #0002
|
|
lda [PrefixPtr],y
|
|
clc
|
|
adc #4 ;buffer size and string size words
|
|
pha ;save extra copy
|
|
ldx #0 ;msb of size = 0
|
|
PushAX ;push size of handle (long)
|
|
PushZLong pointer ;the handle
|
|
_SetHandleSize
|
|
php
|
|
*
|
|
* This could return an error but I will skip it because NameCopy will set the error for me if
|
|
* it can't fit.
|
|
*
|
|
PushZLong pointer ;handle for the deref
|
|
jsr DerefHandle
|
|
stax pointer ;save destination over copy of handle
|
|
plp
|
|
pla
|
|
bcs @5 ;if handle error, don't set size!
|
|
sta [pointer]
|
|
bra @5
|
|
@2
|
|
*
|
|
* if here, only original values left are 2 and 3 (now 1 and 2) and original 2 was eliminated so
|
|
* they want a new handle. Go make one the right size
|
|
*
|
|
ldy #0002 ;just how long is needed.
|
|
lda [PrefixPtr],y ;size of path
|
|
clc
|
|
adc #4 ;buffer size and string size words
|
|
pha ;save size
|
|
jsr GetZeroHandle
|
|
PushAX ;deref it to use it!
|
|
stax [ReplyPtr],NewReplyRecord.NpathRef ;send it back to them here
|
|
jsr DerefHandle
|
|
stax pointer ;save pointer
|
|
pla
|
|
|
|
sta [pointer] ;save buffer size
|
|
@5
|
|
*
|
|
* now copy the path from PrefixPtr to pointer. Make sure there is enough room too.
|
|
*
|
|
ldy #0002
|
|
lda [PrefixPtr],y ;source length
|
|
pha ;guess to # of characters to copy
|
|
sta [pointer],y ;save length
|
|
lda [pointer] ;destination buffer size
|
|
sec
|
|
sbc #0004 ;max string that will fit
|
|
cmp 1,s ;enough room?
|
|
bcs Pcopy_ok ;buffer is plenty large, do it!
|
|
ply ;toss away what we wanted to copy
|
|
pha ;what we can copy
|
|
lda #BadVerbRRPath ;path buffer too small
|
|
sta CurError ;save error
|
|
Pcopy_ok
|
|
ply ;bytes to copy
|
|
iny
|
|
iny
|
|
iny ;account for the 4 bytes at front and 0 math.
|
|
shortm
|
|
@3
|
|
lda [PrefixPtr],y
|
|
sta [pointer],y
|
|
dey
|
|
cpy #0003
|
|
bne @3
|
|
longm
|
|
NewReturnExit
|
|
clc ;guess no error
|
|
lda CurError
|
|
beq @1
|
|
sec
|
|
@1
|
|
rts
|
|
|
|
**********************************************************************
|
|
* special routine to copy the PString pointed to by [pointer2] to
|
|
* the C1OutputString pointed to by [pointer], count passed in y.
|
|
* Will check to see that the destination is large enough and if not will
|
|
* only copy the amount that will fit.
|
|
*
|
|
* EXIT: a = 0, no error. Else string would not fit.
|
|
**********************************************************************
|
|
Name_copy
|
|
stz ztemp2 ;no error
|
|
phy ;save desired length
|
|
tya
|
|
ldy #0002
|
|
sta [pointer],y ;save length
|
|
lda [pointer] ;destination buffer size
|
|
sec
|
|
sbc #0004 ;max string that will fit
|
|
cmp 1,s
|
|
bcs copy_ok ;buffer is plenty large, do it!
|
|
ply ;toss away what we wanted to copy
|
|
pha ;what we can copy
|
|
dec ztemp2 ;error flag
|
|
copy_ok
|
|
ply ;bytes to copy
|
|
ldax pointer2
|
|
clc
|
|
adc #0001
|
|
bcc @1
|
|
inx
|
|
@1
|
|
stax pointer2 ;point to actual text
|
|
|
|
ldax pointer
|
|
clc
|
|
adc #0004
|
|
bcc @2
|
|
inx
|
|
@2
|
|
stax pointer
|
|
shortm
|
|
dey ;0 count correction
|
|
beq @4 ;only 1 character, just do it.
|
|
@3
|
|
lda [pointer2],y
|
|
sta [pointer],y
|
|
dey
|
|
bne @3
|
|
@4
|
|
lda [pointer2],y ;move last byte also
|
|
sta [pointer],y
|
|
longm
|
|
lda ztemp2
|
|
rts
|
|
|
|
|
|
|
|
DoPath
|
|
**********************************************************************
|
|
*
|
|
* OLD DESCRIPTION (5.0.x)
|
|
* -----------------------
|
|
* This is like folder close.
|
|
* If already at the root we either fall off the edge of the world or do
|
|
* nothing. Should this be random?
|
|
*
|
|
* This routine falls through to DoClose
|
|
*
|
|
**********************************************************************
|
|
**********************************************************************
|
|
*
|
|
* 6.0 DESCRIPTION
|
|
*
|
|
* The "path item" is now a pop-up, showing the path from here all
|
|
* the way up to the volume name, and beyond that to the "Desktop"
|
|
* item (choosing Desktop is like clicking the Volumes button--it
|
|
* shows a list of online volumes).
|
|
*
|
|
* If we're already at the volume list, clicking here does nothing.
|
|
*
|
|
* Clicking in the path item rectangle, but to the right of the text
|
|
* we've drawn, does nothing.
|
|
*
|
|
**********************************************************************
|
|
|
|
txa
|
|
lsr a
|
|
sta pathDItemNum ;14-Jan-91 DAL
|
|
|
|
*** 18-Dec-91 DAL -- This check was obsolete and causing trouble.
|
|
;;; lda topflg ; don't do this if item disabled
|
|
;;; bne @notAtRoot
|
|
|
|
lda FGetPutFlag
|
|
and #InVolumeList
|
|
beq @notAtVolList
|
|
@ignoreClick brl LoopModal
|
|
@notAtVolList
|
|
;;;@notAtRoot
|
|
|
|
*** Do the cool new pop-up menu for the path item (14-Jan-91 DAL)
|
|
|
|
pha
|
|
pha
|
|
_FrontWindow
|
|
_SetPort ;moved from below, 18-Dec-91 DAL
|
|
|
|
*** added 18-Dec-91 DAL -- See if they clicked too far to the right
|
|
pha
|
|
pha ;result buffer for GetMouse
|
|
tsc
|
|
pea 0
|
|
inc a
|
|
pha ;address of the 4-byte result buffer we pushed
|
|
_GetMouse
|
|
ply ;Y coordinate
|
|
pla ;X coordinate
|
|
cmp PathItemRightEdge
|
|
bcs @ignoreClick
|
|
*** end 18-Dec-91
|
|
|
|
pea 0
|
|
_MenuStatus
|
|
pla
|
|
bne @1
|
|
brl @noMenuMgr
|
|
@1
|
|
jsr BuildPathMenu
|
|
|
|
pha
|
|
pha
|
|
_FrontWindow
|
|
lda pathDItemNum
|
|
pha
|
|
pushlong #thePathItemBox
|
|
_GetDItemBox
|
|
pushlong #thePathItemBox
|
|
_LocalToGlobal
|
|
|
|
pha
|
|
pha
|
|
_GetPort ;preserve the old port
|
|
pha
|
|
pha
|
|
_GetMenuMgrPort
|
|
_SetPort ;and pop up in the Menu Mgr port (full screen)
|
|
|
|
pha ;space for PopUpMenuSelect result
|
|
lda pmHighestID ;select with last (top) item inserted
|
|
pha
|
|
lda thePathItemBox+2 ;x coord, global coordinates
|
|
clc
|
|
adc #4 ;+4?
|
|
pha
|
|
lda thePathItemBox+0 ;y coord, global coordinates
|
|
clc
|
|
adc #4 ;y-coord + 4
|
|
pha
|
|
pea 0 ;flag (type 2 menu, no white space added)
|
|
pushlong PopUpMenuHandle
|
|
_PopUpMenuSelect
|
|
pla
|
|
sta theChosenItem
|
|
|
|
_SetPort ;restore the old port
|
|
jsr KillPathMenu
|
|
|
|
lda theChosenItem
|
|
beq @done
|
|
cmp #$0100 ;the Volumes item?
|
|
beq @UpToVolumes
|
|
cmp pmHighestID
|
|
beq @done
|
|
@popUpSome pha
|
|
jsr DirectoryUp
|
|
pla
|
|
inc a
|
|
cmp pmHighestID ;the top-level item
|
|
bne @popUpSome
|
|
brl GoListChanged ;re-do the list (short cut)
|
|
|
|
@UpToVolumes jsl BuildVolumeList
|
|
brl LoopModalReturn
|
|
|
|
@done
|
|
@noMenuMgr brl NoSelectionMade
|
|
|
|
*
|
|
* BuildPathMenu -- new routine 14-Jan-91 DAL
|
|
*
|
|
BuildPathMenu stz pmHandle1+1
|
|
stz pmHandle2+1
|
|
stz PopUpMenuBar+1
|
|
stz PopUpMenuHandle+1
|
|
pha
|
|
pha
|
|
_GetMenuBar
|
|
pla
|
|
sta OldMenuBar
|
|
pla
|
|
sta OldMenuBar+2
|
|
|
|
pha
|
|
pha
|
|
lda #0
|
|
pha
|
|
pha
|
|
_NewMenuBar
|
|
lda 3,s
|
|
sta PopUpMenuBar+2
|
|
lda 1,s
|
|
sta PopUpMenuBar
|
|
_SetMenuBar
|
|
|
|
pha
|
|
pha
|
|
pea 0
|
|
pushlong #MyMenuTemplate
|
|
_NewMenu2
|
|
lda 1,s
|
|
sta PopUpMenuHandle
|
|
lda 3,s
|
|
sta PopUpMenuHandle+2
|
|
pea 0 ;insert new menu at beginning of bar
|
|
_InsertMenu
|
|
|
|
pha
|
|
pha ;space for GetSysIcon (desktop icon)
|
|
pea 2 ;misc icon
|
|
lda #0
|
|
pha ;misc icon #0
|
|
pha
|
|
pha ;aux value (long)
|
|
_GetSysIcon
|
|
pla
|
|
sta theDeskIcon
|
|
pla
|
|
sta theDeskIcon+2
|
|
|
|
pea 0 ;by pointer
|
|
pushlong #MyVolItemTmpl
|
|
pea 0 ;at beginning of menu
|
|
pea 1 ;in Menu ID
|
|
_InsertMItem2
|
|
|
|
pea $0004 ;open folders, device at bottom
|
|
|
|
clc
|
|
lda <PrefixPtr
|
|
adc #2
|
|
tax
|
|
lda <PrefixPtr+2
|
|
adc #0
|
|
pha
|
|
phx ;pathname pointer (word-length string)
|
|
pea 0 ;device number (7-Feb-91 DAL)
|
|
pea 1 ;Menu ID
|
|
pea 0 ;insert at beginning of menu
|
|
pea $0101 ;starting Item ID
|
|
pushlong #IPMIResults
|
|
_InsertPathMItems
|
|
|
|
rts
|
|
|
|
pathDItemNum dc.w 0
|
|
thePathItemBox dc.w 0,0,0,0
|
|
|
|
MyMenuTemplate dc.w 0 ;version
|
|
dc.w 1 ;Menu ID
|
|
dc.w $0020 ;everything is by pointer; XOR drawing
|
|
dc.l MyMenuTitle ;empty title
|
|
dc.l 0 ;no items
|
|
MyMenuTitle dc.b 0 ;null pString
|
|
|
|
*** Here's my Desktop/Disks menu item template
|
|
MyVolItemTmpl dc.w 0 ;version
|
|
dc.w $0100 ;item ID
|
|
dc.b 0,0 ;key equivalents
|
|
dc.w 0 ;check mark
|
|
dc.w $0420 ;item flag (XOR, use ItemStruct for title)
|
|
dc.l DeskItemStruct ;copy of the Desktop icon
|
|
DeskItemStruct dc.w $8000 ;has an icon
|
|
dc.l theDeskString ;item name
|
|
theDeskIcon dc.l 0
|
|
theDeskString dc.b 5,'Disks' ;25-Mar-92 DAL
|
|
|
|
OldMenuBar dc.l 0
|
|
PopUpMenuBar dc.l 0
|
|
PopUpMenuHandle dc.l 0
|
|
theChosenItem dc.w 0
|
|
|
|
IPMIResults
|
|
pmHighestID dc.w 0
|
|
pmHandle1 dc.l 0
|
|
pmHandle2 dc.l 0
|
|
|
|
*
|
|
* KillPathMenu
|
|
*
|
|
KillPathMenu pea 1
|
|
_DeleteMenu
|
|
pushlong PopUpMenuHandle
|
|
_DisposeMenu
|
|
pushlong PopUpMenuBar
|
|
_DisposeHandle
|
|
pushlong pmHandle1
|
|
_DisposeHandle
|
|
pushlong pmHandle2
|
|
_DisposeHandle
|
|
pushlong OldMenuBar
|
|
_SetMenuBar
|
|
rts
|
|
|
|
|
|
**********************************************************************
|
|
*
|
|
* Close the current folder and back up one level (if we can).
|
|
*
|
|
* This routine will exit through ListChange above if a new list must
|
|
* must be redrawn.
|
|
*
|
|
**********************************************************************
|
|
DoClose
|
|
jsr DirectoryUp
|
|
bcs GoListChanged ;re-do the list (short cut)
|
|
jsl BuildVolumeList
|
|
brl LoopModalReturn
|
|
|
|
DoVolume
|
|
**********************************************************************
|
|
*
|
|
* kind of like new folder except we start from the root of the next volume
|
|
*
|
|
**********************************************************************
|
|
lda FGetPutFlag
|
|
bit #TABorMouseDown
|
|
bne VolListCheck
|
|
|
|
jsl BuildVolumeList ;Display list of volumes online.
|
|
bra NoSelectionMade
|
|
|
|
VolListCheck and #$FFFF-TABorMouseDown ;Clear the TAB bit since we're handling it now.
|
|
sta FGetPutFlag
|
|
doVolume2 jsr NextDrive ;step to next drive and zero topflg
|
|
bcc GoListChanged
|
|
jsr PutUpAlert
|
|
bcs doCancel
|
|
GoListChanged brl ListChange
|
|
NoSelectionMade clc
|
|
brl LoopModalReturn
|
|
|
|
DoCancel
|
|
*
|
|
pha
|
|
lda #0000 ;cancel, blank prefix
|
|
sta [ReplyPtr]
|
|
pla ;keep error correct
|
|
**********************************************************************
|
|
*
|
|
* Obviously if this button is pressed we are leaving!
|
|
*
|
|
**********************************************************************
|
|
DoExit
|
|
pha ;save error if any
|
|
php ;save possible carry (if error)
|
|
|
|
PushZLong DialogPtr
|
|
_CloseDialog
|
|
|
|
*** this hoses you if it's a resource, so let's call the routine that was made for it instead! 2-Apr-93 SS
|
|
;; Since this handle was not unlocked earlier to fix a bug it is now time
|
|
;; to clean up and unlock the handle. 6/8/89 Mensch fix #2
|
|
; lda promptverb
|
|
;; and #$0003 ;removed 22-Mar-93 SS
|
|
; beq @byptr
|
|
; pha ;space for results
|
|
; pha
|
|
; ldax promptptr
|
|
; PushAX
|
|
; _FindHandle
|
|
; _HUnLock
|
|
;@byPtr
|
|
;; end fix #2
|
|
|
|
jsr prompt_release
|
|
*** end 2-Apr-93 SS
|
|
plp
|
|
pla
|
|
rts
|
|
|
|
|
|
**********************************************************************
|
|
*
|
|
* NextDrive -- step to next drive
|
|
*
|
|
* The assumption is that the current path is already pointed to by the
|
|
* ptr 'PrefixPtr' in a class 1 string
|
|
*
|
|
* Exit:
|
|
* Carry is set if we can't find a drive to change to!
|
|
* Carry clear if a new drive was selected or a new volume is
|
|
* in the current drive.
|
|
*
|
|
**********************************************************************
|
|
NextDrive
|
|
*
|
|
* Since NextDrive is ALWAYS is going to be the top level, the following
|
|
* code will set the directory level to top EVEN if no disk is inserted.
|
|
* Also pre-zero the number of entries as this will blank the list on a
|
|
* disk error.
|
|
*
|
|
* This helps stop a possible bugs.
|
|
*
|
|
lda CurDev
|
|
bne @1
|
|
rts
|
|
@1
|
|
jsr DirectoryUp
|
|
lda topflg
|
|
bne @1
|
|
NextDrive2 lda #0 ;say no items
|
|
ldy #ListRecord.ListCount
|
|
sta [ListRecPtr],y ;number of entries found.
|
|
*
|
|
* Go get name of current device # and see if the volume name changed
|
|
*
|
|
lda curDev ;starting point
|
|
pha ;save it on stack for later check
|
|
jsr DoDInfoCall ; get Dev number
|
|
bcs Bump ;if an error on occured, next device
|
|
*
|
|
* now pass that name to _Volume and get the Volume name. Parameter count is still 2
|
|
*
|
|
jsr DoVolumeCall
|
|
bcs Bump ;if an error occured, go to next device NOW
|
|
*
|
|
* compare new name to the one in prefixptr.
|
|
* check to see if the lengths are different first
|
|
*
|
|
ldy #0002
|
|
lda [volName_Volume],y ;length of returned string
|
|
sta ztemp1 ;hold length
|
|
inc a ;pretend it has a seperator!!! (cheat for length check)
|
|
cmp [PrefixPtr],y ;see if different length
|
|
bne different ;different lengths!
|
|
iny
|
|
iny ;point to first character
|
|
|
|
shortm
|
|
loop
|
|
lda [volName_Volume],y ;character
|
|
;;; cmp [PrefixPtr],y ;see if same
|
|
*** 27-Apr-92 DAL -- case-insensitive compare
|
|
cmp #'a'
|
|
bcc @notLC
|
|
cmp #'z'+1
|
|
bcs @notLC
|
|
and #$df
|
|
@notLC sta @cheat+1
|
|
lda [<PrefixPtr],y
|
|
cmp #'a'
|
|
bcc @notLC2
|
|
cmp #'z'+1
|
|
bcs @notLC2
|
|
and #$df
|
|
@notLC2
|
|
@cheat cmp #$77 ;*** modified ***
|
|
*** end 27-Apr-92
|
|
bne different ;if different, skip the bump
|
|
iny
|
|
dec ztemp1
|
|
bne loop ;keep looking!
|
|
*
|
|
* if here, they are the same so we can bump the drive #
|
|
*
|
|
longm ;back to long mode
|
|
|
|
*** added support for going backwards thru the drives 17-Mar-93 SS
|
|
lda FGetPutFlag
|
|
bit #TabBackwards
|
|
beq @fwd
|
|
dec curDev
|
|
lda 1,s
|
|
dec a
|
|
bra @ok
|
|
*** end 17-Mar-93 SS
|
|
@fwd inc curDev
|
|
lda 1,s
|
|
inc a
|
|
@ok sta 1,s
|
|
bra different
|
|
Bump
|
|
*** added support for going backwards thru the drives 17-Mar-93 SS
|
|
lda FGetPutFlag
|
|
bit #TabBackwards
|
|
beq @fwd
|
|
dec curDev
|
|
bra @ok
|
|
*** end 17-Mar-93 SS
|
|
@fwd inc curDev
|
|
@ok lda curDev
|
|
cmp 1,s ;see if we came all the way around
|
|
bne different
|
|
brl error
|
|
|
|
different
|
|
longm ;make sure in long mode
|
|
jsr DoDInfoCall ;translate # to name
|
|
bcc InfoOk ;if no error, this device is OK
|
|
*** added support for going backwards thru the drives 17-Mar-93 SS
|
|
lda FGetPutFlag
|
|
bit #TabBackwards
|
|
beq @fwd
|
|
jsr SetToMaxDev ;restart with highest dev (+1)
|
|
bra Bump
|
|
*** end 17-Mar-93 SS
|
|
@fwd stz curDev ;restart with lowest dev (-1)
|
|
bra Bump
|
|
|
|
*
|
|
* Entry point for routine NextDrive1. Called by routine ServiceDiskSwitch.
|
|
* This is called when we want the volume in CURDEV to be rescanned.
|
|
*
|
|
|
|
NextDrive1 pha ;pha just to balance stack at the end
|
|
InfoOk
|
|
jsr DoVolumeCall ;get volume name
|
|
bcc VolumeOK ;were ok on the volume
|
|
cmp #$002e ;disk switched?
|
|
bne Bump ;any other error just go to next drive
|
|
bra VolumeOK
|
|
*
|
|
* Now put the new volumename back into PrefixPtr and BuildList Again
|
|
*
|
|
VolumeOK1 pha
|
|
VolumeOK
|
|
ldy #0002
|
|
lda [volName_Volume],y ;length of returned string
|
|
beq Bump ;if 0, bad device (DEBUG***)
|
|
sta ztemp1 ;hold length
|
|
inc a ;count one for end seperator
|
|
sta [PrefixPtr],y ;save new length
|
|
dec a ;restore a
|
|
iny
|
|
iny
|
|
shortm
|
|
loop2
|
|
lda [volName_Volume],y ;character
|
|
sta [PrefixPtr],y ;see if same
|
|
iny
|
|
dec ztemp1
|
|
bne loop2 ;keep moving
|
|
;;; lda Seperator ;I end my prefixes with a seperator
|
|
*** changed 6-May-93 DAL/SS -- Separator is not set up at this point, or not always, so use
|
|
*** whatever we got at the beginning of the volume name.
|
|
phy
|
|
ldy #4
|
|
lda [volName_Volume],y
|
|
ply
|
|
*** end 6-May-93
|
|
sta [PrefixPtr],y
|
|
longm
|
|
|
|
jsr SetThePrefix ;reset prefix 8 and 0
|
|
|
|
bit FGetPutFlag ;if this is Put....
|
|
bpl skipit ;skip if get
|
|
|
|
PushZLong DialogPtr
|
|
_SetPort ;make sure the port is set.
|
|
|
|
PushZLong DialogPtr
|
|
PushWord #0011 ;Put StatText item
|
|
PushZPtr tempRect ;where to store the Rect
|
|
_GetDItemBox
|
|
PushZPtr tempRect
|
|
_InvalRect ;rect is invalid and should redraw
|
|
skipit
|
|
clc ;no error
|
|
bra NDExit
|
|
error
|
|
sec ;error occured
|
|
NDExit lda FGetPutFlag
|
|
and #$FFFF-TabBackwards ;clr flag
|
|
sta FGetPutFlag
|
|
pla ;fix stack (returns original curDev)
|
|
rts
|
|
|
|
;
|
|
; Reset curDev to the highest device in the current universe. 17-Mar-93 SS
|
|
;
|
|
SetToMaxDev
|
|
lda #$0005
|
|
sta ParBlock ;all 6 parameters back ($11 bytes)
|
|
stz statuscode_DStatus ;request device status
|
|
PushZPtr ParBlock2 ;a place for return of a few bytes
|
|
PullAX
|
|
stax statlist_DStatus ;will return status here
|
|
lda #2
|
|
sta rcount_DStatus
|
|
stz rcount_DStatus+2
|
|
stz devNum_DStatus
|
|
|
|
@loop inc devNum_DStatus
|
|
PushZPtr ParBlock ;pointer to parameter block
|
|
PushWord #$202D ;_D_Status
|
|
jsl ProDos_Stack_Entry ;stack based call
|
|
bcc @loop
|
|
lda devNum_DStatus
|
|
sta curDev
|
|
rts
|
|
|
|
**********************************************************************
|
|
*
|
|
* DogetFileInfo. Saves memory by making the getFileINfo call a subroutine.
|
|
*
|
|
* Inputs: PrefixPtr = current path.
|
|
*
|
|
* Side Effects: The information in the memory area for ParBlock is lost.
|
|
*
|
|
*
|
|
**********************************************************************
|
|
DoGetFileInfo
|
|
|
|
lda #$07 ;need 7
|
|
sta parBlock ;need to get the file info ($1F bytes)
|
|
*
|
|
* here, PrefixPtr should point to the volume of interest
|
|
*
|
|
ldax PrefixPtr
|
|
clc
|
|
adc #0002
|
|
bcc @01
|
|
inx
|
|
@01
|
|
stax ParPath_GFI
|
|
PushZPtr ParBlock ;pointer to parameter block
|
|
PushWord #$2006 ;_GetFileInfo_C1
|
|
jsl ProDos_Stack_Entry ;stack based call
|
|
rts
|
|
|
|
**********************************************************************
|
|
*
|
|
* DoDInfoCall. Saves memory by making the DInfo call a subroutine.
|
|
* results are plced in the memory allocated at startup and pointed
|
|
* to by DinfoPtr.
|
|
*
|
|
* Inputs: curDev = current device number (as set by GetThePrefix)
|
|
*
|
|
* Side Effects: The information in the memory area for DInfo called
|
|
* is updates. Any old information is lost.
|
|
*
|
|
* Returns carry set if an error and a = error #
|
|
*
|
|
**********************************************************************
|
|
DoDInfoCall
|
|
*
|
|
* but first, I'll do a status to get write protect information
|
|
*
|
|
lda #$0005
|
|
sta ParBlock ;all 6 parameters back ($11 bytes)
|
|
lda curDev ;current device number
|
|
sta devNum_DStatus
|
|
stz statuscode_DStatus ;request device status
|
|
PushZPtr ParBlock2 ;a place for return of a few bytes
|
|
PullAX
|
|
stax statlist_DStatus ;will return status here
|
|
lda #2
|
|
sta rcount_DStatus
|
|
stz rcount_DStatus+2
|
|
|
|
PushZPtr ParBlock ;pointer to parameter block
|
|
PushWord #$202D ;_D_Status
|
|
jsl ProDos_Stack_Entry ;stack based call
|
|
|
|
stz writeProtect ;guess not write protected
|
|
lda ParBlock2 ;low word
|
|
bit #writeProtBit
|
|
beq @1 ;not write protected
|
|
dec writeProtect
|
|
@1
|
|
lda #08 ;get lots of stuff as someone may need it.
|
|
sta ParBlock ;8 parameters to DInfo ($15 bytes)
|
|
lda curDev ;current device number
|
|
sta devNum_DInfo
|
|
ldax DinfoPtr
|
|
stax devName_DInfo ;a place for the returned name
|
|
|
|
PushZPtr ParBlock ;pointer to parameter block
|
|
PushWord #$202C ;_DInfo_C1
|
|
jsl ProDos_Stack_Entry ;stack based call
|
|
rts
|
|
|
|
**********************************************************************
|
|
*
|
|
* DoVolume called a few places above. Leaves info in ParBlock.
|
|
*
|
|
* This routine also gets the total blocks and total free blocks of the current
|
|
* drive and saves them in [SizeInfoPtr],y where y is totalSize or totalFree.
|
|
* In addition, a P-String is made of each value and saved in [SizeInfoPtr],y
|
|
* where y is totalSizeStr or totalFreeStr. ParamText is called so that the
|
|
* replacement strings are ready for any dialog that needs them.
|
|
*
|
|
* Returns carry set if an error and a = error # on the _Volume call.
|
|
*
|
|
**********************************************************************
|
|
DoVolumeCall lda #$0006
|
|
sta ParBlock ;all 6 parameters back ($15 bytes)
|
|
lda DinfoPtr ;memory for Dev Name Input
|
|
clc
|
|
adc #2 ;Passed the buffer size
|
|
sta devName_Volume
|
|
lda DinfoPtr+2
|
|
adc #0
|
|
sta devName_Volume+2
|
|
ldax NamePtr ;This will make a good temp location...
|
|
stax volName_Volume ;...to put the results
|
|
ldy #0002
|
|
lda #0000
|
|
sta [volName_Volume],y ;0 length (DEBUG)
|
|
*
|
|
* DEBUG: the above corrects a new porblem on 4.1d8. Volume calls on non block devices
|
|
* no longer return an error. I'll detect 0 length on the volume name and skip the device.
|
|
* Could cause a problem on any real unnamed device.
|
|
*
|
|
|
|
PushZPtr ParBlock ;pointer to parameter block
|
|
PushWord #$2008 ;_Volume_C1
|
|
jsl ProDos_Stack_Entry ;stack based call
|
|
bcs @notOK
|
|
brl statusOK
|
|
@notOK cmp #$57 ;DAL 6-Jan-91 duplicate volume
|
|
beq badvolume ;DAL 21-Apr-91
|
|
cmp #$52 ;Is it unknown volume error?
|
|
beq badvolumeFileSys
|
|
cmp #$27 ;Is it an I/O error
|
|
bne JustReturnError
|
|
|
|
pha ;Save error code on stack
|
|
lda curdev ;Get device number of device we're looking at
|
|
asl a
|
|
tax
|
|
lda StaticDeviceTable,x
|
|
beq badvolume2 ;error code already on the stack!
|
|
pla ;get error back in a-reg
|
|
|
|
JustReturnError sec
|
|
brl ErrorOccurred
|
|
*
|
|
* 6-Jan-91 DAL
|
|
*
|
|
* Call ErrorWindow and eject the disk.
|
|
* We do this for Duplicate Volume, and maybe for others later.
|
|
*
|
|
ErrorAndEject pha ;put error on stack so Eject can pull it later
|
|
|
|
pha ;space for result
|
|
pea 0 ;substitution type
|
|
pea 0
|
|
pea 0 ;substitution array
|
|
pha ;error code
|
|
_ErrorWindow
|
|
pla ;button number (ignore)
|
|
brl EjectThatThang
|
|
* end of 6-Jan-91 DAL
|
|
|
|
badvolumeFileSys
|
|
|
|
badvolume pha ;Save error code.
|
|
badvolume2 _InitCursor
|
|
|
|
*** added 15-Apr-91 DAL -- let HandleDiskInsert to most of the work for us
|
|
pha ;space for result flags
|
|
pha ;space for result device number
|
|
pea $4000 ;handle this insertion
|
|
pei <curDev ;devNum input
|
|
_HandleDiskInsert
|
|
plx ;device number
|
|
ply ;result flags
|
|
bcs @err
|
|
|
|
txa
|
|
beq @err ;devnum=0 means they ejected--treat it like an error
|
|
|
|
pla ;kill old error code
|
|
brl DoVolumeCall
|
|
|
|
@err pla
|
|
sec
|
|
brl ErrorOccurred
|
|
|
|
*** end of 15-Apr-91 DAL
|
|
|
|
*
|
|
* Eject device <curdev (DAL)
|
|
*
|
|
EjectThatThang lda #5
|
|
sta ParBlock
|
|
lda <curDev
|
|
sta devNum_DControl
|
|
lda #ejectMedium
|
|
sta controlCode
|
|
PushZPtr ParBlock ;pointer to parameter block
|
|
PushWord #$202E ;_DControl
|
|
jsl ProDos_Stack_Entry ;stack based call
|
|
|
|
pla ;get error code back
|
|
sec
|
|
brl ErrorOccurred
|
|
|
|
statusOK lda ParFileSysID_Volume
|
|
sta FileSysID
|
|
|
|
ldax ParTotBlks_Volume ;total blocks
|
|
jsr convert_to_k ;change blocks to K
|
|
PushAX ;on the stack for string call (later)
|
|
stax [SizeInfoPtr],totalSize ;save total blocks
|
|
ldax ParFreeBlks_Volume ;free blocks
|
|
jsr convert_to_k ;change blocks to K
|
|
PushAX ;free on the stack for string call
|
|
stax [SizeInfoPtr],totalFree ;save free size
|
|
|
|
ldax SizeInfoPtr
|
|
sec ;add 1 to leave space for string size
|
|
adc #totalFreeStr ;point to place for string
|
|
bcc @1
|
|
inx
|
|
@1
|
|
*
|
|
* total free is on the stack
|
|
*
|
|
PushAX ;destination of string 1
|
|
; PushWord #0010 ;10 characters
|
|
; PushWord #False ;unsigned
|
|
; _Long2Dec ;string set up 1
|
|
jsr Long2DecTen ;5-Mar-92 DAL
|
|
*
|
|
* total size should still be on the stack.
|
|
*
|
|
ldax SizeInfoPtr
|
|
sec
|
|
adc #totalSizeStr
|
|
bcc @2
|
|
inx
|
|
@2
|
|
PushAX ;destination of string 2
|
|
; PushWord #0010 ;10 characters
|
|
; PushWord #False
|
|
; _Long2Dec
|
|
jsr Long2DecTen ;5-Mar-92 DAL
|
|
*
|
|
* scan integer math string and make a P-string
|
|
*
|
|
ldy #totalFreeStr+1 ;where the string starts
|
|
jsr findspace ;pass spaces
|
|
*
|
|
* AX contains a pointer to a P-string of total blocks (resides in memory of SizeInfoPtr)
|
|
*
|
|
PushAX ;ParamText needed it here
|
|
*
|
|
* repeat for free blocks
|
|
*
|
|
ldy #totalSizeStr+1 ;where the string starts
|
|
jsr findspace ;pass spaces
|
|
PushAX
|
|
PushLong #0
|
|
PushLong #0 ;last 2 strings blank
|
|
_ParamText
|
|
clc ;ignoring errors from conversion
|
|
ErrorOccurred
|
|
rts
|
|
|
|
*** Added 5-Mar-92 DAL
|
|
*
|
|
* Long2DecTen -- call Long2Dec, unsigned, 10-character buffer.
|
|
*
|
|
* The long value and string pointer have already been pushed.
|
|
*
|
|
export Long2DecTen
|
|
Long2DecTen plx
|
|
stx @theRTS
|
|
lda 3,s
|
|
ora #$8000 ;turn on bit 31 of stringPtr
|
|
sta 3,s
|
|
pea 10 ;ten-byte buffer
|
|
pea 0 ;unsigned
|
|
_Long2Dec
|
|
ldx @theRTS
|
|
phx
|
|
rts
|
|
|
|
@theRTS dc.w 0
|
|
*** end 5-Mar-92
|
|
|
|
**********************************************************************
|
|
*
|
|
* local subroutine to scan an integer math string and find the first non blank space.
|
|
* The string is updated to a P-String with a size byte in the front.
|
|
* On exit A,X contain a pointer to the P-String.
|
|
* (it is assumed that the starting math string is never longer than 10 characters)
|
|
*
|
|
**********************************************************************
|
|
findspace
|
|
shortm
|
|
ldx #0010 ;all 10 characters as a guess
|
|
@1
|
|
lda [SizeInfoPtr],y ;look for blanks
|
|
cmp #$20 ;blank?
|
|
bne done ;if not, we are done
|
|
iny ;look in next space
|
|
dex ;if 0, we did the whole thing!
|
|
bne @1 ;I assume I'll find one (I better!)
|
|
done
|
|
txa
|
|
dey ;put size byte in front of string
|
|
sta [SizeInfoPtr],y ;save size in string
|
|
longm
|
|
phy ;offset to string
|
|
clc
|
|
ldax SizeInfoPtr ;make a pointer to the string
|
|
adc 1,s
|
|
bcc @3
|
|
inx
|
|
@3
|
|
ply ;y is don't care here..fix stack
|
|
rts
|
|
|
|
**********************************************************************
|
|
*
|
|
* Convert_to_K will convert number of blocks returned by the Volume call
|
|
* to the proper number in kbytes it represents.
|
|
*
|
|
* Input A,X = total number of blocks
|
|
*
|
|
* Output a,x = total in K
|
|
*
|
|
**********************************************************************
|
|
convert_to_k
|
|
PushLongSpace ;results
|
|
PushLongSpace
|
|
PushAX ;number of blocks
|
|
PushWord #0 ;high byte of multipler
|
|
PushWord ParBlksSize_Volume ;size of blocks
|
|
_LongMul
|
|
PullLong ztemp1
|
|
PullLong ztemp2 ;temp hold
|
|
*
|
|
* divide by 1024. 2 shifts and drop the bottom byte as a cheat)
|
|
*
|
|
ldx #0002 ;2 shifts = divide by 4
|
|
@1
|
|
lsr ztemp2+2
|
|
ror ztemp2
|
|
ror ztemp1+2
|
|
ror ztemp1
|
|
dex
|
|
bne @1
|
|
lda ztemp1+1 ;attempting to drop bottom byte (equiv to dividing by 256)
|
|
ldx ztemp1+3 ;Bug #MTLRAF019, used to be ldx ztemp2+1
|
|
rts
|
|
|
|
ENDP
|
|
|
|
|
|
|
|
GetFilter PROC
|
|
*****************************************************************
|
|
*
|
|
* GetFilter
|
|
*
|
|
* This routine is called during the ModalDialog for the GET routines
|
|
* and handles all the list manager stuff.
|
|
*
|
|
* It should be noted that I do not have direct access to my direct page
|
|
* since this is called FROM the Dialog Manager.
|
|
*
|
|
* The following is already on the stack (from the call) so just use
|
|
* that memory.
|
|
*
|
|
*****************************************************************
|
|
DefineStack
|
|
editText block 36 ;arghh, a temp area to put the result of the edit box
|
|
keymod word
|
|
keycode word ;temp locations to put key information
|
|
atemp long
|
|
FGetPutCopy word ;a copy of the FGetPutFlag
|
|
FoundControl long
|
|
MyDPPtr long ;pointer back to MY DP (Wait, this gets better!)
|
|
OrigB byte
|
|
OrigD word
|
|
RTLAdr block 3
|
|
ItemHitPtr long
|
|
EventPtr long
|
|
theDialogPtr long
|
|
ReturnFlag long
|
|
*
|
|
*****************************************************************
|
|
with PopUpGlobals
|
|
|
|
phd ; save d
|
|
phb
|
|
phk ; set b to our bank
|
|
plb
|
|
|
|
|
|
tsc ; turn stack into dp
|
|
sec
|
|
sbc #54 ;allocate space on stack for extra items
|
|
tcs ;move stack
|
|
tcd ;set dp
|
|
|
|
PushLongSpace ;results
|
|
PushWord #0 ;system tool
|
|
PushWord #$0017 ;Standard File tool set
|
|
_GetWap
|
|
PullLong MyDPPtr ;local use
|
|
|
|
stz ReturnFlag ; we always return false (guess)
|
|
|
|
pha
|
|
pha
|
|
_GetTick
|
|
ply
|
|
plx
|
|
tya
|
|
sec
|
|
sbc TickCount
|
|
cmp #40
|
|
bcs TimeToPollDisks
|
|
bra NoPoll ; as opposed to SaPoll
|
|
|
|
TimeToPollDisks sty TickCount
|
|
stx TickCount+2
|
|
jsl PollDevices ;see if any disk switch events have occurred
|
|
|
|
NoPoll lda MyDPPtr
|
|
jsl ServiceDiskSwitch
|
|
bcc @notEmpty
|
|
lda #$FFFF
|
|
sta ReturnFlag
|
|
brl ReallyDone
|
|
@notEmpty
|
|
jsr CheckVolume ;AppleShare update check!
|
|
|
|
ldy #FGetPutFlag
|
|
lda [MyDpPtr],y
|
|
sta FGetPutCopy ;get a copy, we need this alot here
|
|
|
|
bpl @notPut
|
|
*** if FunkyPutFile AND item#10 active, make next edit item active instead 23-Mar-93 SS
|
|
bit #FunkyPutFile ;is #10 visible?
|
|
beq @not10 ; no, skip
|
|
lda #10
|
|
jsr IsItActive ;is #10 is active?
|
|
tay
|
|
beq @not10 ; no
|
|
PushLong [MyDpPtr],DialogPtr
|
|
jsr FindItemAfter10 ; yes, skip to next edit item
|
|
pha ;the item id
|
|
pea 0 ;select all
|
|
pea $7fff
|
|
_SelectIText
|
|
@not10
|
|
*** set the ListActive flag 19-Mar-93 SS
|
|
lda #8 ;see if #8 (the list) is active
|
|
jsr IsItActive
|
|
tay
|
|
lda FGetPutCopy ;get current state
|
|
tyx ;condition P
|
|
bne @activate
|
|
|
|
@deactivate bit #PutFileListActive ;isolate the ListActive bit
|
|
beq @alreadySet ;if already clr, do nothing
|
|
bra @update
|
|
|
|
@activate bit #PutFileListActive
|
|
bne @alreadySet ;if already set, do nothing
|
|
@update
|
|
jsr ToggleListTarget ;flip list state
|
|
; brl AllDone ;*** removed 24-Mar-93 SS
|
|
@alreadySet
|
|
@notPut
|
|
|
|
*
|
|
*--------------------------------------------------------------
|
|
*
|
|
lda [EventPtr]
|
|
*** added 1-Apr-91 DAL -- update the focus frame
|
|
cmp #updateEvt
|
|
bne @notUpdateEvent
|
|
|
|
*** added 21-Oct-91 DAL -- only redraw for *my* update events!
|
|
ldy #omessage+1
|
|
lda [<EventPtr],y
|
|
cmp <theDialogPtr+1 ;since windows take more than 1 page,
|
|
bne @notMyUpdate ;I can compare the middle word!
|
|
*** end 21-Oct-91
|
|
|
|
ldy #FGetPutFlag
|
|
lda [<MyDPPtr],y
|
|
jsr UpdateFocusFrame
|
|
|
|
brl AllDone
|
|
@notMyUpdate
|
|
*** try to update window in the background 18-Mar-93 SS
|
|
pea $8000
|
|
ldy #omessage+2
|
|
lda [<EventPtr],y
|
|
pha
|
|
dey
|
|
dey
|
|
lda [<EventPtr],y
|
|
pha
|
|
; _UpdateWindow
|
|
ldx #$6c0e
|
|
jsl $e10000
|
|
brl AllDone
|
|
*** end 18-Mar-93 SS
|
|
@notUpdateEvent
|
|
*** end of 1-Apr-91 DAL
|
|
|
|
cmp #mouseDownEvt ;event?
|
|
beql AMouseDown ;go do mouse down
|
|
cmp #autoKeyEvt ;key from here?
|
|
beq aKey
|
|
cmp #keyDownEvt ;see if a key was pressed
|
|
bnel AllDone ;forget it.
|
|
aKey
|
|
ldy #omessage ;get key
|
|
lda [EventPtr],y ;get the key value
|
|
and #$00FF ;byte value
|
|
tax ;save a copy of the key code
|
|
ldy #omodifiers
|
|
lda [EventPtr],y
|
|
sta keymod ;save modifiers, we will need it
|
|
bit #appleKey ;Apple key pressed?
|
|
bne @isCommand
|
|
brl NotCommand ;skip check on all Apple Keys
|
|
|
|
@isCommand txa ;key back into A
|
|
|
|
ldx #$0004 ;cancel (for Get)
|
|
cmp #'.' ;this would be a cancel
|
|
beq @toCommonKey ;got it
|
|
|
|
* DAL 6-Jan-91
|
|
*
|
|
* check for Volumes (Apple-v, Apple-V, Apple-d, Apple-D, Apple-ESC)
|
|
*
|
|
ldx #3 ;volumes button (for Get)
|
|
*** 14-Mar-91 DAL--removed Apple-V = Volumes because that usually means Paste
|
|
; cmp #'v'
|
|
; beq CommonKey
|
|
; cmp #'V'
|
|
; beq CommonKey
|
|
|
|
cmp #'d'
|
|
beq CommonKey
|
|
cmp #'D'
|
|
beq CommonKey
|
|
cmp #$1b
|
|
beq CommonKey
|
|
* end of 6-Jan-91 DAL
|
|
|
|
*** added Cmd-Shift-Up equivalent 17-Mar-93 SS
|
|
cmp #$0b ;up arrow?
|
|
bne @notvolume
|
|
tay ; yes, hold key in Y
|
|
lda keymod
|
|
bit #shiftKey ; and make sure the shift key is also down
|
|
bne CommonKey ;OK
|
|
tya ;otherwise, restore A
|
|
@notvolume
|
|
*** end 17-Mar-93 SS
|
|
*
|
|
* check for open (Apple-o, Apple-O, Apple-down)
|
|
*
|
|
ldx #0001 ;open button
|
|
cmp #'o'
|
|
@toCommonKey beq CommonKey ;got it!
|
|
cmp #'O'
|
|
beq CommonKey ;OK
|
|
cmp #$000A ;down arrow is also open
|
|
beq CommonKey
|
|
|
|
*** 10-Jun-91 DAL -- Use Apple-Tab to switch volumes
|
|
*** added Cmd-right & Cmd-lt equivalents 17-Mar-93 SS
|
|
tay ;hold a copy in Y for backward flag setting
|
|
cmp #$15 ;Cmd-right arrow
|
|
beq @tab ; same as Cmd-Tab
|
|
cmp #$08 ;Cmd-left arrow
|
|
beq @tab ; same as backward Cmd-Tab
|
|
*** end 17-Mar-93 SS
|
|
cmp #$0009
|
|
bne @notTab
|
|
@tab lda FGetPutCopy
|
|
bit #InVolumeList
|
|
beq @notInVolList
|
|
brl KeyDone
|
|
@notInVolList
|
|
ora #TABorMouseDown
|
|
*** added backward tabbing 17-Mar-93 SS
|
|
cpy #$08 ;backward?
|
|
bne @fwd
|
|
ora #TabBackwards
|
|
*** end 17-Mar-93 SS
|
|
@fwd ldy #FGetPutFlag
|
|
sta [MyDpPtr],y
|
|
ldx #0003 ;drive button execute
|
|
bit FGetPutCopy
|
|
bpl @tab1
|
|
inx ;put is 1 higher in the id.
|
|
@tab1 txa
|
|
sta [ItemHitPtr] ;say item hit - (USM)
|
|
brl KeyDone
|
|
@notTab
|
|
*** end of Apple Tab code (switch volumes)
|
|
|
|
*
|
|
* in Put, Command N is New Folder
|
|
*
|
|
bit FGetPutCopy ;see if Put
|
|
bpl @1
|
|
ldx #0011 ;new folder button is 12 (It will get bumped)
|
|
cmp #'n'
|
|
beq CommonKey
|
|
cmp #'N'
|
|
beq CommonKey
|
|
;*
|
|
;* Still in PutFile only, Apple-Tab bops between the list and the edit-line
|
|
;*
|
|
; cmp #$0009
|
|
; bne @notAppleTab
|
|
;*---------- Handle an Apple-Tab
|
|
;; jsr ToggleListTarget
|
|
;; brl KeyDone
|
|
;*---------- end of Apple-Tab code
|
|
;@notAppleTab
|
|
|
|
@1
|
|
*
|
|
* other command key equiv. could be added here
|
|
*
|
|
* the following must be the last item!
|
|
*
|
|
cmp #$000B ;Command up arrow is Close
|
|
bne @2
|
|
brl Escape
|
|
@2
|
|
brl AllDone
|
|
CommonKey
|
|
bit FGetPutCopy
|
|
bpl @1
|
|
inx ;put is 1 higher in the id.
|
|
@1
|
|
txa
|
|
jsr SeeIfItemEnabled
|
|
bcc @ok
|
|
brl KeyDone ;12-Jan-91 DAL
|
|
@ok sta [ItemHitPtr] ;say item hit - (USM)
|
|
dec ReturnFlag ;sets it to $FFFF (it was 0)
|
|
*
|
|
* now flash the button
|
|
*
|
|
PushWord #00 ; value for unhighlighting button second.
|
|
PushLongSpace ; Result
|
|
PushLong [MyDpPtr],DialogPtr ; the dialog pointer
|
|
phx ;item number for cancel ; Item Number.
|
|
_GetControlDItem
|
|
PushWord #02 ; value for hilighting button
|
|
lda 5,s
|
|
pha
|
|
lda 5,s ; copy the results for first call
|
|
pha
|
|
_HiliteControl ; Make sure it's on
|
|
*
|
|
* returns handle to item on stack. Stack already has the desired state there!
|
|
*
|
|
_HiliteControl ; Make sure it's off again
|
|
brl KeyDone
|
|
*
|
|
* key press, but not a command key
|
|
*
|
|
NotCommand txa ;recall key code
|
|
cmp #$0D ;CR hit?
|
|
bne NotCR
|
|
bit FGetPutCopy
|
|
bpl ItsActive ;if get then just pass <return> to dialog mgr
|
|
|
|
; A <return> key for put dialogs is a little more complicated. BRC #65378.
|
|
; We need to check if the button is active or not before we pass the <return> key along to the
|
|
; dialog mgr. If default button is not active then <return> could get passed onto the edit line
|
|
; item which could erase the current selection.
|
|
|
|
PushLongSpace ;space for result
|
|
PushLong [MyDpPtr],DialogPtr
|
|
pea 1 ;item number for default button
|
|
_GetControlDItem
|
|
phd ;turn stack into dp for now
|
|
tsc
|
|
tcd
|
|
|
|
CurrentDPage equ 1 ;stack frame
|
|
TheHandle equ CurrentDPage+2
|
|
|
|
ldy #2 ;deref handle to default button control and
|
|
lda [<TheHandle],y ;find out if button is active or not
|
|
tax
|
|
lda [<TheHandle]
|
|
sta <TheHandle
|
|
stx <TheHandle+2
|
|
ldy #octlHilite ;hilite field tells us state of button
|
|
lda [<TheHandle],y
|
|
and #$00FF
|
|
pld ;restore direct page
|
|
plx ;get handle to control off of stack
|
|
plx
|
|
cmp #255 ;test if control is active or not
|
|
bne ItsActive
|
|
brl KeyDone ;it's inactive so just ignore this <return>
|
|
|
|
ItsActive brl PassKey ;it's active so pass <return> back to dialog mgr
|
|
|
|
NotCR txa ;copy of the key
|
|
cmp #$09 ;tab key? (Drive button)
|
|
bne NotTab
|
|
*** don't let any tabs go to ListKey 19-Mar-93 SS
|
|
brl PassKey
|
|
|
|
;*---------- Handle a non-Apple Tab
|
|
; lda FGetPutCopy
|
|
; bit #InVolumeList
|
|
; beq @notInVolList
|
|
; brl KeyDone
|
|
;@notInVolList
|
|
; ora #TABorMouseDown
|
|
; ldy #FGetPutFlag
|
|
; sta [MyDpPtr],y
|
|
; ldx #0003 ;drive button execute
|
|
; bit FGetPutCopy
|
|
; bpl @1
|
|
; inx ;put is 1 higher in the id.
|
|
;@1 txa
|
|
; sta [ItemHitPtr] ;say item hit - (USM)
|
|
; brl KeyDone
|
|
;*---------- end of non-Apple Tab code
|
|
|
|
;*---------- new non-Apple Tab code
|
|
; bit FGetPutCopy
|
|
; bpl @doNothing ;for GetFile Tab does nothing!
|
|
; jsr ToggleListTarget
|
|
;@doNothing brl KeyDone
|
|
;*---------- end of non-Apple Tab code
|
|
NotTab
|
|
*** end 18-Mar-93 SS
|
|
cmp #$1B ;Escape? (close)
|
|
bne NotEscape
|
|
Escape
|
|
lda FGetPutCopy ;If not displaying volume list then CLOSE is
|
|
and #InVolumeList ;always going to be active
|
|
bne KeyDone
|
|
ldx #0002 ;do close
|
|
brl CommonKey
|
|
NotEscape
|
|
|
|
*** Pass arrow keys along to ListKey instead of handling them ourself
|
|
|
|
*** ldx #-1 ;guess up!
|
|
cmp #$0B ;up arrow
|
|
beq DoArrow
|
|
bit FGetPutCopy ;this get?
|
|
bmi @1 ;left/right arrow skip for put mode
|
|
cmp #$08 ;left arrow
|
|
beq DoArrow
|
|
@1
|
|
*** inx
|
|
*** inx ;x = 1 (down arrow)
|
|
cmp #$0A ;Down arrow?
|
|
beq DoArrow
|
|
bit FGetPutCopy ;skip left/right for put
|
|
bmi NotArrow
|
|
cmp #$15 ;right arrow
|
|
bne NotArrow
|
|
DoArrow
|
|
*** jsr UpDown
|
|
jsr CallListKey ;4-Dec-90 DAL
|
|
dec ReturnFlag ;(makes it $ffff?)
|
|
|
|
*** added 18-Dec-91 DAL -- bring pointer2 up to date!
|
|
*** Update pointer2 in case we're in the volume list
|
|
*
|
|
* equiv of getselected but for the case when my DPP is incorrect
|
|
*
|
|
PushLongSpace
|
|
PushLong #0000
|
|
PushLong [MyDpPtr],ListRecPtr ;PushLong ListRecPtr
|
|
_NextMember ;search specified list record for selected item
|
|
ldy #selectedptr
|
|
lda 1,s
|
|
sta [MyDpPtr],y
|
|
iny
|
|
iny
|
|
lda 3,s
|
|
sta [MyDpPtr],y
|
|
PullLong [MyDpPtr],pointer2 ;put in temp
|
|
*** end 18-Dec-91
|
|
brl UpdateKbFreeStr
|
|
|
|
NotArrow cmp #':' ;18-Nov-90 DAL disallow colons in SFPut dialogs
|
|
bne @notColon ;18-Nov-90 DAL
|
|
brl KeyDone ;18-Nov-90 DAL
|
|
@notColon
|
|
*
|
|
* other non-command key equiv should go here
|
|
*
|
|
|
|
*** not needed anymore 22-Mar-93 SS
|
|
;*** added 18-Dec-91 DAL -- check FunkyPutFile; feed keys to list
|
|
; lda FGetPutCopy
|
|
; and #FunkyPutFile
|
|
; bne @bopAround
|
|
;*** end 18-Dec-91
|
|
|
|
; bit FGetPutCopy ;in Get?
|
|
; bmi PassKey ;skip letters if in put mode
|
|
*** added 28-Mar-91 DAL -- if the List is active in putFile, call MoveToLetter
|
|
bit FGetPutCopy
|
|
bpl @BopAround ;GetFile--always bop around
|
|
|
|
;;; lda FGetPutCopy
|
|
ldy #FGetPutFlag
|
|
lda [<MyDpPtr],y
|
|
and #PutFileListActive
|
|
beq PassKey
|
|
*** end of 28-Mar-91 DAL
|
|
|
|
@BopAround jsr MoveToLetter ;allow keys to jump around in the list
|
|
|
|
KeyDone dec ReturnFlag ;sets it to $FFFF (it was 0)
|
|
|
|
PassKey brl AllDone
|
|
|
|
|
|
AMouseDown PushWordSpace
|
|
PushZPtr FoundControl
|
|
PushLong [EventPtr],oWhere
|
|
PushZLong theDialogPtr
|
|
_FindControl
|
|
pla
|
|
bne KeepLooking2 ;well, something was found
|
|
brl AllDone ;0...not one of the controls I care aboout
|
|
|
|
KeepLooking2 ldy #ListControl1 ;need to go through DP pointer
|
|
lda FoundControl
|
|
cmp [MyDpPtr],y ; (cmp ListControl1) my list was hit?
|
|
bnel NotList1 ;nope!
|
|
iny
|
|
iny ;point to listcontrol+2
|
|
lda FoundControl+2
|
|
cmp [MyDPPtr],y
|
|
bnel NotList1
|
|
jsr TrackIt ;do track control stuff
|
|
*
|
|
* check for double click on the list and no item selected
|
|
*
|
|
*
|
|
* equiv of getselected but for the case when my DPP is incorrect
|
|
*
|
|
PushLongSpace
|
|
PushLong #0000
|
|
PushLong [MyDpPtr],ListRecPtr ;PushLong ListRecPtr
|
|
_NextMember ;search specified list record for selected item
|
|
ldy #selectedptr
|
|
lda 1,s
|
|
sta [MyDpPtr],y
|
|
iny
|
|
iny
|
|
lda 3,s
|
|
sta [MyDpPtr],y
|
|
PullLong [MyDpPtr],pointer2 ;put in temp
|
|
*
|
|
* if this is 0 nothing is selected.
|
|
* Y is left pointer to 'pointer2' by PullLong macro above
|
|
*
|
|
lda [MyDpPtr],y
|
|
iny
|
|
iny
|
|
ora [MyDpPtr],y
|
|
beql NotList1 ;no items selected.
|
|
PushLongSpace
|
|
PushLong [MyDpPtr],pointer2 ;push what came back, start search here
|
|
PushLong [MyDpPtr],ListRecPtr ;PushLong ListRecPtr
|
|
_NextMember ;search specified list record for selected item
|
|
pla ;what came back
|
|
ora 1,s ;did it come back 0
|
|
ply ;fix stack
|
|
tay ;test for 0
|
|
bnel AllDone ;just skip this if multiple
|
|
|
|
PushLong [MyDpPtr],pointer2 ;otherwise, see if same item hit again.
|
|
jsr DerefHandle ;deref handle
|
|
|
|
ldy #lastSelected
|
|
cmp [MyDPPtr],y ;see if same
|
|
bne NotSame
|
|
iny
|
|
iny
|
|
txa
|
|
cmp [MyDPPtr],y
|
|
bne NotSame2 ;we knew low byte WAS the same!
|
|
brl SameItem ;if same, no need to store it!
|
|
NotSame
|
|
sta [MyDPPtr],y
|
|
txa
|
|
iny
|
|
iny
|
|
NotSame2
|
|
sta [MyDPPtr],y
|
|
ldax [EventPtr],oWhen
|
|
ldy #lastTime
|
|
sta [MyDPPtr],y ;new item, get time hit...
|
|
iny
|
|
iny
|
|
txa
|
|
sta [MyDPPtr],y
|
|
|
|
UpdateKbFreeStr lda FGetPutCopy ;Check whether we're currently displaying
|
|
bit #InVolumeList ;the volume list or not.
|
|
bne @inVolList
|
|
brl fini
|
|
@inVolList
|
|
|
|
PushLong [MyDpPtr],pointer2 ;get ptr to currently selected member
|
|
jsr DerefHandle ;now get ptr to volume string
|
|
sta atemp
|
|
stx atemp+2
|
|
lda [atemp] ;get size of volume string
|
|
and #$00FF
|
|
clc
|
|
adc #3 ;get the device id of volume
|
|
tay
|
|
lda [atemp],y
|
|
;
|
|
; setup for DoVolumeCall which is the routine that actually calculates amount of kbfree
|
|
;
|
|
ldy #curDev
|
|
sta [MyDpPtr],y
|
|
|
|
lda FGetPutCopy
|
|
bit #PutFlag ;don't need to calculate KBFreestr in we're
|
|
bne @inPutDLog ;in get dialog, we did need to update curdev though
|
|
brl fini ;for routine BuildVolumeList
|
|
@inPutDLog
|
|
|
|
phd
|
|
lda MyDpPtr
|
|
tcd
|
|
jsr DoDInfoCall
|
|
jsr DoVolumeCall
|
|
bcc @volumeOk
|
|
PushLong #ZeroString ;Got error from volume call which means we can't
|
|
PushLong #ZeroString ;calculate the amount of free memory on the disk,
|
|
PushLong #0 ;so just use zero.
|
|
PushLong #0
|
|
_ParamText
|
|
|
|
@volumeOk
|
|
PushZLong DialogPtr
|
|
_SetPort ;make sure the port is set.
|
|
|
|
PushZLong DialogPtr
|
|
PushWord #11
|
|
_ShowDItem
|
|
|
|
PushZLong DialogPtr
|
|
PushWord #0011 ;Put StatText item
|
|
PushZPtr tempRect ;where to store the Rect
|
|
_GetDItemBox
|
|
PushZPtr tempRect
|
|
_InvalRect ;rect is invalid and should redraw
|
|
|
|
pld
|
|
|
|
fini brl AllDone ;...and just leave
|
|
SameItem
|
|
*
|
|
* And now, in the catagory for the strangest written piece of code award....
|
|
*
|
|
ldy #oWhen
|
|
lda [EventPtr],y
|
|
tax
|
|
ldy #lastTime
|
|
sec
|
|
sbc [MyDPPtr],y ;get difference
|
|
sta atemp ;use atemp to hold difference
|
|
ldy #lastTime
|
|
txa
|
|
sta [MyDPPtr],y ;strange way to store new back intoDP!
|
|
ldy #oWhen+2
|
|
lda [EventPtr],y
|
|
tax ;save a copy for temp store
|
|
ldy #lastTime+2
|
|
sbc [MyDPPtr],y
|
|
sta atemp+2
|
|
ldy #lastTime+2
|
|
txa
|
|
sta [MyDPPtr],y ;Ahhhhhhhh! :-)
|
|
PushLongSpace
|
|
_GetDblTime ;just how long should we wait?
|
|
pullAX ;we really don't care about the high word
|
|
sec
|
|
sbc atemp
|
|
bmi AllDone ;too long
|
|
dec ReturnFlag ;sets it to $FFFF (it was 0)
|
|
ldx #0001 ;OPEN BUTTON always!
|
|
bit FGetPutCopy
|
|
bpl @1
|
|
inx ;put is 1 higher in the id.
|
|
@1
|
|
txa
|
|
sta [ItemHitPtr] ;say open
|
|
lda #$0002 ;need to hilight the button (will change to 1)
|
|
ldy #openButStat
|
|
sta [MyDPPtr],y
|
|
brl SpecialOpenButton ;Double click: Light Open, disable ACCEPT (if needed)
|
|
NotList1
|
|
ldy #ScrollControl1
|
|
lda FoundControl ;ok, so check then next item
|
|
cmp [MyDpPtr],y
|
|
bne NotScroll1
|
|
iny
|
|
iny ;point to ScrollControl1+2
|
|
lda FoundControl+2
|
|
cmp [MyDpPtr],y
|
|
bne NotScroll1 ;may be more controls later!
|
|
jsr TrackIt ;do track controll stuff
|
|
* bra AllDone
|
|
NotScroll1
|
|
*** added 1-Apr-91 DAL -- if they click in the edit line, make the list not be active
|
|
ldy #FGetPutFlag
|
|
lda [<MyDPPtr],y
|
|
bpl @notPut
|
|
and #PutFileListActive
|
|
beq @editLineAlreadyActive
|
|
|
|
*** removed absolute reference to item #10 19-Mar-93 SS
|
|
*** look for any editline control instead
|
|
pha
|
|
pha
|
|
pushlong FoundControl
|
|
_GetCtlRefCon
|
|
pla
|
|
pla
|
|
and #$7fff
|
|
cmp #$0011
|
|
bne @notEditLine
|
|
|
|
; pha
|
|
; pha ;space for GetControlDItem
|
|
; pha
|
|
; pha ;space for FrontWindow
|
|
; _FrontWindow
|
|
; pea 10
|
|
; _GetControlDItem
|
|
; plx
|
|
; pla
|
|
; cmp FoundControl+2
|
|
; bne @notEditLine
|
|
; cpx FoundControl
|
|
; bne @notEditLine
|
|
*** end 19-Mar-93 SS
|
|
jsr ToggleListTarget ;edit on - list off
|
|
@notEditLine
|
|
@editLineAlreadyActive
|
|
@notPut
|
|
notEditLine1
|
|
*** end of 1-Apr-91 DAL
|
|
*
|
|
* other items could be checked here
|
|
*
|
|
AllDone
|
|
*
|
|
* in case selected items changed...check the list and set the open button
|
|
*
|
|
PushLongSpace
|
|
PushLong #0000
|
|
PushLong [MyDpPtr],ListRecPtr ;PushLong ListRecPtr
|
|
_NextMember ;search specified list record for selected item
|
|
PullLong [MyDpPtr],pointer2 ;put in temp
|
|
*
|
|
* if this is 0 nothing is selected.
|
|
* Y is left pointer to 'pointer2'+2 by PullLong macro above
|
|
*
|
|
dey
|
|
dey
|
|
lda [MyDpPtr],y
|
|
iny
|
|
iny
|
|
ora [MyDpPtr],y
|
|
beq DisableBoth ;no items selected, disable both buttons
|
|
PushLongSpace ;at least 1, perhaps more?
|
|
PushLong [MyDpPtr],pointer2 ;push what came back, start search here
|
|
PushLong [MyDpPtr],ListRecPtr ;PushLong ListRecPtr
|
|
_NextMember ;search specified list record for selected item
|
|
pla ;what came back
|
|
ora 1,s ;did it come back 0
|
|
ply ;fix stack
|
|
tay ;test for 0
|
|
*
|
|
* if this is 0 only 1 item is selected, so enable both, else enable ONLY Accetp
|
|
*
|
|
bne DisableOpenButton ;multiples disable open only
|
|
*
|
|
* multiple items selected, light ACCEPT button, dim Open Button
|
|
*
|
|
lda #$0000 ; item enabled
|
|
bra obc
|
|
DisableOpenButton
|
|
lda #$00FF
|
|
obc
|
|
ldy #openButStat
|
|
cmp [MyDpPtr],y ; see if the state changed
|
|
beq @1 ; then skip this, not necessary
|
|
sta [MyDpPtr],y ; save the open button status
|
|
ldx #1 ; Open
|
|
jsr DoButton
|
|
@1
|
|
ldx #5 ; Accept
|
|
lda #0000 ; item enables entry
|
|
jsr DoButton
|
|
bra done ; done here
|
|
DisableBoth
|
|
lda #$00FF ; item not enabled
|
|
SpecialOpenButton
|
|
*
|
|
* entry here with status for Open button and always DISABLE ACCEPT (if needed)
|
|
*
|
|
ldy #openButStat
|
|
cmp [MyDpPtr],y ; see if the state changed
|
|
beq @1 ; then skip this, not necessary
|
|
sta [MyDpPtr],y ; save the open button status
|
|
ldx #1 ; Open
|
|
jsr DoButton
|
|
@1
|
|
ldx #5 ; Accept
|
|
lda #$00FF ; item disabled
|
|
jsr DoButton
|
|
* bra done
|
|
Done
|
|
*
|
|
* now, if Put, check to see if the text edit field is empty and if so, set the Folder button and
|
|
* Save button accordingly.
|
|
*
|
|
bit FGetPutCopy
|
|
bpll ReallyDone ;PUT only does this check
|
|
|
|
lda FGetPutCopy
|
|
and #InVolumeList
|
|
beq @CheckEditItem
|
|
brl ReallyDone
|
|
@CheckEditItem
|
|
ldx #$00FF ; guess not enabled
|
|
ldy #writeProtect ; see if write protected, don't light button
|
|
lda [MyDpPtr],y
|
|
bne @1 ;not enabled now.
|
|
PushLong [MyDpPtr],DialogPtr ; the dialog pointer
|
|
PushWord #0010 ; item 10 = edit box
|
|
PushZPtr editText ;temp location for 32 max chars.
|
|
_GetIText ;get the string
|
|
|
|
ldx #$00FF ; Guess item not enabled
|
|
lda editText ; P string length (all I car about here)
|
|
and #$00FF
|
|
beq @1
|
|
ldx #$0000 ; nope, item is enabled
|
|
@1
|
|
ldy #saveButStat
|
|
txa
|
|
cmp [MyDpPtr],y ;see if it changed
|
|
beq ReallyDone ;skip this, not needed
|
|
sta [MyDpPtr],y ;save new status
|
|
pha
|
|
pha ;save a copy for each button
|
|
|
|
PushLongSpace
|
|
PushLong [MyDpPtr],DialogPtr ; the dialog pointer
|
|
PushWord #1 ; save button
|
|
_GetControlDItem ; get save buton on stack
|
|
|
|
_HiliteControl ;set the button
|
|
|
|
PushLongSpace
|
|
PushLong [MyDpPtr],DialogPtr ; the dialog pointer
|
|
PushWord #12 ; Create folder button
|
|
_GetControlDItem ; get create buton on stack
|
|
|
|
_HiliteControl ;set the other button
|
|
|
|
|
|
ReallyDone
|
|
tsc ;clean up the stack
|
|
clc
|
|
adc #54 ;get out extra stuff out of the way!
|
|
tcs
|
|
|
|
plb ; restore b
|
|
pld ; restore d
|
|
|
|
|
|
phb ; put extra byte on stack to "word" align
|
|
pla ; pull long into x,a
|
|
plx ; save "RTL"
|
|
ply ; strip 6 words back off stack
|
|
ply
|
|
ply
|
|
ply
|
|
ply
|
|
ply
|
|
phx ;restore "RTL"
|
|
pha ;pull one more byte of RTL's 3 bytes....
|
|
|
|
plb ;...pull extra byte (well, Now it's 3 bytes!!!!)
|
|
|
|
rtl ; done
|
|
|
|
dobutton
|
|
*
|
|
* pass item index in x and status information for the button in 'A'
|
|
*
|
|
bit FGetPutCopy
|
|
bpl @1 ; Get item values. Put is one higher
|
|
cpx #5 ;if item 5 & Put, skip this button.
|
|
beq dbdone
|
|
inx
|
|
@1
|
|
pha ; put status on stack
|
|
PushLongSpace ; handle will return here.
|
|
PushLong [MyDpPtr],DialogPtr ; the dialog pointer
|
|
phx ; push item's ID
|
|
_GetControlDItem ; get a handle to the open button
|
|
*
|
|
* returns handle to item on stack. Stack already has the desired state there!
|
|
*
|
|
_HiliteControl ; Make sure it's on
|
|
dbdone
|
|
rts
|
|
|
|
*
|
|
* SeeIfItemEnabled -- 12-Jan-91 DAL
|
|
*
|
|
* Input: A = dialog item ID
|
|
*
|
|
* Preserves A and X.
|
|
*
|
|
* Output: BCS = the button was disabled
|
|
* BCC = item was enabled
|
|
*
|
|
*
|
|
SeeIfItemEnabled pha
|
|
phx
|
|
|
|
pha ;keep a copy of the dialog item
|
|
|
|
pha
|
|
pha ;space for GetCtlDItem
|
|
pha
|
|
pha ;space for window pointer
|
|
_FrontWindow
|
|
lda 9,s ;get the temporary copy of the dialog item
|
|
pha ;dialog item
|
|
_GetControlDItem
|
|
phd
|
|
tsc
|
|
tcd
|
|
ldy #2 ;deref the control handle
|
|
lda [3]
|
|
tax
|
|
lda [3],y
|
|
sta <3+2
|
|
stx <3
|
|
ldy #$11 ;look at Hilite field
|
|
lda [3],y
|
|
and #$00ff
|
|
tax
|
|
pld
|
|
pla
|
|
pla
|
|
pla ;throw out temp copy of dialog item
|
|
cpx #$00ff ;disabled?
|
|
beq @disabled
|
|
clc
|
|
@disabled plx
|
|
pla
|
|
rts
|
|
|
|
|
|
**********************************************************************
|
|
*
|
|
* New MoveToLetter 25-Nov-90 DAL
|
|
*
|
|
* Use new List Manager ListKey function to allow arbitrarily long
|
|
* prefix strings to be typed.
|
|
*
|
|
CallListKey
|
|
MoveToLetter ldx #0 ;anticipate ListKey flags = 0 (don't skip first character)
|
|
ldy #FGetPutFlag
|
|
lda [<MyDPPtr],y
|
|
and #InVolumeList
|
|
beq @doKey
|
|
inx
|
|
@doKey phx ;flags (bit 0 set = ignore first character)
|
|
pei <EventPtr+2
|
|
pei <EventPtr
|
|
ldy #ListControl1+2
|
|
lda [<MyDPPtr],y
|
|
pha
|
|
dey
|
|
dey
|
|
lda [<MyDPPtr],y
|
|
pha
|
|
_ListKey
|
|
rts
|
|
|
|
*******************************************************************************
|
|
*
|
|
* Check if this Item is active
|
|
* Input: A=ItemID
|
|
* Output: A=BOOLEAN active
|
|
* Uses stack frame, called from inside Filter
|
|
*
|
|
*******************************************************************************
|
|
|
|
IsItActive pha ;(ItemID)
|
|
pha ;space for GetCtlTitle
|
|
pha
|
|
pha ;space for edit line control handle
|
|
PushLong [MyDpPtr],DialogPtr ; the dialog pointer
|
|
lda 5,s ;(ItemID)
|
|
pha
|
|
_GetControlDItem
|
|
_GetCtlTitle ;get the line edit record
|
|
phd
|
|
tsc
|
|
tcd
|
|
* deref line edit record handle into line edit record pointer
|
|
ldy #2
|
|
lda [3],y
|
|
tax
|
|
lda [3]
|
|
sta 3
|
|
stx 5
|
|
ldy #$24 ;get active flag
|
|
lda [3],y ;return in A
|
|
pld
|
|
plx
|
|
plx
|
|
rts
|
|
|
|
*******************************************************************************
|
|
*
|
|
* FindItemAfter10
|
|
* Runs around the list of controls and returns the ID in A of the next edit after #10.
|
|
*******************************************************************************
|
|
FindItemAfter10
|
|
stz @item ;clr the found item #
|
|
@wrapAround
|
|
pha ;spc for pointer
|
|
pha
|
|
pha ;spc for handle
|
|
pha
|
|
PushLong [MyDpPtr],DialogPtr
|
|
_GetWControls ;get first ctl handle
|
|
phd
|
|
tsc
|
|
tcd
|
|
dsect 3
|
|
@handle long
|
|
@pointer long
|
|
|
|
@nextCtl lda <@handle+1 ;if NIL, we're done.
|
|
bne @chk
|
|
|
|
@done pld ;fix stk for completion or re-entry
|
|
pla
|
|
pla
|
|
pla
|
|
pla
|
|
lda @item
|
|
cmp #10 ;if we have only found #10,
|
|
beq @wrapAround ; we must go around again
|
|
rts ; and return the next one after #10
|
|
|
|
@chk ldy #2 ;deref the ctl handle
|
|
lda [<@handle],y
|
|
sta <@pointer+2
|
|
lda [<@handle]
|
|
sta <@pointer
|
|
|
|
pha
|
|
pha
|
|
pushzlong <@handle
|
|
_GetCtlRefCon ;see if it's an edit line
|
|
plx
|
|
pla
|
|
and #$7fff
|
|
cmp #$0011
|
|
bne @notEditLine
|
|
|
|
lda @item ;have we already found one?
|
|
beq @1stpass ; no, start the search with #10
|
|
stx @item ; yes, then keep it
|
|
bra @done ; and check completion.
|
|
@1stpass cpx #10 ;found the start yet?
|
|
bne @not10 ; no, skip all til #10
|
|
stx @item ; yes, continue with next ctl
|
|
@not10
|
|
@notEditLine ldy #2
|
|
lda [<@pointer],y ;get the next ctl handle
|
|
sta <@handle+2
|
|
lda [<@pointer]
|
|
sta <@handle
|
|
bra @nextCtl
|
|
|
|
@item dc.w 0
|
|
|
|
*******************************************************************************
|
|
*
|
|
* UpdateTheDialog -- this is the Standard File window's content-draw routine
|
|
*
|
|
* In "normal" circumstances this doesn't get called at all, since ModalDialog
|
|
* gets our update events and handles them, with the help of our dialog filter
|
|
* procedure.
|
|
*
|
|
* This routine gets called by UpdateWindow (in the Window Manager), when there
|
|
* is a modal dialog in *front* of Standard File (like an AlertWindow, or a
|
|
* moveable-modal dialog being handled with DoModalWindow).
|
|
*
|
|
* There is a SetContentDraw that makes UpdateTheDialog the content-draw routine
|
|
* for the dialog window; it sets bit 31 to indicate we can safely get called
|
|
* without a sepcial environment (like a particular B or D register, a control
|
|
* substitution parameter pointer, or a certain ResourceApp).
|
|
*
|
|
*******************************************************************************
|
|
*** added draw proc for windows in front of me 19-Mar-93 SS
|
|
export UpdateTheDialog
|
|
UpdateTheDialog phb
|
|
phk
|
|
plb
|
|
phd ;save current d
|
|
PushLongSpace ;results
|
|
PushWord #0 ;system tool
|
|
PushWord #$0017 ;Standard File tool set
|
|
_GetWap
|
|
pld ;set DP to old direct page for this routine
|
|
pla ;toss upper
|
|
|
|
pushzlong DialogPtr
|
|
_DrawDialog
|
|
lda FGetPutFlag
|
|
jsr UpdateFocusFrame
|
|
pld
|
|
plb
|
|
rtl
|
|
|
|
|
|
**********************************************************************
|
|
*
|
|
* ToggleListTarget
|
|
*
|
|
* Needs the GetFilter stack frame.
|
|
*
|
|
* Toggle the PutFileListActive bit in FGetPutCopy and call
|
|
* UpdateFocusFrame.
|
|
*
|
|
**********************************************************************
|
|
ToggleListTarget
|
|
ldy #FGetPutFlag
|
|
lda [<MyDpPtr],y
|
|
eor #PutFileListActive
|
|
sta [<MyDpPtr],y
|
|
|
|
bit #PutFileListActive
|
|
beq @deactivateList
|
|
|
|
PushLong [MyDpPtr],DialogPtr ; the dialog pointer
|
|
pea 8 ;the item id
|
|
pea 0 ;select all
|
|
pea $7fff
|
|
_SelectIText
|
|
@deactivateList
|
|
;; update the status of the Edit Line item appropriately
|
|
;
|
|
; pha
|
|
; pha ;space for GetCtlTitle
|
|
; pha
|
|
; pha ;space for GetControlDItem
|
|
; pha
|
|
; pha ;space for FrontWindow
|
|
; _FrontWindow
|
|
; pea 10 ;item number for edit line
|
|
; _GetControlDItem
|
|
; _GetCtlTitle ;this is the edit-line handle
|
|
;
|
|
; ldy #FGetPutFlag
|
|
; lda [<MyDPPtr],y
|
|
; and #PutFileListActive
|
|
; beq @enableEditLine
|
|
; _LEDeactivate
|
|
; bra @together
|
|
;@enableEditLine
|
|
;*** added 8-Jul-91 DAL -- select the text while tabbing to the Edit Line
|
|
; pea 0 ;start
|
|
; pea $00ff ;end
|
|
; lda 3+4,s
|
|
; pha
|
|
; lda 3+4,s
|
|
; pha ;copy of LE handle
|
|
; _LESetSelect
|
|
;*** end 8-Jul-91
|
|
; _LEActivate
|
|
;@together
|
|
ldy #FGetPutFlag
|
|
lda [<MyDpPtr],y
|
|
|
|
; v v v Fall into UpdatefocusFrame
|
|
|
|
**********************************************************************
|
|
*
|
|
* UpdateFocusFrame
|
|
*
|
|
* Direct page needed: none
|
|
*
|
|
* Input: A = value of FGetPutFlag/FGetPutCopy/whatever
|
|
*
|
|
**********************************************************************
|
|
UpdateFocusFrame phd
|
|
pha ;local copy of FGetPutFlag
|
|
tsc
|
|
tcd
|
|
|
|
@localFGetPut equ 1
|
|
|
|
*** if any visible edit line items, we need to draw the focus frame 23-Mar-93 SS
|
|
lda <@localFGetPut
|
|
and #HaveVisibleEdit
|
|
bne @Vis
|
|
brl @exit
|
|
@Vis
|
|
|
|
lda #2 ;set pen size to (2,1) or (1,1)
|
|
bit <@localFGetPut
|
|
bvc @640
|
|
lsr a
|
|
@640 pha
|
|
pea 1
|
|
_SetPenSize
|
|
|
|
ldx #0 ;target color=$0000 (black)
|
|
lda <@localFGetPut
|
|
and #PutFileListActive
|
|
bne @colorX
|
|
dex ;not-target color=$FFFF (white)
|
|
@colorX phx
|
|
_SetSolidPenPat
|
|
|
|
phd ;get the list control rectangle
|
|
pushlong ffListHandle
|
|
tsc
|
|
tcd
|
|
ldy #2
|
|
lda [1],y
|
|
tax
|
|
lda [1]
|
|
clc
|
|
adc #8 ;offset to control rectangle
|
|
bcc @1
|
|
inx
|
|
@1 phx
|
|
pha
|
|
pushlong #theFocusRect
|
|
pushlong #8
|
|
_BlockMove
|
|
pla
|
|
pla
|
|
pld
|
|
|
|
pha
|
|
pha
|
|
_GrowSize
|
|
pla ;height
|
|
pla ;width
|
|
clc
|
|
adc theFocusRect+6
|
|
dec a
|
|
dec a
|
|
sta theFocusRect+6
|
|
|
|
pushlong #theFocusRect
|
|
ldx #-2 ;anticipate 640 mode
|
|
bit <@localFGetPut
|
|
bvc @is640
|
|
ldx #-1 ;320 dX is only -1
|
|
inc theFocusRect+2 ;increment left edge for 320 List Manager funkiness
|
|
@is640 phx ;dX
|
|
pea -1 ;dY
|
|
_InsetRect
|
|
|
|
pushlong #theFocusRect
|
|
_FrameRect
|
|
|
|
_PenNormal
|
|
|
|
@exit pla
|
|
pld
|
|
rts
|
|
|
|
theFocusRect dc.w 0,0,0,0
|
|
|
|
export ffListHandle
|
|
ffListHandle dc.l 0
|
|
|
|
**********************************************************************
|
|
*
|
|
* Used to track the control items in the list manager when a scroll bar
|
|
* or button is touched or an item in the list
|
|
*
|
|
**********************************************************************
|
|
TrackIt
|
|
|
|
*** added 1-Apr-91 DAL -- if they clicked on the PutFile list and it's not the target, make it the target
|
|
ldy #FGetPutFlag
|
|
lda [<MyDPPtr],y
|
|
bpl @notPut
|
|
and #PutFileListActive
|
|
bne @alreadyActive
|
|
jsr ToggleListTarget ;list on - edit off
|
|
@alreadyActive
|
|
@notPut
|
|
*** end of 1-Apr-91 DAL
|
|
|
|
*
|
|
* restore the saved refcons
|
|
*
|
|
PushLong [MyDPPtr],ListRefCon ;the refcon of the list
|
|
PushLong [MyDPPtr],ListControl1
|
|
_SetCtlRefCon
|
|
|
|
PushLong [MyDPPtr],ScrollRefCon
|
|
PushLong [MyDPPtr],ScrollControl1
|
|
_SetCtlRefCon
|
|
|
|
|
|
PushWordSpace
|
|
PushLong [EventPtr],oWhere
|
|
PushLong #$FFFFFFFF
|
|
PushLong FoundControl
|
|
_TrackControl
|
|
*
|
|
* above returns "action" number of what happened. For now it's left on the stack
|
|
*
|
|
*
|
|
* and once again the damn list manager requires zeroing the damned refcons!!!!
|
|
*
|
|
PushLong #0 ;zero the refcon of the list
|
|
PushLong [MyDPPtr],ListControl1
|
|
_SetCtlRefCon
|
|
|
|
PushLong #0
|
|
PushLong [MyDPPtr],ScrollControl1
|
|
_SetCtlRefCon
|
|
|
|
pla ;get _trackControl info off stack
|
|
* beq exit
|
|
*
|
|
* any additional action control would go here
|
|
*
|
|
exit
|
|
rts
|
|
|
|
ENDP
|
|
|
|
**********************************************************************
|
|
* Builds a list of file names from the current path. This will Open the
|
|
* directory specified by Prefix 8 (or prefix 0 if 8 is blank), and build
|
|
* a list of file and folder names. The directory is closed when the build
|
|
* is completed.
|
|
*
|
|
* Errors are returned and no list is built if errors. Possible errors
|
|
* include out of memory and bad path or prefix.
|
|
*
|
|
* This routine effects a great deal of direct page locations too numerous
|
|
* to mention. (Oh, do I have too?)
|
|
*
|
|
* I would also assume that all the registers are effected as well!
|
|
*
|
|
**********************************************************************
|
|
BuildListRoutine PROC
|
|
EXPORT CompareRoutine
|
|
EXPORT BuildExit
|
|
EXPORT BuildList
|
|
IMPORT GetZeroHandle
|
|
DimmedFile equ ztemp1 ;usage of temp
|
|
*
|
|
*
|
|
* ENTRY TO BUILDLIST IS BELOW EXIT POINT
|
|
*
|
|
*
|
|
BuildExit
|
|
*
|
|
* OK, quiet down. I put the exit up here so it's closer to more branches!!!
|
|
*
|
|
php
|
|
pha ;save error status and code (if any)
|
|
jsr ClosePrefix ;close this directory
|
|
|
|
pla
|
|
plp
|
|
rts
|
|
*
|
|
*------------------------entry to BuildList-------------------------------------------
|
|
*
|
|
BuildList
|
|
|
|
lda FGetPutFlag ; Clear the flag that says we're currently
|
|
and #$FFF7 ; displaying the volume list.
|
|
sta FGetPutFlag
|
|
*
|
|
* step 1, find and open the selected volume
|
|
*
|
|
jsr GetFirst ;Find and open the volume (carry set if error)
|
|
bcs BuildExit ;no error returned
|
|
AllOk
|
|
*
|
|
*Step 1.5, dispose of old handle.
|
|
*
|
|
ldax ListPointerHandle
|
|
jsr KillHandle ;gets rid of any old handle
|
|
*
|
|
* step 2, do a get_dir_entry on the returned volume to get the number of entries
|
|
*
|
|
jsr ReadDirSize ;calls ReadAnEntry with 0,0 for size of directory
|
|
bcs BuildExit
|
|
*
|
|
* size of this directory returned in A as a FIRST guess to the amount of memory needed
|
|
* for the Name ListManager pointer table. So now we get some memory for the list
|
|
*
|
|
inc a ;this will prevent a 0 from screwing up.
|
|
inc a ;a little extra space (Fudge Factor)
|
|
pha
|
|
asl a ; do times 4 (clear carry too!)
|
|
asl a ;X4
|
|
adc 1,s ;x5 bytes per entry
|
|
plx ;toss away pushed handle
|
|
*
|
|
* CAUTION: Can't have more than 13,107 files in a directory
|
|
*
|
|
jsr GetZeroHandle ;List pointer memory (will grow if needed)
|
|
stax ListPointerHandle ;returns handle to memory which is all 0
|
|
PushAx ;push for the derefandlock
|
|
jsr DerefAndLock ;returns a pointer to memory
|
|
stax ListPointerPtr
|
|
*
|
|
* so now we have a place to build the Pointers and flags to the List Member's strings.
|
|
* Except here, instead of actual pointers to the strings, these will be OFFSETS from the
|
|
* begining of the buffer area. This will allow me to grow the memory area without having
|
|
* to update all the pointers. Since I am going to do my own custom draw routine, the
|
|
* List Manager will never need to know about this change!
|
|
*
|
|
*
|
|
* so now it's time to build the actual list (First pass is unsorted)
|
|
*
|
|
stz StringsLength ;init length "used" in String array
|
|
stz StringsLength+2 ;init length "used" in String array
|
|
stz StringsOffset ;next element value (start 0)
|
|
stz ztemp2 ;count of items
|
|
dir_loop
|
|
jsr ReadNextDirEntry ;get next entry into [NamePtr]
|
|
bcc Rno_error
|
|
cmp #$61 ;end of directory?
|
|
beql Builddone
|
|
sec ;set error
|
|
*
|
|
**DEBUG**, a strange director error occured which was not end of directory. What should
|
|
* I do with this error? Should I ignore the entry and continue or simply fail?
|
|
*
|
|
bra BuildExit ;simply return error
|
|
Rno_error
|
|
lda ParAccess_GDE ;access of this entry
|
|
and #$0004 ;bit set
|
|
beq NotInvisible
|
|
and invisible ;if bit clear, this will result in zero
|
|
beq dir_loop ;skip it!
|
|
Notinvisible
|
|
jsr ValidEntry ;see if this is valid and or dimmed
|
|
beq dir_loop ;skip this guy
|
|
inc ztemp2 ;count 1 to display
|
|
*
|
|
* Add this guy to the list
|
|
*
|
|
lda StringsOffset ;update pointers
|
|
sta [ListPointerPtr] ;offset to this string
|
|
|
|
lda DimmedFile ;need to dim this entry?
|
|
bpl NoDim
|
|
shortm
|
|
lda #MEM_DISABLE+NOT_POSSIBLE
|
|
ldy #$0004
|
|
sta [ListPointerPtr],y ;disable this item if not folder
|
|
longm
|
|
NoDim
|
|
lda ListPointerPtr ;move the pointer forward
|
|
clc
|
|
adc #$05 ;each element is 5 bytes
|
|
sta ListPointerPtr ;next slot
|
|
*** added 21-Dec-90 DAL: Here's the fix for that annoying repeating-entry bug that kept showing up
|
|
*** (This 4-byte patch has been needed for about 4 years. Neat, eh?)
|
|
bcc @dal1
|
|
inc ListPointerPtr+2
|
|
@dal1
|
|
*** end of 21-Dec-90 DAL addition
|
|
|
|
ldy #2 ;start of actual string (length)
|
|
lda [NamePtr],y
|
|
tax ;x gets size of string
|
|
lda NamePtr
|
|
clc
|
|
adc #04 ;pointer to start of string
|
|
sta NamePtr
|
|
bcc @1
|
|
inc NamePtr+2 ;NamePtr points to start of string
|
|
@1
|
|
jsr ExtendHandle ;size of string in x. See if enough room
|
|
bcsl BuildExit ;out of memory
|
|
*
|
|
* x was preserved in the above call
|
|
*
|
|
* Now copy the string into the memory area reserved for the strings
|
|
*
|
|
ldy StringsOffset
|
|
txa
|
|
sta [StringsPtr],y ;copy length to [StringsPtr]
|
|
iny
|
|
Bcopy_loop
|
|
*
|
|
* Note: The following assumption is made here:
|
|
* There will be no more than 65k bytes worth of file names (path not included).
|
|
* This averages approx 2000 files of 32 characters per file name.
|
|
*
|
|
lda [NamePtr]
|
|
sta [StringsPtr],y ;copy string to [StringsPtr]
|
|
incl NamePtr ;bump pointer
|
|
iny
|
|
dex
|
|
bne Bcopy_loop
|
|
|
|
lda FileType
|
|
sta [StringsPtr],y ;copy string to [StringsPtr]
|
|
iny
|
|
iny ;this IS a word
|
|
*
|
|
* Matt's addition for Claris, add the AuxType after the fle type following the string.
|
|
*
|
|
ldax AuxType
|
|
sta [StringsPtr],y
|
|
iny
|
|
iny
|
|
txa
|
|
sta [StringsPtr],y
|
|
iny
|
|
iny
|
|
******************************************
|
|
sty StringsOffset ;save y
|
|
|
|
PushZLong NameHandle
|
|
jsr DerefAndLock
|
|
stax NamePtr ;restore the original NamePtr
|
|
|
|
brl dir_loop ;loop back and store y
|
|
|
|
BuildDone
|
|
*
|
|
* Now that we have the list lets do something with it (it's still unsorted)
|
|
*
|
|
* First thing is to change the offsets in the List Manager Ptrs to real addresses
|
|
* and pass this to the list manager.
|
|
*
|
|
lda ztemp2 ;number of entries actually found
|
|
ldy #ListRecord.ListCount
|
|
sta [ListRecPtr],y ;number of entries found.
|
|
|
|
lda ListPointerPtr ;low word of next available slot
|
|
sta ztemp2 ;temp storage location (used below)
|
|
|
|
PushZLong ListPointerHandle ;go back and get base address of the strings
|
|
jsr DerefAndLock
|
|
stax ListPointerPtr ;save address of first slot.
|
|
|
|
lda ztemp2 ;last entry - base address
|
|
sbc ListPointerPtr
|
|
tay ;y = offset to next available slot
|
|
|
|
phy ;save offset to last.
|
|
PushZLong StringsHandle
|
|
jsr DerefAndLock ;get base pointer
|
|
stax StringsPtr ;might as well put it back again
|
|
ply ;restore y
|
|
*
|
|
* ok, now add the real address of the strings memory to the offsets saved while building the list
|
|
*
|
|
ptrupdate
|
|
lda [ListPointerPtr],y ;low word
|
|
clc
|
|
adc StringsPtr
|
|
sta [ListPointerPtr],y
|
|
iny
|
|
iny
|
|
lda StringsPtr+2
|
|
adc #0 ;prop carry
|
|
sta [ListPointerPtr],y
|
|
tya
|
|
sec
|
|
sbc #$0007 ;-5 and 2 more for iny's above
|
|
tay
|
|
bcs ptrupdate ;not done yet!
|
|
|
|
ldax ListPointerPtr ;Save list address in the List Manager's record for get file
|
|
stax [ListRecPtr],ListRecord.listPtr
|
|
|
|
*
|
|
* now sort the list of names (by re-arranging the pointers)
|
|
*
|
|
*** 25-Mar-91 DAL -- see if it's the Volumes list; use SortList(#1) for regular files
|
|
lda <FGetPutFlag
|
|
bit #InVolumeList
|
|
bne @inVolList
|
|
|
|
PushLong #1
|
|
bra @together
|
|
|
|
@inVolList
|
|
*** end of 25-Mar-91 DAL
|
|
PushLong #CompareRoutine
|
|
@together PushZLong ListRecPtr ;pointer to the list
|
|
_SortList ;sort list elements
|
|
|
|
jsr SelectFirst ;select the first possible item
|
|
|
|
jsr DoGetFileInfo ;set up moddate time info on entry
|
|
ldx #6 ;move 4 words
|
|
ldy #FileModInfo+6 ;destination
|
|
@4
|
|
lda ParmodTD_GFI,x ;move mod date and time into a holding location.
|
|
sta [DInfoPtr],y
|
|
dey
|
|
dey
|
|
dex
|
|
dex
|
|
bpl @4
|
|
|
|
clc ;no carry = no error
|
|
brl BuildExit
|
|
|
|
|
|
**********************************************************************
|
|
*
|
|
* Routine used to compare two items as given by the list manager
|
|
* for sorting. Carry out indicates status of compare.
|
|
* CC = member A >= member B, CS = member A < member B
|
|
*
|
|
* Note that this routine is called by the List Manager during the
|
|
* toolbox call _SortList (as used above). No Standard FIle variables
|
|
* or local storage are used.
|
|
*
|
|
* Taken from list manager and modified slightly, this code is now included
|
|
* here so that upper and lower case names sort as if the case did not matter.
|
|
*
|
|
* IN: PUSH:LONG - pointer to member A
|
|
* PUSH:LONG - pointer to member B
|
|
*
|
|
* OUT: Carry
|
|
*
|
|
**********************************************************************
|
|
CompareRoutine
|
|
DefineStack
|
|
tempReg word
|
|
strg1 long
|
|
strg2 long
|
|
origD word
|
|
RtlAdr block 3
|
|
sptr1 long
|
|
sptr2 long
|
|
|
|
phd ;save old direct page
|
|
tsc ;copy stack ptr to 'A'
|
|
sec
|
|
sbc #10 ;room for temp varible and pen mask
|
|
tcs
|
|
tcd ;set direct page (to stack)
|
|
|
|
lda [sptr1] ;"deref" the member pointer
|
|
sta <strg1
|
|
lda [sptr2] ;"deref" the member pointer
|
|
sta <strg2
|
|
ldy #2
|
|
lda [sptr1],y
|
|
sta <strg1+2
|
|
lda [sptr2],y
|
|
sta <strg2+2
|
|
|
|
ldy #0
|
|
lda [<strg1]
|
|
xba ;added 25-Mar-91 DAL (this wasn't working right before)
|
|
and #$00FF
|
|
cmp #$003A Is it a colon. If it is then we're in the volume list mode
|
|
beq @InVolList
|
|
cmp #$002E
|
|
bne @notInVolList
|
|
@InVolList iny
|
|
@notInVolList
|
|
shortm
|
|
; begin compare
|
|
|
|
lop10 tya
|
|
iny
|
|
cmp [<strg2] End of gopher string?
|
|
beq greater
|
|
|
|
cmp [<strg1]
|
|
beq lessthan End of current string?
|
|
|
|
lda [<strg2],y Grap a byte.
|
|
and #$0DF drop upper case bit
|
|
sta tempReg
|
|
lda [<strg1],y
|
|
and #$0DF drop upper case bit
|
|
cmp tempReg
|
|
beq lop10
|
|
bra exit10 Carry flag is ready for exit.
|
|
greater
|
|
sec
|
|
bra exit10
|
|
lessthan
|
|
clc current string < gopher string.
|
|
exit10
|
|
longm
|
|
|
|
; ready to leave
|
|
;
|
|
lda RtlAdr+1 ;move the return address down the stack
|
|
sta sptr2+2
|
|
lda RtlAdr
|
|
sta sptr2+1
|
|
lda origD ;set the original direct page
|
|
tcd
|
|
tsc ;start adjusting the stack
|
|
php ;but first save the carry bit
|
|
clc ;adjust the stack, but don't set it yet
|
|
adc #20
|
|
plp ;restore the carry bit
|
|
tcs ;finish adjusting the stack
|
|
rtl ;..and return
|
|
|
|
|
|
**********************************************************************
|
|
*
|
|
* This routine is used to determine if a file is dimmed and or
|
|
* displayed.
|
|
*
|
|
* Entry: Uses direct page variables to access information about currently
|
|
* read file.
|
|
*
|
|
* Exit: Z flag = true if entry is to be skipped, else entry is ok.
|
|
* Direct page variable DimmedFile (actually ztemp1) has dimmed status.
|
|
*
|
|
* Uses direct page: ztemp1 (aka DimmedFile), ztemp3
|
|
*
|
|
**********************************************************************
|
|
ValidEntry stz DimmedFile ;guess not dimmed.
|
|
|
|
lda FileType
|
|
cmp #$000F ;Folder?
|
|
beq GoodFolder ;folders always displayed
|
|
sec
|
|
ror DimmedFile ;guess dimmed
|
|
lda FGetPutFlag ;if Put we dim the rest
|
|
bmi good ;forget rest in put
|
|
lsr a ;see if old call (leave in carry)
|
|
*
|
|
* the rest of this routine down to 'Bad' is for Get only, old style type lists
|
|
*
|
|
stz DimmedFile ;back to not dimed again
|
|
lda TypeList+1 ;is there a Type List? (cheat check)
|
|
beq GoodfType ;no type list, check for a routine.
|
|
|
|
*
|
|
* old style type list check. Will need to update this to check Aux types as well
|
|
*
|
|
ldy #$0002 ;will point to flags for new calls
|
|
lda [TypeList] ;number of entries
|
|
bcc NewTypeCheck ;old/new flag bit left in carry
|
|
and #$00FF ;up tp 256
|
|
beq GoodfType ;silly, but maybe 0 entries!
|
|
tay ;scan through the list
|
|
NextType
|
|
lda [TypeList],Y ;Get a type
|
|
and #$00FF
|
|
cmp FileType ;see if ok type
|
|
beq GoodfType
|
|
dey
|
|
bne NextType
|
|
*------------------------------------------------------------
|
|
Bad
|
|
lda #00
|
|
rts
|
|
|
|
GoodFolder lda ParAccess_GDE ;of the folder.
|
|
and #$0001 ;Do we have read access?
|
|
bne AccessOk
|
|
ror DimmedFile ;dim the darn folder since you don't have the privileges.
|
|
*
|
|
* If multifile mode, they may NOT want to display certain folders so I guess they
|
|
* should be passed to any filter proc if available. This will allow them to skip
|
|
* certain folders (but why?)
|
|
*
|
|
AccessOk lda FGetPutFlag
|
|
bit #MultiFIleMode ;multi-file?
|
|
bne GoodfType ;yes, pass this to the filter proc
|
|
Good
|
|
lda #True
|
|
rts
|
|
NewTypeCheck ;a = number of entries (up to 65k)
|
|
beq GoodfType ;no type list, continue
|
|
tax ;count into x as counter
|
|
inx ;cheat so I can pre-decrement
|
|
bra NextNewType
|
|
*
|
|
* the below branch points are to allow me to move forward through the type list record to the next
|
|
* entry when something does not match in the list.
|
|
*
|
|
NExTNewType6
|
|
iny
|
|
iny
|
|
NExTNewType4
|
|
iny
|
|
iny
|
|
NExTNewType2
|
|
iny
|
|
iny
|
|
NExTNewType
|
|
dex
|
|
beq Bad ;forget it, no match found!
|
|
lda [TypeList],y ;flags
|
|
sta ztemp3 ;save them
|
|
iny
|
|
iny ;to file type
|
|
bit ztemp3 ;see if I need to check file type
|
|
bvs @1 ;nope, wild card file type bit set
|
|
lda [TypeList],y ;file type
|
|
cmp FileType ;first check!
|
|
bne NextNewType6 ;file type mismatch, move forward 6 bytes
|
|
@1
|
|
bit ztemp3 ;see if I need to check aux type.
|
|
bmi GoodfTypeNew ;nope, wild card aux type.
|
|
iny
|
|
iny ;now check the aux type
|
|
lda [TypeList],y
|
|
cmp AuxType
|
|
bne NextNewType4 ;aux type mismatch, move forward 4 bytes
|
|
iny ;now check the aux type, word 2
|
|
iny
|
|
lda [TypeList],y
|
|
cmp AuxType+2
|
|
bne NextNewType2 ;aux type mismatch. move on 2 bytes to next entry
|
|
GoodfTypeNew
|
|
*
|
|
* if here, we have a good match on both type and aux (or wild card match of some sort).
|
|
*
|
|
lda ztemp3 ;bit 13 says dim this selection
|
|
asl a
|
|
asl a ;into bit 15
|
|
bpl GoodfType ;not set so leave it up to the possible filter proc
|
|
sec
|
|
ror DimmedFile ;say dimmed
|
|
bra Good ;and return
|
|
GoodfType
|
|
*
|
|
* this section only used by Get type calls
|
|
*
|
|
lda FilterProcPtr+1 ;is there a User Hook ?(Cheat check)
|
|
beq Good ;none, lets get out of here!
|
|
|
|
pha ;Space for Result in below call
|
|
|
|
lda FGetPutFlag ;old or new call
|
|
lsr a
|
|
bcc NewCall ;go do with existing block
|
|
*
|
|
* old call must create a ProDos look alike entry.
|
|
*
|
|
jsr dir_translate ;create a ProDos look alike block
|
|
PushZLong ProDosDirEntry
|
|
bra CommonCall ;continue....
|
|
NewCall
|
|
*** PushZPtr ParBlock ;Entry read with GS/OS
|
|
pushlong #GDE_ParBlock ;25-Mar-91 DAL
|
|
CommonCall
|
|
lda #(ReturnAdr-1)>>8 ;Where we return to!
|
|
pha
|
|
lda #ReturnAdr-1
|
|
and #$00FF
|
|
xba
|
|
ora FilterProcPtr+2
|
|
pha
|
|
lda FilterProcPtr
|
|
dea
|
|
pha
|
|
rtl ;"jsl" to the user routine
|
|
ReturnAdr
|
|
pla ;returned value
|
|
bne OkToDisplay ;0 = don't display
|
|
brl Bad
|
|
*
|
|
* return code is 1 = no select or 2 = normal
|
|
*
|
|
OkToDisplay cmp #$0001 ;dimmed?
|
|
bne Good ;say good
|
|
sec
|
|
ror DimmedFile ;say dimmed again
|
|
brl Good ;and display it.
|
|
|
|
ENDP
|
|
|
|
|
|
**********************************************************************
|
|
*
|
|
* DirTranslate - used to convert the new GS/OS GetDirEntry call to
|
|
* an old ProDos type call WHEN an old call has a filterProc. I was
|
|
* originally going to translate everything as close as possible but
|
|
* old standard file only translates a few items and all apps work OK
|
|
* there so I'm not going to bother either!!!
|
|
*
|
|
* Ok, I'll do it all! (11/14/88)
|
|
*
|
|
* Uses; dpage temps: handle
|
|
**********************************************************************
|
|
dir_translate PROC EXPORT
|
|
ldy #$26 ;size of PorDos Dir Entry record
|
|
lda #$0000
|
|
ce_clear_loop
|
|
sta [ProDosDirEntry],y ;clear the entire area to 0
|
|
dey
|
|
bpl ce_clear_loop
|
|
|
|
*
|
|
* copy the name from the name pointer to the memory area of the ProDos Block.
|
|
* The assumption is made here that since a length is stored we don't really care if we
|
|
* copy over additional garbage as well so we move 16 characters always! 16? Oh yea, I
|
|
* "fix" the length word to put the size in the right byte and move 8 words which is
|
|
* faster than 15 bytes and then I put back the length word as it belongs.
|
|
*
|
|
ldy #02
|
|
lda [NamePtr],y
|
|
xba
|
|
sta [NamePtr],y ;sawp length "word"
|
|
lda ProDosDirEntry ;need a pointer to the destination
|
|
sec
|
|
sbc #3 ;name location offset to allow use of Y
|
|
sta pointer ;temp location as pointer
|
|
lda ProDosDirEntry+2
|
|
sbc #0
|
|
sta pointer+2
|
|
|
|
ldx #$0008
|
|
ldy #0003
|
|
ce_move_loop
|
|
lda [NamePtr],y
|
|
sta [pointer],y ;copy over the name
|
|
iny
|
|
iny
|
|
dex
|
|
bne ce_move_loop
|
|
ldy #02
|
|
lda [NamePtr],y
|
|
xba
|
|
sta [NamePtr],y ;sawp length "word" back as it was.
|
|
|
|
|
|
|
|
ldax ProDosDirEntry ;create a pointer to get at the other destinations
|
|
clc
|
|
adc #PDType
|
|
bcc @1
|
|
inx
|
|
@1
|
|
stax pointer ;this pointer will track the other items
|
|
lda ParFileType_GDE ;GS/OS file type
|
|
and #$00FF
|
|
sta [pointer] ;file type
|
|
|
|
ldy #0003 ;y as the offset starting at blocks used
|
|
lda ParBlocks_GDE
|
|
sta [pointer],y ;blocks used
|
|
iny
|
|
iny
|
|
lda ParEOF_GDE ;first 3 bytes of EOF
|
|
sta [pointer],y
|
|
iny
|
|
lda ParEOF_GDE+1
|
|
sta [pointer],y
|
|
tya
|
|
clc
|
|
adc #$08 ;pass time & date, ver, min_ver.
|
|
tay
|
|
lda ParAccess_GDE
|
|
sta [pointer],y ;low,high Access (but we only need 1 byte...)
|
|
iny ;y point to AuxType
|
|
lda ParauxType_GDE ;low of aux
|
|
sta [pointer],y
|
|
*
|
|
* now convert the time fields
|
|
*
|
|
* First, creation time and date
|
|
*
|
|
ldax ProDosDirEntry ;create a pointer to get at the other destinations
|
|
clc
|
|
adc #PDCreateDate
|
|
bcc @2
|
|
inx
|
|
@2
|
|
stax pointer ;this pointer will track the other items
|
|
*** changed 25-Mar-91 DAL (the GDE parm block is no longer on direct page)
|
|
*** ldaxzptr ParCreateDT_GDE ;pointer to time and date
|
|
ldx #^ParCreateDT_GDE
|
|
lda #ParCreateDT_GDE
|
|
*** end of 25-Mar-91 DAL
|
|
stax pointer2
|
|
jsr convert_time ;time returned in x and Y
|
|
phy
|
|
txa
|
|
sta [pointer] ;save date
|
|
ldy #0002
|
|
pla
|
|
sta [pointer],y ;save time
|
|
*
|
|
* Now the mod date and time
|
|
*
|
|
ldax ProDosDirEntry ;create a pointer to get at the other destinations
|
|
clc
|
|
adc #PDModDate
|
|
bcc @3
|
|
inx
|
|
@3
|
|
stax pointer ;this pointer will track the other items
|
|
*** ldaxzptr ParModDT_GDE ;pointer to time and date
|
|
ldx #^ParModDT_GDE ;25-Mar-91 DAL
|
|
lda #ParModDT_GDE
|
|
stax pointer2
|
|
jsr convert_time ;time returned in x and Y
|
|
phy
|
|
txa
|
|
sta [pointer] ;save date
|
|
ldy #0002
|
|
pla
|
|
sta [pointer],y ;save time
|
|
|
|
rts
|
|
|
|
ENDP
|
|
|
|
;======================================================================
|
|
;We call this entry point if the time parameters are setup and need
|
|
;only to be convert to the ProDOS format.
|
|
;
|
|
;Input: GS/OS time field in Get File Info pointed to by [pointer2]
|
|
; (This could be either createTimeDate or modTimeDate.)
|
|
;
|
|
;Output: format of time:
|
|
;
|
|
; |<-------- X Register --------->|<-------- Y Register --------->|
|
|
; | | |
|
|
; |<--high Byte-->|<--low Byte-->|<--high Byte-->|<--low Byte-->|
|
|
; _______________________________________________________________
|
|
; | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
|
|
; | year | month | day |0 0 0| hour |0 0| minute |
|
|
; |_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
|
|
;
|
|
;======================================================================
|
|
|
|
convert_time PROC EXPORT
|
|
stz pro_time
|
|
stz pro_time+2 ;start with a clean slate
|
|
ldy #day_GDE
|
|
lda [pointer2],y ;day
|
|
and #$001F ;5 bits
|
|
sta pro_time ;save the day in prodos format
|
|
ldy #month_GDE
|
|
lda [pointer2],y ;month
|
|
and #$000F ;4 bits
|
|
asl a
|
|
asl a
|
|
asl a
|
|
asl a
|
|
asl a ;shift to correct position
|
|
ora pro_time ;month is now happy
|
|
sta pro_time
|
|
ldy #year_GDE
|
|
lda [pointer2],y ;year
|
|
;;; and #$007F ;7 bits
|
|
*** added 29-Jan-92 DAL -- a class-0 year is 40..99 for 1940..1999, 0..39 for 2000..2039
|
|
*** (return unknown-date/time (all zeroes) for out-of-range dates)
|
|
and #$00ff ;year (offset from 1900)
|
|
cmp #40
|
|
bcc @unknownDate
|
|
cmp #139+1
|
|
bcs @unknownDate
|
|
cmp #100
|
|
bcc @yearOK
|
|
; sec
|
|
sbc #100
|
|
@yearOK
|
|
*** end 29-Jan-92 DAL
|
|
xba
|
|
asl a ;shift year to upper 7 bits
|
|
ora pro_time
|
|
sta pro_time
|
|
ldy #minutes_GDE
|
|
lda [pointer2],y ;minutes
|
|
and #$003F ;6 bits
|
|
sta pro_time+2
|
|
ldy #hours_GDE ;hours
|
|
lda [pointer2],y
|
|
and #$001F ;5 bits
|
|
xba
|
|
ora pro_time+2
|
|
sta pro_time+2
|
|
;;; sta pro_time+2 ;redundant, 25-Mar-91 DAL
|
|
tay
|
|
ldx pro_time
|
|
rts
|
|
|
|
*** added 29-Jan-92 DAL
|
|
@unknownDate ldx #0
|
|
txy
|
|
rts
|
|
*** end 29-Jan-92
|
|
|
|
ENDP
|
|
|
|
|
|
**********************************************************************
|
|
*
|
|
* Scan through the list and select the first possible item that can
|
|
* be selected. Used in BuildList for a new list and also by UpDown arrow
|
|
* control if nothing is selected
|
|
*
|
|
* Changes the contents of 'seletedptr' if an item is available for
|
|
* selection and sets its select bit. If the list is empty or nothing
|
|
* can be selected the routine selects nothing and returns with
|
|
* 'selectedptr' nil.
|
|
*
|
|
**********************************************************************
|
|
SelectFirst PROC EXPORT
|
|
*
|
|
* if the list is not empty hilight the first element of the list
|
|
*
|
|
ldy #ListRecord.listCount
|
|
lda [ListRecPtr],y ;how many entries in this list
|
|
beq looksempty
|
|
notempty
|
|
pha
|
|
asl a
|
|
asl a
|
|
clc
|
|
adc 1,s ;* 5
|
|
sta ztemp2
|
|
pla ;clean stack
|
|
ldy #$FFFF ;look throught list (proper offset to get to first item
|
|
shortm
|
|
keeplooking
|
|
iny
|
|
iny
|
|
iny
|
|
iny
|
|
iny
|
|
cpy ztemp2 ;past end of list
|
|
bcs looksempty ;if no items to hilight, just look empty!
|
|
lda [ListPointerPtr],y
|
|
bit #MEM_DISABLE+NOT_POSSIBLE ;item disabled
|
|
bne keeplooking ;find me a selectable slot
|
|
ora #MEM_SEL ;set selected bit
|
|
sta [ListPointerPtr],y
|
|
longm
|
|
*
|
|
* Need a pointer to hand to _NewList so it selects the right item. Here is another reason
|
|
* there cannot be more than 13,107 items in the list! (y is a word!!!!!)
|
|
*
|
|
tya
|
|
sec
|
|
sbc #0004 ;pointer to start of this record
|
|
clc
|
|
adc ListPointerPtr
|
|
sta selectedptr
|
|
lda ListPointerPtr+2
|
|
adc #0000
|
|
sta selectedptr+2
|
|
Exit
|
|
rts
|
|
looksempty
|
|
longm
|
|
stzl selectedptr ;no item selected
|
|
rts
|
|
|
|
**********************************************************************
|
|
*
|
|
* Save and Zero the Ref Cons (wonderful thing the list manager, eh?)
|
|
*
|
|
**********************************************************************
|
|
ENTRY SaveAndZeroRefCons
|
|
SaveAndZeroRefCons pha ; Get the ref con of the list
|
|
pha ; control and save it
|
|
PushZLong ListControl1
|
|
_GetCtlRefCon
|
|
pla
|
|
sta ListRefCon
|
|
pla
|
|
sta ListRefCon+2
|
|
|
|
lda ListControl1 ; now find the handle to the
|
|
sta handle ; scroll bar control
|
|
lda ListControl1+2 ; (it's at the end of the record
|
|
sta Handle+2 ; used by the list control)
|
|
|
|
lda [Handle]
|
|
sta Pointer
|
|
ldy #2
|
|
lda [Handle],y
|
|
sta Pointer+2
|
|
|
|
ldy #octlListBar ;a known offset (page 11-9 IIgs Reference Book)
|
|
lda [Pointer],y
|
|
sta ScrollControl1 ;handle of lists control's scroll bar control
|
|
iny
|
|
iny
|
|
lda [Pointer],y
|
|
sta ScrollControl1+2
|
|
|
|
pha ; use this to save and zero
|
|
pha ; ref con of the Scroll bar control
|
|
PushZLong ScrollControl1
|
|
_GetCtlRefCon
|
|
pla
|
|
sta ScrollRefCon
|
|
pla
|
|
sta ScrollRefCon+2
|
|
|
|
ZeroRefCons
|
|
PushLong #0 ;zero the refcon of the list
|
|
PushZLong ListControl1
|
|
_SetCtlRefCon
|
|
|
|
PushLong #0
|
|
PushZLong ScrollControl1
|
|
_SetCtlRefCon
|
|
|
|
rts
|
|
ENDP
|
|
|
|
|
|
**********************************************************************
|
|
*
|
|
* These routines sets the state of the close button to enabled or disabled:
|
|
* The common button entry may be used to set either and depends on the value
|
|
* of y upon entry.
|
|
*
|
|
* If the button is already in the desired state no action is taken.
|
|
* The global variable openButStat is updated to the new state.
|
|
*
|
|
* Note that similar functions are performed in the filter routine so
|
|
* that some changes take place as soon as items are hit.
|
|
*
|
|
* if called at the CommonOpen entry, the state must be in 'a'
|
|
*
|
|
**********************************************************************
|
|
SetClose PROC EXPORT
|
|
EXPORT EnableClose
|
|
EXPORT DisableClose
|
|
EXPORT CommonOpen
|
|
*
|
|
* set the close button according to the status of topflg
|
|
*
|
|
* jsr check_for_top
|
|
* lda topflg ;0 = top level
|
|
|
|
lda FGetPutFlag
|
|
and #InVolumeList
|
|
bne DisableClose ;needs to be disabled (waste and fall though otherwise)
|
|
EnableClose
|
|
lda #$0000
|
|
bra commonClose
|
|
DisableClose
|
|
lda #$00FF ; item not enabled
|
|
CommonClose
|
|
ldy #0002 ; close ID (Get)
|
|
cmp closeButStat ; see if the state changed
|
|
beq Done ; then skip this, not necessary
|
|
sta closeButStat ; save the new status
|
|
bra CommonButton
|
|
CommonOpen
|
|
ldy #0001
|
|
cmp openButStat ; see if the state changed
|
|
beq Done ; then skip this, not necessary
|
|
sta openButStat ; save the new status
|
|
CommonButton
|
|
pha ; save state
|
|
PushLongSpace ; handle will return here.
|
|
PushZLong DialogPtr ; the dialog pointer
|
|
*
|
|
* the item id goes up by 1 if this is PUT and not GET
|
|
*
|
|
jsr PutAdjust
|
|
phy ; push item's ID
|
|
_GetControlDItem ; get a handle to the open button
|
|
*
|
|
* returns handle to item on stack. Stack already has the desired state there!
|
|
*
|
|
_HiliteControl ; Make sure it's on
|
|
Done
|
|
rts
|
|
ENDP
|
|
|
|
|
|
**********************************************************************
|
|
*
|
|
* GetSelected -- will pass through the list managers list and get the
|
|
* first item selected by checking the selected bit.
|
|
* A pointer to the string selected is returned in A and X
|
|
* N bit set true if item pointer return NIL.
|
|
*
|
|
* GetNextSelected -- will return the next selected item AFTER the member
|
|
* passed in A&X
|
|
*
|
|
* uses: ztemp3
|
|
*
|
|
**********************************************************************
|
|
GetSelected PROC EXPORT
|
|
EXPORT GetNextSelected
|
|
|
|
lda #0000
|
|
tax ;always first item
|
|
GetNextSelected
|
|
PushLongSpace
|
|
PushAX
|
|
PushZLong ListRecPtr
|
|
_NextMember ;search specified list record for selected item
|
|
PullLong ztemp3 ;put in temp
|
|
*
|
|
* if this is 0 nothing is selected.
|
|
*
|
|
lda ztemp3+1 ;cheat check for 0
|
|
beq @done
|
|
ldax ztemp3 ;return "handle"
|
|
rep #%00000010 ;make sure z bit is cleared!
|
|
@done
|
|
rts
|
|
ENDP
|
|
|
|
**********************************************************************
|
|
*
|
|
* DirectoryUp -- Step back one directory level. If no levels to
|
|
* go back to, return same.
|
|
*
|
|
* Exit: Carry set if a change occured.
|
|
*
|
|
**********************************************************************
|
|
DirectoryUp PROC EXPORT
|
|
|
|
*
|
|
* the assumption is that the current path is already pointed to by the
|
|
* ptr 'PrefixPtr' in a class 1 string
|
|
*
|
|
ldy #$0002 ;length of string
|
|
lda [PrefixPtr],y ;get length
|
|
clc
|
|
adc #$0003 ;pass up buffer length and string length - 1
|
|
tay ;hold it!
|
|
shortm ;****SHORT MODE******
|
|
lda Seperator ;current seperation character
|
|
loop
|
|
dey
|
|
cpy #$0004 ;if here, we have done whole stirng
|
|
beq done ;we are finished if we get here
|
|
cmp [PrefixPtr],y ;see if this is a seperation character
|
|
bne loop ;keep looking
|
|
*
|
|
* if here, we found a seperation character. Simply store this as the new string length to backup
|
|
*
|
|
longm ;*******back to long mode
|
|
tya
|
|
sec
|
|
sbc #0003 ;subtract off buffer additions
|
|
ldy #$0002
|
|
sta [PrefixPtr],y ;this shortens the string
|
|
jsr SetThePrefix ;reset the prefix
|
|
jsr check_for_top ;check for top level
|
|
sec
|
|
rts ;return up ok (carry clear)
|
|
done
|
|
longm ;*****back to long mode (in case we branched)
|
|
stz topflg
|
|
clc ;no change flag
|
|
rts
|
|
|
|
ENDP
|
|
|
|
|
|
**********************************************************************
|
|
*
|
|
* DirectoryDown -- Step down one directory level. The name of the
|
|
* directory to step to will be indicated by the string selected
|
|
* in the list.
|
|
*
|
|
* On exit, carry set indicates a change took place else the carry
|
|
* is clear
|
|
*
|
|
**********************************************************************
|
|
DirectoryDown PROC EXPORT
|
|
|
|
*
|
|
* the assumption is that the current path is already pointed to by the
|
|
* ptr 'PrefixPtr' in a class 1 string and the next level is indicated by
|
|
* which member of the list is highlighted.
|
|
*
|
|
jsr GetSelected ;find which picked
|
|
*
|
|
* returns pointer to the selected string in A & X. Returns 0 if nothing sleceted.
|
|
*
|
|
beq @1
|
|
PushAX ;convert returned member to string pointer.
|
|
jsr DerefHandle ;deref handle
|
|
stax pointer2 ;pointer to the string
|
|
jsr AddToPrefix ;add name to prefix string
|
|
|
|
sec
|
|
ror topflg ;non-0 indicates not top
|
|
jsr SetThePrefix ;reset the prefix
|
|
sec ;carry set indicates a change took place
|
|
rts
|
|
@1
|
|
clc ;carry clear indicvates no change happened
|
|
rts
|
|
|
|
ENDP
|
|
**********************************************************************
|
|
*
|
|
* See if I am at the root level and set the dpage variable
|
|
* 'topflg' to non zero if not otherwise zero it. Assumes that a call to
|
|
* GetThePrefix has already been made so that the dpage variable
|
|
* 'Seperator' is set correctly.
|
|
*
|
|
* Uses a,y. Changes topflg
|
|
**********************************************************************
|
|
check_for_top PROC EXPORT
|
|
ldy #$0002
|
|
lda [PrefixPtr],y ;length of prefix string
|
|
clc
|
|
adc #$0003 ;past buffer again (sheesh!)
|
|
tay
|
|
stz topflg ;guess we are at the top
|
|
shortm
|
|
lda Seperator ;get the seperation char
|
|
loop2
|
|
dey
|
|
cpy #$0004 ;if here, we have done whole stirng
|
|
beq done_changed ;we are at the top if we branch
|
|
cmp [PrefixPtr],y ;see if this is a seperation character
|
|
bne loop2 ;keep looking
|
|
*
|
|
* if we fell through there is still at least another layer left!
|
|
*
|
|
dec topflg ;indicate not top yet
|
|
done_changed
|
|
longm
|
|
rts
|
|
|
|
**********************************************************************
|
|
*
|
|
* Add to Prefix. This routine will add the name in the string
|
|
* pointed to by A&X to the string already pointed to by PrefixPtr. The
|
|
* prefix is NOT updated here as this routine is also used to build the
|
|
* path for the call return (path+file name) as well as just the new prefix.
|
|
*
|
|
* Uses: ztemp3, pointer2 A, X, Y. Change string pointed to by PrefixPtr
|
|
*
|
|
**********************************************************************
|
|
AddToPrefix PROC EXPORT
|
|
stax pointer2 ;source location
|
|
ldy #$0002 ;length of string
|
|
lda [PrefixPtr],y ;get last slot
|
|
clc ;get a pointer to the last character (y will point to next)
|
|
adc #$0003 ;ASSUMPTION, no overflow here!
|
|
*
|
|
* GS/OS limits path naes to 8K so I know this won't overflow at +4
|
|
*
|
|
adc PrefixPtr ;pointer to end of current string
|
|
sta ztemp3 ;use D page temp pointer
|
|
lda PrefixPtr+2
|
|
adc #0
|
|
sta ztemp3+2 ;upper byte
|
|
|
|
lda [pointer2] ;get length of string (folder or file)
|
|
and #$00FF ;max length is 255
|
|
tay
|
|
phy ;save a copy of length
|
|
@loop
|
|
lda [pointer2],y
|
|
sta [ztemp3],y
|
|
dey
|
|
bne @loop ;max folder name length is 32K (oh damn!)
|
|
*
|
|
* add the seperation character
|
|
*
|
|
ply ;recall last character location (from above)
|
|
iny ;one past
|
|
shortm ;WARNING...last minute change
|
|
lda Seperator ;get current seperation character
|
|
sta [ztemp3],y ;add the seperation char to the end
|
|
longm
|
|
tya ;move size added to a
|
|
ldy #$00002
|
|
clc
|
|
adc [PrefixPtr],y ;add length of original string
|
|
sta [PrefixPtr],y
|
|
*
|
|
* probably again should check to see of the path length is greater than 512 (508 actually)
|
|
* and re-size the handle but again I am being too lazy and we will assume that 508 is
|
|
* max path size at this time
|
|
*
|
|
rts
|
|
ENDP
|
|
|
|
**********************************************************************
|
|
*
|
|
* GetFirst -- Find and Open directory of selected volume as indicated
|
|
* by the device specified by Prefix 8. If Prefix 8 is blank, then
|
|
* Prefix 0 is taken and copied to Prefix 8.
|
|
* Assuming the Prefix 8 is small enough, prefix 8 is coppied to Prefix 0.
|
|
*
|
|
* NOTE: If the entry was from an old standard file call, we start with
|
|
* with prefix 0 instead. 8 will also get the contents of 0 at this point.
|
|
*
|
|
**********************************************************************
|
|
|
|
GetFirst PROC EXPORT
|
|
With PopUpGlobals
|
|
*
|
|
* ASSUMPTION: At this time no prefix can be more than 512 bytes due to size of allocated memory
|
|
* will need to code to expand this later.
|
|
*
|
|
ldx #$0008 ;guess will use 8
|
|
lda FGetPutFlag
|
|
lsr a ;see if an old call
|
|
bcc NotOld
|
|
ldx #$0000 ;old calls use prefix 0
|
|
NotOld
|
|
txa ;get the prefix needs # in a
|
|
jsr GetThePrefix ;get the prefix string
|
|
bcs Error ;error, how strange!
|
|
*
|
|
* Prefix string is now at [PrefixPtr]
|
|
*
|
|
ldy #2 ;length of string is after buffer length
|
|
lda [PrefixPtr],y
|
|
bne OkPrefix ;if non-0, we found a string in #8
|
|
*
|
|
* yea, I know. I may have already done 0 if this was an old call. No big deal trying again!
|
|
*
|
|
* (ALREADY 0) lda #0
|
|
jsr GetThePrefix ;8 was unused, try prefix #0
|
|
bcs Error
|
|
*
|
|
* copy 0 to 8 as we need it there. (What if 0 was empty??? Can this happen?)
|
|
*
|
|
lda [PrefixPtr],y ;see if also 0 length
|
|
beq Error ;on no, both blank
|
|
OkPrefix
|
|
jsr DoGetFileInfo
|
|
lda ParFileType_GFI ;make sure the filetype is a directory FileType
|
|
cmp #$000F
|
|
bne Error ;if not directory then go to next volume
|
|
|
|
jsr SetThePrefix ;make 0 & 8 the same.
|
|
jsr OpenPrefix ;open the directory specified by prefix
|
|
bcc @openOk
|
|
cmp #$004E ;was the open error caused by an access error
|
|
bne Error
|
|
*
|
|
* OpenPrefix can return an error (carry will be set if Prefix NOT openend)
|
|
*
|
|
@openOk rts ;return the error flag
|
|
|
|
*
|
|
* When standard file first comes up we always try to display the list of files for the volume
|
|
* in prefix 8 or 0. If these prefixes are not valid then we end up here.
|
|
* Here we try to find the first valid device and display the contents of its directory.
|
|
*
|
|
Error
|
|
lda #1 ;Start search at device number 1.
|
|
sta curDev
|
|
lda #0 ;Force the name currently in prefixptr
|
|
ldy #2 ;to become invalid.
|
|
sta [PrefixPtr],y ;Search for first valid device.
|
|
jsr NextDrive2
|
|
bcc GotAGoodDrive ;Carry clear means we found one, carry set
|
|
brl NoVolumes ;means we didn't and now we must display our
|
|
; ;"insert a disk..." errow window.
|
|
|
|
GotAGoodDrive
|
|
ldx #8 ;Since we got a valid device, now we reset
|
|
lda FGetPutFlag ;either prefix 8 or 0 to this volume name.
|
|
lsr a ;see if an old call
|
|
bcc @NotOld
|
|
ldx #0 ;set prefix 0 for old-style calls
|
|
@NotOld stx ParNumber_GetPrefix
|
|
lda #2 ;pCount
|
|
sta ParBlock
|
|
lda PrefixPtr
|
|
clc
|
|
adc #2 ;get past buffer size word
|
|
sta ParPtr_GetPrefix
|
|
lda PrefixPtr+2
|
|
adc #0
|
|
sta ParPtr_GetPrefix+2
|
|
PushZPtr ParBlock
|
|
PushWord #$2009 ;SetPrefix 8 or 0 to first valid device found.
|
|
jsl ProDOS_Stack_Entry
|
|
|
|
brl GetFirst ;Now try it from the beginning again.
|
|
|
|
NoVolumes
|
|
stzl selectedptr
|
|
|
|
jsr PutUpAlert
|
|
bcc GotAGoodDrive
|
|
|
|
rts
|
|
|
|
|
|
|
|
**********************************************************************
|
|
* OpenPrefix will open the file or directory specified in the prefix
|
|
* string with READ ONLY access.
|
|
**********************************************************************
|
|
OpenPrefix PROC
|
|
|
|
|
|
lda #$0002 ;retires on i/o error
|
|
sta ztemp1 ;will be used as a flag
|
|
TryAgain
|
|
lda #03
|
|
sta ParBlock ;3 parameters to Open ($09 bytes)
|
|
lda #01 ;read access only
|
|
sta RequestAccess_Open
|
|
|
|
ldax PrefixPtr
|
|
clc
|
|
adc #02
|
|
bcc @nocarry
|
|
inx
|
|
@nocarry
|
|
stax ParName_Open ;set pointer to path string
|
|
|
|
PushZPtr ParBlock ;pointer to parameter block
|
|
PushWord #$2010 ;open
|
|
jsl ProDos_Stack_Entry ;stack based call
|
|
*
|
|
* errors are possible here
|
|
*
|
|
bcc openok
|
|
*
|
|
* got an error!!!
|
|
*
|
|
cmp #$0027 ;i/o error, try again
|
|
bne notIOerror
|
|
dec ztemp1 ;have we tried too many times?
|
|
bne TryAgain
|
|
NotIOerror
|
|
cmp #$004E ;no access?
|
|
bne anError
|
|
pha ;save error
|
|
_InitCursor ;Set cursor back to arrow cursor.
|
|
*
|
|
* access error to this volume. Report the error as a dialog...
|
|
*..and reset the prefix back "up" one folder level.
|
|
*
|
|
PushWordSpace ;results for alert window
|
|
PushWord #0 ;indicate C string
|
|
PushLong #0 ;no substitution string
|
|
PushWord #$82 ;no access
|
|
_ErrorWindow
|
|
pla ;don't care what comes back
|
|
jsr DirectoryUp ;step the name back out of the prefix
|
|
pla ;error saved above
|
|
anError sec
|
|
rts
|
|
|
|
openok
|
|
lda ParRefNumber_Open
|
|
sta RefNumber
|
|
rts
|
|
**********************************************************************
|
|
* ClosePrefix will close the file or directory specified by the reference
|
|
* number stored in the GLOBAL value RefNumber (usually last opened). An alternate entry,
|
|
* CloseA will allow one to pass a reference number in A and have that
|
|
* item closed. The Global RefNumber in this case is unchanged.
|
|
**********************************************************************
|
|
EXPORT CloseA
|
|
EXPORT ClosePrefix
|
|
ClosePrefix
|
|
lda RefNumber ;Reference number to close
|
|
CloseA
|
|
tax ;14-Jan-91 DAL (just being paranoid!)
|
|
beq @NeverCloseZero ;14-Jan-91 DAL (just being paranoid!)
|
|
sta ParRefNumber_Open
|
|
lda #01
|
|
sta ParBlock ;1 parameters to close
|
|
|
|
PushZPtr ParBlock ;pointer to parameter block
|
|
PushWord #$2014 ;_Close_C1
|
|
jsl ProDos_Stack_Entry ;stack based call
|
|
@NeverCloseZero
|
|
*
|
|
* errors are possible here **DEBUG** What do I do with an error on a close?
|
|
*
|
|
* I'll ignore it!
|
|
*
|
|
clc ;it never happened!!!
|
|
rts
|
|
ENDP
|
|
|
|
**********************************************************************
|
|
* ReadDirSize will return the directory size from the currently opened
|
|
* directory (as last opened by OpenPrefix above) referenced by the
|
|
* RefNumber stored in the GLOBAL varaible RefNumber
|
|
*
|
|
* Size returned in A and also stored the GLOBAL variable DirSize
|
|
**********************************************************************
|
|
ReadDirSize PROC EXPORT
|
|
|
|
|
|
lda #$06
|
|
sta ParPCount_GDE
|
|
stz ParBase_GDE
|
|
stz ParDisplacement_GDE ;0 & 0 will return size of directory
|
|
lda RefNumber
|
|
sta ParRefNumber_GDE ;currently opened directory
|
|
ldax NamePtr
|
|
stax ParName_GDE
|
|
|
|
*** PushZPtr ParBlock ;pointer to parameter block
|
|
pushlong #GDE_ParBlock ;25-Mar-91 DAL
|
|
PushWord #$201C ;GetDirEntry_C1
|
|
jsl ProDos_Stack_Entry ;stack based call
|
|
*
|
|
* errors can be returned here
|
|
*
|
|
bcs @ohno ;returning here will cause a blank list
|
|
|
|
@readok
|
|
lda ParEntryNum_GDE ;size of directory
|
|
sta DirSize
|
|
@ohno
|
|
stz EntryNum ;make sure this is 0
|
|
rts
|
|
|
|
|
|
**********************************************************************
|
|
* ReadNextDirEntry will read the next entry from the currently opened
|
|
* directory (as last opened by OpenPrefix above) referenced by the
|
|
* RefNumber stored in the GLOBAL varaible RefNumber.
|
|
*
|
|
**********************************************************************
|
|
EXPORT ReadNextDirEntry
|
|
ReadNextDirEntry
|
|
lda EntryNum
|
|
cmp DirSize
|
|
bge @too_many ;in case network device and size grew
|
|
lda #$01
|
|
sta ParDisplacement_GDE
|
|
sta ParBase_GDE
|
|
|
|
*** lda #13
|
|
lda #17 ;pCount=17 (25-Mar-91 DAL)
|
|
sta ParPCount_GDE ;13 entries
|
|
|
|
lda RefNumber
|
|
sta ParRefNumber_GDE
|
|
ldax NamePtr ;place to put the answer
|
|
stax ParName_GDE
|
|
|
|
*** PushZPtr ParBlock ;pointer to parameter block
|
|
pushlong #GDE_ParBlock ;25-Mar-91 DAL
|
|
PushWord #$201C ;GetDirEntry
|
|
jsl ProDos_Stack_Entry ;stack based call
|
|
bcs @error
|
|
*
|
|
* errors can be returned here
|
|
*
|
|
lda ParFileType_GDE
|
|
and #$00FF ;file types are bytes
|
|
sta FileType ;save file type in global
|
|
lda ParauxType_GDE
|
|
sta AuxType
|
|
lda ParauxType_GDE+2
|
|
sta AuxType+2
|
|
lda ParEntryNum_GDE
|
|
sta EntryNum ;current entry number
|
|
@error
|
|
rts ;return error status
|
|
@too_many
|
|
sec
|
|
lda #$61 ;fake end of directory
|
|
rts
|
|
|
|
*** added 25-Mar-91 DAL
|
|
export GDE_ParBlock
|
|
GDE_ParBlock
|
|
export ParPCount_GDE
|
|
ParPCount_GDE dc.w 0
|
|
export ParRefNumber_GDE
|
|
ParRefNumber_GDE dc.w 0
|
|
export ParFlags_GDE
|
|
ParFlags_GDE dc.w 0
|
|
export ParBase_GDE
|
|
ParBase_GDE dc.w 0
|
|
export ParDisplacement_GDE
|
|
ParDisplacement_GDE dc.w 0
|
|
export ParName_GDE
|
|
ParName_GDE dc.l 0
|
|
export ParEntryNum_GDE
|
|
ParEntryNum_GDE dc.w 0
|
|
export ParFileType_GDE
|
|
ParFileType_GDE dc.w 0
|
|
export ParEOF_GDE
|
|
ParEOF_GDE dc.l 0
|
|
export ParBlocks_GDE
|
|
ParBlocks_GDE dc.l 0
|
|
export ParCreateDT_GDE
|
|
ParCreateDT_GDE dc.l 0,0
|
|
export ParModDT_GDE
|
|
ParModDT_GDE dc.l 0,0
|
|
export ParAccess_GDE
|
|
ParAccess_GDE dc.w 0
|
|
export ParAuxType_GDE
|
|
ParAuxType_GDE dc.l 0 ;old SF only had 13 parms
|
|
export ParFileSysID_GDE
|
|
ParFileSysID_GDE dc.w 0
|
|
export ParOptList_GDE
|
|
ParOptList_GDE dc.l OptionListBuffer
|
|
export ParResourceEOF_GDE
|
|
ParResourceEOF_GDE dc.l 0
|
|
export ParResourceBlk_GDE
|
|
ParResourceBlk_GDE dc.l 0 ;now we have all 17
|
|
|
|
|
|
OptionListBuffer dc.w 64
|
|
ds.b 64
|
|
*** end of 25-mar-91 DAL
|
|
|
|
ENDP
|
|
|
|
|
|
**********************************************************************
|
|
*
|
|
* GetThePrefix
|
|
*
|
|
* Puts the prefix # passed in A into a class 1 string pointed to by
|
|
* PrefixPtr and clobbers the data currently in the global ParBlock
|
|
* (which is where the string resides).
|
|
*
|
|
* This routine will also update the direct page variable 'curDev' with
|
|
* the device number that this prefix represents (unchanged if the prefix
|
|
* is blank).
|
|
*
|
|
* SetThePrefix
|
|
*
|
|
* Puts the prefix string in the global ParBlock pointed to by PrefixPtr
|
|
* into the prefix number 8 and, if it fits, 0.
|
|
*
|
|
**********************************************************************
|
|
GetThePrefix PROC EXPORT
|
|
*
|
|
* Puts path name into Reply buffer for passed in A
|
|
*
|
|
* equates for GetDevNumber
|
|
*
|
|
devName equ ParBlock+02 ;Ptr to Device name
|
|
devNumber equ ParBlock+06 ;returned dev number
|
|
|
|
sta ParNumber_GetPrefix ;which prefix
|
|
lda #02
|
|
sta ParBlock ;Pcount
|
|
lda PrefixPtr ;memory for path results
|
|
sta ParPtr_GetPrefix
|
|
lda PrefixPtr+2
|
|
sta ParPtr_GetPrefix+2
|
|
PushZPtr ParBlock ;pointer to parameter block
|
|
PushWord #$200A ;GetPrefix
|
|
jsl ProDos_Stack_Entry ;stack based call
|
|
bcs Done ;if an error
|
|
*
|
|
* Note: This should check the length of the returned string and if longer than the
|
|
* current buffer size (pointed to by PrefixPtr), we need to re-size the buffer and
|
|
* issue the call again. But for now 512 bytes should be plenty long.
|
|
*
|
|
ldy #0002 ;current length of string loc
|
|
lda [PrefixPtr],y
|
|
beq done ;skip rest of this string is empty
|
|
*
|
|
* if not an empty prefix, set curDev to the device # specified by this volume name
|
|
*
|
|
pha ;save the original length.
|
|
iny
|
|
iny
|
|
shortm
|
|
ldx #0001 ;use as a temp count
|
|
lda [PrefixPtr],y ;get current seperation character
|
|
sta Seperator
|
|
loop
|
|
iny ;start with next character
|
|
inx
|
|
cmp [PrefixPtr],y ;look for seperation character
|
|
bne loop ;it's there!
|
|
longm
|
|
ldy #0002 ;save length for volume only
|
|
txa
|
|
sta [PrefixPtr],y ;put the temp length in the string
|
|
|
|
lda PrefixPtr ;memory for path results
|
|
clc
|
|
adc #2 ;Passed the buffer size
|
|
sta DevName
|
|
lda PrefixPtr+2
|
|
adc #0
|
|
sta DevName+2
|
|
lda #0002
|
|
sta ParBlock ;2 parameters
|
|
|
|
jsr GetAndFixPrefs ;added 29-Jan-92 DAL (don't prompt for disk)
|
|
|
|
PushZPtr ParBlock ;pointer to parameter block
|
|
PushWord #$2020 ;GetDevNumber
|
|
jsl ProDos_Stack_Entry ;stack based call
|
|
|
|
php ;added 29-Jan-92 DAL
|
|
_SetSysPrefsGS oldPrefs ;added 29-Jan-92 DAL
|
|
plp ;added 29-Jan-92 DAL
|
|
|
|
pla
|
|
ldy #0002
|
|
sta [PrefixPtr],y ;restore original length
|
|
|
|
bcs Done ;in case an error was returned
|
|
|
|
lda devNumber ;returned value
|
|
sta curDev ;save in global!
|
|
|
|
clc ;make sure no error reported
|
|
done
|
|
rts
|
|
|
|
*** added 29-Jan-92 DAL -- don't prompt for the boot disk
|
|
GetAndFixPrefs _GetSysPrefsGS oldPrefs
|
|
lda >oldPrefs+2
|
|
and #$1fff ;
|
|
sta >myPrefs+2
|
|
_SetSysPrefsGS myPrefs
|
|
rts
|
|
|
|
oldPrefs dc.w 1 ;1 parameter
|
|
dc.w 0 ;the old SysPrefs
|
|
|
|
myPrefs dc.w 1
|
|
dc.w 0 ;my modified preferences
|
|
*** end 29-Jan-92
|
|
|
|
EXPORT SetThePrefix
|
|
EXPORT Force0 ;entry to skip size check.
|
|
SetThePrefix
|
|
|
|
ldy #$0002 ;length of prefix
|
|
lda [PrefixPtr],y
|
|
*
|
|
* A = size of prefix we want to put into 8. If small enough, we will put it back into 0 as
|
|
* well, if too big, will warn the user and not change
|
|
*
|
|
cmp #$0040 ; max size of prefix 0 (64 char)
|
|
bcc Force0 ; will fit into 0
|
|
*
|
|
* warn the person if we came in through an old call that this may not work
|
|
*
|
|
ldx #$0008 ;also, we skip 0 because we know it's too big
|
|
lda FGetPutFlag
|
|
lsr a ;if carry set, this old mode
|
|
bcc AndAgain ;don't care in new mode, just don't do 0
|
|
*
|
|
* by the way, simply don't do this and stay where we are as well!
|
|
*
|
|
PushWordSpace ;results for alert window
|
|
PushWord #0 ;indicate C string
|
|
PushLong #0 ;no substitution string
|
|
PushWord #$88 ;Pathname too long
|
|
_ErrorWindow
|
|
pla ;don't care what comes back
|
|
jsr DirectoryUp ;and back this mess out!
|
|
sec ;not really an error
|
|
rts ;no change
|
|
|
|
Force0
|
|
ldx #$0000 ;set prefix 0 first, then do 8
|
|
AndAgain
|
|
phx ;save for later check
|
|
stx ParNumber_GetPrefix ;which prefix
|
|
lda #02
|
|
sta ParBlock ;Pcount
|
|
lda PrefixPtr ;memory for path results
|
|
clc
|
|
adc #2 ;Passed the buffer size
|
|
sta ParPtr_GetPrefix
|
|
lda PrefixPtr+2
|
|
adc #0
|
|
sta ParPtr_GetPrefix+2
|
|
PushZPtr ParBlock ;pointer to parameter block
|
|
PushWord #$2009 ;SetPrefix
|
|
jsl ProDos_Stack_Entry ;stack based call
|
|
bcs Oppss
|
|
pla
|
|
bne Setdone ;we are done?
|
|
ldx #$0008 ;now do 8
|
|
bra AndAgain
|
|
*
|
|
* Errors returned through call
|
|
*
|
|
Oppss
|
|
plx ;return an error
|
|
Setdone
|
|
rts
|
|
|
|
ENDP
|
|
|
|
**********************************************************************
|
|
*
|
|
* Misc stuff
|
|
*
|
|
**********************************************************************
|
|
GetLocInfo PROC EXPORT
|
|
|
|
PushWord #00
|
|
_GetMasterScb
|
|
pla
|
|
and #$80 ;if bit set, we are 640, else 320
|
|
rts
|
|
|
|
**********************************************************************
|
|
*
|
|
* MoveDialogToMemory -- allocates and locks a memory area in which to
|
|
* place the current dialog header. Since old standard file calls
|
|
* have a dialog items that now do nothing, this will Mung out the unused items
|
|
* by building a new dialog template header list WITHOUT the two unused items;
|
|
* Namely, "files" and "scroll"
|
|
* In addition, it needs to add 'PathDraw' to the Path item (if nothing there)
|
|
* on Patched dialogs.
|
|
*
|
|
* This also moves the list manager record into RAM as well & updates that
|
|
* area with the proper rectangle.
|
|
*
|
|
*
|
|
* ENTRY: AX points to the dialog template
|
|
*
|
|
* Exit: AX pointes to the ram area that contains the corrected dialog.
|
|
*
|
|
* Side effects: Memory is allocated and used. Memory errors may be returned.
|
|
*
|
|
**********************************************************************
|
|
MoveDialogToMemory PROC EXPORT
|
|
IMPORT ListManagerRec,OrigDialogTempPtr
|
|
|
|
destptr equ pointer ;temp usage, destination
|
|
srcptr equ pointer2 ;temp usage, source dialog pointer
|
|
tmppointer equ handle ;temp usage, an extra pointer
|
|
|
|
stax srcptr ;save a copy as of source
|
|
|
|
sta >OrigDialogTempPtr ;added 15-Sep-91 DAL
|
|
txa
|
|
sta >OrigDialogTempPtr+2
|
|
*
|
|
* Move the List manager Record into ram (so it can be updated)
|
|
*
|
|
PushLong #ListManagerRec ;source(pointer)
|
|
PushZLong ListRecHandle ;destination(handle)
|
|
PushLong #40 ;move 40 bytes
|
|
_PtrToHand ;move
|
|
bcc NoError ;Oh No
|
|
*
|
|
*DEBUG. Do I need to worry about this error or can I just die?
|
|
*
|
|
rts
|
|
NoError
|
|
lda #MultiFIleMode
|
|
bit FGetPutFlag ;multi mode
|
|
beq NoMulti
|
|
ldy #ListRecord.listFlags
|
|
lda [ListRecPtr],y ;current flags
|
|
and #$FFFD ;Set list manager flag to allow
|
|
sta [ListRecPtr],y ;multiple selections to be made.
|
|
NoMulti
|
|
|
|
*
|
|
* prescan to figure the size of this header and allocate some memory to it.
|
|
*
|
|
ldy #0014+1-4 ;beginning of dialog item list (low byte + 1 byte offset)
|
|
@1
|
|
iny
|
|
iny
|
|
iny ;We're checking bytes 1 and 2 of the pointer and if they're
|
|
iny ;zero we assume this is not a valid ptr and we're at the end.
|
|
lda [srcptr],y ;if this is 0 we are at the end of the list
|
|
*
|
|
* cheat by looking at bank and page byte which should never be zero unless a template
|
|
* somewhow got into absloute zero page which should never happen!
|
|
*
|
|
bne @1 ;keep looking
|
|
*
|
|
* y = number of entries * 4. We will be moving 2 less items. We need to allocate a block
|
|
* of memory of (y-8)+14 bytes.
|
|
* Note that the new Multi entry moves one of these 2 so this
|
|
* could be wrong. I'll be safe rather than sorry and since another 28 bytes won't really make
|
|
* that much difference in the total memory used, I'll forget all this silly stuff and just use
|
|
* y+14. (Changed 2/17/89)
|
|
*
|
|
tya ;recall # * 4
|
|
* sec
|
|
* sbc #0008 ;subtract out start value. 'A' = (# items * 4) + 14 - 8
|
|
jsr GetSmallHandle ;get me some memory
|
|
PushAX
|
|
jsr DerefAndLock ;lock it down please
|
|
stax destptr ;put it on the stack for return
|
|
PushAX ;save a copy that will not change (pulled below)
|
|
*
|
|
* move the standard header.
|
|
*
|
|
lda #0014 ;move the first 14 bytes always
|
|
jsr moveit ;move rect and flags always
|
|
|
|
ldx #0000 ;move items
|
|
moveloop
|
|
inx ;count next item
|
|
txy ;cheat to check for different items to skip
|
|
*
|
|
* Move the put dialog. Walk the list till 0 is found and skip items 6 & 8.
|
|
* However, item 7 (files), move the bounding rect to the List Manager Record
|
|
* Move the get dialog. Walk the list till 0 is found and skip items 5 & 7.
|
|
* unless this is multi get then leave item 5 (this is the ACCEPT button)
|
|
* However, item 6 (files), move the bounding rect to the list manager record.
|
|
* If get, we can cheat the compare by doing an INY for GET so it checks against the same item #'s
|
|
*
|
|
lda FGetPutFlag
|
|
bmi @1 ;0 = Get, 1 = put
|
|
iny ;put is 1 higher in the id so bump Get to match
|
|
@1
|
|
bit #MultiFIleMode ;in multi mode, do item 5
|
|
bne @11
|
|
cpy #0006 ;Put: skip #6 (scroll) and #8 (Files)
|
|
bne @11
|
|
brl skipthis
|
|
@11
|
|
cpy #0008 ;files entry contains list manager rect.
|
|
beql moverect
|
|
bit #PatchedFlag ;patched?
|
|
beq @4
|
|
*
|
|
* if path item on patched is not already pointing to a draw routine, fix it!
|
|
*
|
|
cpy #0007 ;path #7?
|
|
bne @3 ;skip fix
|
|
phx
|
|
phy
|
|
PushZlong srcptr
|
|
jsr DerefHandle
|
|
stax tmppointer
|
|
ldy #0013
|
|
lda [tmppointer],y ;see if set
|
|
bne @2
|
|
dey
|
|
ldax #PathDraw
|
|
sta [tmppointer],y
|
|
txa
|
|
iny
|
|
iny
|
|
sta [tmppointer],y ;move in draw routine
|
|
|
|
lda FGetPutFlag ;set flag that says upon exit we need
|
|
ora #PathDrawPatched ;to unpatch this field in the user's template
|
|
sta FGetPutFlag
|
|
@2
|
|
ply
|
|
plx
|
|
@3
|
|
*
|
|
* Set item type of prompt string to StatText+Disable
|
|
*
|
|
cpy #0009 ;change prompt to StatText
|
|
bne @4
|
|
phx
|
|
PushZlong srcptr
|
|
jsr DerefHandle
|
|
stax tmppointer
|
|
ldy #0010
|
|
lda #StatText+ItemDisable
|
|
sta [tmppointer],y ;change item type
|
|
plx
|
|
@4
|
|
*
|
|
* Item 10 in put needs the maxlen set in the dialog template. This HAS to be done here as
|
|
* SetDItemValue cannot be used (LeNew is called at GetNewModalDialog time and SetDItemValue
|
|
* cannot be called until AFTER GetNewModalDialog and by that time it's too late!
|
|
*
|
|
bit FGetPutFlag
|
|
bpl @41
|
|
cpy #0010 ;item 10 in edit needs the length "fixed"
|
|
bne @41
|
|
phy
|
|
phx
|
|
PushZlong srcptr ;moves along with the source and points to item 10
|
|
jsr DerefHandle
|
|
stax tmppointer
|
|
ldy #0016 ;userItem location!
|
|
lda MaxLen ;max number of characters
|
|
sta [tmppointer],y ;save it!
|
|
plx
|
|
ply
|
|
@41
|
|
*
|
|
* one to include
|
|
*
|
|
lda #0004 ;now move these 4 bytes (pointer to the item)
|
|
jsr moveit ;move and update pointers (return 0 if we moved all 0's)
|
|
bnel moveloop
|
|
PullAX ;recall dest address and return
|
|
rts ;we are done
|
|
|
|
|
|
skipthis
|
|
lda #0004 ;skip 4 bytes from source!
|
|
clc
|
|
adc srcptr
|
|
sta srcptr
|
|
bcc @1
|
|
inc srcptr+2
|
|
@1
|
|
brl moveloop
|
|
|
|
moverect
|
|
*
|
|
* this item is skipped but we want the bounding rect moved to the list manager.
|
|
*
|
|
phx
|
|
lda [srcptr]
|
|
clc
|
|
adc #0002 ;1 past item number to bounding rect
|
|
sta tmppointer ;use this a s a temp
|
|
ldy #0002
|
|
lda [srcptr],y
|
|
adc #0 ;in case of carry
|
|
sta tmppointer+2 ;use this a s a temp
|
|
ldy #0006 ;move 8 bytes
|
|
@1
|
|
lda [tmppointer],y
|
|
sta [ListRecPtr],y
|
|
dey
|
|
dey
|
|
bpl @1
|
|
*
|
|
* this is also a good place to calculate the number of visible items: ((top-bottom)-2)/10
|
|
*
|
|
PushLongSpace ;2 words returned
|
|
ldy #0004 ;bottom position
|
|
lda [tmppointer],y ;bottom
|
|
sec
|
|
sbc [tmppointer] ;difference
|
|
* sec
|
|
sbc #0002
|
|
pha ;dividend
|
|
PushWord #0010 ;divisor
|
|
_SDivide
|
|
pla ;quotient
|
|
plx ;toss remainder..don't care
|
|
*
|
|
* place this results at ListManagerRecord + 10 bytes
|
|
*
|
|
ldy #0010
|
|
sta [ListRecPtr],y ;# of visible items
|
|
|
|
plx
|
|
bra skipthis ;and bump source pointer and continue
|
|
|
|
*-------------------------------------------------------------------
|
|
Moveit
|
|
*
|
|
* move count bytes from Source memory to Destination and update pointers
|
|
* This is used to "rebuild" pieces of the dialog template in memory.
|
|
* ASSUMPTIONS: Always moves an even number of bytes.
|
|
*
|
|
*Input: A = count of bytes. srcptr and destptr are zero page temps used.
|
|
*
|
|
* Output: a = inclusive or of all bytes moved (for zero test)
|
|
*
|
|
pha ;saved for add below
|
|
tay ;count in y
|
|
dey ;move from 0!
|
|
dey
|
|
stz ztemp1 ;inclusice or register
|
|
@1
|
|
lda [Srcptr],y
|
|
sta [Destptr],y
|
|
ora ztemp1
|
|
sta ztemp1 ;will be 0 if we move all 0's
|
|
dey
|
|
dey
|
|
bpl @1
|
|
lda 1,s ;recall count
|
|
clc
|
|
adc srcptr
|
|
sta srcptr
|
|
bcc @2
|
|
inc srcptr+2
|
|
@2
|
|
lda 1,s
|
|
clc
|
|
adc destptr
|
|
sta destptr
|
|
bcc @3
|
|
inc destptr+2
|
|
@3
|
|
pla ;toss away count
|
|
lda ztemp1 ;set z flag
|
|
rts
|
|
|
|
ENDP
|
|
|
|
**********************************************************************
|
|
*
|
|
* GetZeroHandle -- Gets a small hunk of memory < 64K and sets it to zero.
|
|
* Size is passed in A.
|
|
*
|
|
**********************************************************************
|
|
GetZeroHandle PROC EXPORT
|
|
|
|
pha ;save size
|
|
jsr GetSmallHandle ;handle returned in A & X
|
|
bcs @error ;skip the rest and return the error
|
|
stax handle
|
|
PushAX
|
|
jsr DerefandLock ;this doesn't use zero page handle or pointer
|
|
stax pointer
|
|
ply ;this big!!!!!!
|
|
dey
|
|
shortm
|
|
lda #0
|
|
@loop
|
|
sta [pointer],y
|
|
dey
|
|
bne @loop
|
|
sta [pointer] ;don't forget last byte (the count may have been - Dave!!!)
|
|
longm
|
|
ldax handle
|
|
@error
|
|
rts
|
|
ENDP
|
|
|
|
|
|
**********************************************************************
|
|
*
|
|
* GetSmallHandle -- Get a hunk of memory < 64K. Size passes in A.
|
|
*
|
|
**********************************************************************
|
|
GetSmallHandle PROC EXPORT
|
|
*
|
|
* getting a handle of size smaller than 64K
|
|
*
|
|
ldx #0 ;make sure x is 0
|
|
;
|
|
;fall through to GetNewHandle
|
|
;
|
|
**********************************************************************
|
|
*
|
|
* GetNewHandle-- Get a hunk of memory. Size passes in A (lo) and X (hi)
|
|
*
|
|
**********************************************************************
|
|
EXPORT GetNewHandle
|
|
GetNewHandle
|
|
PushLongSpace ; Output : Handle. (reserve space)
|
|
PushAX ; Block Size.
|
|
stax LastRequest ; save for debug, how much did I need
|
|
PushWord MyID ; Owner.
|
|
PushWord #00 ; not purgeable !
|
|
PushLongSpace ; Anywhere.
|
|
_NewHandle
|
|
bcs @error
|
|
PullAX ;handle into a and x
|
|
rts
|
|
@error
|
|
*
|
|
* DEBUG** This is a real problem. If I get a memory error trying to get a new handle.
|
|
* Suggestions?
|
|
*
|
|
ply
|
|
ply
|
|
rts ;carry (error) returned from new Handle
|
|
|
|
**********************************************************************
|
|
*
|
|
* ExtendHandle -- Check if a recently allocated handle needs to grow.
|
|
* Handle assumed to be in GLOBAL variable StringsHandle at entry
|
|
* Next size to add is in X. Will check here and expand if more room is needed.
|
|
* The logicalsize of the handle is in the GLOBAL StringsLength
|
|
* x is preserved
|
|
*
|
|
**********************************************************************
|
|
EXPORT ExtendHandle
|
|
ExtendHandle
|
|
phx ;preserve x
|
|
txa
|
|
clc
|
|
adc #$08 ;flag byte, type 2 byte, 4 aux type bytes, size byte
|
|
;(can do this since we know string length is ALWAYS < 256)
|
|
clc
|
|
adc StringsLength ;new size needed
|
|
sta StringsLength
|
|
bcc @1
|
|
inc StringsLength+2
|
|
@1
|
|
ldy #4
|
|
lda [StringsHandle],y
|
|
and #$7FFF ;drop lock bit
|
|
sta [StringsHandle],y ;unlocked
|
|
PushLongSpace ;space for results
|
|
PushZLong StringsHandle
|
|
_GetHandleSize ;so how big is it?
|
|
PullAX ;size of handle
|
|
cmpl StringsLength ;see if enough room
|
|
bge @ok ;still enough room
|
|
ldax StringsLength
|
|
clc
|
|
adc #$200 ;grow by 512 bytes
|
|
bcc @nocarry
|
|
inx
|
|
@nocarry
|
|
PushAX ;new size
|
|
stax LastRequest
|
|
PushZLong StringsHandle
|
|
_SetHandleSize
|
|
bcs Abortexit
|
|
@ok
|
|
PushZLong StringsHandle
|
|
jsr DerefAndLock ;relock handle
|
|
stax StringsPtr
|
|
plx ;save x
|
|
clc
|
|
rts
|
|
Abortexit
|
|
*
|
|
* an error occured, handle not resized. Out of memory...now WHAT??????????????
|
|
*
|
|
plx
|
|
rts ;return with error
|
|
|
|
ENDP
|
|
**********************************************************************
|
|
* Kill a handle ... handle passed in A and X
|
|
**********************************************************************
|
|
KillHandle PROC EXPORT
|
|
PushAX
|
|
_DisposeHandle
|
|
|
|
rts
|
|
ENDP
|
|
|
|
|
|
**********************************************************************
|
|
* Kill a pointer... pointer passed in A and X
|
|
**********************************************************************
|
|
KillPointer PROC EXPORT
|
|
|
|
PushLongSpace
|
|
PushAX
|
|
_FindHandle
|
|
|
|
_DisposeHandle
|
|
|
|
rts
|
|
ENDP
|
|
|
|
|
|
****************************************************************
|
|
*
|
|
* DerefandLock
|
|
* Input: Handle on stack
|
|
*
|
|
* Handle LONG
|
|
*
|
|
* Lock the handle to the list
|
|
* Value returned in A and X.
|
|
*
|
|
*
|
|
****************************************************************
|
|
DerefandLock PROC EXPORT
|
|
|
|
|
|
DefineStack
|
|
origD word ;reserve word on stack
|
|
Orts word
|
|
Handlel long ;reserve long on stack
|
|
|
|
phd
|
|
tsc
|
|
tcd ;stack is direct page now (a cheap trick, eh?)
|
|
|
|
ldy #4
|
|
lda [Handlel],y
|
|
ora #$8000 ;cheat to lock handle.Is this illegal?
|
|
sta [Handlel],y
|
|
dey
|
|
dey
|
|
lda [Handlel],y
|
|
tax
|
|
lda [Handlel]
|
|
sta Handlel+2 ;save the low word of the pointer on top of the passed handle
|
|
|
|
pld ;restor direct page
|
|
ply ;save rts address
|
|
pla ;get rid of the low word of the handle
|
|
pla ;get back the low word of the pointer and clean up the stack
|
|
phy ;push the return addr back on the stack
|
|
rts ;leave this place !
|
|
|
|
ENDP
|
|
|
|
****************************************************************
|
|
*
|
|
* DerefHandle
|
|
* Input: Handle on stack
|
|
*
|
|
* Handle LONG
|
|
*
|
|
* DeRef a handle and return in A&X
|
|
*
|
|
*
|
|
****************************************************************
|
|
DerefHandle PROC EXPORT
|
|
|
|
|
|
DefineStack
|
|
origD word ;reserve word on stack
|
|
Orts word
|
|
Handlel long ;reserve long on stack
|
|
|
|
phd
|
|
tsc
|
|
tcd ;stack is direct page now (a cheap trick, eh?)
|
|
|
|
ldy #2
|
|
lda [Handlel],y
|
|
tax
|
|
lda [Handlel]
|
|
sta Handlel+2 ;save the low word of the pointer on top of the passed handle
|
|
|
|
pld ;restor direct page
|
|
ply ;save rts address
|
|
pla ;get rid of the low word of the handle
|
|
pla ;get back the low word of the pointer and clean up the stack
|
|
phy ;push the return addr back on the stack
|
|
rts ;leave this place !
|
|
|
|
ENDP
|
|
|
|
|
|
**********************************************************************
|
|
*
|
|
* CONVERT reference and RELEASE reference routines:
|
|
*
|
|
**********************************************************************
|
|
*
|
|
* Convert reference and verb to a pointer to a PString for Prompt string
|
|
* (local use to all above entry points)
|
|
* EXIT: Pointer to PString in A & X
|
|
*
|
|
**********************************************************************
|
|
get_prompt_ptr PROC EXPORT
|
|
EXPORT get_name_ptr
|
|
EXPORT name_release
|
|
EXPORT prompt_release
|
|
|
|
clc
|
|
PushZLong PromptPtr ;save pointer
|
|
; and #$0003 ;removed (and it wasn't even in the right place!) 22-Mar-93 SS
|
|
lda PromptVerb
|
|
beq ItsAPointer ;if a pointer already, return it
|
|
dec a ;1 = handle
|
|
beq ItsAHandleOnStack
|
|
ldy #$8006 ;2 = Resource
|
|
ItsAResource
|
|
PullAX
|
|
PushLongSpace
|
|
phy ;resource type (DEBUG?)
|
|
PushAX ;ref
|
|
_LoadResource
|
|
tay ;save error
|
|
PullAX
|
|
bcc ItsAHandle ;resource error, exit
|
|
tya
|
|
bra gExit
|
|
ItsAHandle
|
|
PushAX ;back on stack!
|
|
ItsAHandleOnStack
|
|
jsr DeRefAndLock ;get a pointer to PString
|
|
gExit
|
|
rts
|
|
ItsAPointer
|
|
PullAX ;pointer to PString
|
|
rts
|
|
**********************************************************************
|
|
*
|
|
* Convert reference and verb to a pointer to a C1InputString for default name
|
|
* (local use to all above entry points)
|
|
*
|
|
**********************************************************************
|
|
get_name_ptr
|
|
PushZLong OrigName
|
|
lda OrigNameVerb
|
|
beq ItsAPointer
|
|
dec a
|
|
beq ItsAHandleOnStack
|
|
ldy #$8005 ;resource type (DEBUG)
|
|
bra ItsAResource
|
|
|
|
**********************************************************************
|
|
*
|
|
* Release if PromptPtr was a handle or a resource
|
|
*
|
|
**********************************************************************
|
|
prompt_Release
|
|
ldax PromptPtr
|
|
stax pointer ;incase it was a handle
|
|
ldy #$8006 ;ID if a resource
|
|
lda PromptVerb
|
|
; and #$0003 ;removed 22-Mar-93 SS
|
|
bra Release
|
|
|
|
**********************************************************************
|
|
*
|
|
* Release if OrigName was a handle or a resource
|
|
*
|
|
**********************************************************************
|
|
name_Release
|
|
ldax OrigName
|
|
stax pointer ;incase it was a handle
|
|
ldy #$8005 ;ID if a resource
|
|
lda OrigNameVerb
|
|
* bra Release
|
|
**********************************************************************
|
|
*
|
|
* Release common.
|
|
* ENTRY: A = verb. CC = results of loading verb.
|
|
* Y = Resource Type. (pointer) = original passed reference.
|
|
*
|
|
* EXIT: Pointer unlocked. Carry set for error.
|
|
*
|
|
**********************************************************************
|
|
Release clc ;no error
|
|
beq RExit ;pointer, forget it
|
|
dec a
|
|
beq UnlockIt ;it's a handle, unlock it
|
|
pea $0003
|
|
phy
|
|
PushZLong pointer
|
|
_ReleaseResource
|
|
rts
|
|
Unlockit
|
|
ldy #$0004
|
|
lda [pointer],y
|
|
and #$7FFF ;drop lock bit
|
|
sta [pointer],y ;unlocked
|
|
RExit
|
|
rts
|
|
|
|
|
|
ENDP
|
|
|
|
|
|
**********************************************************************
|
|
*
|
|
* reset_vars: sets to 0 all variables that MAY not be set when the
|
|
* tool is reentered. This prevents a cutsom proc routine from being
|
|
* called (for example) in a standard, no proc call.
|
|
*
|
|
**********************************************************************
|
|
reset_vars PROC EXPORT
|
|
stzl FilterProcPtr
|
|
stzl PromptPtr
|
|
stzl TypeList
|
|
stzl IconHookPtr
|
|
stzl DilgHook
|
|
stz PromptVerb
|
|
stz OrigNameVerb ;default verbs to pointers
|
|
stz FRedraw
|
|
rts
|
|
|
|
|
|
|
|
|
|
**********************************************************************
|
|
* will adjust the dialog item number up one if we are in a Put dialog.
|
|
* (most items are one off because Put has SAVE as #1.
|
|
*
|
|
* Input: Y = item number
|
|
*
|
|
* Output: Y = adjusted item number
|
|
*
|
|
**********************************************************************
|
|
PutAdjust PROC EXPORT
|
|
bit FGetPutFlag
|
|
bpl @1
|
|
iny ;put is 1 higher in the id.
|
|
@1
|
|
rts
|
|
ENDP
|
|
|
|
*****************************************************************
|
|
*
|
|
* MyDraw
|
|
*
|
|
* This routine draws the list item when asked by the list mgr
|
|
*
|
|
* Ptr to Bounding Rect
|
|
* Ptr to member's record
|
|
* Handle to list Control record
|
|
*
|
|
* Checks 'IconHookPtr' and if not nil, will use that routine to
|
|
* draw the line item rather than local code. The line item is passed
|
|
* a pointer to the the list member which is a pstring followed by
|
|
* a word of file type and a longword of Auxtype.
|
|
*
|
|
*
|
|
*****************************************************************
|
|
MyDraw PROC EXPORT
|
|
*** with IconGlobals
|
|
|
|
DefineStack
|
|
FgetPutCpy word
|
|
TempDpPtr long
|
|
oldmask block 8
|
|
atempptr long
|
|
origB byte
|
|
origD word
|
|
RtlAdr block 3
|
|
CHandle long
|
|
MemberPtr long
|
|
RectPtr long
|
|
|
|
phd ;save old direct page
|
|
phb ;save data bank
|
|
phk ;push program bank
|
|
plb ;set data bank to same as program bank
|
|
tsc ;copy stack ptr to 'A'
|
|
sec
|
|
sbc #0018 ;room for temp varible and pen mask
|
|
tcs
|
|
tcd ;set direct page (to stack)
|
|
|
|
PushLongSpace ;results
|
|
PushWord #0 ;system tool
|
|
PushWord #$0017 ;Standard File tool set
|
|
_GetWap
|
|
PullLong TempDPPtr ;local use, I need access to my Direct Page
|
|
|
|
ldy #FGetPutFlag
|
|
lda [TempDpPtr],y
|
|
sta FgetPutCpy ;get a copy, we need this alot here
|
|
|
|
pei RectPtr+2
|
|
pei RectPtr
|
|
_EraseRect ;clear the space
|
|
|
|
PushZLong MemberPtr
|
|
jsr DerefHandle
|
|
stax atempptr
|
|
PushAX ;on the stack for the possible hook routine
|
|
|
|
lda FgetPutCpy
|
|
and #InVolumeList
|
|
bne NoItemHook
|
|
|
|
ldy #IconHookPtr
|
|
lda [TempDpPtr],y
|
|
iny
|
|
iny ;y=iconHookPtr+2
|
|
ora [TempDpPtr],y ;empty pointer?
|
|
beq NoItemHook ;skip if empty
|
|
lda #(ItemReturnHook-1)>>8 ;6 bytes needed (3 "dest", 3 return)
|
|
pha
|
|
lda #ItemReturnHook-1
|
|
and #$00FF
|
|
xba
|
|
ora [TempDpPtr],y
|
|
pha
|
|
dey
|
|
dey
|
|
lda [TempDpPtr],y
|
|
dec a
|
|
pha
|
|
rtl ;go do user hook
|
|
|
|
NoItemHook
|
|
PullAX ;didn't need this!
|
|
|
|
*** This is Standard File's default member-draw routine
|
|
|
|
*
|
|
* Set up for DrawIcon call (they are really icons again!)
|
|
*
|
|
|
|
lda FgetPutCpy
|
|
and #InVolumeList
|
|
beq @notInVolumeList
|
|
|
|
lda [atempptr]
|
|
and #$00FF
|
|
inc a
|
|
tay
|
|
lda [atempptr],y
|
|
|
|
*** Now uses GetSysIcon (15-Jan-91 DAL)
|
|
pha
|
|
pha ;space for GetSysIcon result
|
|
pea 1 ;device icons
|
|
pha ;device ID
|
|
lda #0
|
|
pha
|
|
pha ;aux value (long)
|
|
_GetSysIcon
|
|
brl do_icon
|
|
|
|
@notInVolumeList lda [atempptr] ;size of string
|
|
and #$00FF ;offset
|
|
tay
|
|
iny
|
|
lda [atempptr],y ;this member's file type
|
|
|
|
pha
|
|
pha ;space for _GetSysIcon
|
|
pea 0 ;files, closed folders
|
|
pha ;filetype
|
|
|
|
;;; lda #0
|
|
;;; pha
|
|
;;; pha ;aux value (long)
|
|
*** 5-Oct-92 DAL -- pass the real auxiliary type
|
|
iny
|
|
iny
|
|
lda [atempptr],y ;low word of auxtype
|
|
tax
|
|
iny
|
|
iny
|
|
lda [atempptr],y ;high word of auxtype
|
|
pha
|
|
phx
|
|
*** end 5-Oct-92
|
|
_GetSysIcon
|
|
|
|
do_icon pea 0 ;mode for _DrawIcon
|
|
ldy #2
|
|
lda #4 ;move over space for 640 mode
|
|
jsr mDrawHalfIf320 ;12-Jan-91 DAL
|
|
clc
|
|
*** 15-Sep-91 DAL -- moved ADC up here and forced sum to be even
|
|
adc [RectPtr],y ;left position of rect
|
|
and #$fffe ;force even
|
|
*** end 15-Sep-91
|
|
|
|
*** added 26-Aug-91 DAL -- set carry if window position is odd, to make dithering right
|
|
pha
|
|
phy
|
|
pha
|
|
pha ;space for GetPort
|
|
_GetPort
|
|
phd
|
|
tsc
|
|
tcd
|
|
lda [3]
|
|
and #$0080
|
|
;;; clc ;assume CLC from the GetPort call
|
|
beq @ok
|
|
ldy #10 ;offset to boundsRect.left
|
|
lda [3],y
|
|
lsr a
|
|
@ok pld
|
|
pla
|
|
pla ;discard port pointer
|
|
ply
|
|
pla
|
|
*** end 26-Aug-91 DAL -- carry is set if 640 and window position is odd
|
|
|
|
adc #0 ;15-Sep-91 DAL
|
|
|
|
pha ;X position
|
|
lda [RectPtr]
|
|
inc a ;Y position
|
|
pha
|
|
_DrawIcon
|
|
|
|
**********************************************************************
|
|
|
|
|
|
ldy #2 ;Y=left
|
|
lda #32 ;over 6 + 26 for icon size (for 640 mode)
|
|
jsr mDrawHalfIf320 ;12-Jan-91 DAL
|
|
adc [RectPtr],y ;left position of rect
|
|
pha
|
|
pha ;one more copy 10-Jun-91 DAL
|
|
iny
|
|
iny
|
|
lda [RectPtr],y ;Y=bottom
|
|
dec a
|
|
dec a
|
|
pha ;y coord = bottom - 2
|
|
_MoveTo ;set pen to drawing location for first element
|
|
|
|
; PushZLong atempptr
|
|
; _DrawString
|
|
;*** added 10-Jun-91 DAL -- call DrawStringMaybeCrunch to draw the string
|
|
; ldy #6
|
|
; lda [RectPtr],y
|
|
; sec
|
|
; sbc 1,s
|
|
; sta 1,s
|
|
; pushzlong atempptr
|
|
; jsr DrawStringMaybeCrunch
|
|
;*** end of 10-Jun-91
|
|
*** 16-Mar-92 DAL -- use DrawStringWidth in QD Aux
|
|
plx ;horizontal pen position from above
|
|
pea $6000 ;truncate on right
|
|
pei <atempptr+2
|
|
pei <atempptr
|
|
phx
|
|
ldy #6
|
|
lda [RectPtr],y
|
|
sec
|
|
sbc 1,s
|
|
sta 1,s ;available width in pixels
|
|
ldx #$1512
|
|
jsl $e10000
|
|
; _DrawStringWidth
|
|
*** end 16-Mar-92
|
|
|
|
|
|
ItemReturnHook
|
|
*
|
|
* Return point if a hook was used to draw the items.
|
|
*
|
|
* now test and see if the item needs to be greyed out.
|
|
*
|
|
ldy #$0004 ;flags in the 5th byte
|
|
lda [MemberPtr],y
|
|
bit #MEM_DISABLE ;if disabled, no selection!
|
|
beq NotGrey ;not disabled, could be selected
|
|
and #$FF7F ;make sure NEVER selected
|
|
sta [MemberPtr],y ;not selected anymore (in case it was!)
|
|
|
|
PushZPtr oldmask
|
|
_GetPenMask ;save old mask
|
|
PushLong #GreyMask
|
|
_SetPenMask ;set mask to grey
|
|
pei RectPtr+2
|
|
pei RectPtr
|
|
_EraseRect ;grey it out
|
|
PushZPtr oldmask
|
|
_SetPenMask ;back to normal
|
|
bra NotSelected
|
|
|
|
notGrey ldy #$0004
|
|
lda [MemberPtr],y
|
|
and #MEM_SEL ;selected bit
|
|
beq NotSelected
|
|
|
|
pei RectPtr+2
|
|
pei RectPtr
|
|
_InvertRect ;if selected, invert this member
|
|
NotSelected
|
|
|
|
|
|
tsc
|
|
clc
|
|
adc #0018
|
|
tcs ;get rid of atemp and mask and other stuff
|
|
plb
|
|
pld
|
|
lda 1,s
|
|
sta 13,s
|
|
lda 2,s
|
|
sta 14,s
|
|
tsc
|
|
clc
|
|
adc #12
|
|
tcs
|
|
rtl
|
|
|
|
GreyMask dc.w $AA55,$AA55
|
|
dc.w $AA55,$AA55
|
|
|
|
*
|
|
* mDrawHalfIf320 -- 15-Jan-91 DAL
|
|
*
|
|
* Cuts A in half if we're in 320 mode
|
|
*
|
|
* Returns carry clear so we can do an addition right
|
|
* after the call to this routine.
|
|
*
|
|
mDrawHalfIf320 phy
|
|
tax
|
|
ldy #FGetPutFlag
|
|
lda [<TempDPPtr],y
|
|
and #$4000
|
|
beq @1 ;it's 640
|
|
txa
|
|
lsr a ;cut in half for 320
|
|
tax
|
|
@1 txa
|
|
clc
|
|
ply
|
|
rts
|
|
|
|
;*
|
|
;* DrawStringMaybeCrunch
|
|
;*
|
|
;* push available width
|
|
;* push pString ptr
|
|
;* JSR here
|
|
;*
|
|
;DrawStringMaybeCrunch
|
|
; phd
|
|
; tsc
|
|
; tcd
|
|
; lda [5]
|
|
; and #$00ff
|
|
; cmp #16
|
|
; bcc @drawNormal
|
|
;
|
|
; pha ;space for StringWidth
|
|
; pei 7
|
|
; pei 5
|
|
; _StringWidth
|
|
; pla
|
|
; inc a
|
|
; cmp 9
|
|
; bcc @drawNormal
|
|
;
|
|
; pha
|
|
; pha
|
|
; _GetCharExtra
|
|
; pea $ffff
|
|
; pea $0000
|
|
; _SetCharExtra ;negative one
|
|
; pei 7
|
|
; pei 5
|
|
; _DrawString
|
|
; _SetCharExtra
|
|
; pld
|
|
; plx
|
|
; pla
|
|
; pla
|
|
; pla ;stripped input parameters
|
|
; phx
|
|
; rts
|
|
;
|
|
;@drawNormal pld
|
|
; plx
|
|
; ply
|
|
; pla
|
|
; phx
|
|
; pha
|
|
; phy ;moved RTS addr above String ptr
|
|
; _DrawString
|
|
; plx
|
|
; pla ;kill Width input
|
|
; phx
|
|
; rts
|
|
|
|
ENDP
|
|
|
|
|
|
PathDraw PROC EXPORT
|
|
**********************************************************************
|
|
*
|
|
* This is the draw routine for the path string in the get and put
|
|
* dialog as called by a UserItem
|
|
*
|
|
* Note that since this is called by the window manager that the direct
|
|
* page and data bank will not be set correctly.
|
|
*
|
|
* The stack contains the dialog pointer and the item id of the object
|
|
* pressed but we don't care as this routine is only called in one place.
|
|
* they will be tossed at exit time.
|
|
*
|
|
**********************************************************************
|
|
phd ;save old direct page
|
|
phb
|
|
phk
|
|
plb ;set data bank to program bank
|
|
|
|
PushLongSpace ;results
|
|
PushWord #0 ;system tool
|
|
PushWord #$0017 ;Standard File tool set
|
|
_GetWap
|
|
pld ;set DP to old direct page for this routine
|
|
pla ;toss upper
|
|
|
|
jsr DoPathDraw
|
|
|
|
plb ;restore data bank
|
|
pld ;restore direct page
|
|
lda 2,s ;restore stack!
|
|
sta 8,s
|
|
lda 1,s
|
|
sta 7,s ;move return address
|
|
|
|
pla ;dialog ptr
|
|
pla
|
|
pla ;item id
|
|
|
|
rtl
|
|
ENDP
|
|
|
|
**********************************************************************
|
|
*
|
|
* Does the actual clear and draw of the current path. Called by the
|
|
* above custom useritem draw routine and also by close and open buttons.
|
|
*
|
|
* ASSUMPTION: (**DEBUG??**) Only the normal system font is used at
|
|
* this time. Do I need to add code later to determine font size?
|
|
*
|
|
* Assumptions: It is assumed that PrefixPtr points to the current path
|
|
* and the curDev contains the current device number. Also that Seperator
|
|
* contains the current seperation character.
|
|
*
|
|
**********************************************************************
|
|
DoPathDraw PROC EXPORT
|
|
|
|
DrawAreaWidth equ ztemp2 ;in pixels
|
|
TextLength equ ztemp1 ;in characters
|
|
|
|
*
|
|
* First determine which dialog box we are using (needs to be changed to a dialog call)
|
|
*
|
|
PushZLong DialogPtr
|
|
lda #$0006 ;item number for get
|
|
bit FGetPutFlag
|
|
bpl @1 ;correct guess
|
|
inc a
|
|
@1
|
|
pha
|
|
PushZPtr tempRect
|
|
_GetDItemBox
|
|
|
|
lda tempRect ;top position
|
|
clc
|
|
adc #03 ;move down by 3
|
|
sta tempRect
|
|
|
|
clc
|
|
lda tempRect+2 ;h position
|
|
adc wherex ;dialog position
|
|
lsr a ;bottom bit should be set...
|
|
*** bcs @2 ;...for proper color
|
|
bcc @2 ;15-Mar-91 DAL (previous test seems reversed?)
|
|
inc tempRect+2 ;force it even!
|
|
@2
|
|
|
|
PushZPtr tempRect
|
|
_EraseRect ;erase old information
|
|
|
|
lda FGetPutFlag
|
|
bit #InVolumeList ;Check if we're in volume list.
|
|
bne @checkWhichDLog ;If we are then display different
|
|
brl notInVolList
|
|
@checkWhichDLog bpl getDialog
|
|
|
|
lda selectedptr+1
|
|
bne @SomethingSelected
|
|
|
|
PushZLong DialogPtr
|
|
PushWord #11
|
|
_HideDItem
|
|
@SomethingSelected
|
|
lda #255
|
|
sta saveButStat
|
|
|
|
PushWord #255
|
|
pha
|
|
pha
|
|
PushZLong DialogPtr
|
|
PushWord #1 ;Deactivate SAVE button.
|
|
_GetControlDItem ;It is no longer valid when we're
|
|
_HiliteControl ;displaying the list of volume names.
|
|
|
|
PushWord #255
|
|
pha
|
|
pha
|
|
PushZLong DialogPtr
|
|
PushWord #12 ;Deactivate NEWFOLDER button.
|
|
_GetControlDItem ;It's is no longer valid when we're
|
|
_HiliteControl ;displaying the list of volume names.
|
|
bra DoSomeMore
|
|
|
|
getDialog PushZLong DialogPtr ;If in get dialog hide the prompt string.
|
|
PushWord #8
|
|
_HideDItem
|
|
|
|
DoSomeMore PushWord #255
|
|
pha
|
|
pha
|
|
PushZLong DialogPtr
|
|
ldy #3
|
|
jsr PutAdjust
|
|
phy
|
|
_GetControlDItem
|
|
_HiliteControl
|
|
|
|
lda tempRect+2 ;path string.
|
|
pha ;x coordindate
|
|
lda tempRect
|
|
clc
|
|
adc #8
|
|
pha ;y coordindate
|
|
_MoveTo
|
|
|
|
PushLong #VolumeString ;display string 'Volumes on-line:'
|
|
_DrawString
|
|
|
|
rts
|
|
|
|
notInVolList lda curDev
|
|
bne KeepOnTruckin
|
|
rts
|
|
*
|
|
* need to determine which icon to draw here. Either folder, disk, or appletalk or ...
|
|
*
|
|
KeepOnTruckin PushWord #0
|
|
pha
|
|
pha
|
|
PushZLong DialogPtr
|
|
ldy #3
|
|
jsr PutAdjust
|
|
phy
|
|
_GetControlDItem
|
|
_HiliteControl
|
|
|
|
bit FGetPutFlag
|
|
bmi @notGet
|
|
|
|
PushZLong DialogPtr If in get dialog hide the prompt string.
|
|
PushWord #8
|
|
_ShowDItem
|
|
bra @PassPutStuff
|
|
@notGet
|
|
PushZLong DialogPtr
|
|
PushWord #11
|
|
_ShowDItem
|
|
@PassPutStuff
|
|
|
|
*** added 18-Dec-91 DAL -- set clip region to path item, leaving old region on stack
|
|
PushZLong DialogPtr
|
|
lda #$0006 ;item number for get
|
|
bit FGetPutFlag
|
|
bpl @1b ;correct guess
|
|
inc a
|
|
@1b pha
|
|
pushlong #myClipRect
|
|
_GetDItemBox
|
|
|
|
pha
|
|
pha
|
|
_NewRgn
|
|
lda 3,s
|
|
pha
|
|
lda 3,s
|
|
pha ;clone region handle (leave one copy on stack)
|
|
_GetClip
|
|
pushlong #myClipRect
|
|
_ClipRect
|
|
*** end 18-Dec-91
|
|
|
|
jsr DrawPopUpThing ;14-Jan-91 DAL
|
|
|
|
*** Padlock-drawing code used to be here
|
|
|
|
lda tempRect+2
|
|
pha
|
|
lda tempRect ;top of rect
|
|
clc
|
|
adc #08 ;**DEBUG**Assumes system font always
|
|
pha
|
|
_MoveTo ;position pen
|
|
|
|
ldy #2
|
|
lda [PrefixPtr],y ;get length of original path
|
|
tax ;counter
|
|
iny
|
|
iny
|
|
shortm
|
|
lda Seperator ;seperation character
|
|
@whichloop
|
|
iny
|
|
dex
|
|
cmp [PrefixPtr],y
|
|
bne @whichloop ;look for next sep character
|
|
*
|
|
* Found next seperation character. Is it as the end of the string?
|
|
*
|
|
longm
|
|
dex ;will be 0 if only volume name
|
|
bne DoAFolder
|
|
|
|
DoADevice jsr DoDInfoCall
|
|
pha
|
|
pha ;space for GetSysIcon result
|
|
pea 1 ;device icons
|
|
lda devDeviceID_DInfo
|
|
pha
|
|
lda #0
|
|
pha
|
|
pha ;aux value (long)
|
|
_GetSysIcon
|
|
ldx #0 ;flag: don't increment Y position
|
|
bra do_icon
|
|
|
|
DoAFolder pha
|
|
pha ;space for _GetSysIcon result
|
|
pea $0004 ;file icons (open folder)
|
|
pea $000f ;folder
|
|
lda #0
|
|
pha
|
|
pha ;aux value (long)
|
|
_GetSysIcon ;fall into do_icon
|
|
ldx #1 ;flag to increment Y position
|
|
*
|
|
* do_icon--icon already on stack
|
|
*
|
|
do_icon pea 0 ;mode for _DrawIcon
|
|
lda #4
|
|
jsr HalfIf320
|
|
adc <tempRect+2
|
|
pha ;X position
|
|
clc
|
|
txa
|
|
adc <tempRect
|
|
pha ;Y position
|
|
_DrawIcon
|
|
*** End of Device/Folder icon stuff
|
|
|
|
lda #30 ;move over 30 pixels in 640 mode
|
|
jsr HalfIf320 ;12-Jan-91 DAL
|
|
adc <tempRect+2 ;left edge of rect
|
|
sta <tempRect+2
|
|
|
|
pha ;x position
|
|
lda <tempRect ;top of rect
|
|
clc
|
|
adc #8 ;**DEBUG**Assumes system font always
|
|
pha ;y position
|
|
_MoveTo ;position pen
|
|
|
|
*
|
|
* get size in pixels of the drawing rect.
|
|
*
|
|
sec
|
|
lda tempRect+6 ;right edge
|
|
sbc tempRect+2 ;right edge - left edge
|
|
*** 14-Jan-91 DAL -- leave room for the padlock on the right
|
|
ldx writeProtect
|
|
beq @noWrProt
|
|
sbc #16
|
|
@noWrProt
|
|
*** end of 14-Jan-91 DAL
|
|
sta DrawAreaWidth ;save size to work in ( %%% Dead now??? )
|
|
|
|
*** New pathSeg drawing stuff (15-Jan-91 DAL)
|
|
ldy #2
|
|
lda [<PrefixPtr],y ;get length of original path
|
|
tay
|
|
iny
|
|
iny
|
|
ldx #0
|
|
|
|
sep #$20
|
|
longa off
|
|
|
|
lda Seperator ;seperation character
|
|
@findSegLoop inx
|
|
dey
|
|
beq @noSegment
|
|
cmp [<PrefixPtr],y
|
|
bne @findSegLoop ;look for next sep character
|
|
iny
|
|
longa on
|
|
rep #$20
|
|
|
|
*** Set up for DrawText (Y=index to first character to print, X = length)
|
|
clc
|
|
tya
|
|
adc <PrefixPtr
|
|
tay
|
|
lda <PrefixPtr+2
|
|
adc #0
|
|
pha
|
|
phy
|
|
phx
|
|
_DrawText
|
|
|
|
@noSegment rep #$20
|
|
*** end of new pathSeg drawing stuff
|
|
|
|
jsr DrawThePadlock ;added 14-Jan-91 DAL
|
|
|
|
jsr DrawTheFileSystem ;added 25-Mar-91 DAL
|
|
|
|
*** added 18-Dec-91 DAL -- store the right edge of the path item
|
|
*** [moved below DrawTheFileSystem 6-Feb-92 DAL]
|
|
pha
|
|
pha ;Pen Loc result buffer
|
|
tsc
|
|
pea 0
|
|
inc a
|
|
pha
|
|
_GetPen
|
|
pla ;y coord
|
|
pla ;x coord
|
|
sta PathItemRightEdge
|
|
*** end 18-Dec-91
|
|
|
|
*** added 18-Dec-91 DAL -- restore the clip region
|
|
lda 3,s
|
|
pha
|
|
lda 3,s
|
|
pha ;clone my region handle
|
|
_SetClip
|
|
_DisposeRgn
|
|
*** end 18-Dec-91
|
|
rts
|
|
|
|
;VolumeString str 'Volumes on-line:'
|
|
VolumeString str 'Available disks:' ;25-Mar-92 DAL
|
|
|
|
export PathItemRightEdge
|
|
PathItemRightEdge dc.w 0 ;rightmost position to pop up when they click (18-Dec-91 DAL)
|
|
myClipRect ds.b 8 ;temp rectangle for path item (18-Dec-91 DAL)
|
|
|
|
*
|
|
* DrawPopUpThing -- draw a framed down-arrow to the left of the path item
|
|
*
|
|
* Location = tempRect (bumps tempRect over, too)
|
|
*
|
|
DrawPopUpThing lda #4 ;move over this far in 640 mode
|
|
jsr HalfIf320
|
|
adc <tempRect+2
|
|
sta <tempRect+2
|
|
|
|
pha
|
|
pha ;space for icon
|
|
pea 2 ;Misc Icons
|
|
pea 4 ;framed down arrow
|
|
lda #0
|
|
pha
|
|
pha ;aux value (ignored)
|
|
_GetSysIcon ;leave icon pointer on stack for DrawIcon
|
|
|
|
pea 0 ;DrawIcon mode
|
|
pei <tempRect+2 ;X position
|
|
pei <tempRect ;Y position
|
|
_DrawIcon
|
|
|
|
lda #24 ;move over this far in 640 mode
|
|
jsr HalfIf320
|
|
adc tempRect+2
|
|
sta tempRect+2
|
|
|
|
rts
|
|
|
|
*
|
|
* Do the Padlock thing
|
|
*
|
|
DrawThePadlock lda writeProtect ;see if a write protected disk
|
|
beq @noPadlock
|
|
|
|
pea 0
|
|
tdc
|
|
clc
|
|
adc #tempRect
|
|
pha
|
|
_GetPen
|
|
|
|
lda tempRect+0 ;top
|
|
sec
|
|
sbc #8
|
|
sta tempRect+0
|
|
|
|
pha
|
|
pha ;space for GetSysIcon result
|
|
pea 2 ;misc icons
|
|
pea 1 ;misc icon #1 = padlock
|
|
lda #0
|
|
pha
|
|
pha ;aux value (long)
|
|
_GetSysIcon
|
|
pea 0
|
|
lda #4 ;move over 4 in 640 mode
|
|
jsr HalfIf320
|
|
adc <tempRect+2
|
|
pha ;X
|
|
lda <tempRect
|
|
inc a
|
|
pha ;Y
|
|
_DrawIcon
|
|
|
|
lda #18 ;move over this far in 640 mode (was 12 6-Feb-92 DAL)
|
|
jsr HalfIf320 ;12-Jan-91 DAL
|
|
*** added 6-Feb-92 DAL -- Also adjust the pen position!
|
|
pha ;preserve delta
|
|
pha ;delta X for Move
|
|
pea 0 ;delta Y for Move
|
|
_Move
|
|
pla ;restore delta
|
|
*** end 6-Feb-92
|
|
adc tempRect+2 ;left edge of rect
|
|
sta tempRect+2
|
|
|
|
@noPadlock rts
|
|
|
|
|
|
**********************************************************************
|
|
*
|
|
* DrawTheFileSystem -- 25-Mar-91 DAL
|
|
*
|
|
**********************************************************************
|
|
DrawTheFileSystem jsr GetTheFSTName
|
|
bcs @notFound
|
|
|
|
pea $0020
|
|
_DrawChar
|
|
pea $0028 ;'('
|
|
_DrawChar
|
|
|
|
pushlong #fstNameBuffer+4
|
|
lda fstNameBuffer+2
|
|
and #$00ff
|
|
pha
|
|
_DrawText
|
|
|
|
pea $0029 ;')'
|
|
_DrawChar
|
|
|
|
@notFound rts
|
|
|
|
ParBlock_FSTInfo dc.w 5 ;pCount=5
|
|
fstnum_FSTInfo dc.w 0
|
|
fstID_FSTInfo dc.w 0
|
|
fstName_FSTInfo dc.l fstNameBuffer
|
|
fstVersion_FSTInfo dc.w 0
|
|
fstAttr_FSTInfo dc.w 0
|
|
|
|
export fstNameBuffer
|
|
fstNameBuffer dc.w 32
|
|
ds.b 34
|
|
|
|
export GetTheFSTName
|
|
GetTheFSTName stz fstnum_FSTInfo
|
|
@search inc fstnum_FSTInfo
|
|
pushlong #ParBlock_FSTInfo
|
|
pea $202b ;GetFSTInfo
|
|
jsl $e100b0
|
|
bcs @notFound
|
|
lda fstID_FSTInfo
|
|
cmp <FileSysID
|
|
bne @search
|
|
clc
|
|
@notFound rts
|
|
|
|
ENDP
|
|
|
|
**********************************************************************
|
|
*
|
|
* HalfIf320 -- 12-Jan-91 DAL
|
|
*
|
|
* Cuts A in half if we're in 320 mode
|
|
*
|
|
* Returns carry clear so we can do an addition right
|
|
* after the call to this routine.
|
|
*
|
|
**********************************************************************
|
|
HalfIf320 proc export
|
|
bit <FGetPutFlag
|
|
bvc @1 ;it's 640
|
|
lsr a ;cut in half for 320
|
|
@1 clc
|
|
rts
|
|
|
|
EndP
|
|
|
|
**********************************************************************
|
|
*
|
|
* PollForInsertions
|
|
*
|
|
* Check for a disk insertion and return device number in A if
|
|
* something was inserted.
|
|
*
|
|
* The DO_INSERT_SCAN service scans *all* the devices and then tells
|
|
* us about the first insertion it detected. This is good for two
|
|
* things:
|
|
*
|
|
* 1. We can call PollForInsertion *once* to ignore all pending inserts.
|
|
* 2. When a CD with multiple partitions is inserted, we only find out
|
|
* about it once.
|
|
*
|
|
**********************************************************************
|
|
|
|
PollForInsertions proc export
|
|
|
|
pha
|
|
_ScanDevices
|
|
pla
|
|
rts
|
|
|
|
EndP
|
|
|
|
**********************************************************************
|
|
*
|
|
* JudgeTheName
|
|
*
|
|
* Make sure the filename is valid for this file system. If it's not,
|
|
* put up a big alert explaining what's wrong.
|
|
*
|
|
* Return values: CLC = name was okay
|
|
* SEC = name was bad, edit line text may or may
|
|
* not have been replaced
|
|
*
|
|
* Inputs:
|
|
* Text in the edit line item (dialog item 10).
|
|
* <FileSysID on direct page
|
|
* A = 3 for file, 2 for folder
|
|
*
|
|
**********************************************************************
|
|
JudgeTheName proc
|
|
import fstNameBuffer
|
|
import GetTheFSTName
|
|
|
|
sta jnNameType
|
|
|
|
lda <FileSysID
|
|
sta jnFileSys
|
|
|
|
jsr GetTheFSTName
|
|
|
|
;; pha
|
|
;; pha
|
|
;; _FrontWindow
|
|
*** added 18-Dec-91 DAL -- don't use FrontWindow; Bryan P has hidden the window already!
|
|
pushzlong <dialogPtr
|
|
*** end 18-Dec-91
|
|
pea 10 ;dialog item number for edit line
|
|
pushlong #fileName1+1
|
|
_GetIText
|
|
lda fileName1+1
|
|
and #$00ff
|
|
sta fileName1 ;made it into a GS/OS string
|
|
|
|
pushlong #fileName1
|
|
pushlong #fileName2+2
|
|
pushlong #41
|
|
_BlockMove
|
|
|
|
pushlong #JudgeNameParms
|
|
pea $2007
|
|
jsl $e100b0
|
|
; _JudgeName
|
|
bcc @noExit
|
|
brl @exit
|
|
@noExit
|
|
|
|
lda jnNameFlags
|
|
clc
|
|
;;; beq @nameOK
|
|
bne @nameNotOK
|
|
brl @nameOK
|
|
@nameNotOK
|
|
|
|
lda jnSyntaxString+2
|
|
sta theFSTHelpStr+2
|
|
lda jnSyntaxString
|
|
sta theFSTHelpStr
|
|
|
|
lda fileName2+2
|
|
xba
|
|
sta fileName2+2 ;make fileName2+3 a Pascal string
|
|
|
|
lda fileName1
|
|
xba
|
|
sta fileName1 ;make fileName1+1 a Pascal string
|
|
|
|
lda fstNameBuffer+2
|
|
xba
|
|
sta fstNameBuffer+2 ;make fstNameBuffer+3 a Pascal string
|
|
|
|
pea $4009 ;bad input value, default to bonk
|
|
_SysBeep2
|
|
|
|
_InitCursor ;added 3-Sep-91 DAL
|
|
|
|
pha ;space for result
|
|
pea 5 ;by resource, Pascal substitution strings
|
|
pushlong #JudgeSubstitutions
|
|
pushlong #$07ff1701 ;JudgeName alert window ID
|
|
_AlertWindow
|
|
pla
|
|
bcs @exit
|
|
sec
|
|
beq @exit ;they clicked "No Change"--exit with SEC
|
|
|
|
;; pha
|
|
;; pha
|
|
;; _FrontWindow
|
|
*** 18-Dec-91 DAL
|
|
pushzlong <dialogPtr
|
|
***
|
|
pea 10
|
|
pushlong #fileName2+3
|
|
_SetIText
|
|
|
|
pha
|
|
pha
|
|
_FrontWindow
|
|
pea 10
|
|
pea 0
|
|
pea $ff
|
|
_SelectIText
|
|
|
|
sec ;return SEC since their first name was no good
|
|
@nameOK
|
|
@exit rts
|
|
|
|
JudgeNameParms dc.w 6 ;6 parameters
|
|
jnFileSys dc.w 0 ;file system
|
|
jnNameType dc.w 0 ;name type (1=volume, 2=file, 3=folder, 0=unknown)
|
|
jnSyntaxString dc.l 0 ;(result) pointer to syntax string
|
|
jnMaxLength dc.w 0 ;(result)
|
|
jnNameBuffer dc.l fileName2 ;input/output
|
|
jnNameFlags dc.w 0 ;(result)
|
|
|
|
JudgeSubstitutions dc.l fileName1+1 ; *0 = their trial name
|
|
dc.l fstNameBuffer+3 ; *1 = file system name
|
|
dc.l fileName2+3 ; *2 = fixed-up valid name
|
|
theFSTHelpStr dc.l 0 ; *3 = FST-syntax-help message
|
|
dc.l noChangeName ; *4 = "No Change"
|
|
|
|
fileName1 ds.b 41
|
|
fileName2 dc.w 40 ;result buffer
|
|
ds.b 42
|
|
|
|
noChangeName dc.b 9,'No Change'
|
|
|
|
EndP
|
|
|
|
END
|