mirror of
https://github.com/GnoConsortium/gno.git
synced 2024-06-25 14:29:34 +00:00
Changed many invocations from old shell interface routines (Read_Variable,
Set_Variable, Export, etc.) to new ones (ReadVariableGS, SetGS, ExportGS, etc.) in many places; there are still a few more to change. This change removed the 256-character limit on strings retrieved by these routines, such as the value of environment variables. (PR # 9). At startup do not set $TERM to gnocon if it is already set. Removed the df command (from builtin.asm). Defined macro incad to increment a 4-byte address, checking for overflow; replaced instances of "inc ptr" with "incad ptr". Changed column offset table to use a 1-word rather than 1-byte entry. This resolves PR#14 (hash wouldn't print beyond first 256 filenames). Fixed defect in unalias (alias.asm) where the double quote portion of the scanner would look for a terminating single quote. This resolves PR#69. Changed default order for copying files in $PATH dirs into executable list, so earlier paths files are found first. Added environment variable flag $OLDPATHMODE to make gsh behave in the old (backwards order) way when necessary. Discard duplicate filenames when hashing. Fix PR#73: directory in $PATH with escaped space (\ ) is not searched.
This commit is contained in:
parent
615d7ab922
commit
d534981038
|
@ -1,21 +1,13 @@
|
||||||
Last updated: June 19, 1998 By: Dave Tribby
|
Last updated: July 5, 1998 By: Dave Tribby
|
||||||
|
|
||||||
For more bug reports, see also http://www.gno.org/~gno/bugs.html
|
For more bug reports, see also http://www.gno.org/~gno/bugs.html
|
||||||
|
|
||||||
Completed items are reported in file UpdateLog.
|
Completed items are reported in file UpdateLog.
|
||||||
|
|
||||||
|
|
||||||
Initialize internal shell variables to match environment variables
|
|
||||||
(echo, nodirexec, nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof)
|
|
||||||
when shell first starts.
|
|
||||||
|
|
||||||
Gsh requires the v2.0.4 ltermcap to link. Termcap has changed in v2.0.6,
|
Gsh requires the v2.0.4 ltermcap to link. Termcap has changed in v2.0.6,
|
||||||
and gsh should be updated to reflect this.
|
and gsh should be updated to reflect this.
|
||||||
|
|
||||||
When building the EXE hash table, duplicate entries oughta should be ignored.
|
|
||||||
|
|
||||||
Make PATH's use consistent with forward parsing.
|
|
||||||
|
|
||||||
Identify limits built into gsh and how they can be changed; for example,
|
Identify limits built into gsh and how they can be changed; for example,
|
||||||
size of $PATH <= 256; max programs in hash table = 256.
|
size of $PATH <= 256; max programs in hash table = 256.
|
||||||
|
|
||||||
|
@ -39,6 +31,10 @@ Allow ~user construct (call routines to get user's home directory)
|
||||||
|
|
||||||
recursive aliases.
|
recursive aliases.
|
||||||
|
|
||||||
|
In expandvars (expand.asm):
|
||||||
|
Add error checking if out buf gets too big (> 1024)
|
||||||
|
Get rid of fixed buffers
|
||||||
|
|
||||||
[ -- below this line...probably not -- ]
|
[ -- below this line...probably not -- ]
|
||||||
|
|
||||||
write new memory management.
|
write new memory management.
|
||||||
|
|
|
@ -1,6 +1,65 @@
|
||||||
GSH 2.0 UPDATES
|
GSH 2.0 UPDATES
|
||||||
^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Jul 19 98 [dmt] Changed edit.asm to use ReadIndexedGS, InitWildcardGS,
|
||||||
|
NextWildcardGS, instead of their obsolete counterparts.
|
||||||
|
|
||||||
|
Jul 18 98 [dmt] Changed Set_Variable, Export, UnsetVariable in cmd.asm,
|
||||||
|
shellvar.asm, jobs.asm, and term.asm to use new shell interface
|
||||||
|
(SetGS, ExportGS, UnsetVariableGS).
|
||||||
|
In InitTerm (term.asm), do not set TERM to gnocon if it is
|
||||||
|
already set.
|
||||||
|
|
||||||
|
Jul 17 98 [dmt] Changed final Read_Variable call (in edit.asm) to use
|
||||||
|
getenv instead. Changed ReadVariableGS calls in hash.asm
|
||||||
|
and builtin.asm to also use getenv.
|
||||||
|
|
||||||
|
Jul 16 98 [dmt] Changed Read_Variable calls in history.asm and prompt.asm
|
||||||
|
to use getenv instead.
|
||||||
|
|
||||||
|
Jul 15 98 [dmt] Changed getenv (shellutil.asm) to use ReadVariableGS
|
||||||
|
instead of Read_Variable to get value. getenv's input parameter
|
||||||
|
is now a pointer to a GS/OS string (not a C-string), and it
|
||||||
|
returns a pointer to a GS/OS result buffer with a terminating
|
||||||
|
null byte added. This interface change affected calls to
|
||||||
|
getenv in orca.asm and term.asm.
|
||||||
|
|
||||||
|
Jul 14 98 [dmt] Changed expandvars (expand.asm) to use ReadVariableGS
|
||||||
|
to get the value of an environment variable, allowing values
|
||||||
|
over 256 characters in length.
|
||||||
|
|
||||||
|
Jul 13 98 [dmt] Rewrote shellvar.asm to use newer shell calls to access
|
||||||
|
environment variables, so that they can be > 256 characters.
|
||||||
|
Combined set and setenv into the same routine, with different
|
||||||
|
entry points.
|
||||||
|
|
||||||
|
Jul 12 98 [dmt] In rehash command (hash.asm), read the PATH environment
|
||||||
|
variable with ReadVariableGS instead of Read_Variable, allowing
|
||||||
|
detection of true length and total length > 256 (PR # 9).
|
||||||
|
|
||||||
|
Jul 9 98 [dmt] Removed the df command (from builtin.asm).
|
||||||
|
Defined macro incad to increment a 4-byte address, checking
|
||||||
|
for overflow; replaced instances of "inc ptr" with "incad ptr".
|
||||||
|
|
||||||
|
Jul 8 98 [dmt] Changed column offset table to use a 1-word rather
|
||||||
|
than 1-byte entry. This resolves PR#14 (hash wouldn't
|
||||||
|
print beyond first 256 filenames).
|
||||||
|
|
||||||
|
Jul 7 98 [dmt] Fixed defect in unalias (alias.asm) where the double
|
||||||
|
quote portion of the scanner would look for a terminating
|
||||||
|
single quote. This resolves PR#69.
|
||||||
|
|
||||||
|
Jul 5 98 [dmt] Changed default order for copying files in $PATH dirs
|
||||||
|
into executable list, so earlier paths files are found first.
|
||||||
|
Added environment variable flag $OLDPATHMODE to make gsh
|
||||||
|
behave in the old (backwards order) way when necessary.
|
||||||
|
Discard duplicate filenames when hashing.
|
||||||
|
Fix PR#73: directory in $PATH with escaped space (\ ) is
|
||||||
|
not searched. Needed to remove the "\" before sending
|
||||||
|
pathname to ExpandPathGS.
|
||||||
|
|
||||||
|
Jun 29 98 [dmt] Changes up to this point checked-in to master archive.
|
||||||
|
|
||||||
Jun 28 98 [dmt] Added InitVar routine to shellvar.asm to read values
|
Jun 28 98 [dmt] Added InitVar routine to shellvar.asm to read values
|
||||||
of all environment variables tracked in vardata.
|
of all environment variables tracked in vardata.
|
||||||
|
|
||||||
|
@ -25,7 +84,7 @@ Jun 21 98 [dmt] Added loop to execute(), in cmd.asm, to extract a single
|
||||||
b) Odd things randomly happened when tab was the first
|
b) Odd things randomly happened when tab was the first
|
||||||
character of multiple consecutive lines.
|
character of multiple consecutive lines.
|
||||||
|
|
||||||
Jun 20 98 [dmt] Changed pointer arithmetic from dec or inc to acd or sbc
|
Jun 20 98 [dmt] Changed pointer arithmetic from dec or inc to adc or sbc
|
||||||
to allow for boundary condition in shell.asm.
|
to allow for boundary condition in shell.asm.
|
||||||
In ShellExec (cmd.asm), save status from call to execute and
|
In ShellExec (cmd.asm), save status from call to execute and
|
||||||
pass back to caller in Accumulator.
|
pass back to caller in Accumulator.
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: alias.asm,v 1.3 1998/06/30 17:25:07 tribby Exp $
|
* $Id: alias.asm,v 1.4 1998/07/20 16:23:01 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -20,23 +20,30 @@
|
||||||
*
|
*
|
||||||
* Interfaces defined in this file:
|
* Interfaces defined in this file:
|
||||||
*
|
*
|
||||||
* alias
|
* alias subroutine (4:argv,2:argc)
|
||||||
|
* Returns with status=0 in Accumulator
|
||||||
*
|
*
|
||||||
* unalias
|
* unalias subroutine (4:argv,2:argc)
|
||||||
|
* Returns with status=0 in Accumulator
|
||||||
|
*
|
||||||
|
* initalias jsr/rts with no parameters
|
||||||
*
|
*
|
||||||
* initalias
|
* expandalias subroutine (4:cmd)
|
||||||
|
* return 4:buf
|
||||||
*
|
*
|
||||||
* expandalias
|
* addalias subroutine (4:aliasname,4:aliasval)
|
||||||
|
* return
|
||||||
*
|
*
|
||||||
* addalias
|
* removealias subroutine (4:aliasname)
|
||||||
|
* return
|
||||||
|
*
|
||||||
|
* findalias subroutine (4:aliasname),space
|
||||||
|
* return 4:value
|
||||||
*
|
*
|
||||||
* removealias
|
* startalias jsl/rtl with no parameters
|
||||||
*
|
*
|
||||||
* findalias
|
* nextalias subroutine (4:p)
|
||||||
*
|
* return 2:hashvalz
|
||||||
* startalias
|
|
||||||
*
|
|
||||||
* nextalias
|
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
|
@ -76,13 +83,16 @@ end equ argv+4
|
||||||
phd
|
phd
|
||||||
tcd
|
tcd
|
||||||
|
|
||||||
lda argc
|
lda argc How many arguments were provided?
|
||||||
dec a
|
dec a
|
||||||
beq showall
|
beq showall None -- show all alias names.
|
||||||
dec a
|
dec a
|
||||||
beq showone
|
beq showone One -- show a single name.
|
||||||
jmp setalias
|
jmp setalias More -- set an alias.
|
||||||
|
|
||||||
|
;
|
||||||
|
; Show all aliases
|
||||||
|
;
|
||||||
showall jsl startalias
|
showall jsl startalias
|
||||||
showloop jsl nextalias
|
showloop jsl nextalias
|
||||||
sta arg
|
sta arg
|
||||||
|
@ -110,6 +120,9 @@ showloop jsl nextalias
|
||||||
|
|
||||||
noshow jmp exit
|
noshow jmp exit
|
||||||
|
|
||||||
|
;
|
||||||
|
; Show a single alias
|
||||||
|
;
|
||||||
showone ldy #4+2
|
showone ldy #4+2
|
||||||
lda [argv],y
|
lda [argv],y
|
||||||
tax
|
tax
|
||||||
|
@ -117,8 +130,8 @@ showone ldy #4+2
|
||||||
ldy #4
|
ldy #4
|
||||||
lda [argv],y
|
lda [argv],y
|
||||||
pha
|
pha
|
||||||
jsr puts
|
jsr puts Print name.
|
||||||
lda #':'
|
lda #':' Print ": ".
|
||||||
jsr putchar
|
jsr putchar
|
||||||
lda #' '
|
lda #' '
|
||||||
jsr putchar
|
jsr putchar
|
||||||
|
@ -128,14 +141,18 @@ showone ldy #4+2
|
||||||
ora arg+2
|
ora arg+2
|
||||||
beq notthere
|
beq notthere
|
||||||
lda arg
|
lda arg
|
||||||
jsr puts
|
jsr puts Print alias value.
|
||||||
jsr newline
|
jsr newline Print newline.
|
||||||
jmp exit
|
jmp exit All done.
|
||||||
notthere ldx #^noalias
|
|
||||||
lda #noalias
|
notthere ldx #^noalias Print message:
|
||||||
|
lda #noalias 'Alias not defined'
|
||||||
jsr puts
|
jsr puts
|
||||||
jmp exit
|
jmp exit
|
||||||
|
|
||||||
|
;
|
||||||
|
; Set an alias name
|
||||||
|
;
|
||||||
setalias ldy #4+2 ;put alias name on stack
|
setalias ldy #4+2 ;put alias name on stack
|
||||||
lda [argv],y
|
lda [argv],y
|
||||||
pha
|
pha
|
||||||
|
@ -202,7 +219,7 @@ exit lda space
|
||||||
adc #end-4
|
adc #end-4
|
||||||
tcs
|
tcs
|
||||||
|
|
||||||
lda #0
|
lda #0 Return status always 0.
|
||||||
|
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
|
@ -413,6 +430,9 @@ next lda [cmd]
|
||||||
if2 @a,eq,#"'",singquoter
|
if2 @a,eq,#"'",singquoter
|
||||||
if2 @a,eq,#'"',doubquoter
|
if2 @a,eq,#'"',doubquoter
|
||||||
bra next
|
bra next
|
||||||
|
;
|
||||||
|
; "\" found
|
||||||
|
;
|
||||||
backstabber lda [cmd]
|
backstabber lda [cmd]
|
||||||
inc cmd
|
inc cmd
|
||||||
sta [outbuf]
|
sta [outbuf]
|
||||||
|
@ -420,6 +440,9 @@ backstabber lda [cmd]
|
||||||
and #$FF
|
and #$FF
|
||||||
beq done
|
beq done
|
||||||
bra next
|
bra next
|
||||||
|
;
|
||||||
|
; "'" found
|
||||||
|
;
|
||||||
singquoter lda [cmd]
|
singquoter lda [cmd]
|
||||||
inc cmd
|
inc cmd
|
||||||
sta [outbuf]
|
sta [outbuf]
|
||||||
|
@ -428,15 +451,21 @@ singquoter lda [cmd]
|
||||||
beq done
|
beq done
|
||||||
if2 @a,ne,#"'",singquoter
|
if2 @a,ne,#"'",singquoter
|
||||||
bra next
|
bra next
|
||||||
|
;
|
||||||
|
; '"' found
|
||||||
|
;
|
||||||
doubquoter lda [cmd]
|
doubquoter lda [cmd]
|
||||||
inc cmd
|
inc cmd
|
||||||
sta [outbuf]
|
sta [outbuf]
|
||||||
inc outbuf
|
inc outbuf
|
||||||
and #$FF
|
and #$FF
|
||||||
beq done
|
beq done
|
||||||
if2 @a,ne,#"'",singquoter
|
if2 @a,ne,#'"',doubquoter
|
||||||
bra next
|
bra next
|
||||||
|
|
||||||
|
;
|
||||||
|
; ";", "|", or "&" found: it's another command
|
||||||
|
;
|
||||||
nextalias jmp eatleader
|
nextalias jmp eatleader
|
||||||
|
|
||||||
done ldx word+2
|
done ldx word+2
|
||||||
|
@ -793,7 +822,7 @@ hashval equ 0
|
||||||
space equ hashval+2
|
space equ hashval+2
|
||||||
|
|
||||||
subroutine (4:p),space
|
subroutine (4:p),space
|
||||||
|
|
||||||
lda #11
|
lda #11
|
||||||
sta hashval
|
sta hashval
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: builtin.asm,v 1.3 1998/06/30 17:25:12 tribby Exp $
|
* $Id: builtin.asm,v 1.4 1998/07/20 16:23:01 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -39,7 +39,6 @@
|
||||||
* which
|
* which
|
||||||
* prefix
|
* prefix
|
||||||
* rehash (unhash is entry as an alternate name)
|
* rehash (unhash is entry as an alternate name)
|
||||||
* df
|
|
||||||
* exit
|
* exit
|
||||||
* setdebug
|
* setdebug
|
||||||
* psbi (command name is "ps")
|
* psbi (command name is "ps")
|
||||||
|
@ -138,7 +137,8 @@ ourproc jsl >$FFFFFF ;might want to mutex this!!!!!!
|
||||||
pei (argv)
|
pei (argv)
|
||||||
jsl argfree
|
jsl argfree
|
||||||
|
|
||||||
done anop
|
done ldy val Y-reg = return value.
|
||||||
|
|
||||||
lda space
|
lda space
|
||||||
sta end-3
|
sta end-3
|
||||||
lda space+1
|
lda space+1
|
||||||
|
@ -148,9 +148,9 @@ done anop
|
||||||
clc
|
clc
|
||||||
adc #end-4
|
adc #end-4
|
||||||
tcs
|
tcs
|
||||||
tya
|
|
||||||
|
|
||||||
lda val
|
tya Accumulator = return value.
|
||||||
|
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
END
|
END
|
||||||
|
@ -219,7 +219,6 @@ builtintbl dc a4'aliasname,alias',i2'0'
|
||||||
dc a4'chdirname,chdir',i2'1'
|
dc a4'chdirname,chdir',i2'1'
|
||||||
dc a4'clearname,clear',i2'1' Changed to unforked
|
dc a4'clearname,clear',i2'1' Changed to unforked
|
||||||
dc a4'cmdname,cmdbi',i2'0'
|
dc a4'cmdname,cmdbi',i2'0'
|
||||||
dc a4'dfname,df',i2'0'
|
|
||||||
dc a4'dirsname,dirs',i2'0'
|
dc a4'dirsname,dirs',i2'0'
|
||||||
dc a4'echoname,echo',i2'0'
|
dc a4'echoname,echo',i2'0'
|
||||||
dc a4'editname,edit',i2'1'
|
dc a4'editname,edit',i2'1'
|
||||||
|
@ -256,7 +255,6 @@ cdname dc c'cd',h'00'
|
||||||
clearname dc c'clear',h'00'
|
clearname dc c'clear',h'00'
|
||||||
cmdname dc c'commands',h'00'
|
cmdname dc c'commands',h'00'
|
||||||
dirsname dc c'dirs',h'00'
|
dirsname dc c'dirs',h'00'
|
||||||
dfname dc c'df',h'00'
|
|
||||||
echoname dc c'echo',h'00'
|
echoname dc c'echo',h'00'
|
||||||
editname dc c'edit',h'00'
|
editname dc c'edit',h'00'
|
||||||
exitname dc c'exit',h'00'
|
exitname dc c'exit',h'00'
|
||||||
|
@ -299,7 +297,8 @@ chdir ENTRY
|
||||||
|
|
||||||
dpg equ 1 Direct page pointer.
|
dpg equ 1 Direct page pointer.
|
||||||
buf equ dpg+4 Buffer address to be freed.
|
buf equ dpg+4 Buffer address to be freed.
|
||||||
space equ buf+4
|
status equ buf+4 Status returned from command.
|
||||||
|
space equ status+2
|
||||||
argc equ space+3
|
argc equ space+3
|
||||||
argv equ argc+2
|
argv equ argc+2
|
||||||
end equ argv+4
|
end equ argv+4
|
||||||
|
@ -318,6 +317,8 @@ end equ argv+4
|
||||||
stz buf Clear the pointer to
|
stz buf Clear the pointer to
|
||||||
stz buf+2 allocated buffer.
|
stz buf+2 allocated buffer.
|
||||||
|
|
||||||
|
stz status Assume good status.
|
||||||
|
|
||||||
lda argc Number of parameters
|
lda argc Number of parameters
|
||||||
dec a determines type of cd...
|
dec a determines type of cd...
|
||||||
beq cdhome either to $HOME
|
beq cdhome either to $HOME
|
||||||
|
@ -327,7 +328,8 @@ end equ argv+4
|
||||||
;
|
;
|
||||||
; Illegal parameters: print usage string
|
; Illegal parameters: print usage string
|
||||||
;
|
;
|
||||||
showusage lda [argv]
|
showusage inc status Return status = 1.
|
||||||
|
lda [argv]
|
||||||
tax
|
tax
|
||||||
ldy #2
|
ldy #2
|
||||||
lda [argv],y
|
lda [argv],y
|
||||||
|
@ -336,11 +338,11 @@ showusage lda [argv]
|
||||||
lda [argv],y
|
lda [argv],y
|
||||||
and #$FF
|
and #$FF
|
||||||
beq cdusage
|
beq cdusage
|
||||||
ldx #^Usage2
|
ldx #^Usage2 Print chdir usage
|
||||||
lda #Usage2
|
lda #Usage2
|
||||||
jsr errputs
|
jsr errputs
|
||||||
jmp exit
|
jmp exit
|
||||||
cdusage ldx #^Usage
|
cdusage ldx #^Usage Print cd usage
|
||||||
lda #Usage
|
lda #Usage
|
||||||
jsr errputs
|
jsr errputs
|
||||||
jmp exit
|
jmp exit
|
||||||
|
@ -348,21 +350,13 @@ cdusage ldx #^Usage
|
||||||
;
|
;
|
||||||
; Set prefix to $home
|
; Set prefix to $home
|
||||||
;
|
;
|
||||||
cdhome ph4 #256 Allocate 256 bytes for result buf.
|
cdhome anop
|
||||||
jsl ~NEW
|
ph4 #home Get value of $HOME
|
||||||
sta buf
|
jsl getenv
|
||||||
stx buf+2
|
sta buf If GS/OS result buffer
|
||||||
sta ReadName
|
stx buf+2 wasn't allocated,
|
||||||
stx ReadName+2
|
ora buf+2
|
||||||
ora ReadName+2 If both address bytes are 0,
|
jeq exit there's no more to do.
|
||||||
bne madeit
|
|
||||||
lda #$201
|
|
||||||
jmp ohshit we have a problem...
|
|
||||||
|
|
||||||
madeit lda #256 Set length of GS/OS result buffer
|
|
||||||
sta [buf]
|
|
||||||
|
|
||||||
ReadVariableGS ReadVar Read value of $home
|
|
||||||
|
|
||||||
clc Calculate address
|
clc Calculate address
|
||||||
lda buf of GS/OS input string
|
lda buf of GS/OS input string
|
||||||
|
@ -374,10 +368,6 @@ madeit lda #256 Set length of GS/OS result buffer
|
||||||
sta PRecPath+2
|
sta PRecPath+2
|
||||||
sta GRecPath+2
|
sta GRecPath+2
|
||||||
|
|
||||||
ldy #2
|
|
||||||
lda [buf],y Get string length word.
|
|
||||||
beq done If 0, bail out.
|
|
||||||
|
|
||||||
bra getinfo
|
bra getinfo
|
||||||
|
|
||||||
;
|
;
|
||||||
|
@ -434,13 +424,13 @@ ok2 SetPrefix PRec
|
||||||
;
|
;
|
||||||
; Deallocate buffer (if necessary), unlock mutex, cleanup stack, and leave
|
; Deallocate buffer (if necessary), unlock mutex, cleanup stack, and leave
|
||||||
;
|
;
|
||||||
done ora2 buf,buf+2,@a
|
done ph4 buf
|
||||||
beq exit
|
|
||||||
ph4 buf
|
|
||||||
jsl nullfree
|
jsl nullfree
|
||||||
|
|
||||||
exit unlock cdmutex
|
exit unlock cdmutex
|
||||||
|
|
||||||
|
ldy status Put return status in Y-reg
|
||||||
|
|
||||||
lda space
|
lda space
|
||||||
sta end-3
|
sta end-3
|
||||||
lda space+1
|
lda space+1
|
||||||
|
@ -451,7 +441,7 @@ exit unlock cdmutex
|
||||||
adc #end-4
|
adc #end-4
|
||||||
tcs
|
tcs
|
||||||
|
|
||||||
lda #0
|
tay Put return status in Accumulator.
|
||||||
|
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
|
@ -468,13 +458,6 @@ GRecPath ds 4 Pointer to input pathname
|
||||||
GRecAcc ds 2 access (result)
|
GRecAcc ds 2 access (result)
|
||||||
GRecFT ds 2 fileType (result)
|
GRecFT ds 2 fileType (result)
|
||||||
|
|
||||||
; Parameter block for shell ReadVariableGS call (p 423 in ORCA/M manual)
|
|
||||||
ReadVar anop
|
|
||||||
dc i2'3' pCount
|
|
||||||
dc a4'home' Pointer to name
|
|
||||||
ReadName ds 4 GS/OS Output buffer ptr: value
|
|
||||||
ds 2 export flag
|
|
||||||
|
|
||||||
home gsstr 'home' Env variable name
|
home gsstr 'home' Env variable name
|
||||||
|
|
||||||
; Parameter block for shell ErrorGS call (p 393 in ORCA/M manual)
|
; Parameter block for shell ErrorGS call (p 393 in ORCA/M manual)
|
||||||
|
@ -607,8 +590,9 @@ gotn iny
|
||||||
dec argc Decrement argument counter.
|
dec argc Decrement argument counter.
|
||||||
jeq done Done if no more arguments.
|
jeq done Done if no more arguments.
|
||||||
|
|
||||||
* Beginning of main processing loop of echo parameters.
|
;
|
||||||
|
; Beginning of main processing loop of echo parameters.
|
||||||
|
;
|
||||||
loop add2 argv,#4,argv Bump argument pointer.
|
loop add2 argv,#4,argv Bump argument pointer.
|
||||||
ldy #2
|
ldy #2
|
||||||
lda [argv],y Set ptr to argv (next argument)
|
lda [argv],y Set ptr to argv (next argument)
|
||||||
|
@ -621,7 +605,7 @@ putloop lda [ptr] Get first
|
||||||
jeq doneput done with this argument.
|
jeq doneput done with this argument.
|
||||||
cmp #'\' If != "\"
|
cmp #'\' If != "\"
|
||||||
jne putit go save in print buffer.
|
jne putit go save in print buffer.
|
||||||
inc ptr Escape character found; point
|
incad ptr Escape character found; point
|
||||||
lda [ptr] to the next
|
lda [ptr] to the next
|
||||||
and #$FF character.
|
and #$FF character.
|
||||||
beq doneput If 0, done with this argument.
|
beq doneput If 0, done with this argument.
|
||||||
|
@ -658,13 +642,13 @@ escloop lda [ptr],y
|
||||||
adc 1,s
|
adc 1,s
|
||||||
sta val
|
sta val
|
||||||
pla
|
pla
|
||||||
inc ptr
|
incad ptr
|
||||||
bra escloop
|
bra escloop
|
||||||
|
|
||||||
putval lda val Get numeric escape code.
|
putval lda val Get numeric escape code.
|
||||||
|
|
||||||
putit jsr putchar Save character in accumulator.
|
putit jsr putchar Save character in accumulator.
|
||||||
didit inc ptr Point to next char in arg
|
didit incad ptr Point to next char in arg
|
||||||
jmp putloop and go process it.
|
jmp putloop and go process it.
|
||||||
|
|
||||||
doneput dec argc Decrement argument counter.
|
doneput dec argc Decrement argument counter.
|
||||||
|
@ -1268,266 +1252,6 @@ Usage dc c'Usage: ',h'00'
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
**************************************************************************
|
|
||||||
*
|
|
||||||
* DF: builtin command
|
|
||||||
* syntax: df
|
|
||||||
*
|
|
||||||
* displays volumes and free space
|
|
||||||
*
|
|
||||||
**************************************************************************
|
|
||||||
|
|
||||||
df START
|
|
||||||
|
|
||||||
using FSTData
|
|
||||||
|
|
||||||
space equ 1
|
|
||||||
argc equ space+3
|
|
||||||
argv equ argc+2
|
|
||||||
end equ argv+4
|
|
||||||
|
|
||||||
tsc
|
|
||||||
phd
|
|
||||||
tcd
|
|
||||||
|
|
||||||
lock mutex
|
|
||||||
|
|
||||||
lda argc
|
|
||||||
dec a
|
|
||||||
beq showall
|
|
||||||
|
|
||||||
ldx #^Usage
|
|
||||||
lda #Usage
|
|
||||||
jsr errputs
|
|
||||||
bra exit
|
|
||||||
|
|
||||||
showall ldx #^hdr
|
|
||||||
lda #hdr
|
|
||||||
jsr puts
|
|
||||||
ld2 1,DIDevNum
|
|
||||||
allloop DInfo DIParm
|
|
||||||
bcs exit
|
|
||||||
jsr showdev
|
|
||||||
inc DIDevNum
|
|
||||||
bra allloop
|
|
||||||
|
|
||||||
exit unlock mutex
|
|
||||||
lda space
|
|
||||||
sta end-3
|
|
||||||
lda space+1
|
|
||||||
sta end-2
|
|
||||||
pld
|
|
||||||
tsc
|
|
||||||
clc
|
|
||||||
adc #end-4
|
|
||||||
tcs
|
|
||||||
|
|
||||||
lda #0
|
|
||||||
|
|
||||||
rtl
|
|
||||||
|
|
||||||
showdev lda #'.'
|
|
||||||
jsr putchar
|
|
||||||
lda #'d'
|
|
||||||
jsr putchar
|
|
||||||
lda DIdevnum
|
|
||||||
cmp #10
|
|
||||||
bcs dev10
|
|
||||||
clc
|
|
||||||
adc #'0'
|
|
||||||
jsr putchar
|
|
||||||
lda #' '
|
|
||||||
jsr putchar
|
|
||||||
bra endnum
|
|
||||||
dev10 UDivide (DIdevnum,#10),(@a,@x)
|
|
||||||
phx
|
|
||||||
clc
|
|
||||||
adc #'0'
|
|
||||||
jsr putchar
|
|
||||||
pla
|
|
||||||
clc
|
|
||||||
adc #'0'
|
|
||||||
jsr putchar
|
|
||||||
endnum lda #' '
|
|
||||||
jsr putchar
|
|
||||||
|
|
||||||
Volume VolParm
|
|
||||||
jcc okdev
|
|
||||||
lda DIid
|
|
||||||
cmp #$20
|
|
||||||
bcc okdid
|
|
||||||
lda #0
|
|
||||||
okdid asl2 a
|
|
||||||
tay
|
|
||||||
ldx idtbl+2,y
|
|
||||||
lda idtbl,y
|
|
||||||
jsr puts
|
|
||||||
short a
|
|
||||||
ldy devname
|
|
||||||
lda #' '
|
|
||||||
dev5 cpy #17
|
|
||||||
bcs dev6
|
|
||||||
sta devname+2,y
|
|
||||||
iny
|
|
||||||
bra dev5
|
|
||||||
dev6 lda #16
|
|
||||||
sta devname+1
|
|
||||||
long a
|
|
||||||
ldx #^devname+1
|
|
||||||
lda #devname+1
|
|
||||||
jsr putp
|
|
||||||
lda #' '
|
|
||||||
jsr putchar
|
|
||||||
|
|
||||||
jmp newline
|
|
||||||
|
|
||||||
okdev ldy volname
|
|
||||||
short a
|
|
||||||
lda #' '
|
|
||||||
dev1 cpy #17
|
|
||||||
bcs dev2
|
|
||||||
sta volname+2,y
|
|
||||||
iny
|
|
||||||
bra dev1
|
|
||||||
dev2 lda #16
|
|
||||||
sta volname+1
|
|
||||||
ldy devname
|
|
||||||
lda #' '
|
|
||||||
dev3 cpy #17
|
|
||||||
bcs dev4
|
|
||||||
sta devname+2,y
|
|
||||||
iny
|
|
||||||
bra dev3
|
|
||||||
dev4 lda #16
|
|
||||||
sta devname+1
|
|
||||||
long a
|
|
||||||
|
|
||||||
ldx #^volname+1
|
|
||||||
lda #volname+1
|
|
||||||
jsr putp
|
|
||||||
lda #' '
|
|
||||||
jsr putchar
|
|
||||||
ldx #^devname+1
|
|
||||||
lda #devname+1
|
|
||||||
jsr putp
|
|
||||||
lda #' '
|
|
||||||
jsr putchar
|
|
||||||
Long2Dec (VolFree,#numbuf,#7,#0)
|
|
||||||
ldx #^numbuf
|
|
||||||
lda #numbuf
|
|
||||||
jsr puts
|
|
||||||
Long2Dec (VolTot,#numbuf,#7,#0)
|
|
||||||
ldx #^numbuf
|
|
||||||
lda #numbuf
|
|
||||||
jsr puts
|
|
||||||
;
|
|
||||||
; [(total - free) * 100] / total
|
|
||||||
;
|
|
||||||
lda VolFree
|
|
||||||
ora VolFree+2
|
|
||||||
beq put100
|
|
||||||
clc ;why clc, need to investigate :)
|
|
||||||
lda VolTot
|
|
||||||
sbc VolFree
|
|
||||||
tax
|
|
||||||
lda VolTot+2
|
|
||||||
sbc VolFree+2
|
|
||||||
LongMul (@ax,#100),(@ax,@y)
|
|
||||||
LongDivide (@xa,VolTot),(@ax,@y)
|
|
||||||
Long2Dec (@xa,#capbuf+3,#3,#0)
|
|
||||||
ldx #^capbuf
|
|
||||||
lda #capbuf
|
|
||||||
jsr puts
|
|
||||||
bra putsys
|
|
||||||
|
|
||||||
put100 ldx #^cap100buf
|
|
||||||
lda #cap100buf
|
|
||||||
jsr puts
|
|
||||||
|
|
||||||
putsys lda VolSysID
|
|
||||||
cmp #$E
|
|
||||||
bcc oksys
|
|
||||||
lda #0
|
|
||||||
oksys asl2 a
|
|
||||||
tay
|
|
||||||
ldx FSTtable+2,y
|
|
||||||
lda FSTtable,y
|
|
||||||
jsr puts
|
|
||||||
jmp newline
|
|
||||||
|
|
||||||
hdr dc c'.d## Volume Device Free Total Capacity System',h'0d'
|
|
||||||
dc c'---- ---------------- ---------------- ------- ------- -------- -----------',h'0d00'
|
|
||||||
|
|
||||||
Usage dc c'Usage: df',h'0d00'
|
|
||||||
numbuf dc c' ',h'00'
|
|
||||||
capbuf dc c' % ',h'00'
|
|
||||||
cap100buf dc c' 100% ',h'00'
|
|
||||||
|
|
||||||
mutex key
|
|
||||||
|
|
||||||
DIParm dc i2'8'
|
|
||||||
DIDevNum ds 2
|
|
||||||
dc a4'devbuf'
|
|
||||||
dc i2'0'
|
|
||||||
dc i4'0'
|
|
||||||
dc i2'0'
|
|
||||||
dc i2'0'
|
|
||||||
dc i2'0'
|
|
||||||
DIid dc i2'0'
|
|
||||||
|
|
||||||
VolParm dc i2'5'
|
|
||||||
dc a4'devname'
|
|
||||||
dc a4'volbuf'
|
|
||||||
VolTot ds 4
|
|
||||||
VolFree ds 4
|
|
||||||
VolSysID ds 2
|
|
||||||
|
|
||||||
devbuf dc i'35'
|
|
||||||
devname ds 33
|
|
||||||
volbuf dc i'260'
|
|
||||||
volname ds 258
|
|
||||||
|
|
||||||
idtbl dc a4'id00,id01,id02,id03,id04,id05,id06,id07,id08'
|
|
||||||
dc a4'id09,id0a,id0b,id0c,id0d,id0e,id0f,id10,idff'
|
|
||||||
dc a4'id12,id13,id14,id15,id16,id17,id18,id19,id1a'
|
|
||||||
dc a4'id1b,id1c,id1d,id1e,id1f'
|
|
||||||
dc a4'idff'
|
|
||||||
|
|
||||||
idff dc c'<unknown> ',h'00'
|
|
||||||
id00 dc c'Apple 5.25 Drive ',h'00'
|
|
||||||
id01 dc c'Profile 5MB ',h'00'
|
|
||||||
id02 dc c'Profile 10MB ',h'00'
|
|
||||||
id03 dc c'Apple 3.5 Drive ',h'00'
|
|
||||||
id04 dc c'SCSI ',h'00'
|
|
||||||
id05 dc c'SCSI Hard Drive ',h'00'
|
|
||||||
id06 dc c'SCSI Tape Drive ',h'00'
|
|
||||||
id07 dc c'SCSI CD-ROM ',h'00'
|
|
||||||
id08 dc c'SCSI Printer ',h'00'
|
|
||||||
id09 dc c'Serial Modem ',h'00'
|
|
||||||
id0a dc c'Console Driver ',h'00'
|
|
||||||
id0b dc c'Serial Printer ',h'00'
|
|
||||||
id0c dc c'Serial LaserWrit ',h'00'
|
|
||||||
id0d dc c'AppleTalk LaserW ',h'00'
|
|
||||||
id0e dc c'RAM Disk ',h'00'
|
|
||||||
id0f dc c'ROM Disk ',h'00'
|
|
||||||
id10 dc c'File Server ',h'00'
|
|
||||||
id12 dc c'Apple Desktop Bu ',h'00'
|
|
||||||
id13 dc c'Hard Drive ',h'00'
|
|
||||||
id14 dc c'Floppy Drive ',h'00'
|
|
||||||
id15 dc c'Tape Drive ',h'00'
|
|
||||||
id16 dc c'Character dev dr ',h'00'
|
|
||||||
id17 dc c'MFM-encoded ',h'00'
|
|
||||||
id18 dc c'AppleTalk net ',h'00'
|
|
||||||
id19 dc c'Sequential dev ',h'00'
|
|
||||||
id1a dc c'SCSI Scanner ',h'00'
|
|
||||||
id1b dc c'Scanner ',h'00'
|
|
||||||
id1c dc c'LaserWriter SC ',h'00'
|
|
||||||
id1d dc c'AppleTalk Main ',h'00'
|
|
||||||
id1e dc c'AppleTalk fsd ',h'00'
|
|
||||||
id1f dc c'AppleTalk RPM ',h'00'
|
|
||||||
|
|
||||||
END
|
|
||||||
|
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
* FST descriptions
|
* FST descriptions
|
||||||
|
@ -1572,7 +1296,7 @@ space equ 0
|
||||||
|
|
||||||
subroutine (4:argv,2:argc),space
|
subroutine (4:argv,2:argc),space
|
||||||
|
|
||||||
inc exitamundo
|
inc exit_requested
|
||||||
|
|
||||||
return 2:#0
|
return 2:#0
|
||||||
|
|
||||||
|
@ -1649,7 +1373,7 @@ done setdebug newdebug
|
||||||
mv2 newdebug,globaldebug
|
mv2 newdebug,globaldebug
|
||||||
return return 2:#0
|
return return 2:#0
|
||||||
|
|
||||||
findflag inc arg
|
findflag incad arg
|
||||||
ldy #0
|
ldy #0
|
||||||
findloop phy
|
findloop phy
|
||||||
lda nametbl,y
|
lda nametbl,y
|
||||||
|
@ -1997,60 +1721,69 @@ space equ p+4
|
||||||
|
|
||||||
subroutine (4:argv,2:argc),space
|
subroutine (4:argv,2:argc),space
|
||||||
|
|
||||||
ph2 t_size
|
ph2 t_size Get size of hash table.
|
||||||
jsl sv_alloc
|
jsl sv_alloc Allocate a string vector array.
|
||||||
sta sv
|
sta sv
|
||||||
stx sv+2
|
stx sv+2
|
||||||
|
|
||||||
lda hash_table
|
lda hash_table If no hash table
|
||||||
ora hash_table+2
|
ora hash_table+2 has been allocated,
|
||||||
beq exit
|
beq exit exit.
|
||||||
mv4 hash_table,p
|
|
||||||
lda hash_numexe
|
mv4 hash_table,p Move address to dir pg variable.
|
||||||
beq doneadd
|
lda hash_numexe Get the number of executable files.
|
||||||
ldy #0
|
beq doneadd Done if 0.
|
||||||
ldx t_size
|
|
||||||
beq doneadd
|
|
||||||
;
|
;
|
||||||
; loop through every hashed file and add it the string vector
|
; loop through every hashed file and add it the string vector
|
||||||
;
|
;
|
||||||
addloop lda [p],y
|
ldy #0 Y is index into the next entry.
|
||||||
sta q
|
ldx t_size X is the number of entries left.
|
||||||
|
beq doneadd
|
||||||
|
addloop lda [p],y Get next hash table entry.
|
||||||
|
sta q
|
||||||
iny
|
iny
|
||||||
iny
|
iny
|
||||||
lda [p],y
|
lda [p],y
|
||||||
sta q+2
|
sta q+2
|
||||||
iny
|
iny
|
||||||
iny
|
iny
|
||||||
ora q
|
ora q If this entry isn't used,
|
||||||
beq skip
|
beq skip skip to the next one.
|
||||||
phy
|
|
||||||
|
phy Hold the Y and X regs on stack.
|
||||||
phx
|
phx
|
||||||
pei (sv+2)
|
pei (sv+2) Insert string in table entry
|
||||||
pei (sv)
|
pei (sv) into the string vector.
|
||||||
pei (q+2)
|
clc
|
||||||
lda q
|
lda q
|
||||||
inc a
|
adc #2 (Note: tn_name in hash.asm == 2)
|
||||||
inc a
|
tax
|
||||||
|
lda q+2
|
||||||
|
adc #0
|
||||||
pha
|
pha
|
||||||
pea 1
|
phx
|
||||||
|
pea 1 (allocflag: 1 = allocate memory)
|
||||||
jsl sv_add
|
jsl sv_add
|
||||||
plx
|
plx Restore X and Y regs from stack.
|
||||||
ply
|
ply
|
||||||
skip dex
|
skip dex
|
||||||
bne addloop
|
bne addloop
|
||||||
|
;
|
||||||
|
; Files have all been added to the string vector
|
||||||
|
;
|
||||||
doneadd anop
|
doneadd anop
|
||||||
|
|
||||||
doneprint pei (sv+2)
|
|
||||||
pei (sv)
|
|
||||||
jsl sv_sort
|
|
||||||
pei (sv+2)
|
pei (sv+2)
|
||||||
pei (sv)
|
pei (sv)
|
||||||
jsl sv_colprint
|
jsl sv_sort Sort the string vector.
|
||||||
|
|
||||||
pei (sv+2)
|
pei (sv+2)
|
||||||
pei (sv)
|
pei (sv)
|
||||||
jsl sv_dispose
|
jsl sv_colprint Print the string vector in columns.
|
||||||
|
|
||||||
|
pei (sv+2)
|
||||||
|
pei (sv)
|
||||||
|
jsl sv_dispose Dispose of the string vector memory.
|
||||||
|
|
||||||
exit return 2:#0
|
exit return 2:#0
|
||||||
|
|
||||||
|
@ -2153,7 +1886,7 @@ addloop lda builtintbl,x
|
||||||
bra addloop
|
bra addloop
|
||||||
doneadd anop
|
doneadd anop
|
||||||
|
|
||||||
doneprint pei (sv+2)
|
pei (sv+2)
|
||||||
pei (sv)
|
pei (sv)
|
||||||
jsl sv_sort
|
jsl sv_sort
|
||||||
pei (sv+2)
|
pei (sv+2)
|
||||||
|
|
156
bin/gsh/cmd.asm
156
bin/gsh/cmd.asm
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: cmd.asm,v 1.3 1998/06/30 17:25:17 tribby Exp $
|
* $Id: cmd.asm,v 1.4 1998/07/20 16:23:02 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -121,7 +121,7 @@ SINGQUOTE equ 4 ;single quote string
|
||||||
; Main loop: get character and take action based upon state.
|
; Main loop: get character and take action based upon state.
|
||||||
;
|
;
|
||||||
loop lda [buf]
|
loop lda [buf]
|
||||||
inc buf
|
incad buf
|
||||||
and2 @a,#$FF,ch ch = next character.
|
and2 @a,#$FF,ch ch = next character.
|
||||||
bne switch
|
bne switch
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ neut4b if2 @a,ne,#'#',neut5 ;comment
|
||||||
neut4c lda [buf]
|
neut4c lda [buf]
|
||||||
and #$7F
|
and #$7F
|
||||||
beq neut4d
|
beq neut4d
|
||||||
inc buf
|
incad buf
|
||||||
if2 @a,eq,#13,neut4d
|
if2 @a,eq,#13,neut4d
|
||||||
if2 @a,eq,#10,neut4d
|
if2 @a,eq,#10,neut4d
|
||||||
bra neut4c
|
bra neut4c
|
||||||
|
@ -219,10 +219,10 @@ startsingle lda #SINGQUOTE
|
||||||
neut8 if2 @a,ne,#'\',neut9
|
neut8 if2 @a,ne,#'\',neut9
|
||||||
lda [buf]
|
lda [buf]
|
||||||
and #$FF
|
and #$FF
|
||||||
inc buf
|
incad buf
|
||||||
if2 @a,eq,#13,neut10a
|
if2 @a,eq,#13,neut10a
|
||||||
neut9 sta [word] ;default
|
neut9 sta [word] ;default
|
||||||
inc word
|
incad word
|
||||||
lda #INWORD
|
lda #INWORD
|
||||||
neut10 sta state
|
neut10 sta state
|
||||||
neut10a jmp loop
|
neut10a jmp loop
|
||||||
|
@ -242,7 +242,7 @@ gtgt2 lda [buf]
|
||||||
if2 @a,eq,#'&',gtgt3
|
if2 @a,eq,#'&',gtgt3
|
||||||
lda #T_GTGT
|
lda #T_GTGT
|
||||||
jmp done
|
jmp done
|
||||||
gtgt3 inc buf
|
gtgt3 incad buf
|
||||||
lda #T_GTGTAMP
|
lda #T_GTGTAMP
|
||||||
jmp done
|
jmp done
|
||||||
;
|
;
|
||||||
|
@ -250,9 +250,9 @@ gtgt3 inc buf
|
||||||
;
|
;
|
||||||
case_inquote if2 ch,ne,#'\',quote2 ;is it a quoted character?
|
case_inquote if2 ch,ne,#'\',quote2 ;is it a quoted character?
|
||||||
lda [buf]
|
lda [buf]
|
||||||
inc buf
|
incad buf
|
||||||
putword sta [word]
|
putword sta [word]
|
||||||
inc word
|
incad word
|
||||||
jmp loop
|
jmp loop
|
||||||
quote2 if2 @a,ne,#'"',putword
|
quote2 if2 @a,ne,#'"',putword
|
||||||
ld2 INWORD,state
|
ld2 INWORD,state
|
||||||
|
@ -283,7 +283,7 @@ case_inword if2 ch,eq,#000,endword
|
||||||
jeq startsingle
|
jeq startsingle
|
||||||
if2 @a,ne,#'\',putword
|
if2 @a,ne,#'\',putword
|
||||||
lda [buf]
|
lda [buf]
|
||||||
inc buf
|
incad buf
|
||||||
and #$FF
|
and #$FF
|
||||||
if2 @a,eq,#13,word2
|
if2 @a,eq,#13,word2
|
||||||
bra putword
|
bra putword
|
||||||
|
@ -801,56 +801,60 @@ end equ path+4
|
||||||
|
|
||||||
lock mutex
|
lock mutex
|
||||||
;
|
;
|
||||||
; set the variables 0..argc
|
; Set the variables 0..argc
|
||||||
;
|
;
|
||||||
lda argc
|
lda argc Get number of variables.
|
||||||
jeq skipvar
|
jeq vars_set If 0, there are none to set.
|
||||||
stz count
|
|
||||||
parmloop lda count
|
|
||||||
asl2 a
|
|
||||||
tay
|
|
||||||
lda [argv],y
|
|
||||||
sta setparm+4
|
|
||||||
iny2
|
|
||||||
lda [argv],y
|
|
||||||
sta setparm+6
|
|
||||||
lda count
|
|
||||||
cmp #10
|
|
||||||
bcs num1
|
|
||||||
short a
|
|
||||||
adc #'0'
|
|
||||||
sta num+2
|
|
||||||
long a
|
|
||||||
ld4 num+2,setparm
|
|
||||||
bra setit
|
|
||||||
num1 cmp #100
|
|
||||||
bcs num2
|
|
||||||
Int2Dec (@a,#num+1,#2,#0)
|
|
||||||
ld4 num+1,setparm
|
|
||||||
bra setit
|
|
||||||
num2 Int2Dec (@a,#num,#3,#0)
|
|
||||||
ld4 num,setparm
|
|
||||||
setit ph4 setparm
|
|
||||||
jsr c2pstr2
|
|
||||||
phx
|
|
||||||
pha
|
|
||||||
stx setparm+2
|
|
||||||
sta setparm
|
|
||||||
ph4 setparm+4
|
|
||||||
jsr c2pstr2
|
|
||||||
phx
|
|
||||||
pha
|
|
||||||
stx setparm+4+2
|
|
||||||
sta setparm+4
|
|
||||||
Set_Variable setparm
|
|
||||||
jsl nullfree
|
|
||||||
jsl nullfree
|
|
||||||
inc count
|
|
||||||
lda count
|
|
||||||
cmp argc
|
|
||||||
jcc parmloop
|
|
||||||
|
|
||||||
skipvar unlock mutex
|
stz count Start with argv[0].
|
||||||
|
parmloop lda count Get index
|
||||||
|
asl2 a into address array.
|
||||||
|
tay
|
||||||
|
lda [argv],y Copy argument
|
||||||
|
sta SetValue pointer to
|
||||||
|
iny2 SetValue
|
||||||
|
lda [argv],y
|
||||||
|
sta SetValue+2
|
||||||
|
|
||||||
|
lda count If parameter number
|
||||||
|
cmp #10
|
||||||
|
bcs digits2or3 < 10,
|
||||||
|
adc #'0' Convert to single digit
|
||||||
|
sta pname_text and store in name string.
|
||||||
|
lda #1 Set length of string to 1.
|
||||||
|
sta pname
|
||||||
|
bra set_value
|
||||||
|
|
||||||
|
digits2or3 cmp #100 If parameter number
|
||||||
|
bcs digits3 >= 10 && < 99,
|
||||||
|
ldx #2 length = 2
|
||||||
|
bra setit otherwise
|
||||||
|
digits3 ldx #3 length = 3
|
||||||
|
;
|
||||||
|
; Store length (2 or 3) and convert number to text
|
||||||
|
;
|
||||||
|
setit stx pname
|
||||||
|
Int2Dec (@a,#pname_text,pname,#0)
|
||||||
|
|
||||||
|
set_value anop
|
||||||
|
ph4 SetValue Convert value string
|
||||||
|
jsr c2gsstr to a GS/OS string
|
||||||
|
stx SetValue+2 and save in SetGS
|
||||||
|
sta SetValue parameter block.
|
||||||
|
|
||||||
|
SetGS SetPB Set $count to the argv string.
|
||||||
|
|
||||||
|
ph4 SetValue Free the value buffer.
|
||||||
|
jsl nullfree
|
||||||
|
inc count Bump the parameter counter.
|
||||||
|
lda count If more to do,
|
||||||
|
cmp argc
|
||||||
|
jcc parmloop stay in loop.
|
||||||
|
|
||||||
|
;
|
||||||
|
; Variables have all been set
|
||||||
|
;
|
||||||
|
vars_set unlock mutex
|
||||||
|
|
||||||
ph4 #4 ;Close parms
|
ph4 #4 ;Close parms
|
||||||
jsl ~NEW
|
jsl ~NEW
|
||||||
|
@ -969,21 +973,19 @@ noecho lda [data]
|
||||||
and #$FF
|
and #$FF
|
||||||
if2 @a,eq,#'#',ReadLoop
|
if2 @a,eq,#'#',ReadLoop
|
||||||
|
|
||||||
* execute subroutine (4:cmdline,2:jobflag)
|
* call execute: subroutine (4:cmdline,2:jobflag)
|
||||||
pei (data+2)
|
pei (data+2)
|
||||||
pei (data)
|
pei (data)
|
||||||
* ph2 #0
|
|
||||||
* ph2 #1
|
|
||||||
pei (jobflag)
|
pei (jobflag)
|
||||||
jsl execute
|
jsl execute
|
||||||
sta status
|
sta status
|
||||||
|
|
||||||
lda exitamundo
|
lda exit_requested
|
||||||
bne almostdone
|
bne almostdone
|
||||||
bra ReadLoop
|
bra ReadLoop
|
||||||
|
|
||||||
almostdone anop
|
almostdone anop
|
||||||
stz exitamundo
|
stz exit_requested
|
||||||
lda #1
|
lda #1
|
||||||
sta [CRec]
|
sta [CRec]
|
||||||
pei (CRec+2)
|
pei (CRec+2)
|
||||||
|
@ -1031,9 +1033,19 @@ NLTable dc h'0d'
|
||||||
Err dc i2'1' pCount
|
Err dc i2'1' pCount
|
||||||
ErrError ds 2 Error number
|
ErrError ds 2 Error number
|
||||||
|
|
||||||
setparm ds 4
|
;
|
||||||
ds 4
|
; Parameter block for shell SetGS calls (p 427 in ORCA/M manual)
|
||||||
num dc c'000',h'00'
|
;
|
||||||
|
SetPB anop
|
||||||
|
dc i2'3' pCount
|
||||||
|
SetName dc i4'pname' Name (pointer to GS/OS string)
|
||||||
|
SetValue ds 4 Value (pointer to GS/OS string)
|
||||||
|
SetExport ds 2 Export flag
|
||||||
|
;
|
||||||
|
; Name of argv parameter ($1 to $999) to be set; GS/OS string
|
||||||
|
;
|
||||||
|
pname ds 2 Length
|
||||||
|
pname_text dc c'000' Text (up to 3 digits)
|
||||||
|
|
||||||
mutex key
|
mutex key
|
||||||
|
|
||||||
|
@ -1097,10 +1109,8 @@ chkws lda [cmdstrt] Get next character.
|
||||||
beq bump_strt
|
beq bump_strt
|
||||||
cmp #9 or a tab,
|
cmp #9 or a tab,
|
||||||
bne found_start
|
bne found_start
|
||||||
bump_strt inc cmdstrt bump the start pointer
|
bump_strt incad cmdstrt bump the start pointer
|
||||||
bne chkws and look for more whitespace.
|
bra chkws and look for more whitespace.
|
||||||
inc cmdstrt+2
|
|
||||||
bra chkws
|
|
||||||
|
|
||||||
; Initialize pointer to end of command
|
; Initialize pointer to end of command
|
||||||
|
|
||||||
|
@ -1249,7 +1259,7 @@ noecho anop
|
||||||
jmp chk_cmd
|
jmp chk_cmd
|
||||||
|
|
||||||
|
|
||||||
* command l_subroutine (4:waitpid,2:inpipe,2:jobflag,2:inpipe2,
|
* command subroutine (4:waitpid,2:inpipe,2:jobflag,2:inpipe2,
|
||||||
* 4:pipesem,4:stream)
|
* 4:pipesem,4:stream)
|
||||||
loop pea 0 ;Bank 0 waitpid (hi)
|
loop pea 0 ;Bank 0 waitpid (hi)
|
||||||
tdc
|
tdc
|
||||||
|
@ -1322,7 +1332,11 @@ nowait if2 term,eq,#T_EOF,noerrexit
|
||||||
beq exit
|
beq exit
|
||||||
jmp loop process the next command.
|
jmp loop process the next command.
|
||||||
|
|
||||||
noerrexit stz waitstatus ;non-forked builtins cannot return an error
|
;
|
||||||
|
; NOTE: non-forked builtins have no mechanism to return command status
|
||||||
|
;
|
||||||
|
|
||||||
|
noerrexit stz waitstatus
|
||||||
|
|
||||||
exit jsl nullfree
|
exit jsl nullfree
|
||||||
lda term ;make sure we return -1 if error
|
lda term ;make sure we return -1 if error
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: dir.asm,v 1.3 1998/06/30 17:25:20 tribby Exp $
|
* $Id: dir.asm,v 1.4 1998/07/20 16:23:03 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -693,7 +693,7 @@ checkhome lda [path],y
|
||||||
|
|
||||||
found lda #'~'
|
found lda #'~'
|
||||||
sta [ptr]
|
sta [ptr]
|
||||||
inc ptr
|
incad ptr
|
||||||
bra copyrest
|
bra copyrest
|
||||||
|
|
||||||
notfound pla
|
notfound pla
|
||||||
|
@ -706,7 +706,7 @@ copyloop lda [path],y
|
||||||
lda #'/'
|
lda #'/'
|
||||||
copyput sta [ptr]
|
copyput sta [ptr]
|
||||||
long a
|
long a
|
||||||
inc ptr
|
incad ptr
|
||||||
short a
|
short a
|
||||||
iny
|
iny
|
||||||
bra copyloop
|
bra copyloop
|
||||||
|
|
369
bin/gsh/edit.asm
369
bin/gsh/edit.asm
|
@ -6,12 +6,13 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: edit.asm,v 1.3 1998/06/30 17:25:23 tribby Exp $
|
* $Id: edit.asm,v 1.4 1998/07/20 16:23:03 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
* EDIT.ASM
|
* EDIT.ASM
|
||||||
* By Tim Meekins
|
* By Tim Meekins
|
||||||
|
* Modified by Dave Tribby for GNO 2.0.6
|
||||||
*
|
*
|
||||||
* The GNO/Shell command-line editor
|
* The GNO/Shell command-line editor
|
||||||
*
|
*
|
||||||
|
@ -651,7 +652,7 @@ t1a lda [p],y
|
||||||
;
|
;
|
||||||
; one at a time
|
; one at a time
|
||||||
;
|
;
|
||||||
t2 jsr dofignore
|
t2 jsl dofignore
|
||||||
lda nummatch
|
lda nummatch
|
||||||
beq meepmeep
|
beq meepmeep
|
||||||
dec a
|
dec a
|
||||||
|
@ -730,27 +731,29 @@ wordlen equ wordnum+2
|
||||||
varpos equ wordlen+2
|
varpos equ wordlen+2
|
||||||
newpos equ varpos+2
|
newpos equ varpos+2
|
||||||
wordpos equ newpos+2
|
wordpos equ newpos+2
|
||||||
|
gsbuf equ wordpos+2
|
||||||
|
space equ gsbuf+4
|
||||||
|
|
||||||
jsl alloc256
|
subroutine (0:dummy),space
|
||||||
sta ReadName
|
|
||||||
stx ReadName+2
|
|
||||||
phx
|
|
||||||
pha
|
|
||||||
|
|
||||||
Read_Variable varparms
|
ph4 #fignore
|
||||||
jsr p2cstr
|
jsl getenv
|
||||||
sta var
|
|
||||||
stx var+2
|
|
||||||
phx
|
|
||||||
pha
|
|
||||||
jsr lowercstr
|
|
||||||
lda ReadName
|
|
||||||
ldx ReadName+2
|
|
||||||
jsl free256
|
|
||||||
|
|
||||||
lda [var]
|
sta gsbuf If buffer wasn't allocated
|
||||||
and #$FF
|
stx gsbuf+2
|
||||||
jeq done
|
ora gsbuf+2
|
||||||
|
jeq done return to caller.
|
||||||
|
|
||||||
|
clc
|
||||||
|
lda gsbuf Text begins after
|
||||||
|
adc #4 four bytes of
|
||||||
|
bcc storevar length words.
|
||||||
|
inx
|
||||||
|
storevar sta var Store pointer to
|
||||||
|
stx var+2 c-string in var.
|
||||||
|
phx Shift
|
||||||
|
pha to
|
||||||
|
jsr lowercstr lower case.
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
sta wordnum
|
sta wordnum
|
||||||
|
@ -762,14 +765,14 @@ bigloop asl a
|
||||||
tay
|
tay
|
||||||
lda matchbuf+2,x
|
lda matchbuf+2,x
|
||||||
sta word+2
|
sta word+2
|
||||||
pha
|
pha
|
||||||
phy
|
phy
|
||||||
jsr cstrlen
|
jsr cstrlen
|
||||||
sta wordlen
|
sta wordlen
|
||||||
stz newpos
|
stz newpos
|
||||||
figmatch lda newpos
|
figmatch lda newpos
|
||||||
sta varpos
|
sta varpos
|
||||||
ldy varpos
|
ldy varpos
|
||||||
eatspace lda [var],y
|
eatspace lda [var],y
|
||||||
and #$FF
|
and #$FF
|
||||||
beq bignext
|
beq bignext
|
||||||
|
@ -777,6 +780,7 @@ eatspace lda [var],y
|
||||||
bne yummy
|
bne yummy
|
||||||
iny
|
iny
|
||||||
bra eatspace
|
bra eatspace
|
||||||
|
|
||||||
yummy sty varpos
|
yummy sty varpos
|
||||||
ldx #0
|
ldx #0
|
||||||
eatstuff lda [var],y
|
eatstuff lda [var],y
|
||||||
|
@ -787,6 +791,7 @@ eatstuff lda [var],y
|
||||||
inx
|
inx
|
||||||
iny
|
iny
|
||||||
bra eatstuff
|
bra eatstuff
|
||||||
|
|
||||||
gotstuff sty newpos
|
gotstuff sty newpos
|
||||||
cpx wordlen
|
cpx wordlen
|
||||||
beq hgf
|
beq hgf
|
||||||
|
@ -817,18 +822,15 @@ bignext inc wordnum
|
||||||
cmp nummatch
|
cmp nummatch
|
||||||
bcc bigloop
|
bcc bigloop
|
||||||
|
|
||||||
done pei (var+2)
|
pei (gsbuf+2) Free memory allocated
|
||||||
pei (var)
|
pei (gsbuf) for the value of $FIGNORE.
|
||||||
jsl nullfree
|
jsl nullfree
|
||||||
rts
|
|
||||||
|
|
||||||
; Parameter block for shell Read_Variable call
|
done anop
|
||||||
; [predecessor to ReadVariableGS call (p 423 in ORCA/M manual)]
|
|
||||||
varparms anop
|
|
||||||
dc a4'fignore' Pointer to name
|
|
||||||
ReadName ds 4 Pointer to result
|
|
||||||
|
|
||||||
fignore str 'fignore' Env variable name
|
return
|
||||||
|
|
||||||
|
fignore gsstr 'fignore' Env variable name
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
|
@ -1023,12 +1025,12 @@ isolate cpy cmdlen
|
||||||
beq gotiso
|
beq gotiso
|
||||||
cmp #'&'
|
cmp #'&'
|
||||||
beq gotiso
|
beq gotiso
|
||||||
sta wordbuf,x
|
sta wordgs_text,x
|
||||||
iny
|
iny
|
||||||
inx
|
inx
|
||||||
bra isolate
|
bra isolate
|
||||||
gotiso lda #0
|
gotiso lda #0
|
||||||
sta wordbuf,x
|
sta wordgs_text,x
|
||||||
stx wordlen
|
stx wordlen
|
||||||
sty cmdloc
|
sty cmdloc
|
||||||
txa
|
txa
|
||||||
|
@ -1070,115 +1072,93 @@ chkflag cmp #';'
|
||||||
|
|
||||||
gotflag anop
|
gotflag anop
|
||||||
;
|
;
|
||||||
; check if the first character is '$', if so, match for variables ONLY
|
; Check if the first character is '$', if so, match for variables ONLY
|
||||||
;
|
;
|
||||||
lda wordbuf
|
lda wordgs_text
|
||||||
and #$FF
|
and #$FF
|
||||||
cmp #'$'
|
cmp #'$'
|
||||||
jne filem
|
jne filem
|
||||||
|
|
||||||
ld2 1,varIndex
|
ld2 1,idxIndex
|
||||||
varloop Read_Indexed varParm
|
varloop ReadIndexedGS idxParm
|
||||||
lda buffer
|
lda NameLen
|
||||||
jeq vardone
|
beq vardone
|
||||||
dec a
|
|
||||||
cmp wordlen ;if shorter than word skip
|
cmp wordlen ;if shorter than word skip
|
||||||
jcc nextvar
|
jcc nextvar
|
||||||
|
;
|
||||||
|
; Scan this variable name to see if it matches wordgs_text
|
||||||
|
;
|
||||||
ldx #1
|
ldx #1
|
||||||
varscan lda wordbuf,x
|
varscan lda wordgs_text,x
|
||||||
and #$FF
|
and #$FF
|
||||||
beq goodvar
|
beq goodvar Matches (up to current length)
|
||||||
jsr tolower
|
jsr tolower
|
||||||
eor buffer,x
|
eor NameText-1,x
|
||||||
and #$FF
|
and #$FF
|
||||||
jne nextvar
|
jne nextvar Name doesn't match word.
|
||||||
inx
|
inx
|
||||||
bra varscan
|
bra varscan
|
||||||
|
;
|
||||||
|
; We have a match between the variable name and word being typed
|
||||||
|
;
|
||||||
|
goodvar stz sepstyle Don't use ":" or "/"
|
||||||
|
|
||||||
goodvar stz sepstyle
|
gv02a anop
|
||||||
lda varval
|
lda nummatch Get the number of matches.
|
||||||
and #$FF
|
asl a Multiply by 4 (size of address entry)
|
||||||
tay
|
|
||||||
ldx #1
|
|
||||||
gv00 dey
|
|
||||||
bmi gv02
|
|
||||||
lda varval,x
|
|
||||||
and #$FF
|
|
||||||
cmp #':'
|
|
||||||
beq gv00b
|
|
||||||
cmp #'/'
|
|
||||||
bne gv00a
|
|
||||||
gv00b sta sepstyle
|
|
||||||
gv00a inx
|
|
||||||
bra gv00
|
|
||||||
|
|
||||||
gv02 lda varval ;check if it really is a directory
|
|
||||||
and #$FF
|
|
||||||
sta varval-1
|
|
||||||
ld4 varval-1,GFName
|
|
||||||
GetFileInfo GFParm
|
|
||||||
lda GFType
|
|
||||||
cmp #$0F
|
|
||||||
beq gv02a
|
|
||||||
stz sepstyle
|
|
||||||
|
|
||||||
gv02a lda nummatch
|
|
||||||
asl a
|
asl a
|
||||||
asl a
|
pha Hold offset on stack.
|
||||||
pha
|
lda NameLen Get length of name,
|
||||||
lda buffer
|
inc a and add 3.
|
||||||
and #$FF
|
|
||||||
inc a
|
|
||||||
inc a
|
inc a
|
||||||
inc a
|
inc a
|
||||||
pea 0
|
pea 0
|
||||||
pha
|
pha
|
||||||
jsl ~NEW
|
jsl ~NEW Request memory to hold name.
|
||||||
sta 0
|
sta 0
|
||||||
stx 0+2
|
stx 0+2
|
||||||
ply
|
ply Get matchbuf offset from stack.
|
||||||
sta matchbuf,y
|
sta matchbuf,y Store allocated memory's
|
||||||
txa
|
txa address in matchbuf array.
|
||||||
sta matchbuf+2,y
|
sta matchbuf+2,y
|
||||||
inc nummatch
|
inc nummatch
|
||||||
lda #'$'
|
|
||||||
sta [0]
|
|
||||||
lda buffer
|
|
||||||
and #$FF
|
|
||||||
tax
|
|
||||||
ldy #1
|
|
||||||
gv01 lda buffer,y
|
|
||||||
sta [0],y
|
|
||||||
iny
|
|
||||||
dex
|
|
||||||
bne gv01
|
|
||||||
lda sepstyle
|
|
||||||
sta [0],y
|
|
||||||
|
|
||||||
nextvar inc varIndex
|
lda #'$' First character = "$".
|
||||||
|
sta [0]
|
||||||
|
ldx NameLen Get length of name in X-Reg.
|
||||||
|
ldy #1 Use Y as offset into strings.
|
||||||
|
gv01 lda NameText-1,y Get next byte of name.
|
||||||
|
sta [0],y Store in allocated memory.
|
||||||
|
iny Bump the index.
|
||||||
|
dex Decrement the count
|
||||||
|
bne gv01 Keep copying until done.
|
||||||
|
lda sepstyle Store separator style at end.
|
||||||
|
sta [0],y
|
||||||
|
;
|
||||||
|
; Done with this variable. Check the next one.
|
||||||
|
;
|
||||||
|
nextvar inc idxIndex
|
||||||
jmp varloop
|
jmp varloop
|
||||||
|
|
||||||
vardone rts
|
vardone rts
|
||||||
|
|
||||||
;
|
;
|
||||||
; next lets match by file names
|
; Match by file names; start by moving wordgs_text + trailing "*" to a GS/OS string
|
||||||
; we'll start by moving our wordbuf to a pascal string
|
|
||||||
;
|
;
|
||||||
filem lda #1
|
filem lda #1
|
||||||
sta iwparm+4
|
sta iwFlags
|
||||||
|
|
||||||
short a
|
|
||||||
lda wordlen
|
lda wordlen
|
||||||
inc a
|
inc a
|
||||||
sta wordpbuf
|
sta wordgsbuf
|
||||||
long a
|
|
||||||
ldy wordlen
|
ldy wordlen
|
||||||
lda #'*'
|
lda #'*'
|
||||||
sta wordbuf,y
|
sta wordgs_text,y
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
short a
|
short a
|
||||||
dey
|
dey
|
||||||
findsep lda wordbuf,y
|
findsep lda wordgs_text,y
|
||||||
cmp #':'
|
cmp #':'
|
||||||
beq gotsep
|
beq gotsep
|
||||||
cmp #'/'
|
cmp #'/'
|
||||||
|
@ -1197,7 +1177,7 @@ findsep lda wordbuf,y
|
||||||
bne nextsep
|
bne nextsep
|
||||||
cpy #0 ;allow boot prefix */
|
cpy #0 ;allow boot prefix */
|
||||||
bne gotglob
|
bne gotglob
|
||||||
lda wordbuf+1
|
lda wordgs_text+1
|
||||||
cmp sepstyle
|
cmp sepstyle
|
||||||
bne gotglob
|
bne gotglob
|
||||||
bra nextsep
|
bra nextsep
|
||||||
|
@ -1211,57 +1191,66 @@ nextsep dey
|
||||||
long a
|
long a
|
||||||
cpx #0
|
cpx #0
|
||||||
beq initit
|
beq initit
|
||||||
dec iwparm+4
|
dec iwFlags
|
||||||
|
|
||||||
initit Init_Wildcard iwparm
|
initit InitWildcardGS iwparm
|
||||||
|
|
||||||
filematch Next_Wildcard nwparm
|
filematch anop
|
||||||
lda buffer
|
NextWildcardGS nwparm
|
||||||
and #$FF
|
ldy NameLen Get length of name.
|
||||||
jeq filemdone
|
jeq filemdone
|
||||||
cmp wordlen
|
cpy wordlen
|
||||||
beq filematch
|
beq filematch
|
||||||
lda nummatch
|
|
||||||
|
lda #0 Store null byte at end of name,
|
||||||
|
sta NameText,y so it will act like a c-string.
|
||||||
|
|
||||||
|
lda nummatch Get the number of matches.
|
||||||
|
asl a Multiply by 4 (size of address entry)
|
||||||
asl a
|
asl a
|
||||||
asl a
|
pha Hold offset on stack.
|
||||||
pha
|
iny Get length of name + 1
|
||||||
ph4 #buffer
|
pea 0
|
||||||
jsr p2cstr
|
phy
|
||||||
ply
|
jsl ~NEW Request memory to hold name.
|
||||||
phx ;for c2gsstr
|
ply Get matchbuf offset from stack.
|
||||||
pha
|
sta matchbuf,y Store allocated memory's
|
||||||
sta matchbuf,y
|
txa address in matchbuf array.
|
||||||
txa
|
|
||||||
sta matchbuf+2,y
|
sta matchbuf+2,y
|
||||||
jsr c2gsstr
|
|
||||||
phx ;for nullfree
|
ph4 #NameText Copy string from
|
||||||
|
lda matchbuf+2,y name buffer into
|
||||||
|
pha matchbuf table entry.
|
||||||
|
lda matchbuf,y
|
||||||
pha
|
pha
|
||||||
sta GFName
|
jsr copycstr
|
||||||
stx GFName+2
|
|
||||||
sta 4
|
lda cmdflag Are we looking for a command?
|
||||||
stx 6
|
|
||||||
GetFileInfo GFParm
|
|
||||||
jsl nullfree
|
|
||||||
lda cmdflag
|
|
||||||
beq fm01
|
beq fm01
|
||||||
lda GFType
|
lda nwType Yes: Get the file's type
|
||||||
cmp #$0F
|
cmp #$0F == $0F?
|
||||||
beq isdir
|
beq isdir it's a directory
|
||||||
cmp #$B5
|
cmp #$B5 == $B5?
|
||||||
beq notdir
|
beq notdir it's EXE (shell executable)
|
||||||
cmp #$B3
|
cmp #$B3 == $B3?
|
||||||
beq notdir
|
beq notdir it's S16 (GS/OS application)
|
||||||
cmp #$B0
|
cmp #$B0 == $B0?
|
||||||
bne filematch
|
bne filematch it's SRC (shell source code)
|
||||||
lda GFAux
|
lda nwAux Get file's aux type
|
||||||
cmp #6
|
cmp #6 == $00000006?
|
||||||
bne filematch
|
bne filematch
|
||||||
lda GFAux+2
|
lda nwAux+2
|
||||||
bne filematch
|
bne filematch No; try next wildcard.
|
||||||
bra notdir
|
bra notdir It's shell cmd file.
|
||||||
fm01 lda GFType
|
;
|
||||||
|
; Not looking for a command
|
||||||
|
;
|
||||||
|
fm01 lda nwType
|
||||||
cmp #$0F
|
cmp #$0F
|
||||||
bne notdir
|
bne notdir
|
||||||
|
;
|
||||||
|
; File type is $0F: it's a directory
|
||||||
|
;
|
||||||
isdir lda nummatch
|
isdir lda nummatch
|
||||||
asl a
|
asl a
|
||||||
asl a
|
asl a
|
||||||
|
@ -1271,8 +1260,7 @@ isdir lda nummatch
|
||||||
sta 0
|
sta 0
|
||||||
lda matchbuf+2,x
|
lda matchbuf+2,x
|
||||||
sta 2
|
sta 2
|
||||||
lda buffer
|
lda NameLen Allocate NameLen+2 bytes of memory
|
||||||
and #$FF
|
|
||||||
inc a
|
inc a
|
||||||
inc a
|
inc a
|
||||||
pea 0
|
pea 0
|
||||||
|
@ -1292,15 +1280,13 @@ isdir lda nummatch
|
||||||
pei (2)
|
pei (2)
|
||||||
pei (0)
|
pei (0)
|
||||||
jsl nullfree
|
jsl nullfree
|
||||||
lda buffer
|
ldy NameLen
|
||||||
and #$FF
|
|
||||||
tay
|
|
||||||
lda sepstyle
|
lda sepstyle
|
||||||
sta [8],y
|
sta [8],y
|
||||||
|
|
||||||
notdir anop
|
notdir anop
|
||||||
inc nummatch
|
inc nummatch Bump the match count.
|
||||||
jmp filematch
|
jmp filematch Try next wildcard.
|
||||||
|
|
||||||
filemdone anop
|
filemdone anop
|
||||||
lda cmdflag ;if it's not a command, we're done
|
lda cmdflag ;if it's not a command, we're done
|
||||||
|
@ -1313,17 +1299,17 @@ q equ 4
|
||||||
|
|
||||||
ldy wordlen ;remove '*' from above
|
ldy wordlen ;remove '*' from above
|
||||||
lda #0
|
lda #0
|
||||||
sta wordbuf,y
|
sta wordgs_text,y
|
||||||
|
|
||||||
lda hash_table
|
lda hash_table
|
||||||
ora hash_table+2
|
ora hash_table+2
|
||||||
beq endhash
|
beq eq_endhash
|
||||||
mv4 hash_table,p
|
mv4 hash_table,p
|
||||||
lda hash_numexe
|
lda hash_numexe
|
||||||
beq endhash
|
beq endhash
|
||||||
ldy #0
|
ldy #0
|
||||||
ldx t_size
|
ldx t_size
|
||||||
beq endhash
|
eq_endhash beq endhash
|
||||||
;
|
;
|
||||||
; loop through every hashed file and add it the string vector
|
; loop through every hashed file and add it the string vector
|
||||||
;
|
;
|
||||||
|
@ -1337,8 +1323,8 @@ hashloop lda [p],y
|
||||||
iny
|
iny
|
||||||
ora q
|
ora q
|
||||||
beq nexthash
|
beq nexthash
|
||||||
inc q
|
incad q
|
||||||
inc q
|
incad q
|
||||||
phy
|
phy
|
||||||
phx
|
phx
|
||||||
pei (q+2)
|
pei (q+2)
|
||||||
|
@ -1348,7 +1334,7 @@ hashloop lda [p],y
|
||||||
bcc nexthash0
|
bcc nexthash0
|
||||||
tax
|
tax
|
||||||
ldy #0
|
ldy #0
|
||||||
hl lda wordbuf,y
|
hl lda wordgs_text,y
|
||||||
and #$FF
|
and #$FF
|
||||||
beq hl0
|
beq hl0
|
||||||
jsr tolower
|
jsr tolower
|
||||||
|
@ -1400,7 +1386,7 @@ bilup lda [p]
|
||||||
bcc binext
|
bcc binext
|
||||||
tax
|
tax
|
||||||
ldy #0
|
ldy #0
|
||||||
bl lda wordbuf,y
|
bl lda wordgs_text,y
|
||||||
and #$FF
|
and #$FF
|
||||||
beq bl0
|
beq bl0
|
||||||
eor [q],y
|
eor [q],y
|
||||||
|
@ -1435,27 +1421,52 @@ done rts
|
||||||
startpos ds 2
|
startpos ds 2
|
||||||
cmdflag ds 2
|
cmdflag ds 2
|
||||||
|
|
||||||
iwparm dc i4'wordpbuf'
|
;
|
||||||
dc i2'1'
|
; GS/OS string holding match word + wildcard "*"
|
||||||
|
;
|
||||||
|
wordgsbuf ds 2
|
||||||
|
wordgs_text ds 256
|
||||||
|
|
||||||
nwparm dc i4'buffer'
|
;
|
||||||
|
; Parameter block for shell InitWildcardGS call (p 414 in ORCA/M manual)
|
||||||
|
;
|
||||||
|
iwparm dc i2'2' pCount
|
||||||
|
dc i4'wordgsbuf' pathname with wildcard
|
||||||
|
iwFlags dc i2'1' flags
|
||||||
|
|
||||||
GFParm dc i2'4'
|
;
|
||||||
GFName dc i4'0'
|
; Parameter block for shell NextWildcardGS call (p 414 in ORCA/M manual)
|
||||||
dc i2'0'
|
;
|
||||||
GFType dc i2'0'
|
nwparm dc i2'4' pCount
|
||||||
GFAux dc i4'0'
|
dc i4'NameBuf' pathName
|
||||||
|
dc i2'0' access
|
||||||
|
nwType dc i2'0' fileType
|
||||||
|
nwAux dc i4'0' auxType
|
||||||
|
|
||||||
|
;
|
||||||
; Parameter block for shell Read_Indexed call
|
; Parameter block for shell ReadIndexedGS call (p 421 in ORCA/M manual)
|
||||||
; [predecessor to ReadIndexedGS call (p 421 in ORCA/M manual)]
|
;
|
||||||
varParm anop
|
idxParm anop
|
||||||
dc i4'buffer' Name (pointer to 256-byte p-string)
|
dc i2'4' pCount
|
||||||
dc i4'varval' Value (pointer to 256-byte p-string)
|
dc i4'NameBuf' Name (pointer to GS/OS result buf)
|
||||||
varIndex dc i2'0' Index number
|
dc i4'ResultBuf' Value (pointer to GS/OS result buf)
|
||||||
|
idxIndex ds 2 Index number
|
||||||
ds 1 ;<- don't futz with me!!
|
ds 2 Export flag
|
||||||
varval ds 256
|
;
|
||||||
|
; GS/OS result buffer to hold name: maximum size = 255 bytes
|
||||||
|
;
|
||||||
|
NameBuf dc i2'259' Total length of result buf.
|
||||||
|
NameLen ds 2 Name's length returned here.
|
||||||
|
NameText ds 255 Text goes here.
|
||||||
|
ds 2 Room for terminating null bytes.
|
||||||
|
;
|
||||||
|
; GS/OS result buffer for testing whether a variable is defined.
|
||||||
|
; It doesn't have enough room for > 1 byte to be returned, but we
|
||||||
|
; only need to get the length of the value.
|
||||||
|
;
|
||||||
|
ResultBuf dc i2'5' Only five bytes total.
|
||||||
|
ds 2 Value's length returned here.
|
||||||
|
ds 1 Only 1 byte for value.
|
||||||
|
|
||||||
sepstyle ds 2
|
sepstyle ds 2
|
||||||
|
|
||||||
|
@ -1944,9 +1955,7 @@ numloop asl ch
|
||||||
|
|
||||||
casebreak lda ch
|
casebreak lda ch
|
||||||
casebreak0 sta [cp]
|
casebreak0 sta [cp]
|
||||||
inc cp
|
incad cp
|
||||||
jne loop
|
|
||||||
inc cp+2
|
|
||||||
jmp loop
|
jmp loop
|
||||||
|
|
||||||
breakloop lda #0
|
breakloop lda #0
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: expand.asm,v 1.3 1998/06/30 17:25:27 tribby Exp $
|
* $Id: expand.asm,v 1.4 1998/07/20 16:23:03 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -219,7 +219,7 @@ globword stz filesep
|
||||||
sta exppath
|
sta exppath
|
||||||
stx exppath+2
|
stx exppath+2
|
||||||
|
|
||||||
inc eptr ;leave room for pascal length
|
incad eptr ;leave room for pascal length
|
||||||
mv4 eptr,sepptr
|
mv4 eptr,sepptr
|
||||||
|
|
||||||
ldy #0
|
ldy #0
|
||||||
|
@ -233,11 +233,11 @@ exploop lda [wordbuf],y
|
||||||
if2 @a,eq,#'/',expsep
|
if2 @a,eq,#'/',expsep
|
||||||
if2 @a,eq,#':',expsep
|
if2 @a,eq,#':',expsep
|
||||||
expput sta [eptr]
|
expput sta [eptr]
|
||||||
inc eptr
|
incad eptr
|
||||||
bra exploop
|
bra exploop
|
||||||
expsep sty filesep
|
expsep sty filesep
|
||||||
sta [eptr]
|
sta [eptr]
|
||||||
inc eptr
|
incad eptr
|
||||||
mv4 eptr,sepptr
|
mv4 eptr,sepptr
|
||||||
bra exploop
|
bra exploop
|
||||||
expslash lda [wordbuf],y
|
expslash lda [wordbuf],y
|
||||||
|
@ -251,7 +251,7 @@ expsingle lda [wordbuf],y
|
||||||
beq endexp
|
beq endexp
|
||||||
if2 @a,eq,#"'",exploop
|
if2 @a,eq,#"'",exploop
|
||||||
sta [eptr]
|
sta [eptr]
|
||||||
inc eptr
|
incad eptr
|
||||||
bra expsingle
|
bra expsingle
|
||||||
expdouble lda [wordbuf],y
|
expdouble lda [wordbuf],y
|
||||||
iny
|
iny
|
||||||
|
@ -259,7 +259,7 @@ expdouble lda [wordbuf],y
|
||||||
beq endexp
|
beq endexp
|
||||||
if2 @a,eq,#'"',exploop
|
if2 @a,eq,#'"',exploop
|
||||||
sta [eptr]
|
sta [eptr]
|
||||||
inc eptr
|
incad eptr
|
||||||
bra expdouble
|
bra expdouble
|
||||||
;
|
;
|
||||||
; We really didn't mean to expand the filename, so, copy it back again..
|
; We really didn't mean to expand the filename, so, copy it back again..
|
||||||
|
@ -269,7 +269,7 @@ copyback lda [wordbuf],y
|
||||||
iny
|
iny
|
||||||
and #$FF
|
and #$FF
|
||||||
sta [sepptr]
|
sta [sepptr]
|
||||||
inc sepptr
|
incad sepptr
|
||||||
cmp #0
|
cmp #0
|
||||||
bne copyback
|
bne copyback
|
||||||
;
|
;
|
||||||
|
@ -393,7 +393,7 @@ bye return 4:buf
|
||||||
; Subroutine of glob: get a byte from the original command-line
|
; Subroutine of glob: get a byte from the original command-line
|
||||||
;
|
;
|
||||||
g_getbyte lda [cmd]
|
g_getbyte lda [cmd]
|
||||||
inc cmd
|
incad cmd
|
||||||
and #$FF
|
and #$FF
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@ -419,21 +419,21 @@ special pha
|
||||||
;
|
;
|
||||||
; Subroutine of glob: store a byte into the new command-line
|
; Subroutine of glob: store a byte into the new command-line
|
||||||
;
|
;
|
||||||
g_putbyte short a
|
g_putbyte short a
|
||||||
sta [ptr]
|
sta [ptr]
|
||||||
long a
|
long a
|
||||||
inc ptr
|
incad ptr
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
glob_mutex key
|
glob_mutex key
|
||||||
|
|
||||||
; Parameter block for InitWildcard shell call (ORCA/M pp 414-415)
|
; Parameter block for InitWildcard shell call (ORCA/M pp 414-415)
|
||||||
InitWCParm ds 4 Path name, with wildcard
|
InitWCParm ds 4 Path name, with wildcard
|
||||||
dc i2'%00000001' Flags (this bit not documented!!!)
|
dc i2'%00000001' Flags (this bit not documented!!!)
|
||||||
|
|
||||||
; Parameter block for NextWildcard shell call (ORCA/M pp 417-418)
|
; Parameter block for NextWildcard shell call (ORCA/M pp 417-418)
|
||||||
nWCparm ds 4 Pointer to returned path name
|
nWCparm ds 4 Pointer to returned path name
|
||||||
|
|
||||||
nomatch dc c'No match: ',h'00'
|
nomatch dc c'No match: ',h'00'
|
||||||
ignored dc c' ignored',h'0d00'
|
ignored dc c' ignored',h'0d00'
|
||||||
|
@ -444,13 +444,14 @@ ignored dc c' ignored',h'0d00'
|
||||||
*
|
*
|
||||||
* Expand $variables and tildes not in single quotes
|
* Expand $variables and tildes not in single quotes
|
||||||
*
|
*
|
||||||
* * Add error checking if out buf gets too big (> 1024)
|
|
||||||
* * Get rid of fixed buffers
|
|
||||||
*
|
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
|
|
||||||
expandvars START
|
expandvars START
|
||||||
|
|
||||||
|
; Maximum number of characters in an environment variable or $<
|
||||||
|
MAXVAL equ 512
|
||||||
|
|
||||||
|
|
||||||
ptr equ 1
|
ptr equ 1
|
||||||
buf equ ptr+4
|
buf equ ptr+4
|
||||||
dflag equ buf+4
|
dflag equ buf+4
|
||||||
|
@ -536,6 +537,8 @@ nameloop lda [cmd]
|
||||||
if2 @a,cc,#'z'+1,inname
|
if2 @a,cc,#'z'+1,inname
|
||||||
bra getval
|
bra getval
|
||||||
inname jsr e_getbyte
|
inname jsr e_getbyte
|
||||||
|
cpx #255 Only the first 255 characters
|
||||||
|
beq nameloop are significant.
|
||||||
sta name,x
|
sta name,x
|
||||||
inx
|
inx
|
||||||
bra nameloop
|
bra nameloop
|
||||||
|
@ -550,6 +553,8 @@ braceloop lda [cmd]
|
||||||
beq getval
|
beq getval
|
||||||
jsr e_getbyte
|
jsr e_getbyte
|
||||||
if2 @a,eq,#'}',getval
|
if2 @a,eq,#'}',getval
|
||||||
|
cpx #255 Only the first 255 characters
|
||||||
|
beq braceloop are significant.
|
||||||
sta name,x
|
sta name,x
|
||||||
inx
|
inx
|
||||||
bra braceloop
|
bra braceloop
|
||||||
|
@ -558,83 +563,77 @@ braceloop lda [cmd]
|
||||||
; get text from standard input
|
; get text from standard input
|
||||||
;
|
;
|
||||||
stdinexpand jsr e_getbyte
|
stdinexpand jsr e_getbyte
|
||||||
ReadLine (#value+1,#255,#13,#1),@a
|
ReadLine (#value,#MAXVAL,#13,#1),@a
|
||||||
|
sta valueln
|
||||||
bra chklen
|
bra chklen
|
||||||
|
|
||||||
;
|
;
|
||||||
; get a value for this variable
|
; Get a value for this variable
|
||||||
;
|
;
|
||||||
getval lda #0
|
getval stx nameln Save length of name.
|
||||||
sta name,x
|
ReadVariableGS ReadVarPB Read its value.
|
||||||
ph4 #name
|
|
||||||
jsr c2pstr2
|
|
||||||
phx
|
|
||||||
pha
|
|
||||||
sta parm
|
|
||||||
stx parm+2
|
|
||||||
Read_Variable parm
|
|
||||||
jsl nullfree
|
|
||||||
|
|
||||||
lda value Get length
|
lda valueln Get value length.
|
||||||
chklen and #$FF byte.
|
cmp #MAXVAL+1 If > maximum allowed length,
|
||||||
|
bcs expanded we didn't get anything.
|
||||||
|
cmp #0
|
||||||
|
chklen anop
|
||||||
beq expanded If 0, nothing to do
|
beq expanded If 0, nothing to do
|
||||||
tax Save length in X-reg.
|
tax Save length in X-reg.
|
||||||
lda dflag If delimiter flag isn't set,
|
lda dflag If delimiter flag isn't set,
|
||||||
beq storeval go store the variable value
|
beq storeval go store the variable value
|
||||||
|
|
||||||
; Check to see if delimiters in the variable need to be switched
|
; Check to see if delimiters in the variable need to be switched
|
||||||
lda value Set up length
|
lda valueln Set up length in
|
||||||
and #$FF byte in
|
tax X-reg and get
|
||||||
tax X-reg and
|
lda [cmd] next command line
|
||||||
lda [cmd] Get next command line
|
and #$FF character.
|
||||||
and #$FF character.
|
|
||||||
cmp #"/" If it's a slash, see if
|
cmp #"/" If it's a slash, see if
|
||||||
beq chkvarslash variable needs to convert to slash.
|
beq chkvarslash variable needs to convert to slash.
|
||||||
cmp #":" If it's not a colon,
|
cmp #":" If it's not a colon,
|
||||||
bne storeval no need to convert.
|
bne storeval no need to convert.
|
||||||
lda value+1 Get first character of value.
|
lda value Get first character of value.
|
||||||
and #$FF
|
and #$FF
|
||||||
cmp #"/" If it's not a slash,
|
cmp #"/" If it's not a slash,
|
||||||
bne storeval no need to convert.
|
bne storeval no need to convert.
|
||||||
|
|
||||||
; Convert variable from "/" to ":" delimiter
|
; Convert variable from "/" to ":" delimiter
|
||||||
short m
|
short m
|
||||||
chk_s lda value,x
|
chk_s lda value-1,x
|
||||||
cmp #"/"
|
cmp #"/"
|
||||||
bne bump_s
|
bne bump_s
|
||||||
lda #":"
|
lda #":"
|
||||||
sta value,x
|
sta value-1,x
|
||||||
bump_s dex
|
bump_s dex
|
||||||
bpl chk_s
|
bpl chk_s
|
||||||
long m
|
long m
|
||||||
bra storeval
|
bra storeval
|
||||||
|
|
||||||
chkvarslash anop
|
chkvarslash anop
|
||||||
lda value+1 Get first character of value.
|
lda value Get first character of value.
|
||||||
and #$FF
|
and #$FF
|
||||||
cmp #":" If it's not a colon,
|
cmp #":" If it's not a colon,
|
||||||
bne storeval no need to convert.
|
bne storeval no need to convert.
|
||||||
|
|
||||||
; Convert variable from ":" to "/" delimiter
|
; Convert variable from ":" to "/" delimiter
|
||||||
short m
|
short m
|
||||||
chk_c lda value,x
|
chk_c lda value-1,x
|
||||||
cmp #":"
|
cmp #":"
|
||||||
bne bump_c
|
bne bump_c
|
||||||
lda #"/"
|
lda #"/"
|
||||||
sta value,x
|
sta value-1,x
|
||||||
bump_c dex
|
bump_c dex
|
||||||
bpl chk_c
|
bpl chk_c
|
||||||
long m
|
long m
|
||||||
|
|
||||||
;
|
;
|
||||||
; store the variable value in the out buffer
|
; Store the variable's value in the out buffer
|
||||||
;
|
;
|
||||||
storeval anop
|
storeval anop
|
||||||
lda value Get length
|
lda valueln Get length.
|
||||||
and #$FF byte.
|
|
||||||
tay Save length in Y-reg.
|
tay Save length in Y-reg.
|
||||||
ldx #0 Use X-reg in index value.
|
ldx #0 Use X-reg in index value.
|
||||||
putval lda value+1,x
|
putval lda value,x
|
||||||
jsr e_putbyte
|
jsr e_putbyte
|
||||||
inx
|
inx
|
||||||
dey
|
dey
|
||||||
|
@ -662,24 +661,38 @@ done jsr e_putbyte
|
||||||
tya
|
tya
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
e_getbyte lda [cmd]
|
e_getbyte lda [cmd]
|
||||||
inc cmd
|
incad cmd
|
||||||
and #$FF
|
and #$FF
|
||||||
rts
|
rts
|
||||||
|
|
||||||
e_putbyte short a
|
e_putbyte short a
|
||||||
sta [ptr]
|
sta [ptr]
|
||||||
long a
|
long a
|
||||||
inc ptr
|
incad ptr
|
||||||
rts
|
rts
|
||||||
|
|
||||||
exp_mutex key
|
exp_mutex key
|
||||||
|
|
||||||
; Parameter block for ReadVariable shell call
|
|
||||||
parm dc a4'name'
|
|
||||||
dc a4'value'
|
|
||||||
|
|
||||||
name ds 256
|
; GS/OS string to hold variable name
|
||||||
value ds 256
|
namestr anop
|
||||||
|
nameln ds 2 Length of name
|
||||||
|
name ds 256 Room for 255 chars + 0.
|
||||||
|
|
||||||
|
|
||||||
|
; GS/OS result buffer to hold up to MAXVAL bytes of value
|
||||||
|
valueresult anop
|
||||||
|
dc i2'MAXVAL+4' Length of result buffer
|
||||||
|
valueln ds 2 Length of value
|
||||||
|
value ds MAXVAL Room for MAXVAL chars
|
||||||
|
|
||||||
|
|
||||||
|
; Parameter block for shell ReadVariableGS calls
|
||||||
|
ReadVarPB anop
|
||||||
|
dc i2'3' pCount
|
||||||
|
RVname dc a4'namestr' Name (pointer to GS/OS string)
|
||||||
|
RVvalue dc a4'valueresult' Value (ptr to result buf or string)
|
||||||
|
RVexport ds 2 Export flag
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
2909
bin/gsh/gsh.mac
2909
bin/gsh/gsh.mac
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Resources for version and comment
|
* Resources for version and comment
|
||||||
*
|
*
|
||||||
* $Id: gsh.rez,v 1.2 1998/06/30 17:25:33 tribby Exp $
|
* $Id: gsh.rez,v 1.3 1998/07/20 16:23:06 tribby Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PROG "gsh"
|
#define PROG "gsh"
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
resource rVersion (1, purgeable3) {
|
resource rVersion (1, purgeable3) {
|
||||||
{ 2, 0, 0, /* Version 2.0.0 */
|
{ 2, 0, 0, /* Version 2.0.0 */
|
||||||
development, /* development|alpha|beta|final|release */
|
development, /* development|alpha|beta|final|release */
|
||||||
1 }, /* non-final release number */
|
2 }, /* non-final release number */
|
||||||
verUS, /* Country */
|
verUS, /* Country */
|
||||||
PROG, /* Program name */
|
PROG, /* Program name */
|
||||||
DESC
|
DESC
|
||||||
|
@ -30,6 +30,6 @@ resource rVersion (1, purgeable3) {
|
||||||
resource rComment (1, purgeable3) {
|
resource rComment (1, purgeable3) {
|
||||||
PROG " v2.0\n"
|
PROG " v2.0\n"
|
||||||
DESC
|
DESC
|
||||||
"Written by Tim Meekins.\n"
|
"Written by Tim Meekins. Updated by Dave Tribby\n"
|
||||||
BUILD_DATE
|
BUILD_DATE
|
||||||
};
|
};
|
||||||
|
|
526
bin/gsh/hash.asm
526
bin/gsh/hash.asm
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: hash.asm,v 1.3 1998/06/30 17:25:34 tribby Exp $
|
* $Id: hash.asm,v 1.4 1998/07/20 16:23:06 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -57,16 +57,27 @@ dummyhash start ; ends up in .root
|
||||||
C1 gequ 11
|
C1 gequ 11
|
||||||
C2 gequ 13
|
C2 gequ 13
|
||||||
TAB_MULT gequ 4
|
TAB_MULT gequ 4
|
||||||
|
|
||||||
;
|
;
|
||||||
; Structure for filenames
|
; Structure for filenames
|
||||||
;
|
;
|
||||||
|
; struct filenode {
|
||||||
|
; short dirnum;
|
||||||
|
; char name[32];
|
||||||
|
; filenode *next;
|
||||||
|
; };
|
||||||
fn_dirNum gequ 0
|
fn_dirNum gequ 0
|
||||||
fn_name gequ fn_dirNum+2
|
fn_name gequ fn_dirNum+2
|
||||||
fn_next gequ fn_name+32
|
fn_next gequ fn_name+32
|
||||||
fn_size gequ fn_next+4
|
fn_size gequ fn_next+4
|
||||||
|
|
||||||
;
|
;
|
||||||
; Structure for hash table
|
; Structure for hash table
|
||||||
;
|
;
|
||||||
|
; struct tablenode {
|
||||||
|
; short dirnum;
|
||||||
|
; char *name[32];
|
||||||
|
; };
|
||||||
tn_dirNum gequ 0
|
tn_dirNum gequ 0
|
||||||
tn_name gequ tn_dirNum+2
|
tn_name gequ tn_dirNum+2
|
||||||
tn_size gequ tn_name+32
|
tn_size gequ tn_name+32
|
||||||
|
@ -259,23 +270,29 @@ hashloop pei (files+2)
|
||||||
tay
|
tay
|
||||||
lda [table],y
|
lda [table],y
|
||||||
tax
|
tax
|
||||||
iny
|
iny2
|
||||||
iny
|
|
||||||
ora [table],y
|
ora [table],y
|
||||||
beq gotit
|
beq gotit
|
||||||
|
|
||||||
; let's see if it's the same, skip if so...
|
; If it's the same name, skip the duplicate entry
|
||||||
|
|
||||||
; pei (files+2)
|
ldy h Calculate address
|
||||||
; lda files
|
clc of hash entry's
|
||||||
; inc a
|
lda [table],y name field.
|
||||||
; inc a
|
adc #tn_name
|
||||||
; pha
|
tax
|
||||||
; lda [table],y
|
iny2
|
||||||
; pha
|
lda [table],y
|
||||||
; phx
|
adc #0
|
||||||
; jsr cmpcstr
|
pha High-order word of address.
|
||||||
; beq mainloop
|
phx Low-order word of address.
|
||||||
|
pei (files+2)
|
||||||
|
lda files
|
||||||
|
inc a
|
||||||
|
inc a
|
||||||
|
pha
|
||||||
|
jsr cmpcstr
|
||||||
|
beq mainloop
|
||||||
|
|
||||||
inc qh
|
inc qh
|
||||||
bra hashloop
|
bra hashloop
|
||||||
|
@ -361,64 +378,70 @@ end equ file+4
|
||||||
tcd
|
tcd
|
||||||
|
|
||||||
stz qh
|
stz qh
|
||||||
stz full_path
|
stz full_path Set result to NULL.
|
||||||
stz full_path+2
|
stz full_path+2
|
||||||
|
|
||||||
lda table
|
lda table If hash table hasn't
|
||||||
ora table+2
|
ora table+2 been allocated,
|
||||||
jeq done
|
jeq done return null string.
|
||||||
|
|
||||||
pei (file+2)
|
pei (file+2)
|
||||||
pei (file)
|
pei (file)
|
||||||
jsr lowercstr
|
jsr lowercstr
|
||||||
mainloop pei (file+2)
|
mainloop pei (file+2) Get hash(qh,file)
|
||||||
pei (file)
|
pei (file)
|
||||||
pei (qh)
|
pei (qh)
|
||||||
jsr hash
|
jsr hash
|
||||||
asl a
|
asl a Multiply by 4
|
||||||
asl a
|
asl a
|
||||||
tay
|
tay Use as index into table.
|
||||||
lda [table],y
|
lda [table],y ptr = table[hash(qh,file)]
|
||||||
sta ptr
|
sta ptr
|
||||||
tax
|
tax
|
||||||
iny
|
iny
|
||||||
iny
|
iny
|
||||||
ora [table],y
|
ora [table],y If == 0,
|
||||||
jeq done
|
jeq done all done.
|
||||||
|
|
||||||
lda [table],y
|
lda [table],y
|
||||||
sta ptr+2
|
sta ptr+2
|
||||||
|
|
||||||
pei (file+2)
|
pei (file+2)
|
||||||
pei (file)
|
pei (file)
|
||||||
pha ;ptr+2
|
pha ;ptr+2
|
||||||
inx ;ptr + #2
|
inx ;ptr + #2
|
||||||
inx
|
inx
|
||||||
phx
|
phx
|
||||||
jsr cmpcstr
|
jsr cmpcstr Compare filename against entry.
|
||||||
beq found
|
beq found
|
||||||
inc qh
|
inc qh
|
||||||
bra mainloop
|
bra mainloop
|
||||||
|
|
||||||
|
;
|
||||||
|
; Found an entry that matches the filename. Calculate full path.
|
||||||
|
;
|
||||||
found lda [ptr]
|
found lda [ptr]
|
||||||
asl a
|
asl a
|
||||||
asl a
|
asl a
|
||||||
ldx paths+2
|
|
||||||
adc paths ;(cf=0)
|
adc paths ;(cf=0)
|
||||||
stx ptr+2
|
|
||||||
sta ptr
|
sta ptr
|
||||||
|
ldx paths+2
|
||||||
|
stx ptr+2
|
||||||
ldy #2
|
ldy #2
|
||||||
lda [ptr],y
|
lda [ptr],y
|
||||||
pha
|
pha
|
||||||
lda [ptr]
|
lda [ptr]
|
||||||
pha
|
pha
|
||||||
jsr cstrlen
|
jsr cstrlen Get length of path.
|
||||||
pha
|
pha
|
||||||
clc
|
clc
|
||||||
adc #33
|
adc #33 Add 33 (max prog name size + 1)
|
||||||
pea 0
|
pea 0
|
||||||
pha
|
pha
|
||||||
jsl ~NEW
|
jsl ~NEW Allocate memory,
|
||||||
sta full_path
|
sta full_path storing address at
|
||||||
stx full_path+2
|
stx full_path+2 functional return value.
|
||||||
|
|
||||||
ldy #2
|
ldy #2
|
||||||
lda [ptr],y
|
lda [ptr],y
|
||||||
pha
|
pha
|
||||||
|
@ -426,7 +449,8 @@ found lda [ptr]
|
||||||
pha
|
pha
|
||||||
pei (full_path+2)
|
pei (full_path+2)
|
||||||
pei (full_path)
|
pei (full_path)
|
||||||
jsr copycstr
|
jsr copycstr Copy pathname into buffer.
|
||||||
|
|
||||||
pla ;length of path
|
pla ;length of path
|
||||||
pei (file+2)
|
pei (file+2)
|
||||||
pei (file)
|
pei (file)
|
||||||
|
@ -434,10 +458,12 @@ found lda [ptr]
|
||||||
clc
|
clc
|
||||||
adc full_path
|
adc full_path
|
||||||
pha
|
pha
|
||||||
jsr copycstr
|
jsr copycstr Put filename at end of pathname.
|
||||||
|
|
||||||
done ldx full_path+2
|
done ldx full_path+2 Load return value into Y- & X- regs
|
||||||
ldy full_path
|
ldy full_path
|
||||||
|
|
||||||
|
; Adjust stack in preparation for return
|
||||||
lda space
|
lda space
|
||||||
sta end-3
|
sta end-3
|
||||||
lda space+1
|
lda space+1
|
||||||
|
@ -448,7 +474,8 @@ done ldx full_path+2
|
||||||
adc #end-4
|
adc #end-4
|
||||||
tcs
|
tcs
|
||||||
|
|
||||||
tya
|
tya A- & X- regs contain ptr (or NULL)
|
||||||
|
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
END
|
END
|
||||||
|
@ -538,101 +565,124 @@ space equ ptr+4
|
||||||
|
|
||||||
subroutine (4:dir,2:dirNum,4:files),space
|
subroutine (4:dir,2:dirNum,4:files),space
|
||||||
;
|
;
|
||||||
; Open directory
|
; Open directory name passed as 1st parameter
|
||||||
;
|
;
|
||||||
ld2 3,ORec
|
ld2 3,ORec
|
||||||
pei (dir+2) ;copy this string
|
pei (dir+2) Turn "dir" c-string into
|
||||||
pei (dir)
|
pei (dir) a GS/OS string, allocated
|
||||||
jsr c2gsstr
|
jsr c2gsstr via ~NEW.
|
||||||
sta ORecPath
|
sta ORecPath
|
||||||
stx ORecPath+2
|
stx ORecPath+2
|
||||||
phx
|
phx Put GS/OS string addr on stack
|
||||||
pha
|
pha so it can be deallocated.
|
||||||
Open ORec
|
Open ORec Open that file.
|
||||||
bcc goodopen
|
bcc goodopen If there was an error,
|
||||||
jsl nullfree
|
jsl nullfree Free the GS/OS string
|
||||||
jmp exit
|
jmp exit and exit.
|
||||||
|
|
||||||
goodopen jsl nullfree
|
goodopen jsl nullfree Free the GS/OS string.
|
||||||
mv2 ORecRef,DRecRef
|
|
||||||
stz DRecBase
|
;
|
||||||
stz DRecDisp
|
; Set up parameter block for GetDirEntry
|
||||||
jsl alloc256
|
;
|
||||||
sta DRecName
|
mv2 ORecRef,DRecRef Copy the file ref num from open.
|
||||||
sta ptr
|
stz DRecBase Zero the base and
|
||||||
|
stz DRecDisp displacement.
|
||||||
|
jsl alloc256 Get 256 bytes for name.
|
||||||
|
sta DRecName Store address in param block
|
||||||
|
sta ptr and also in direct page var.
|
||||||
stx DRecName+2
|
stx DRecName+2
|
||||||
stx ptr+2
|
stx ptr+2
|
||||||
|
lda #254 Set total length of GS/OS buffer in
|
||||||
|
sta [ptr] bufsize word (save byte for 0 at end).
|
||||||
|
GetDirEntry DRec Make DirEntry call.
|
||||||
|
|
||||||
lda #254 ;Output buffer size (GT never did this?)
|
mv2 DRecEntry,numEntries Save number of entries.
|
||||||
sta [ptr]
|
|
||||||
GetDirEntry DRec
|
|
||||||
mv2 DRecEntry,numEntries
|
|
||||||
ld2 1,(DRecBase,DRecDisp)
|
ld2 1,(DRecBase,DRecDisp)
|
||||||
stz entry
|
stz entry # processed entries = 0.
|
||||||
|
|
||||||
loop lda entry
|
loop lda entry If number of processed entries
|
||||||
cmp numEntries
|
cmp numEntries equals the total number,
|
||||||
jge done
|
jge done we are all done.
|
||||||
GetDirEntry DRec
|
GetDirEntry DRec
|
||||||
|
|
||||||
|
; Check for filetype $B3: GS/OS Application (S16)
|
||||||
if2 DRecFileType,eq,#$B3,goodfile
|
if2 DRecFileType,eq,#$B3,goodfile
|
||||||
|
|
||||||
|
; Check for filetype $B5: GS/OS Shell Application (EXE)
|
||||||
if2 @a,eq,#$B5,goodfile
|
if2 @a,eq,#$B5,goodfile
|
||||||
|
|
||||||
|
; Check for filetype $B0, subtype $0006: Shell command file (EXEC)
|
||||||
cmp #$B0
|
cmp #$B0
|
||||||
jne nextfile
|
bne nextfile
|
||||||
lda DRecAuxType
|
lda DRecAuxType
|
||||||
cmp #$06
|
cmp #$06
|
||||||
jne nextfile
|
bne nextfile
|
||||||
lda DRecAuxType+2
|
lda DRecAuxType+2
|
||||||
jne nextfile
|
bne nextfile
|
||||||
goodfile inc hash_numexe
|
;
|
||||||
ldy #2
|
; This directory entry points to an executable file.
|
||||||
lda [ptr],y
|
; Included it in the file list.
|
||||||
add2 @a,#4,@y
|
;
|
||||||
lda #0
|
goodfile inc hash_numexe Bump the (global) # files.
|
||||||
sta [ptr],y
|
ldy #2 Get length word from GS/OS string
|
||||||
|
lda [ptr],y in result buffer.
|
||||||
|
add2 @a,#4,@y Use length + 4 as index
|
||||||
|
lda #0 to store terminating
|
||||||
|
sta [ptr],y null byte.
|
||||||
add2 ptr,#4,@a
|
add2 ptr,#4,@a
|
||||||
pei (ptr+2) ;for copycstr
|
pei (ptr+2) ;for copycstr
|
||||||
pha
|
pha
|
||||||
pei (ptr+2)
|
pei (ptr+2)
|
||||||
pha
|
pha
|
||||||
jsr lowercstr
|
jsr lowercstr Convert name to lower case.
|
||||||
|
|
||||||
ldy #fn_next
|
ldy #fn_next temp = files->next.
|
||||||
lda [files],y
|
lda [files],y
|
||||||
sta temp
|
sta temp
|
||||||
ldy #fn_next+2
|
ldy #fn_next+2
|
||||||
lda [files],y
|
lda [files],y
|
||||||
sta temp+2
|
sta temp+2
|
||||||
ph4 #fn_size
|
|
||||||
|
ph4 #fn_size temp2 = new entry.
|
||||||
jsl ~NEW
|
jsl ~NEW
|
||||||
sta temp2
|
sta temp2
|
||||||
stx temp2+2
|
stx temp2+2
|
||||||
ldy #fn_next
|
|
||||||
|
ldy #fn_next files->next = temp2
|
||||||
sta [files],y
|
sta [files],y
|
||||||
ldy #fn_next+2
|
ldy #fn_next+2
|
||||||
txa
|
txa
|
||||||
pha
|
pha
|
||||||
sta [files],y
|
sta [files],y
|
||||||
|
|
||||||
lda temp2
|
lda temp2
|
||||||
clc
|
clc
|
||||||
adc #fn_name
|
adc #fn_name
|
||||||
pha
|
pha
|
||||||
jsr copycstr
|
jsr copycstr
|
||||||
lda dirNum
|
|
||||||
sta [temp2]
|
lda dirNum temp2->dirnum = dirNum
|
||||||
ldy #fn_next
|
sta [temp2]
|
||||||
|
|
||||||
|
ldy #fn_next temp2->next = temp
|
||||||
lda temp
|
lda temp
|
||||||
sta [temp2],y
|
sta [temp2],y
|
||||||
ldy #fn_next+2
|
ldy #fn_next+2
|
||||||
lda temp+2
|
lda temp+2
|
||||||
sta [temp2],y
|
sta [temp2],y
|
||||||
|
|
||||||
nextfile inc entry
|
nextfile inc entry Bump entry number
|
||||||
jmp loop
|
jmp loop and stay in the loop.
|
||||||
|
|
||||||
done ldx DRecName+2
|
;
|
||||||
|
; Done adding entries to the hash table from this directory
|
||||||
|
;
|
||||||
|
done ldx DRecName+2 Free the Name buffer.
|
||||||
lda DRecName
|
lda DRecName
|
||||||
jsl free256
|
jsl free256
|
||||||
ld2 1,ORec
|
|
||||||
|
ld2 1,ORec ORec.pCount = 1
|
||||||
Close ORec
|
Close ORec
|
||||||
|
|
||||||
exit return
|
exit return
|
||||||
|
@ -671,13 +721,17 @@ DRecAuxType ds 4 auxType
|
||||||
hashpath START
|
hashpath START
|
||||||
|
|
||||||
using hashdata
|
using hashdata
|
||||||
|
using vardata
|
||||||
|
|
||||||
len equ 1
|
len equ 1
|
||||||
pathnum equ len+2
|
pathnum equ len+2
|
||||||
ptr equ pathnum+2
|
ptr equ pathnum+2
|
||||||
files equ ptr+4
|
files equ ptr+4
|
||||||
pathptr equ files+4
|
pathptr equ files+4
|
||||||
space equ pathptr+4
|
qflag equ pathptr+4
|
||||||
|
qptr equ qflag+2
|
||||||
|
gsosbuf equ qptr+4
|
||||||
|
space equ gsosbuf+4
|
||||||
end equ space+3
|
end equ space+3
|
||||||
|
|
||||||
;
|
;
|
||||||
|
@ -689,8 +743,10 @@ end equ space+3
|
||||||
tcs
|
tcs
|
||||||
phd
|
phd
|
||||||
tcd
|
tcd
|
||||||
|
|
||||||
|
lock hashmutex
|
||||||
;
|
;
|
||||||
; allocate special file node
|
; Allocate special file node
|
||||||
;
|
;
|
||||||
ph4 #fn_size
|
ph4 #fn_size
|
||||||
jsl ~NEW
|
jsl ~NEW
|
||||||
|
@ -699,15 +755,18 @@ end equ space+3
|
||||||
stx hash_files+2
|
stx hash_files+2
|
||||||
stx files+2
|
stx files+2
|
||||||
|
|
||||||
|
;
|
||||||
|
; Allocate memory for ExpandPath GS/OS result string
|
||||||
|
;
|
||||||
jsl alloc256
|
jsl alloc256
|
||||||
sta EPParm+6
|
sta EPoutputPath
|
||||||
stx EPParm+6+2
|
stx EPoutputPath+2
|
||||||
sta ptr
|
sta ptr
|
||||||
stx ptr+2
|
stx ptr+2
|
||||||
lda #254
|
lda #254
|
||||||
sta [ptr]
|
sta [ptr]
|
||||||
;
|
;
|
||||||
; initialize counters and pointers
|
; Initialize counters and pointers
|
||||||
;
|
;
|
||||||
lda #0
|
lda #0
|
||||||
sta hash_numexe
|
sta hash_numexe
|
||||||
|
@ -720,37 +779,38 @@ end equ space+3
|
||||||
sta [files],y
|
sta [files],y
|
||||||
sta [files]
|
sta [files]
|
||||||
;
|
;
|
||||||
; allocate memory for $path variable
|
; Determine length of $PATH environment variable string
|
||||||
;
|
;
|
||||||
jsl alloc256
|
ph4 #pathname
|
||||||
sta pathvalue
|
jsl getenv
|
||||||
stx pathvalue+2
|
sta gsosbuf Save address of allocated buffer.
|
||||||
phx
|
stx gsosbuf+2
|
||||||
pha
|
ora gsosbuf+2 If null,
|
||||||
phx
|
bne setptr
|
||||||
pha
|
ldx #^nopatherr print error message
|
||||||
;
|
lda #nopatherr
|
||||||
; read $PATH
|
jsr errputs
|
||||||
;
|
jmp noprint and exit.
|
||||||
Read_Variable pathparm
|
|
||||||
|
setptr clc Add 4 bytes to
|
||||||
|
lda gsosbuf direct page pointer
|
||||||
|
adc #4 to get the addr of
|
||||||
|
sta pathptr beginning of text.
|
||||||
|
lda gsosbuf+2
|
||||||
|
adc #0
|
||||||
|
sta pathptr+2
|
||||||
|
|
||||||
jsr p2cstr
|
|
||||||
stx pathptr+2
|
|
||||||
sta pathptr
|
|
||||||
stx pathvalue+2 ;for disposal only
|
|
||||||
sta pathvalue
|
|
||||||
pla
|
|
||||||
plx
|
|
||||||
jsl free256 ;pushed earlier
|
|
||||||
;
|
;
|
||||||
; begin parsing $path
|
; Begin parsing $PATH
|
||||||
;
|
;
|
||||||
loop lda [pathptr]
|
loop lda [pathptr]
|
||||||
and #$FF
|
and #$FF
|
||||||
jeq done
|
jeq pathdone
|
||||||
;
|
;
|
||||||
; parse next pathname
|
; parse next pathname
|
||||||
;
|
;
|
||||||
|
stz qflag Clear quote flag for this path
|
||||||
|
|
||||||
mv4 pathptr,ptr
|
mv4 pathptr,ptr
|
||||||
ldy #0
|
ldy #0
|
||||||
despace lda [pathptr],y
|
despace lda [pathptr],y
|
||||||
|
@ -764,15 +824,19 @@ despace lda [pathptr],y
|
||||||
bra despace
|
bra despace
|
||||||
|
|
||||||
; Found "\"
|
; Found "\"
|
||||||
gotquote iny2
|
gotquote anop
|
||||||
|
iny2
|
||||||
|
ldx qflag If quote flag hasn't already been set,
|
||||||
|
bne despace
|
||||||
|
sty qflag set it to index of first "\" + 2.
|
||||||
bra despace
|
bra despace
|
||||||
|
|
||||||
; Found null byte
|
; Found null byte
|
||||||
gotspace0 tyx
|
gotspace0 tyx Why put Y-reg in X???
|
||||||
bra gotspace3
|
bra gotspace3
|
||||||
|
|
||||||
; Found " ", tab, or creturn
|
; Found " ", tab, or creturn
|
||||||
gotspace1 tyx
|
gotspace1 tyx Why put Y-reg in X???
|
||||||
short a
|
short a
|
||||||
lda #0
|
lda #0
|
||||||
sta [pathptr],y
|
sta [pathptr],y
|
||||||
|
@ -799,25 +863,67 @@ gotspace3 anop
|
||||||
ldx #^toomanyerr
|
ldx #^toomanyerr
|
||||||
lda #toomanyerr
|
lda #toomanyerr
|
||||||
jsr errputs
|
jsr errputs
|
||||||
jmp done
|
jmp pathdone
|
||||||
|
|
||||||
|
;
|
||||||
|
; Convert c string to GS/OS string (allocating space for it)
|
||||||
|
;
|
||||||
numok pei (ptr+2)
|
numok pei (ptr+2)
|
||||||
pei (ptr)
|
pei (ptr)
|
||||||
jsr c2gsstr
|
jsr c2gsstr
|
||||||
phx
|
phx Push allocated address onto
|
||||||
pha
|
pha stack for later deallocation.
|
||||||
sta EPinputPath
|
sta EPinputPath Save address in ExpandPath
|
||||||
stx EPinputPath+2
|
stx EPinputPath+2 parameter block.
|
||||||
ExpandPath EPParm
|
;
|
||||||
|
; If any quoted characters were included, the "\" chars must be removed
|
||||||
|
;
|
||||||
|
ldy qflag Get quote flag (index to "\" char).
|
||||||
|
beq xpandit If no "\", go ahead with expansion.
|
||||||
|
|
||||||
|
sta qptr Save EPinputPath pointer in
|
||||||
|
stx qptr+2 direct page variable.
|
||||||
|
lda [qptr] Store length + 2 (since we're indexing
|
||||||
|
inc2 a from before length word) in qflag.
|
||||||
|
sta qflag
|
||||||
|
tyx X = index of 1st overwritten "\".
|
||||||
|
short a Use 1-byte accumulator
|
||||||
|
;
|
||||||
|
; Copy characters toward front of string, removing "\" chars
|
||||||
|
;
|
||||||
|
chkloop2 lda [qptr],y Get next character.
|
||||||
|
cmp #'\' If it's a quote,
|
||||||
|
bne storeit
|
||||||
|
lda [qptr] Decrement length.
|
||||||
|
dec a
|
||||||
|
sta [qptr]
|
||||||
|
iny Skip over "\".
|
||||||
|
lda [qptr],y Get character following.
|
||||||
|
storeit phy Push source index onto stack
|
||||||
|
txy so destination index can be
|
||||||
|
sta [qptr],y used to store the character.
|
||||||
|
ply Restore the source index.
|
||||||
|
inx Bump destination and
|
||||||
|
iny source index registers.
|
||||||
|
cpy qflag If source index < length,
|
||||||
|
bcc chkloop2 stay in copy loop.
|
||||||
|
|
||||||
|
long a Restore long accumulator.
|
||||||
|
|
||||||
|
;
|
||||||
|
; Convert the input pathname into the corresponding
|
||||||
|
; full pathname with colons as separators.
|
||||||
|
;
|
||||||
|
xpandit ExpandPath EPParm
|
||||||
bcc epok
|
bcc epok
|
||||||
|
|
||||||
ldx #^eperrstr Print error message:
|
ldx #^eperrstr Print error message:
|
||||||
lda #eperrstr "Invalid pathname syntax."
|
lda #eperrstr "Invalid pathname syntax."
|
||||||
jsr errputs
|
jsr errputs
|
||||||
jsl nullfree
|
jsl nullfree Free GS/OS string (pushed earlier).
|
||||||
jmp next
|
jmp next Get the next one.
|
||||||
|
|
||||||
epok jsl nullfree
|
epok jsl nullfree Free GS/OS string (addr on stack)
|
||||||
|
|
||||||
clc Set ptr to GS/OS string
|
clc Set ptr to GS/OS string
|
||||||
lda EPoutputPath portion of result buffer.
|
lda EPoutputPath portion of result buffer.
|
||||||
|
@ -835,11 +941,10 @@ epok jsl nullfree
|
||||||
lda #0
|
lda #0
|
||||||
sta [ptr],y
|
sta [ptr],y
|
||||||
|
|
||||||
pea 0
|
pea 0 Allocate memory the
|
||||||
phy
|
phy size of the expanded path.
|
||||||
jsl ~NEW
|
jsl ~NEW
|
||||||
phx ;for dir_search
|
|
||||||
pha
|
|
||||||
pei (ptr+2)
|
pei (ptr+2)
|
||||||
inc2 ptr
|
inc2 ptr
|
||||||
pei (ptr)
|
pei (ptr)
|
||||||
|
@ -847,58 +952,122 @@ epok jsl nullfree
|
||||||
pha
|
pha
|
||||||
sta ptr
|
sta ptr
|
||||||
stx ptr+2
|
stx ptr+2
|
||||||
|
|
||||||
ldy pathnum
|
ldy pathnum
|
||||||
sta hash_paths,y
|
sta hash_paths,y Store address of this
|
||||||
txa
|
txa path's address in the
|
||||||
sta hash_paths+2,y
|
sta hash_paths+2,y hash path table.
|
||||||
|
|
||||||
jsr copycstr
|
jsr copycstr
|
||||||
ldy len
|
ldy len
|
||||||
beq go4it
|
beq bumppnum
|
||||||
dey
|
dey
|
||||||
lda [ptr],y
|
lda [ptr],y If last character
|
||||||
and #$FF
|
and #$FF of path name
|
||||||
cmp #':'
|
cmp #':' isn't ":",
|
||||||
beq go4it
|
beq bumppnum
|
||||||
iny
|
iny
|
||||||
lda #':'
|
lda #':' store ":\0"
|
||||||
sta [ptr],y
|
sta [ptr],y at end of string.
|
||||||
iny
|
|
||||||
lda #0
|
|
||||||
sta [ptr],y
|
|
||||||
|
|
||||||
go4it lda pathnum
|
bumppnum anop
|
||||||
lsr2 a
|
add2 pathnum,#4,pathnum Bump path pointer.
|
||||||
pha
|
next jmp loop Stay in loop.
|
||||||
pei (files+2)
|
|
||||||
pei (files)
|
|
||||||
jsl dir_search
|
|
||||||
add2 pathnum,#4,pathnum
|
|
||||||
|
|
||||||
next jmp loop
|
;
|
||||||
|
; The $PATH entries have been created. Now we need to search each of the
|
||||||
|
; directories for executable files and add them to the "files" list.
|
||||||
|
; The earliest versions of gsh added files to the list in the order that
|
||||||
|
; directories appeared in $PATH, which put the earliest directories' files
|
||||||
|
; at the end of the list. Check for existence of $OLDPATHMODE environment
|
||||||
|
; variable to see if the user wants this, or would rather have them hashed
|
||||||
|
; in the expected order.
|
||||||
|
;
|
||||||
|
pathdone anop
|
||||||
|
lda varoldpmode
|
||||||
|
beq neworder
|
||||||
|
|
||||||
|
;
|
||||||
|
; Search directories and add executables to file list starting at the
|
||||||
|
; beginning of $PATH and working to the end.
|
||||||
|
;
|
||||||
|
stz pathnum Start at beginning of path table.
|
||||||
|
|
||||||
|
nextpath1 ldy pathnum Get offset into hash table.
|
||||||
|
cpy #32*4
|
||||||
|
bcs filesdone
|
||||||
|
lda hash_paths,y If address of this path
|
||||||
|
ora hash_paths+2,y has not been set,
|
||||||
|
beq filesdone all done.
|
||||||
|
lda hash_paths,y Get address of this
|
||||||
|
ldx hash_paths+2,y path's address in the
|
||||||
|
phx hash path table.
|
||||||
|
pha
|
||||||
|
tya Directory number =
|
||||||
|
lsr2 a offset / 4
|
||||||
|
pha
|
||||||
|
pei (files+2) Pointer to file list.
|
||||||
|
pei (files)
|
||||||
|
jsl dir_search Add executables from this directory.
|
||||||
|
add2 pathnum,#4,pathnum Bump path offset.
|
||||||
|
bra nextpath1
|
||||||
|
|
||||||
|
;
|
||||||
|
; Search directories and add executables to file list starting at end
|
||||||
|
; of $PATH and working back to the beginning. (Note: Loop begins at
|
||||||
|
; "neworder", but structuring the code this ways saves an instruction.)
|
||||||
|
;
|
||||||
|
nextpath2 dey4 Decrement path offset.
|
||||||
|
sty pathnum
|
||||||
|
lda hash_paths,y Get address of this
|
||||||
|
ldx hash_paths+2,y path's address in the
|
||||||
|
phx hash path table.
|
||||||
|
pha
|
||||||
|
tya Directory number =
|
||||||
|
lsr2 a offset / 4
|
||||||
|
pha
|
||||||
|
pei (files+2) Pointer to file list.
|
||||||
|
pei (files)
|
||||||
|
jsl dir_search Add executables from this directory.
|
||||||
|
neworder ldy pathnum Get offset into hash table.
|
||||||
|
bne nextpath2 When == 0, no more to do.
|
||||||
|
|
||||||
|
|
||||||
done ph4 pathvalue
|
;
|
||||||
jsl nullfree
|
; Executable files in $PATH have been added to the list. Print
|
||||||
|
; number of files, then build the hash table.
|
||||||
|
;
|
||||||
|
filesdone anop
|
||||||
|
ph4 gsosbuf Free memory allocated for
|
||||||
|
jsl nullfree $PATH string.
|
||||||
|
|
||||||
lda hash_print
|
lda hash_print If this is the first time,
|
||||||
beq noprint
|
beq noprint don't print the # of files.
|
||||||
|
|
||||||
Int2Dec (hash_numexe,#hashnum,#3,#0)
|
Int2Dec (hash_numexe,#hashnum,#3,#0)
|
||||||
ldx #^hashmsg
|
ldx #^hashmsg
|
||||||
lda #hashmsg
|
lda #hashmsg
|
||||||
jsr puts
|
jsr puts
|
||||||
|
|
||||||
noprint ld2 1,hash_print
|
noprint ld2 1,hash_print Set print flag.
|
||||||
|
|
||||||
|
;
|
||||||
|
; Free memory allocated for ExpandPath output string
|
||||||
|
;
|
||||||
|
lda EPoutputPath
|
||||||
|
ldx EPoutputPath+2
|
||||||
|
jsl free256
|
||||||
|
|
||||||
|
;
|
||||||
|
; Create the hash table from the file list.
|
||||||
|
;
|
||||||
ph4 hash_files
|
ph4 hash_files
|
||||||
jsl dohash
|
jsl dohash
|
||||||
sta hash_table
|
sta hash_table
|
||||||
stx hash_table+2
|
stx hash_table+2
|
||||||
|
|
||||||
lda EPoutputPath
|
unlock hashmutex
|
||||||
ldx EPoutputPath+2
|
|
||||||
jsl free256
|
|
||||||
|
|
||||||
pld
|
pld
|
||||||
tsc
|
tsc
|
||||||
clc
|
clc
|
||||||
|
@ -907,12 +1076,9 @@ noprint ld2 1,hash_print
|
||||||
|
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
; Parameter block for shell call Read_Variable
|
hashmutex key Mutual exclusion key
|
||||||
pathparm anop
|
|
||||||
dc a4'pathvar' Address of name
|
|
||||||
pathvalue ds 4 Address to store result
|
|
||||||
|
|
||||||
pathvar str 'path'
|
pathname gsstr 'path'
|
||||||
|
|
||||||
hashmsg dc c'hashed '
|
hashmsg dc c'hashed '
|
||||||
hashnum dc c'000 files',h'0d00'
|
hashnum dc c'000 files',h'0d00'
|
||||||
|
@ -924,6 +1090,7 @@ EPoutputPath ds 4 ptr to outputPath (Result buffer)
|
||||||
|
|
||||||
eperrstr dc c'rehash: Invalid pathname syntax.',h'0d00'
|
eperrstr dc c'rehash: Invalid pathname syntax.',h'0d00'
|
||||||
toomanyerr dc c'rehash: Too many paths specified.',h'0d00'
|
toomanyerr dc c'rehash: Too many paths specified.',h'0d00'
|
||||||
|
nopatherr dc c'rehash: PATH string is not set.',h'0d00'
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
|
@ -940,23 +1107,24 @@ dispose_hash START
|
||||||
ora2 hash_table,hash_table+2,@a
|
ora2 hash_table,hash_table+2,@a
|
||||||
beq done
|
beq done
|
||||||
|
|
||||||
ldx #32
|
ldx #32 32 different paths, maximum
|
||||||
ldy #0
|
ldy #0 Start looking at the first entry.
|
||||||
loop1 phx
|
|
||||||
phy
|
loop1 phx Save path counter
|
||||||
lda hash_paths+2,y
|
phy and index.
|
||||||
|
lda hash_paths+2,y Put address for this
|
||||||
|
pha path table entry on
|
||||||
|
lda hash_paths,y the stack.
|
||||||
pha
|
pha
|
||||||
lda hash_paths,y
|
lda #0 Zero out the table entry.
|
||||||
pha
|
|
||||||
lda #0
|
|
||||||
sta hash_paths+2,y
|
sta hash_paths+2,y
|
||||||
sta hash_paths,y
|
sta hash_paths,y
|
||||||
jsl nullfree
|
jsl nullfree Free the entry's memory.
|
||||||
next1 ply
|
next1 ply Restore path index
|
||||||
plx
|
plx and counter.
|
||||||
iny4
|
iny4 Bump pointer to next address.
|
||||||
dex
|
dex If more paths to process,
|
||||||
bne loop1
|
bne loop1 stay in the loop.
|
||||||
|
|
||||||
ph4 hash_files
|
ph4 hash_files
|
||||||
jsl free_files
|
jsl free_files
|
||||||
|
@ -980,12 +1148,12 @@ done rts
|
||||||
|
|
||||||
hashdata DATA
|
hashdata DATA
|
||||||
|
|
||||||
t_size ds 2
|
t_size ds 2 t_size = (TAB_MULT * numexe) - 1
|
||||||
|
|
||||||
hash_paths dc 32i4'0' ;32 paths max for now.
|
hash_paths dc 32i4'0' 32 paths max for now.
|
||||||
hash_files dc i4'0'
|
hash_files dc i4'0'
|
||||||
hash_table dc i4'0'
|
hash_table dc i4'0' Pointer to table (t_size entries)
|
||||||
hash_numexe dc i2'0'
|
hash_numexe dc i2'0' Number of hashed executables
|
||||||
hash_print dc i2'0'
|
hash_print dc i2'0' Print flag; 0 first time through
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
|
@ -6,12 +6,13 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: history.asm,v 1.3 1998/06/30 17:25:37 tribby Exp $
|
* $Id: history.asm,v 1.4 1998/07/20 16:23:07 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
* HISTORY.ASM
|
* HISTORY.ASM
|
||||||
* By Tim Meekins
|
* By Tim Meekins
|
||||||
|
* Modified by Dave Tribby for GNO 2.0.6
|
||||||
*
|
*
|
||||||
* Routines for dealing with history buffers.
|
* Routines for dealing with history buffers.
|
||||||
*
|
*
|
||||||
|
@ -71,7 +72,8 @@ InsertHistory START
|
||||||
ptr2 equ 0
|
ptr2 equ 0
|
||||||
ptr equ ptr2+4
|
ptr equ ptr2+4
|
||||||
len equ ptr+4
|
len equ ptr+4
|
||||||
space equ len+2
|
histvalptr equ len+2
|
||||||
|
space equ histvalptr+4
|
||||||
|
|
||||||
subroutine (4:cmd),space
|
subroutine (4:cmd),space
|
||||||
|
|
||||||
|
@ -112,11 +114,33 @@ space equ len+2
|
||||||
;
|
;
|
||||||
putdone anop
|
putdone anop
|
||||||
|
|
||||||
Read_Variable RVParm
|
;
|
||||||
lda buffer
|
; Get value of $HISTORY environment variable
|
||||||
and #$FF
|
;
|
||||||
beq alldone
|
ph4 #historyStr
|
||||||
Dec2Int (#buffer+1,@a,#0),@a
|
jsl getenv
|
||||||
|
sta histvalptr Save pointer to GS/OS result buffer.
|
||||||
|
stx histvalptr+2
|
||||||
|
ora histvalptr+2 If buffer wasn't allocated,
|
||||||
|
jeq goback all done.
|
||||||
|
;
|
||||||
|
; Call Dec2Int to convert value of string into an integer
|
||||||
|
;
|
||||||
|
pha Reserve room on stack for result.
|
||||||
|
lda histvalptr Get pointer to $HISTORY value.
|
||||||
|
ldx histvalptr+2
|
||||||
|
clc Add 4 to address to skip
|
||||||
|
adc #4 over length words.
|
||||||
|
bcc pushaddr
|
||||||
|
inx
|
||||||
|
pushaddr phx Push address onto stack.
|
||||||
|
pha
|
||||||
|
ldy #2
|
||||||
|
lda [histvalptr],y
|
||||||
|
pha Push length.
|
||||||
|
pea 0 Push signedFlag = 0 (unsigned)
|
||||||
|
Tool $280b Dec2Int.
|
||||||
|
pla Get result.
|
||||||
sta size
|
sta size
|
||||||
beq alldone
|
beq alldone
|
||||||
;
|
;
|
||||||
|
@ -165,10 +189,11 @@ dispose lda ptr2
|
||||||
ldy #histNext+2
|
ldy #histNext+2
|
||||||
bra dispose
|
bra dispose
|
||||||
|
|
||||||
alldone return
|
alldone pei (histvalptr+2)
|
||||||
|
pei (histvalptr)
|
||||||
|
jsl nullfree
|
||||||
|
|
||||||
RVParm dc a4'historyStr'
|
goback return
|
||||||
dc a4'buffer'
|
|
||||||
|
|
||||||
size ds 2
|
size ds 2
|
||||||
|
|
||||||
|
@ -339,6 +364,11 @@ SaveHistory START
|
||||||
using HistoryData
|
using HistoryData
|
||||||
using global
|
using global
|
||||||
|
|
||||||
|
svhisvalptr equ 0
|
||||||
|
space equ svhisvalptr+4
|
||||||
|
|
||||||
|
subroutine ,space
|
||||||
|
|
||||||
lda historyFN
|
lda historyFN
|
||||||
sta DestroyParm+2
|
sta DestroyParm+2
|
||||||
sta CreateParm+2
|
sta CreateParm+2
|
||||||
|
@ -347,14 +377,35 @@ SaveHistory START
|
||||||
sta DestroyParm+4
|
sta DestroyParm+4
|
||||||
sta CreateParm+4
|
sta CreateParm+4
|
||||||
sta OpenParm+6
|
sta OpenParm+6
|
||||||
|
;
|
||||||
Read_Variable RVParm
|
; Get value of $SAVEHISTORY environment variable
|
||||||
lda buffer
|
;
|
||||||
and #$FF
|
ph4 #savehistStr
|
||||||
jeq done
|
jsl getenv
|
||||||
Dec2Int (#buffer+1,@a,#0),size
|
sta svhisvalptr Save pointer to GS/OS result buffer.
|
||||||
lda size
|
stx svhisvalptr+2
|
||||||
jeq done
|
ora svhisvalptr+2 If buffer wasn't allocated,
|
||||||
|
jeq goback all done.
|
||||||
|
;
|
||||||
|
; Call Dec2Int to convert value of string into an integer
|
||||||
|
;
|
||||||
|
pha Reserve room on stack for result.
|
||||||
|
lda svhisvalptr Get pointer to $HISTORY value.
|
||||||
|
ldx svhisvalptr+2
|
||||||
|
clc Add 4 to address to skip
|
||||||
|
adc #4 over length words.
|
||||||
|
bcc pushaddr
|
||||||
|
inx
|
||||||
|
pushaddr phx Push address onto stack.
|
||||||
|
pha
|
||||||
|
ldy #2
|
||||||
|
lda [svhisvalptr],y
|
||||||
|
pha Push length.
|
||||||
|
pea 0 Push signedFlag = 0 (unsigned)
|
||||||
|
Tool $280b Dec2Int
|
||||||
|
pla Get result.
|
||||||
|
sta size
|
||||||
|
jeq done
|
||||||
;
|
;
|
||||||
; Create and write history to file
|
; Create and write history to file
|
||||||
;
|
;
|
||||||
|
@ -400,10 +451,12 @@ next dec size
|
||||||
|
|
||||||
doneclose Close CloseParm
|
doneclose Close CloseParm
|
||||||
|
|
||||||
done rts
|
done pei (svhisvalptr+2) Free $SAVEHISTORY value buffer
|
||||||
|
pei (svhisvalptr)
|
||||||
|
jsl nullfree
|
||||||
|
|
||||||
|
goback return
|
||||||
|
|
||||||
RVParm dc a4'savehistStr'
|
|
||||||
dc a4'buffer'
|
|
||||||
|
|
||||||
DestroyParm dc i2'1'
|
DestroyParm dc i2'1'
|
||||||
dc a4'historyFN'
|
dc a4'historyFN'
|
||||||
|
@ -587,15 +640,15 @@ count ds 2
|
||||||
;
|
;
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
|
|
||||||
HistoryData DATA
|
HistoryData DATA
|
||||||
|
|
||||||
lasthist dc i2'0'
|
lasthist dc i2'0'
|
||||||
numhist dc i2'0'
|
numhist dc i2'0'
|
||||||
currenthist ds 4
|
currenthist ds 4
|
||||||
historyptr dc i4'0'
|
historyptr dc i4'0'
|
||||||
historyStr str 'HISTORY'
|
historyStr gsstr 'HISTORY'
|
||||||
savehistStr str 'SAVEHIST'
|
savehistStr gsstr 'SAVEHIST'
|
||||||
histName dc c'/history',i1'0'
|
histName dc c'/history',i1'0'
|
||||||
historyFN ds 4
|
historyFN ds 4
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: invoke.asm,v 1.4 1998/06/30 17:25:40 tribby Exp $
|
* $Id: invoke.asm,v 1.5 1998/07/20 16:23:07 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
* invoke subroutine (2:argc,4:argv,4:sfile,4:dfile,4:efile,2:app,
|
* invoke subroutine (2:argc,4:argv,4:sfile,4:dfile,4:efile,2:app,
|
||||||
* 2:eapp,2:bg,4:cmd,2:jobflag,2:pipein,2:pipeout,
|
* 2:eapp,2:bg,4:cmd,2:jobflag,2:pipein,2:pipeout,
|
||||||
* 2:pipein2,2:pipeout2,4:pipesem)
|
* 2:pipein2,2:pipeout2,4:pipesem)
|
||||||
* return 2:val
|
* return 2:rtnval
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
|
|
||||||
|
@ -245,13 +245,13 @@ invoke START
|
||||||
p equ 0
|
p equ 0
|
||||||
biflag equ p+4
|
biflag equ p+4
|
||||||
ptr equ biflag+2
|
ptr equ biflag+2
|
||||||
val equ ptr+4
|
rtnval equ ptr+4 Return pid, -1 (error), or 0 (no fork)
|
||||||
dir equ val+2
|
dir equ rtnval+2
|
||||||
space equ dir+4
|
space equ dir+4
|
||||||
|
|
||||||
subroutine (2:argc,4:argv,4:sfile,4:dfile,4:efile,2:app,2:eapp,2:bg,4:cmd,2:jobflag,2:pipein,2:pipeout,2:pipein2,2:pipeout2,4:pipesem),space
|
subroutine (2:argc,4:argv,4:sfile,4:dfile,4:efile,2:app,2:eapp,2:bg,4:cmd,2:jobflag,2:pipein,2:pipeout,2:pipein2,2:pipeout2,4:pipesem),space
|
||||||
|
|
||||||
ld2 -1,val
|
ld2 -1,rtnval
|
||||||
stz biflag ;not a built-in
|
stz biflag ;not a built-in
|
||||||
|
|
||||||
lda argc Get number of arguments.
|
lda argc Get number of arguments.
|
||||||
|
@ -296,7 +296,7 @@ checkfile anop
|
||||||
cmp #-1
|
cmp #-1
|
||||||
jne trybuiltin
|
jne trybuiltin
|
||||||
|
|
||||||
; Command is not listed in the built-in table
|
; Command is not listed in the built-in table. See if it was hashed
|
||||||
|
|
||||||
pei (dir+2)
|
pei (dir+2)
|
||||||
pei (dir)
|
pei (dir)
|
||||||
|
@ -456,7 +456,7 @@ doDir lock cdmutex
|
||||||
mv4 GRecPath,PRecPath
|
mv4 GRecPath,PRecPath
|
||||||
SetPrefix PRec
|
SetPrefix PRec
|
||||||
unlock cdmutex
|
unlock cdmutex
|
||||||
stz val
|
stz rtnval Return value: no fork done.
|
||||||
jmp free
|
jmp free
|
||||||
|
|
||||||
;
|
;
|
||||||
|
@ -556,7 +556,7 @@ noforkbuiltin anop
|
||||||
pei (argv+2)
|
pei (argv+2)
|
||||||
pei (argv)
|
pei (argv)
|
||||||
jsl builtin
|
jsl builtin
|
||||||
stz val
|
stz rtnval Return value: no fork done.
|
||||||
bra done
|
bra done
|
||||||
|
|
||||||
*
|
*
|
||||||
|
@ -575,8 +575,10 @@ notfound pei (ptr+2)
|
||||||
ldx #^err2 Print error message:
|
ldx #^err2 Print error message:
|
||||||
lda #err2 'Command not found.'
|
lda #err2 'Command not found.'
|
||||||
jsr errputs
|
jsr errputs
|
||||||
|
|
||||||
lda pipein
|
lda pipein
|
||||||
beq notfound0
|
beq notfound0
|
||||||
|
|
||||||
ssignal _semaphore
|
ssignal _semaphore
|
||||||
sdelete _semaphore
|
sdelete _semaphore
|
||||||
mv4 pjoblist,p
|
mv4 pjoblist,p
|
||||||
|
@ -603,7 +605,7 @@ skipfrarg pei (cmd+2)
|
||||||
pei (cmd)
|
pei (cmd)
|
||||||
jsl nullfree
|
jsl nullfree
|
||||||
|
|
||||||
return 2:val
|
return 2:rtnval
|
||||||
;
|
;
|
||||||
;
|
;
|
||||||
; stuff to do just before forking
|
; stuff to do just before forking
|
||||||
|
@ -636,7 +638,7 @@ prefork lock mutex
|
||||||
;
|
;
|
||||||
; stuff to do right after forking
|
; stuff to do right after forking
|
||||||
;
|
;
|
||||||
postfork sta val
|
postfork sta rtnval
|
||||||
lda pipein
|
lda pipein
|
||||||
beq postfork2
|
beq postfork2
|
||||||
sta CloseRef
|
sta CloseRef
|
||||||
|
@ -645,7 +647,7 @@ postfork2 lda pipeout
|
||||||
beq postfork3
|
beq postfork3
|
||||||
sta CloseRef
|
sta CloseRef
|
||||||
Close CloseParm
|
Close CloseParm
|
||||||
postfork3 lda val
|
postfork3 lda rtnval
|
||||||
cmp #-1
|
cmp #-1
|
||||||
bne postfork4
|
bne postfork4
|
||||||
ldx #^deadstr Print error message:
|
ldx #^deadstr Print error message:
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: jobs.asm,v 1.3 1998/06/30 17:25:43 tribby Exp $
|
* $Id: jobs.asm,v 1.4 1998/07/20 16:23:07 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -576,44 +576,55 @@ done anop
|
||||||
tcs
|
tcs
|
||||||
|
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
;
|
;
|
||||||
; set status return variable
|
; Set $status return variable
|
||||||
;
|
;
|
||||||
setstatus ENTRY
|
setstatus ENTRY
|
||||||
|
|
||||||
xba
|
xba Isolate status
|
||||||
and #$FF
|
and #$FF byte.
|
||||||
|
|
||||||
cmp #100
|
cmp #10
|
||||||
bcc set1
|
bcs digits2or3 If < 10,
|
||||||
Int2Dec (@a,#valstat1+1,#3,#0)
|
adc #'0' Convert to single digit
|
||||||
lda #valstat1
|
sta valstat_text and store in value string.
|
||||||
ldx #^valstat1
|
ldx #1 Set length of string to 1.
|
||||||
bra set0
|
stx valstat
|
||||||
|
bra set_value
|
||||||
|
|
||||||
set1 cmp #10
|
digits2or3 cmp #100 If parameter number
|
||||||
bcc set2
|
bcs digits3 >= 10 && < 99,
|
||||||
Int2Dec (@a,#valstat2+1,#2,#0)
|
ldx #2 length = 2
|
||||||
lda #valstat2
|
bra setit otherwise
|
||||||
ldx #^valstat2
|
digits3 ldx #3 length = 3
|
||||||
bra set0
|
;
|
||||||
|
; Store length (2 or 3) and convert number to text
|
||||||
set2 Int2Dec (@a,#valstat3+1,#1,#0)
|
;
|
||||||
lda #valstat3
|
setit stx valstat
|
||||||
ldx #^valstat3
|
Int2Dec (@a,#valstat_text,valstat,#0)
|
||||||
|
|
||||||
set0 sta SetParm+4
|
set_value anop
|
||||||
stx SetParm+6
|
SetGS SetPB
|
||||||
Set_Variable SetParm
|
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
SetParm dc a4'name'
|
;
|
||||||
ds 4
|
; Parameter block for shell SetGS calls (p 427 in ORCA/M manual)
|
||||||
name str 'status'
|
;
|
||||||
valstat1 str '000'
|
SetPB anop
|
||||||
valstat2 str '00'
|
dc i2'3' pCount
|
||||||
valstat3 str '0'
|
dc i4'status' Name (pointer to GS/OS string)
|
||||||
|
dc i4'valstat' Value (pointer to GS/OS string)
|
||||||
|
dc i2'0' Export flag
|
||||||
|
|
||||||
|
status gsstr 'status' Name of environment variable
|
||||||
|
|
||||||
|
;
|
||||||
|
; Value of status: GS/OS string with one to three digits
|
||||||
|
;
|
||||||
|
valstat ds 2 Length word
|
||||||
|
valstat_text dc c'000' Text (up to three digits)
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
|
@ -972,7 +983,7 @@ init stz pid
|
||||||
cmp #'-'
|
cmp #'-'
|
||||||
jne getpid
|
jne getpid
|
||||||
|
|
||||||
inc arg
|
incad arg
|
||||||
|
|
||||||
lda [arg]
|
lda [arg]
|
||||||
and #$FF
|
and #$FF
|
||||||
|
@ -1677,7 +1688,7 @@ dojobnum ldy len
|
||||||
dey
|
dey
|
||||||
ldx str+2
|
ldx str+2
|
||||||
lda str
|
lda str
|
||||||
inc a
|
incad @xa
|
||||||
Dec2Int (@xa,@y,#0),pid
|
Dec2Int (@xa,@y,#0),pid
|
||||||
lda pjoblist
|
lda pjoblist
|
||||||
ldx pjoblist+2
|
ldx pjoblist+2
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: orca.asm,v 1.3 1998/06/30 17:25:48 tribby Exp $
|
* $Id: orca.asm,v 1.5 1998/08/03 17:30:22 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -120,9 +120,7 @@ doloop short m Between parameters:
|
||||||
sta [strPtr] character in strPtr.
|
sta [strPtr] character in strPtr.
|
||||||
long m
|
long m
|
||||||
inc sLen Bump string length
|
inc sLen Bump string length
|
||||||
inc strPtr and pointer.
|
incad strPtr and pointer.
|
||||||
bne nodelimit
|
|
||||||
inc strPtr+2
|
|
||||||
|
|
||||||
nodelimit anop
|
nodelimit anop
|
||||||
lda pnum Get parameter number
|
lda pnum Get parameter number
|
||||||
|
@ -229,10 +227,17 @@ doloopend inc pnum pnum++
|
||||||
ph4 #defedit use default value.
|
ph4 #defedit use default value.
|
||||||
bra execit
|
bra execit
|
||||||
|
|
||||||
goteditvar anop
|
goteditvar anop Add 4 to value returned by getenv
|
||||||
pei (editcommand+2)
|
ldx editcommand+2 to get address of text portion.
|
||||||
pei (editcommand)
|
clc
|
||||||
execit ph2 #0 ;tells execute we're called by system
|
lda editcommand
|
||||||
|
adc #4
|
||||||
|
bcc nobump
|
||||||
|
inx
|
||||||
|
nobump anop
|
||||||
|
phx Push address onto stack.
|
||||||
|
pha
|
||||||
|
execit ph2 #0 Tells execute we're called by system
|
||||||
jsl execute
|
jsl execute
|
||||||
sta retval
|
sta retval
|
||||||
|
|
||||||
|
@ -295,12 +300,13 @@ gl_sfile dc i4'0' source file name (GS/OS string)
|
||||||
dc i1'0' max err level found (compile/link)
|
dc i1'0' max err level found (compile/link)
|
||||||
dc i1'0' operations flags (compile/link)
|
dc i1'0' operations flags (compile/link)
|
||||||
dc i1'0' keep flag (compile)
|
dc i1'0' keep flag (compile)
|
||||||
dc i4'0' minus flags (see ASML)
|
dc i4'0' minus flags (see ASML command descr)
|
||||||
dc i4'$08000000' plus flags [+E] (see ASML)
|
dc i4'$08000000' plus flags [+E] (see ASML)
|
||||||
dc i4'0' origin (link)
|
dc i4'0' origin (link)
|
||||||
|
|
||||||
nullparm dc i2'0'
|
nullparm dc i2'0'
|
||||||
|
|
||||||
editorvar dc c'editor',h'00' Name of editor environment variable
|
editorvar gsstr 'editor' Name of editor environment variable
|
||||||
|
|
||||||
defedit dc c'4:editor',h'00' Default value for editor
|
defedit dc c'4:editor',h'00' Default value for editor
|
||||||
END
|
END
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: prompt.asm,v 1.3 1998/06/30 17:25:50 tribby Exp $
|
* $Id: prompt.asm,v 1.4 1998/07/20 16:23:08 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -34,58 +34,64 @@ WritePrompt START
|
||||||
|
|
||||||
|
|
||||||
prompt equ 0
|
prompt equ 0
|
||||||
hour equ prompt+4
|
promptgsbuf equ prompt+4
|
||||||
minute equ hour+2
|
usergsbuf equ promptgsbuf+4
|
||||||
offset equ minute+2
|
hour equ usergsbuf+4
|
||||||
|
minute equ hour+2
|
||||||
|
offset equ minute+2
|
||||||
pfx equ offset+2
|
pfx equ offset+2
|
||||||
space equ pfx+4
|
space equ pfx+4
|
||||||
|
|
||||||
year equ hour
|
year equ hour
|
||||||
monday equ minute
|
monday equ minute
|
||||||
precmd equ prompt
|
precmd equ prompt
|
||||||
|
|
||||||
subroutine (0:dummy),space
|
subroutine (0:dummy),space
|
||||||
|
|
||||||
ph4 #precmdstr
|
ph4 #precmdstr If "precmd" alias is defined,
|
||||||
jsl findalias
|
jsl findalias
|
||||||
sta precmd
|
sta precmd
|
||||||
stx precmd+2
|
stx precmd+2
|
||||||
ora precmd+2
|
ora precmd+2
|
||||||
beq getvar
|
beq getvar
|
||||||
|
|
||||||
pei (precmd+2)
|
pei (precmd+2) execute it before parsing prompt.
|
||||||
pei (precmd)
|
pei (precmd)
|
||||||
ph2 #0
|
ph2 #0
|
||||||
jsl execute
|
jsl execute
|
||||||
|
|
||||||
getvar Read_Variable promptparm
|
;
|
||||||
|
; Get value of $PROMPT environment variable
|
||||||
|
;
|
||||||
|
getvar ph4 #promptname
|
||||||
|
jsl getenv
|
||||||
|
|
||||||
php
|
php
|
||||||
sei ;interrupt free environment
|
sei ;interrupt free environment
|
||||||
|
|
||||||
lda promptbuf
|
sta promptgsbuf Save pointer to GS/OS result buffer.
|
||||||
and #$FF
|
stx promptgsbuf+2 If there is no memory to hold it,
|
||||||
bne parseprompt
|
ora promptgsbuf+2 it's undefined, or it has a
|
||||||
|
bne parseprompt length of 0,
|
||||||
ldx #^dfltPrompt
|
ldx #^dfltPrompt
|
||||||
lda #dfltPrompt
|
lda #dfltPrompt
|
||||||
jsr puts
|
jsr puts print the default prompt
|
||||||
|
bra donemark2 and exit.
|
||||||
bra donemark2
|
|
||||||
|
|
||||||
precmdstr dc c'precmd',h'00'
|
|
||||||
|
|
||||||
|
;
|
||||||
|
; Prompt string begins in result buffer after the two length words
|
||||||
|
;
|
||||||
parseprompt anop
|
parseprompt anop
|
||||||
|
clc
|
||||||
ph4 #promptbuf
|
lda promptgsbuf
|
||||||
jsr p2cstr
|
adc #4
|
||||||
phx ;for disposal
|
|
||||||
pha
|
|
||||||
stx prompt+2
|
|
||||||
sta prompt
|
sta prompt
|
||||||
|
lda promptgsbuf+2
|
||||||
|
adc #0
|
||||||
|
sta prompt+2
|
||||||
|
|
||||||
promptloop lda [prompt]
|
promptloop lda [prompt]
|
||||||
inc prompt
|
incad prompt
|
||||||
and #$FF
|
and #$FF
|
||||||
beq done
|
beq done
|
||||||
cmp #'%'
|
cmp #'%'
|
||||||
|
@ -99,13 +105,19 @@ _putchar jsr putchar
|
||||||
|
|
||||||
done jsr standend
|
done jsr standend
|
||||||
jsr cursoron
|
jsr cursoron
|
||||||
|
|
||||||
|
donemark2 anop
|
||||||
|
pei (promptgsbuf+2) Free $PROMPT value buffer
|
||||||
|
pei (promptgsbuf)
|
||||||
jsl nullfree
|
jsl nullfree
|
||||||
donemark2 plp
|
|
||||||
|
plp Restore interrupts.
|
||||||
|
|
||||||
jsr flush
|
jsr flush
|
||||||
return
|
return
|
||||||
|
|
||||||
special lda [prompt]
|
special lda [prompt]
|
||||||
inc prompt
|
incad prompt
|
||||||
and #$FF
|
and #$FF
|
||||||
beq done
|
beq done
|
||||||
cmp #'%'
|
cmp #'%'
|
||||||
|
@ -313,11 +325,25 @@ ptilde anop
|
||||||
;
|
;
|
||||||
; Write user name
|
; Write user name
|
||||||
;
|
;
|
||||||
puser Read_Variable userparm
|
puser ph4 #username Get value of $USER
|
||||||
ldx #^buf2
|
jsl getenv
|
||||||
lda #buf2
|
sta usergsbuf If buffer wasn't allocated
|
||||||
jsr putp
|
stx usergsbuf+2
|
||||||
jmp promptloop
|
ora usergsbuf+2
|
||||||
|
beq goploop ignore it.
|
||||||
|
|
||||||
|
clc
|
||||||
|
lda usergsbuf Text begins after
|
||||||
|
adc #4 four bytes of
|
||||||
|
bcc printit length words.
|
||||||
|
inx
|
||||||
|
printit jsr puts
|
||||||
|
|
||||||
|
pei (usergsbuf+2) Free $USER value buffer
|
||||||
|
pei (usergsbuf)
|
||||||
|
jsl nullfree
|
||||||
|
|
||||||
|
goploop jmp promptloop
|
||||||
;
|
;
|
||||||
; Write date as mm/dd/yy
|
; Write date as mm/dd/yy
|
||||||
;
|
;
|
||||||
|
@ -366,7 +392,7 @@ pdate2 ReadTimeHex (@a,year,monday,@a)
|
||||||
; check for \ quote
|
; check for \ quote
|
||||||
;
|
;
|
||||||
quoteit lda [prompt]
|
quoteit lda [prompt]
|
||||||
inc prompt
|
incad prompt
|
||||||
and #$FF
|
and #$FF
|
||||||
jeq done
|
jeq done
|
||||||
cmp #'n'
|
cmp #'n'
|
||||||
|
@ -391,35 +417,40 @@ WriteNum cmp #10
|
||||||
bcs write1
|
bcs write1
|
||||||
adc #'0'
|
adc #'0'
|
||||||
jmp putchar
|
jmp putchar
|
||||||
|
|
||||||
write1 cmp #100
|
write1 cmp #100
|
||||||
bcs write2
|
bcs write2
|
||||||
Int2Dec (@a,#num+2,#2,#0)
|
Int2Dec (@a,#num+2,#2,#0)
|
||||||
ldx #^num+2
|
ldx #^num+2
|
||||||
lda #num+2
|
lda #num+2
|
||||||
jmp puts
|
jmp puts
|
||||||
|
|
||||||
write2 cmp #1000
|
write2 cmp #1000
|
||||||
bcs write3
|
bcs write3
|
||||||
Int2Dec (@a,#num+1,#3,#0)
|
Int2Dec (@a,#num+1,#3,#0)
|
||||||
ldx #^num+1
|
ldx #^num+1
|
||||||
lda #num+1
|
lda #num+1
|
||||||
jmp puts
|
jmp puts
|
||||||
|
|
||||||
write3 Int2Dec (@a,#num,#4,#0)
|
write3 Int2Dec (@a,#num,#4,#0)
|
||||||
ldx #^num
|
ldx #^num
|
||||||
lda #num
|
lda #num
|
||||||
jmp puts
|
jmp puts
|
||||||
|
|
||||||
|
|
||||||
|
; Name of alias to execute before prompt
|
||||||
|
precmdstr dc c'precmd',h'00'
|
||||||
|
|
||||||
|
|
||||||
|
; Parameter block for GetPrefix GS/OS call
|
||||||
GPParm dc i2'2'
|
GPParm dc i2'2'
|
||||||
dc i2'0'
|
dc i2'0'
|
||||||
GPpfx dc a4'0'
|
GPpfx dc a4'0'
|
||||||
promptparm dc a4'promptname'
|
|
||||||
dc a4'promptbuf'
|
promptname gsstr 'prompt'
|
||||||
promptname str 'prompt'
|
username gsstr 'user'
|
||||||
|
|
||||||
dfltPrompt dc c'% ',h'00'
|
dfltPrompt dc c'% ',h'00'
|
||||||
num dc c'0000',h'00'
|
num dc c'0000',h'00'
|
||||||
promptbuf ds 256
|
|
||||||
userparm dc a4'user'
|
|
||||||
dc a4'buf2'
|
|
||||||
user str 'user'
|
|
||||||
buf2 ds 256
|
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: shell.asm,v 1.3 1998/06/30 17:25:52 tribby Exp $
|
* $Id: shell.asm,v 1.4 1998/07/20 16:23:09 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -201,7 +201,7 @@ gnoloop entry
|
||||||
ph2 #0
|
ph2 #0
|
||||||
jsl execute
|
jsl execute
|
||||||
|
|
||||||
lda exitamundo
|
lda exit_requested
|
||||||
bne done1
|
bne done1
|
||||||
jsr newlineX
|
jsr newlineX
|
||||||
stz lastabort
|
stz lastabort
|
||||||
|
@ -217,7 +217,7 @@ done1 ora2 pjoblist,pjoblist+2,@a
|
||||||
lda lastabort
|
lda lastabort
|
||||||
bne donekiller
|
bne donekiller
|
||||||
inc lastabort
|
inc lastabort
|
||||||
stz exitamundo
|
stz exit_requested
|
||||||
ldx #^stopstr Print message:
|
ldx #^stopstr Print message:
|
||||||
lda #stopstr "There are stopped jobs"
|
lda #stopstr "There are stopped jobs"
|
||||||
jsr puts
|
jsr puts
|
||||||
|
@ -227,7 +227,7 @@ done1 ora2 pjoblist,pjoblist+2,@a
|
||||||
donekiller jsl jobkiller
|
donekiller jsl jobkiller
|
||||||
done2 lda FastFlag
|
done2 lda FastFlag
|
||||||
bne fastskip5
|
bne fastskip5
|
||||||
jsr SaveHistory
|
jsl SaveHistory
|
||||||
fastskip5 jsr dispose_hash
|
fastskip5 jsr dispose_hash
|
||||||
|
|
||||||
quit PopVariablesGS NullPB
|
quit PopVariablesGS NullPB
|
||||||
|
@ -303,9 +303,13 @@ gshrcName dc c'/gshrc',h'00'
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
* Append a C string to the value of the $HOME variable. If $HOME is
|
;=========================================================================
|
||||||
* not set, then it appends the C string to the string '@/'. Returns
|
;
|
||||||
* a pointer to a GC string.
|
; Append a C string to the value of the $HOME variable. If $HOME is
|
||||||
|
; not set, then it appends the C string to the string '@/'. Returns
|
||||||
|
; a pointer to a GS/OS input string.
|
||||||
|
;
|
||||||
|
;=========================================================================
|
||||||
|
|
||||||
AppendHome START
|
AppendHome START
|
||||||
outPtr equ 0
|
outPtr equ 0
|
||||||
|
@ -318,9 +322,9 @@ len equ 4
|
||||||
stx outPtr+2 value of $HOME and
|
stx outPtr+2 value of $HOME and
|
||||||
sta outPtr the final result.
|
sta outPtr the final result.
|
||||||
|
|
||||||
pei (str+2)
|
pei (str+2) Get length of
|
||||||
pei (str)
|
pei (str) string to be
|
||||||
jsr cstrlen
|
jsr cstrlen appended.
|
||||||
sta len
|
sta len
|
||||||
|
|
||||||
lda #255 Max len is 255 (leave room
|
lda #255 Max len is 255 (leave room
|
||||||
|
@ -370,10 +374,13 @@ foundSep sta [str] Store separator at end of string.
|
||||||
|
|
||||||
pei (str+2)
|
pei (str+2)
|
||||||
pei (str)
|
pei (str)
|
||||||
pei (outPtr+2)
|
ldx outPtr+2
|
||||||
lda outPtr
|
lda outPtr
|
||||||
clc
|
clc
|
||||||
adc #4
|
adc #4
|
||||||
|
bcc pushptr
|
||||||
|
inx
|
||||||
|
pushptr phx
|
||||||
pha
|
pha
|
||||||
case on
|
case on
|
||||||
jsl strcat
|
jsl strcat
|
||||||
|
@ -384,25 +391,28 @@ foundSep sta [str] Store separator at end of string.
|
||||||
adc #2 get address if GS/OS
|
adc #2 get address if GS/OS
|
||||||
bcc no_ovf input string.
|
bcc no_ovf input string.
|
||||||
inc outPtr+2
|
inc outPtr+2
|
||||||
clc
|
|
||||||
no_ovf sta outPtr
|
no_ovf sta outPtr
|
||||||
|
|
||||||
lda [outPtr] Adjust string length
|
lda [outPtr] Adjust string length
|
||||||
clc to include appended
|
clc to include appended
|
||||||
adc len string (parameter).
|
adc len string (parameter).
|
||||||
sta [outPtr]
|
sta [outPtr]
|
||||||
|
;
|
||||||
|
; NOTE: The returned value points to a GS/OS string, two bytes offset
|
||||||
|
; from the allocated memory for a GS/OS result buffer. When the
|
||||||
|
; memory is deallocated, the address must be adjusted back.
|
||||||
|
;
|
||||||
return 4:outPtr
|
return 4:outPtr
|
||||||
|
|
||||||
atSign dc c'@',i1'0'
|
atSign dc c'@',i1'0'
|
||||||
|
|
||||||
; Parameter block for Shell call ReadVariable (p 423 in ORCA/M reference)
|
; Parameter block for Shell call ReadVariable (p 423 in ORCA/M reference)
|
||||||
rvbl dc i2'3' pCount
|
rvbl dc i2'3' pCount
|
||||||
dc a4'in' address of variable's name
|
dc a4'home' address of variable's name
|
||||||
outPtr1 dc a4'0' pointer to result buffer
|
outPtr1 dc a4'0' pointer to result buffer
|
||||||
dc i2'0' value of 'Export' flag (returned)
|
dc i2'0' value of 'Export' flag (returned)
|
||||||
|
|
||||||
in dosin 'HOME'
|
home gsstr 'HOME'
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
|
@ -420,9 +430,8 @@ GSOSDP ds 2
|
||||||
cmdloc ds 2
|
cmdloc ds 2
|
||||||
cmdlen ds 2
|
cmdlen ds 2
|
||||||
cmdline ds cmdbuflen
|
cmdline ds cmdbuflen
|
||||||
buffer ds 256
|
buffer ds 256
|
||||||
wordlen ds 2
|
wordlen ds 2
|
||||||
wordpbuf ds 1
|
|
||||||
wordbuf ds 256
|
wordbuf ds 256
|
||||||
nummatch ds 2
|
nummatch ds 2
|
||||||
matchbuf ds 512*4
|
matchbuf ds 512*4
|
||||||
|
@ -430,7 +439,7 @@ cmdcontext ds 2
|
||||||
cmddp ds 2
|
cmddp ds 2
|
||||||
gshtty ds 2
|
gshtty ds 2
|
||||||
gshpid ds 2
|
gshpid ds 2
|
||||||
exitamundo dc i'0' ;!=0 if exit
|
exit_requested dc i'0' ;!=0 if exit
|
||||||
signalled dc i'0'
|
signalled dc i'0'
|
||||||
|
|
||||||
FastFlag dc i'0'
|
FastFlag dc i'0'
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: shellutil.asm,v 1.3 1998/06/30 17:25:55 tribby Exp $
|
* $Id: shellutil.asm,v 1.4 1998/07/20 16:23:09 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -213,7 +213,7 @@ end equ p+4
|
||||||
sta cstr
|
sta cstr
|
||||||
stx cstr+2
|
stx cstr+2
|
||||||
lda [p]
|
lda [p]
|
||||||
inc p
|
incad p
|
||||||
and #$FF
|
and #$FF
|
||||||
tax
|
tax
|
||||||
|
|
||||||
|
@ -491,8 +491,8 @@ end equ cstr+4
|
||||||
jsl ~NEW
|
jsl ~NEW
|
||||||
sta gstr
|
sta gstr
|
||||||
stx gstr+2
|
stx gstr+2
|
||||||
inc a
|
incad @xa
|
||||||
inc a
|
incad @xa
|
||||||
pei (cstr+2)
|
pei (cstr+2)
|
||||||
pei (cstr)
|
pei (cstr)
|
||||||
phx
|
phx
|
||||||
|
@ -566,7 +566,7 @@ copy2 lda [q]
|
||||||
sta [new],y
|
sta [new],y
|
||||||
beq done
|
beq done
|
||||||
iny
|
iny
|
||||||
inc q
|
incad q
|
||||||
bra copy2
|
bra copy2
|
||||||
|
|
||||||
done ldx new+2
|
done ldx new+2
|
||||||
|
@ -592,11 +592,11 @@ done ldx new+2
|
||||||
|
|
||||||
nullfree START
|
nullfree START
|
||||||
|
|
||||||
lda 6,s
|
* lda 6,s DEBUG code: break if
|
||||||
and #$FF80
|
* and #$FF80 address is > $007FFFFF
|
||||||
beq notbad
|
* beq notbad
|
||||||
brk $db
|
* brk $db
|
||||||
notbad anop
|
*notbad anop
|
||||||
|
|
||||||
lda 4,s
|
lda 4,s
|
||||||
ora 6,s
|
ora 6,s
|
||||||
|
@ -648,16 +648,15 @@ newline ENTRY
|
||||||
* library getenv(), but lets stay Orca-free, after all, that's why this
|
* library getenv(), but lets stay Orca-free, after all, that's why this
|
||||||
* is written in assembly! :)
|
* is written in assembly! :)
|
||||||
*
|
*
|
||||||
* Borrowed from termcap
|
* For gsh 2.0: pass in addr of a GS/OS string, and pass back addr of
|
||||||
|
* allocated GS/OS result buffer (with null word added at end), not c-strings.
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
|
|
||||||
getenv START
|
getenv START
|
||||||
|
|
||||||
newval equ 1
|
len equ 1
|
||||||
len equ newval+4
|
retval equ len+2
|
||||||
namebuf equ len+2
|
|
||||||
retval equ namebuf+4
|
|
||||||
space equ retval+4
|
space equ retval+4
|
||||||
var equ space+3
|
var equ space+3
|
||||||
end equ var+4
|
end equ var+4
|
||||||
|
@ -671,109 +670,59 @@ end equ var+4
|
||||||
phd
|
phd
|
||||||
tcd
|
tcd
|
||||||
|
|
||||||
stz retval
|
|
||||||
stz retval+2
|
|
||||||
|
|
||||||
lock mutex
|
lock mutex
|
||||||
;
|
;
|
||||||
; get length of variable name
|
; Get the variable's length using ReadVariableGS
|
||||||
|
; Set up parameter block:
|
||||||
|
mv4 var,RVname Addr of name, from user.
|
||||||
|
ld4 TempResultBuf,RVresult Use temporary result buf.
|
||||||
|
ReadVariableGS ReadVar Get length.
|
||||||
;
|
;
|
||||||
short a
|
; Allocate memory for value string
|
||||||
ldy #0
|
|
||||||
findlen lda [var],y
|
|
||||||
beq gotlen
|
|
||||||
iny
|
|
||||||
bra findlen
|
|
||||||
gotlen long a
|
|
||||||
sty len
|
|
||||||
;
|
;
|
||||||
; allocate a buffer to put the pascal string
|
lda TempRBlen Get length of value.
|
||||||
;
|
bne notnull Return null if 0.
|
||||||
iny
|
sta retval
|
||||||
pea 0
|
sta retval+2
|
||||||
phy
|
bra exit
|
||||||
jsl ~NEW
|
|
||||||
sta namebuf
|
notnull inc2 a Add 4 bytes for result buf len words.
|
||||||
stx namebuf+2
|
inc2 a
|
||||||
sta varparm
|
sta len Save result buf len.
|
||||||
stx varparm+2
|
inc a Add 1 more for terminating null byte.
|
||||||
ora namebuf+2
|
|
||||||
jeq exit
|
|
||||||
;
|
|
||||||
; now make a pascal string from the c string
|
|
||||||
;
|
|
||||||
short ai
|
|
||||||
lda len
|
|
||||||
sta [namebuf]
|
|
||||||
ldy #0
|
|
||||||
copyname lda [var],y
|
|
||||||
beq copydone
|
|
||||||
iny
|
|
||||||
sta [namebuf],y
|
|
||||||
bra copyname
|
|
||||||
copydone long ai
|
|
||||||
;
|
|
||||||
; allocate a return buffer
|
|
||||||
;
|
|
||||||
jsl alloc256
|
|
||||||
sta newval
|
|
||||||
stx newval+2
|
|
||||||
sta varparm+4
|
|
||||||
stx varparm+6
|
|
||||||
ora newval+2
|
|
||||||
jeq exit0
|
|
||||||
;
|
|
||||||
; Let's go read the variable
|
|
||||||
;
|
|
||||||
Read_Variable varparm
|
|
||||||
;
|
|
||||||
; Was it defined?
|
|
||||||
;
|
|
||||||
lda [newval]
|
|
||||||
and #$FF
|
|
||||||
jeq exit1 ;return a null if not defined
|
|
||||||
;
|
|
||||||
; Make a return buffer to return the variable value
|
|
||||||
;
|
|
||||||
inc a
|
|
||||||
pea 0
|
pea 0
|
||||||
pha
|
pha
|
||||||
jsl ~NEW
|
jsl ~NEW Request the memory.
|
||||||
sta retval
|
sta RVresult Store address in ReadVariable
|
||||||
|
stx RVresult+2 parameter block and
|
||||||
|
sta retval direct page pointer.
|
||||||
stx retval+2
|
stx retval+2
|
||||||
ora retval+2
|
ora retval+2 If address == NULL,
|
||||||
jeq exit1
|
beq exit return NULL to user.
|
||||||
;
|
|
||||||
; And copy the resulting value
|
|
||||||
;
|
|
||||||
short ai
|
|
||||||
lda [newval]
|
|
||||||
tay
|
|
||||||
copyval cpy #0
|
|
||||||
beq val1
|
|
||||||
lda [newval],y
|
|
||||||
dey
|
|
||||||
sta [retval],y
|
|
||||||
bra copyval
|
|
||||||
val1 lda [newval]
|
|
||||||
tay
|
|
||||||
lda #0
|
|
||||||
sta [retval],y
|
|
||||||
long ai
|
|
||||||
;
|
|
||||||
; hasta la vista, baby
|
|
||||||
;
|
|
||||||
exit1 ldx newval+2
|
|
||||||
lda newval
|
|
||||||
jsl free256
|
|
||||||
|
|
||||||
exit0 pei (namebuf+2)
|
|
||||||
pei (namebuf)
|
|
||||||
jsl nullfree
|
|
||||||
|
|
||||||
|
lda len Store result buffer length
|
||||||
|
sta [retval] at beginning of buf.
|
||||||
|
;
|
||||||
|
; Read the full value into the allocated memory
|
||||||
|
;
|
||||||
|
ReadVariableGS ReadVar
|
||||||
|
;
|
||||||
|
; Add null byte at end of text to make it work as a C string
|
||||||
|
;
|
||||||
|
ldy TempRBlen Get length of value,
|
||||||
|
iny4 + 4 (for length words at start)
|
||||||
|
lda #0 Store zero at end of string.
|
||||||
|
short a
|
||||||
|
sta [retval],y
|
||||||
|
long a
|
||||||
|
;
|
||||||
|
; All done.
|
||||||
|
;
|
||||||
exit unlock mutex
|
exit unlock mutex
|
||||||
|
|
||||||
ldy retval
|
ldy retval
|
||||||
ldx retval+2
|
ldx retval+2
|
||||||
|
|
||||||
lda space+1
|
lda space+1
|
||||||
sta end-2
|
sta end-2
|
||||||
lda space
|
lda space
|
||||||
|
@ -787,9 +736,20 @@ exit unlock mutex
|
||||||
|
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
varparm ds 8
|
|
||||||
mutex key
|
mutex key
|
||||||
|
|
||||||
|
; Parameter block for shell ReadVariableGS call (p 423 in ORCA/M manual)
|
||||||
|
ReadVar anop
|
||||||
|
dc i2'3' pCount
|
||||||
|
RVname ds 4 Pointer to name (passed by user)
|
||||||
|
RVresult ds 4 GS/OS Output buffer ptr
|
||||||
|
RVexpflag ds 2 export flag
|
||||||
|
|
||||||
|
; GS/OS result buffer for getting the full length of the PATH env var.
|
||||||
|
TempResultBuf dc i2'5' Only five bytes total.
|
||||||
|
TempRBlen ds 2 Value's length returned here.
|
||||||
|
ds 1 Only 1 byte for value.
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
rmemcpy START
|
rmemcpy START
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
176
bin/gsh/sv.asm
176
bin/gsh/sv.asm
|
@ -6,12 +6,13 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: sv.asm,v 1.3 1998/06/30 17:26:02 tribby Exp $
|
* $Id: sv.asm,v 1.4 1998/07/20 16:23:10 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
* SV.ASM
|
* SV.ASM
|
||||||
* By Tim Meekins
|
* By Tim Meekins
|
||||||
|
* Modified by Dave Tribby for GNO 2.0.6
|
||||||
*
|
*
|
||||||
* String Vector routines.
|
* String Vector routines.
|
||||||
*
|
*
|
||||||
|
@ -43,33 +44,31 @@ space equ ptr+4
|
||||||
lda size
|
lda size
|
||||||
inc a ;for size and count
|
inc a ;for size and count
|
||||||
inc a ;at least one null entry
|
inc a ;at least one null entry
|
||||||
asl a
|
asl a Multiply by 4 (bytes/entry).
|
||||||
asl a
|
asl a
|
||||||
pea 0
|
pea 0
|
||||||
pha
|
pha
|
||||||
jsl ~NEW
|
jsl ~NEW Allocate the memory
|
||||||
sta ptr
|
sta ptr and save address in
|
||||||
stx ptr+2
|
stx ptr+2 direct page variable.
|
||||||
|
|
||||||
ldy #2
|
ldy #2 Store number of entries
|
||||||
lda size
|
lda size as the value of the
|
||||||
sta [ptr],y
|
sta [ptr],y first entry's high byte
|
||||||
lda #0
|
lda #0 and zero as the low byte.
|
||||||
sta [ptr]
|
sta [ptr]
|
||||||
ldy #4
|
|
||||||
|
|
||||||
ldx size
|
ldy #4 Set Y to index to 2nd entry.
|
||||||
|
ldx size X = num of entries following.
|
||||||
|
|
||||||
init sta [ptr],y
|
init sta [ptr],y Set all entries
|
||||||
iny
|
iny2 to 0x00000000.
|
||||||
iny
|
|
||||||
sta [ptr],y
|
sta [ptr],y
|
||||||
iny
|
iny2
|
||||||
iny
|
|
||||||
dex
|
dex
|
||||||
bpl init ;not bne so that extra null at end
|
bpl init ;not bne so that extra null at end
|
||||||
|
|
||||||
add4 ptr,#4,ptr
|
add4 ptr,#4,ptr Set ptr to point at second entry.
|
||||||
|
|
||||||
return 4:ptr
|
return 4:ptr
|
||||||
|
|
||||||
|
@ -89,52 +88,54 @@ space equ base+4
|
||||||
|
|
||||||
subroutine (4:vect,4:string,2:allocflag),space
|
subroutine (4:vect,4:string,2:allocflag),space
|
||||||
|
|
||||||
sub4 vect,#4,base
|
sub4 vect,#4,base base points to entry # 0.
|
||||||
|
|
||||||
ldy #2
|
ldy #2
|
||||||
lda [base],y
|
lda [base],y If number of entries in table
|
||||||
cmp [base]
|
cmp [base] == number in use,
|
||||||
beq exit ;ack, the vector is full!
|
beq exit the vector is full!
|
||||||
;
|
;
|
||||||
; 1 = allocate memory, 0 = use string as is...
|
; 1 = allocate memory, 0 = use string as is...
|
||||||
;
|
;
|
||||||
lda allocflag
|
lda allocflag If "allocate memory" flag is set,
|
||||||
beq asis
|
beq asis
|
||||||
|
|
||||||
pei (string+2)
|
pei (string+2) Determine length of
|
||||||
pei (string)
|
pei (string) new string.
|
||||||
jsr cstrlen
|
jsr cstrlen
|
||||||
inc a
|
inc a
|
||||||
pea 0
|
pea 0
|
||||||
pha
|
pha
|
||||||
jsl ~NEW
|
jsl ~NEW Allocate memory for it.
|
||||||
sta p
|
sta p Store address in p/p+1.
|
||||||
stx p+2
|
stx p+2
|
||||||
|
|
||||||
pei (string+2)
|
pei (string+2) Copy the string into
|
||||||
pei (string)
|
pei (string) the new memory.
|
||||||
phx
|
phx
|
||||||
pha
|
pha
|
||||||
jsr copycstr
|
jsr copycstr
|
||||||
bra doit
|
bra doit else
|
||||||
|
|
||||||
asis mv4 string,p
|
asis mv4 string,p Just copy address to p/p+1.
|
||||||
|
|
||||||
|
;
|
||||||
|
; p contains address of string to be added to the vector.
|
||||||
|
;
|
||||||
doit lda [base]
|
doit lda [base]
|
||||||
tax
|
tax X = number of entries in use.
|
||||||
asl a
|
asl a
|
||||||
asl a
|
asl a
|
||||||
tay
|
tay Y = offset to next avail entry.
|
||||||
lda p
|
lda p Set entry to address of added string.
|
||||||
sta [vect],y
|
sta [vect],y
|
||||||
iny
|
iny2
|
||||||
iny
|
|
||||||
lda p+2
|
lda p+2
|
||||||
sta [vect],y
|
sta [vect],y
|
||||||
|
|
||||||
txa
|
txa
|
||||||
inc a
|
inc a
|
||||||
sta [base]
|
sta [base] Bump the number of entries in use.
|
||||||
|
|
||||||
exit return
|
exit return
|
||||||
|
|
||||||
|
@ -153,27 +154,27 @@ space equ p+4
|
||||||
|
|
||||||
subroutine (4:vect),space
|
subroutine (4:vect),space
|
||||||
|
|
||||||
sub4 vect,#4,p
|
sub4 vect,#4,p p points to head of vector
|
||||||
|
|
||||||
loop lda [p]
|
lda [p] Get number of entries in use.
|
||||||
beq done
|
beq done Done if zero.
|
||||||
|
|
||||||
|
loop asl a
|
||||||
asl a
|
asl a
|
||||||
asl a
|
tay Y points to last used entry.
|
||||||
tay
|
|
||||||
lda [vect],y
|
lda [vect],y
|
||||||
tax
|
tax
|
||||||
iny
|
iny2
|
||||||
iny
|
|
||||||
lda [vect],y
|
lda [vect],y
|
||||||
pha
|
pha
|
||||||
phx
|
phx
|
||||||
jsl nullfree
|
jsl nullfree Free memory used by this entry.
|
||||||
lda [p]
|
lda [p]
|
||||||
dec a
|
dec a
|
||||||
sta [p]
|
sta [p] Number used = number used - 1.
|
||||||
bra loop
|
bne loop If more to do, stay in loop.
|
||||||
|
|
||||||
done pei (p+2)
|
done pei (p+2) Free the vector itself.
|
||||||
pei (p)
|
pei (p)
|
||||||
jsl nullfree
|
jsl nullfree
|
||||||
|
|
||||||
|
@ -197,35 +198,32 @@ space equ maxlen+2
|
||||||
|
|
||||||
subroutine (4:sv),space
|
subroutine (4:sv),space
|
||||||
|
|
||||||
sub4 sv,#4,base
|
sub4 sv,#4,base base = ptr to entry 0.
|
||||||
;
|
;
|
||||||
; Find the maximum string length
|
; Find the maximum string length
|
||||||
;
|
;
|
||||||
lda #1
|
lda #1
|
||||||
sta maxlen
|
sta maxlen
|
||||||
|
|
||||||
ldy #0
|
lda #0 Keep track of entry number in Acc.
|
||||||
lda #0
|
|
||||||
lenloop pha
|
lenloop pha
|
||||||
|
asl a
|
||||||
|
asl a
|
||||||
|
tay Y = offset to entry number.
|
||||||
lda [sv],y
|
lda [sv],y
|
||||||
tax
|
tax
|
||||||
iny
|
iny2
|
||||||
iny
|
|
||||||
lda [sv],y
|
lda [sv],y
|
||||||
iny
|
|
||||||
iny
|
|
||||||
phy
|
|
||||||
pha
|
pha
|
||||||
phx
|
phx
|
||||||
jsr cstrlen
|
jsr cstrlen Get length of entry's string.
|
||||||
cmp maxlen
|
cmp maxlen If > maxlen,
|
||||||
bcc nextlen
|
bcc nextlen
|
||||||
sta maxlen
|
sta maxlen set maxlen to this length.
|
||||||
nextlen ply
|
nextlen pla
|
||||||
pla
|
inc a Bump entry number.
|
||||||
inc a
|
cmp [base] If not done,
|
||||||
cmp [base]
|
bcc lenloop stay in loop.
|
||||||
bcc lenloop
|
|
||||||
;
|
;
|
||||||
; add one for a space
|
; add one for a space
|
||||||
;
|
;
|
||||||
|
@ -259,6 +257,7 @@ okcol stx numcol
|
||||||
beq foocol
|
beq foocol
|
||||||
inc numrow
|
inc numrow
|
||||||
foocol anop
|
foocol anop
|
||||||
|
|
||||||
;
|
;
|
||||||
; find the index for each column...
|
; find the index for each column...
|
||||||
;
|
;
|
||||||
|
@ -266,22 +265,20 @@ foocol anop
|
||||||
tax
|
tax
|
||||||
clc
|
clc
|
||||||
mkidxloop sta offtbl,x
|
mkidxloop sta offtbl,x
|
||||||
inx
|
inx2
|
||||||
adc numrow
|
adc numrow
|
||||||
cmp [base]
|
cmp [base]
|
||||||
bcc mkidxloop
|
bcc mkidxloop
|
||||||
;
|
;
|
||||||
; well....I think we can print now (yay!)
|
; well....I think we can print now (yay!)
|
||||||
;
|
;
|
||||||
ldx #0
|
asl numcol Double numcol since it's compared
|
||||||
|
ldx #0 against X to end the loop.
|
||||||
printloop lda offtbl,x
|
printloop lda offtbl,x
|
||||||
and #$FF
|
|
||||||
cmp [base]
|
cmp [base]
|
||||||
bcs nextprint0
|
bcs nextprint0
|
||||||
inc a
|
inc a
|
||||||
short a
|
|
||||||
sta offtbl,x
|
sta offtbl,x
|
||||||
long a
|
|
||||||
phx
|
phx
|
||||||
dec a
|
dec a
|
||||||
asl a
|
asl a
|
||||||
|
@ -289,8 +286,7 @@ printloop lda offtbl,x
|
||||||
tay
|
tay
|
||||||
lda [sv],y
|
lda [sv],y
|
||||||
tax
|
tax
|
||||||
iny
|
iny2
|
||||||
iny
|
|
||||||
lda [sv],y
|
lda [sv],y
|
||||||
pha
|
pha
|
||||||
phx
|
phx
|
||||||
|
@ -307,7 +303,7 @@ tabit cmp maxlen
|
||||||
inc a
|
inc a
|
||||||
bra tabit
|
bra tabit
|
||||||
nextprint plx
|
nextprint plx
|
||||||
inx
|
inx2
|
||||||
cpx numcol
|
cpx numcol
|
||||||
bcc printloop
|
bcc printloop
|
||||||
nextprint0 jsr newline
|
nextprint0 jsr newline
|
||||||
|
@ -317,7 +313,10 @@ nextprint0 jsr newline
|
||||||
|
|
||||||
doneprint return
|
doneprint return
|
||||||
|
|
||||||
offtbl ds 7
|
;
|
||||||
|
; Offset table: one entry for each column
|
||||||
|
;
|
||||||
|
offtbl ds 14
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
|
@ -375,8 +374,7 @@ space equ idx1+2
|
||||||
tay
|
tay
|
||||||
lda [sv],y
|
lda [sv],y
|
||||||
sta ptr1
|
sta ptr1
|
||||||
iny
|
iny2
|
||||||
iny
|
|
||||||
lda [sv],y
|
lda [sv],y
|
||||||
sta ptr1+2
|
sta ptr1+2
|
||||||
add2 left,right,@a
|
add2 left,right,@a
|
||||||
|
@ -388,8 +386,7 @@ space equ idx1+2
|
||||||
sta ptr2
|
sta ptr2
|
||||||
lda ptr1
|
lda ptr1
|
||||||
sta [sv],y
|
sta [sv],y
|
||||||
iny
|
iny2
|
||||||
iny
|
|
||||||
lda [sv],y
|
lda [sv],y
|
||||||
sta ptr2+2
|
sta ptr2+2
|
||||||
lda ptr1+2
|
lda ptr1+2
|
||||||
|
@ -397,8 +394,7 @@ space equ idx1+2
|
||||||
ldy idx1
|
ldy idx1
|
||||||
lda ptr2
|
lda ptr2
|
||||||
sta [sv],y
|
sta [sv],y
|
||||||
iny
|
iny2
|
||||||
iny
|
|
||||||
lda ptr2+2
|
lda ptr2+2
|
||||||
sta [sv],y
|
sta [sv],y
|
||||||
;
|
;
|
||||||
|
@ -412,8 +408,7 @@ space equ idx1+2
|
||||||
tay
|
tay
|
||||||
lda [sv],y
|
lda [sv],y
|
||||||
sta vleft
|
sta vleft
|
||||||
iny
|
iny2
|
||||||
iny
|
|
||||||
lda [sv],y
|
lda [sv],y
|
||||||
sta vleft+2
|
sta vleft+2
|
||||||
;
|
;
|
||||||
|
@ -435,8 +430,7 @@ okloop anop
|
||||||
tay
|
tay
|
||||||
lda [sv],y
|
lda [sv],y
|
||||||
tax
|
tax
|
||||||
iny
|
iny2
|
||||||
iny
|
|
||||||
lda [sv],y
|
lda [sv],y
|
||||||
pha
|
pha
|
||||||
phx
|
phx
|
||||||
|
@ -455,8 +449,7 @@ okloop anop
|
||||||
tay
|
tay
|
||||||
lda [sv],y
|
lda [sv],y
|
||||||
sta ptr1
|
sta ptr1
|
||||||
iny
|
iny2
|
||||||
iny
|
|
||||||
lda [sv],y
|
lda [sv],y
|
||||||
sta ptr1+2
|
sta ptr1+2
|
||||||
lda i
|
lda i
|
||||||
|
@ -467,8 +460,7 @@ okloop anop
|
||||||
sta ptr2
|
sta ptr2
|
||||||
lda ptr1
|
lda ptr1
|
||||||
sta [sv],y
|
sta [sv],y
|
||||||
iny
|
iny2
|
||||||
iny
|
|
||||||
lda [sv],y
|
lda [sv],y
|
||||||
sta ptr2+2
|
sta ptr2+2
|
||||||
lda ptr1+2
|
lda ptr1+2
|
||||||
|
@ -476,8 +468,7 @@ okloop anop
|
||||||
ldy idx1
|
ldy idx1
|
||||||
lda ptr2
|
lda ptr2
|
||||||
sta [sv],y
|
sta [sv],y
|
||||||
iny
|
iny2
|
||||||
iny
|
|
||||||
lda ptr2+2
|
lda ptr2+2
|
||||||
sta [sv],y
|
sta [sv],y
|
||||||
|
|
||||||
|
@ -493,8 +484,7 @@ endloop lda left
|
||||||
tay
|
tay
|
||||||
lda [sv],y
|
lda [sv],y
|
||||||
sta ptr1
|
sta ptr1
|
||||||
iny
|
iny2
|
||||||
iny
|
|
||||||
lda [sv],y
|
lda [sv],y
|
||||||
sta ptr1+2
|
sta ptr1+2
|
||||||
lda last
|
lda last
|
||||||
|
@ -505,8 +495,7 @@ endloop lda left
|
||||||
sta ptr2
|
sta ptr2
|
||||||
lda ptr1
|
lda ptr1
|
||||||
sta [sv],y
|
sta [sv],y
|
||||||
iny
|
iny2
|
||||||
iny
|
|
||||||
lda [sv],y
|
lda [sv],y
|
||||||
sta ptr2+2
|
sta ptr2+2
|
||||||
lda ptr1+2
|
lda ptr1+2
|
||||||
|
@ -514,8 +503,7 @@ endloop lda left
|
||||||
ldy idx1
|
ldy idx1
|
||||||
lda ptr2
|
lda ptr2
|
||||||
sta [sv],y
|
sta [sv],y
|
||||||
iny
|
iny2
|
||||||
iny
|
|
||||||
lda ptr2+2
|
lda ptr2+2
|
||||||
sta [sv],y
|
sta [sv],y
|
||||||
;
|
;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: term.asm,v 1.3 1998/06/30 17:26:04 tribby Exp $
|
* $Id: term.asm,v 1.4 1998/07/20 16:23:11 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -32,7 +32,7 @@ TIOCGETP gequ $40067408
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
* Initialize the system for termcap - checks to see if $TERM exists
|
* Initialize the system for termcap - checks to see if $TERM exists
|
||||||
* and is set, if not, sets to GNOCON
|
* and is set, if not, sets to GNOCON; and allocate termcap buffers.
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
|
|
||||||
|
@ -40,26 +40,55 @@ InitTerm START
|
||||||
|
|
||||||
using termdata
|
using termdata
|
||||||
|
|
||||||
Set_Variable setparm
|
;
|
||||||
Export expparm
|
; See if $TERM exists
|
||||||
|
;
|
||||||
|
ReadVariableGS dummyresult
|
||||||
|
|
||||||
|
lda term_len Get length of $TERM
|
||||||
|
bne allocate If 0,
|
||||||
|
SetGS SetPB set to default ("gnocon")
|
||||||
|
|
||||||
|
allocate anop Allocate termcap buffers.
|
||||||
|
|
||||||
ph4 #1024
|
ph4 #1024
|
||||||
jsl ~NEW
|
jsl ~NEW
|
||||||
sta bp
|
sta bp
|
||||||
stx bp+2
|
stx bp+2
|
||||||
|
|
||||||
ph4 #1024
|
ph4 #1024
|
||||||
jsl ~NEW
|
jsl ~NEW
|
||||||
sta areabuf
|
sta areabuf
|
||||||
stx areabuf+2
|
stx areabuf+2
|
||||||
rts
|
|
||||||
|
|
||||||
setparm dc i4'termname' ;default term type
|
rts Return to caller.
|
||||||
dc i4'termval'
|
|
||||||
|
|
||||||
expparm dc i4'termname'
|
;
|
||||||
dc i2'1'
|
; Parameter block for shell ReadVariableGS call (p 423 in ORCA/M manual)
|
||||||
|
;
|
||||||
|
ReadVarPB anop
|
||||||
|
dc i2'3' pCount
|
||||||
|
dc i4'term' Name (pointer to GS/OS string)
|
||||||
|
dc i4'dummyresult' GS/OS Output buffer ptr
|
||||||
|
ds 2 export flag
|
||||||
|
;
|
||||||
|
; GS/OS result buffer for getting length of TERM env var.
|
||||||
|
;
|
||||||
|
dummyresult dc i2'5' Only five bytes total.
|
||||||
|
term_len ds 2 Value's length returned here.
|
||||||
|
ds 1 Only 1 byte for value.
|
||||||
|
|
||||||
termname str 'term'
|
;
|
||||||
termval str 'gnocon'
|
; Parameter block for shell SetGS calls (p 427 in ORCA/M manual)
|
||||||
|
;
|
||||||
|
SetPB anop
|
||||||
|
dc i2'3' pCount
|
||||||
|
dc i4'term' Name (pointer to GS/OS string)
|
||||||
|
dc i4'gnocon' Value (pointer to GS/OS string)
|
||||||
|
dc i2'1' Export flag
|
||||||
|
|
||||||
|
term gsstr 'term'
|
||||||
|
gnocon gsstr 'gnocon'
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
|
@ -83,31 +112,38 @@ down_history equ 6
|
||||||
|
|
||||||
ph4 #termname
|
ph4 #termname
|
||||||
jsl getenv
|
jsl getenv
|
||||||
phx
|
phx Push allocated buffer on stack
|
||||||
pha
|
pha for later call to nullfree.
|
||||||
|
clc Add 4 to GS/OS result buffer
|
||||||
|
adc #4 to get pointer to text.
|
||||||
|
bcc val_addr_set
|
||||||
|
inx
|
||||||
|
val_addr_set sta hold_term_val
|
||||||
|
stx hold_term_val+2
|
||||||
tgetent (bp,@xa) ;xa is pushed first
|
tgetent (bp,@xa) ;xa is pushed first
|
||||||
beq noentry
|
beq noentry
|
||||||
dec a
|
dec a
|
||||||
beq ok
|
beq ok
|
||||||
|
|
||||||
jsl nullfree
|
jsl nullfree Free buffer allocated by getenv.
|
||||||
stz termok
|
stz termok
|
||||||
ldx #^error1
|
ldx #^error1
|
||||||
lda #error1
|
lda #error1
|
||||||
jmp errputs
|
jmp errputs
|
||||||
|
|
||||||
noentry jsl nullfree
|
noentry anop
|
||||||
stz termok
|
stz termok
|
||||||
ldx #^error2
|
ldx #^error2
|
||||||
lda #error2
|
lda #error2 Print error message:
|
||||||
jsr errputs
|
jsr errputs 'Termcap entry not found for '
|
||||||
ph4 #termname
|
lda hold_term_val Get text from buffer allocated
|
||||||
jsl getenv
|
ldx hold_term_val+2 by getenv
|
||||||
jsr errputs
|
jsr errputs and print it.
|
||||||
|
jsl nullfree Free buffer allocated by getenv.
|
||||||
lda #13
|
lda #13
|
||||||
jmp errputchar
|
jmp errputchar
|
||||||
|
|
||||||
ok jsl nullfree
|
ok jsl nullfree Free buffer allocated by getenv.
|
||||||
lda #1
|
lda #1
|
||||||
sta termok
|
sta termok
|
||||||
mv4 areabuf,area
|
mv4 areabuf,area
|
||||||
|
@ -183,7 +219,7 @@ ok jsl nullfree
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
termname dc c'term',h'00'
|
termname gsstr 'term'
|
||||||
error1 dc c'Error reading termcap file!',h'0d0d00'
|
error1 dc c'Error reading termcap file!',h'0d0d00'
|
||||||
error2 dc c'Termcap entry not found for ',h'00'
|
error2 dc c'Termcap entry not found for ',h'00'
|
||||||
isid dc c'is',h'00'
|
isid dc c'is',h'00'
|
||||||
|
@ -210,6 +246,10 @@ sg_ospeed dc i1'0'
|
||||||
dc i1'0'
|
dc i1'0'
|
||||||
dc i1'0'
|
dc i1'0'
|
||||||
sg_flags dc i2'0'
|
sg_flags dc i2'0'
|
||||||
|
|
||||||
|
; Hold the address of the value of $TERM
|
||||||
|
hold_term_val ds 4
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
|
|
Loading…
Reference in New Issue
Block a user