comparison 3rdparty/packages/multivue/cmds_6809/gshell.asm @ 422:5d138adbc9fe

Adding gshell to Multi-Vue
author boisy
date Sun, 22 Sep 2002 15:06:38 +0000
parents
children 910b1bd03739
comparison
equal deleted inserted replaced
421:2cf4b593cebf 422:5d138adbc9fe
1 * Signal handlers will have to handle new RBF call for directory updates
2 * DIR has to be open (uses path #), but can be in READ+DIR mode
3 * Renames, etc. will have to close DIR 1st, do function, re-open.
4
5 nam GShell Graphics Shell
6 ttl Source derived by Kent D. Meyers.
7
8 * Compressed Version. Started February 7, 1988. Completed February 29.
9 * Upgraded Version. Started March 2, 1988. Finished by KDM Feb 13, 1994
10 * NITROS9 ONLY VERSION. Started August 8,1998 by LCB
11 * NOTE: When GSHPAL added, got rid of DEVICSET, and 2 other SETS from env.file
12 * check in DP (3 DP bytes back)
13 * NOTE: HAVE TRIED 5 ROWS OF ICONS (ICONYMAX=143, ICONROWH=32, ICONSCR=20), &
14 * IT FITS, BUT LOOKS REALLY CROWDED
15 * Killed all calls to F.SLEEP, embedded (shorter & faster)
16 * Should do F$CpyMem of <$40-43 in direct page to get real RAM size - both
17 * 6809 and NitrOS9. Then we can eliminate RAM= from the Env.fil entirely!
18
19 * NOTE (6309 ONLY): ALL STD -2,S TO CHECK THE D FLAG CAN BE CHANGED TO TSTD
20 *(SAME SIZE, FASTER)
21
22 BTEXT mod MODSIZE,MODNAME,$11,$81,CSTART,DATASIZE
23
24 * COMPLETE DEFS FOR THIS ASSEMBLY.
25
26 ICNONSCR equ 16 # icons on screen in 40 column mode
27
28 * System call defs
29 F$FORK equ $03
30 F$WAIT equ $04
31 F$CHAIN equ $05
32 F$EXIT equ $06
33 F$MEM equ $07
34 F$SEND equ $08
35 F$ICPT equ $09
36 F$SLEEP equ $0A
37 F$ID equ $0C
38 F$GPRDSC equ $18
39 F$UNLOAD equ $1D
40 F$NMLINK equ $21
41 F$NMLOAD equ $22
42 I$DUP equ $82
43 I$OPEN equ $84
44 I$MAKDIR equ $85
45 I$CHGDIR equ $86
46 I$DELETE equ $87
47 I$READ equ $89
48 I$WRITE equ $8A
49 I$READLN equ $8B
50 I$WRITLN equ $8C
51 I$GETSTT equ $8D
52 I$SETSTT equ $8E
53 I$CLOSE equ $8F
54
55 * Standard character defs
56 NUL equ $00
57 BEL equ $07
58 HT equ $09
59 LF equ $0A
60 FF equ $0C
61 CR equ $0D
62 SPACE equ $20
63
64 * Standard RBF access mode defs
65 READ. equ $0001
66 UPDAT. equ $0003
67 EXEC. equ $0004
68 PREAD. equ $0008
69 PEXEC. equ $0020
70 DIR. equ $0080
71
72 * Standard condition code register defs
73 CARRY equ $0001
74 NCARRY equ $00FE
75
76 * Error message defs
77 E$MEMFUL equ $00CF
78 E$EOF equ $00D3
79 E$PNNF equ $00D8
80
81 * GShell specific Data Structures.
82
83 org 0
84 * File info - linked list for each icon
85 FL.XSTRT rmb 2 X start position of icon \ These are for determining if
86 FL.YSTRT rmb 2 Y start position of icon \ mouse clicks are on a particular
87 FL.XEND rmb 2 X end position of icon / icon or not.
88 FL.YEND rmb 2 Y end position of icon /
89 FL.ICONO rmb 1 Icon type (IC.*)
90 FL.AIFNO rmb 1 AIF # (entry # to look in ID.* table)
91 FL.LINK rmb 2 Link to next FL.* entry
92 FL.FNAME rmb 2 Ptr to filename
93 FL.SIZE equ .
94
95 org 0
96 * Structure for table entries for executable programs to fork into new
97 * windows - called process tables here (see PTBL* vars)
98 GD.MNAME rmb 2 Module name ptr?
99 GD.INDVC rmb 2 ??? Ptr to ?
100 GD.PRCID rmb 2 Process ID # for new process
101 GD.STATS rmb 2 Last status of forked program (errors, etc.)
102 GD.MTYPE rmb 1 Module type
103 GD.MLANG rmb 1 Module language
104 GD.MEMSZ rmb 2 Mem size required
105 GD.WPATH rmb 2 Path to window
106 GD.DW.OW rmb 2 Process running in overlay window flag: 1=Yes, else NO
107 GD.XSTRT rmb 2 Start X,Y coords of window
108 GD.YSTRT rmb 2
109 GD.XEND rmb 2 End X,Y coords of window
110 GD.YEND rmb 2
111 GD.SCRNO rmb 2 Screen #
112 GD.LINK rmb 2 Link to next GD.* entry
113 GD.SIZE equ .
114
115 * Defs for table entries of AIF data
116 * NOTE: all ID.NUMBR's below IC.XTRNL ($14) are for internal AIF structures,
117 * not from actual read in AIF files ($f-$13 are currently unused?)
118 org 0
119 ID.NUMBR rmb 2 Entry # in ID.* structure (only 2nd byte is used)
120 ID.WTYPE rmb 2 Window type for AIF program
121 ID.XSIZE rmb 2 Minimum window X size for AIF program
122 ID.YSIZE rmb 2 Minimum window Y size for AIF program
123 ID.FRGND rmb 2 Window foreground color for AIF program
124 ID.BKGND rmb 2 Window background color for AIF program
125 ID.MEMSZ rmb 2 Data area size for AIF program
126 ID.MNAME rmb 2 Ptr to module name for AIF program
127 ID.XXXPT rmb 2 ??? Ptr to AIF 3 letter extension?
128 ID.PARAM rmb 2 Ptr to parameters for AIF program
129 ID.LINK rmb 2 Ptr to next ID.* structure in linked list
130 ID.SIZE equ .
131
132 * Structure for screens used table (maximum of 8)
133 org 0
134 SC.PTHNO rmb 1 Path number to screen
135 SC.WTYPE rmb 1 Full screen background window type
136 SC.USERS rmb 1 # of users (programs) active on screen
137 rmb 1 ??? reserved space?
138 SC.SIZE equ .
139
140 * Icon descriptor identifiers (reserved ones). For programs, they will have
141 * there own entry for running in a new window (?)
142 * These are stored in Fl.ICONO
143 * NOTE: WE SHOULD ADD A PRINTER ICON, AND HAVE IT CALL THE FILE/PRINT ROUTINE
144 * ALSO, A NEW VERSION OF COCOPR SHOULD BE WRITTEN TO HANDLE GRAPHIC SCREEN
145 * DUMPS OF VEF'S. IT SHOULD ALSO ALLOW -F (FORMFEED AFTER TRAILER) AS AN
146 * OPTION FROM THE ENV.FILE
147 IC.TEXT equ $0001 Text file identifier
148 IC.FOLDR equ $0002 Folder (directory) identifier
149 IC.PRGRM equ $0003 Program (executable) identifier
150 IC.CLOSE equ $0004 Close box
151 IC.DRIVE equ $0005 Drive icon
152 IC.AIF.F equ $0006 ??? AIF for a single program
153 IC.F.XXX equ $0007 ??? AIF for an extension already allocated
154 IC.DRBAR equ $0008 Drive bar (top of current dir window)
155 IC.TRASH equ $0009 Trash can (delete from file menu)
156 IC.GCALC equ $000A Calculator off of Tandy menu
157 IC.GCLOK equ $000B Clock off of Tandy menu
158 IC.GCAL equ $000C Calendar off of Tandy menu
159 IC.SHELL equ $000D Shell off of Tandy menu
160 IC.QUERY equ $000E '?' Help off of Tandy menu
161 IC.PRNTR equ $000F Printer (print from file menu)
162 * Looks like we have room to insert 5 entries here... like PRINTER
163 IC.XTRNL equ $0014 Start of external entries (from AIF files)
164
165 * Menu ID #'s
166 MID.CLS equ $0002
167 MID.SUP equ $0004
168 MID.SDN equ $0005
169 MID.SRT equ $0006
170 MID.SLT equ $0007
171 MID.TDY equ $0014
172 MID.FIL equ $0017
173 MID.VEW equ $0018
174 MID.DSK equ $0019
175 MID.KDM equ $001A
176
177 * Mouse packet variables (see manual)
178 PT.VALID equ $0000
179 PT.CBSA equ $0008
180 PT.CBSB equ $0009
181 PT.STAT equ $0016
182 PT.ACX equ $0018
183 PT.ACY equ $001A
184 PT.WRX equ $001C
185 PT.WRY equ $001E
186
187 *Get/Setstat calls
188 SS.READY equ $0001
189 SS.SSIG equ $001A
190 SS.RELEA equ $001B
191 SS.FDINF equ $0020
192 SS.SCSIZ equ $0026
193 SS.FSIG equ $002C Signal on dir change Setstat
194 SS.WNSET equ $0086
195 SS.MNSEL equ $0087
196 SS.SBAR equ $0088
197 SS.MOUSE equ $0089
198 SS.MSSIG equ $008A
199 SS.SCTYP equ $0093
200 SS.UMBAR equ $0095
201
202 STDOUT equ $0001
203 STDERR equ $0002
204
205 OBJCT equ $0001
206 ICODE equ $0002
207 PCODE equ $0003
208 CBLCODE equ $0005
209
210 WT.FSWIN equ $0002
211 WT.DBOX equ $0004
212 WN.NMNS equ $0014
213 WN.SYNC equ $0017
214 WN.BAR equ $0020
215 WINSYNC equ $C0C0
216
217 S$WAKE equ $0001
218 S$ABORT equ $0002
219 S$INTRPT equ $0003
220 DIR.FD equ $001D
221 DIR.SZ equ $0020
222
223 PTR.ARR equ $0001
224 FNT.S8X8 equ $0001
225 FNT.S6X8 equ $0002
226 FNT.G8X8 equ $0003
227 PTR.SLP equ $0004
228 PTR.ILL equ $0005
229 MOUSIGNL equ $000A
230 KYBDSGNL equ $000B
231 DIRSIG equ $000C New signal for SS.FSig
232 MI.SIZ equ $0015
233 MI.ENBL equ $000F
234 MN.ENBL equ $0012
235 MN.SIZ equ $0017
236 WN.SIZ equ $0022
237 GRP.FNT equ $00C8
238 GRP.PTR equ $00CA
239
240 * OS-9 DATA AREA DEFINITIONS
241
242 org 0
243 WIPED rmb 1 Icons wiped flag (0=no need to redraw)
244 DEFWTYPE rmb 2 GShell's current window type (default for GCalc, GClock, etc.)
245 ICONCOLW rmb 2 Width of icon column. (in pixels)
246 STRTYPOS rmb 2 Starting Y position for the first icon on screen.
247 ICONYMAX rmb 2 Maximum Y value for displayed icons.
248 ICONROWH rmb 2 Height of icon row. (in pixels)
249 WINDWSZY rmb 2 Y size of GShell window path.
250 PTBLNEXT rmb 2 Pointer to next available process descriptor link.
251 FNAMEPTR rmb 2 Pointer to file name buffer. (null terminated)
252 IDSCSPTR rmb 2 Pointer to start of icon descriptor table.
253 IDSCNEXT rmb 2 Pointer to next available icon descriptor link
254 DEVICNTR rmb 1 Current device count. (maximum 5)
255 DRIVYPOS rmb 1 Starting Y position for first drive icon.
256
257 * The preceding are loaded at startup with default values.
258
259 STRTXPOS rmb 2 Starting X position for the first icon on screen.
260 PIXELSWD rmb 2 Width of GShell window in pixels.
261 FLAG640W rmb 1 640 pixels wide flag
262 RECDSGNL rmb 2 Current received signal from intercept routine.
263 MAXICONS rmb 2 Maximum number of icons per screen. (12/24)
264 RAMSIZE rmb 2 Computer's memory size. (128/512)
265 WNDWPATH rmb 2 GShell window I/O path number.
266 WINDWSZX rmb 2 X size of GShell window path.
267 PRCIDNUM rmb 2 GShell process ID number. (for GPLOAD)
268 SCREENOW rmb 2 Number of current display icon screen. (0 to n-1)
269 NSCREENS rmb 2 Number of available icon screens.
270 STRTICON rmb 2 Pointer to file icon descriptor for first icon on current screen.
271 FILESCTR rmb 2 Number of files in current data directory.
272 FTBLSPTR rmb 2 Pointer to start of file icon descriptor table.
273 FTBLNEXT rmb 2 Pointer to next available link in file icon descriptor table.
274 SELECTED rmb 2 Pointer to file icon descriptor for currently selected icon.
275 DEVICNOW rmb 2 Pointer to file icon descriptor for currently selected drive.
276 PTBLSPTR rmb 2 Pointer to start of process descriptor table.
277 DIRPTR rmb 2 Pointer to next directory entry in directory read buffer.
278 XFD.ATT rmb 1 Buffer for FD.ATT (attributes) of current directory entry.
279 NEXTXPOS rmb 2 Next X position for file icon on this screen.
280 NEXTYPOS rmb 4 Next Y position for file icon on this screen.
281 ACTVSCRN rmb 2 Number of the active process screen. (for window setup)
282 PROCXSIZ rmb 2 Minimum X size for this process.
283 PROCYSIZ rmb 2 Minimum Y size for this process.
284 PROCWTYP rmb 2 Default window type for this process.
285 WPOSGOOD rmb 2 Window OK flag. (for window setup)
286 DWSETSTY rmb 2 Actual STY byte for process window. (for window setup)
287
288 * Additions to handle GSHPALx=r,g,b commands (removed *SET ones)
289 CURPAL rmb 1 Current GSHPAL palette # being worked on
290 CURCOLOR rmb 1 Current palette value
291 CURGFXSZ rmb 1 Size of GFXBUF to write for GSHPAL values
292 GIPMSRES rmb 1 0=low res, 1=high res, $ff=not set (default=0)
293 GIPMSPRT rmb 1 1=right, 2=left, $ff=not set (default=1)
294 GIPKYST rmb 1 keyboard repeat start ($ff=not set)
295 GIPKYSPD rmb 1 keyboard repeat speed ($ff=not set)
296 DRTBLPTR rmb 2 Pointer to start of drive table.
297 SUREYPOS rmb 2 Y position for "Sure" box.
298 SUREXPOS rmb 1 X position for "Sure" box.
299 BXOFFSET rmb 2 X size for selection box.
300 WD48FLAG rmb 1 $80 if on type 7 windown.
301 TNDYITMS rmb MI.SIZ*8 Tandy Menu items array.
302
303 DISKITMS rmb 0 Disk Menu items array.
304 ITM.FREE rmb MI.SIZ Free
305 ITM.FLDR rmb MI.SIZ Folder
306 ITM.FMAT rmb MI.SIZ*4 Format
307
308 FILSITMS rmb 0 Files menu items array.
309 ITM.OPEN rmb MI.SIZ Open
310 ITM.LIST rmb MI.SIZ List
311 ITM.COPY rmb MI.SIZ Copy
312 ITM.STAT rmb MI.SIZ Stat
313 ITM.PRNT rmb MI.SIZ Print
314 ITM.RNAM rmb MI.SIZ Rename
315 ITM.DELT rmb MI.SIZ Delete
316 ITM.SORT rmb MI.SIZ*2 Sort
317
318 VIEWITMS rmb 0 View Menu items array.
319 ITM.LRES rmb MI.SIZ*3 Low Res 4 Color
320
321 KDMITMS rmb MI.SIZ*2 KDM Menu items array.
322
323 TNDYDESC rmb MN.SIZ Tandy Menu descriptor.
324 FILSDESC rmb MN.SIZ Files Menu descriptor.
325 DISKDESC rmb MN.SIZ Disk Menu descriptor.
326 VIEWDESC rmb MN.SIZ View Menu descriptor.
327 KDMDESC rmb MN.SIZ KDM Menu descriptor.
328
329 SHELLNAM rmb 6 "shell"
330 LISTNAM rmb 5 "list"
331 GCALCNAM rmb 6 "gcalc"
332 GCLOCKNM rmb 7 "gclock"
333 GCALNAM rmb 5 "gcal"
334 CONTRLNM rmb 8 "control"
335 GPRINTNM rmb 7 "gprint"
336 GPORTNAM rmb 6 "gport"
337 HELPNAM rmb 5 "help"
338 COCPRNM rmb 7 "cocopr"
339
340 DBOXDESC rmb FL.SIZE Directory Close Box descriptor. (file icon descriptor format)
341 DBARDESC rmb FL.SIZE Directory Bar descriptor. (file icon descriptor format)
342 QURYDESC rmb FL.SIZE ? descriptor. (file icon descriptor format)
343 TRSHDESC rmb FL.SIZE Trash Can descriptor. (file icon descriptor format)
344 PRTRDESC rmb FL.SIZE Printer descriptor (file icon descriptor format)
345
346 CALCDESC rmb ID.SIZE Icon descriptor for gcalc.
347 CLOKDESC rmb ID.SIZE icon descriptor for gclock
348 CALDESC rmb ID.SIZE icon descriptor for gcal.
349 SHELDESC rmb ID.LINK icon descriptor for shell.
350 ENDLINK rmb 2 Terminating link for internal icon descriptors.
351 NXTICONO rmb 2 Next available external icon number.
352 PRESSMSG rmb 14 "press any key"
353 NEWNMSG rmb 18 "new name:"
354 SLASHW rmb 3 "/w"
355 ALLOCP rmb 3 "C" Variable.
356 STTOP rmb 2 "C" Variable.
357 MEMEND rmb 10 "C" Variable. 1st 2 is current upper boundary of data memory
358 MTOP rmb 2 "C" Variable.
359 STBOT rmb 2 "C" Variable.
360 ERRNO rmb 2 "C" Variable.
361 WINDDESC rmb WN.SIZ GShell window descriptor.
362 DDIRNAME rmb 256 Full path name to current data directory.
363 XDIRNAME rmb 256 Full path name to current execution directory.
364 MOUSPCKT rmb 32 Mouse packet buffer.
365 FNAMBUFR rmb 30 File name (null terminated) for file icon descriptor setup.
366 DIRBUFER rmb 2048 Read buffer for current directory information.
367 ICONBUFR rmb 144 Icon read/build buffer. (for GPLOAD)
368 MULTIBFR rmb 256 Shared buffer.
369 LINEBUFR rmb 80 80 character line input buffer.
370 ASCIINUM rmb 8 ASCII number from binary/ASCII conversion routine.
371 ASCIITMP rmb 8 Binary/ASCII temp buffer. (reversed)
372 PARMSBFR rmb 256 Command/parameters build build buffer.
373 AIFNMBFR rmb 8 AIF.xxx file name build buffer.
374 DNAMBUFR rmb 32 Directory name input buffer.
375 SCRNTABL rmb SC.SIZE*8 Process screen table.
376 ENVFLBFR rmb 80 80 character line buffer for ENV.FILE input.
377 GFXBUF2 rmb 4 Graphics command build buffer. (small)
378 SSOPTBFR rmb 34 Buffer for SS.OPT information.
379 DRIVETBL rmb FL.SIZE*5 Device/Drive table.
380 DRVNMTBL rmb 32*5 Device/Drive name table.
381 BASE rmb 4 "C" Variable.
382 SPARE rmb 2 "C" Variable.
383 GFXBUF rmb 16 Graphics command build buffer. (large)
384 * Added for mode changing palette support
385 GSHBUF rmb 16 GSHPAL0 to 3 display code buffer.
386 DIRPATH rmb 1 Path # to current dir. (added for dir monitoring)
387 Dirup rmb 1 Copy of signal code (if it was new DIR signal)
388 RenFlag rmb 1 Flag used by rename - whether to reset DIRSIG or not
389 SIGN rmb 1 "C" Variable.
390 HANDLER rmb 2 "C" Variable.
391 END rmb 896 "C" Variable.
392 DATASIZE equ .
393
394 MODNAME fcs "gshell"
395 fcb 2
396
397 * Will change to not bother preserving U, assume data area always @ 0
398 CSTART pshs Y Save ptr to end of parm area
399 pshs U Save ptr to start of data area
400 clr ,-s Init all of direct page to 0's
401 ldw #256
402 tfm s,u+
403 leas 1,s Eat 0 byte
404 ldx ,S Get ptr to start of data area again
405 leau ,X Point U to it again
406 leax END,X Point to End of GSHELL data area
407 pshs X Save it
408 leay ETEXT,PC Point to a table of initialized data (includes screen height)
409 ldw ,y++ Get size of data block
410 tfm y+,u+ Block copy initialized data
411 ldu 2,S Get ptr to start of data area again
412 leau <TNDYITMS,U Point to Tandy Menu Items array in data area
413 ldw ,y++ Get size of data block
414 tfm y+,u+ Block copy initialized data
415 ldw ,s Get end address
416 clr ,-s Zero byte
417 subr u,w W=Size of area to clear
418 tfm s,u+ Clear until end of data area
419 ldu 3,s Get ptr to start of data area again
420 leas 5,s Eat zero byte & End/Start of data markers
421 puls X Get ptr to end of parm area
422 stx >MEMEND Save as end of data memory ptr
423 leay ,U Point Y to start of data area
424 bsr MAIN Call main GSHELL routine
425 clrd No error & exit
426 std ,--s
427 lbra EXIT
428
429 * Signal intercept trap
430 SAVESGNL clra Save signal as D & return
431 std RECDSGNL,U
432 cmpb #DIRSIG Dir update signal?
433 bne DoneSig
434 stb Dirup,u Save copy (in case in middle of dir update, or stuck elsewhere)
435 DoneSig rti
436
437 MAIN pshs U,y Save U
438 lbsr SETUPENV Setup drive tables, and read in ENV.FIL stuff
439 puls y
440 leax <SAVESGNL,PC Set up intercept trap
441 tfr Y,U Copy start of data area to U
442 os9 F$ICPT
443 * FIXWINDW only called once, embed !
444 bsr FIXWINDW Get window path
445 std -2,S Save it
446 beq GSHABORT Could not get path, abort
447 bsr BILDDESC Go build menu descriptor for GSHELL
448 bsr SETWINDW Set some coords, graphics cursor, window type, etc.
449 lbsr KILLPBUF Kill all GP buffers in the our ID # group
450 lbsr FINLINIT Redo std I/O for window path, menus for 128/512k,mouse on
451 lbsr GSHSTART
452
453 GSHABORT puls U,PC Restore U & return
454
455 * Entry: Y=start of data area ptr
456 FIXWINDW ldd #SS.SCTYP Path=0, get screentype call
457 os9 I$GETSTT
458 bcc ONWINDOW No error on call, skip ahead
459 clra
460 std >ERRNO Save 16 bit error #
461 lda #UPDAT. Attempt to open path to 'w/'
462 ldx #SLASHW
463 lbsr I.OPEN D=path for window
464 DoneFix std <WNDWPATH Save path to window
465 rts
466
467 ONWINDOW lda #STDERR Get Std Error path
468 lbsr I.DUP Duplicate path
469 pshs d Save new path # (16 bit)
470 lbsr DWEND DWEnd the window
471 puls d Get path #
472 bra DoneFix Save & return
473
474 BILDDESC ldx #TNDYDESC Point to our copy of Tandy Menu descriptor
475 stx WINDDESC+WN.BAR,Y Save as ptr to menu descriptors
476 ldb #5 5 menus on the menu bar
477 stb WINDDESC+WN.NMNS,Y
478 ldd #WINSYNC Sync bytes to $c0c0 <grin>
479 std WINDDESC+WN.SYNC,Y
480 leax <GSHELLTL,PC Point to GSHELL title bar
481 pshs X Save it
482 ldx #WINDDESC Point to Gshell menu descriptor
483 pshs X Save that
484 lbsr STRCPY Copy title bar info into RAM copy of Menu descriptor
485 leas 4,S Eat stack
486 clr <PRCIDNUM
487 pshs y Save Y
488 os9 F$ID Get process #
489 sta <PRCIDNUM+1 Save it
490 puls y,pc Restore Y & return
491
492 GSHELLTL fcc "GShell+ 1.26"
493 fcb NUL
494
495 SETWINDW bsr WINDPARM Set up some of the 40/80 column measurement stuff
496 ldb #2
497 pshs d border color=2
498 pshs d background color=0
499 clrb
500 pshs d foreground color=1
501 ldx WINDWSZY Get Window height
502 ldb WINDWSZX+1 Get X window size (in chars)
503 pshs d,X Save them
504 clrb Start x,y=0,0
505 pshs d
506 pshs d
507 ldx DEFWTYPE Get window type
508 ldb WNDWPATH+1 Get window path #
509 pshs d,X Save them
510 lbsr DWSET Do the device window set
511 lbsr ResetPal Added to restore GSHPAL colors when re-setting window
512 leas 18,S Eat all of our stack crap
513 std -2,S
514 blt SETWIND1 ??? Error, skip ahead
515
516 lbsr MenuClr Set color for menu bars
517 ldx #WINDDESC Point to Gshell menu structure
518 ldd #WT.FSWIN Framed window with scrollbars
519 pshs d,X Save on stack
520 ldb WNDWPATH+1 Get path to window
521 pshs d Save
522 lbsr ST.WNSET Set the window to framed with scrollbars
523 leas 6,S Eat stack stuff
524
525 lbsr RegClr Set color for regular stuff
526 std -2,S
527 bge SETFONTS No error, skip ahead
528 SETWIND1 ldd ERRNO,Y Get error #
529 pshs d Save it
530 lbsr TRYQUIT ??? Try resetting everything?
531 leas 2,S Eat stack
532 SETFONTS clrb Save regs
533 pshs d,X,Y
534 lbsr SELECT Select std in as current window
535 ldb WNDWPATH+1 Get window path
536 stb 1,S Save on stack
537 lbsr SELECT Select Gshell window path as current window
538 ldb #FNT.S6X8 Save 6x8 font #
539 stb 1+4,S
540 ldb #GRP.FNT Save font group #
541 stb 3,S
542 lbsr FONT Select the 6x8 font
543 clrb Echo off, pause off
544 std 2,S
545 lbsr PAUSECHO Shut echo & pause off
546 lbsr CURSCLOF Cursor off & Scaling off
547 lbsr CRSRAROW Set graphics cursor to the arrow
548 leas 6,S Eat stack & return
549 rts
550
551 WINDPARM clra Default flag to 320 res.
552 ldb DEFWTYPE+1 Get default window type
553 cmpb #7 640x200x4 color?
554 bne WINDPAR3 No, leave at 320 res.
555 WINDPAR1 inca Flag as 640 res.
556 WINDPAR3 sta FLAG640W Save 640/320 flag
557 bne WINDPAR4 640, skip ahead
558 ldd #303 Set Gshell window width to 303
559 std PIXELSWD
560 ldd #265 Set Directory Bar End X to 265
561 std DBARDESC+FL.XEND,Y
562 ldd #280 '?' Start X pos to 280
563 std QURYDESC+FL.XSTRT,Y
564 ldd #295 '?' End X pos to 295
565 std QURYDESC+FL.XEND,Y
566 ldd #64 Start X position of icons on screen to 64
567 std STRTXPOS
568 std ICONCOLW Also # pixels between icons (width)
569 ldb #ICNONSCR Get max # icons on screen at once
570 std MAXICONS Save it
571 ldb #40 X Size of GShell window path to 40
572 clr WD48FLAG Set 40 column flag
573 bra WINDPARX
574
575 * 640 wide screen
576 WINDPAR4 ldd #623 GShell window width=632
577 std PIXELSWD
578 ldd #576 Set directory bar end X to 576
579 std DBARDESC+FL.XEND,Y
580 ldd #597 '?' Start X pos to 597
581 std QURYDESC+FL.XSTRT,Y
582 ldd #615 '?' End X pos to 615
583 std QURYDESC+FL.XEND,Y
584 ldd #56 Start X pos of icons on screen to 56
585 std STRTXPOS
586 ldb #ICNONSCR*2 # icons on screen max
587 std MAXICONS Save it
588 ldb #72 72 pixels between icons on screen
589 stb ICONCOLW+1
590 ldb #$80 Flag 80 colum screen
591 stb WD48FLAG
592 ldb #80 80 column width
593 WINDPARX std WINDWSZX Save # text chars wide screen is & return
594 rts
595
596 FINLINIT lbsr RESTDIO Close std I/O, Reopen with current window path
597 lbsr SETVIEW Set up the VIEW menu
598 tst RAMSIZE >128k RAM?
599 bne FINLINIX Yes, skip ahead
600 clr VIEWDESC+MN.ENBL No, disable the view menu (only allow 16k 320x200x4)
601 clr ITM.FMAT+MI.ENBL Disable the FORMAT command
602 lda WNDWPATH+1 Get window path
603 ldb #SS.UMBAR Update the menu bar (to enforce above changes)
604 os9 I$SETSTT
605
606 FINLINIX lbsr STDICONS Preload built in icons (regular & expanded for some)
607 lbsr MOUSENOW Turn on auto-follow mouse
608 rts
609
610 * Shut cursor & scaling off
611 CURSCLOF clrd
612 pshs d
613 ldb 5,S
614 pshs d
615 lbsr SCALESW Shut scaling off
616 lbsr CURSROFF Shut cursor off
617 bra CURSCLOX
618
619 * Clear out signal code, reset up Mouse/keyboard signals
620 * CHANGED: will copy Dirup signal flag to RECDSGNL
621 SETSGNLS clra Clear out last received signal
622 ldb Dirup Get Saved Dir updated signal (0 means none)
623 std RECDSGNL Clear or set saved DIR signal
624 ldb WNDWPATH+1 D=window path to receive mouse signal from
625 ldx #MOUSIGNL Mouse signal #
626 pshs d,X Save for routine call (both only s/b 8 bit)
627 lbsr ST.RELEA Release the mouse signal
628 lbsr ST.MSSIG Set the mouse signal
629 inc 3,S Bump up signal number (to keyboard signal)
630 lbsr ST.SSIG Set keyboard signal
631 CURSCLOX leas 4,S Eat temp stack & return
632 rts
633
634 GSHSTART pshs U Preserve U
635 leas -3,S Make room on stack
636 ldu #MOUSPCKT Point to mouse packet buffer
637 lbsr INITSCRN
638 WAITLOOP bsr SETSGNLS Set signals for keyboard & mouse
639 ldd RECDSGNL Get signal
640 bne SGNLRECD Got one, process it
641 pshs d Preserve 0
642 lbsr HNDLWAIT Go sleep, check for signals
643 std ,S++ Save child's signal code
644 bne SGNLRECD Got one, process as if local signal
645 bsr SETSGNLS Set signals again
646 ldx RECDSGNL Get any new signal
647 bne SGNLRECD Got one, process it
648 os9 F$SLEEP Sleep until signal received
649 SGNLRECD ldd RECDSGNL Get signal code (only need B portion)
650 subb #DIRSIG Dir update signal?
651 lbeq EQULSIGN Yes, go do
652 incb Keyboard signal?
653 lbeq CHKKEYBD yes, handle
654 incb Mouse signal?
655 bne WAITLOOP No, wait some more
656 * Mouse signal handling here
657 CHKMOUSE ldd WNDWPATH Get window path
658 pshs d,U
659 lbsr GT.MOUSE Get mouse packet
660 leas 4,S
661 ldb PT.VALID,U Mouse on current window?
662 beq WAITLOOP No, continue waiting
663 ldb PT.CBSA,U Is button A pressed?
664 beq WAITLOOP No, continue waiting
665 ldb PT.STAT,U Is mouse in control region or off window?
666 bne CHEKMENU Yes, go check if menu select made
667 pshs U
668 lbsr CHEKSCRN No, check if user selected something not on menu bar
669 SLCTRTRN leas 2,S Eat stack, poll keyboard/mouse
670 bra WAITLOOP
671
672 CHEKMENU lda WNDWPATH+1 Get window path
673 ldb #SS.MNSEL Menu select call
674 os9 I$GETSTT Do call (ignore errors... original does)
675 * Error code added to see if we get errors when GSHELL "freezes"
676 bcc NoError
677 os9 F$EXIT
678 NoError cmpa #MID.CLS Close box?
679 beq CLOSEBOX
680 cmpa #MID.SUP Scroll up arrow?
681 beq SCRLLUPL
682 cmpa #MID.SLT Scroll left arrow?
683 beq SCRLLUPL
684 cmpa #MID.SDN Scroll down arrow?
685 beq SCRLLDNR
686 cmpa #MID.SRT Scroll right arrow?
687 beq SCRLLDNR
688 cmpa #MID.TDY Tandy menu?
689 beq TNDYMENU
690 cmpa #MID.FIL File menu?
691 beq FILEMENU
692 cmpa #MID.DSK Disk menu?
693 beq DISKMENU
694 cmpa #MID.VEW View menu?
695 beq VIEWMENU
696 WAITRTRN bra WAITLOOP Continue waiting (About.. menu will never return item)
697
698 * Called by hitting 'q' or clicking on close box
699 CLOSEBOX lbsr SUREQUIT Do 'are you sure' box
700 bra WAITRTRN Obviously hit 'no', continue
701
702 SCRLLUPL ldd DEVICNOW Drive selected?
703 beq WAITRTRN No, continue polling keyboard/mouse
704 lbsr SCRLLUP1 Scroll up on current drive
705 bra WAITRTRN Continue polling keyboard/mouse
706
707 SCRLLDNR ldd DEVICNOW If drive selected, scroll down
708 beq WAITRTRN continue polling keyboard/mouse
709 lbsr SCRLLDN1
710 bra WAITRTRN
711
712 * Entry for all 4 ????MENU calls is B=item # selected
713 TNDYMENU clra
714 pshs d
715 lbsr TNDYSLCT Go handle Tandy menu
716 bra SLCTRTRN Eat stack, continue polling
717
718 FILEMENU clra
719 pshs d
720 lbsr FILESLCT Do File menu
721 bra SLCTRTRN Eat stack, continue polling
722
723 DISKMENU clra
724 pshs d
725 lbsr DISKSLCT Do Disk menu
726 bra SLCTRTRN Eat stack, continue polling
727
728 VIEWMENU clra
729 pshs d
730 lbsr VIEWSLCT Do View menu
731 bra SLCTRTRN Eat stack, continue polling
732
733 * Poll keyboard
734 CHKKEYBD ldd #1 1 byte length/std in?
735 pshs d
736 leax 2,S Point to 1 byte buffer
737 ldd WNDWPATH Get window path
738 pshs d,X
739 lbsr I.READ Read key
740 leas 6,S
741 std -2,S save byte
742 ble WAITRTN2 No key(?), continue polling
743 ldb ,S Get key press
744 cmpb #'=
745 beq EQULSIGN '=' - go refresh current drive/dir selection
746 cmpb #'$
747 beq DOLRSIGN '$' - go set up new resizable shell window
748 cmpb #28 (Pageup)
749 beq SCRLLUPL Scroll up current dir
750 cmpb #26 (PageDown)
751 beq SCRLLDNR Scroll down current dir
752 cmpb #63 '?' - call Help routine
753 beq ICONQUR1
754 andb #$5F
755 cmpb #'Q 'Q'uit Gshell
756 beq CLOSEBOX
757 cmpb #'S 'S'ame screen overlay shell
758 beq LETTERS
759 ldd WNDWPATH Illegal key, beep at user
760 pshs d
761 lbsr RINGBELL
762 leas 2,S
763 bra WAITRTN2 Continue polling
764
765 * Resizable shell
766 DOLRSIGN ldb #IC.SHELL We want the structure for the SHELL entry
767 pshs d
768 lbsr FNDIDESC (Returns D=ptr to proper ID structure) - may change screen type
769 std ,S Save ptr
770 ldd #1 ? Save flag that we want a double box window for the program
771 pshs d
772 ldx #SHELLNAM Point to shell name for F$Fork
773 pshs X
774 lbsr EXCICOND Execute shell in resizable window
775 leas 6,S
776 bra WAITRTN2
777
778 * Refresh current drive/dir (NEW RBF CALL, IF FULLY WORKING, MAY OBSOLETE THIS
779 * ROUTINE FROM BEING CALLED BY A KEYPRESS)
780 EQULSIGN ldd DEVICNOW If no drive selected, don't bother
781 beq WAITRTN2
782 lbsr DONEWDIR Go refresh current drive stuff
783 WAITRTN2 lbra WAITLOOP
784
785 * Same screen overlay shell
786 LETTERS clrd
787 pshs d
788 pshs d No parameter for calling program
789 incb
790 pshs d Flag that we want overlay window to run in
791 ldx #SHELLNAM Point to 'shell'
792 pshs X
793 lbsr EXECPRGM Execute program in overlay window (MAYBE ALLOW RESIZE?)
794 leas 8,S
795 bra WAITRTN2 Continue polling after shell exited
796
797 * Printer click
798 ICONPRTR ldd SELECTED Is there a file/dir selected?
799 beq ICONTRS1 No, don't do printer
800 ldb #5 Print menu item # from FILES menu
801 std ,S
802 lbsr FILESLCT
803 bra ICONTRS1
804
805 * Trash can click
806 ICONTRSH ldd SELECTED Is there a file/dir selected?
807 beq ICONTRS1 No, don't do trash stuff
808 ldb #10 Trash delete option from FILES menu structure (no sure prompt)
809 std ,S
810 lbsr FILESLCT
811 ICONTRS1 lbra ICONEXIT
812
813 * ? in upper right corner - hot key
814 ICONQUR1 pshs d Just so it exits properly
815 ldb #7
816 pshs d
817 lbsr TNDYSLCT
818 bra WAITRTN2
819
820 ICONQURY ldb #7 '?' selected, call 'Help' (menu item 7) from Tandy menu
821 pshs d
822 lbsr TNDYSLCT
823 lbra ICONEXT1
824
825 * Not menu bar selection, try other stuff on screen
826 CHEKSCRN pshs U
827 ldd 8-4,S
828 pshs d,X
829 lbsr ISITICON Check if drive or icon
830 tfr D,U
831 stu -2,S Set CC based on ptr to icon info
832 lbeq DSLCTALL Empty spot clicked, clear any currently highlighted stuff
833 ldb FL.ICONO,U Get selected icon buffer #
834 cmpb #IC.TRASH Is it the trash can?
835 beq ICONTRSH Yes, go handle
836 cmpb #IC.PRNTR Is it the printer?
837 beq ICONPRTR Yes, go do it
838 cmpb #IC.QUERY Is it the question mark?
839 beq ICONQURY Yes, go do help
840 lbsr ENBLSOFF Disable any menu items that deal with specific file
841 ldb #1
842 std ,S
843 ldd SELECTED Get current selected icon
844 beq CHEKSCR2 None, skip ahead
845 cmpu SELECTED Same as previously selected icon?
846 bne CHEKSCR1 No, unselect previous icon
847 inc 1,S
848 bra CHEKSCR2
849
850 CHEKSCR1 pshs d Unselect previously selected icon
851 lbsr UNSLICON
852 leas 2,S
853 CHEKSCR2 stu SELECTED Save newly selected icon
854 ldb FL.ICONO,U Get icon # (also type?)
855 decb
856 lbeq ICONTEXT 1=Text file icon
857 decb
858 beq ICONFLDR 2=Folder (dir) icon
859 decb
860 lbeq ICONPRGM 3=Program (executable) icon
861 decb
862 beq ICONCLOS 4=Close box for current device title bar
863 decb
864 beq ICONDRIV 5=Disk drive icon
865 decb
866 lbeq ICONAIF 6=AIF file icon
867 decb
868 lbeq ICON.XXX 7=file with extension already defined by AIF
869 decb
870 bne ICONEXT2 >8, exit icon check routine
871 ldd DEVICNOW 8=current device title bar (to refresh current dir)
872 beq ICONEXT2
873 lbsr DONEWDIR Refresh current dir
874 bra ICONEXT2
875
876 * Select new drive icon
877 ICONDRIV ldd DEVICNOW Get current device
878 std 2,S
879 pshs d
880 lbsr UNSLICON Unselect current device
881 stu ,S
882 lbsr SELCICON Select new icon
883 ldd FL.FNAME,U Get ptr to drive name
884 std ,S
885 lbsr NEWDDIR Get new drive dir
886 std ,S++
887 bne ICONDROK Legit, continue
888 pshs U
889 lbsr UNSLICON Bad dir, unselect drive
890 leas 2,S
891 clrd
892 std SELECTED Current device=none
893 ldd 2,S Did user have a different drive selected before?
894 beq ICONEXT2 No, exit
895 pshs d
896 lbsr SELCICON Re-select the old drive instead
897 ICONEXT1 leas 2,S
898 ICONEXT2 lbra ICONEXIT
899
900 * User selected new, legitimate drive
901 ICONDROK ldb #1 Enable menu items flag
902 pshs d
903 lbsr ENFREFLD Enable drive specific menu items (NOT FILE ONES!)
904 leas 2,S
905 stu DEVICNOW Save new current device
906 bra ICONEXT2
907
908 * Selected current path close box (go up a directory)
909 ICONCLOS lbsr PARENTDR Change to parent directory or drive
910 bra ICONEXT2
911
912 * Selected a folder (directory)
913 ICONFLDR ldd ,S ??? Get # times mouse clicked
914 decb
915 beq ONECLIKF Once, skip ahead
916 ldd FL.FNAME,U Twice, get ptr to folder name
917 pshs d
918 lbsr OPENFLDR Open the folder & return
919 bra ICONEXT1
920
921 ONECLIKF pshs U
922 lbsr SELCICON Highlight (select) the folder
923 ldb #1
924 std ,S
925 lbsr ENBLOPEN Enable OPEN item on files menu
926 lbsr ENSTRNDL Enable STAT, RENAME & DELETE on files menu
927 bra ICONEXT1 Exit
928
929 * Text file icon selected
930 ICONTEXT ldb #1 Enable LIST & PRINT on Files menu
931 pshs d
932 lbsr ENLSTPRT
933 ldd 2,S Get # of mouse clicks
934 decb
935 bne TWOCLIKT double click, skip ahead
936 stu ,S Select the icon
937 lbsr SELCICON
938 bra ICONTEX1
939
940 TWOCLIKT ldx #1 Double clicked text file: try executing as shell script
941 stx ,S
942 ldd FL.FNAME,U Save ptr to filename
943 pshs d
944 ldd #SHELLNAM Save ptr to 'shell' and 'use overlay window' flag
945 pshs d,X
946 lbsr EXECPRGM Execute shell in overlay window
947 leas 6,S
948 bra ICONTEX1
949
950 * File with previously found AIF extension clicked on
951 ICON.XXX ldd ,S Get # of clicks
952 decb
953 beq ICONAIF1 1 click, skip ahead
954 pshs U
955 lbsr EXEC.XXX Double click, execute the program related to icon
956 bra ICONAIF2
957
958 * AIF file clicked on
959 ICONAIF ldb #1 Enable LIST & PRINT on FILE menu
960 pshs d
961 lbsr ENLSTPRT
962 leas 2,S
963 ldd ,S Get # of clicks
964 decb
965 beq ICONAIF1 1 click, skip ahead
966 pshs U
967 lbsr EXECAIF 2 clicks, execute program AIF file refers to
968 bra ICONAIF2
969
970 * Executable program clicked on
971 ICONPRGM ldd ,S Get # of clicks
972 decb
973 beq ICONAIF1 1 click, skip ahead
974 pshs d
975 lbsr FILESLCT 2 clicks, Go to file select menu, option 1 (OPEN)
976 leas 2,S
977 bra ICONPRG1
978
979 ICONAIF1 pshs U
980 lbsr SELCICON Do select icon on screen
981 ICONAIF2 leas 2,S
982 ICONPRG1 ldb #1 Enable OPEN item on FILES menu
983 pshs d
984 lbsr ENBLOPEN
985 ICONTEX1 ldb #1
986 std ,S
987 lbsr ENBLCOPY Enable COPY item on FILES menu
988 lbra ICONEXT1
989
990 DSLCTALL ldd SELECTED Get ptr to current selected icon
991 pshs d
992 lbsr UNSLICON Unselect icon
993 lbsr ENBLSOFF Shut all FILES menu items off
994 leas 2,S
995 clrd
996 std SELECTED Set selected file/device to none
997 ICONEXIT leas 4,S
998 puls U,PC
999
1000 * Pop up overlay window to ask user for parameters for file we are about to
1001 * execute.
1002 GETPARMS pshs U
1003 ldd 4,S
1004 leas -48-10,S Make room on stack for string copy
1005 leax TENSPACE,PC
1006 pshs d,X Save ptr to 10 spaces & ptr to module name we are executing
1007 leax <PARMSFOR,PC Save ptr to "parameters for" text
1008 pshs X
1009 leax 4+2,S
1010 pshs X
1011 lbsr STRCPY Copy "paramters for" onto stack
1012 leas 4,S
1013 pshs d
1014 lbsr STRCAT Add 10 spaces
1015 leas 4,S
1016 pshs d
1017 lbsr STRCAT Add module name
1018 leas 4,S
1019 leax ,S
1020 pshs X
1021 lbsr INPTSCRN Get parameter info from user
1022 leas 48+2+10,S Eat stack & return
1023 puls U,PC
1024
1025 PARMSFOR fcc "Parameters for "
1026 fcb NUL
1027
1028 EXEC.XXX pshs U
1029 bsr IDESCTST
1030 beq EXECAIF3
1031 pshs d
1032 ldd FL.FNAME,U Get ptr to file name
1033 pshs d
1034 lbsr STPREFIX
1035 puls d,U
1036 bra EXEC.XX1
1037
1038 * See if there is a ID.* entry for a FL.* entry
1039 * Entry: 0-1,s : RTS address
1040 * 2-3,s : ignored
1041 * 4-5,s : ignored
1042 * 6-7,s : FL.* ptr
1043 * Exit: D=ptr to ID.* structure (0 if none)
1044 IDESCTST ldu 4+2,S Get ptr to file info structure (FL.*)
1045 clra
1046 ldb FL.AIFNO,U Get entry # in ID.* table
1047 pshs d
1048 lbsr FNDIDESC Get ptr to appropriate ID.* table entry
1049 std ,S++ Set zero flag based on ptr
1050 rts
1051
1052 EXECAIF pshs U Save U
1053 bsr IDESCTST Get ID.* ptr
1054 beq EXECAIF3 None, exit
1055 tfr D,U Move ptr to U
1056 EXEC.XX1 lda [ID.PARAM,U] Get 1st char of parms
1057 beq EXECAIF2 None, skip ahead
1058 cmpa #'? Question mark (prompt for parms)?
1059 bne EXECAIFN No, use parms raw
1060 ldd ID.MNAME,U Get ptr to module name
1061 pshs d
1062 bsr GETPARMS Prompt user for parms (uses overlay with module name)
1063 std ,S++ Size of user response
1064 beq EXECAIF2 Just hit enter, skip ahead
1065 bra EXECAIFP
1066
1067 EXECAIFN ldd ID.PARAM,U Get ptr to parms string
1068 EXECAIFP pshs d Save ptr to parms string
1069 lbsr STPREFIX Prefix that onto Fork line string
1070 leas 2,S
1071 EXECAIF2 clrd
1072 pshs d,U
1073 ldd ID.MNAME,U Get ptr to module name to fork
1074 pshs d
1075 lbsr EXCICOND Go execute module in resizable window
1076 leas 6,S
1077 EXECAIF3 puls U,PC
1078
1079 * Open folder
1080 OPENFLDR pshs U
1081 ldu 4,S
1082 pshs U
1083 lbsr CHGDDIR Change dir to newly selected folder
1084 std ,S++
1085 bne OPENFLD1
1086 ldx #DDIRNAME Append new dir to dir name on drive bar
1087 pshs X
1088 lbsr STREND Find end of current path
1089 leas 2,S
1090 tfr D,X
1091 ldb #'/ Add slash to end of path
1092 stb ,X+
1093 bra NEWDDIR1
1094
1095 OPENFLD1 leax <CANTFLDR,PC
1096 bra OPENFLD2
1097
1098 NEWDDIR pshs U
1099 ldu 4,S
1100 pshs U
1101 lbsr CHGDDIR
1102 std ,S++
1103 bne NEWDDIR2
1104 lbsr KILIBUFS Kill previous dir's icon buffers & get/put buffers?
1105 ldx #DDIRNAME Point to full path to current data directory
1106
1107 NEWDDIR1 pshs X,U
1108 lbsr STRCPY Add new path (,U) to end of current path (,X)
1109 leas 4,S
1110 lbsr DONEWDIR Refresh current drive on screen
1111 ldb #1 Exit with D=1
1112 bra NEWDDIR3
1113
1114 NEWDDIR2 leax <CANTDEVC,PC
1115 OPENFLD2 pshs X
1116 lbsr OLAYPRNT
1117 leas 2,S
1118 clrb
1119 NEWDDIR3 clra
1120 puls U,PC
1121
1122 CANTFLDR fcc "Can't open this folder"
1123 fcb NUL
1124
1125 CANTDEVC fcc "Can't open this device"
1126 fcb NUL
1127
1128 * Change to parent directory (clicked on dir bar close box)
1129 PARENTDR pshs U
1130 lbsr FNDSLASH Find slash NOTE: ONLY CALLED ONCE, EMBED!
1131 std -2,S On root?
1132 bne PARENTD1 Yes, skip ahead
1133 leax <DOTDOT,PC Change directory to '..'
1134 pshs X
1135 lbsr CHGDDIR
1136 ldx #DDIRNAME Get ptr to current full path to data dir.
1137 stx ,S
1138 lbsr TERMSLSH Cut data dir off one directory level earlier
1139 leas 2,S Eat stack
1140 lbsr DONEWDIR Refresh current drive on screen
1141 bra PARENTD2
1142
1143 * On root directory of current drive, unselect drive itself
1144 PARENTD1 clrb D=0
1145 pshs d Save it
1146 lbsr ENFREFLD Disable Drive specific menu items
1147 lbsr CLRDSCRN Wipe out current dir icon window, reset scroll bars to 0,0
1148 ldd DEVICNOW Get ptr to table for current selected drive
1149 std ,S Save it
1150 lbsr UNSLICON Unselect the current drive
1151 leas 2,S
1152 clrd
1153 std STRTICON Set ptr to start icon for screen to NONE
1154 std SELECTED Current selected icon to NONE
1155 std DEVICNOW Current selected device to NONE
1156 lbsr KILIBUFS Kill icon table & get/put buffers
1157 PARENTD2 puls U,PC
1158
1159 DOTDOT fcc ".."
1160 fcb NUL
1161
1162 KILPDS00 lbra KILPDS16 Eat stack & exit
1163
1164 * Kill process info for a process that has stopped (update linked list)
1165 * NOTE: BOTH 6809/6309 - SOME STU -2,S LOOK PRETTY USELESS
1166 * Entry: 0-1,s RTS address
1167 * 2-3,s ptr to GD.* (process table entry ptr) to kill
1168 KILPDESC pshs U
1169 clrd No entry found yet
1170 pshs d Save it
1171 ldu PTBLSPTR Get ptr to start of process descriptor table
1172 beq KILPDS00 None, exit
1173 ldd 6,S Get process table entry ptr we are to kill
1174 beq KILPDS00 None, exit
1175 cmpu 6,S Is the requested entry to kill the 1st entry in table?
1176 beq KILPDES2 Yes, skip ahead
1177 * Entry other than 1st to kill
1178 KILPDES1 stu ,S Save ptr to entry previous to one we want to kill
1179 ldu GD.LINK,U Get ptr to next process table entry in chain
1180 * Following line should be removed (inherent from LDU)
1181 stu -2,S
1182 beq KILPDES2 No other entries, exit (if you follow below) (REALLY STUPID)
1183 cmpu 6,S Is this the entry we are trying to kill?
1184 bne KILPDES1 No, check next link
1185 * ??? Remove entry from linked list (next entry in list pointed to by U)
1186 KILPDES2 stu -2,S Next entry a legit one?
1187 beq KILPDS00 No, exit
1188 cmpu PTBLSPTR Is it the 1st entry?
1189 bne KILPDES3 No, skip ahead
1190 ldd GD.LINK,U Get ptr to next process table entry
1191 std PTBLSPTR Reset this ptr as the 1st process table entry
1192 bra KILPDES4 Skip ahead
1193
1194 * one to remove is not 1st entry
1195 KILPDES3 ldd GD.LINK,U Get next entry in linked list
1196 ldx ,S Get ptr to one previous to the one we want to kill
1197 std GD.LINK,X Repoint previous entry to link to next entry (bypass us)
1198 KILPDES4 ldd #GD.LINK Offset to link ptr in structure
1199 addr u,d Point to next link ptr entry in current table entry
1200 cmpd PTBLNEXT Same as next available process descriptor link?
1201 bne KILPDES6 No, skip ahead
1202 ldd ,S Get previous entry ptr
1203 beq KILPDES5 None, skip ahead
1204 addd #GD.LINK Offset to next link ptr
1205 std PTBLNEXT Save as ptr to next available process descriptor link
1206 bra KILPDES6
1207
1208 KILPDES5 leax <PTBLSPTR,Y Point to 1st entry
1209 stx PTBLNEXT Save as next available process desc. link
1210 KILPDES6 ldd GD.WPATH,U Get window path for process
1211 blt KILPDS10 If negative, skip ahead
1212 cmpd WNDWPATH Same as current GSHELL path?
1213 bne KILPDES7 No, skip ahead
1214 lbsr KILLOLAY Remove overlay window it was running in.
1215 tst RAMSIZE 128k RAM machine?
1216 bne KILPDS12 >=256K, skip ahead
1217 lbsr CLRSCRN on 128k, clear GSHELL screen 1st
1218 bra KILPDS12
1219
1220 *Process killed was on different path than GSHELL itself is on
1221 KILPDES7 ldd GD.DW.OW,U Process running in overlay window?
1222 beq KILPDES8 No, skip ahead
1223 * NOTE: WHY DO SELECT TWO DIFFERENT WINDOWS IN A ROW???
1224 * Something to do with overlay window vs. parent device window?
1225 ldd GD.WPATH,U Get path to window process was on
1226 pshs d Make it the active window
1227 lbsr SELECT
1228 ldd WNDWPATH Get GSHELL window path
1229 std ,S Select it
1230 lbsr SELECT Select window
1231 ldd GD.WPATH,U Get process' window path again
1232 std ,S End process' window
1233 lbsr DWEND
1234 bra KILPDES9
1235
1236 KILPDES8 ldd WNDWPATH Get path to GSHELL window
1237 pshs d Make it the active window
1238 lbsr SELECT
1239 KILPDES9 leas 2,S Eat temp stack
1240 ldd GD.WPATH,U Get path to process' window
1241 pshs d Close path to window
1242 lbsr I.CLOSE
1243 bra KILPDS11
1244
1245 KILPDS10 ldd WNDWPATH Get path to GSHELL window
1246 pshs d
1247 lbsr SELECT Make it the active window
1248 KILPDS11 leas 2,S Eat stack
1249 KILPDS12 ldd GD.SCRNO,U Get screen #
1250 ble KILPDS13 If negative or 0, skip ahead
1251 pshs d Save screen #
1252 lbsr UNLKWNDW Unlink window from active window/screen list
1253 leas 2,S
1254 KILPDS13 ldd GD.INDVC,U Get ptr to ???
1255 beq KILPDS14 None, skip ahead
1256 pshs d
1257 lbsr FREE ??? Free memory of some sort?
1258 leas 2,S
1259 KILPDS14 ldd GD.MNAME,U Get ptr to process module name
1260 beq KILPDS15 None, skip ahead
1261 pshs d ??? Free mem for that?
1262 lbsr FREE
1263 leas 2,S
1264 KILPDS15 pshs U
1265 lbsr FREE
1266 leas 2,S
1267 KILPDS16 leas 2,S
1268 puls U,PC
1269
1270 * Allocate & setup process entry for our table of forked proceses
1271 SETPDESC pshs U
1272 ldd #GD.SIZE Size we want to allocate
1273 pshs d
1274 lbsr MEMSPACE Allocate the memory
1275 tfr D,U Save ptr to allocated memory into U
1276 std [PTBLNEXT,Y] Save ptr to next available spot for process descriptor
1277 leax GD.LINK,U Point to next link
1278 stx PTBLNEXT Save ptr to next available
1279 ldd 4+2,S
1280 std ,S
1281 lbsr PUTSTRNG
1282 leas 2,S
1283 std GD.MNAME,U Save ptr to module name
1284 clrd
1285 std GD.MTYPE,U Default stuff to zeros
1286 std GD.INDVC,U ??? to 0
1287 std GD.PRCID,U Process ID # to 0
1288 std GD.MEMSZ,U memory size to 0
1289 std GD.DW.OW,U Default to running on separate device window
1290 leax GD.LINK,U Point to next link ptr
1291 std ,X Set next link to empty
1292 ldd #-1
1293 std GD.STATS,U
1294 std GD.WPATH,U No window path done yet
1295 std ,--X
1296 std ,--X
1297 std ,--X
1298 std ,--X
1299 std ,--X
1300 tfr U,D
1301 puls U,PC
1302
1303 DONEWDIR lbsr KILLFTBL Kill current file table in memory
1304 lbsr RSTXYPTR Reset x/y pointers for icon starts
1305 lbsr NEWDIREC Redraw current dir screen
1306 bra DONEWDR1 Redraw screen & return
1307
1308 SCRLLDN1 ldb SCREENOW+1
1309 cmpb NSCREENS+1
1310 bge SCRLLUDX
1311 incb
1312 bra SCRLLDN2
1313
1314 SCRLLUP1 ldb SCREENOW+1
1315 beq SCRLLUDX
1316 decb
1317 SCRLLDN2 stb SCREENOW+1
1318 DONEWDR1 bsr DRAWSCRN
1319 SCRLLUDX rts
1320
1321 * Update screen: does 1) update directory bar, 2) update icons, 3) update
1322 * scroll bar marker.
1323 DRAWSCRN pshs U
1324 lbsr ENBLSOFF Disable any menu items that deal with a specific file
1325 ldd WNDWPATH Get GSHELL path
1326 pshs d,X
1327 lbsr GCSETOFF Shut graphics cursor off
1328 lbsr MOUSOFF Shut mouse off
1329 lbsr WIPICONS Wipe icons off screen (should not touch dir bar)
1330 clrd
1331 std SELECTED 0 out currently selected icon ptr
1332 ldd MAXICONS Get # icons/screen
1333 muld SCREENOW Multiply by screen set #
1334 stw 2,s Save result
1335 ldu FTBLSPTR Get ptr to file icon descriptor table
1336 bra DRAWSCR2
1337
1338 DRAWSCR1 ldu FL.LINK,U
1339 DRAWSCR2 ldd 2,S Get screen set # we want to print
1340 decd Base 0
1341 std 2,S Save it back
1342 bge DRAWSCR1 If not 1st, skip ahead
1343 stu STRTICON Save ptr to 1st icon on current screen
1344 clrd
1345 bra DRAWSCR4
1346
1347 DRAWSCR3 pshs U
1348 lbsr WRITICON
1349 leas 2,S
1350 ldu FL.LINK,U
1351 ldd 2,S
1352 incd
1353 DRAWSCR4 std 2,S
1354 stu -2,S
1355 beq DRAWSCR5
1356 cmpd MAXICONS
1357 blt DRAWSCR3
1358
1359 DRAWSCR5 ldd NSCREENS Get # of icon screens
1360 cmpd SCREENOW On last one?
1361 bne SCROLBAR No, skip ahead
1362 ldd #20 Yes, use Y pos 20 (for 200 line screen)
1363 bra DRAWSCR6
1364
1365 * Calculate position of vertical scroll bar (based on current screen #, and
1366 * how many screens of icons there is in current dir)
1367 SCROLBAR ldd NSCREENS Get # of screens of icons
1368 beq DRAWSCR6 If 0, just put in position 0
1369 lda SCREENOW+1 Get current screen#
1370 beq Force0 If 0, that is Y position
1371 leas -3,s make room on stack for temp vars
1372 incb Base 1 for divide
1373 stb 3,s Save # of screens
1374 ldd #21 Maximum # of screens
1375 divd 3,s B= # of Y positions per screen
1376 std 1,s Save remainder & answer
1377 lda SCREENOW+1 Get current screen #
1378 inca Base 1
1379 mul Multiply by answer (rough Y pos)
1380 stb ,s Save that result
1381 lda SCREENOW+1 Get current screen #
1382 inca Base 1
1383 ldb 1,s Get original remainder
1384 mul Calculate 2ndary offset
1385 divd 3,s Divide by # screens total (Y pos=B)
1386 addb ,s Add 2ndary to primary Y pos calc
1387 leas 3,s Eat stack
1388 decb Base 0 for scroll bar SETSTAT call
1389 bge NotNeg not negative, skip ahead
1390 Force0 clrd Force to 0
1391 NotNeg cmpb #20 Past end?
1392 bls DRAWSCR6 No, good, so update scroll bars
1393 ldb #20 Force to 20
1394 * Actually update the scrollbar (Y only one used)
1395 * Entry: D=Y position wanted (0-20)
1396 DRAWSCR6 std ,S Save Y pos
1397 pshs d And again
1398 ldx #77 Default to X position 77
1399 tst FLAG640W 80 or 40 column?
1400 bne DRAWSCR8 80, continue
1401 ldx #37 X position to 37 for 40 column
1402 DRAWSCR8 ldd WNDWPATH Get GSHELL window path
1403 pshs d,X Save path & x position
1404 lbsr ST.SBAR Set scroll bar positions
1405 lbsr MOUSENOW Turn auto-follow mouse back on
1406 leas 6,S eat stack
1407 lbra GENLEXIT Fix stack & return
1408
1409 * Wipe interior window, & redraw directory bar (latter done by call to
1410 * WRITDBAR). Change so it doesn't redraw directory bar unless directory has
1411 * changed
1412 WIPICONS pshs U
1413 ldb #21 Window Y size to clear - NOTE: WE HAVE TO ELIMINATE THE
1414 pshs d EXTRA BOX LINE IT CURRENTLY DRAWS
1415 ldx WINDWSZX Get window X size
1416 leax -7,X Subtract 7 (leaves scroll bars & drive icons alone)
1417 ldb #2 Start Y at 2 (skip menu bar and current path line)
1418 pshs d,X
1419 ldx #6 Start X (skip left border & drive icons)
1420 ldd WNDWPATH Get GSHELL path
1421 pshs d,X
1422 lbsr CWAREA Change working area
1423 lbsr CLRSCRN Clear screen (Send CHR$(12))
1424 leas 10,S Eat stack
1425 lbsr FULLSCRN Change working area to whole window except border stuff
1426 lbsr WRITDBAR Do initial drawing of "inside" screen REDOES DIR STUFF
1427 clr WIPED Flag that icons need not be redrawn
1428 puls U,PC Exit
1429
1430 * Wipe interior window, except drive icons (but including box around dir
1431 * contents)
1432 CLRDSCRN pshs U
1433 ldb #22 Y size
1434 pshs d
1435 ldx WINDWSZX X size -6 (includes box around dir contents)
1436 leax -6,X
1437 ldb #1 Y start=1 (includes dir bar)
1438 pshs d,X
1439 ldx #5 X start=5 (includes box around dir)
1440 ldd WNDWPATH
1441 pshs d,X
1442 lbsr CWAREA Clear out interior window
1443 lbsr CLRSCRN
1444 lbsr FULLSCRN Full interior window size (except border)
1445 clrd Redo scroll bars at 0,0
1446 std 4,S
1447 std 2,S
1448 lbsr ST.SBAR
1449 leas 10,S
1450 puls U,PC
1451
1452 * new dir - read in and print 1st screen
1453 NEWDIREC pshs U
1454 ldb #$ff Flag that we have to redo icons
1455 stb WIPED
1456 bsr WIPICONS Wipe icons off screen (leave current dir border)
1457 clrd
1458 std FILESCTR # files in current dir=0
1459 ldb #PTR.SLP Hourglass ptr
1460 pshs d,X,Y
1461 ldx #GRP.PTR
1462 ldd WNDWPATH
1463 pshs d,X
1464 lbsr GCSET
1465 lbsr MOUSOFF Shut mouse off - Change later to slow sampling?
1466
1467 * New DIR check code here
1468 lda DIRPATH Get current DIR path #
1469 beq SkipClos None, don't try closing
1470 os9 I$Close Close dir path 1st
1471 * New label here
1472 SkipClos ldb #DIR.+READ.
1473 std 2,S
1474 leax ONEDOT,PC Point to '.'
1475 stx ,S
1476 lbsr I.OPEN2 Open current dir
1477 leas 6,S
1478 std 2,S Save path # to stack
1479 lblt BAD.DIR Couldn't read current dir
1480 stb DIRPATH Successfull open; Save current dir path
1481 * NOTE: Done this early so if opening a large directory, and updates are done
1482 * during read, they will get caught too
1483 clr Dirup Clear out Directory update flag (saved signal)
1484 * New DIR code here - We want a signal if DIR changes
1485 * Moved here so will detect changes even on dir we are doing
1486 lda DIRPATH path in A
1487 ldx #DIRSIG Signal code to send on dir update
1488 ldb #SS.FSIG Send signal on file update setstat
1489 os9 I$SetStt Enable call
1490
1491 ldd #DIR.SZ*2 Flag to read 2 entries (. & ..) - NOTE IF ONE OR BOTH OF THESE
1492 pshs d IS NOT PRESENT, THEN GSHELL WILL SKIP ENTRIES!
1493 ldx #DIRBUFER
1494 ldd 6-2,S
1495 pshs d,X
1496 lbsr I.READ Read . & ..
1497 leas 6,S
1498 bra READ.DIR Go read rest of dir
1499
1500 DIRVALID ldd ,S Get # of bytes of dir entries
1501 pshs d Save # to divide by
1502 ldb #5
1503 lbsr CCASR divide by 32 (2^5) (size of dir entry)
1504 std ,S
1505 ldx #DIRBUFER Point to start of DIR buffer
1506 stx DIRPTR Save it
1507 bra CLASTEST Check which kind of file
1508
1509 CLASSIFY ldb [DIRPTR,Y] Get 1st byte of dir entry
1510 beq CLASSIF4 NUL (Deleted file, skip to next)
1511 ldx DIRPTR Get ptr to filename
1512 ldd FNAMEPTR Get ptr to current filename buffer
1513 pshs d,X
1514 lbsr STRHCPY Copy filename, including fixing hi-bit marker
1515 lbsr UPDTIPTR Update icon/file table ptrs
1516 leas 4,S
1517 tfr D,U
1518 stu -2,S
1519 beq CLASSIF4
1520 bsr GTFD.ATT Get file attributes
1521 ldb #IC.FOLDR Default to folder (dir)
1522 bita #DIR. If it is dir, done
1523 bne CLASSIF3
1524 ldb #IC.PRGRM
1525 bita #EXEC. If executable, program type
1526 bne CLASSIF3
1527 pshs U
1528 lbsr ISIT.XXX Check if an AIF type we know about
1529 leas 2,S
1530 CLASSIF3 stb FL.ICONO,U Save icon type
1531 CLASSIF4 ldd DIRPTR Go onto next dir entry
1532 addd #DIR.SZ
1533 std DIRPTR
1534
1535 CLASTEST ldd ,S Get # of dir entries in this 2k block
1536 decd Subtract 1
1537 std ,S
1538 bge CLASSIFY Still going, classify file type, otherwise, get next 2k block
1539
1540 READ.DIR ldd #2048 Size of read buffer (64 dir entries @ once)
1541 pshs d
1542 ldx #DIRBUFER
1543 ldd 6-2,S
1544 pshs d,X
1545 lbsr I.READ Read in 2K of directory
1546 leas 6,S
1547 std ,S
1548 bgt DIRVALID Good read, continue
1549
1550 * New DIR code here
1551 * We want a signal if DIR changes
1552 lda DIRPATH path in A
1553 ldx #DIRSIG Signal code to send on dir update
1554 ldb #SS.FSIG Send signal on file update setstat
1555 os9 I$SetStt Enable call
1556 bra READDIR2
1557
1558 BAD.DIR leax <CANTFLD2,PC
1559 pshs X
1560 lbsr OLAYPRNT
1561 READDIRX leas 2,S
1562 READDIR2 bsr CNTSCRNS
1563 lbra GENLEXIT
1564
1565 CANTFLD2 fcc "Can't open folder"
1566 fcb NUL
1567
1568 * Count # of screens to hold icons
1569 CNTSCRNS clrd
1570 std SCREENOW Set current "screen" of icons to 0 (1st)
1571 ldd FILESCTR Get # files current dir
1572 beq CNTSCRN2 zero, save & exit
1573 decd
1574 divd MAXICONS+1 Divide by # icons/"screen"
1575 clra 16 bit result
1576 CNTSCRN2 std NSCREENS Save # of icon "screens" & return
1577 rts
1578
1579 GTFD.ATT leax <XFD.ATT,Y
1580 ldd DIRPTR
1581 pshs d,X
1582 ldd 6+2,S
1583 pshs d
1584 lbsr GT.FDINF
1585 leas 6,S
1586 lda XFD.ATT
1587 rts
1588
1589 * Write icon to screen
1590 WRITICON pshs U
1591 ldu 4,S ?? Get ptr to current FL.* entry
1592 ldb FL.ICONO,U Get icon type
1593 pshs d Save it
1594 bra WRITICO2
1595
1596 WRITICO1 ldb FL.AIFNO,U
1597 std ,S
1598 bra WRITICO3
1599
1600 WRITICO2 subb #IC.F.XXX
1601 beq WRITICO1
1602 incb
1603 beq WRITICO1
1604 WRITICO3 ldd FL.YSTRT,U Get icon Y start position
1605 pshs d Save it
1606 ldx FL.XSTRT,U Get icon X start position
1607 ldd 2,S Get icon buffer #
1608 orb WD48FLAG +$80 if double wide (for 80 column)
1609 pshs d,X Save 'em
1610 ldx PRCIDNUM Get group #
1611 ldd WNDWPATH Get window path
1612 pshs d,X Save 'em
1613 lbsr PUTBLK Put icon on screen
1614 leas 10,S Eat temp stack
1615 ldd ,S Get icon type
1616 andb #$7F Strip hi bit
1617 cmpb #IC.TRASH Trash icon?
1618 beq NoName Yes, don't print name
1619 cmpb #IC.PRNTR Printer icon?
1620 bne WRITICO6 No, print name
1621 NoName pshs U Yes, fake stack for exit, NO name printing
1622 bra GENLEXIT Eat stack & return
1623
1624 WRITICO6 cmpb #IC.DRIVE Drive icon?
1625 bne WRITICO4 No, skip ahead
1626 pshs U
1627 lbsr POSIDRNM Print drive name below drive icon
1628 bra GENLEXIT Eat stack & exit
1629
1630 WRITICO4 pshs U If not trash or drive, print icon name
1631 bsr WRITFNAM
1632 WRITICO5 bra GENLEXIT Eat stack & exit
1633
1634 WRITFNAM pshs U
1635 ldu 4,S Get ptr to current icon table
1636 ldd FL.FNAME,U Get ptr to icon name
1637 pshs d Save em
1638 pshs U
1639 bra ERWRFNAM Write out icon (file) name
1640
1641 * Erase the filename from the screen (under the icon)
1642 ERASFNAM pshs U
1643 leax <TENSPACE,PC
1644 ldd 4,S
1645 pshs d,X
1646 ERWRFNAM bsr POSIFNAM Print filename under icon
1647 GENLEXIT leas 4,S Eat stack, restore U and return
1648 puls U,PC
1649
1650 TENSPACE fcc " "
1651 FOURSPAC fcc " "
1652 fcb NUL
1653
1654 POSIFNAM pshs U
1655 ldu 4,S
1656 ldd 8-2,S
1657 pshs d
1658 lbsr STRLEN
1659 cmpd #10
1660 ble POSIFNA1
1661 ldd #10
1662 tst WD48FLAG
1663 beq POSIFNA1
1664 incb
1665 POSIFNA1 std ,S
1666 ldd FL.YSTRT,U Get Y start of icon
1667 addd #1 Force to next text line
1668 lbsr DIVDX8 Divide by 8 (text Y position)
1669 addd #3 Add 3 (to skip 3*8 pixel height of icon)
1670 pshs d
1671 ldd 2,S
1672 asra
1673 rorb
1674 pshs d
1675 ldd FL.XSTRT,U
1676 pshs d
1677 ldd #6
1678 lbsr CCDIV
1679 subd ,S++
1680 addd #2
1681 tst WD48FLAG
1682 beq POSIFNA3
1683 addd #2
1684
1685 POSIFNA3 pshs d
1686 ldd WNDWPATH
1687 pshs d
1688 tst WD48FLAG
1689 bne POSIFNA4
1690 ldd FL.XSTRT,U
1691 cmpd #200
1692 blo POSIFNA4
1693 inc 3,S
1694
1695 POSIFNA4 lbsr GOTOXY
1696 ldd 0+6,S
1697 std 4,S
1698 ldd 10+4,S
1699 bra POSIFNA2
1700
1701 * Print drive name (max 4 chars) at proper position below drive icon
1702 POSIDRNM pshs U
1703 ldu 4,S Get ptr to icon entry for current drive
1704 ldd FL.FNAME,U Get drive name ptr
1705 pshs d Save it
1706 lbsr STRLEN Calculate length of drive name
1707 cmpd #4 4 or less?
1708 ble POSIDRN1 Yep, continue
1709 ldd #4 No, 4 is max.
1710 POSIDRN1 std ,S Save drive name size
1711 ldd FL.YSTRT,U Get Y icon start
1712 lbsr DIVDX8 Calc char. position
1713 addd #2 +2 to skip icon itself
1714 pshs d Save it
1715 ldb #1 X position=1
1716 pshs d
1717 ldd WNDWPATH Window path
1718 pshs d
1719 lbsr GOTOXY Position text cursor
1720 ldd 6,S Get drive name size
1721 std 4,S Save it
1722 ldd FL.FNAME,U Get drive name ptr
1723 POSIFNA2 std 2,S Save it
1724 lbsr I.WRITE Write out drive name
1725 leas 8,S Eat temp stack
1726 puls U,PC Restore U & return
1727
1728 * Scroll bar Y position table (for # of icon-filled screens)
1729 * SCROLLxx: xx is the number of screens of icons present
1730 * the last screen is ALWAYS the last position (20), irregardless of the #
1731 * of screens used.
1732 * since using x200 now, can expand to 21 screen, using 0-20
1733 * Data is then which Y position to be in for each screen set
1734 * This should be a DIV type instruction, and screw the table to save memory
1735 * in the 6309 version
1736 * EVENTUALLY, SEE IF WINDINT CAN HANDLE VARIABLE SIZED SCROLL
1737 * BARS (SEE NOTES I PUT IN MULTI-VUE MANUAL).
1738 SCROLL02 fcb 0
1739 SCROLL03 fcb 0,10
1740 SCROLL04 fcb 0,7,14
1741 SCROLL05 fcb 0,7,11,15
1742 SCROLL06 fcb 0,6,9,13,16
1743 SCROLL07 fcb 0,4,7,10,13,16
1744 SCROLL08 fcb 0,4,7,9,12,14,17
1745 SCROLL09 fcb 0,4,6,8,10,12,14,16
1746 SCROLL10 fcb 0,3,5,7,9,11,13,15,17
1747 SCROLL11 fcb 0,2,4,6,8,10,12,14,16,18
1748 SCROLL12 fcb 0,1,3,5,7,9,11,13,15,17,18
1749 SCROLL13 fcb 0,1,2,3,5,7,9,11,13,15,17,18
1750 SCROLL14 fcb 0,1,2,3,5,7,9,11,13,15,16,17,18
1751 SCROLL15 fcb 0,1,2,3,4,5,7,9,11,13,15,16,17,18
1752 SCROLL16 fcb 0,1,2,3,4,5,7,9,11,13,14,15,16,17,18
1753 SCROLL17 fcb 0,1,2,3,4,5,6,7,9,11,13,14,15,16,17,18
1754 SCROLL18 fcb 0,1,2,3,4,5,6,7,9,11,12,13,14,15,16,17,18
1755 SCROLL19 fcb 0,1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18
1756 SCROLL20 fcb 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18
1757
1758 * Select icon on screen - draw box around AIF ones, just FFill for drives,
1759 * folders, data files or executables. Done in color 3, reverts to color 1
1760 * on exit.
1761 * NOTE: TRY CHANGING TO XOR BAR AROUND ICON & NAME OF ICON. SHOULD BE FASTER
1762 * & SMALLER (don't need "stop box" around AIF's to prevent FFILL leaking)
1763 * Entry: U=Ptr to FL.* data structure
1764 SELCICON pshs U
1765 ldu 4,S
1766 beq SELCICO3
1767 ldb #3 color 3
1768 pshs d,X
1769 ldb WNDWPATH+1
1770 pshs d
1771 lbsr FCOLOR Change foreground color to 3
1772 ldb FL.ICONO,U Get icon type
1773 beq SELCICO2
1774 cmpb #IC.PRGRM Program, folder or text?
1775 bls SELCICO1 Yes, draw box
1776 cmpb #IC.DRIVE Drive icon?
1777 beq SELCICO1 Yes, draw box
1778 subb #IC.AIF.F If AIF file, draw box around icon 1st
1779 beq SELCICO1
1780 decb If anything but AIF itself or found AIF extension, don't
1781 bne SELCICO2 draw box around icon
1782 SELCICO1 lde #1 Flag we want inverted shadow as well
1783 bsr DRAIFBOX Draw "selected" box around icon
1784 SELCICO2 std 2,S
1785 clrb Reset foreground color to black
1786 std 2,S
1787 lbsr FCOLOR
1788 leas 6,S
1789 SELCICO3 puls U,PC
1790
1791 * Unselect icon
1792 * Entry: U=ptr to FL.* structure
1793 UNSLICON pshs U
1794 ldu 4,S
1795 beq SELCICO3
1796 ldb FL.ICONO,U Get icon type
1797 beq UNSLICO2
1798 cmpb #IC.PRGRM text, folder or program?
1799 bls UNSLICO1 Yes, draw box
1800 cmpb #IC.DRIVE Drive?
1801 beq UNSLICO1 Yes, draw grey box
1802 subb #IC.AIF.F If AIF or previously done AIF, we do outside box stuff 1st
1803 beq UNSLICO1
1804 decb
1805 bne UNSLICO2
1806 UNSLICO1 ldx #2 If AIF related, set color to 2 and draw box around it (clear
1807 ldb WNDWPATH+1 box around around icon)
1808 pshs d,X
1809 lbsr FCOLOR
1810 clre Flag that we are just doing light grey box
1811 bsr DRAIFBOX Light grey box (same as background color)
1812 clrb
1813 stb 3,S
1814 lbsr FCOLOR Reset foreground color to black
1815 leas 4,S
1816 UNSLICO2 puls u,pc ALSO REDRAWS FILENAME - UNNECESSARY FROM HERE, ANYWAYS
1817
1818 * Draw select box around selected drive/icon
1819 * Color should be set up before calling
1820 * Entry: E=0 if just straight box, <>0 if box AND dark grey invert shadow
1821 * U=ptr to FL.* structure
1822 * Uses F
1823 DRAIFBOX ldd FL.YSTRT,U Get Y start coord for icon, subtract 2 for box
1824 subb #2 A little above top of icon
1825 pshs d
1826 ldx FL.XSTRT,U Get X pos of icon
1827 ldf FL.ICONO,u Get icon type
1828 subf #IC.DRIVE Drive? (special case)
1829 bne NormIcon No, do normal box
1830 leax -3,x Yes, smaller box
1831 bra Minus9 Go save X pos
1832
1833 NormIcon leax -9,X -9 to include text
1834 tst WD48FLAG If 40 column, bump down by another 14
1835 bne Minus9
1836 leax -16,x
1837 ldd FL.XSTRT,u Get original icon start again
1838 lsld Put column # in A
1839 lsld
1840 AdjLoop leax 2,x 2 pixels per column
1841 deca
1842 bne AdjLoop
1843 Minus9 ldd WNDWPATH Save X start & window path
1844 pshs d,X
1845 lbsr SETDPTR Set draw ptr to upper left corner of box
1846 * include text below icon as well
1847 ldd #36 Box height 36 pixels (2 above & below)
1848 tstf
1849 bne NormIco2
1850 ldd #24 Unless drive, then 24
1851 NormIco2 std 4,S
1852 tstf Drive?
1853 bne NormIco3 No, determine width
1854 ldb #29 Special width for drive
1855 bra DRAIFBO1
1856
1857 NormIco3 ldb #68 80 columns defaults to 68 pixel width
1858 tst WD48FLAG If 80 column skip ahead
1859 bne DRAIFBO1
1860 ldb #62 Box width 62 pixels for 40 column
1861 DRAIFBO1 std 2,S Save box width
1862 lbsr RBOX Draw box & return
1863 * use entry flag to flag whether
1864 tste Do we want shadow too?
1865 beq DoneAIFB No, exit
1866 ldb #1 Dark Grey color
1867 std 2,s
1868 lbsr FCOLOR
1869 clrb Set X offset to 0
1870 std 2,s
1871 lbsr RLINE Draw vertical line
1872 clrb Set Y offset to 0
1873 std 4,s
1874 tstf Drive?
1875 bne NormIco4 No
1876 ldb #28
1877 bra Do40Shdw
1878
1879 NormIco4 ldb #61 61 pixel width for 40 column
1880 tst WD48FLAG
1881 beq Do40Shdw
1882 ldb #67 67 pixel width for 80 column
1883 Do40Shdw std 2,s X offset
1884 lbsr RLINE Draw horizontal dark grey line
1885 DoneAIFB leas 6,S Eat stack & return
1886 rts
1887
1888 UPDTDEVC pshs U
1889 ldu #DRIVETBL
1890 ldx #21
1891 ldb #4
1892 pshs d,X
1893 ldx #1
1894 pshs X
1895 ldb WNDWPATH+1
1896 pshs d,X
1897 lbsr CWAREA
1898 lbsr MOUSOFF
1899 lbsr CLRSCRN
1900 lbsr FULLSCRN
1901 bra UPDTDEV2
1902
1903 UPDTDEV1 lbsr WRITICON Print icon on screen
1904 ldu FL.LINK,U Get next device in linked list
1905 UPDTDEV2 stu ,S Save it
1906 bne UPDTDEV1 Still more drives, do next one
1907 ldx #TRSHDESC Now, do trash can
1908 stx ,S
1909 lbsr WRITICON
1910 ldx #PRTRDESC And printer
1911 stx ,s
1912 lbsr WRITICON
1913 ldd DEVICNOW Get current drive (if any)
1914 std ,S
1915 lbsr SELCICON Select it on screen
1916 ldd WNDWPATH
1917 std ,S
1918 lbsr INITMOUS Set mouse parms
1919 leas 10,S
1920 puls U,PC
1921
1922 * Get ptr to root path (not including drive name)
1923 * Exit: X=ptr to either end of pathname (if on root), or ptr to root path
1924 * D=1 if on root
1925 * D=0 if found path
1926 FNDSLASH ldx #DDIRNAME+1 Point to full path of current dir (skip 1st '/')
1927 FNDSLAS1 ldb ,X+ Get char
1928 beq FNDSLAS2 End of path, exit with D=1
1929 cmpb #'/ Find slash?
1930 bne FNDSLAS1 No, keep looking
1931 clrb Exit with D=0
1932 bra FNDSLAS3
1933
1934 FNDSLAS2 incb
1935 FNDSLAS3 clra
1936 rts
1937
1938 * Check if icon (or clickable option)
1939 * Exit: D=0 if no icon selected
1940 * else D=ptr to FL.* structure for icon selected
1941 ISITICON pshs U
1942 ldx 4,S Get ptr to mouse packet
1943 ldd PT.ACY,X Get Y coord
1944 subd #8
1945 pshs d,X Save modified Y coord & room for X coord
1946 ldd PT.ACX,X Get X coord
1947 tst FLAG640W 640 wide screen?
1948 bne ISITICO1 No, skip ahead
1949 asrd Divide by 2 (scale to 320)
1950 ISITICO1 subd #8
1951 std 2,S Save modified X coord
1952 cmpd #32 Is X coord within 32 pixels of left side (no border)?
1953 ble ISITDEVC Yes, check for device (NOTE: WHERE PRINTER SHOULD GO)
1954 ldd ,S Get Y adjusted coord
1955 cmpd #8 Is it in the current directory bar area?
1956 bgt ISITDISP No, skip ahead
1957 ldu #DBOXDESC Point to icon info table entry for CLOSE box in current dir bar
1958 bra ISITICO4 Go check that
1959
1960 ISITDISP ldu STRTICON Get ptr to icon descriptor for 1st icon on current scrn
1961 bra ISITICO4 Check it
1962
1963 ISITDEVC ldu #DRIVETBL Point to start of device/drive table
1964 ldd ,S Get adjusted Y coord (NOTE: LDB 1,S BOTH 6809/6309)
1965 cmpb #128 From 0-128 (drives themselves)?
1966 blo ISITICO4 Yes, check with drive table entries
1967 cmpb #160 Trash?
1968 blo TryPrntr No, try printer
1969 ldu #TRSHDESC Try the trash can descriptor
1970 bra ISITICO4
1971
1972 TryPrntr ldu #PRTRDESC Try printer descriptor
1973 bra ISITICO4
1974
1975 ISITICO2 ldd 2,S Get X coord
1976 cmpd FL.XSTRT,U Within X start coord of current file table entry?
1977 blt ISITICO3 No, check next file entry
1978 cmpd FL.XEND,U Within X end coord of current entry?
1979 bgt ISITICO3 No, check next file entry
1980 ldd ,S Get Y coord
1981 cmpd FL.YSTRT,U Within Y start coord of current entry?
1982 blt ISITICO3 No, check next
1983 cmpd FL.YEND,U Within Y end coord of current entry
1984 bgt ISITICO3 No, check next
1985 tfr U,D Found, move table entry ptr to D & exit
1986 bra ISITICO5
1987
1988 * Go to next file table entry
1989 ISITICO3 ldu FL.LINK,U Get next file table ptr
1990 ISITICO4 stu -2,S Is this a legit ptr?
1991 bne ISITICO2 Yes, go check it
1992 clra No match, return with 0 (done, & no icon clicked)
1993 clrb
1994 ISITICO5 leas 4,S Eat stack & return
1995 puls U,PC
1996
1997 SET48X24 ldd #288
1998 std 14,S
1999 ldx #MULTIBFR Point to general purpose buffer
2000 stx 16,S
2001 ldb #7
2002 stb 9,S
2003 ldd #48
2004 std 10,S
2005 ldb 7,S
2006 orb #$80
2007 stb 7,S
2008 rts
2009
2010 SET24X24 ldd #144
2011 std 14,S
2012 ldx #ICONBUFR Point to icon build buffer
2013 stx 16,S
2014 ldb #6
2015 stb 9,S
2016 ldd #24
2017 std 10,S
2018 rts
2019
2020 * Load standard icons
2021 STDICONS leas -12,S Make temp buffer on stack
2022 ldx PRCIDNUM Get GSHELL's process id # (for group)
2023 ldd WNDWPATH Get GSHELL's window path
2024 pshs d,X Save them
2025 ldb #24 Save ??? (height in pixels?)
2026 std 10,S
2027 leax txticon,pc Point to new 4 color image of text
2028 ldb #144
2029 lbsr CopyIcon
2030 lbsr ICN48X24
2031 ldd #IC.TEXT
2032 std 4,S
2033 bsr SET24X24
2034 lbsr GPLOAD
2035 bsr SET48X24
2036 lbsr GPLOAD
2037
2038 leax foldricn,pc Point to new 4 color image of folder
2039 ldb #144
2040 lbsr CopyIcon
2041 lbsr ICN48X24
2042 ldb #IC.FOLDR
2043 std 4,S
2044 bsr SET24X24
2045 lbsr GPLOAD
2046 bsr SET48X24
2047 lbsr GPLOAD
2048
2049 leax execicon,pc Point to new 4 color image of executable
2050 ldb #144
2051 lbsr CopyIcon
2052 lbsr ICN48X24 Make double width version for 80 column screen
2053 ldb #IC.PRGRM
2054 std 4,S
2055 bsr SET24X24
2056 lbsr GPLOAD
2057 lbsr SET48X24
2058 lbsr GPLOAD
2059
2060 leax trashicn,pc Point to new 4 color image of trashcan
2061 ldb #144
2062 lbsr CopyIcon
2063 ldb #IC.TRASH
2064 std 4,S
2065 bsr SET24X24
2066 lbsr GPLOAD
2067 ldb #7
2068 stb 7,S
2069 ldb #IC.TRASH+$80
2070 stb 5,S
2071 lbsr GPLOAD
2072 lbsr SET24X24
2073
2074 leax driveicn,pc Point to new 4 color image of drive
2075 ldb #72
2076 lbsr CopyIcon
2077 ldd #72 72 bytes to load
2078 std 12,S
2079 ldb #12 12 lines high
2080 std 10,S
2081 ldb #IC.DRIVE Buffer #
2082 std 4,S
2083 lbsr GPLOAD Load it in
2084 ldb #7 Screen type 7
2085 stb 7,S
2086 ldb #IC.DRIVE+$80 Buffer #+$80 for type 7 version (useless, same as type 6)
2087 stb 5,S
2088 lbsr GPLOAD Load the type 7 version (eliminate later!)
2089
2090 leax prntricn,pc Point to new 4 color image of printer
2091 ldb #90 90 bytes to load/copy
2092 lbsr CopyIcon
2093 ldd #90 72 bytes to load
2094 std 12,S
2095 ldb #15 12 lines high
2096 std 10,S
2097 ldb #IC.PRNTR Buffer #
2098 std 4,S
2099 lbsr GPLOAD Load it in
2100 ldb #7 Screen type 7
2101 stb 7,S
2102 ldb #IC.PRNTR+$80 Buffer #+$80 for type 7 version (useless, same as type 6)
2103 stb 5,S
2104 lbsr GPLOAD Load the type 7 version (eliminate later!)
2105
2106 leas 16,S
2107 rts
2108
2109 * NOTE: XPNDICONS ROUTINE ORIGINALLY HERE...NO LONGER NEEDED
2110
2111 * duplicate a 24x12 4 color buffer to a 48x12
2112 ICN48X24 ldb #144 Counter for # of bytes in 4 color icon
2113 pshs B,U Save it
2114 ldx #ICONBUFR Point to 4 color icon buffer
2115 ldu #MULTIBFR Point to bigger buffer to expand into (could expand into LINEBUFR)
2116 IC48X24L ldb ,X+ Get 4 color byte
2117 bsr SR48X24 Expand 2 pixels (a nibble) into 4 pixels (a byte)
2118 bsr SR48X24 Do next last half of byte
2119 dec ,S Are we done all 144 source bytes?
2120 bne IC48X24L No, continue
2121 puls B,U,PC Restore & return
2122
2123 SR48X24 clra Zero out hi byte
2124 lslb Shift 1st color into B (2 bits)
2125 rola
2126 lslb
2127 rola
2128 lsla Now, shift that over 1 pixel
2129 lsla
2130 lslb Shift in the next pixel from the source byte
2131 rola
2132 lslb
2133 rola
2134 pshs A Save that byte (2 source pixels, now separated by a pixel)
2135 lsla Shift it left by a pixel
2136 lsla
2137 ora ,S+ Merge with original (effectively doubling each pixel)
2138 sta ,U+ Save doubled up byte
2139 rts
2140
2141 AIF.NAME fcc "aif"
2142
2143 ONEDOT fcb '.
2144 fcb NUL
2145
2146 * Entry: 0-1,s=RTS address
2147 * 2-3,s=Ptr to file table entry
2148 FILE.XXX pshs U
2149 ldu 4,S Get ptr to file table entry
2150 leas -64,S Make large buffer on stack
2151 clrd
2152 std 28,S
2153 ldd FL.FNAME,U Get ptr to filename
2154 pshs d
2155 lbsr ISIT.AIF
2156 std 28+2,S
2157 ldd 70+2,S
2158 std ,S
2159 lbsr MTCH.XXX
2160 leas 2,S
2161 std 22,S
2162 lbne FILEXXX3
2163 ldd 70,S
2164 pshs d
2165 leax <AIF.NAME,PC
2166 pshs X
2167 leax 38-2,S
2168 pshs X
2169 lbsr STRCPY
2170 leas 4,S
2171 pshs d
2172 lbsr STRCAT
2173 std 26+4,S
2174 ldx #READ.
2175 stx 2,S
2176 std ,S
2177 lbsr I.OPEN2 Open AIF file
2178 leas 4,S
2179 std 30,S Save path to AIF file
2180 lblt FILEXXX2 Couldn't open, skip ahead
2181 ldd 70,S
2182 pshs d
2183 lbsr PUTSTRNG
2184 std ID.XXXPT+2,S
2185 ldd 30+2,S Get path to AIF file
2186 std ,S
2187 lbsr RDLN80CH Read line of up to 80 chars (program name)
2188 std ,S Save size of read
2189 lbsr PUTSTRNG Allocate mem & copy string into that mem
2190 std ID.MNAME+2,S Save pointer to program name in AIF structure
2191 std 26+2,S Save again
2192 ldd 30+2,S Get path to AIF file again
2193 std ,S
2194 lbsr RDLN80CH Read parameters line
2195 std ,S Save size of read
2196 lbsr PUTSTRNG Allocate mem & copy string
2197 std ID.PARAM+2,S Save parm line
2198 ldd 30+2,S
2199 std ,S
2200 lbsr RDLN80CH Get icon file path
2201 std ,S Save # bytes read
2202 lbsr PUTSTRNG Allocate mem & copy string
2203 std 24+2,S
2204 ldd 30+2,S
2205 std ,S
2206 lbsr GETNUMBR Get memory modifier (in 256 byte pages) HANDLES +/-
2207 std ID.MEMSZ+2,S Save mem size
2208 lbsr GETNUMBR
2209 std ID.WTYPE+2,S Save window type (includes - & 0's!)
2210 lbsr GETNUMBR
2211 std ID.XSIZE+2,S Save minimum X size
2212 lbsr GETNUMBR
2213 std ID.YSIZE+2,S Save minimum Y size
2214 lbsr GETNUMBR
2215 std ID.BKGND+2,S Save background color
2216 lbsr GETNUMBR
2217 std ID.FRGND+2,S Save foreground color
2218 lbsr I.CLOSE Close the AIF file
2219 ldb #EXEC.+READ.
2220 std ,S
2221 ldd 26,S Get icon file path ptr
2222 pshs d
2223 lbsr I.OPEN2 Open icon file
2224 leas 4,S
2225 std 30,S Save path # to icon file
2226 blt FILEXXX1 Error opening, skip ahead
2227 ldd #144 Size of icon file
2228 pshs d
2229 ldx #ICONBUFR Point to buffer to hold icon data
2230 ldd 34-2,S Get path #
2231 pshs d,X Save them both
2232 lbsr I.READ Read in icon data
2233 ldd 30+6,S Get path # again
2234 std ,S
2235 lbsr I.CLOSE Close icon file
2236 ldd 24+6,S
2237 std ,S
2238 lbsr FREE
2239 ldd 70+6,S
2240 std ,S
2241 lbsr EXTICTBL Allocate a new AIF descriptor entry (ID.*)
2242 std 22+6,S Save ptr to new entry
2243 std ,S and again
2244 ldd #ID.SIZE Get size of ID.* structure
2245 std 4,S Save it
2246 leax 2+4,S
2247 stx 2,S
2248 lbsr STRNCPY ?? Copy stack copy of ID.* structure into allocated entry
2249 ldd NXTICONO,Y
2250 ldx 22+6,S
2251 std ,X
2252 incd
2253 std NXTICONO,Y
2254 clrd
2255 std ID.LINK,X
2256 ldd #24
2257 std ,S
2258 pshs d
2259 ldd [32-2,S]
2260 pshs d,X
2261 ldx PRCIDNUM
2262 ldd WNDWPATH
2263 pshs d,X
2264 lbsr SET24X24
2265 lbsr GPLOAD
2266 lbsr ICN48X24
2267 lbsr SET48X24
2268 lbsr GPLOAD
2269 leas 16,S
2270 bra FILEXXX2
2271
2272 FILEXXX1 ldd 14,S
2273 pshs d
2274 lbsr FREE
2275 ldd 18+2,S
2276 std ,S
2277 lbsr FREE
2278 ldd 24+2,S
2279 std ,S
2280 lbsr FREE
2281 leas 2,S
2282 FILEXXX2 ldd 30,S
2283 bge FILEXXX3
2284 clrd
2285 bra FILEXXX6
2286
2287 FILEXXX3 ldd 28,S
2288 beq FILEXXX4
2289 ldx 22,S
2290 ldd ID.MNAME,X
2291 pshs d
2292 pshs U
2293 lbsr RPLFICON
2294 leas 4,S
2295 tfr D,U
2296 ldd #IC.AIF.F
2297 stb FL.ICONO,U
2298 bra FILEXXX5
2299
2300 FILEXXX4 ldd #IC.F.XXX
2301 FILEXXX5 std 28,S
2302 ldd [22,S]
2303 stb FL.AIFNO,U
2304 ldd 28,S
2305 FILEXXX6 leas 64,S
2306 puls U,PC
2307
2308 * Allocate new ID.* descriptor
2309 * Exit:D=0 if could not allocate new descriptor
2310 * or D=ptr to where new descriptor is
2311 EXTICTBL pshs U
2312 ldd #ID.SIZE Size of ID.* structure (for AIF's)
2313 pshs d,X
2314 lbsr MEMSPACE Try to allocate memory for another ID.* entry
2315 leas 2,S
2316 std ,S Save ptr to where new ID.* entry will go
2317 std [IDSCNEXT,Y] ??? Save where process ID # is supposed to be???
2318 addd #ID.LINK offset to next link ptr within ID.* entry
2319 std IDSCNEXT Save as ptr to next available icon desc. link
2320 ldd ,S++ Get ptr to new entry
2321 puls U,PC Return with it
2322
2323 FIND.XXX ldx 2,S
2324 lbsr STREND1
2325 ldb #'.
2326 cmpb -4,X
2327 bne ISITAIF4
2328 leax -3,X
2329 tfr X,D
2330 rts
2331
2332 * Get a numeric input
2333 * Entry: Path # to read from on stack
2334 GETNUMBR ldd 2,S Get path to do read from
2335 pshs d
2336 lbsr RDLN80CH Go do 80 char readln
2337 std ,S Save # chars read
2338 beq GETNUMB1 If no characters read, exit
2339 lbsr ATOI Convert ASCII # to raw binary form
2340 GETNUMB1 leas 2,S
2341 rts
2342
2343 ISIT.AIF ldx 2,S
2344 ldd ,X++
2345 andd #$5f5f
2346 cmpd #"AI
2347 bne ISITAIF4
2348 ldd ,X
2349 anda #$5F
2350 cmpd #"F.
2351 beq ISITAIF5
2352 ISITAIF4 clra
2353 clrb
2354 ISITAIF5 rts
2355
2356 MTCH.XXX pshs X,U
2357 ldu 6,S
2358 ldx IDSCSPTR
2359 leax ID.SIZE*2,X
2360 ldx ID.LINK,X
2361 beq MTCH.XX2
2362 MTCH.XX1 ldd ID.XXXPT,X
2363 pshs d,U
2364 lbsr STRCMP
2365 leas 4,S
2366 std -2,S
2367 beq MTCH.XX2
2368 ldx ID.LINK,X
2369 bne MTCH.XX1
2370 MTCH.XX2 tfr X,D
2371 puls X,U,PC
2372
2373 * Entry: 0-1,s : RTS address
2374 * 2-3,s : AIF entry # (anything lower than IC.XTRNL is internal AIF's
2375 * only, such as GCALC, etc.)
2376 * Exit: D=ptr to ID.* structure that matches
2377 * D=0 if no match found
2378 FNDIDESC pshs U
2379 ldd 4,S Get AIF entry # for ID.* structure (only need B)
2380 ldu IDSCSPTR Get ptr to start of icon descriptor table
2381 FNDIDES1 cmpb ID.NUMBR+1,U Is this the correct ID.* entry?
2382 beq FNDIDES2 Yes, skip ahead
2383 ldu ID.LINK,U Get ptr to next ID.* entry
2384 bne FNDIDES1 Go check it out
2385 bra FNDIDES5 Hit end of list, no match so exit with ptr=0
2386
2387 FNDIDES2 cmpb #IC.XTRNL Is this an external AIF?
2388 bge FNDIDES5 Yes, exit
2389 cmpb #IC.GCAL Is it the calender program?
2390 bne FNDIDES3 No, use GSHELL's current window type
2391 * ADDED FOR GCAL - to allow it on an 80 column screen
2392 ldd DEFWTYPE Get current GSHELL window type
2393 cmpd #8 Is it a 16 color?
2394 bne FNDIDES4 No, allow GSHELL window type
2395 ldd #6 Force GCAL to use type 6 (320x200x4)
2396 bra FNDIDES4
2397
2398 FNDIDES3 ldd DEFWTYPE Use default window type (GShell's actual type)
2399 FNDIDES4 std ID.WTYPE,U Save as AIF's window type
2400 FNDIDES5 tfr U,D D=ptr to AIF entry found
2401 puls U,PC
2402
2403 * Kill icon Get/put buffer, free up table entry???
2404 KILIBUFS pshs U
2405 ldu IDSCSPTR
2406 leau ID.SIZE*3,U
2407 ldd ID.LINK,U
2408 pshs d
2409 clra
2410 clrb
2411 std ID.LINK,U
2412 bra KILIBUF2
2413
2414 KILIBUF1 ldd ID.LINK,U
2415 std ,S
2416 ldd ID.NUMBR,U
2417 pshs d
2418 ldd PRCIDNUM
2419 pshs d
2420 ldd WNDWPATH
2421 pshs d
2422 lbsr KILBUF
2423 ldb 5,S
2424 orb #$80
2425 stb 5,S
2426 lbsr KILBUF
2427 ldd ID.MNAME,U
2428 std ,S
2429 lbsr FREE
2430 ldd ID.XXXPT,U
2431 std ,S
2432 lbsr FREE
2433 ldd ID.PARAM,U
2434 std ,S
2435 lbsr FREE
2436 stu ,S
2437 lbsr FREE
2438 leas 6,S
2439 KILIBUF2 ldu ,S
2440 bne KILIBUF1
2441 ldd #IC.XTRNL
2442 std NXTICONO,Y
2443 ldx #ENDLINK
2444 stx IDSCNEXT
2445 puls d,U,PC
2446
2447 PUTSTRNG ldd 2,S
2448 pshs d
2449 lbsr STRLEN
2450 addd #1
2451 std ,S
2452 bsr MEMSPACE
2453 std ,S++
2454 beq PUTSTRNX
2455 ldx 2,S
2456 pshs d,X
2457 lbsr STRCPY
2458 leas 4,S
2459 PUTSTRNX rts
2460
2461 * Allocate memory from internal data area?
2462 * Entry: # bytes requested at 0,s
2463 * Exit: appears to be ptr to start of memory received, or 0 if couldn't get
2464 * memory requested
2465 MEMSPACE ldd 2,S Get size of memory requested
2466 pshs d
2467 lbsr MALLOC Allocate it
2468 std ,S Save ptr to memory received
2469 bne MEMSPAC1 Successful MALLOC, exit with new mem ptr
2470 leax <OUTOFMEM,PC Unsuccesfull, print 'Out of memory" in overlay window
2471 pshs X
2472 lbsr OLAYPRNT
2473 leas 2,S
2474 MEMSPAC1 puls d,pc Return with ptr
2475
2476 OUTOFMEM fcc "Out of memory"
2477 CRETURN fcb CR,NUL
2478
2479 * See if all forked processes shut down before we exit
2480 * Exit: D=-1 if still active processes
2481 *
2482 TESTQUIT pshs U
2483 ldu PTBLSPTR Get ptr to start of linked list of process descriptors
2484 beq TSTQUIT3 No entries
2485 TSTQUIT1 ldx GD.LINK,U
2486 ldd GD.STATS,U
2487 bge TSTQUIT2
2488 leax <STILACTV,PC Print "processes still active" in overlay window
2489 pshs X
2490 lbsr OLAYPRNT
2491 leas 2,S
2492 ldd #-1 Flag we can't exit GSHELL yet
2493 TSTQUIT3 puls U,PC
2494
2495 TSTQUIT2 tfr X,U
2496 stu -2,S
2497 bne TSTQUIT1
2498 puls U,PC
2499
2500 TRYQUIT pshs U
2501 ldx #1
2502 ldb WNDWPATH+1
2503 pshs d,X
2504 lbsr PAUSECHO Set pause & echo ON
2505 lbsr CURSORON Turn text cursor ON
2506 lbsr ST.RELEA Release any pending signals
2507 lbsr KILLPBUF
2508 clr 3,S
2509 lbsr NOMOUSE Shut mouse autofollow off
2510 lbsr ST.WNSET
2511 clrb
2512 pshs d
2513 lbsr SELECT
2514 leas 2,S
2515 lbsr I.CLOSE
2516 leas 4,S
2517 ldd 4,S
2518 blt TRYQUIT4
2519 pshs d
2520 lbsr F.EXIT
2521 TRYQUIT4 clra
2522 clrb
2523 puls U,PC
2524
2525 STILACTV fcc "Processes still active"
2526 fcb NUL
2527
2528 ERRPRINT pshs U
2529 ldu 6,S
2530 ldd GD.WPATH,U Get process window path
2531 cmpd WNDWPATH Same as GSHELL window path?
2532 ble ERRPRIN1
2533 pshs d
2534 lbsr SELECT
2535 ldd WNDWPATH
2536 std ,S
2537 lbsr SELECT
2538 leas 2,S
2539 ERRPRIN1 ldd GD.STATS,U Get last status (error) from program
2540 pshs d
2541 ldx GD.MNAME,U Get ptr to module name that had error
2542 ldd 6,S
2543 pshs d,X
2544 bsr BUILDMSG
2545 leas 6,S
2546 puls U,PC
2547
2548 BUILDMSG ldd 6,S
2549 pshs d
2550 lbsr BIN2ASCI
2551 std ,S
2552 leax <QUOTDASH,PC
2553 pshs X
2554 ldx 8,S
2555 ldd 6,S
2556 pshs d,X
2557 ldx #MULTIBFR
2558 pshs X
2559 lbsr STRCPY
2560 leas 4,S
2561 pshs d
2562 lbsr STRCAT
2563 leas 4,S
2564 pshs d
2565 lbsr STRCAT
2566 leas 4,S
2567 pshs d
2568 lbsr STRCAT
2569 leas 4,S
2570 pshs d
2571 bsr OLAYPRNT
2572 leas 2,S
2573 rts
2574
2575 QUOTDASH fcb '"
2576 fcc " - "
2577 fcb NUL
2578
2579 OLAYPRNT ldx #1
2580 ldd 2,S
2581 pshs d,X
2582 ldd WNDWPATH
2583 pshs d
2584 lbsr OLAYGNBK
2585 bsr WAITPRES
2586 lbsr KILOLAY2
2587 bra OLAYPRN1
2588
2589 * Write out a string to the current window path (string length determined by
2590 * NUL char)
2591 * Entry: 0-1,s = RTS address
2592 * 2-3,s = ptr to string to write
2593 WTSTRLEN ldd 2,S Get ptr to string to write
2594 pshs d
2595 lbsr STRLEN Determine length
2596 std ,S Save it
2597 ldx 4,S
2598 ldd WNDWPATH Get path to window
2599 pshs d,X
2600 lbsr I.WRITE Write it out
2601 OLAYPRN1 leas 6,S Eat temp stack & return
2602 rts
2603
2604 * Write out a string to the current window path (string length determined by
2605 * NUL char) and add a Carriage return if there isn't one already
2606 * Entry: 0-1,s = RTS address
2607 * 2-3,s = ptr to string to write
2608 WRLNWCR pshs Y,U
2609 ldd 6,S Get ptr to string
2610 pshs d
2611 lbsr STREND Get end position of string
2612 tfr D,U
2613 subd ,S++ Calculate size of string
2614 tfr D,Y
2615 ldx 6,S Get ptr to string again
2616 lda WNDWPATH+1 Get window path
2617 os9 I$WRITLN Write it
2618 ldb -1,U Was last char a CR?
2619 cmpb #CR
2620 beq WRLNWCRX Yep, done
2621 ldy #1 No, write a CR too
2622 leax CRETURN,PC
2623 os9 I$WRITLN
2624 WRLNWCRX puls Y,U,PC
2625
2626 WAITPRES pshs U
2627 ldu 4,S
2628 pshs U
2629 lbsr ST.RELEA
2630 ldd #NEWNMSG-PRESSMSG
2631 std ,S
2632 ldx #PRESSMSG
2633 pshs X
2634 pshs U
2635 lbsr I.WRITE
2636 leas 6,S
2637 lbsr WAITPSIG
2638 puls U,PC
2639
2640 * ReadLn up to 80 chars into [LINEBUFR]
2641 RDLN80CH ldd #80 Max read size
2642 pshs d
2643 ldx #LINEBUFR Get ptr to read buffer
2644 ldd 4,S Get path to read from
2645 pshs d,X
2646 lbsr I.READLN Read line up to 80 chars (note:includes CR!)
2647 leas 6,S
2648 addd #1 Add 1 to total of chars read
2649 beq RDLN80C0 If was -1 (had error),try reading again
2650 subd #2 Just CR?
2651 bne RDLN80C1 No, skip ahead
2652 RDLN80C0 clr LINEBUFR,Y If just one char, NUL instead of CR
2653 rts
2654
2655 RDLN80C1 ldx #LINEBUFR Point to input buffer
2656 pshs X
2657 leax D,X Point to last char read in buffer
2658 clr ,X Terminate read string @ CR
2659 puls D,PC Return with D=ptr to start of read buffer
2660
2661 BIN2ASCI pshs U
2662 ldu #ASCIITMP Point to buffer to hold ASCII version of # (reverse order)
2663 ldd 4,S
2664 bra BIN2ASC2
2665
2666 BIN2ASC1 pshs d
2667 ldd #10
2668 lbsr CCMOD
2669 addd #'0 'ASCII'ize the digit
2670 stb ,U+
2671 ldd 4,S
2672 pshs d
2673 ldd #10
2674 lbsr CCDIV
2675 std 4,S
2676 BIN2ASC2 cmpd #9
2677 bgt BIN2ASC1
2678 addd #'0
2679 ldx #ASCIITMP
2680 pshs X
2681 ldx #ASCIINUM
2682 bra BIN2ASC4
2683
2684 BIN2ASC3 ldb ,-U
2685 BIN2ASC4 stb ,X+
2686 cmpu ,S
2687 bhi BIN2ASC3
2688 leas 2,S
2689 clr ,X
2690 ldx #ASCIINUM
2691 tfr X,D
2692 puls U,PC
2693
2694 LINKLOAD pshs U
2695 ldu 4,S
2696 ldb #PTR.SLP Change ptr to sleep icon
2697 pshs d,X
2698 ldx #GRP.PTR
2699 ldd WNDWPATH
2700 pshs d,X
2701 lbsr GCSET
2702 lbsr MOUSOFF Shut mouse off
2703 leas 6,S
2704 pshs U
2705 lbsr NMLNKLOD Attempt to link/load module
2706 std ,S++
2707 beq LINKLOA1 Error, deal with it
2708 ldd #1 No error, status=successful
2709 bra LINKLOA2
2710
2711 LINKLOA1 ldd ERRNO,Y Get error code
2712 std GD.STATS,U Save in forked program status
2713 leax <CANTFORK,PC Tell user we could not fork program
2714 pshs X,U
2715 lbsr ERRPRINT
2716 leas 4,S
2717 clra Non successful fork
2718 clrb
2719 LINKLOA2 std ,S Save status of fork
2720 lbsr MOUSENOW Turn mouse back on and return
2721 puls d,U,PC
2722
2723 CANTFORK fcc "Can't fork "
2724 fcb '",NUL
2725
2726 RUNCNAME fcc "runc"
2727 fcb NUL
2728
2729 RUNBNAME fcc "runb"
2730 fcb NUL
2731
2732 BAS09NAM fcc "basic09"
2733 fcb NUL
2734
2735 * Fork program pointed to by GD.* ptr, onto it's proper window (obviously
2736 * already set up in GD.INDVC or GD.WPATH earlier). Does language stuff
2737 * automatically like SHELL, and mem size stuff
2738 * Stack on entry:
2739 * 0-1,s = RTS address
2740 * 2-3,s = Ptr to GD.* vars
2741 FORKPROC pshs U Save U
2742 ldu 4,S Get GD.* ptr
2743 leas -12,S Make temp stack
2744 clra
2745 clrb
2746 std 10,S Set some things to 0
2747 std 8,S
2748 std ,S
2749 ldb GD.MLANG,U Get language type of module to fork
2750 cmpb #OBJCT ML code?
2751 ble SETPRGRM Yes, go set
2752 cmpb #ICODE RUNB required?
2753 beq SETRUNB Yes, set that
2754 cmpb #PCODE Pascal required?
2755 beq SETPASCL Yes, set that
2756 cmpb #CBLCODE COBOL required?
2757 bne BADLANG No, don't have a clue what it is
2758 leax <RUNCNAME,PC Must be RUNC (whatever that is?)
2759 stx 10,S Save ptr to runtime module name
2760 bra SETLANG
2761
2762 SETRUNB leax <RUNBNAME,PC Set ptr to RUNB module name
2763 stx 10,S
2764 leax <BAS09NAM,PC 2nd ptr to BASIC09
2765 bra SETRUNB1
2766
2767 SETPASCL leax <PASCSNAM,PC Set ptr to PASCALS module name
2768 stx 10,S
2769 leax <PASCNNAM,PC 2nd ptr to PASCALN
2770 SETRUNB1 stx 8,S
2771 bra SETLANG
2772
2773 PASCSNAM fcc "pascals"
2774 fcb NUL
2775
2776 PASCNNAM fcc "pascaln"
2777 fcb NUL
2778
2779 BADLANG leax <CANTLANG,PC Code type is unknown, notify user that we can
2780 pshs X not run.
2781 lbsr OLAYPRNT
2782 leas 2,S
2783 clra
2784 clrb
2785 lbra BADLANGX
2786
2787 CANTLANG fcc "Can't determine language"
2788 fcc " for module"
2789 fcb CR,NUL
2790
2791 * Entry: 10,s=ptr to runtime module
2792 * X=ptr to 2ndary module (if needed) ex. BASIC09 for RUNB
2793 SETLANG ldd #$0101 Module type=Program module, language=ML
2794 std GD.MTYPE,U Save module type&language of primary program to execute
2795 SETPRGRM ldd 10,S Get ptr to name of primary program
2796 beq FORKPRC2 If raw ML module (no runtime package), skip ahead
2797 ldd GD.MNAME,U Get ptr to sub-module name (ex. program name for RUNB)
2798 pshs d Save it
2799 lbsr STPREFIX Build (into PARMSBFR) program name <space> module name
2800 leas 2,S Eat stack
2801 ldd 10,S Get ptr to name of primary program
2802 bra FORKPRC3
2803
2804 FORKPRC2 ldd GD.MNAME,U Get ptr to module to run
2805 FORKPRC3 std 6,S Save it
2806 ldx #PARMSBFR Point to temp buffer
2807 pshs X Save it
2808 lbsr STRLEN Get length of command line to run
2809 leas 2,S Eat stack
2810 std 2,S Save length
2811 beq FORKPRC4 If 0, just put a CR in it
2812 addd #-1 Dec length by 1 (space on end?)
2813 ldx #PARMSBFR Point to start of command line
2814 leax D,X Point to end of it
2815 ldd #CR*256 Append a CR/NUL to it
2816 std ,X
2817 bra FORKPRC5
2818
2819 FORKPRC4 ldd #CR*256 Nothing in command buffer, just put CR/NUL in
2820 std PARMSBFR,Y
2821 FORKPRC5 ldd 2,S Get length of command line to run
2822 addd #1 bump up by 1 & save it again
2823 std 2,S
2824 pshs U
2825 lbsr NEWSTDIO Change I/O paths (all 3) to window path in current GD.* ptr
2826 std ,S++ Were we successful?
2827 beq FORKPRC7 No, skip ahead
2828 clra Select std IN path as current window (in other words,
2829 clrb select GD.* path as new window
2830 pshs d
2831 lbsr SELECT
2832 ldd GD.MEMSZ,U Get memory size required
2833 std ,S Save it
2834 clra
2835 clrb
2836 pshs d
2837 pshs d
2838 ldx #PARMSBFR Point to parms buffer
2839 ldd 8,S
2840 pshs d,X
2841 ldd 16,S
2842 pshs d
2843 lbsr F.FORK Fork the program
2844 std 16,S
2845 ble FORKPR51
2846 leas 12,S
2847 bra FORKPRC6
2848
2849 FORKPR51 ldd 20,S
2850 bne FORKPR52
2851 leas 12,S
2852 bra FORKPRC7
2853
2854 FORKPR52 std ,S
2855 lbsr F.FORK
2856 leas 12,S
2857 std 4,S
2858 ble FORKPRC7
2859
2860 FORKPRC6 ldd 4,S
2861 std GD.PRCID,U
2862 ldd #1
2863 std ,S
2864
2865 * Couldn't change std paths to new window
2866 FORKPRC7 ldd GD.MNAME,U Get ptr to module name
2867 pshs d Save it
2868 lbsr F.UNLOAD Unload the module
2869 leas 2,S Eat stack
2870 ldd ,S ???
2871 bne FORKPRC8 But don't print FORK ERROR if it is<>0
2872 ldd ERRNO,Y Get error code
2873 std GD.STATS,U Save as last status for forked program
2874 leax <FORKERR,PC Report FORK error in overlay window
2875 pshs X,U
2876 lbsr ERRPRINT
2877 leas 4,S
2878 FORKPRC8 clr PARMSBFR,Y NUL the command buffer
2879 pshs U
2880 lbsr RESTDIO Restore std I/O paths to normal GSHELL window path
2881 leas 2,S
2882 ldd ,S Get ???
2883 BADLANGX leas 12,S Eat stack & return
2884 puls U,PC
2885
2886 FORKERR fcc "Fork error - "
2887 fcb '",NUL
2888
2889 * Call F$Wait. If no child process, returns immediately.
2890 * Otherwise, returns with child ID # & child exit status code)
2891 * Stack usage (from -6,s):
2892 * 0,s = ???
2893 * 2,s = Child process ID #
2894 * 4,s = Child process signal code
2895 * NOTE: IF child is ABORTED (CTRL-E), GSHELL's keyboard buffer is cleared.
2896 * IF child is INTERRUPTED, GSHELL's keyboard buffer is left intact.
2897 HNDLWAIT pshs U
2898 leas -6,S Temp stack
2899 clra Default child status code to 0
2900 clrb
2901 std 4,S
2902 HNDLWAI1 leax 4,S Point to temp ID/exit status
2903 pshs X Save ptr for subroutine call
2904 lbsr F.WAIT NOTE: ONLY CALLED FROM HERE! EMBED (6809 &6309)
2905 leas 2,S Eat temp X ptr
2906 std 2,S Save child process' ID #
2907 beq HNDLWAI2 None, eat temp stack & return
2908 cmpd #-1 Error from F$Wait?
2909 beq HNDLWA10 Yes, return with exit signal=0 (no signal)
2910 ldd RECDSGNL Did get child signal; try local signal
2911 beq HNDLWAI3 None, process child signal
2912 HNDLWAI2 ldd #S$WAKE Exit with WAKE signal (flag to redo signal loop)
2913 bra HNDLWA12
2914
2915 * Child process has sent us a signal
2916 HNDLWAI3 ldd 2,S Get child process ID #
2917 pshs d Save on stack (silly, unless destructive)
2918 bsr GTPRDESC Get our process descriptor table entry ptr
2919 tfr D,U Move to U
2920 stu ,S++ Legit?
2921 beq HNDLWA11 No, if signal=0, try WAIT again, else exit
2922 ldd 4,S Get child's signal code
2923 std ERRNO,Y Save as error
2924 std GD.STATS,U Save as last status for forked program
2925 beq HNDLWAI8 If child's signal was 0, skip ahead
2926 cmpb #S$ABORT Abort signal?
2927 beq HNDLWAI4 yes, go handle
2928 cmpb #S$INTRPT Interrupt signal?
2929 bne HNDLWAI7 Yes, go handle
2930 * Child ABORTed (CTRL-E)
2931 HNDLWAI4 clrb D=0
2932 pshs d
2933 ldd GD.WPATH,U Get programs window path
2934 pshs d
2935 lbsr PAUSECHO Shut pause & echo off for that window
2936 leas 4,S Eat temp stack
2937 bra HNDLWAI6
2938
2939 * Flush out keyboard buffer for main GSHELL window
2940 HNDLWAI5 pshs d Save # of chars in main window buffer
2941 ldx #MULTIBFR Point to temp buffer area
2942 ldd WNDWPATH Get window path for GSHELL
2943 pshs d,X
2944 lbsr I.READ Read (eat/flush) all chars in keyboard buffer for GSHELL
2945 leas 6,S Eat temp stack
2946 HNDLWAI6 ldd WNDWPATH Get path to GSHELL window
2947 pshs d
2948 lbsr GT.READY Check if any data ready in keyboard buffer
2949 leas 2,S
2950 std ,S Save # chars waiting
2951 bgt HNDLWAI5 There are some, process
2952 * Child INTERRUPTed (CTRL-C)
2953 HNDLWAI7 leax <PROCERR,PC Point to 'process error' msg
2954 pshs X,U
2955 lbsr ERRPRINT Print error to screen
2956 leas 4,S
2957 HNDLWAI8 ldd GD.DW.OW,U Child running on overlay window in main GSHELL scrn?
2958 cmpd #1
2959 beq HNDLWAI9 Yes, Skip ahead
2960 pshs U No, save ptr to Process dsc. entry
2961 lbsr KILPDESC Remove process descriptor out of table, kill device window
2962 leas 2,S
2963 HNDLWAI9 cmpu 10,S Current process desc. entry ptr same as ???
2964 bne HNDLWA11
2965 HNDLWA10 clra Return with D=0 (no signal)
2966 clrb
2967 bra HNDLWA12
2968
2969 * If signal received not for any child of ours (done directly from GSHELL)
2970 * ,exit with D=0, else redo WAIT and try again (could this be 'infinite'
2971 * loop bug where sometimes just auto-follow mouse works, but nothing else?
2972 HNDLWA11 ldd 4,S Get child's signal code
2973 lbeq HNDLWAI1 If none, redo WAIT call & try again
2974 HNDLWA12 leas 6,S Eat temp stack & return
2975 puls U,PC
2976
2977 PROCERR fcc "Process error - "
2978 fcb '",NUL
2979
2980 * Exit: D=0 if no child processes in table
2981 * D=ptr to process descriptor table entry
2982 GTPRDESC ldx PTBLSPTR Get ptr to start of process descriptor table
2983 beq GTPRDES3 None, exit
2984 GTPRDES1 ldd GD.PRCID,X Get process id # for current table entry
2985 cmpd 2,S This the one we are looking for?
2986 bne GTPRDES2 No, skip to next one
2987 tfr X,D Exit with D=process table entry ptr
2988 rts
2989
2990 GTPRDES2 ldx GD.LINK,X Get ptr to next process in table
2991 bne GTPRDES1 got one, check it
2992 GTPRDES3 clra End of table, exit with D=0
2993 clrb
2994 rts
2995
2996 * Add a string prefix to the current string
2997 * Entry: 0-1,s = RTS address
2998 * 2-3,s = String that we are inserting in front of
2999 STPREFIX pshs U Preserve U
3000 ldd 4,S Get ptr to string we are inserting in front of
3001 pshs d,X,Y Save it & regs
3002 lbsr STRLEN Get length of string we are inserting in front of
3003 * NOTE: WHEN TFM'ING BELOW, DELETE ADDD #1
3004 addd #1
3005 std 4,S Save length of string+1
3006 ldu #PARMSBFR Point to temp buffer
3007 stu ,S Save ptr
3008 lbsr STRLEN Get length of string in temp buffer
3009 leas 2,S Eat stack
3010 * WHEN TFMING BELOW, DELETE INCB
3011 incb Bump length up by 1
3012 * 6309
3013 * tfr d,w Save length
3014 * addr w,u Point to end of string+1
3015 * DELETE LDA 1,S BELOW
3016
3017 std ,S Save it
3018 leau D,U Point to end of string+1
3019 tfr U,X Save ptr in X
3020 ldd 2,S Get length of string we are inserting in front of
3021 leau D,U Calculate end ptr of two strings together
3022 lda 1,S Get # of bytes to move (size of inserted string)
3023 bra STPREFX2
3024
3025 * 6309 - DELETE ABOVE BRA STPREFX2
3026 * NOTE THAT DELETING INCB & ADDD #1 ABOVE IS BECAUSE TFM IS _POST_ DECREMENT,
3027 * WHILE ORIGINAL ,-X IS _PRE_DECREMENT
3028 * NOTE: 6309 ONLY: CHANGE TO TFM
3029 * tfm x-,u-
3030 * Copy string we are inserting in front of further ahead in buffer to make
3031 * room for inserted string
3032 STPREFX1 ldb ,-X Get char from 1st string
3033 stb ,-U Append in 2nd
3034 STPREFX2 deca Dec # bytes left
3035 bge STPREFX1 Still some left continue copying
3036 ldx 8,S Get ptr to another string
3037 ldu #PARMSBFR Point to start of temp buffer
3038 bra STPREFX4
3039
3040 STPREFX3 ldb ,X+ Copy char from string to temp buffer
3041 stb ,U+
3042 STPREFX4 ldb ,X Get char from string
3043 bne STPREFX3 Not end of string, copy character
3044 ldd #SPACE A=0, B=Space char
3045 stb ,U Add space char
3046 leas 4,S Eat stack & return
3047 puls U,PC
3048
3049 * Change all 3 standard I/O paths to path pointed to by current program
3050 * table entry (GD.*) (or WNDWPATH if GD.WPATH is negative & there is no
3051 * ptr to a pathname in GD.INDVC)
3052 * Entry: 0-1,s = RTS address
3053 * 2-3,s = Ptr to current entry in GD.* table
3054 NEWSTDIO pshs U
3055 ldu 4,S Get GD.* ptr
3056 lda GD.WPATH+1,U Get path # to window program is/will be running on.
3057 bgt NEWSTDI1 If positive value, skip ahead
3058 lda WNDWPATH+1 If negative, use GSHELL window path
3059 NEWSTDI1 pshs A Save new window path #
3060 clra Close current input/output/error paths
3061 os9 I$CLOSE
3062 inca
3063 os9 I$CLOSE
3064 inca
3065 os9 I$CLOSE
3066 ldx GD.INDVC,U Get ptr to new window's path NAME
3067 beq NEWSTDI2 None, use path # on stack
3068 lda #READ. There is a path name, OPEN a READ path to it
3069 os9 I$OPEN & use it's path # for new std i/o paths
3070 bra NEWSTDI3
3071
3072 NEWSTDI2 lda ,S Get new window's path # from stack
3073 os9 I$DUP Duplicate new path as std in
3074 NEWSTDI3 bcs NEWSTDI4
3075 lda ,S and std out
3076 os9 I$DUP
3077 bcs NEWSTDI4
3078 lda ,S and std err
3079 os9 I$DUP
3080 bcs NEWSTDI4
3081 puls A eat copy of new path #
3082 ldd #1 D=1 if new std i/o paths created successfully
3083 puls U,PC
3084
3085 NEWSTDI4 leas 1,S Eat stack
3086 clra Exit with D=0 if could not create new paths
3087 clrb
3088 puls U,PC
3089
3090 * Restore std I/O paths to normal GSHELL path
3091 RESTDIO clra Close std in/out/error paths
3092 os9 I$CLOSE
3093 inca
3094 os9 I$CLOSE
3095 inca
3096 os9 I$CLOSE
3097 lda WNDWPATH+1 Duplicate normal GSHELL window paths to std i/o
3098 os9 I$DUP
3099 lda WNDWPATH+1
3100 os9 I$DUP
3101 lda WNDWPATH+1
3102 os9 I$DUP
3103 rts
3104
3105 EXTFITBL pshs U
3106 ldd 4,S
3107 pshs d
3108 lbsr STRLEN
3109 addd #FL.SIZE+1
3110 std ,S
3111 lbsr MEMSPACE
3112 leas 2,S
3113 tfr D,U
3114 stu -2,S
3115 beq EXTFITB1
3116 leax FL.SIZE,U
3117 stx FL.FNAME,U
3118 ldd 4,S
3119 pshs d
3120 pshs X
3121 lbsr STRCPY
3122 leas 4,S
3123 inc FILESCTR+1
3124 bne EXTFITB1
3125 inc FILESCTR
3126 EXTFITB1 tfr U,D
3127 puls U,PC
3128
3129 UPDTIPTR ldd 2,S
3130 pshs d
3131 bsr EXTFITBL
3132 std ,S
3133 beq UPDTIPT1
3134 std [FTBLNEXT,Y]
3135 tfr D,X
3136 clra
3137 clrb
3138 std FL.LINK,X
3139 std FL.ICONO,X
3140 lbsr ICNXYSET
3141 leax FL.LINK,X
3142 stx FTBLNEXT
3143 UPDTIPT1 puls d,PC
3144
3145 ADDFICON ldd 2,S
3146 pshs d
3147 bsr UPDTIPTR
3148 std ,S
3149 beq ADDFICO3
3150 ldb 7,S
3151 cmpb #IC.AIF.F
3152 beq ADDFICO1
3153 cmpb #IC.F.XXX
3154 bne ADDFICO2
3155 ADDFICO1 bsr ISIT.XXX
3156 ADDFICO2 ldx ,S
3157 stb FL.ICONO,X
3158 bsr UPDTNSCR
3159 ADDFICO3 puls d,PC
3160
3161 UPDTNSCR ldd FILESCTR
3162 subd #1
3163 pshs d
3164 ldd MAXICONS
3165 lbsr CCDIV
3166 std NSCREENS
3167 rts
3168
3169 ISIT.XXX pshs U
3170 ldu 4,S
3171 ldd FL.FNAME,U
3172 pshs d
3173 lbsr FIND.XXX
3174 std ,S++
3175 beq ISITXXX1
3176 pshs d
3177 pshs U
3178 lbsr FILE.XXX
3179 leas 4,S
3180 std -2,S
3181 beq ISITXXX1
3182 puls U,PC
3183
3184 ISITXXX1 incb
3185 puls U,PC
3186
3187 RPLFICON pshs U
3188 ldd 6-2,S
3189 pshs d,X
3190 bsr SRCHFTBL
3191 std 2,S
3192 ldd 8+2,S
3193 std ,S
3194 lbsr EXTFITBL
3195 tfr D,U
3196 ldd #FL.FNAME
3197 std ,S
3198 ldd 8,S
3199 pshs d
3200 pshs U
3201 lbsr STRNCPY
3202 leas 6,S
3203 ldx 6,S
3204 cmpx STRTICON
3205 bne RPLFICOX
3206 stu STRTICON
3207 RPLFICOX ldx FL.LINK,X
3208 bne RPLFICO1
3209 leax FL.LINK,U
3210 stx FTBLNEXT
3211 RPLFICO1 ldx ,S
3212 bne RPLFICO2
3213 stu FTBLSPTR
3214 bra RPLFICO3
3215
3216 RPLFICO2 stu FL.LINK,X
3217 RPLFICO3 ldd 6,S
3218 pshs d
3219 lbsr FREE
3220 ldd FILESCTR
3221 subd #1 NOTE: 6309 DECD
3222 std FILESCTR
3223 bsr UPDTNSCR
3224 tfr U,D
3225 leas 4,S
3226 puls U,PC
3227
3228 RMVFICON pshs U
3229 ldx 4,S
3230 ldu FL.LINK,X
3231 pshs X
3232 bsr SRCHFTBL
3233 std ,S
3234 stu -2,S
3235 bne RPLFICO1
3236 ldd ,S
3237 bne RMVFICO1
3238 leax <FTBLSPTR,Y
3239 stx FTBLNEXT
3240 bra RPLFICO1
3241
3242 RMVFICO1 addd #FL.LINK
3243 std FTBLNEXT
3244 bra RPLFICO1
3245
3246 SRCHFTBL clra
3247 clrb
3248 pshs d
3249 ldx FTBLSPTR
3250 SRCHFTB1 cmpx 4,S
3251 bne SRCHFTB2
3252 puls d,PC
3253
3254 SRCHFTB2 stx ,S
3255 ldx FL.LINK,X
3256 bne SRCHFTB1
3257 clra
3258 clrb
3259 rts
3260
3261 KILLFTBL pshs d,U
3262 ldu FTBLSPTR
3263 bra KILLFTB2
3264
3265 KILLFTB1 ldu FL.LINK,U
3266 lbsr FREE
3267 KILLFTB2 stu ,S
3268 bne KILLFTB1
3269 leax <FTBLSPTR,Y
3270 stu ,X
3271 stx FTBLNEXT
3272 puls d,U,PC
3273
3274 * Update file icon table position entry, as well as next icon position on
3275 * screen.
3276 * Entry: 0-1,s = RTS address
3277 * 2-3,s = Ptr to current file table (FL.*) entry
3278 ICNXYSET pshs U
3279 ldu 4,S Get ptr to current file table entry
3280 ldd NEXTXPOS Get next X position for file icon on screen
3281 std FL.XSTRT,U Save as X start for file table entry
3282 addd #24 Add 24 pixels (Width of icon)
3283 tst WD48FLAG Using wide 80 column screen?
3284 beq ICNXYSE2 No, skip ahead
3285 addd #24 Yes, add another 24 pixels (48 pixels for wide)
3286 ICNXYSE2 std FL.XEND,U Save as X end for file table entry
3287 ldd NEXTYPOS Get next Y position
3288 std FL.YSTRT,U Save as Y start for file table entry
3289 addd #24 Add 24
3290 std FL.YEND,U Save Y end for file table entry
3291 ldd NEXTXPOS Get next X start pos again
3292 addd ICONCOLW Add icon column width (including spacing)
3293 std NEXTXPOS Save as new next X pos
3294 pshs d * NOTE: 6309 SUBR
3295 ldd PIXELSWD Get GSHELL window width
3296 subd ,S++
3297 cmpd #24 Is next icon going to be past right window edge?
3298 bge ICNXYSE1 No, skip ahead
3299 ldd STRTXPOS Yes, reset next X pos to start X pos (left side)
3300 std NEXTXPOS
3301 ldd NEXTYPOS Bump Y pos up too by icon row height
3302 addd ICONROWH
3303 std NEXTYPOS
3304 cmpd ICONYMAX Are we passed the bottom of the GSHELL window too?
3305 ble ICNXYSE1 No, skip ahead
3306 ldd STRTYPOS Yes, reset next Y pos as start Y pos (top side)
3307 std NEXTYPOS
3308 ICNXYSE1 puls U,PC
3309
3310 UPDFITBL bsr RSTXYPTR Reset X/Y positions of next icon to upper left corner
3311 ldx FTBLSPTR Get ptr to start of file table
3312 bra UPDFITB2 Update table icon positions again
3313
3314 UPDFITB1 pshs X Save file table entry ptr
3315 bsr ICNXYSET Set X/Y positions of file icon
3316 leas 2,S
3317 ldx FL.LINK,X Get ptr to next file table entry
3318 UPDFITB2 bne UPDFITB1 There is one, go fix it's coords
3319 rts Done them all, return
3320
3321 * Reset next positions for icons to upper left corner
3322 RSTXYPTR ldd STRTXPOS
3323 std NEXTXPOS
3324 ldd STRTYPOS
3325 std NEXTYPOS
3326 rts
3327
3328 * FILE menu - Sort option
3329 FLSORT lbsr SUREBOX6
3330 std -2,S
3331 beq FLSORT1
3332 clrd
3333 pshs d
3334 pshs d No parameter for program
3335 pshs d No overlay window
3336 leax <GSORTNAM,PC Save primary module name ptr
3337 pshs X
3338 lbsr EXECPRGM Execute GSORT without overlay window (does it's own)
3339 leas 8,S
3340 lbsr DONEWDIR
3341 FLSORT1 lbra FILSEXIT
3342
3343 GSORTNAM fcc "gsort"
3344 fcb NUL
3345
3346 DELDIRNM fcc "deldir"
3347 fcb NUL
3348
3349 CANTDELT fcc "Can't delete "
3350 fcb '",NUL
3351
3352 * FILE menu, Delete option (Trash entry a little further in. NOTE: Use this
3353 * as the basis for the PRINT option)
3354 FLDELETE lbsr SUREBOX6 Ask user if he/she is sure they want to delete
3355 std -2,S
3356 lbeq FILSEXIT Said no, don't delete
3357 FLTRASH ldb FL.ICONO,U Get icon buffer number for file to delete
3358 cmpb #IC.FOLDR Is it a folder (directory)?
3359 bne NOTADIR No, skip ahead
3360 clra Call DELDIR to delete a directory
3361 clrb
3362 pshs d
3363 ldx FL.FNAME,U
3364 incb
3365 pshs d,X
3366 leax <DELDIRNM,PC
3367 pshs X
3368 lbsr EXECPRGM
3369 leas 8,S
3370 FLDELET1 std 4,S
3371 bra FLDELET3
3372
3373 * Not a dir, delete a normal file
3374 NOTADIR pshs U
3375 lbsr GETFLPTR Get ptr to filename
3376 std ,S
3377 lbsr I.DELETE
3378 leas 2,S
3379 std 4,S
3380 beq FLDELET3
3381 ldd ERRNO,Y
3382 cmpb #E$PNNF
3383 bne FLDELET2
3384 clra
3385 clrb
3386 bra FLDELET1
3387
3388 FLDELET2 ldx ERRNO,Y
3389 ldd FL.FNAME,U
3390 pshs d,X
3391 leax <CANTDELT,PC
3392 pshs X
3393 lbsr BUILDMSG
3394 leas 6,S
3395 FLDELET3 ldd 4,S
3396 bne FILSEXIT
3397 pshs U
3398 lbsr RMVFICON
3399 leas 2,S
3400 clra
3401 clrb
3402 std SELECTED
3403 lbsr UPDFITBL
3404 ldd FL.ICONO,U
3405 cmpa #IC.AIF.F
3406 bne FLDELET9
3407 ldx FTBLSPTR
3408 beq FLDELET6
3409 lda #IC.TEXT
3410 FLDELET4 cmpb FL.AIFNO,X
3411 bne FLDELET5
3412 clr FL.AIFNO,X
3413 sta FL.ICONO,X
3414 FLDELET5 ldx FL.LINK,X
3415 bne FLDELET4
3416 FLDELET6 ldx IDSCSPTR
3417 FLDELET7 cmpb ID.NUMBR+1,X
3418 bne FLDELET8
3419 ldx ID.XXXPT,X
3420 clr ,X
3421 bra FLDELET9
3422
3423 FLDELET8 ldx ID.LINK,X
3424 bne FLDELET7
3425 FLDELET9
3426 FLCOPYEX lbsr DRAWSCRN
3427 bra FILSEXIT
3428
3429 * FILE menu, Quit option
3430 FLQUIT lbsr SUREQUI3 Ask user if they are sure
3431 bra FILSEXIT
3432
3433 * FILES menu
3434 FILESLCT pshs U
3435 leas -8,S
3436 ldu SELECTED Get ptr to icon table entry currently selected
3437 ldd 12,S Get FILES menu item #
3438 decb
3439 beq FLOPEN
3440 decb
3441 lbeq FLLIST
3442 decb
3443 lbeq FLCOPY
3444 decb
3445 lbeq FLSTAT
3446 decb
3447 lbeq FLPRINT
3448 decb
3449 lbeq FLRENAME
3450 decb
3451 lbeq FLDELETE
3452 decb
3453 lbeq FLSORT
3454 decb
3455 beq FLQUIT
3456 decb
3457 lbeq FLTRASH
3458 FILSEXIT leas 8,S
3459 puls U,PC
3460
3461 * File menu - OPEN option
3462 FLOPEN ldb FL.ICONO,U Get icon type
3463 cmpb #IC.AIF.F Is it a one shot AIF file?
3464 beq FLOPNAIF Yes, open as an AIF file
3465 cmpb #IC.FOLDR Is it a folder/directory?
3466 beq FLOPFLDR Yes, switch to that sub-directory
3467 cmpb #IC.F.XXX Is it a file that matches a previous AIF extension
3468 bne FLOPRGRM No, treat as an executable
3469 pshs U Save file info ptr
3470 lbsr EXEC.XXX Do the AIF match thing
3471 bra FLEXHOOK
3472
3473 * File menu - OPEN for a one-shot AIF file
3474 FLOPNAIF pshs U Save file info ptr
3475 lbsr EXECAIF Execute using AIF stuff
3476 bra FLEXHOOK
3477
3478 * File menu - OPEN for a folder (directory)
3479 FLOPFLDR ldd FL.FNAME,U Get ptr to directory name
3480 pshs d
3481 lbsr OPENFLDR Change to sub-directory
3482 FLEXHOOK leas 2,S Eat temp stack & exit
3483 bra FILSEXIT
3484
3485 FLOPRGRM ldd FL.FNAME,U Get ptr to filename to execute
3486 pshs d
3487 leax <SLASH,PC Point to a slash
3488 pshs X
3489 ldx #DDIRNAME Point to current full path name
3490 pshs X
3491 ldx #MULTIBFR Place to store path & filename
3492 pshs X
3493 lbsr STRCPY Copy pathname to temp buffer
3494 leas 4,S
3495 pshs d
3496 lbsr STRCAT Add slash (NOTE: DO MANUALLY!)
3497 leas 4,S
3498 pshs d
3499 lbsr STRCAT Add filename of program to execute
3500 leas 4,S
3501 ldd FL.FNAME,U Point to filename (for get params prompt)
3502 pshs d
3503 lbsr GETPARMS Prompt & get any params needed from user
3504 leas 2,S
3505 std 2,S
3506 ldd #1 We want overlay window to run program in flag
3507 pshs d
3508 ldx 4,S
3509 pshs d,X
3510 ldx #MULTIBFR Point to new filename path
3511 FLEXEC pshs X
3512 lbsr EXECPRGM Fork that program in an overlay window
3513 leas 8,S
3514 FILSEXT2 bra FILSEXIT
3515
3516 SLASH fcc "/"
3517 fcb NUL
3518
3519 * File menu - LIST option
3520 FLLIST ldd #1
3521 pshs d
3522 pshs U
3523 lbsr GETFLPTR Get ptr to filename we want to list
3524 std ,S Save it
3525 ldd #1 Flag that we want to run LIST in an overlay window
3526 pshs d
3527 ldx #LISTNAM Point to 'LIST '
3528 bra FLEXEC
3529
3530 * File menu - COPY option
3531 FLCOPY ldx #NEWNMSG Point to 'new name:'
3532 pshs X
3533 lbsr INPTSCRN Prompt for destination path for copy
3534 std 4,S
3535 beq FLEXHOOK User just hit <ENTER>, abort copy
3536 std ,S Save ptr to string we are inserting in front of
3537 lbsr STPREFIX Insert original filename to copy (?)
3538 clra
3539 clrb
3540 std ,S
3541 pshs U
3542 lbsr GETFLPTR Get ptr to filename we want to copy
3543 std ,S
3544 clra No overlay window for COPY command
3545 clrb
3546 pshs d
3547 leax <COPYNAME,PC
3548 pshs X
3549 lbsr EXECPRGM Execute COPY program
3550 leas 8,S
3551 std -2,S
3552 bne FILSEXT2
3553 ldd 2,S
3554 pshs d
3555 lbsr INOURDIR
3556 leas 2,S
3557 std 2,S
3558 beq FILSEXT2
3559 ldb FL.ICONO,U
3560 sex
3561 pshs d
3562 ldd 4,S
3563 pshs d
3564 lbsr ADDFICON
3565 leas 4,S
3566 lbra FLCOPYEX
3567
3568 * File menu - FSTAT option
3569 FLSTAT ldd #1
3570 pshs d
3571 pshs U
3572 lbsr GETFLPTR Get ptr to filename we are FSTATing
3573 std ,S
3574 ldd #1 Flag we want this in an overlay window
3575 pshs d
3576 leax <FSTATNAM,PC Point to 'fstat'
3577 lbra FLEXEC
3578
3579 COPYNAME fcc "copy"
3580 fcb NUL
3581
3582 FSTATNAM fcc "fstat"
3583 fcb NUL
3584
3585 * File menu - PRINT option - NOTE: ADD PRINT ICON CALL TO HERE
3586 FLPRINT ldd #1
3587 pshs d
3588 pshs U
3589 bsr GETFLPTR Get ptr to file to print
3590 std ,S
3591 ldd #1 We want this to run in an overlay window
3592 pshs d
3593 ldx #COCPRNM Execute 'COCOPR' program
3594 lbra FLEXEC
3595
3596 * File menu - RENAME option - patch to not allow DIRSIG to trigger needlessly
3597 FLRENAME ldx #NEWNMSG Prompt user for new filename
3598 pshs X
3599 lbsr INPTSCRN
3600 std 4,S Save ptr to new filename
3601 beq FLRENAM1 User hit <ENTER>, abort rename
3602 std ,S
3603 lbsr STPREFIX
3604 clra
3605 clrb
3606 std ,S
3607 pshs U
3608 bsr GETFLPTR Get ptr to filename of original filename to rename
3609 std ,S
3610 * If Dirup <>0, leave RECDSGNL/Dirup alone (another process has updated DIR)
3611 * If Dirup=0, we want to wipe out RECDSGNL & Dirup right after Fork comes back
3612 * before we exit this routine.
3613 lda Dirup Any directory update signal?
3614 sta RenFlag Save it (irregardless)
3615 clra No overlay window for RENAME
3616 clrb
3617 pshs d
3618 leax <RENAMENM,PC Rename the file
3619 pshs X
3620 lbsr EXECPRGM
3621 leas 8,S
3622 std -2,S
3623 lbne FILSEXIT
3624 lda RenFlag Was their a dir update originally?
3625 bne SkipSigC Yes, leave signal stuff alone
3626 sta Dirup Clear queued dir update signal flag (rename triggered it)
3627 sta RECDSGNL+1 Clear signal copy as well
3628 SkipSigC pshs U
3629 lbsr ERASFNAM Erase the original filename from the screen
3630 ldd 4,S
3631 std ,S
3632 pshs U
3633 lbsr RPLFICON Update the file table entry for the new name
3634 leas 4,S
3635 std SELECTED
3636 pshs d
3637 lbsr WRITFNAM Write the new filename on the screen
3638 FLRENAM1 lbra FLEXHOOK
3639
3640 RENAMENM fcc "rename"
3641 fcb NUL
3642
3643 * Get ptr to filename
3644 * Entry: 0-1,s = RTS address
3645 * 2-3,s = Ptr to file table entry for current file
3646 GETFLPTR ldx 2,S Get ptr to file table entry
3647 ldb FL.ICONO,X Get icon type
3648 cmpb #IC.AIF.F Is it a one shot AIF type?
3649 bne GETFLPT1 No, skip ahead
3650 pshs X Save ptr to file table entry
3651 bsr FPTR.XXX Generate AIF.xxx filename, return with ptr to it
3652 leas 2,S
3653 rts
3654
3655 * Non AIF one-shot
3656 GETFLPT1 ldd FL.FNAME,X Get filename ptr & return
3657 rts
3658
3659 * AIF one shot (need name of AIF itself, not program referenced in it)
3660 FPTR.XXX pshs U
3661 leau AIF.NAME,PC Point to 'aif'
3662 ldx #AIFNMBFR Point to buffer to build AIF.xxx filename
3663 pshs X,U
3664 lbsr STRCPY Copy 'aif' into buffer
3665 leas 4,S
3666 ldu 4,S
3667 clra
3668 ldb FL.AIFNO,U Get entry # into ID.* table
3669 pshs d
3670 lbsr FNDIDESC Go find the right entry
3671 tfr D,U
3672 std ,S++
3673 beq FPTRXXX1 None, skip ahead
3674 ldu ID.XXXPT,U Get ptr to ???
3675 ldx #AIFNMBFR Point to AIF buffer again
3676 pshs X,U
3677 lbsr STRCAT append the 3 letter AIF code
3678 leas 4,S
3679 FPTRXXX1 puls U,PC Return with ptr to AIF.xxx filename
3680
3681 INOURDIR pshs U
3682 ldu 4,S
3683 ldb ,U
3684 cmpb #'/
3685 bne INOURDI1
3686 pshs U
3687 bsr TERMSLSH Cut directory name off one dir. level earlier
3688 std ,S Save ptr to end of new path
3689 ldx #DDIRNAME
3690 pshs X,U
3691 lbsr STRCMP
3692 leas 4,S
3693 puls X
3694 std -2,S
3695 bne INOURDI2
3696 leax 1,X
3697 tfr X,D
3698 bra INOURDI4
3699
3700 INOURDI1 ldb ,U+
3701 beq INOURDI3
3702 cmpb #'/
3703 bne INOURDI1
3704 INOURDI2 clra
3705 clrb
3706 puls U,PC
3707
3708 INOURDI3 ldd 4,S
3709 INOURDI4 puls U,PC
3710
3711 * Shorten string at [2,S] to end at the previous '/'
3712 * Used to shorten directory paths by one directory level
3713 * Exit: D=ptr to end of new pathname
3714 TERMSLSH ldx 2,S Get ptr to pathname
3715 lbsr STREND1 Get end of string ptr into D
3716 TERMSLS1 ldb ,-X Get previous char
3717 cmpb #'/ Slash?
3718 bne TERMSLS1 No, keep looking
3719 cmpx 2,S Yes, are we at the beginning of the path again?
3720 beq TERMSLS2 Yes, done
3721 clrb Found previous dir, flag string end here
3722 stb ,X
3723 TERMSLS2 tfr X,D
3724 rts
3725
3726 * FILE menu, Free option
3727 DOFREE ldd #1 Do in an overlay window
3728 pshs d
3729 ldx DEVICNOW Get ptr to file entry for current device
3730 ldx FL.FNAME,X Get ptr to device name
3731 pshs d,X
3732 leax <FREENAME,PC Fork FREE command on that drive
3733 bra FORKHOOK
3734
3735 FREENAME fcc "free"
3736 fcb NUL
3737
3738 SORCDEVC fcc " Source device"
3739 fcb LF,NUL
3740
3741 DESTDEVC fcc " Dest. device"
3742 fcb LF,NUL
3743
3744 BACKUPNM fcc "backup"
3745 fcb NUL
3746
3747 SNAME fcc "s"
3748 fcb NUL
3749
3750 * - Backup command - NOTE: SHOULD WE CHANGE THIS TO USE BRUCE ISTED'S STREAM?
3751 DOBACKUP leax <SORCDEVC,PC Point to ' Source device'
3752 pshs X
3753 lbsr SLCTDEVC Prompt user for source device to BACKUP
3754 tfr D,U
3755 stu ,S++
3756 beq DISKEXIT User just hit <ENTER>, exit
3757 leax <DESTDEVC,PC Prompt user for destination device to BACKUP
3758 pshs X
3759 lbsr SLCTDEVC
3760 leas 2,S
3761 std 2,S
3762 beq DISKEXIT User just hit <ENTER>, exit
3763 cmpu 2,S Same as source drive?
3764 beq SNGLDRIV Yes, doing single drive backup
3765 pshs d
3766 lbsr STPREFIX Append
3767 leas 2,S
3768 clra No overlay window (since will be automatic)
3769 clrb
3770 bra TWODRIVE
3771
3772 * Single drive backup
3773 SNGLDRIV ldd #1 Need overlay window for disk swap prompts
3774 TWODRIVE std ,S
3775 pshs U
3776 lbsr STPREFIX
3777 ldd #1
3778 std ,S
3779 ldd 2,S
3780 beq TWODRIV1
3781 leax <SNAME,PC
3782 tfr X,D
3783 TWODRIV1 pshs d
3784 ldd #1
3785 pshs d
3786 leax <BACKUPNM,PC
3787 FORKHOOK pshs X
3788 lbsr EXECPRGM
3789 leas 8,S
3790 bra DISKEXIT
3791
3792 DOSTEXEC lbsr NOMOUSE ++X25
3793 lbsr STEXCDVC
3794 bra DISKEXIT
3795
3796 DOSETDVC lbsr NOMOUSE ++X25
3797 lbsr FIXDRTBL
3798 lbsr CHGDEVCS
3799 lbsr UPDTDEVC
3800 bra DISKEXIT
3801
3802 * DISK MENU
3803 DISKSLCT pshs U
3804 leas -4,S
3805 ldd 8,S
3806 decb
3807 lbeq DOFREE Free
3808 decb
3809 beq DONWFLDR Create new folder (directory)
3810 decb
3811 beq DOFORMAT Format disk
3812 decb
3813 lbeq DOBACKUP Backup disk
3814 decb
3815 beq DOSTEXEC Set execution directory
3816 decb
3817 beq DOSETDVC Set data directory (drive)
3818 DISKEXIT leas 4,S
3819 lbsr MOUSENOW Turn mouse back on
3820 puls U,PC
3821
3822 DONWFLDR lbsr NOMOUSE Turn mouse off
3823 leax <FOLDRNAM,PC Ask for new folder name
3824 pshs X
3825 lbsr INPTSCRN
3826 tfr D,U
3827 std ,S++
3828 beq DISKEXIT
3829 ldb #PEXEC.+PREAD.+EXEC.+UPDAT.
3830 pshs d
3831 pshs U
3832 lbsr I.MAKDIR
3833 leas 4,S
3834 tstb
3835 bne DONWFLD1
3836 pshs U
3837 lbsr INOURDIR
3838 tfr D,U
3839 stu ,S++
3840 beq DISKEXIT
3841 ldb #IC.FOLDR
3842 pshs d
3843 pshs U
3844 lbsr ADDFICON
3845 leas 4,S
3846 lbsr DRAWSCRN
3847 bra DISKEXIT
3848
3849 DONWFLD1 ldd ERRNO,Y
3850 pshs d
3851 leax <CANTMAKE,PC
3852 pshs X,U
3853 lbsr BUILDMSG
3854 leas 6,S
3855 bra DISKEXIT
3856
3857 DOFORMAT leax <FMTDEVIC,PC
3858 pshs X
3859 bsr SLCTDEVC
3860 tfr D,U
3861 stu ,S++
3862 beq DISKEXIT
3863 lbsr SUREBOX5
3864 tstb
3865 beq DISKEXIT
3866 ldd #1
3867 pshs d
3868 pshs d,U
3869 leax <FORMATNM,PC
3870 lbra FORKHOOK
3871
3872 FOLDRNAM fcc "Folder name: "
3873 fcb NUL
3874
3875 CANTMAKE fcc "Can't make "
3876 fcb '",NUL
3877
3878 FMTDEVIC fcc " Format device"
3879 fcb LF,NUL
3880
3881 FORMATNM fcc "format"
3882 fcb NUL
3883
3884 * Select a new drive
3885 SLCTDEVC pshs U
3886 lbsr NOMOUSE Shut the mouse off
3887 ldx #MOUSPCKT
3888 ldd #8
3889 std BXOFFSET
3890 clrb
3891 pshs d,X
3892 ldb #3
3893 pshs d,X
3894 decb
3895 pshs d
3896 ldx #10
3897 ldd 16-2,S
3898 pshs d,X
3899 lbsr STRLEN
3900 addd #2
3901 std ,S
3902 clrb
3903 pshs d
3904 ldb #10
3905 pshs d
3906 ldx #1
3907 ldd WNDWPATH
3908 pshs d,X
3909 lbsr OWSET
3910 ldd #WT.DBOX Double box overlay window
3911 std 2,S
3912 lbsr ST.WNSET
3913 ldd 10+16,S
3914 std ,S
3915 lbsr WRLNWCR
3916 leas 2+14,S
3917 ldd #16
3918 std ,S
3919 ldu #DRIVETBL
3920 bra SLCTDEV2
3921
3922 SLCTDEV1 ldd FL.FNAME,U
3923 pshs d
3924 ldx #DNAMBUFR
3925 pshs X
3926 lbsr STRCPY
3927 clr DNAMBUFR+11,Y
3928 leax FOURSPAC,PC
3929 stx ,S
3930 lbsr WTSTRLEN
3931 ldx #DNAMBUFR
3932 stx ,S
3933 lbsr WRLNWCR
3934 ldd 4,S
3935 std 2,S
3936 ldd #8
3937 std ,S
3938 lbsr DRAWABOX
3939 leas 4,S
3940 ldd ,S
3941 addd #8
3942 std ,S
3943 ldu FL.LINK,U
3944 SLCTDEV2 stu -2,S
3945 bne SLCTDEV1
3946 stu RECDSGNL
3947 ldd WNDWPATH
3948 pshs d,X
3949 lbsr ST.RELEA
3950 lbsr MOUSENOW
3951 ldd #MOUSIGNL
3952 std 2,S
3953 lbsr ST.MSSIG
3954 leas 4,S
3955 ldx RECDSGNL Get signal
3956 bne SLCTDEV3 Got one, process
3957 os9 F$SLEEP Sleep for remainder of tick
3958 SLCTDEV3 ldd RECDSGNL
3959 cmpb #MOUSIGNL
3960 bne SLCTDEV6
3961 ldx 4,S
3962 ldd WNDWPATH
3963 pshs d,X
3964 lbsr GT.MOUSE
3965 leas 4,S
3966 ldd #16
3967 std ,S
3968 ldu #DRIVETBL
3969 bra SLCTDEV5
3970
3971 SLCTDEV4 pshs d
3972 ldx #8
3973 ldd 8-2,S
3974 pshs d,X
3975 lbsr TESTDBOX
3976 leas 6,S
3977 std 2,S
3978 bne SLCTDEV6
3979 ldd ,S
3980 addd #8
3981 std ,S
3982 ldu FL.LINK,U
3983 SLCTDEV5 stu -2,S
3984 bne SLCTDEV4
3985 SLCTDEV6 ldd WNDWPATH
3986 pshs d
3987 lbsr OWEND
3988 leas 2,S
3989 lbsr MOUSENOW
3990 ldd 2,S
3991 beq SLCTDEV7
3992 ldd FL.FNAME,U
3993 bra SLCTDEVX
3994
3995 SLCTDEV7 clra
3996 clrb
3997 bra SLCTDEVX
3998
3999 STEXCDVC pshs U
4000 ldd #3
4001 pshs d
4002 leax <SETEXEC,PC
4003 ldd WNDWPATH
4004 pshs d,X
4005 lbsr OLAYGNBK
4006 lbsr CURSORON
4007 leax <PREVIOUS,PC
4008 stx ,S
4009 lbsr WTSTRLEN
4010 ldx #XDIRNAME
4011 stx ,S
4012 lbsr WRLNWCR
4013 leax <NEW.MSG,PC
4014 stx ,S
4015 lbsr WTSTRLEN
4016 lbsr INPUTCHK
4017 leas 2+4,S
4018 tfr D,U
4019 stu -2,S
4020 beq STEXCDV3
4021 ldb ,U
4022 beq STEXCDV3
4023 pshs U
4024 lbsr CHGXDIR
4025 std ,S++
4026 bne STEXCDV1
4027 ldx #XDIRNAME
4028 pshs X,U
4029 lbsr STRCPY
4030 leas 4,S
4031 bra STEXCDV3
4032
4033 STEXCDV1 lbsr KILLOLAY
4034 ldd ERRNO,Y
4035 pshs D
4036 leax <CANTOPEN,PC
4037 pshs X,U
4038 lbsr BUILDMSG
4039 SLCTDEVX leas 6,S
4040 puls U,PC
4041
4042 STEXCDV3 lbsr KILLOLAY
4043 puls U,PC
4044
4045 SETEXEC fcc " Set execution folder "
4046 fcb NUL
4047
4048 PREVIOUS fcb LF
4049 fcc "Prev: "
4050 fcb NUL
4051
4052 NEW.MSG fcc "New: "
4053 fcb NUL
4054
4055 CANTOPEN fcc "Can't open "
4056 fcb '",NUL
4057
4058 SUREQUI3 lbsr TESTQUIT
4059 bne SUREQUI2
4060 lbsr SUREBOX8
4061 bra SUREQUI4
4062
4063 SUREQUIT lbsr TESTQUIT
4064 bne SUREQUI2
4065 lbsr SUREBOX7
4066 SUREQUI4 std -2,S
4067 beq SUREQUI2
4068 ldd #-1
4069 pshs D
4070 lbsr TRYQUIT
4071 std ,S++
4072 bne SUREQUI2
4073 os9 F$ID
4074 ldx #DIRBUFER
4075 os9 F$GPRDSC
4076 tst 1,X
4077 bne SUREQUI1
4078 lds #$FF
4079 leax <EXITSHEL,PC Point to SHELL
4080 leau <IEQUALS,PC Point to 'i=/1'
4081 ldy #PARMSIZE
4082 * NOTE: WE SHOULD CHANGE SO THAT GSHELL RECORDS THE ORIGINAL WINDOW TYPE, AND
4083 * RESTORES IT AS WELL. IT SHOULD ALSO RESET PAUSE PROPERLY
4084 ldd #$0100 Chain to regular SHELL
4085 os9 F$CHAIN
4086
4087 SUREQUI1 pshs D
4088 lbsr EXIT
4089 SUREQUI2 rts
4090
4091 EXITSHEL fcc "shell"
4092 fcb CR
4093
4094 IEQUALS fcc "i=/1"
4095 fcb CR
4096
4097 PARMSIZE equ *-IEQUALS
4098
4099 * Entry: 0-1,s = RTS address
4100 * 2-3,s = Ptr to mouse packet
4101 TESTDBOX pshs U
4102 ldu 4,S Get ptr to mouse packet
4103 ldx PT.WRX,U Get
4104 ldd PT.WRY,U
4105 pshs d,X
4106 ldd 10,S
4107 cmpd 2,S
4108 bge TESTDBO1
4109 addd BXOFFSET
4110 cmpd 2,S
4111 blt TESTDBO1
4112 ldd 12,S
4113 cmpd ,S
4114 bge TESTDBO1
4115 addd #8
4116 cmpd ,S
4117 blt TESTDBO1
4118 ldd 12,S
4119 addd #2
4120 pshs d
4121 ldd 12,S
4122 addd #2
4123 pshs d
4124 ldd WNDWPATH
4125 pshs d
4126 lbsr SETDPTR
4127 lbsr FFILL
4128 ldx #10 Sleep for 10 ticks
4129 os9 F$SLEEP
4130 leas 6,S
4131 ldb #1
4132 bra TESTDBO2
4133
4134 TESTDBO1 clrb
4135 TESTDBO2 clra
4136 leas 4,S
4137 puls U,PC
4138
4139 VIEWSLCT ldb 3,S Get menu item #
4140 beq VIEWEXIT None selected, exit
4141 cmpb #3 Higher than the 3 we ignore (HOW WOULD THIS HAPPEN?)
4142 bhi VIEWEXIT
4143 addb #5 Adjust to match OS9 window types
4144 cmpb DEFWTYPE+1 Same as current type?
4145 beq VIEWEXIT Yes, don't do anything
4146 stb DEFWTYPE+1 Save new type
4147 stb WIPED Flag that we have to redo dir bar
4148 bsr SETVIEW Do changes to the VIEW menu for the new type
4149 lbsr SETHLRES Change current GSHELL window to new type
4150 VIEWEXIT rts
4151
4152 * Update VIEW menu options
4153 SETVIEW ldb #1
4154 ldx #ITM.LRES+MI.ENBL
4155 stb ,X
4156 stb MI.SIZ,X
4157 stb MI.SIZ*2,X
4158 ldb DEFWTYPE+1
4159 subb #5
4160 SETVIEW1 decb
4161 beq SETVIEW2
4162 leax MI.SIZ,X
4163 bra SETVIEW1
4164
4165 SETVIEW2 clr ,X
4166 rts
4167
4168 * Select off of the TANDY menu
4169 * Entry: 0-1,s = RTS parameter
4170 * 2-3,s = Menu item # selected
4171 TNDYSLCT clrd Put 4 zero bytes on stack
4172 pshs D
4173 pshs D
4174 ldb 7,S Get 1 byte version of menu item selected
4175 decb
4176 beq SELCALC 1=Calculator
4177 decb
4178 beq SELCLOCK 2=Clock
4179 decb
4180 beq SELCAL 3=Calender
4181 decb
4182 beq SELCNTRL 4=Control Panel
4183 decb
4184 beq SELPRNTR 5=Printer control panel
4185 decb
4186 beq SELPORT 6=Serial port control panel
4187 decb
4188 beq SELHELP 7=Help command
4189 decb
4190 bne TNDYEXIT 9 or greater, exit Tandy menu
4191 incb Save ???
4192 stb 1,S
4193 ldb #IC.SHELL Execute resizable window SHELL command
4194 ldx #SHELLNAM Point to word "shell" with NUL
4195 bra TNDYEXEC Go execute it
4196
4197 * Clock from Tandy menu selected
4198 SELCLOCK ldb #IC.GCLOK Clock forked process ID #
4199 ldx #GCLOCKNM Point to name of clock program
4200 bra TNDYEXEC Go execute it
4201
4202 * Calendar from Tandy menu selected
4203 SELCAL ldb #IC.GCAL Execute GCalendar
4204 ldx #GCALNAM
4205 bra TNDYEXEC
4206
4207 * Control panel selected
4208 SELCNTRL ldx #CONTRLNM
4209 bra TNDYEXC1
4210
4211 * Printer panel selected
4212 SELPRNTR ldx #GPRINTNM
4213 bra TNDYEXC1
4214
4215 * Serial ports panel selected
4216 SELPORT ldx #GPORTNAM
4217 TNDYEXC1 pshs X Save ptr to program name to fork
4218 lbsr EXCOPOPR
4219 leas 2,S
4220 bra TNDYEXIT
4221
4222 SELHELP incb
4223 pshs D
4224 ldx SELECTED
4225 beq SELHELP1
4226 ldd FL.FNAME,X
4227 std 2,S
4228 inc 5,S
4229
4230 SELHELP1 ldx #HELPNAM
4231 pshs X
4232 lbsr EXECPRGM
4233 leas 4,S
4234 bra TNDYEXIT
4235
4236 SELCALC ldb #IC.GCALC
4237 ldx #GCALCNAM
4238
4239 * Execute resizable window, call program
4240 * Entry: B=IC.* id number
4241 * X=Pointer to program to call (no parameters at this point)
4242 TNDYEXEC pshs D Preserve id #
4243 lbsr FNDIDESC Find Ptr to ID descriptor we are looking for
4244 std 2+2,S Save on stack
4245 stx ,S Save ptr to program name
4246 bsr EXCICOND Go execute
4247 leas 2,S Eat temp stack
4248 TNDYEXIT leas 4,S Eat rest of temp stack & return
4249 rts
4250
4251 *Execute an IC.* program
4252 * Entry: 0-1,s RTS address
4253 * 2-3,s Ptr to name of program to be called
4254 EXCICOND pshs U Preserve U
4255 ldd 4,S Get ptr to program to be forked
4256 pshs D Add entry to our internal table of programs we have forked
4257 lbsr SETPDESC
4258 std ,S Save ptr to current descriptor entry
4259 lbeq EXCICON9 None (couldn't make), clear 1st byte of parms buffer/exit
4260 tfr D,U Move ptr to U
4261 lbsr LINKLOAD Shut mouse off/Hourglass, link or load program in question
4262 std ,S++ Did we have an error?
4263 lbeq EXCICON8 Yes, kill our GD.* process link, window (if any), exit
4264 tst RAMSIZE Check our RAM size
4265 bne EXCICON4 >128k, skip ahead
4266 ldd 8,S 128k
4267 pshs D
4268 pshs U
4269 lbsr ISCR128K Do special 128k processing for new window
4270 leas 4,S Eat stack
4271 std -2,S Check if new window create successful
4272 beq EXCICON1 Yes, continue
4273 bgt EXCICON6 Screen type of 7 or 8, can't create in 128k
4274 lbsr SETHLRES Reinit main window, then print 'can't create' error
4275 bra EXCICON6
4276
4277 EXCICON1 ldd 6,S ???
4278 beq EXCICON2
4279 ldx #WT.DBOX Double box border
4280 ldb WNDWPATH+1 Window path
4281 pshs D,X Save for routine
4282 lbsr ST.WNSET Set window to double box
4283 leas 4,S Eat temp stack
4284 std -2,S Error on Window Set?
4285 bne EXCICON3 Yes, reset window (?) and exit
4286 EXCICON2 pshs D Save regs
4287 pshs D
4288 pshs U ?? Save ptr to process to fork
4289 lbsr FORKWAIT Go fork process
4290 leas 6,S
4291 EXCICON3 lbsr SETHLRES Change current window type & exit
4292 bra EXCICN10
4293
4294 * >128k RAM for forking IC.* program
4295 EXCICON4 ldd 8,S
4296 pshs D
4297 pshs U
4298 lbsr ISCR512K Go set up new window to fork program into
4299 leas 4,S Eat temp stack
4300 std -2,S Successful window create?
4301 blt EXCICN11 No, report error
4302 ldd 6,S Get double box window flag
4303 beq EXCICON5 Not set, go straight to program fork
4304 ldx #WT.DBOX Draw Double box window
4305 ldd GD.WPATH,U Get path # to window program is/will be running on
4306 pshs D,X
4307 lbsr ST.WNSET
4308 leas 4,S
4309 std -2,S
4310 bne EXCICON6 Couldn't create double box window, report error
4311 EXCICON5 pshs U Save ptr to GD.* variables
4312 lbsr FORKPROC Fork program
4313 std ,S++
4314 bne EXCICN10 Successful fork, exit
4315 EXCICON6 ldd WNDWPATH Print error on main window that we could not
4316 pshs D make a new window
4317 lbsr SELECT
4318 leas 2,S
4319 leax <CANTWIND,PC
4320 EXCICON7 pshs X
4321 lbsr OLAYPRNT Print message on overlay window (main screen)
4322 ldd GD.MNAME,U
4323 std ,S
4324 lbsr F.UNLOAD Unload program we tried to fork
4325 leas 2,S
4326 EXCICON8 pshs U
4327 lbsr KILPDESC Yank entry out of current forked processes list
4328 EXCICON9 leas 2,S
4329 clr PARMSBFR,Y Flag parameters buffer as empty & return
4330 EXCICN10 puls U,PC
4331
4332 EXCICN11 cmpd #-1
4333 beq EXCICON6 If error flag=-1,"can't create new window" error
4334 leax <EXECTERM,PC "Execution terminated" error
4335 bra EXCICON7
4336
4337 EXECTERM fcc "Execution terminated"
4338 fcb NUL
4339
4340 * Execute program in pop up window on main GSHELL screen?
4341 EXCOPOPR pshs U
4342 ldd 4,S
4343 pshs D
4344 lbsr SETPDESC Allocate internal process descriptor table entry
4345 tfr D,U
4346 std ,S
4347 beq EXCICON9
4348 lbsr LINKLOAD
4349 std ,S++
4350 beq EXCICON8
4351 pshs U
4352 lbsr OLAYWTBK
4353 std ,S++
4354 beq EXCICON8
4355 ldx #1
4356 ldb WNDWPATH+1
4357 pshs D,X
4358 lbsr SCALESW
4359 leas 4,S
4360 clra
4361 clrb
4362 pshs D
4363 incb
4364 bra EXECPRG3
4365
4366 CANTWIND fcc "Can't open new window"
4367 fcb NUL
4368
4369 * Execute program
4370 * Entry: 0-1,s = RTS address
4371 * 2-3,s = Ptr to primary module name
4372 * 4-5,s = Flag 0=Make overlay window, <>0 = no overlay window
4373 * 6-7,s = Ptr to parameter to send?
4374 EXECPRGM pshs U
4375 ldd 4,S Get ptr to primary module to execute
4376 pshs D
4377 lbsr SETPDESC Allocate a process table entry
4378 std ,S
4379 beq EXECPRG5 If primary module ptr empty, exit
4380 ldu ,S Get ptr to primary module name
4381 lbsr LINKLOAD Attempt to link or load it
4382 std ,S++ Eat stack
4383 beq EXECPRG4 Could not load/link, return process tbl mem & exit
4384 ldd 6,S Get overlay window flag
4385 beq EXECPRG1 If flag=0, don't do overlay window
4386 pshs U
4387 lbsr OLAYBLWT
4388 bsr NOMOUSE
4389 leas 2,S
4390 EXECPRG1 ldd 8,S
4391 beq EXECPRG2
4392 pshs D
4393 lbsr STPREFIX
4394 leas 2,S
4395
4396 EXECPRG2 ldd 10,S
4397 pshs D
4398 ldd 8,S
4399
4400 EXECPRG3 pshs d
4401 pshs U
4402 bsr FORKWAIT
4403 pshs d
4404 bsr MOUSENOW
4405 puls d
4406 leas 6,S
4407 lbsr ResetPal Reset palettes to GSHPAL in case CONTROL was called.
4408 puls U,PC
4409
4410 EXECPRG4 pshs U
4411 lbsr KILPDESC Kill the process table entry we had allocated
4412 EXECPRG5 leas 2,S Exit with error flag set
4413 ldd #-1
4414 puls U,PC
4415
4416 NOMOUSE ldd WNDWPATH
4417 pshs d
4418 lbsr GCSETOFF
4419 lbsr MOUSOFF
4420 puls d,PC
4421
4422 MOUSENOW ldd WNDWPATH Get path to gshell window
4423 pshs d Save it
4424 lbsr CRSRAROW Set gfx cursor to arrow
4425 lbsr INITMOUS Set mouse parms
4426 puls d,PC
4427
4428 FORKWAIT pshs U
4429 ldu 4,S
4430 pshs U,PC
4431 lbsr FORKPROC Fork process
4432 std ,S++ Successful?
4433 beq FORKWAI3 No, flag error & kill process descriptor entry
4434 FORKWAI1 clra Succesful - clear received signal
4435 clrb
4436 std RECDSGNL
4437 pshs U
4438 lbsr HNDLWAIT Handle waiting while forked process runs
4439 leas 2,S
4440 ldd GD.STATS,U Get child's exit signal
4441 cmpd #-1 If -1, try waiting again
4442 beq FORKWAI1
4443 std ,S Save signal
4444 ldd 8,S
4445 beq FORKWAI5
4446 ldd 10,S
4447 beq FORKWAI4
4448 ldd ,S
4449 bne FORKWAI4
4450 ldx #PRESSMSG "Press any key" message
4451 pshs X
4452 lbsr WRLNWCR
4453 leas 2,S
4454 bsr WAITPSIG Wait for signal
4455 bra FORKWAI4
4456
4457 FORKWAI3 ldd #-1 Flag error
4458 std ,S
4459 FORKWAI4 pshs U
4460 lbsr KILPDESC Kill process descriptor entry
4461 leas 2,S
4462 tst RAMSIZE Only 128k?
4463 bne FORKWAI5 No, exit
4464 lbsr INITSCRN Yes, reinit screen before exiting
4465 FORKWAI5 puls d,U,PC
4466
4467 WAITPSIG lbsr SETSGNLS Reset mouse & keyboard signals
4468 ldd RECDSGNL Get current signal (could be dirupdate from SETSGNLS)
4469 beq WAITPSLP None, sleep for one.
4470 cmpb #DIRSIG Queued Dir update signal?
4471 beq WAITPSL2 Yes, sleep till next signal
4472 bsr FORKWTST Check for key press, abort or interrupt signal
4473 bne WAITPSIG Different signal, wait for a different one
4474 bsr FORKWSUB Go read a key from current window
4475 bra WAITPSIG Now wait for signal again
4476
4477 WAITPSL2 clrb
4478 WAITPSLP tfr d,x Sleep till we receive a signal
4479 os9 F$SLEEP
4480 bsr FORKWTST Have signal, check it out
4481 bne WAITPRSX Not key, abort or interrupt, skip ahead
4482 bsr FORKWSUB If one of those, eat key from kybd buffer 1st
4483 WAITPRSX ldd <WNDWPATH Release signals for window
4484 pshs d
4485 lbsr ST.RELEA
4486 leas 2,S
4487 clrd Clear out signal received & return
4488 std <RECDSGNL
4489 rts
4490
4491 FORKWSUB clr ,-S
4492 ldd WNDWPATH
4493 pshs d,DP
4494 lbsr PAUSECHO Shut echo & pause off on current window
4495 ldd #1
4496 std ,S
4497 ldd WNDWPATH
4498 leax 2,S
4499 pshs d,X
4500 lbsr I.READ Read 1 char for current window
4501 leas 8,S
4502 rts
4503
4504 * Received signal - Set for BEQ if keyboard, interrupt or abort signal, else
4505 * BNE
4506 FORKWTST ldd <RECDSGNL Get last received signal
4507 clr <RECDSGNL Clear out old signal code
4508 clr <RECDSGNL+1
4509 cmpb #KYBDSGNL Key pressed?
4510 beq FORKWTEX Yes, return
4511 cmpb #S$ABORT Abort signal?
4512 beq FORKWTEX Yes, return
4513 cmpb #S$INTRPT Interrupt signal, return
4514 FORKWTEX rts
4515
4516 DRAWABOX ldd 2,S
4517 ldx 4,S
4518 pshs d,X
4519 ldd WNDWPATH
4520 pshs D
4521 lbsr SETDPTR
4522 ldd BXOFFSET
4523 std 2,S
4524 ldb #8
4525 std 4,S
4526 lbsr RBOX
4527 leas 6,S
4528 rts
4529
4530 *Change current window type (from VIEW menu)
4531 SETHLRES ldd #PTR.SLP Set mouse cursor to hourglass
4532 pshs d
4533 ldx #GRP.PTR
4534 ldd WNDWPATH
4535 pshs d,X
4536 lbsr GCSET
4537 lbsr ST.RELEA Release any signals
4538 lbsr MOUSOFF
4539 ldx #30 Sleep for 1/2 second
4540 SETHLRE1 os9 F$SLEEP
4541 leax ,X Did we finish sleeping?
4542 bne SETHLRE1 No, continue sleeping
4543 SETHLRE2 ldd WNDWPATH Get window path
4544 std ,S
4545 lbsr DWEND End current window
4546 leas 6,S
4547 lbsr SETWINDW Set new window
4548 lbsr CNTSCRNS Figure out how many screens needed to hold all icons
4549 lbsr UPDFITBL Rebuild icon positions in file table (FL.* stuff)
4550 lbsr INITSCRN Init new screen
4551 rts
4552
4553 AREYSURE fcc " Are you sure?"
4554 fcb NUL
4555
4556 YES.NO fcb LF
4557 fcc " Yes!"
4558 fcb NUL
4559
4560 SUREBOX5 ldd #10
4561 bra SUREBOX9
4562
4563 SUREBOX6 ldd #4*256+5
4564 bra SUREBOX9
4565
4566 SUREBOX7 ldd #0
4567 bra SUREBOX9
4568
4569 SUREBOX8 ldd #6*256+5
4570 SUREBOX9 std SUREYPOS+1
4571 pshs U
4572 lbsr NOMOUSE
4573 ldu #MOUSPCKT
4574 ldb #3
4575 pshs D,DP,X
4576 decb
4577 pshs D
4578 ldx #6
4579 ldb #14
4580 pshs D,X
4581 ldx SUREYPOS
4582 ldb SUREXPOS
4583 pshs D,X
4584 ldx #1
4585 ldb WNDWPATH+1
4586 pshs D,X
4587 lbsr OWSET
4588 ldd #WT.DBOX
4589 std 2,S
4590 lbsr ST.WNSET
4591 leax <AREYSURE,PC
4592 stx ,S
4593 lbsr WRLNWCR
4594 leax <YES.NO,PC
4595 stx ,S
4596 lbsr WTSTRLEN
4597 ldd #16
4598 std BXOFFSET
4599 std 0+2,S
4600 ldb #20
4601 std ,S
4602 lbsr DRAWABOX
4603 lbsr MOUSENOW
4604 lbsr SETSGNLS
4605 tst RECDSGNL+1
4606 bne SUREBOX0
4607 tfr 0,x Sleep for remainder of tick (ldx #0 for 6809)
4608 os9 F$SLEEP
4609 SUREBOX0 leas 16,S
4610 ldd RECDSGNL
4611 cmpb #MOUSIGNL
4612 bne SUREBOX1
4613 ldb WNDWPATH+1
4614 pshs d,U
4615 lbsr GT.MOUSE
4616 ldd #16
4617 std 2,S
4618 ldb #20
4619 std ,S
4620 pshs U
4621 lbsr TESTDBOX
4622 leas 6,S
4623 bra SUREBOX4
4624
4625 SUREBOX1 cmpb #KYBDSGNL
4626 bne SUREBOX3
4627 ldb #1
4628 pshs D
4629 leax 4,S
4630 ldb WNDWPATH+1
4631 pshs D,X
4632 lbsr I.READ
4633 leas 6,S
4634 ldb 2,S
4635 andb #$5F
4636 cmpb #'Y
4637 bne SUREBOX3
4638 ldd #1
4639 bra SUREBOX4
4640
4641 SUREBOX3 clra
4642 clrb
4643 SUREBOX4 std ,S
4644 ldd WNDWPATH
4645 pshs D
4646 lbsr OWEND
4647 lbsr MOUSENOW
4648 ldd 2,S
4649 leas 5,S
4650 puls U,PC
4651
4652 * Create overlay window for calling other programs
4653 * Does White on Black
4654 OLAYBLWT pshs U
4655 ldb #13 Overlay window height of 13 lines
4656 pshs D,X,Y,U
4657 ldx #75 75 char wide window as default
4658 tst FLAG640W On 640 screen?
4659 bne OLAYBLW2 Yes, continue on
4660 ldx #37 320 screen, only do 37 char wide window
4661 OLAYBLW2 ldb #9 Start Y of overlay at 9 chars down from top
4662 pshs D,X
4663 ldx #2 Start X of overlay at 2 chars from left
4664 ldd WNDWPATH
4665 pshs D,X
4666 lbsr CWAREA Change working area to outside of overlay
4667 clrb Background color black
4668 std 14,S
4669 ldb #3 Foreground color (WHITE)
4670 std 12,S
4671 ldb #13 Y size of overlay
4672 std 10,S
4673 ldb #75 Width of overlay
4674 tst FLAG640W
4675 bne OLAYBLW4
4676 ldb #37 40 column width
4677 OLAYBLW4 std 8,S
4678 clrb
4679 std 6,S Start Y=0
4680 std 4,S Start X=0
4681 tst RAMSIZE Enough RAM to save overlay area?
4682 beq OLAYBLW6 No, don't bother
4683 incb Flag to preserve contents
4684 OLAYBLW6 std 2,S
4685 lbsr OWSET Do overlay window
4686 leas 16,S Eat stack
4687 std -2,S Save error code
4688 bne OLAYBERR
4689 ldx #WT.DBOX Double box around window
4690 ldd WNDWPATH
4691 pshs D,X
4692 lbsr ST.WNSET Draw double box
4693 leas 4,S
4694 bra OLAYBLW7
4695
4696 * Theoretically,
4697 OLAYWTBK pshs U
4698 clrb Black background
4699 pshs D
4700 ldb #3 White foreground
4701 pshs D
4702 ldx WINDWSZY Get window Y size
4703 leax -3,X Drop by 3
4704 ldd WINDWSZX Get window X size
4705 asra Divide by 2
4706 rorb
4707 pshs D,X Save X/Y sizes
4708 clrb
4709 pshs D
4710 pshs D
4711 tst RAMSIZE
4712 beq OLAYWTB2
4713 incb
4714 OLAYWTB2 pshs D Save 'save screen' flag
4715 ldd WNDWPATH
4716 pshs D
4717 lbsr OWSET
4718 leas 16,S Eat stack
4719 std -2,S
4720 bne OLAYBERR
4721 OLAYBLW7 ldd 4,S
4722 pshs D
4723 bsr OLAYIOPS
4724 lbra ISC128K5
4725
4726 OLAYBERR clrd
4727 puls U,PC
4728
4729 OLAYIOPS pshs U
4730 ldu 4,S
4731 bsr IOOPTSON
4732 ldd WNDWPATH Get GSHELL window path
4733 std GD.WPATH,U Save as window path for forked program
4734 clrd
4735 std GD.SCRNO,U Screen # 0
4736 incb
4737 std GD.DW.OW,U ??? to 1
4738 puls U,PC
4739
4740 * Turn ON: page pause, echo, text cursor, and release any pending signals
4741 IOOPTSON ldb #1 Flag for turning stuff ON
4742 pshs D
4743 ldb WNDWPATH+1
4744 pshs D
4745 lbsr PAUSECHO Turn pause & echo on
4746 lbsr CURSORON Turn text cursor on
4747 lbsr ST.RELEA Release any pending signals
4748 leas 4,S
4749 rts
4750
4751 KILLOLAY pshs U
4752 ldd WNDWPATH Get path to current window
4753 pshs D,X
4754 clr 3,S
4755 lbsr ST.RELEA Release any pending signals
4756 lbsr MOUSOFF Shut mouse off
4757 lbsr OWEND Remove overlay window
4758 lbsr FULLSCRN Change working area to full screen
4759 lbsr PAUSECHO
4760 lbsr CURSROFF Shut text cursor off
4761 lbsr INITMOUS Set mouse parms
4762 leas 4,S
4763 puls U,PC
4764
4765 * Make double bordered overlay window with text in it
4766 OLAYGNBK pshs U
4767 ldu 6,S
4768 leas -12,S Make stack buffer
4769 ldd 16,S
4770 pshs D
4771 lbsr ST.RELEA Release any pending signals
4772 stu ,S
4773 lbsr STRLEN Get string length of prompt text
4774 std 4+2,S
4775 leas 2,s
4776 *NOTE: SINCE THIS MULD DOES THE WIDTH OF A WINDOW, WHICH CAN NEVER GET PAST
4777 * 106 CHARACTERS, WE SHOULD BE ABLE TO USE A STRAIGHT 8 BIT MUL, FOLLOWED BY
4778 * AND ADDD#7 ON _BOTH_ THE 6809 & 6309 VERSIONS.
4779 muld #6 Multiply by 6 (for 6 pixel font chars)
4780 ldd #7 Add 7 extra pixels (border?)
4781 addr w,d
4782 lbsr DIVDX8 Divide by 8 (shift method) for # 8 pixel chars for window width
4783 addd #3 Add 3 more for borders?
4784 cmpd WINDWSZX Too big for current screen width?
4785 blo OLAYGNB1 No, continue
4786 ldd WINDWSZX Yes, change to screen width-1
4787 decb
4788 OLAYGNB1 std 6,S Save overlay window width
4789 ldd 20,S ???
4790 incd
4791 std 20,S
4792 leax ,S Where we are going to store Y size
4793 pshs X
4794 leax 4,S Where we are going to store X size
4795 ldd 20-2,S
4796 pshs D,X Save path # & ptr to where to store X size
4797 lbsr GT.SCSIZ Get the current screen size
4798 leas 6,S Eat ptrs & path duplicates
4799 ldd 2,S Get X size of screen
4800 cmpd 6,S
4801 bhi OLAYGN05 If it is wider than the proposed overlay window, jump
4802 dec 6,S If not, bump X size of overlay down by one
4803 clr 11,S ??? Clear flag
4804 bra OLAYGN07
4805
4806 OLAYGN05 subd 6,S Get # of characters extra we have for window vs scrn width
4807 pshs D
4808 * NOTE: HARD CODE SINGLE SHIFT HERE! (6809 & 6309)
4809 ldd #2 Divide by 2 (to figure out start X coord of overlay)
4810 lbsr CCDIV
4811 std 10,S Save start X coord
4812 OLAYGN07 ldb #3 Save background palette #3 (white in new windint)
4813 pshs D
4814 * NOTE: 6309 ONLY - USE DARK GREY? (PALETTE #1)
4815 ldb #1 Save foreground palette #1 (dark grey in new windint)
4816 pshs D
4817 ldd 24,S Get Y size for border (usually 2)
4818 addb #3 ??? Add 3 for data entry lines (not including borders)
4819 pshs D Save overlay Y size
4820 ldd 12,S Save X size of overlay
4821 pshs D
4822 * Start Y coord for overlay
4823 * NOTE: 6309 - Change to use W on first load, then SUBR
4824 ldd 28,S Get Y size of border (usually 2)
4825 addd #3 Add 3 for height added to overlay window for data entry
4826 pshs D
4827 ldd 10,S Get height of screen
4828 subd ,S++ Subtract overlay Y size
4829 asra Divide result by 2
4830 rorb
4831 pshs D Save Y start coord
4832 ldd 20,S Start X coord of overlay
4833 pshs D
4834 ldb #1 Save switch to ON
4835 pshs D
4836 ldd 30,S Get path to window
4837 pshs D
4838 lbsr OWSET Make overlay window
4839 leas 16,S Eat temp stack
4840 std -2,S If error, eat stack & return
4841 bne OLAYGNB4
4842 ldx #WT.DBOX Now make the overlay a double bordered box
4843 ldd 18-2,S
4844 pshs D,X
4845 lbsr ST.WNSET
4846 leas 4,S
4847 ldd 20,S ??? Flag to indicate whether we add CR to text on overlay
4848 beq OLAYGNB2 or not. If 0, do NOT add CR.
4849 ldd 4,S
4850 pshs D Save length of string to write
4851 ldd 20-2,S
4852 pshs D,U Save path # and ptr to text to write
4853 lbsr I.WRITLN Write text to double box window
4854 ldd #1 Length to write=1
4855 std 4,S
4856 leax CRETURN,PC Write out a single CR
4857 stx 2,S
4858 lbsr I.WRITLN
4859 bra OLAYGNB3
4860
4861 OLAYGNB2 ldd 4,S Get length of string to write
4862 pshs D Save it
4863 ldd 20-2,S Get ptr to text to write
4864 pshs D,U
4865 lbsr I.WRITE Write text out (NO CR)
4866 OLAYGNB3 leas 6,S Eat stack & exit
4867 OLAYGNB4 leas 12,S
4868 puls U,PC
4869
4870 * Pop up overlay window and ask for input from user
4871 INPTSCRN pshs U
4872 ldd #1
4873 pshs D
4874 ldx 6,S
4875 ldd WNDWPATH
4876 pshs D,X
4877 lbsr OLAYGNBK Pop up overlay window & print prompt
4878 lbsr CURSORON Turn text cursor on
4879 bsr INPUTCHK Get input from user
4880 leas 2+4,S
4881 tfr D,U
4882 lbsr KILLOLAY Shut off overlay prompt window
4883 tfr U,D
4884 puls U,PC
4885
4886 INPUTCHK ldd WNDWPATH Get window path
4887 pshs D
4888 INPTLOOP lbsr SETSGNLS Reset both mouse & keyboard signals
4889 ldd RECDSGNL Any signal received?
4890 bne INPTSGNL Yes, go process
4891 tfr d,x
4892 os9 F$SLEEP Sleep for remainder of tick
4893 ldd RECDSGNL Get signal code
4894 INPTSGNL cmpb #S$INTRPT Interrupt signal?
4895 beq INPTQUIT Yes, abort input
4896 cmpb #S$ABORT Abort signal?
4897 beq INPTQUIT Yes, abort input
4898 cmpb #MOUSIGNL Mouse signal?
4899 bne INPTKYBD No, skip ahead (must be keyboard)
4900 clrd Mouse signal, abort input & return
4901 bra INPTEXIT
4902
4903 INPTKYBD cmpb #KYBDSGNL Keyboard signal?
4904 * NOTE (6309 ONLY): IF LIVE DIRECTORY UPDATE IS ENABLED, WE WILL HAVE TO FLAG
4905 * IT HERE TO ACT ON _AFTER_ PROCESSING KEYBOARD INPUT
4906 bne INPTLOOP No, ignore any other signals
4907 lbsr IOOPTSON Turn pause,echo,text cursor on, release signals
4908 lbsr RDLN80CH Go read in up to 80 chars
4909 INPTEXIT leas 2,S Eat stack & return
4910 rts
4911
4912 * Waiting for user input, but received abort or interrupt signal
4913 INPTQUIT lbsr ST.RELEA Release any other pending signals
4914 ldd #1 Read 1 char from window path
4915 pshs D
4916 leax 2,S Point to temp spot
4917 ldd WNDWPATH
4918 pshs D,X
4919 lbsr I.READ Read 1 key from keyboard (hot key)
4920 clrd exit
4921 leas 8,S
4922 rts
4923
4924 KILOLAY2 pshs U
4925 ldd 4,S
4926 pshs D
4927 lbsr ST.RELEA
4928 lbsr OWEND
4929 bra ISC128K5
4930
4931 ISCR128K pshs U
4932 ldu 6,S
4933 ldd ID.WTYPE,U Get window type
4934 pshs d Save it
4935 cmpd #6
4936 bgt ISC128K4
4937 ldd WNDWPATH Get GSHELL window path
4938 ldx 6,S
4939 std GD.WPATH,X Save as program window path
4940 pshs d
4941 lbsr GCSETOFF
4942 lbsr ST.RELEA
4943 lbsr DWEND
4944 ldd ID.BKGND,U
4945 std ,S
4946 pshs d
4947 ldx ID.FRGND,U
4948 * Changed for x200 screens
4949 ldb #25
4950 pshs d,X
4951 ldd 8,S Get screen type
4952 lbsr COLS4080 40 or 80 column?
4953 beq ISC128K1 80 column, skip ahead
4954 ldb #40 40 columns
4955 bra ISC128K2
4956
4957 ISC128K1 ldb #80 80 columns
4958 ISC128K2 pshs d
4959 clrb
4960 pshs d
4961 pshs d
4962 ldx 14,S Get window type
4963 ldd WNDWPATH Get path # to window
4964 pshs D,X
4965 lbsr DWSET Set the new window
4966 leas 18,S
4967 std -2,S
4968 bne ISC128K3
4969 ldx #1
4970 ldd WNDWPATH
4971 pshs D,X
4972 lbsr SELECT
4973 lbsr MOUSENOW
4974 lbsr PAUSECHO
4975 leas 4,S
4976 clra
4977 clrb
4978 bra ISC128K5
4979
4980 ISC128K3 ldd #-1
4981 bra ISC128K5
4982
4983 ISC128K4 ldd #1
4984 ISC128K5 leas 2,S
4985 puls U,PC
4986
4987 * Get mouse packet - wait till button A is released
4988 GETMPAKT pshs U
4989 ldu #MOUSPCKT
4990 ldd 4,S
4991 pshs D,U
4992 GETMPAK1 lbsr GT.MOUSE Get mouse packet
4993 ldd PT.CBSA,U Button A pressed?
4994 bne GETMPAK1 Yes, wait till it is released
4995 leas 4,S
4996 puls U,PC
4997
4998 * Use mouse to position & size new window
4999 SETSTOP pshs U
5000 leas -10,S Make 10 byte temp area
5001 ldu #MOUSPCKT Point to mouse packet
5002 ldd 14,S
5003 pshs D
5004 bsr GETMPAKT Let auto-follow mouse for start position of window run until
5005 leas 2,S button A is released
5006 * Upper left corner is now selected
5007 SETSTOP1 ldd 14,S
5008 pshs D,X,Y
5009 lbsr ST.RELEA Release signals
5010 clra
5011 clrb
5012 std RECDSGNL
5013 std WPOSGOOD
5014 ldd #KYBDSGNL Set keyboard signal (So we can trap SPACEBAR to switch screens
5015 std 2,S for new window)
5016 lbsr ST.SSIG
5017 clra
5018 clrb
5019 std 6,S
5020 std 4,S
5021 std 8,S
5022 std 2,S
5023 lbsr SETDPTR Draw ptr=0,0
5024 ldd PROCYSIZ Min. X size of process
5025 std 4,S
5026 ldd PROCXSIZ Min. Y size of process
5027 std 2,S
5028 lbsr BOX Draw box (for window sizing)
5029 leas 6,S
5030 SETSTOP2 pshs U
5031 ldd 16,S
5032 pshs D
5033 lbsr GT.MOUSE Get mouse update
5034 leas 4,S
5035 ldb PT.CBSB,U Button B pressed?
5036 beq SETSTOP3 No, skip ahead
5037 ldd #S$WAKE Flag WAKE signal
5038 std RECDSGNL
5039 lbra SETTOP13
5040
5041 SETSTOP3 ldb PT.CBSA,U Button A pressed?
5042 beq SETSTOP4 No, skip ahead
5043 ldd 14,S Button B pressed - do this?
5044 pshs D
5045 bsr GETMPAKT Do auto-follow mouse update until button A pressed
5046 leas 2,S
5047 ldd WPOSGOOD
5048 lbeq SETTOP13
5049 bra SETSTOP2
5050
5051 * Button A pressed when positioning window
5052 SETSTOP4 ldd PT.ACX,U Get current X coord of mouse
5053 std 6,S Save it
5054 ldd PROCWTYP Get window type
5055 lbsr COLS4080 40 or 80 column?
5056 beq SETSTOP5 80 column, skip ahead
5057 ldd 6,S Get current X coord of mouse
5058 lsra divide by 2
5059 rorb
5060 std 6,S Save it
5061 SETSTOP5 ldd 6,S Get X coord of mouse
5062 andb #%11111000 Make it evenly divisible by 8
5063 std 6,S Save new X coord
5064 ldd PT.ACY,U Get current mouse Y coord
5065 andb #%11111000 Make it evenly divisible by 8
5066 std 4,S Save it
5067 ldd 6,S Get X coord
5068 cmpd 2,S
5069 bne SETSTOP6
5070 ldd 4,S
5071 cmpd ,S
5072 beq SETTOP11
5073 SETSTOP6 ldd 4,S
5074 addd PROCYSIZ
5075 pshs D
5076 ldd 8,S
5077 addd PROCXSIZ
5078 pshs D
5079 ldx 8,S
5080 ldd 12-2,S
5081 pshs D,X
5082 lbsr CHKPOSIT See if we can position window on existing screen
5083 leas 8,S
5084 std -2,S
5085 beq SETSTOP9
5086 ldd WPOSGOOD
5087 beq SETSTOP7
5088 ldd 14,S
5089 pshs D
5090 lbsr GOODWPOS
5091 leas 2,S
5092 bra SETSTOP8
5093
5094 SETSTOP7 bsr MAKERBOX
5095 SETSTOP8 ldd 4,S
5096 std ,S
5097 pshs D
5098 ldx 8,S
5099 stx 4,S
5100 ldd 18-2,S
5101 pshs D,X
5102 lbsr SETDPTR
5103 leas 6,S
5104 bsr MAKERBOX
5105 std -2,S
5106 bge SETTOP11
5107 bra SETTOP10
5108
5109 * Draw relative box
5110 MAKERBOX ldd PROCYSIZ Y size
5111 pshs D
5112 ldd PROCXSIZ X size
5113 pshs D
5114 ldd 18+2,S Get path # to full-screen window underneath program windows
5115 pshs D
5116 lbsr RBOX Draw box from current coord for currently selected size
5117 leas 6,S
5118 rts
5119
5120 SETSTOP9 ldd WPOSGOOD
5121 bne SETTOP11
5122 bsr MAKERBOX
5123 SETTOP10 ldd 14,S
5124 pshs D
5125 lbsr STOPSIGN
5126 leas 2,S
5127 SETTOP11 ldd RECDSGNL
5128 lbeq SETSTOP2
5129 cmpb #KYBDSGNL
5130 bne SETTOP12
5131 ldd #1
5132 pshs D
5133 leax 10,S
5134 ldd 18-2,S
5135 pshs D,X
5136 lbsr I.READ
5137 leas 6,S
5138 bra SETTOP13
5139
5140 SETTOP12 clra
5141 clrb
5142 std RECDSGNL
5143 lbra SETSTOP2
5144
5145 SETTOP13 ldd RECDSGNL Get last signal received
5146 beq SETTOP15 None, skip ahead
5147 ldd WPOSGOOD ??? Window positioning good?
5148 bne SETTOP14 Yes, create selected window pos/size to run program in
5149 bsr MAKERBOX No, Draw current
5150 SETTOP14 ldd 14,S
5151 pshs D
5152 lbsr GOODWPOS
5153 leas 2,S
5154 lbsr GETPSCRN Create new window (screen) if possible
5155 std 14,S Save flag
5156 blt SETTOP16
5157 lbra SETSTOP1
5158
5159 SETTOP15 ldd 14,S
5160 pshs D
5161 lbsr ST.RELEA Release signals
5162 leas 2,S
5163 ldd 2,S
5164 ldx 16,S
5165 std GD.XSTRT,X
5166 ldd ,S
5167 std GD.YSTRT,X
5168
5169 SETTOP16 ldd 14,S
5170 leas 10,S
5171 puls U,PC
5172
5173 SETSBOTM pshs U
5174 ldu 4,S
5175 leas -14,S
5176 ldx #MOUSPCKT
5177 stx 12,S
5178 clra
5179 clrb
5180 std WPOSGOOD
5181 ldx 20,S
5182 ldd GD.XSTRT,X
5183 addd PROCXSIZ
5184 std 2,S
5185 std 6,S
5186 ldd GD.YSTRT,X
5187 addd PROCYSIZ
5188 std ,S
5189 std 4,S
5190
5191 SETSBOT1 ldd 12,S
5192 pshs D
5193 pshs U
5194 lbsr GT.MOUSE
5195 leas 4,S
5196 ldd WPOSGOOD
5197 beq SETSBOT2
5198 ldx 12,S
5199 ldb PT.CBSA,X
5200 bne SETSBOT1
5201
5202 SETSBOT2 ldx 12,S Get ptr to mouse packet
5203 ldd PT.ACX,X Get current mouse X coord
5204 std 10,S Save it
5205 ldd PROCWTYP Get new process' window type
5206 lbsr COLS4080 Check if 40 or 80 column
5207 beq SETSBOT3 80 column, skip ahead
5208 ldd 10,S Get mouse X coord again
5209 asra Divide by 2
5210 rorb
5211 std 10,S Save it
5212 SETSBOT3 ldd 10,S Get mouse X coord
5213 pshs D Save it
5214 lbsr RNDUPTO8 Round up to nearest 8 pixel boundary
5215 std 10+2,S Save it again
5216 ldx 12+2,S Get mouse packet ptr again
5217 ldd PT.ACY,X Get mouse Y coord
5218 std ,S Save it
5219 lbsr RNDUPTO8 Round it up to nearest 8 pixel boundary
5220 leas 2,S Eat temp stack
5221 std 8,S Save it
5222 ldd 10,S Get X coord
5223 cmpd 6,S
5224 bge SETSBOT4
5225 ldd 6,S
5226 std 10,S
5227
5228 SETSBOT4 ldd 8,S
5229 cmpd 4,S
5230 bge SETSBOT5
5231 ldd 4,S
5232 std 8,S
5233
5234 SETSBOT5 ldd 10,S
5235 cmpd 2,S
5236 bne SETSBOT6
5237 ldd 8,S
5238 cmpd ,S
5239 beq SETBOT11
5240
5241 SETSBOT6 ldx 8,S
5242 ldd 12-2,S
5243 pshs D,X
5244 ldx 24,S
5245 ldd GD.YSTRT,X
5246 pshs D
5247 ldd GD.XSTRT,X
5248 pshs D
5249 lbsr CHKPOSIT
5250 leas 8,S
5251 std -2,S
5252 beq SETSBOT9
5253 ldd WPOSGOOD
5254 beq SETSBOT7
5255 pshs U
5256 lbsr GOODWPOS
5257 leas 2,S
5258 bra SETSBOT8
5259
5260 MAKEBOX2 ldd 2,S
5261 pshs D
5262 ldd 4+2,S
5263 pshs D
5264 pshs U
5265 lbsr BOX
5266 leas 6,S
5267 rts
5268
5269 SETSBOT7 bsr MAKEBOX2
5270
5271 SETSBOT8 ldd 8,S
5272 std ,S
5273 pshs D
5274 ldd 12,S
5275 std 4,S
5276 pshs D
5277 pshs U
5278 lbsr BOX
5279 leas 6,S
5280 std -2,S
5281 bge SETBOT11
5282 bra SETBOT10
5283
5284 SETSBOT9 ldd WPOSGOOD
5285 bne SETBOT10
5286 bsr MAKEBOX2
5287
5288 SETBOT10 pshs U
5289 bsr STOPSIGN
5290 leas 2,S
5291
5292 SETBOT11 ldx 12,S
5293 ldb PT.CBSA,X
5294 lbeq SETSBOT1
5295 ldd WPOSGOOD
5296 lbne SETSBOT1
5297 ldd 8,S
5298 ldx 20,S
5299 std GD.YEND,X
5300 pshs D
5301 ldd 12,S
5302 std GD.XEND,X
5303 pshs D
5304 pshs U
5305 lbsr BOX
5306 leas 14+6,S
5307 puls U,PC
5308
5309 RNDUPTO8 pshs U
5310 ldd 4,S
5311 addd #7
5312 andb #$F8
5313 addd #-1
5314 puls U,PC
5315
5316 STOPSIGN pshs U
5317 ldd #1
5318 std WPOSGOOD
5319 ldb #PTR.ILL
5320 pshs D
5321 ldx #GRP.PTR
5322 ldd 8-2,S
5323 pshs D,X
5324 lbsr GCSET
5325 leas 6,S
5326 puls U,PC
5327
5328 GOODWPOS clra
5329 clrb
5330 std WPOSGOOD
5331 ldd 2,S
5332 pshs D
5333 lbsr GCSETOFF
5334 puls D,PC
5335
5336 * Theoretically, code to check if we can fit new window on an existing
5337 * screen
5338 CHKPOSIT pshs U
5339 ldu PTBLSPTR Get ptr to process descriptors table
5340 bra CHKPOSI8 NOTE: BOTH CPUS: S/B ABLE TO BRA PAST STU -2,S
5341
5342 CHKPOSI1 ldd GD.SCRNO,U Get screen # for process entry
5343 cmpd ACTVSCRN Same as active process screen?
5344 bne CHKPOSI7 Nope, skip ahead
5345 ldd GD.XSTRT,U
5346 cmpd 4,S
5347 blt CHKPOSI3
5348 cmpd 8,S
5349 blt CHKPOSI4
5350 bra CHKPOSI7
5351
5352 CHKPOSI3 ldd GD.XEND,U
5353 cmpd 4,S
5354 bgt CHKPOSI4
5355 cmpd 8,S
5356 ble CHKPOSI7
5357
5358 CHKPOSI4 ldd GD.YSTRT,U
5359 cmpd 6,S
5360 blt CHKPOSI5
5361 cmpd 10,S
5362 blt CHKPOSI6
5363 bra CHKPOSI7
5364
5365 CHKPOSI5 ldd GD.YEND,U
5366 cmpd 6,S
5367 bgt CHKPOSI6
5368 cmpd 10,S
5369 ble CHKPOSI7
5370 CHKPOSI6 clra
5371 clrb
5372 puls U,PC
5373
5374 CHKPOSI7 ldu GD.LINK,U Get ptr to next forked program entry
5375 CHKPOSI8 stu -2,S Is there one?
5376 bne CHKPOSI1 Yes, check positions
5377 ldd #1 No, set flag to 1 & exit
5378 puls U,PC
5379
5380 * Entry: B=screen type
5381 * Exit: B=0 (80 column)
5382 * B=1 (40 column)
5383 COLS4080 decb Type 1?
5384 beq COLS408X Yes, flag 40 column
5385 cmpb #5 320x200x4?
5386 beq COLS408X Yes, flag 40 column
5387 cmpb #7 320x200x16?
5388 beq COLS408X Yes, flag 40 column
5389 clrb Flag for 80 column
5390 rts
5391
5392 COLS408X ldb #1
5393 rts
5394
5395 * >128k RAM, try to make new window???
5396 ISCR512K pshs U
5397 ldu 4,S Get ptr to current GD (forked process table) structure
5398 clrd
5399 std ACTVSCRN Current active screen to none
5400 std DWSETSTY New window type to none
5401 ldx 6,S
5402 lbsr GFXSIZXY Set window type & minimum X/Y sizes
5403 ldd ID.MEMSZ,X Get mem size need for new program
5404 std GD.MEMSZ,U Save it in forked process table
5405 ldd PROCWTYP Get default window type new program
5406 pshs d,X,Y Save window type, ID.* tbl ptr & room for 2 bytes(?)
5407 bsr COLS4080 Figure it if 40 or 80 column screen
5408 stb 5,S Save 40/80 flag (0=80 column)
5409 puls d Get window type back
5410 decb
5411 beq ISC512K3 H/W text handler (type 1) - Just create new window
5412 decb
5413 beq ISC512K3 H/W text handler (type 2) - Just create new window
5414 ldb #40 Default to 40 column screen
5415 tst 3,S Was process window type 40 or 80 column
5416 bne ISC512K2 40, skip ahead
5417 ldb #80 It was 80
5418 ISC512K2 cmpb ID.XSIZE+1,X If min width<>full width window, go to window
5419 bne ISC512K6 sizing routine
5420 lda ID.YSIZE+1,X If min height<>full height window, go to window sizing
5421 cmpa #25 routine
5422 bne ISC512K6
5423 * New window is full size goes here
5424 ISC512K3 clrd Default window x,y start to 0,0
5425 std GD.XSTRT,U
5426 std GD.YSTRT,U
5427 ldd #319 Default to 320 X pixel size
5428 tst 3,S Was it 40 column window?
5429 bne ISC512K5 Yes, 320 is fine
5430 ldd #639 80 column, so 640 X pixel size
5431 ISC512K5 std GD.XEND,U Save X size for new process
5432 ldd #199 Y end is 199 (NitrOS9 only)
5433 std GD.YEND,U
5434 ldd #-1 Flag active screen with -1 (?)
5435 std ACTVSCRN
5436 ldd PROCWTYP Get process' requested type
5437 std DWSETSTY Save as screen type to use to create new window
5438 bra ISC512K7
5439
5440 * New window is sized by user - do positioning/sizing
5441 ISC512K6 lbsr GETPSCRN ???Activate screen we will be putting new window on
5442 std ,S Save flag
5443 lblt IS512K13 If -2 or -1, eat stack & exit (Either scrn tbl full, or deleted old screen)
5444 pshs d,U
5445 lbsr SETSTOP Position & size window with mouse
5446 leas 4,S
5447 std ,S Save flag
5448 lblt IS512K13
5449 pshs d,U
5450 lbsr SETSBOTM
5451 ldd 4,S
5452 std ,S
5453 lbsr GCSETOFF
5454 leas 4,S
5455 ldx #0
5456 ldd ,S
5457 pshs d,X
5458 lbsr LSET
5459 leas 4,S
5460 * Create new window (?)
5461 ISC512K7 ldd ACTVSCRN
5462 std GD.SCRNO,U
5463 blt ISC512K8
5464 lbsr LINKWNDW
5465 ISC512K8 lda #UPDAT. Open path to next available window
5466 ldx #SLASHW
5467 lbsr I.OPEN
5468 std 2,S Save path #
5469 blt IS512K13 negative (error), skip ahead
5470 std GD.WPATH,U Save as path # to window for program to fork
5471 ldx 10,S
5472 bne ISC512K9
5473 clra
5474 clrb
5475 ldx #1
5476 bra IS512K10
5477
5478 ISC512K9 ldd ID.FRGND,X Get foreground color
5479 ldx ID.BKGND,X Get background color
5480 IS512K10 pshs X Save border color (Background copy)
5481 pshs d,X Save background & foreground colors
5482 leas -12,S Make room on stack for rest of DWSET
5483 ldd GD.YSTRT,U
5484 bsr DIVDX8
5485 std 6,S Save Y start of window
5486 ldd GD.YEND,U
5487 incb
5488 bsr DIVDX8
5489 subd 6,S Save Y window size
5490 std 10,S
5491 ldd GD.XSTRT,U Save X start of window
5492 bsr DIVDX8
5493 std 4,S
5494 ldd GD.XEND,U Save X window size
5495 incd
5496 bsr DIVDX8
5497 subd 4,S
5498 std 8,S
5499 ldd DWSETSTY Save screen type
5500 std 2,S
5501 ldd 20,S Save path to new window
5502 std ,S
5503 lbsr DWSET
5504 leas 18,S
5505 std -2,S
5506 bne IS512K12
5507 ldd DWSETSTY
5508 beq IS512K11
5509 ldd 2,S
5510 pshs D
5511 lbsr SELECT
5512 puls D
5513
5514 IS512K11 ldd #2
5515 std GD.DW.OW,U
5516 decb
5517 bra IS512K13
5518
5519 IS512K12 ldd #-1
5520
5521 IS512K13 leas 4,S
5522 puls U,PC
5523
5524 *D=D/8
5525 DIVDX8 asra
5526 rorb
5527 asra
5528 rorb
5529 asra
5530 rorb
5531 rts
5532
5533 *D=D*8
5534 MULDX8 aslb
5535 rola
5536 aslb
5537 rola
5538 aslb
5539 rola
5540 rts
5541
5542 * ???
5543 * NOTE: BOTH CPUS: SINCE MAX=8, LDB ACTVSCRN+1 WOULD BE FINE
5544 * Exit: D=-1 : screen table full, could not create new screen
5545 * D=-2 : Closed existing screen table, did not create new screen
5546 GETPSCRN pshs U Preserve U
5547 leas -2,S Make room on stack
5548 ldu #SCRNTABL Point to start of screens used table
5549 ldd ACTVSCRN Get active screen #
5550 aslb x4 (size of each entry)
5551 aslb
5552 leau D,U Point to active screen entry
5553 ldb ACTVSCRN+1 Get active screen # again
5554 beq GETPSCR3 1st entry, skip ahead (?)
5555 leax SC.SIZE,U Point to next entry
5556 lda SC.USERS,X Any paths already open to this next screen?
5557 bne GETPSCR3 Yes, skip ahead
5558 * Cleanup? seems to close screen path if no programs on screen
5559 ldd WNDWPATH No programs on this screen, get GSHELL window path
5560 pshs D,X
5561 lbsr SELECT Go select GSHELL window
5562 puls D,X
5563 lbsr CLOSE.X Close screen entry path
5564 ldd #-2 Exit flag
5565 bra GETPSCR6
5566
5567 * NOTE: IN ADDITION TO ADDING SUPPORT FOR VDG SCREENS, AND WINDOW TYPES
5568 * WITH GSHELL PALETTES (INSTEAD OF STANDARD), WE SHOULD PUT IN A WILDCARD
5569 * ONE FOR PROGRAMS THAT DON'T CARE (EX. ZONE RUNNER, ROGUE, ETC.) THAT CAN
5570 * RUN ON ANY TYPE AS LONG AS THERE IS ROOM, BASED ON MINIMUM X/Y SIZES.
5571 * (AND IT HAS TO BE ON A GRAPHICS WINDOW)
5572 * SC.USERS count will be at least 1 (for the underlying size select window)
5573
5574 * This chunk checks against window types for screens in active use...
5575 GETPSCR1 lda SC.WTYPE,U Get screen type
5576 cmpa PROCWTYP+1 Same as window type needed for process?
5577 bne GETPSCR2 No, try next screen
5578 lda SC.USERS,U Screen initialized already?
5579 bne GETPSCR8 Yes, skip ahead
5580 GETPSCR2 incb Set active screen to next one
5581 stb ACTVSCRN+1
5582 leau SC.SIZE,U Bump to next screen table
5583 GETPSCR3 cmpb #8 On last possible active screen?
5584 blt GETPSCR1 No, check this screen
5585 * No current screen entry of correct type
5586 ldu #SCRNTABL IF on last screen, point to start of screen table
5587 clrb Next routine starts @ screen 0 again
5588 bra GETPSCR5 See if we can add new screen to list
5589
5590 * This chunk checks to see if we can add a new screen to the screen table
5591 GETPSCR4 lda SC.USERS,U Is this screen initialized already?
5592 beq GETPSCR7 No, use it
5593 incb Yes, try next one
5594 leau SC.SIZE,U
5595 GETPSCR5 stb ACTVSCRN+1 Save screen #
5596 cmpb #8 On last one?
5597 blt GETPSCR4 No, check next
5598 ldd #-1 ERROR - no room for new screen
5599 GETPSCR6 std ,S Save flag as to what happened
5600 bra GETPSCR9 Restore regs & exit
5601
5602 * Empty screen table entry - add new entry (Screen) for process
5603 GETPSCR7 ldd PROCWTYP Get process window type
5604 stb SC.WTYPE,U Save as screen table screen type
5605 pshs D Save it
5606 bsr OPNSLSHW Open new window (/w)
5607 leas 2,S Eat stack
5608 stb SC.PTHNO,U Save new window path #
5609 GETPSCR8 ldb SC.PTHNO,U Get path # to screen
5610 sex Save it as D for subroutines
5611 std ,S
5612 blt GETPSCR9 If new window failed, exit
5613 inc ACTVSCRN+1 Bump up active screen #
5614 bsr INITPSCR Select new window, LSET to XOR, set up mouse
5615 GETPSCR9 puls D,U,PC
5616
5617 * Select new window, prepare for sizing/etc.
5618 INITPSCR pshs D Save new window path #
5619 pshs D & again
5620 lbsr INITMOUS Set mouse parms & turn auto follow on
5621 lbsr CURSCLOF Cursor & scaling off
5622 lbsr SELECT Select new window as interactive one
5623 ldd #3 gfx logic set to XOR
5624 std 2,S
5625 lbsr LSET
5626 clr 3,S
5627 lbsr PAUSECHO Shut echo & pause off
5628 leas 4,S Eat stack & return
5629 rts
5630
5631 * Create new window - GSHPAL window stuff & VDGINT stuff should go here!
5632 * Called from GETPSCR7 only. Should be able to sneak GSHPAL flag as 1st byte
5633 * of window type (0=not gshpal, <>0=gshpal), so window type needs no
5634 * massaging here (or, do masks here)
5635 * Entry: 0-1,s = RTS address
5636 * 2-3,s = window type
5637 * Exit: D=New window path #
5638 * <0 means failure on OPEN
5639 OPNSLSHW pshs U
5640 ldx #SLASHW
5641 lda #UPDAT.
5642 lbsr I.OPEN Open /w
5643 tfr D,U Copy path # to U
5644 std -2,S
5645 blt OPNSLSHX Error opening path, exit
5646 ldb #80
5647 lda 5,S Get window type (could put GSHPAL flag at 4,s)
5648 * beq SetupVDG Add this in for when we do VDG window support
5649 anda #1 See if 40 or 80 column window
5650 bne OPNSLSH2
5651 ldb #40
5652 OPNSLSH2 pshs d Save window width for DWSET
5653 ldb #2 Border color=2
5654 pshs d
5655 clrb Background color=0
5656 pshs d
5657 incb Foreground color=1
5658 pshs d
5659 ldb #25 Window height=25
5660 pshs d
5661 ldx 8,S Get window width
5662 clrb
5663 pshs d,X Save Y start & window width
5664 pshs d Save X start
5665 ldd 20,S Get window type
5666 pshs d Save for DWSET
5667 pshs U Save path # to new window (new screen)
5668 lbsr DWSET Set the window
5669 clrb
5670 std 2,S
5671 lbsr DWPROTSW
5672 leas 20,S Eat temp stack
5673 OPNSLSHX tfr U,D Transfer new window path # to D & exit
5674 puls U,PC
5675
5676 SRWINDOW decb - Note, if B does not need to be signed, change
5677 ldx #SCRNTABL LEAX d,x to abx
5678 aslb
5679 aslb
5680 leax D,X
5681 rts
5682
5683 LINKWNDW bsr SRWINDOW
5684 inc SC.USERS,X
5685 rts
5686
5687 * Unlink window from active screen list
5688 UNLKWNDW ldd 2,S
5689 bsr SRWINDOW
5690 dec SC.USERS,X Dec # users on current screen
5691 bne UNLKWND1 Still some left, exit
5692 * Close current SC.* entry path
5693 * Entry: X=ptr to current entry in used screen table
5694 CLOSE.X lda SC.PTHNO,X Get path to window
5695 os9 I$CLOSE Close it
5696 clra Flag as no path anymore & return
5697 sta SC.PTHNO,X
5698 UNLKWND1 rts
5699
5700 * Calc highest pixel values allowed for AIF entry (X&Y), and window type
5701 * Saves PROCYSIZ, PROCXSIZ, PROCWTYP
5702 * Entry: X=ptr to ID.* structure
5703 GFXSIZXY ldd ID.XSIZE,X Get min. X size for AIF entry
5704 lbsr MULDX8 *8 for pixels
5705 subd #1 -1 for far right pixel base 0
5706 std PROCXSIZ Save as min. X size for process
5707 ldd ID.YSIZE,X Do pixel Y calc
5708 lbsr MULDX8
5709 subd #1
5710 std PROCYSIZ Save as min. Y size for process
5711 ldd ID.WTYPE,X Save AIF window type too.
5712 std PROCWTYP
5713 rts
5714
5715 ENV.FILE fcc "/dd/sys/env.file"
5716 fcb NUL
5717
5718 GET.ENV pshs U
5719 ldu #ENVFLBFR Point U to 80 char buffer for enviornment file lines
5720 ldd #$ffff Defaults for keyboard & mouse stuff
5721 std <GIPMSRES Both mouse defaults
5722 std <GIPKYST Both keyboard defaults
5723 ldd #128 Default RAM size to 128k
5724 sta <CURGFXSZ Size of GSHPAL buffer to 0
5725 std <RAMSIZE
5726 leax <ENV.FILE,PC Point to filename
5727 pshs X,Y
5728 pshs U
5729 lbsr STRCPY
5730 leas 4,S
5731 lda #READ.
5732 tfr U,X
5733 lbsr I.OPEN Open env.file
5734 std ,S Save path #
5735 blt GET.ENV3 Bad path #, exit
5736
5737 GET.ENV1 ldd #80 Size of line buffer to read
5738 pshs d
5739 pshs U
5740 ldd 4,S
5741 pshs d
5742 lbsr I.READLN Read line from env.file
5743 leas 6,S
5744 std -2,S
5745 ble GET.ENV2 End of file, close & exit
5746 pshs U
5747 bsr PROCENVF Go process lines we actually pay attention to
5748 leas 2,S
5749 bra GET.ENV1 Keep going till env.file done
5750
5751 ResetPal pshs d,u For GET.ENV3 below
5752 bra DoPal
5753
5754 GET.ENV2 lbsr I.CLOSE
5755 pshs y Do mouse/keyboard updates
5756 lda <GIPMSRES Any change to Mouse resolution?
5757 cmpa #$ff
5758 bne Mse2 Yes, use it
5759 clra No, default to low res
5760 Mse2 ldb <GIPMSPRT Any change to mouse port?
5761 cmpb #$ff
5762 bne Kybd1 Yes, use it
5763 ldb #1 No, default to right port
5764 Kybd1 tfr d,x Move mouse stuff to X
5765 ldy <GIPKYST Get keyboard repeat start/repeat speed
5766 lda <WNDWPATH+1 Get window path
5767 ldb #$94 SS.GIP call
5768 os9 I$SETSTT Set keyboard/mouse stuff
5769 puls y
5770 DoPal ldb <CURGFXSZ Get current graphics buffer write size
5771 beq GET.ENV3 Empty, exit
5772 clra Put in Y
5773 pshs y Save Y (else screws up)
5774 tfr d,y
5775 ldx #GSHBUF Point to start of buffer
5776 lda <WNDWPATH+1 Get path # to window
5777 os9 I$Write Write out palette changes
5778 puls y Restore y
5779 GET.ENV3 puls D,U,PC
5780
5781 RBFDEVEQ fcc "RBFDEV="
5782 RBFSEND fcb NUL
5783
5784 RAMEQU fcc "RAM="
5785 RAMSEND fcb NUL
5786
5787 * Process and env.file line
5788 PROCENVF pshs U
5789 ldu 4,S
5790 leas -2,S
5791 ldb #RBFSEND-RBFDEVEQ
5792 leax <RBFDEVEQ,PC
5793 bsr PROCLINE Check if 'RBFDEV='
5794 bne PROCENV2 No, check next
5795 leau RBFSEND-RBFDEVEQ,U Point to start of string
5796 PROCENV1 pshs U Save start of string ptr
5797 bsr TERMNATE Append NUL terminator on end of device name
5798 std 2,S Save flag as to whether whole string is done
5799 lbsr ADDEVICE Add the device to the list
5800 lbsr STRLEN Get length of device name
5801 leas 2,S Eat extra on stack
5802 addd #1 Bump length up to accomodate NUL (INCD for 6309)
5803 leau D,U Point to start of next device name (if any)
5804 ldd ,S Get flag - do we have more to do?
5805 beq PROCENV1 Yes, keep doing until all devices done
5806 bra PROCENV4 No, exit process current line of env.file routine
5807
5808 * Check if current env.file line=current flag we are looking for
5809 * Entry:B=Size of compare to do
5810 * X=Text of current flag we are looking for
5811 * Exit: Flags set so BEQ will mean a match
5812 PROCLINE pshs d
5813 pshs X
5814 pshs U
5815 lbsr STRNCMP
5816 leas 6,S
5817 std -2,S
5818 rts
5819
5820 PROCENV2 ldb #RAMSEND-RAMEQU Check for RAM setting ALREADY HANDLES >128K
5821 leax <RAMEQU,PC
5822 bsr PROCLINE
5823 bne PROCENV3 Not RAM, check next
5824 leau RAMSEND-RAMEQU,U Point to after RAM=
5825 pshs U Save ptr
5826 lbsr ATOI Convert ASCII text from [,u] into D register
5827 leas 2,S Save RAM size from file
5828 std <RAMSIZE Save RAM size found
5829 bra PROCENV4 Done processing current line
5830
5831 EXECEQU fcc "EXEC="
5832 EXECSEND fcb NUL
5833
5834 PROCENV3 ldb #EXECSEND-EXECEQU Check for EXEC setting
5835 leax <EXECEQU,PC
5836 bsr PROCLINE
5837 bne GSHPal
5838 leau EXECSEND-EXECEQU,U Point to 1st byte after EXEC=
5839 pshs U
5840 bsr TERMNATE Terminate the string with a NUL
5841 lbsr CHGXDIR Change Execution directory to one read from env.file
5842 std ,S++ Eat stack & set CC
5843 bne PROCENV4
5844 ldx #XDIRNAME Copy execution path name here
5845 pshs X,U
5846 lbsr STRCPY
5847 leas 4,S
5848
5849 PROCENV4 puls d,U,PC Restore regs & return
5850
5851 GSHPALEQ fcc "GSHPAL" --Added for GShell palettes
5852 GSHSEND fcb NUL
5853
5854 * Add a NUL to the end of a string segment (, or CR delimeter)
5855 * Entry: 2,S=Ptr to string
5856 * Exit: D=0 if end of string
5857 * D=1 if string has more to process yet
5858 TERMNATE ldx 2,S Get ptr to start of string
5859 clrb NUL to terminate string with
5860 TERMNAT1 lda ,X Get char
5861 beq TERMNAT4 Already NUL, flag & exit
5862 cmpa #', Comma?
5863 beq TERMNAT2 Yes, set NUL & exit
5864 cmpa #CR End of line?
5865 beq TERMNAT3 Yes, set NUL & flag & exit
5866 leax 1,X Bump up string ptr
5867 bra TERMNAT1 Keep looking
5868
5869 TERMNAT2 stb ,X Save NUL as separator
5870 clra We're done the entire string flag
5871 rts
5872
5873 TERMNAT3 stb ,X Save NUL as separator
5874 TERMNAT4 ldd #1 We still have more in string to do flag
5875 rts
5876
5877 * NOTE: FROM HERE ON, SHOULD CHANGE NON-LBRA TO PROCENV4 TO BE SHORT BRANCHES
5878 * TO THE TERMINATING LBRA PROCENV4 (TO SAVE A LITTLE SPACE)
5879
5880 * Added by LCB 8/12/1998 - Check for GShell default palettes (only 0-3 legit)
5881 GSHPal ldb #GSHSEND-GSHPALEQ Check for GSHPAL setting
5882 leax <GSHPALEQ,pc
5883 bsr PROCLINE
5884 lbne DefCheck Not, try next
5885 PalLoop leau GSHSEND-GSHPALEQ,u Point to 1st byte after GSHPAL
5886 ldd ,u++ Get palette # to assign to
5887 cmpb #'= 2nd char '='?
5888 bne PROCENV4 No, ignore this line
5889 suba #$30 Convert to binary palette #
5890 blt PROCENV4 Went negative, ignore line
5891 cmpa #3 Within palette range?
5892 bhi PROCENV4 No, ignore this line
5893 sta <CURPAL Save palette #
5894 ldd ,u++ Get next 2 chars
5895 cmpb #', 2nd a comma?
5896 bne PROCENV4 No, ignore line
5897 suba #$30 Convert to binary
5898 blt PROCENV4 negative, ignore line
5899 cmpa #3 Within range?
5900 bhi PROCENV4 (No, ignore line)
5901 lsla Move to 1st red bit
5902 lsla
5903 tfr a,b Save copy
5904 anda #4 Save lsb
5905 pshs a
5906 lslb Calculate msb of RED
5907 lslb
5908 andb #$20
5909 addb ,s+ Merge the reds together
5910 stb <CURCOLOR Save it
5911 ldd ,u++ Get next color
5912 cmpb #', 2nd char a comma?
5913 bne PROCENV4 No, ignore line
5914 suba #$30 Convert to binary
5915 blt PROCENV4 negative, ignore line
5916 cmpa #3 Within range?
5917 bhi PROCENV4 (No, ignore line)
5918 lsla Shift to 1st Green bit
5919 tfr a,b Save copy
5920 anda #2 Save lsb
5921 pshs a
5922 lslb Calculate msb of Green
5923 lslb
5924 andb #$10
5925 addb ,s+ Merge the greens together
5926 orb <CURCOLOR mix with red
5927 stb <CURCOLOR Save it
5928 ldd ,u++ Get last color
5929 cmpb #CR 2nd char a CR?
5930 bne GSHPalEx No, ignore line
5931 suba #$30 Convert to binary
5932 blt GSHPalEx negative, ignore line
5933 cmpa #3 Within range?
5934 bhi GSHPALEx (No, ignore line)
5935 tfr a,b
5936 andb #1
5937 pshs b Save lsb of Blue
5938 lsla Move msb of Blue
5939 lsla
5940 anda #$08 Just msb
5941 adda ,s+ Merge blues together
5942 ora <CURCOLOR merge with red/green
5943 ldx #GSHBUF Point to start of palette buffer
5944 ldb <CURGFXSZ Get size of previous buffer
5945 abx Point X to start
5946 addb #4 Add for next position
5947 stb <CURGFXSZ Save it
5948 sta 3,x Save color
5949 lda <CURPAL Get current palette
5950 sta 2,x Save palette
5951 ldd #$1b31 Change palette command
5952 std ,x Save it
5953 GSHPalEx lbra PROCENV4 Done processing line
5954
5955 DEFTYPE fcc "DEFTYPE="
5956 DEFTPEND fcb NUL
5957
5958 MONTYPE fcc "MONTYPE="
5959 MONTEND fcb NUL
5960
5961 * Added by LCB 12/24/1998 - Check for Default screen type=6,7,8
5962 DefCheck ldb #DEFTPEND-DEFTYPE Check for Default screen type
5963 leax <DEFTYPE,PC
5964 lbsr PROCLINE
5965 bne MonCheck No, try next
5966 leau DEFTPEND-DEFTYPE,u Point to after DEFTYPE=
5967 lda ,u Get screen type
5968 suba #$30 Adjust to binary
5969 cmpa #6 Below type 6?
5970 blo DefEx Yes, ignore
5971 cmpa #8 Above type 8?
5972 bhi DefEx Yes, ignore
5973 sta DEFWTYPE+1 One of 3 good ones, save it
5974 DefEx lbra PROCENV4 Done processing current line
5975
5976 * Added by LCB 04/15/1999 - set monitor type
5977 MonCheck ldb #MONTEND-MONTYPE Check for monitor type
5978 leax <MONTYPE,pc
5979 lbsr PROCLINE
5980 bne MousChk1 No, try next
5981 leau MONTEND-MONTYPE,u Point to after MONTYPE=
5982 ldb ,u Get monitor type
5983 subb #$30 Adjust to binary
5984 cmpb #2 Above 2, ignore
5985 bhi MonEx
5986 clra
5987 tfr d,x Move to proper register
5988 lda <WNDWPATH+1 Get path # to window
5989 ldb #$92 SS.Montr call
5990 os9 I$SETSTT Change monitor type
5991 MonEx lbra PROCENV4 Done processing current line
5992
5993 PTRSIDE fcc "PTRSID="
5994 PTRSDEND fcb NUL
5995
5996 * Following 4 (PTRSID, PTRRES, REPSPD, REPSTR) added by LCB 04/15/1999 - set
5997 * keyboard and mouse parameters
5998 MousChk1 ldb #PTRSDEND-PTRSIDE Check for Mouse port
5999 leax <PTRSIDE,pc
6000 lbsr PROCLINE
6001 bne MousChk2 No, try next
6002 leau PTRSDEND-PTRSIDE,u Point to after PTRSID=
6003 lda ,u Get parm
6004 suba #$30 ASC to binary
6005 cmpa #1
6006 bhi Mse1Ex <>0 or 1 is illegal
6007 ldb #1
6008 subr a,b Invert value
6009 incb Bump up to 1-2 for SS.GIP
6010 sta <GIPMSPRT Save it
6011 Mse1Ex lbra PROCENV4
6012
6013 PTRRES fcc 'PTRRES='
6014 PTRRESEN fcb NUL
6015
6016 MousChk2 ldb #PTRRESEN-PTRRES Check for mouse resolution
6017 leax <PTRRES,pc
6018 lbsr PROCLINE
6019 bne KybdChk1 No, try next
6020 leau PTRRESEN-PTRRES,u Point to after PTRRES=
6021 lda ,u Get parm
6022 suba #$30 ASC to bin
6023 cmpa #1
6024 bhi Mse2Ex <>1 or 2 is illegal
6025 sta <GIPMSRES Save mouse res
6026 Mse2Ex lbra PROCENV4
6027
6028 REPSTR fcc 'REPSTR='
6029 REPSTREN fcb NUL
6030
6031 * Start delay table from CONTROL
6032 StrtTble fcb 0,45,30,20,10
6033
6034 KybdChk1 ldb #REPSTREN-REPSTR Check for keyboard repeat start
6035 leax <REPSTR,pc
6036 lbsr PROCLINE
6037 bne KybdChk2 No, try next
6038 leau REPSTREN-REPSTR,u Point to after REPSTR=
6039 lda ,u Get parm
6040 suba #$30 ASC to bin
6041 beq Key1Ex 0 not legal
6042 cmpa #5
6043 bhi Key1Ex Above 5 ain't either (unlike manual's 3)
6044 leax <StrtTble,pc Point to table
6045 deca 0-4
6046 ldb a,x Get speed setting
6047 stb <GIPKYST Save keyboard repeat start
6048 Key1Ex lbra PROCENV4
6049
6050 REPSPD fcc 'REPSPD='
6051 REPSPDEN fcb NUL
6052
6053 SpdTble fcb 24,12,6,3,2
6054
6055 KybdChk2 ldb #REPSPDEN-REPSPD Check for keyboard repeat speed
6056 leax <REPSPD,pc
6057 lbsr PROCLINE
6058 bne Key2Ex No, done processing current line
6059 leau REPSPDEN-REPSPD,u Point to after REPSPD=
6060 lda ,u Get parm
6061 suba #$30 ASC to bin
6062 beq Key2Ex 0 not legal
6063 cmpa #5
6064 bhi Key2Ex Above 5 ain't either (unlike manual's 3)
6065 leax <SpdTble,pc Point to table
6066 deca 0-4
6067 ldb a,x Get speed setting
6068 stb <GIPKYSPD Save keyboard repeat speed
6069 Key2Ex lbra PROCENV4
6070
6071 * Get file descriptor info
6072 GT.FDINF pshs d,X,Y,U
6073 ldx 12,S
6074 leax DIR.FD,X
6075 lda ,X+
6076 ldb #1
6077 tfr D,Y
6078 ldu ,X
6079 ldx 14,S
6080 lda 1,S
6081 ldb #SS.FDINF
6082 os9 I$GETSTT
6083 puls d,X,Y,U
6084 bra ISYSRET1
6085
6086 * Entry: 0-1,s = RTS address
6087 * 2-3,s = Path for window (only use 3,s)
6088 * 4-5,s = On/off flag (0=off, 1=on) (only use 5,s)
6089 PAUSECHO ldx #SSOPTBFR Point to window's SS.option buffer
6090 lda 3,S Get path
6091 clrb SS.OPT Getstat
6092 os9 I$GETSTT Get current window options
6093 bcs ISYSRET1
6094 ldb 5,S Get on/off flag
6095 stb 4,X Set echo
6096 stb 7,X Set page pause
6097 clrb SS.OPT SetStat
6098 os9 I$SETSTT Set echo & pause options
6099 ISYSRET1 lbra SYSRET
6100
6101 *Close box char, and CurXY to 8,0
6102 CBOXICON fcb $C7,$02,$28,$20
6103
6104 *Text string to draw 80 column wide stripes for directory bar
6105 * We should make this box/line calls, as faster (possibly smaller?)
6106 STRIPBAR fcb $C5,$C5,$C5,$C5,$C5,$C5,$C5,$C5
6107 fcb $C5,$C5,$C5,$C5,$C5,$C5,$C5,$C5
6108 fcb $C5,$C5,$C5,$C5,$C5,$C5,$C5,$C5
6109 fcb $C5,$C5,$C5,$C5,$C5,$C5,$C5,$C5
6110 fcb $C5,$C5,$C5,$C5,$C5,$C5,$00
6111
6112 WBOX.BAR leax <CBOXICON,PC Point to CLOSE box & CurXY 8,0
6113 ldb #29 Default to close box & 25 "stripe" bar chars to write
6114 tst FLAG640W
6115 beq WRITEBX If 320 pixel screen, go write it
6116 ldd <WNDWPATH Save window path
6117 pshs d
6118 ldb #33 Do close box & 29 "stripe" bar chars
6119 bsr WRITEBX
6120 leas 2,S Eat temp window path
6121 ldb #36 Do 36 more "stripe" bar chars (65 total)
6122 leax <STRIPBAR,PC
6123 bra WRITEBX
6124
6125 GOTOXY ldx #GFXBUF2
6126 lda #2
6127 ldb 5,S
6128 addb #SPACE
6129 std ,X
6130 ldb 7,S
6131 addb #SPACE
6132 stb 2,X
6133 ldb #3
6134
6135 GFXWR2 ldx #GFXBUF2
6136
6137 * Write text string
6138 * Entry: B =# chars to write
6139 * X =Ptr to text to write
6140 * 4-5,s=Path to write to (only 5 used)
6141 WRITEBX pshs Y
6142 clra
6143 tfr D,Y
6144 lda 5,S
6145 os9 I$WRITE
6146 puls Y
6147 bra ISYSRET1
6148
6149 CLRSCRN ldb #FF
6150 bra OUT1
6151
6152 RINGBELL ldb #BEL
6153 OUT1 stb GFXBUF2,Y
6154 ldb #1
6155 bra GFXWR2
6156
6157 CURSORON ldb #$21
6158 bra CURSRSET
6159
6160 CURSROFF ldb #$20
6161 CURSRSET lda #5
6162 std GFXBUF2,Y
6163 ldb #2
6164 bra GFXWR2
6165
6166 * Change gfx cursor to arrow
6167 CRSRAROW lda #GRP.PTR
6168 ldb #PTR.ARR
6169 bra GCSET.2
6170
6171 GCSETOFF clra
6172 clrb
6173 GCSET.2 std GFXBUF2+2,Y
6174 ldd #$1B39
6175 std GFXBUF2,Y
6176 ldb #4
6177 bra GFXWR2
6178
6179 * Entry for change EXEC dir
6180 CHGXDIR lda #EXEC.
6181 bra I.CHGDIR
6182
6183 * Entry for change DATA dir
6184 CHGDDIR lda #READ.
6185 I.CHGDIR pshs A
6186 * SHOULD WE CHANGE TO JUST DROP SAMPLING RATE SO MOUSE CAN STILL MOVE?
6187 * Shut mouse off (note that keyboard mouse ignores this)
6188 lbsr NOMOUSE
6189 puls A
6190 ldx 2,S
6191 os9 I$CHGDIR
6192 pshs CC,B
6193 * Mouse back on
6194 lbsr MOUSENOW
6195 puls CC,B
6196 lbra SYSRET
6197
6198 MOUSOFF clra
6199 clrb
6200 bra INITMOU1
6201
6202 * 0-1,s = Path to window to read mouse from
6203 * 2-3,s = Mouse sampling rate
6204 * 4-5,s = Mouse button timeout
6205 * 6-7 ,s= Auto follow mouse flag
6206 * Init mouse to
6207 INITMOUS ldd #3
6208 INITMOU1 ldx #1
6209 pshs X
6210 pshs d,X Save mouse sampling rate & mouse button timeout
6211 ldd 8,S
6212 pshs d Save path to window mouse is on
6213 * NOTE: ONLY CALLED ONCE...EMBED WITH RAW CALL!
6214 lbsr ST.MOUSE Set mouse parms
6215 leas 8,S Eat temp stack & return
6216 rts
6217
6218 SETUPENV pshs U
6219 ldu #DRIVETBL
6220 stu <DRTBLPTR
6221 ldx #DRVNMTBL
6222 clra
6223 SETUPEN1 stx FL.FNAME,U
6224 ldb #IC.DRIVE
6225 stb FL.ICONO,U
6226 ldb #8
6227 std FL.XSTRT,U
6228 ldb #32
6229 std FL.XEND,U
6230 ldb <DRIVYPOS
6231 std FL.YSTRT,U
6232 addb #12
6233 std FL.YEND,U
6234 addb #12
6235 stb <DRIVYPOS
6236 leax 32,X
6237 leau FL.SIZE,U
6238 dec <DEVICNTR
6239 bne SETUPEN1
6240 lbsr GET.ENV Read env.sys file
6241 puls U,PC
6242
6243 ADDEVICE pshs U
6244 ldx <DRTBLPTR
6245 ldb <DEVICNTR
6246 cmpb #5
6247 bge ADDEVIC1
6248 pshs B
6249 inc DEVICNTR
6250 ldu 5,S
6251 pshs X,U
6252 bsr MOVDNAME
6253 puls X,U
6254 leau FL.SIZE,X
6255 stu <DRTBLPTR
6256 ldb ,S+
6257 beq ADDEVIC1
6258 leau 0-FL.SIZE,X
6259 stx FL.LINK,U
6260 ADDEVIC1 puls U,PC
6261
6262 MOVDNAME ldx 2,S
6263 ldd FL.FNAME,X
6264 ldx 4,S
6265 pshs d,X
6266 lbsr STRCPY
6267 leas 4,S
6268 rts
6269
6270 FIXDRTBL ldb <DEVICNTR
6271 beq FIXDRTB1
6272 ldd <SELECTED
6273 beq FIXDRTBX
6274 pshs d
6275 lbsr UNSLICON
6276 leas 2,S
6277
6278 FIXDRTBX ldx <DRTBLPTR
6279 clrd
6280 std <SELECTED
6281 std FL.LINK-FL.SIZE,X
6282 ldd <DEVICNOW
6283 beq FIXDRTB1
6284 cmpx <DEVICNOW
6285 bhi FIXDRTB1
6286 clrd
6287 std <DEVICNOW
6288 std <STRTICON
6289 lbsr ENFREFL1
6290 lbsr ENBLSOFF
6291 lbsr CLRDSCRN
6292 FIXDRTB1 rts
6293
6294 CHGDEVCS pshs U
6295 leas -38,S
6296 leax 6,S
6297 stx 4,S
6298 ldd #3
6299 pshs d
6300 decb
6301 pshs d
6302 ldb #10
6303 pshs d
6304 ldx #20
6305 ldb #11
6306 pshs d,X
6307 decb
6308 pshs d
6309 ldx #1
6310 ldb <WNDWPATH+1
6311 pshs d,X
6312 lbsr OWSET Overlay window
6313 ldd #WT.DBOX
6314 std 2,S
6315 lbsr ST.WNSET Double boxed window
6316 lbsr IOOPTSON
6317 leax <CHGDEVNM,PC
6318 stx ,S
6319 lbsr WRLNWCR
6320 leas 2+14,S
6321 ldu #DRIVETBL
6322 bra CHGDEVC2
6323
6324 CHGDEVC1 ldd FL.FNAME,U
6325 pshs d
6326 lbsr WRLNWCR
6327 leas 2,S
6328 ldu FL.LINK,U
6329 CHGDEVC2 stu -2,S
6330 bne CHGDEVC1
6331 ldu <DRTBLPTR
6332 ldb <DEVICNTR
6333 bra CHGDEVC5
6334
6335 CHGDEVC3 ldd #32
6336 pshs d
6337 ldx 6,S
6338 ldd WNDWPATH
6339 pshs d,X
6340 lbsr I.READLN
6341 leas 6,S
6342 std ,S
6343 ble CHGDEVC6
6344 ldb [4,S]
6345 cmpb #'/
6346 bne CHGDEVC6
6347 ldd ,S
6348 decb
6349 addd 4,S
6350 tfr D,X
6351 clr ,X
6352 ldd 4,S
6353 pshs d
6354 pshs U
6355 lbsr MOVDNAME
6356 leas 4,S
6357 ldb 3,S
6358 beq CHGDEVC4
6359 stu FL.LINK-FL.SIZE,U
6360 CHGDEVC4 clrd
6361 std FL.LINK,U
6362 leau FL.SIZE,U
6363 ldb 3,S
6364 incb
6365 CHGDEVC5 stb 3,S
6366 cmpb #5
6367 blt CHGDEVC3
6368 CHGDEVC6 lbsr KILLOLAY
6369 leas 38,S
6370 puls U,PC
6371
6372 CHGDEVNM fcc "Change device names"
6373 fcb LF,NUL
6374
6375 ENBLSOFF clrb Flag to disable menu items on FILES menu
6376 pshs d
6377 bsr ENBLOPEN Set OPEN item on FILES menu
6378 bsr ENLSTPRT Set LIST & PRINT items on FILES menu
6379 bsr ENBLCOPY Set COPY item on FILES menu
6380 bra ENBLSOFX
6381
6382 ENFREFLD ldb 3,S
6383 * Enable/Disable FREE, FOLDER & SORT on DISK menu
6384 ENFREFL1 stb ITM.FREE+MI.ENBL
6385 stb ITM.FLDR+MI.ENBL
6386 stb ITM.SORT+MI.ENBL
6387 rts
6388
6389 * Enable/Disable OPEN item on FILES menu
6390 ENBLOPEN ldb 3,S
6391 stb ITM.OPEN+MI.ENBL
6392 rts
6393
6394 * Enable/Disable LIST & PRINT items on FILES menu
6395 ENLSTPRT ldb 3,S
6396 stb ITM.LIST+MI.ENBL
6397 stb ITM.PRNT+MI.ENBL
6398 rts
6399
6400 * Enable/Disable COPY item on FILES menu
6401 ENBLCOPY ldd 2,S
6402 stb ITM.COPY+MI.ENBL
6403 pshs d
6404 bsr ENSTRNDL Deal with 3 other menu items
6405 ENBLSOFX leas 2,S
6406 rts
6407
6408 * Enable/Disable STAT, RENAME & DELETE items on FILES menu
6409 ENSTRNDL ldb 3,S
6410 stb ITM.STAT+MI.ENBL
6411 stb ITM.RNAM+MI.ENBL
6412 stb ITM.DELT+MI.ENBL
6413 rts
6414
6415 INITSCRN bsr FULLSCRN Change working area to everything but menu/scroll bars
6416 ldd WNDWPATH Get window path
6417 pshs d
6418 lbsr CLRSCRN Send $0c to clear screen
6419 leas 2,S Eat stack
6420 lbsr UPDTDEVC Update device list at left in window ONLY
6421 ldd DEVICNOW Get ptr to icon descriptor for current selected drive
6422 beq INITSCR1 No drive selected, return
6423 lbsr DRAWSCRN Disable OPEN,COPY,LIST,PRINT,STAT,RENAME,DELETE options
6424 INITSCR1 rts Wipe out icons, draw icons, etc., etc.
6425
6426 * Changed from 22 to 23 for NitrOS9
6427 FULLSCRN ldb #23 Save CWAREA height
6428 pshs d
6429 ldd WINDWSZX CWAREA width=full width-2
6430 subb #2
6431 pshs d Save it
6432 ldx #1 Save '1'
6433 pshs X
6434 ldb WNDWPATH+1 Get window path
6435 pshs d,X Save '1' again & path
6436 lbsr CWAREA Change working area
6437 leas 10,S
6438 rts
6439
6440 * Draw border stuff for current dir, re-title dir bar
6441 WRITDBAR clrd
6442 pshs d
6443 ldx #39 39,0 for 1st coord (relative to window inside border)
6444 ldd WNDWPATH
6445 pshs d,X
6446 lbsr MOUSOFF Shut mouse off
6447 lbsr SETDPTR Set draw ptr
6448 ldb #183 Draw to 39,183 (for 200 line screen)
6449 std 4,S
6450 lbsr LINE
6451 ldb #8 Y coord=8
6452 std 4,s
6453 lbsr SETDPTR Set draw ptr to 39,8
6454 ldd PIXELSWD Get far right coord of current dir window
6455 std 2,s
6456 lbsr LINE Draw top line
6457 ldb WIPED icons ok already?
6458 lbeq WIPICEXT Yes, exit
6459 * From here on draws the dir bar, question mark, and current directory.
6460 * Should flag to NOT do this if still in same dir.
6461 ldd #FNT.G8X8 8x8 graphic font
6462 std 4,S
6463 ldb #GRP.FNT
6464 std 2,S
6465 lbsr FONT Set font to special GSHELL font set
6466 clrd
6467 std 4,S
6468 ldb #6
6469 std 2,S
6470 lbsr GOTOXY Text cursor to 6,0
6471 lbsr WBOX.BAR Draw dir entry close box, and bars all the way across
6472 ldb #FNT.S8X8 Select 8x8 text font
6473 std 4,S
6474 ldb #GRP.FNT
6475 std 2,S
6476 lbsr FONT
6477 ldb #5 Write out ' <?> ' for help box
6478 stb 5,S
6479 leax <QUERY,PC
6480 stx 2,S
6481 lbsr I.WRITE
6482 ldb #FNT.S6X8 6x8 text font
6483 std 4,S
6484 ldb #GRP.FNT
6485 std 2,S
6486 lbsr FONT Text cursor to 10,0
6487 clrd
6488 std 4,S
6489 ldb #10
6490 std 2,S
6491 lbsr GOTOXY
6492 ldx #DDIRNAME Print dir name (as far as can fit)
6493 stx 2,S
6494 pshs X
6495 lbsr STRLEN
6496 puls X
6497 cmpd #34 If 320 screen, we can fit up to 34 chars
6498 bls WRITDBA1
6499 tst FLAG640W Check if 640 screen, in which case we can fit up to 87 chars
6500 beq WRITDB05
6501 cmpd #87
6502 bls WRITDBA1
6503 subd #87
6504 leax D,X
6505 ldd #87
6506 bra WRITDB07
6507
6508 WRITDB05 subd #34
6509 leax D,X
6510 ldd #34
6511 WRITDB07 stx 2,S
6512 WRITDBA1 std 4,S
6513 lbsr I.WRITE Write out current directory name
6514 ldd #1
6515 std 4,S
6516 leax <ONESPACE,PC Add one space
6517 stx 2,S
6518 lbsr I.WRITE
6519 WIPICEXT lbsr INITMOUS Re-init mouse
6520 leas 6,S Eat stack & return
6521 rts
6522
6523 QUERY fcc " <?> "
6524
6525 ONESPACE fcc " "
6526
6527 * memory allocation ala K&R
6528 * functionally identical to the C stuff from MicroWare
6529 * but 75% as much code and faster
6530 * calloc split out to save size
6531 * Allocates memory in multiples of 256 bytes (pages)
6532 * Exit:D=-1 If could not get the memory requested
6533
6534 MORECORE ldd 2,S get nu (Get # 4 byte units requested)
6535 addd #255 nu + NALLOC - 1 Round up to even 256 byte page
6536 clrb divided by NALLOC
6537 pshs D rnu = result Save # of 256 byte pages needed
6538 aslb * sizeof(HEADER) (Multiply by 4)
6539 rola
6540 aslb
6541 rola
6542 pshs D Save #
6543 lbsr SBRK Go allocate more data mem & clear it
6544 leas 2,S Eat temp
6545 puls U get rnu into U (U=# 256 byte pages requested)
6546 cmpd #-1 Did we get our requested data memory?
6547 beq ANRTS No, return with D=-1
6548 exg D,U Swap # 256 byte pages & ptr to start of free data mem
6549 std 2,U Save # 256 byte pages at 2,<start of free data mem>
6550 leau 4,U up += 1 (Point to next entry after free data header)??
6551 pshs U Save ptr
6552 bsr FREE
6553 leas 2,S waste up
6554 ldu ALLOCP,Y return allocp (never 0)
6555 ANRTS rts
6556
6557 * Allocate memory within our data area
6558 MALLOC pshs D,U Preserve regs
6559 ldd 6,S Get # bytes to be allocated
6560 addd #3 nbytes + sizeof(HEADER) - 1
6561 lsrd div by sizeof(HEADER) (4 bytes)
6562 lsrd
6563 incd result+1
6564 std ,S nunits = result (units allocated seems to be 4 byte chunks)
6565 ldx ALLOCP,Y q = allocp (Get current value)
6566 bne MALLOC1 if not 0 (If not zero, it has been initialized)
6567 ldx #BASE q = &base (Initialize it to BASE)
6568 stx ALLOCP,Y allocp = q = &base
6569 stx BASE,Y base.ptr = .... = &base (BASE points to itself)
6570 clrd
6571 std BASE+2,Y base.size = 0 (it's size=0)
6572 MALLOC1 ldu ,X p = q->ptr (Get ptr to current allocp (last mem entry?)
6573 bra MALLOC3
6574
6575 MALLOC2 tfr U,X q = p
6576 ldu ,U p = p->ptr
6577 MALLOC3 ldd 2,U Get size of last block allocated
6578 cmpd ,S Compare with # 4 byte blocks requested
6579 blo MALLOC6 if (p->size >= nunits)
6580 bne MALLOC4 if (p->size == nunits)
6581 ldd ,U
6582 std ,X q->ptr = p->ptr
6583 bra MALLOC5
6584
6585 MALLOC4 ldd 2,U p->size -= nunits
6586 subd 0,S
6587 std 2,U
6588 aslb (char) p->size
6589 rola
6590 aslb
6591 rola
6592 leau D,U p += (char) p->size
6593 ldd ,S p->size = nunits
6594 std 2,U
6595
6596 MALLOC5 stx ALLOCP,Y allocp = q
6597 leau 4,U p += 1 (header)
6598 tfr U,D set up for return
6599 bra MALLOC7
6600
6601 MALLOC6 cmpu ALLOCP,Y if (p == allocp)
6602 bne MALLOC2
6603 lbsr MORECORE nunits above return addr (Get more data mem)
6604 bne MALLOC2 if (p = .... == 0) (Get mem failed?)
6605 clrd set up zero for return
6606 MALLOC7 leas 2,S
6607 puls U,PC
6608
6609 * Entry: 0-1,s RTS address
6610 * 2-3,s Ptr of some sort (to data area after 4 byte header?)
6611 * D=# 256 byte pages requested
6612 * U=Ptr to header+4
6613 FREE pshs D,U Save ??? ptr & #256 byte pages
6614 ldu 6,S Get ptr to data start of allocated chunk?
6615 leau -4,U p = ap - 1 (Point to star of chunk header?)
6616 ldx ALLOCP,Y q = allocp ???
6617 bra FREE3
6618
6619 FREE1 cmpx ,X if (q >= q->ptr)
6620 blo FREE2
6621 cmpu ,S && (p > q
6622 bhi FREE4
6623 cmpu ,X || p < q->ptr)
6624 blo FREE4 break
6625 FREE2 ldx ,X q >= q->ptr
6626 FREE3 stx ,S q' = q Save ??? (chunk header?)
6627 cmpu ,S if (p > q) Is
6628 bls FREE1
6629 cmpu ,X && (p < q->ptr)
6630 bhs FREE1
6631 FREE4 pshs U stack p
6632 ldd 2,U t$1 = p->size
6633 aslb scale it
6634 rola
6635 aslb
6636 rola
6637 addd ,S++ t$1 = p + p->size
6638 cmpd ,X if (p + p->size == q->ptr)
6639 bne FREE5
6640 pshs X save q
6641 ldx ,X q = q->ptr
6642 ldd 2,X t$1 = q->ptr->size
6643 puls X recover q
6644 addd 2,U t$1 = p->size + p->ptr->size
6645 std 2,U p->size = t$1
6646 ldd [,X] t$1 = q->ptr->ptr
6647 bra FREE6
6648
6649 FREE5 ldd ,X t$1 = q->ptr
6650 FREE6 std ,U p->ptr = t$1
6651 ldd 2,X t$1 = q->size
6652 aslb scale it
6653 rola
6654 aslb
6655 rola
6656 addd ,S t$1 = q + q->size
6657 *NOTE 6309:CMPR D,U
6658 pshs D
6659 cmpu ,S++ if (q + q->size == p)
6660 bne FREE7
6661 ldd 2,X t$1 = q->size
6662 addd 2,U t$1 += p->size
6663 std 2,X q->size = t$1
6664 ldd ,U t$1 = p->ptr
6665 std ,X q->ptr = t$1
6666 bra FREE8
6667
6668 FREE7 stu ,X q->ptr = p
6669 FREE8 stx ALLOCP,Y allocp = q
6670 bra MALLOC7
6671
6672 NMLNKLOD pshs U
6673 leas -4,S
6674 leax ,S
6675 leau 2,S
6676 pshs X,U
6677 ldu 12,S
6678 ldd GD.MNAME,U
6679 pshs D
6680 bsr F.NMLINK
6681 std -2,S
6682 bne LINLOA1
6683 bsr F.NMLOAD
6684 std -2,S
6685 bne LINLOA1
6686 leas 6,S
6687 bra LINLOA3
6688
6689 LINLOA1 leas 6,S
6690 ldb 1,S
6691 andb #$F0
6692 lsrb
6693 lsrb
6694 lsrb
6695 lsrb
6696 stb GD.MTYPE,U
6697 ldb 1,S
6698 andb #$0F
6699 stb GD.MLANG,U
6700 ldd GD.MEMSZ,U
6701 bne LINLOA3
6702 ldd 2,S
6703 tstb
6704 beq LINLOA2
6705 inca
6706 LINLOA2 tfr A,B
6707 clra
6708 std GD.MEMSZ,U
6709 ldb #1
6710 LINLOA3 leas 4,S
6711 puls U,PC
6712
6713 F.NMLOAD pshs X,Y
6714 ldx 6,S
6715 clra
6716 os9 F$NMLOAD
6717 bra F.NML1
6718
6719 F.NMLINK pshs X,Y
6720 ldx 6,S
6721 bsr SKPSLASH
6722 clra
6723 os9 F$NMLINK
6724 F.NML1 bcc F.NML2
6725 puls X,Y
6726 stb ERRNO+1,Y
6727 clrd
6728 rts
6729
6730 F.NML2 sty [10,S]
6731 tfr A,B
6732 clra
6733 std [8,S]
6734 ldb #1
6735 puls X,Y,PC
6736
6737 F.UNLOAD ldx 2,S
6738 bsr SKPSLASH
6739 clra
6740 os9 F$UNLOAD
6741 rts
6742
6743 SKPSLASH pshs X
6744 lbsr STREND1
6745 SKPSLAS1 cmpx ,S
6746 ble SKPSLAS2
6747 ldb ,-X
6748 cmpb #'/
6749 bne SKPSLAS1
6750 leax 1,X
6751 stx ,S
6752 SKPSLAS2 puls X
6753 rts
6754
6755 KILLPBUF clrb
6756 pshs D
6757 ldx PRCIDNUM
6758 ldd WNDWPATH
6759 pshs D,X
6760 lbsr KILBUF
6761 leas 6,S
6762 rts
6763
6764 * NOTE: ONLY CALLED FROM
6765 * Wait for forked program to die (or wait for signal)
6766 * Entry: [,x] is a ptr to a 16 bit area to save the child's exit code
6767 * Exit: [,x] child's exit code
6768 * D=0 - if [,x] ptr was 0
6769 * else D= Child's proces #
6770 F.WAIT clrd Wait for signal
6771 os9 F$WAIT
6772 bcs OS9ERR2 Error, save error code & return (no child process)
6773 ldx 2,S Get ptr to ???
6774 beq F.WAITX If 0, exit with child ID process #=0
6775 stb 1,X Save child's exit code in pointed to area
6776 clr ,X
6777 F.WAITX tfr A,B D=Deceased child process's ID #
6778 clra
6779 rts
6780
6781 F.FORK pshs Y,U
6782 ldx 6,S
6783 ldy 8,S
6784 ldu 10,S
6785 lda 13,S
6786 ora 15,S
6787 ldb 17,S
6788 os9 F$FORK
6789 puls Y,U
6790 bcs OS9ERR2
6791 tfr A,B
6792 clra
6793 rts
6794
6795 * Raw read
6796 I.READ pshs Y Save Y
6797 ldx 6,S Get ptr to buffer to read into
6798 lda 5,S Get file path
6799 ldy 8,S Get size of read
6800 os9 I$READ Read data
6801 READ1 bcc WRITE10
6802 cmpb #E$EOF EOF error?
6803 bne WRITERR No, report error
6804 clrd If EOF error, report 0 bytes read
6805 puls Y,PC
6806
6807 * Read line: Exits with D=# bytes read
6808 I.READLN pshs Y
6809 lda 5,S
6810 ldx 6,S
6811 ldy 8,S
6812 os9 I$READLN
6813 bra READ1
6814
6815 I.WRITE pshs Y
6816 ldy 8,S
6817 beq WRITE10
6818 lda 5,S
6819 ldx 6,S
6820 os9 I$WRITE
6821 WRITE1 bcc WRITE10
6822 WRITERR puls Y
6823 OS9ERR2 lbra OS9ERR
6824
6825 WRITE10 tfr Y,D
6826 puls Y,PC
6827
6828 * Perform WritLn call
6829 * Entry: 0-1,s =RTS address
6830 * 2-3,s =Path to write to (use only B)
6831 * 4-5,s =Ptr to text to write
6832 * 6-7,s =Length to write
6833 I.WRITLN pshs Y
6834 ldy 8,S
6835 beq WRITE10
6836 lda 5,S
6837 ldx 6,S
6838 os9 I$WRITLN
6839 bra WRITE1
6840
6841 I.DUP os9 I$DUP
6842 bra ERRTEST
6843
6844 I.OPEN2 ldx 2,S
6845 lda 5,S
6846 I.OPEN os9 I$OPEN
6847 ERRTEST bcs OS9ERR2
6848 tfr A,B
6849 clra
6850 rts
6851
6852 I.CLOSE lda 3,S
6853 os9 I$CLOSE
6854 bra I.SYSRET
6855
6856 I.MAKDIR ldx 2,S
6857 ldb 5,S
6858 os9 I$MAKDIR
6859 bra I.SYSRET
6860
6861 I.DELETE ldx 2,S
6862 os9 I$DELETE
6863 I.SYSRET lbra SYSRET
6864
6865 * Get String length - terminated by NUL (CHR$(0)) char
6866 * Entry: 0-1,s is RTS address
6867 * 2-3,s is the ptr to the string to check
6868 * Exit: X=Ptr to end of string (not including NUL)
6869 * D=Length of string
6870 STRLEN ldx 2,S Get ptr to string we are checking length of
6871 STRLEN1 ldb ,X+ Get char
6872 bne STRLEN1 Not end of string, keep checking
6873 leax -1,X Found it, point to last char
6874 tfr X,D
6875 subd 2,S D=length of string
6876 rts
6877
6878 * Get string end - terminated by NUL char
6879 * Entry: [,s] is the ptr to the string to check
6880 * Exit: D=Ptr to end of string (not including NUL)
6881 STREND ldx 2,S
6882 STREND1 ldb ,X+
6883 bne STREND1
6884 leax -1,X
6885 tfr X,D
6886 rts
6887
6888 STRCPY pshs X,U
6889 ldu 6,S
6890 STRCAT2 ldx 8,S
6891 STRCPY1 ldb ,X+
6892 stb ,U+
6893 bne STRCPY1
6894 ldd 6,S
6895 puls X,U,PC
6896
6897 STRCAT pshs X,U
6898 ldu 6,S
6899 STRCAT1 ldb ,U+
6900 bne STRCAT1
6901 leau -1,U
6902 bra STRCAT2
6903
6904 * Compare two strings
6905 * Exit: D=0 if they are the same
6906 * D=-1 if they are not the same
6907 STRCMP pshs X,U Save regs
6908 ldu 6,S Get ptr to 1st string
6909 beq STRCMP2 No string, exit with <>
6910 ldx 8,S Get ptr to 2nd string
6911 beq STRCMP2 No string, exit with <>
6912 STRCMP1 ldb ,U+ Get char from 1st string
6913 cmpb ,X+ Same as char from 2nd string?
6914 bne STRCMP2 No, exit with <>
6915 tstb Same, is it an end of string marker?
6916 bne STRCMP1 No, continue comparing
6917 clra Exit with '='
6918 puls X,U,PC
6919
6920 * Flag not equal strings
6921 STRCMP2 ldd #-1
6922 puls X,U,PC
6923
6924 * String compare with maximum length of strings
6925 * Exit: D=-1 if they are <>
6926 * D=0 if they are =
6927 STRNCMP pshs X,U
6928 ldu 6,S Get ptr to string 1
6929 beq STRNCMP4
6930 ldx 8,S Get ptr to string 2
6931 beq STRNCMP4
6932 lda 11,S Get maximum size to compare
6933 beq STRNCMP2 If 0, exit with =
6934 STRNCMP1 deca Done max length?
6935 blt STRNCMP3 Yes, process
6936 ldb ,U+ Get char
6937 cmpb ,X+ Same as in 2nd string?
6938 bne STRNCMP4 No, exit with <>
6939 tstb End of string early?
6940 bne STRNCMP1 No, continue comparing
6941 STRNCMP2 clrd Exit with =
6942 puls X,U,PC
6943
6944 * If done up to max length, compare last chars of each string
6945 * NOTE: THIS LOOKS LIKE THE LDB/CMPB/BEQ IS USELESS??? SHOULD JUST EXIT
6946 * WITH D=0???
6947 STRNCMP3 ldb ,-U If last 2 chars matched, exit with =
6948 cmpb ,-X
6949 beq STRNCMP2
6950 STRNCMP4 ldd #-1 Exit with <>
6951 STRNCMPX puls X,U,PC
6952
6953 STRHCPY pshs U
6954 ldu 4,S
6955 ldx 6,S
6956 STRHCPY1 ldb ,X+
6957 stb ,U+
6958 bgt STRHCPY1
6959 andb #$7F
6960 stb -1,U
6961 clrb
6962 stb ,U
6963 ldd 4,S
6964 puls U,PC
6965
6966 * Copy B bytes from X to Y
6967 * NOTE: CHANGE TO TFM!
6968 STRNCPY pshs X,U
6969 ldu 6,S
6970 ldx 8,S
6971 ldb 11,S
6972 STRNCPY1 lda ,X+
6973 sta ,U+
6974 decb
6975 bne STRNCPY1
6976 puls X,U,PC
6977
6978 * Allocate more memory from our remainding data memory, or get more data mem-
6979 * ory and allocate from that
6980 * Exit:D=-1 if could not get memory
6981 * or D=Ptr to start of free data memory
6982 SBRK ldd MEMEND,Y Get end of data memory ptr
6983 pshs D Save it
6984 ldd 4,S Get # bytes requested
6985 cmpd SPARE,Y Will that fit in what we have left right now?
6986 * following should be BLO
6987 bcs SBRK20 Yes, skip ahead
6988 addd MEMEND,Y Calculate what total data area size should now be
6989 bcs SBRK05 >64k, too big to fit in process space, exit with error
6990 pshs Y Preserve Y
6991 os9 F$MEM Attempt to change data area size to D bytes
6992 tfr Y,D Move new end of data mem address to D
6993 puls Y Restore Y
6994 bcc SBRK10 No error on F$MEM call, continue
6995 SBRK05 ldd #-1 Eat stack & exit with error flag set
6996 leas 2,S
6997 rts
6998
6999 * Extra memory requested was succesful
7000 SBRK10 std MEMEND,Y Save new end of data mem ptr
7001 addd SPARE,Y Add to amount of free data mem before request came in
7002 subd ,S Subtract original end of data mem ptr
7003 std SPARE,Y Save new amount of spare data mem
7004 SBRK20 leas 2,S
7005 ldd SPARE,Y Get amount of spare data mem
7006 pshs D
7007 subd 4,S Subtract the amount of mem requested
7008 std SPARE,Y Save new amount of spare data mem
7009 ldd MEMEND,Y Get end of data mem ptr
7010 * NOTE 6309:SUBR, AND KEEP SIZE OF SPARE MEM. CHANGE LOOP BELOW TO TFM
7011 subd ,S++ Calculate start address of free data mem
7012 pshs D Save it
7013 clra Zero byte
7014 ldx ,S X=start of free data mem
7015 SBRK30 sta ,X+ Clear out all free data mem
7016 cmpx MEMEND,Y
7017 bcs SBRK30
7018 puls D,PC Get ptr to start of data mem & return with it
7019
7020 GT.READY lda 3,S
7021 ldb #SS.READY
7022 os9 I$GETSTT
7023 bcs OS9ERR3
7024 clra
7025 rts
7026
7027 * setup mouse parms - NOTE: should embed elsewhere - only called once.
7028 * In routine: 0-1,s = Preserved Y
7029 * 2-3,s = RTS address
7030 * 4-5,s = Path to window to read mouse from
7031 * 6-7,s = Mouse sampling rate
7032 * 8-9,s = Mouse button timeout
7033 * 10-11,s= Auto follow mouse flag
7034 ST.MOUSE pshs Y Preserve Y
7035 lda 7,S Get # clock ticks between mouse reads
7036 ldb 9,S Get mouse button timeout value
7037 tfr D,X
7038 clra Get auto-follow flag
7039 ldb 11,S
7040 tfr D,Y
7041 lda 5,S Get path for window mouse is on
7042 ldb #SS.MOUSE Setup mouse parms
7043 os9 I$SETSTT
7044 puls Y Restore Y & return
7045 bra SYSRET2
7046
7047 GT.MOUSE lda 3,S
7048 ldb #SS.MOUSE
7049 ldx 4,S
7050 pshs Y
7051 ldy #0
7052 os9 I$GETSTT
7053 puls Y
7054 bra SYSRET2
7055
7056 ST.SSIG lda 3,S
7057 ldb #SS.SSIG
7058 ldx 4,S
7059 os9 I$SETSTT
7060 bra SYSRET2
7061
7062 ST.RELEA lda 3,S
7063 ldb #SS.RELEA
7064 os9 I$SETSTT
7065 SYSRET2 lbra SYSRET
7066
7067 OS9ERR3 lbcs OS9ERR
7068 pshs A
7069 sex
7070 std [5,S]
7071 puls B
7072 clra
7073 rts
7074
7075 * Get current screen size in 8x8 text chars
7076 * Entry: 0-1,s = RTS address
7077 * 2-3,s = 16 bit path # (only use 3,s)
7078 * 4-5,s = Ptr to where to store X size
7079 * 6-7,s = Ptr to where to store Y size
7080 GT.SCSIZ lda 3,S Get path to screen
7081 ldb #SS.SCSIZ
7082 pshs X,Y Preserve regs
7083 os9 I$GETSTT
7084 bcs SCSIZERR
7085 stx [8,S] Save X size (by pointer)
7086 sty [10,S] Save Y size (by pointer)
7087 clrd
7088 bra SCSIZEXT
7089
7090 SCSIZERR ldy 2,S Get data area pointer back
7091 clra
7092 std ERRNO,Y Save error code
7093 ldd #-1 Flag error & return
7094 SCSIZEXT puls X,Y
7095 rts
7096
7097 ST.SBAR lda 3,S
7098 ldb #SS.SBAR
7099 ldx 4,S
7100 pshs Y
7101 ldy 8,S
7102 os9 I$SETSTT
7103 puls Y
7104 bra SYSRET2
7105
7106 ST.MSSIG lda 3,S
7107 ldb #SS.MSSIG
7108 ldx 4,S
7109 os9 I$SETSTT
7110 bra SYSRET2
7111
7112 * Do WINDINT window style
7113 * Entry: 0-1,s =RTS address
7114 * 2-3,s =Window path (only use B)
7115 * 4-5,s =window type (WT.*)
7116 * 6-7,s =Ptr to window/menu data (for framed windows only)
7117 ST.WNSET lda 3,S Get path
7118 ldb #SS.WNSET
7119 pshs Y
7120 ldy 6,S Get window type
7121 ldx 8,S Get ptr for framed window data
7122 os9 I$SETSTT Convert current window
7123 puls Y
7124 bra SYSRET2
7125
7126 * Entry: all parms for DWSET are on stack, in order-but with 2 bytes/parm
7127 * whether it needs it or not!
7128 * 0-1,s: RTS address
7129 * 2-3,s: path # to window
7130 * 4-5,s: screen type
7131 * etc. for other DWSET parms
7132 DWSET ldd #$1B20 Device window Set
7133 bsr DW.OWSET Set up GFXBUF to contain full display code sequence for DWSET
7134 ldb #9 # of bytes to write in DWSET sequence
7135 tst 5,S Check low byte of window type (actual type)
7136 ble DOWSETX If current displayed or current processes screen, don't bother with border
7137 incb If positive, bump # bytes up to 10 (to cover border color)
7138 DOWSETX bra GFXWR3 Go write it out and return from there
7139
7140 OWSET ldd #$1B22
7141 bsr DW.OWSET
7142 ldb #9
7143 bra DOWSETX
7144
7145 DW.OWSET ldx #GFXBUF Place to put actual command bytes for DWSET
7146 std ,X++ Save command sequence
7147 lda 7,S Get screen type (low byte only)
7148 ldb 9,S
7149 std ,X++ Get start, end ,etc. parms & append them
7150 lda 11,S
7151 ldb 13,S
7152 std ,X++
7153 lda 15,S
7154 ldb 17,S
7155 std ,X++
7156 lda 19,S
7157 ldb 21,S Get border color (may not be used)
7158 std ,X
7159 rts
7160
7161 DWEND ldd #$1B24
7162 bra OUT2
7163
7164 OWEND ldd #$1B23
7165 bra OUT2
7166
7167 SELECT ldd #$1B21
7168
7169 OUT2 std GFXBUF,Y
7170 ldb #2
7171 bra GFXWR3
7172
7173 CWAREA ldd #$1B25
7174 ldx #GFXBUF
7175 std ,X++
7176 lda 5,S
7177 ldb 7,S
7178 std ,X++
7179 lda 9,S
7180 ldb 11,S
7181 std ,X
7182 ldb #6
7183 bra GFXWR3
7184
7185 GCSET ldd #$1B39
7186 bra OUT4
7187
7188 FONT ldd #$1B3A
7189 bra OUT4
7190
7191 KILBUF ldd #$1B2A
7192 OUT4 ldx #GFXBUF
7193 std ,X++
7194 lda 5,S
7195 ldb 7,S
7196 std ,X
7197 ldb #4
7198 GFXWR3 lbra GFXWR
7199
7200 SCALESW ldb #$35
7201 bra OUT3
7202
7203 DWPROTSW ldb #$36
7204 bra OUT3
7205
7206 FCOLOR ldb #$32
7207 bra OUT3
7208
7209 LSET ldb #$2F
7210 OUT3 lda #$1B
7211 std GFXBUF,Y
7212 ldb 5,S
7213 stb GFXBUF+2,Y
7214 ldb #3
7215 bra GFXWR3
7216
7217 LINE ldb #$44
7218 bra OUT6
7219
7220 LINEM ldb #$46
7221 bra OUT6
7222
7223 RLINE ldb #$45
7224 bra OUT6
7225
7226 BOX ldb #$48
7227 bra OUT6
7228
7229 RBOX ldb #$49
7230 bra OUT6
7231
7232 SETDPTR ldb #$40
7233 OUT6 lda #$1B
7234 ldx #GFXBUF
7235 std ,X++
7236 ldd 4,S
7237 std ,X++
7238 ldd 6,S
7239 std ,X
7240 ldb #6
7241 bra GFXWR
7242
7243 PUTBLK ldx #GFXBUF
7244 ldd #$1B2D
7245 std ,X++
7246 lda 5,S
7247 ldb 7,S
7248 std ,X++
7249 ldd 8,S
7250 std ,X++
7251 ldd 10,S
7252 std ,X
7253 ldb #8
7254 bra GFXWR
7255
7256 FFILL ldd #$1B4F
7257 std GFXBUF,Y
7258 ldb #2
7259 bra GFXWR
7260
7261 GPLOAD ldx #GFXBUF
7262 ldd #$1B2B
7263 std ,X++
7264 lda 5,S
7265 ldb 7,S
7266 std ,X++
7267 lda 9,S
7268 sta ,X+
7269 ldd 10,S
7270 std ,X++
7271 ldd 12,S
7272 std ,X++
7273 ldd 14,S
7274 std ,X
7275 ldd 2,S
7276 pshs D
7277 ldb #11
7278 bsr GFXWR
7279 leas 2,S
7280 ldx 16,S
7281 pshs Y
7282 ldy 16,S
7283 lda 5,S
7284 os9 I$WRITE
7285 bcs GFXERR
7286 puls Y,PC
7287
7288
7289 * Entry:B= # bytes to write
7290 GFXWR clra D=B
7291 ldx #GFXBUF Point to buffer that holds graphics commands to execute
7292 pshs Y
7293 tfr D,Y Length of command sequence to write
7294 lda 5,S Get path # to write to
7295 os9 I$WRITE Send gfx command
7296 puls Y
7297 bcs GFXERR
7298 clra
7299 clrb
7300 rts
7301
7302 GFXERR clra
7303 std ERRNO,Y
7304 ldd #-1
7305 rts
7306
7307 * Convert ASCII # to 16 bit signed integer
7308 * NOTE:WILL DO WEIRD THINGS IF RESULT IS >65535 (WRAPS AT 16 BIT)
7309 * Works by saving neg/pos flag, and then going from left to right, multiplying
7310 * cumulative result by 10 each time a new digit is found, until non-digit
7311 * found. Also eats leading spaces & tabs.
7312 * Entry: ptr to ASCII buffer on stack
7313 * Exit: D=signed 16 bit value
7314 ATOI pshs U Preserve U
7315 ldu 4,S Get ptr to text to convert
7316 clrd Clear carry, and default # to 0
7317 pshs CC,d,dp CC=storage for current ASC char, dp=sign, D=current result
7318 ATOI1 ldb ,U+ Get 1st ascii character
7319 stb ,S Save it
7320 cmpb #SPACE Is it a space?
7321 beq ATOI1 Yes, skip that char
7322 cmpb #HT Is it a TAB char?
7323 beq ATOI1 Yes, skip that char
7324 cmpb #'- Is it a negative sign?
7325 bne ATOI2 No, process character
7326 ldb #1 Flag that we are working with a negative #
7327 bra ATOI3
7328
7329 ATOI2 clrb Flag that it is a positive #
7330 ATOI3 stb 3,S Save positive/negative flag
7331 ldb ,S Get char again
7332 cmpb #'- Was it a negative sign?
7333 beq ATOI5 Yes, go onto next character
7334 cmpb #'+ Was it a plus sign?
7335 bne ATOI6 No, go check if it was a numeric char
7336 bra ATOI5 +, skip to next char
7337 * CHANGE MAIN LOOP TO PRE SUBTRACT #$30 INSTEAD OF CMP 1ST WHEN CHECKING
7338 * RANGE (?)
7339
7340 ATOI4 ldd 1,S Get current result (so far)
7341 muld #10 Bump up by one order of magnitude (Since on next digit)
7342 ldb ,S Get original numeric char
7343 sex make 16 bit (note: still ascii version!)
7344 addr w,d Add to current base digit value (1,10,100,1000,10000)
7345 std 1,S Save current result
7346 ATOI5 ldb ,U+ Get next char from ASCII buffer
7347 ATOI6 subb #$30 Convert to binary
7348 stb ,S Save it
7349 blt ATOI65 Below '0', stop conversion
7350 cmpb #9 Above '9'?
7351 bls ATOI4 No, numeric, go process
7352 cmpb #'0 Below a numeric char?
7353 blo ATOI65 Yes, skip ahead
7354 cmpb #'9 Above a numeric char?
7355 bls ATOI4 No, a numeric, go process
7356 * Non numeric char stops conversion
7357 ATOI65 ldd 1,S Get current result
7358 tst 3,S Was there a negative sign?
7359 beq ATOI8 No, done
7360 negd
7361 ATOI8 leas 4,S Eat temp vars
7362 puls U,PC Restore U & exit
7363
7364 CCMOD leax <CCDIV,PC
7365 stx HANDLER,Y
7366 clr SIGN,Y
7367 tst 2,S
7368 bpl CCMOD1
7369 inc SIGN,Y
7370 CCMOD1 subd #0
7371 bne CCMOD2
7372 puls X
7373 ldd ,S++
7374 jmp ,X
7375
7376 CCMOD2 ldx 2,S
7377 pshs X
7378 jsr [HANDLER,Y]
7379 ldd ,S
7380 std 2,S
7381 tfr X,D
7382 tst SIGN,Y
7383 beq CCMODX
7384 negd
7385 CCMODX std ,S++
7386 rts
7387
7388 DIVIDE.0 puls D
7389 std ,S
7390 ldd #45
7391 bra RPTERR
7392
7393 CCDIV subd #0
7394 beq DIVIDE.0
7395 pshs D
7396 leas -2,S
7397 clr ,S
7398 clr 1,S
7399 tsta
7400 bpl CCDIV1
7401 negd
7402 inc 1,S
7403 std 2,S
7404 CCDIV1 ldd 6,S
7405 bpl CCDIV2
7406 negd
7407 com 1,S
7408 std 6,S
7409 CCDIV2 lda #1
7410 CCDIV3 inca
7411 asl 3,S
7412 rol 2,S
7413 bpl CCDIV3
7414 sta ,S
7415 ldd 6,S
7416 clr 6,S
7417 clr 7,S
7418 CCDIV4 subd 2,S
7419 bcc CCDIV5
7420 addd 2,S
7421 andcc #NCARRY
7422 bra CCDIV6
7423
7424 CCDIV5 orcc #CARRY
7425 CCDIV6 rol 7,S
7426 rol 6,S
7427 lsr 2,S
7428 ror 3,S
7429 dec ,S
7430 bne CCDIV4
7431 std 2,S
7432 tst 1,S
7433 beq CCDIV7
7434 ldd 6,S
7435 negd
7436 std 6,S
7437 CCDIV7 ldx 4,S
7438 ldd 6,S
7439 std 4,S
7440 stx 6,S
7441 ldx 2,S
7442 ldd 4,S
7443 leas 6,S
7444 rts
7445
7446 CCASR tstb
7447 beq CCSEXIT
7448 CCASR1 asr 2,S
7449 ror 3,S
7450 decb
7451 bne CCASR1
7452 CCSEXIT ldd 2,S
7453 pshs D
7454 ldd 2,S
7455 std 4,S
7456 ldd ,S
7457 leas 4,S
7458 rts
7459
7460 RPTERR std ERRNO,Y
7461 pshs B,Y
7462 os9 F$ID
7463 puls B,Y
7464 os9 F$SEND
7465 rts
7466
7467 * Save error # & set flag
7468 OS9ERR clra
7469 std ERRNO,Y
7470 ldd #-1
7471 rts
7472
7473 SYSRET bcs OS9ERR
7474 clrd
7475 rts
7476
7477 EXIT
7478 F.EXIT ldd 2,S
7479 os9 F$EXIT
7480
7481 * Quick hack to copy new 4 color icon stuff into buffer used by GPLOAD routine
7482 * Entry: X=Source buffer of icon
7483 * B=# bytes to copy
7484 CopyIcon pshs u
7485 ldu #ICONBUFR Point to icon build buffer
7486 CpyIc lda ,x+
7487 sta ,u+
7488 decb
7489 bne CpyIc
7490 puls u,pc
7491
7492 * Reset fore/back colors for Menu bar updates
7493 MenuClr pshs d,x,y
7494 leax <MenuColr,pc
7495 bra WritColr
7496
7497 * Reset fore/back colors for non-Menu bar updates
7498 RegClr pshs d,x,y
7499 leax <RegColr,pc
7500 WritColr ldy #6
7501 lda <WNDWPATH+1 Get window path
7502 os9 I$Write
7503 puls d,x,y,pc
7504
7505 MenuColr fcb $1b,$32,2,$1b,$33,0
7506 RegColr fcb $1b,$32,0,$1b,$33,2
7507
7508 * New 4 color disk drive icon 24x12
7509 driveicn fcb 255,255,255,255,255,253
7510 fcb 234,170,170,170,170,169
7511 fcb 234,170,170,170,170,169
7512 fcb 234,170,170,170,170,169
7513 fcb 234,170,85,85,170,169
7514 fcb 233,85,64,1,85,233
7515 fcb 235,255,234,171,255,233
7516 fcb 234,170,255,255,170,169
7517 fcb 234,170,170,170,175,233
7518 fcb 229,106,170,170,173,105
7519 fcb 234,170,170,170,170,169
7520 fcb 213,85,85,85,85,85
7521
7522 * New trash can icon 24x24
7523 trashicn fcb 170,170,170,170,170,170
7524 fcb 170,128,0,0,170,170
7525 fcb 160,5,85,155,2,170
7526 fcb 129,17,86,102,188,170
7527 fcb 4,85,89,154,239,42
7528 fcb 1,17,102,167,188,42
7529 fcb 32,5,89,159,2,42
7530 fcb 42,128,0,0,170,42
7531 fcb 42,170,170,170,170,42
7532 fcb 40,10,170,168,10,42
7533 fcb 35,210,128,163,210,42
7534 fcb 35,146,61,35,146,42
7535 fcb 35,146,57,35,146,42
7536 fcb 35,146,57,35,146,42
7537 fcb 35,146,57,35,146,42
7538 fcb 35,146,57,35,146,42
7539 fcb 35,146,57,35,146,42
7540 fcb 35,146,57,35,146,42
7541 fcb 35,146,57,35,146,42
7542 fcb 35,146,57,35,146,42
7543 fcb 40,10,57,40,10,22
7544 fcb 130,170,128,170,160,85
7545 fcb 168,10,170,168,5,85
7546 fcb 170,160,0,1,85,86
7547
7548 * New 4 color EXECUTABLE icon 24x24
7549 execicon fcb 255,255,255,255,255,253
7550 fcb 228,169,21,100,74,165
7551 fcb 228,169,20,161,10,165
7552 fcb 213,85,85,85,85,85
7553 fcb 253,170,170,170,170,253
7554 fcb 233,145,170,18,170,201
7555 fcb 233,132,170,70,170,193
7556 fcb 233,145,170,18,170,213
7557 fcb 233,170,170,170,170,233
7558 fcb 233,148,106,20,170,253
7559 fcb 233,145,106,80,170,233
7560 fcb 233,170,170,170,170,213
7561 fcb 233,170,170,170,170,233
7562 fcb 233,157,234,170,170,233
7563 fcb 233,180,106,170,170,233
7564 fcb 233,131,106,170,170,233
7565 fcb 233,170,170,170,170,213
7566 fcb 233,129,42,170,170,193
7567 fcb 233,132,42,170,170,209
7568 fcb 213,170,170,170,170,213
7569 fcb 255,255,255,255,255,253
7570 fcb 193,174,106,170,170,65
7571 fcb 225,174,106,170,170,73
7572 fcb 85,85,85,85,85,85
7573
7574 * New 4 color Folder icon 24x24
7575 foldricn fcb 170,130,170,170,170,170
7576 fcb 170,60,10,170,170,170
7577 fcb 170,55,240,170,170,170
7578 fcb 1,225,124,170,170,170
7579 fcb 60,42,168,10,170,170
7580 fcb 63,192,171,240,42,170
7581 fcb 62,191,2,175,192,170
7582 fcb 58,170,252,10,191,2
7583 fcb 58,170,171,240,42,252
7584 fcb 58,170,170,175,194,160
7585 fcb 58,170,170,170,146,164
7586 fcb 58,170,170,170,145,148
7587 fcb 58,170,170,170,146,100
7588 fcb 58,170,170,170,145,148
7589 fcb 58,170,170,170,146,82
7590 fcb 58,170,170,170,164,146
7591 fcb 58,170,170,170,164,82
7592 fcb 21,170,170,170,164,146
7593 fcb 128,86,170,170,164,82
7594 fcb 170,1,90,170,164,10
7595 fcb 170,168,5,106,165,10
7596 fcb 170,170,160,21,153,10
7597 fcb 170,170,170,128,85,10
7598 fcb 170,170,170,170,0,10
7599
7600 * Text Icon 24x24
7601 txticon fcb 0,0,0,0,0,10
7602 fcb 63,255,255,253,85,70
7603 fcb 61,183,229,253,154,134
7604 fcb 61,119,109,125,230,134
7605 fcb 63,255,255,253,249,134
7606 fcb 63,255,255,253,190,70
7607 fcb 61,191,246,253,85,70
7608 fcb 62,223,155,191,255,198
7609 fcb 63,255,255,255,255,198
7610 fcb 63,255,255,255,255,198
7611 fcb 62,109,253,215,251,198
7612 fcb 63,126,122,219,185,198
7613 fcb 63,255,255,255,255,198
7614 fcb 63,255,255,255,255,198
7615 fcb 62,254,254,255,251,198
7616 fcb 62,125,110,125,249,198
7617 fcb 63,255,255,255,255,198
7618 fcb 63,255,255,255,255,198
7619 fcb 62,189,127,231,151,198
7620 fcb 62,255,175,223,251,198
7621 fcb 63,255,255,255,255,198
7622 fcb 0,0,0,0,0,6
7623 fcb 149,85,85,85,85,86
7624 fcb 170,170,170,170,170,170
7625
7626 * NEW - printer icon (24x15)
7627 prntricn fcb 170,168,0,2,170,170
7628 fcb 170,168,255,200,170,170
7629 fcb 170,168,195,205,42,170
7630 fcb 170,168,255,192,42,170
7631 fcb 170,168,192,255,42,170
7632 fcb 170,168,255,195,42,170
7633 fcb 170,128,192,255,2,170
7634 fcb 170,136,255,255,34,170
7635 fcb 170,0,0,0,0,170
7636 fcb 168,166,102,102,106,42
7637 fcb 168,170,170,170,130,42
7638 fcb 168,170,170,170,170,42
7639 fcb 168,0,0,0,0,42
7640 fcb 170,38,102,102,104,170
7641 fcb 170,128,0,0,2,170
7642
7643 ETEXT fdb INTCOUNT-DPAGDATA
7644
7645 DPAGDATA fcb $FF WIPED On initialization, we have to refresh DIR screen
7646 fdb 6 DEFWTYPE
7647 fdb 64 ICONCOLW
7648 fdb 15 STRTYPOS
7649 fdb 135 ICONYMAX
7650 fdb 40 ICONROWH
7651 fdb 25 WNDWSZY
7652 fdb PTBLSPTR PTBLNEXT
7653 fdb FNAMBUFR FNAMEPTR
7654 fdb CALCDESC IDSCSPTR
7655 fdb ENDLINK IDSCNEXT
7656 fcb 5 DEVICNTR
7657 fcb 2 DRIVYPOS Was 18 (making room for printer)
7658
7659 * End of Direct Page Variables.
7660
7661 INTCOUNT fdb DTXCOUNT-INITDATA
7662
7663 * TNDYITMS
7664
7665 INITDATA fcc "Calc"
7666 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7667 fcb NUL,NUL,NUL
7668 fcb 1,0,0,0
7669 fcb 0,0
7670
7671 fcc "Clock"
7672 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7673 fcb NUL,NUL
7674 fcb 1,0,0,0
7675 fcb 0,0
7676
7677 fcc "Calendar"
7678 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL
7679 fcb 1,0,0,0
7680 fcb 0,0
7681
7682 fcc "Control"
7683 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7684 fcb 1,0,0,0
7685 fcb 0,0
7686
7687 fcc "Printer"
7688 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7689 fcb 1,0,0,0
7690 fcb 0,0
7691
7692 fcc "Port"
7693 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7694 fcb NUL,NUL,NUL
7695 fcb 1,0,0,0
7696 fcb 0,0
7697
7698 fcc "Help"
7699 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7700 fcb NUL,NUL,NUL
7701 fcb 1,0,0,0
7702 fcb 0,0
7703
7704 fcc "Shell"
7705 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7706 fcb NUL,NUL
7707 fcb 1,0,0,0
7708 fcb 0,0
7709
7710 * MAY WANT TO ADD BACK IN IF WE START USING CLIPBOARD FUNCTIONS
7711 * FCC "Clipboard"
7712 * FCB NUL,NUL,NUL,NUL,NUL,NUL
7713 * FCB 0,0,0,0
7714 * FCB 0,0
7715
7716 * DISKITMS
7717 * ITM.FREE
7718
7719 fcc "Free"
7720 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7721 fcb NUL,NUL,NUL
7722 fcb 0,0,0,0
7723 fcb 0,0
7724
7725 * ITM.FLDR
7726
7727 fcc "New Folder"
7728 fcb NUL,NUL,NUL,NUL,NUL
7729 fcb 0,0,0,0
7730 fcb 0,0
7731
7732 * ITM.FMAT
7733
7734 fcc "Format"
7735 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7736 fcb NUL
7737 fcb 1,0,0,0
7738 fcb 0,0
7739
7740 fcc "Backup"
7741 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7742 fcb NUL
7743 fcb 1,0,0,0
7744 fcb 0,0
7745
7746 fcc "Set Execute"
7747 fcb NUL,NUL,NUL,NUL
7748 fcb 1,0,0,0
7749 fcb 0,0
7750
7751 fcc "Set Devices"
7752 fcb NUL,NUL,NUL,NUL
7753 fcb 1,0,0,0
7754 fcb 0,0
7755
7756 * ITM.OPEN
7757
7758 fcc "Open"
7759 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7760 fcb NUL,NUL,NUL
7761 fcb 0,0,0,0
7762 fcb 0,0
7763
7764 * ITM.LIST
7765
7766 fcc "List"
7767 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7768 fcb NUL,NUL,NUL
7769 fcb 0,0,0,0
7770 fcb 0,0
7771
7772 * ITM.COPY
7773
7774 fcc "Copy"
7775 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7776 fcb NUL,NUL,NUL
7777 fcb 0,0,0,0
7778 fcb 0,0
7779
7780 * ITM.STAT
7781
7782 fcc "Stat"
7783 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7784 fcb NUL,NUL,NUL
7785 fcb 0,0,0,0
7786 fcb 0,0
7787
7788 * ITM.PRNT
7789
7790 fcc "Print"
7791 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7792 fcb NUL,NUL
7793 fcb 0,0,0,0
7794 fcb 0,0
7795
7796 * ITM.RENAM
7797
7798 fcc "Rename"
7799 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7800 fcb NUL
7801 fcb 0,0,0,0
7802 fcb 0,0
7803
7804 * ITM.DELT
7805
7806 fcc "Delete"
7807 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7808 fcb NUL
7809 fcb 0,0,0,0
7810 fcb 0,0
7811
7812 * ITM.SORT
7813
7814 fcc "Sort"
7815 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7816 fcb NUL,NUL,NUL
7817 fcb 0,0,0,0
7818 fcb 0,0
7819
7820 fcc "Quit"
7821 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7822 fcb NUL,NUL,NUL
7823 fcb 1,0,0,0
7824 fcb 0,0
7825
7826 * VIEWITEMS
7827 * ITM.LRES
7828
7829 fcc "40x25-4"
7830 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7831 fcb 1,0,0,0
7832 fcb 0,0
7833
7834 fcc "80x25-4 (FAT)"
7835 fcb NUL,NUL
7836 fcb 1,0,0,0
7837 fcb 0,0
7838
7839 fcc "40x25-16"
7840 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL
7841 fcb 1,0,0,0
7842 fcb 0,0
7843
7844 * KDMITMS
7845
7846 fcc "<KDM&LCB>"
7847 fcb NUL,NUL,NUL,NUL,NUL,NUL
7848 fcb 0,0,0,0
7849 fcb 0,0
7850
7851 fcc "V#1.26"
7852 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7853 fcb 0,0,0,0
7854 fcb 0,0
7855
7856 * TNDYDESC
7857
7858 fcc "Tandy"
7859 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7860 fcb NUL,NUL
7861 fcb MID.TDY
7862 fcb 8,8,1
7863 fdb $0000
7864 fdb TNDYITMS
7865
7866 * FILSDESC
7867
7868 fcc "Files"
7869 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7870 fcb NUL,NUL
7871 fcb MID.FIL
7872 fcb 6,9,1
7873 fdb $0000
7874 fdb FILSITMS
7875
7876 * DISKDESC
7877
7878 fcc "Disk"
7879 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7880 fcb NUL,NUL,NUL
7881 fcb MID.DSK
7882 fcb 12,6,1
7883 fdb $0000
7884 fdb DISKITMS
7885
7886 * VIEWDESC
7887
7888 fcc "View"
7889 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7890 fcb NUL,NUL,NUL
7891 fcb MID.VEW
7892 fcb 13,3,1
7893 fdb $0000
7894 fdb VIEWITMS
7895
7896 * KDMDESC
7897
7898 fcc "About.."
7899 fcb NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL
7900 fcb MID.KDM
7901 fcb 9,2,1
7902 fdb $0000
7903 fdb KDMITMS
7904
7905 * SHELLNAM
7906
7907 fcc "shell"
7908 fcb NUL
7909
7910 * LISTNAM
7911
7912 fcc "list"
7913 fcb NUL
7914
7915 * GCALCNAM
7916
7917 fcc "gcalc"
7918 fcb NUL
7919
7920 * GCLOCKNM
7921
7922 fcc "gclock"
7923 fcb NUL
7924
7925 * GCALNAM
7926
7927 fcc "gcal"
7928 fcb NUL
7929
7930 * CONTROLNM
7931
7932 fcc "control"
7933 fcb NUL
7934
7935 * GPRINTNM
7936
7937 fcc "gprint"
7938 fcb NUL
7939
7940 * GPORTNAM
7941
7942 fcc "gport"
7943 fcb NUL
7944
7945 * HELPNAM
7946
7947 fcc "help"
7948 fcb NUL
7949
7950 * COCPRNM
7951
7952 fcc "cocopr"
7953 fcb NUL
7954
7955 * SCRLPTRS table of pointers was here
7956
7957 * DBOXDESC
7958
7959 fdb 48,0,56,8
7960 fcb IC.CLOSE
7961 fcb 0
7962 fdb DBARDESC
7963 fdb $0000
7964
7965 * DBARDESC
7966
7967 fdb 58,0,600,8
7968 fcb IC.DRBAR
7969 fcb 0
7970 fdb QURYDESC
7971 fdb $0000
7972
7973 * QURYDESC
7974
7975 fdb 600,0,623,8
7976 fcb IC.QUERY
7977 fcb 0
7978 fdb $0000,$0000
7979
7980 * TRSHDESC - moved down to make room for printer
7981 fdb 8,160,32,184 Was 8,144,32,168
7982 fcb IC.TRASH
7983 fcb 0
7984 fdb $0000,$0000
7985
7986 * PRTRDESC - NEW
7987 fdb 8,133,32,148
7988 fcb IC.PRNTR
7989 fcb 0
7990 fdb $0000,$0000
7991
7992 * CALCDESC
7993
7994 fdb IC.GCALC
7995 fdb 6,20,12,1
7996 fdb 0,0
7997 fdb GCALCNAM
7998 fdb $0000,$0000
7999 fdb CLOKDESC
8000
8001 * CLOKDESC
8002
8003 fdb IC.GCLOK
8004 fdb 6,20,10,1
8005 fdb 0,0
8006 fdb GCLOCKNM
8007 fdb $0000,$0000
8008 fdb CALDESC
8009
8010 * CALDESC
8011
8012 fdb IC.GCAL
8013 fdb 6,40,25,1
8014 fdb 0,0
8015 fdb GCALNAM
8016 fdb $0000,$0000
8017 fdb SHELDESC
8018
8019 * SHELDESC
8020
8021 fdb IC.SHELL
8022 fdb 6,10,5,1
8023 fdb 0,0
8024 fdb SHELLNAM
8025 fdb $0000,$0000
8026
8027 * ENDLINK
8028
8029 fdb $0000
8030
8031 * NXTICONO
8032
8033 fdb IC.XTRNL
8034
8035 * PRESSMSG
8036
8037 fcc "Press any key"
8038 fcb NUL
8039
8040 * NEWNMSG
8041
8042 fcc "New name: "
8043 fcb NUL
8044
8045 * SLASHW
8046
8047 fcc "/w"
8048 fcb NUL
8049
8050 * ALLOCP
8051
8052 fcb 0,0,0
8053
8054 DTXCOUNT
8055
8056
8057 emod
8058
8059 MODSIZE equ *
8060
8061 end
8062