mirror of
https://github.com/GnoConsortium/gno.git
synced 2024-06-08 20:29:44 +00:00
Added startup protocol as requested by Devin Reed (PR#78) and Steve Reeves
(PR#85, PR#86): For login shells (command line starts with '-'), If $PATH doesn't start with ':' or contain a space, change all ":" to " ". source /etc/glogin source $HOME/glogin $HOME/gshrc is sourced afterward for both login and non-login shells. Don't the print number of hashed commands (from "rehash") until all initialization is completed. Only pass exported environment variables to child processes, and prevent child processes from changing parent's environment. A null command followed by a redirection of stdout, for example > /tmp/list would cause an error message "<garbage> not found" due to incorrect setting of command buffer pointer. Filename completion did not work following ">&" or ">" without a trailing space. Entabbed all the asm files, saving more than 36,000 bytes.
This commit is contained in:
parent
2e0ebb5392
commit
1dc5497309
|
@ -1,6 +1,43 @@
|
||||||
GSH 2.0 UPDATES
|
GSH 2.0 UPDATES
|
||||||
^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Sep 7 98 [dmt] Changes to this point checked-in to master archive.
|
||||||
|
|
||||||
|
Sep 7 98 [dmt] In "gettoken" (cmd.asm), decrement buf (pointer to
|
||||||
|
command line) when EOL is reached; otherwise if the character
|
||||||
|
following the command in the buffer is non-zero, the garbage
|
||||||
|
after the real command will be interpreted as another command.
|
||||||
|
Test case: "> /tmp/list" would cause "not found" error message.
|
||||||
|
|
||||||
|
Sep 6 98 [dmt] Added startup protocol as requested by Devin Reed
|
||||||
|
(PR#78) and Steve Reeves (PR#85, PR#86):
|
||||||
|
For login shells (command line starts with '-'),
|
||||||
|
If $PATH doesn't start with ':' or contain a space,
|
||||||
|
change all ":" to " ".
|
||||||
|
source /etc/glogin
|
||||||
|
source $HOME/glogin
|
||||||
|
($HOME/gshrc is sourced afterward for both login and non-login).
|
||||||
|
In rehash built-in command, don't the print number of hashed
|
||||||
|
until all initialization is completed.
|
||||||
|
Restored commented-out PushVariablesGS at start of "shell" in
|
||||||
|
shell.asm to keep subshells from changing parent's environment.
|
||||||
|
|
||||||
|
Aug 4 98 [dmt] Fixed defects in wordmatch (edit.asm) related to
|
||||||
|
recognizing commands versus filenames during tab and ctrl-D
|
||||||
|
filename completion. Suppose there is a file "filename" in the
|
||||||
|
current directory and you enter one of the following:
|
||||||
|
command >& filen
|
||||||
|
command >filen
|
||||||
|
and press tab. Instead of getting filename completion, you
|
||||||
|
would get a beep. In the first case, gsh thought the "&"
|
||||||
|
was putting the command in the background and filen was the
|
||||||
|
beginning of a command name rather than a filename. In the
|
||||||
|
second, gsh included the ">" in the filename match pattern.
|
||||||
|
|
||||||
|
Aug 3 98 [dmt] Entabbed all the asm files (saved >36,000 bytes).
|
||||||
|
|
||||||
|
Aug 3 98 [dmt] Changes to this point checked-in to master archive.
|
||||||
|
|
||||||
Aug 2 98 [dmt] Remove alloc256/free256 and associated data. Replace
|
Aug 2 98 [dmt] Remove alloc256/free256 and associated data. Replace
|
||||||
with fixed 64-byte buffer for command filename (hash.asm)
|
with fixed 64-byte buffer for command filename (hash.asm)
|
||||||
and allocation of 261-byte buffer via ~NEW for shell
|
and allocation of 261-byte buffer via ~NEW for shell
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: alias.asm,v 1.5 1998/08/03 17:30:25 tribby Exp $
|
* $Id: alias.asm,v 1.6 1998/09/08 16:53:05 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
*
|
*
|
||||||
* unalias subroutine (4:argv,2:argc)
|
* unalias subroutine (4:argv,2:argc)
|
||||||
* Returns with status=0 in Accumulator
|
* Returns with status=0 in Accumulator
|
||||||
*
|
*
|
||||||
* initalias jsr/rts with no parameters
|
* initalias jsr/rts with no parameters
|
||||||
*
|
*
|
||||||
* expandalias subroutine (4:cmd)
|
* expandalias subroutine (4:cmd)
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
*
|
*
|
||||||
* removealias subroutine (4:aliasname)
|
* removealias subroutine (4:aliasname)
|
||||||
* return
|
* return
|
||||||
*
|
*
|
||||||
* findalias subroutine (4:aliasname),space
|
* findalias subroutine (4:aliasname),space
|
||||||
* return 4:value
|
* return 4:value
|
||||||
*
|
*
|
||||||
|
@ -170,9 +170,9 @@ setalias ldy #4+2 ;put alias name on stack
|
||||||
|
|
||||||
add2 argv,#8,argv
|
add2 argv,#8,argv
|
||||||
|
|
||||||
dec2 argc
|
dec2 argc
|
||||||
|
|
||||||
buildalias lda argc
|
buildalias lda argc
|
||||||
beq setit
|
beq setit
|
||||||
|
|
||||||
pei (arg+2)
|
pei (arg+2)
|
||||||
|
@ -184,7 +184,7 @@ buildalias lda argc
|
||||||
pha
|
pha
|
||||||
lda [argv]
|
lda [argv]
|
||||||
pha
|
pha
|
||||||
jsr catcstr
|
jsr catcstr
|
||||||
stx arg+2
|
stx arg+2
|
||||||
sta arg
|
sta arg
|
||||||
jsl nullfree
|
jsl nullfree
|
||||||
|
@ -194,7 +194,7 @@ buildalias lda argc
|
||||||
pei (arg+2)
|
pei (arg+2)
|
||||||
pei (arg)
|
pei (arg)
|
||||||
ph4 #spacestr
|
ph4 #spacestr
|
||||||
jsr catcstr
|
jsr catcstr
|
||||||
stx arg+2
|
stx arg+2
|
||||||
sta arg
|
sta arg
|
||||||
jsl nullfree
|
jsl nullfree
|
||||||
|
@ -285,7 +285,7 @@ done lda space
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
|
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
Usage dc c'Usage: unalias name ...',h'0d00'
|
Usage dc c'Usage: unalias name ...',h'0d00'
|
||||||
|
|
||||||
|
@ -315,7 +315,7 @@ yahaha sta AliasTable,x
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
;
|
;
|
||||||
|
@ -324,7 +324,7 @@ yahaha sta AliasTable,x
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
|
|
||||||
expandalias START
|
expandalias START
|
||||||
|
|
||||||
outbuf equ 0
|
outbuf equ 0
|
||||||
sub equ outbuf+4
|
sub equ outbuf+4
|
||||||
word equ sub+4
|
word equ sub+4
|
||||||
|
@ -343,7 +343,8 @@ space equ buf+4
|
||||||
stx word+2
|
stx word+2
|
||||||
sta word
|
sta word
|
||||||
lda #0
|
lda #0
|
||||||
sta [buf] ;In case we're called with empty string
|
sta [buf] In case we're called with empty string
|
||||||
|
sta [word]
|
||||||
;
|
;
|
||||||
; eat leading spaces
|
; eat leading spaces
|
||||||
;
|
;
|
||||||
|
@ -427,7 +428,7 @@ next lda [cmd]
|
||||||
if2 @a,eq,#';',nextalias
|
if2 @a,eq,#';',nextalias
|
||||||
if2 @a,eq,#'&',nextalias
|
if2 @a,eq,#'&',nextalias
|
||||||
if2 @a,eq,#'|',nextalias
|
if2 @a,eq,#'|',nextalias
|
||||||
if2 @a,eq,#'\',backstabber
|
if2 @a,eq,#'\',backstabber
|
||||||
if2 @a,eq,#"'",singquoter
|
if2 @a,eq,#"'",singquoter
|
||||||
if2 @a,eq,#'"',doubquoter
|
if2 @a,eq,#'"',doubquoter
|
||||||
bra next
|
bra next
|
||||||
|
@ -484,7 +485,7 @@ done ldx word+2
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
|
|
||||||
addalias START
|
addalias START
|
||||||
|
|
||||||
using AliasData
|
using AliasData
|
||||||
|
|
||||||
tmp equ 0
|
tmp equ 0
|
||||||
|
@ -535,7 +536,7 @@ replace ldy #8+2
|
||||||
pha
|
pha
|
||||||
jsl nullfree
|
jsl nullfree
|
||||||
pei (aliasval+2)
|
pei (aliasval+2)
|
||||||
pei (aliasval)
|
pei (aliasval)
|
||||||
jsr cstrlen
|
jsr cstrlen
|
||||||
inc a
|
inc a
|
||||||
pea 0
|
pea 0
|
||||||
|
@ -566,7 +567,7 @@ notfound ph4 #4*3
|
||||||
lda AliasTable+2,x
|
lda AliasTable+2,x
|
||||||
sta [ptr],y
|
sta [ptr],y
|
||||||
pei (aliasname+2)
|
pei (aliasname+2)
|
||||||
pei (aliasname)
|
pei (aliasname)
|
||||||
jsr cstrlen
|
jsr cstrlen
|
||||||
inc a
|
inc a
|
||||||
pea 0
|
pea 0
|
||||||
|
@ -585,7 +586,7 @@ notfound ph4 #4*3
|
||||||
pei (tmp)
|
pei (tmp)
|
||||||
jsr copycstr
|
jsr copycstr
|
||||||
pei (aliasval+2)
|
pei (aliasval+2)
|
||||||
pei (aliasval)
|
pei (aliasval)
|
||||||
jsr cstrlen
|
jsr cstrlen
|
||||||
inc a
|
inc a
|
||||||
pea 0
|
pea 0
|
||||||
|
@ -608,7 +609,7 @@ notfound ph4 #4*3
|
||||||
sta AliasTable,x
|
sta AliasTable,x
|
||||||
lda ptr+2
|
lda ptr+2
|
||||||
sta AliasTable+2,x
|
sta AliasTable+2,x
|
||||||
|
|
||||||
done return
|
done return
|
||||||
|
|
||||||
END
|
END
|
||||||
|
@ -644,8 +645,8 @@ space equ ptr+4
|
||||||
adc #AliasTable
|
adc #AliasTable
|
||||||
sta oldptr
|
sta oldptr
|
||||||
|
|
||||||
searchloop ora2 ptr,ptr+2,@a
|
searchloop ora2 ptr,ptr+2,@a
|
||||||
beq done
|
beq done
|
||||||
|
|
||||||
ldy #4+2
|
ldy #4+2
|
||||||
lda [ptr],y
|
lda [ptr],y
|
||||||
|
@ -688,7 +689,7 @@ foundit ldy #2
|
||||||
pei (ptr+2)
|
pei (ptr+2)
|
||||||
pei (ptr)
|
pei (ptr)
|
||||||
jsl nullfree
|
jsl nullfree
|
||||||
|
|
||||||
done return
|
done return
|
||||||
|
|
||||||
END
|
END
|
||||||
|
@ -721,8 +722,8 @@ space equ value+4
|
||||||
lda AliasTable+2,x
|
lda AliasTable+2,x
|
||||||
sta ptr+2
|
sta ptr+2
|
||||||
|
|
||||||
searchloop ora2 ptr,ptr+2,@a
|
searchloop ora2 ptr,ptr+2,@a
|
||||||
beq done
|
beq done
|
||||||
|
|
||||||
ldy #4+2
|
ldy #4+2
|
||||||
lda [ptr],y
|
lda [ptr],y
|
||||||
|
@ -817,34 +818,34 @@ done return 4:value
|
||||||
;
|
;
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
|
|
||||||
hashalias PRIVATE
|
hashalias PRIVATE
|
||||||
|
|
||||||
hashval equ 0
|
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
|
||||||
|
|
||||||
ldy #0
|
ldy #0
|
||||||
loop asl hashval
|
loop asl hashval
|
||||||
lda [p],y
|
lda [p],y
|
||||||
and #$FF
|
and #$FF
|
||||||
beq done
|
beq done
|
||||||
clc
|
clc
|
||||||
adc hashval
|
adc hashval
|
||||||
sta hashval
|
sta hashval
|
||||||
iny
|
iny
|
||||||
bra loop
|
bra loop
|
||||||
done UDivide (hashval,#VTABSIZE),(@a,@a)
|
done UDivide (hashval,#VTABSIZE),(@a,@a)
|
||||||
|
|
||||||
asl2 a ;Make it an index.
|
asl2 a ;Make it an index.
|
||||||
sta hashval
|
sta hashval
|
||||||
|
|
||||||
return 2:hashval
|
return 2:hashval
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
;
|
;
|
||||||
|
@ -857,6 +858,6 @@ AliasData DATA
|
||||||
AliasNum dc i2'0'
|
AliasNum dc i2'0'
|
||||||
AliasPtr dc i4'0'
|
AliasPtr dc i4'0'
|
||||||
|
|
||||||
AliasTable ds VTABSIZE*4
|
AliasTable ds VTABSIZE*4
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: bufpool.asm,v 1.4 1998/08/03 17:30:26 tribby Exp $
|
* $Id: bufpool.asm,v 1.5 1998/09/08 16:53:05 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
* bufpool data:
|
* bufpool data:
|
||||||
* pool1024 dc i4'0'
|
* pool1024 dc i4'0'
|
||||||
* pool1024mutex key
|
* pool1024mutex key
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
|
|
||||||
mcopy /obj/gno/bin/gsh/bufpool.mac
|
mcopy /obj/gno/bin/gsh/bufpool.mac
|
||||||
|
@ -45,7 +45,7 @@ dummybufpool start ; ends up in .root
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
|
|
||||||
alloc1024 START
|
alloc1024 START
|
||||||
|
|
||||||
using bufpool
|
using bufpool
|
||||||
|
|
||||||
lock pool1024mutex
|
lock pool1024mutex
|
||||||
|
@ -64,7 +64,7 @@ alloc1024 START
|
||||||
lda [1],y
|
lda [1],y
|
||||||
sta pool1024+2
|
sta pool1024+2
|
||||||
unlock pool1024mutex
|
unlock pool1024mutex
|
||||||
pla
|
pla
|
||||||
plx
|
plx
|
||||||
pld
|
pld
|
||||||
rtl
|
rtl
|
||||||
|
@ -119,5 +119,5 @@ bufpool DATA
|
||||||
|
|
||||||
pool1024 dc i4'0'
|
pool1024 dc i4'0'
|
||||||
pool1024mutex key
|
pool1024mutex key
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: builtin.asm,v 1.5 1998/08/03 17:30:26 tribby Exp $
|
* $Id: builtin.asm,v 1.6 1998/09/08 16:53:05 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -25,12 +25,12 @@
|
||||||
*
|
*
|
||||||
* builtin subroutine (2:argc,4:argv)
|
* builtin subroutine (2:argc,4:argv)
|
||||||
* Returns completion status in Accumulator
|
* Returns completion status in Accumulator
|
||||||
*
|
*
|
||||||
* IsBuiltin subroutine (4:name)
|
* IsBuiltin subroutine (4:name)
|
||||||
* return 2:tbl
|
* return 2:tbl
|
||||||
*
|
*
|
||||||
* Remainder are interfaces to builtin commands with interface
|
* Remainder are interfaces to builtin commands with interface
|
||||||
* subroutine (4:argv,2:argc)
|
* subroutine (4:argv,2:argc)
|
||||||
* returns status in accumulator
|
* returns status in accumulator
|
||||||
* cd (chdir is entry as an alternate name)
|
* cd (chdir is entry as an alternate name)
|
||||||
* clear
|
* clear
|
||||||
|
@ -173,7 +173,7 @@ space equ tbl+4
|
||||||
subroutine (4:name),space
|
subroutine (4:name),space
|
||||||
|
|
||||||
ld4 builtintbl,tbl
|
ld4 builtintbl,tbl
|
||||||
builtinloop ldy #2
|
builtinloop ldy #2
|
||||||
lda [tbl]
|
lda [tbl]
|
||||||
ora [tbl],y
|
ora [tbl],y
|
||||||
beq nofile
|
beq nofile
|
||||||
|
@ -193,7 +193,7 @@ foundit ldy #8 Get the fork/nofork flag
|
||||||
bra foundbuiltin
|
bra foundbuiltin
|
||||||
|
|
||||||
nofile lda #-1 Set not-found return value.
|
nofile lda #-1 Set not-found return value.
|
||||||
foundbuiltin sta tbl
|
foundbuiltin sta tbl
|
||||||
|
|
||||||
return 2:tbl
|
return 2:tbl
|
||||||
|
|
||||||
|
@ -211,33 +211,33 @@ BuiltinData DATA
|
||||||
; command. Third value is fork flag (0 to fork, 1 for no fork).
|
; command. Third value is fork flag (0 to fork, 1 for no fork).
|
||||||
; TABLE MUST BE SORTED BY COMMAND NAME.
|
; TABLE MUST BE SORTED BY COMMAND NAME.
|
||||||
;
|
;
|
||||||
builtintbl dc a4'aliasname,alias',i2'0'
|
builtintbl dc a4'aliasname,alias',i2'0'
|
||||||
dc a4'bgname,bg',i2'1'
|
dc a4'bgname,bg',i2'1'
|
||||||
dc a4'bindkeyname,bindkey',i2'0'
|
dc a4'bindkeyname,bindkey',i2'0'
|
||||||
dc a4'cdname,cd',i2'1'
|
dc a4'cdname,cd',i2'1'
|
||||||
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'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'
|
||||||
dc a4'exitname,exit',i2'1'
|
dc a4'exitname,exit',i2'1'
|
||||||
dc a4'exportname,export',i2'1'
|
dc a4'exportname,export',i2'1'
|
||||||
dc a4'fgname,fg',i2'1'
|
dc a4'fgname,fg',i2'1'
|
||||||
dc a4'hashname,hashbi',i2'0'
|
dc a4'hashname,hashbi',i2'0'
|
||||||
dc a4'hname,PrintHistory',i2'0'
|
dc a4'hname,PrintHistory',i2'0'
|
||||||
dc a4'jobsname,jobs',i2'1'
|
dc a4'jobsname,jobs',i2'1'
|
||||||
dc a4'killname,kill',i2'1'
|
dc a4'killname,kill',i2'1'
|
||||||
dc a4'popdname,popd',i2'1'
|
dc a4'popdname,popd',i2'1'
|
||||||
dc a4'pfxname,prefix',i2'1'
|
dc a4'pfxname,prefix',i2'1'
|
||||||
dc a4'psname,psbi',i2'0'
|
dc a4'psname,psbi',i2'0'
|
||||||
dc a4'pushdname,pushd',i2'1'
|
dc a4'pushdname,pushd',i2'1'
|
||||||
dc a4'pwdname,pwd',i2'1'
|
dc a4'pwdname,pwd',i2'1'
|
||||||
dc a4'rehashname,rehash',i2'1'
|
dc a4'rehashname,rehash',i2'1'
|
||||||
dc a4'setname,set',i2'0'
|
dc a4'setname,set',i2'0'
|
||||||
dc a4'setbugname,setdebug',i2'0'
|
dc a4'setbugname,setdebug',i2'0'
|
||||||
dc a4'setenvname,setenv',i2'0'
|
dc a4'setenvname,setenv',i2'0'
|
||||||
dc a4'sourcename,source',i2'1' Changed to unforked
|
dc a4'sourcename,source',i2'1' Changed to unforked
|
||||||
dc a4'stopname,stop',i2'1'
|
dc a4'stopname,stop',i2'1'
|
||||||
dc a4'tsetname,tset',i2'1'
|
dc a4'tsetname,tset',i2'1'
|
||||||
dc a4'unaliasname,unalias',i2'1'
|
dc a4'unaliasname,unalias',i2'1'
|
||||||
|
@ -246,18 +246,18 @@ builtintbl dc a4'aliasname,alias',i2'0'
|
||||||
dc a4'whichname,which',i2'0'
|
dc a4'whichname,which',i2'0'
|
||||||
dc i4'0,0'
|
dc i4'0,0'
|
||||||
|
|
||||||
aliasname dc c'alias',h'00'
|
aliasname dc c'alias',h'00'
|
||||||
bgname dc c'bg',h'00'
|
bgname dc c'bg',h'00'
|
||||||
bindkeyname dc c'bindkey',h'00'
|
bindkeyname dc c'bindkey',h'00'
|
||||||
chdirname dc c'chdir',h'00'
|
chdirname dc c'chdir',h'00'
|
||||||
cdname dc c'cd',h'00'
|
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'
|
||||||
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'
|
||||||
exportname dc c'export',h'00'
|
exportname dc c'export',h'00'
|
||||||
fgname dc c'fg',h'00'
|
fgname dc c'fg',h'00'
|
||||||
hashname dc c'hash',h'00'
|
hashname dc c'hash',h'00'
|
||||||
hname dc c'history',h'00'
|
hname dc c'history',h'00'
|
||||||
|
@ -268,17 +268,17 @@ popdname dc c'popd',h'00'
|
||||||
psname dc c'ps',h'00'
|
psname dc c'ps',h'00'
|
||||||
pushdname dc c'pushd',h'00'
|
pushdname dc c'pushd',h'00'
|
||||||
pwdname dc c'pwd',h'00'
|
pwdname dc c'pwd',h'00'
|
||||||
rehashname dc c'rehash',h'00'
|
rehashname dc c'rehash',h'00'
|
||||||
setbugname dc c'setdebug',h'00'
|
setbugname dc c'setdebug',h'00'
|
||||||
setname dc c'set',h'00'
|
setname dc c'set',h'00'
|
||||||
setenvname dc c'setenv',h'00'
|
setenvname dc c'setenv',h'00'
|
||||||
sourcename dc c'source',h'00'
|
sourcename dc c'source',h'00'
|
||||||
stopname dc c'stop',h'00'
|
stopname dc c'stop',h'00'
|
||||||
tsetname dc c'tset',h'00'
|
tsetname dc c'tset',h'00'
|
||||||
unaliasname dc c'unalias',h'00'
|
unaliasname dc c'unalias',h'00'
|
||||||
unhashname dc c'unhash',h'00'
|
unhashname dc c'unhash',h'00'
|
||||||
unsetname dc c'unset',h'00'
|
unsetname dc c'unset',h'00'
|
||||||
whichname dc c'which',h'00'
|
whichname dc c'which',h'00'
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
|
@ -327,8 +327,8 @@ end equ argv+4
|
||||||
;
|
;
|
||||||
; Illegal parameters: print usage string
|
; Illegal parameters: print usage string
|
||||||
;
|
;
|
||||||
showusage inc status Return status = 1.
|
showusage inc status Return status = 1.
|
||||||
lda [argv]
|
lda [argv]
|
||||||
tax
|
tax
|
||||||
ldy #2
|
ldy #2
|
||||||
lda [argv],y
|
lda [argv],y
|
||||||
|
@ -386,7 +386,7 @@ paramcd anop
|
||||||
if2 @a,ne,#'-',setprefix
|
if2 @a,ne,#'-',setprefix
|
||||||
jmp showusage
|
jmp showusage
|
||||||
|
|
||||||
setprefix pei (dpg+2)
|
setprefix pei (dpg+2)
|
||||||
pei (dpg)
|
pei (dpg)
|
||||||
jsr c2gsstr
|
jsr c2gsstr
|
||||||
sta PRecPath
|
sta PRecPath
|
||||||
|
@ -515,7 +515,7 @@ exit lda space
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
|
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
Usage dc c'Usage: clear',h'0d00'
|
Usage dc c'Usage: clear',h'0d00'
|
||||||
|
|
||||||
|
@ -572,7 +572,7 @@ end equ argv+4
|
||||||
; First argument begins with "-"; only legal value is -n
|
; First argument begins with "-"; only legal value is -n
|
||||||
|
|
||||||
lda [ptr],y Get second
|
lda [ptr],y Get second
|
||||||
and #$FF character.
|
and #$FF character.
|
||||||
if2 @a,eq,#'n',gotn If != 'n', it's a bad one.
|
if2 @a,eq,#'n',gotn If != 'n', it's a bad one.
|
||||||
|
|
||||||
showusage ldx #^Usage Incorrect parameter usage:
|
showusage ldx #^Usage Incorrect parameter usage:
|
||||||
|
@ -608,7 +608,7 @@ putloop lda [ptr] Get first
|
||||||
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.
|
||||||
if2 @a,ne,#'b',esc02 Check for escape codes: "b"
|
if2 @a,ne,#'b',esc02 Check for escape codes: "b"
|
||||||
ldx #1
|
ldx #1
|
||||||
jsr moveleft moveleft
|
jsr moveleft moveleft
|
||||||
bra didit
|
bra didit
|
||||||
|
@ -678,7 +678,7 @@ exit jsr flush Print the buffer.
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
|
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
Usage dc c'Usage: echo [-n] [strings...]',h'0d00'
|
Usage dc c'Usage: echo [-n] [strings...]',h'0d00'
|
||||||
|
|
||||||
|
@ -721,7 +721,7 @@ end equ argv+4
|
||||||
wait lock pwdmutex
|
wait lock pwdmutex
|
||||||
|
|
||||||
pea 0
|
pea 0
|
||||||
jsl getpfxstr Get value of prefix 0.
|
jsl getpfxstr Get value of prefix 0.
|
||||||
sta ptr
|
sta ptr
|
||||||
stx ptr+2
|
stx ptr+2
|
||||||
|
|
||||||
|
@ -757,7 +757,7 @@ exit lda space Deallocate stack space
|
||||||
|
|
||||||
lda #0 Return status always 0.
|
lda #0 Return status always 0.
|
||||||
|
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
pwdmutex key
|
pwdmutex key
|
||||||
|
|
||||||
|
@ -834,7 +834,7 @@ loop add2 argv,#4,argv
|
||||||
;
|
;
|
||||||
; was it a built-in?
|
; was it a built-in?
|
||||||
;
|
;
|
||||||
chkbuiltin pei (file+2)
|
chkbuiltin pei (file+2)
|
||||||
pei (file)
|
pei (file)
|
||||||
jsl IsBuiltin
|
jsl IsBuiltin
|
||||||
cmp #-1
|
cmp #-1
|
||||||
|
@ -846,7 +846,7 @@ foundbuiltin ldx #^builtstr
|
||||||
;
|
;
|
||||||
; See if it was hashed
|
; See if it was hashed
|
||||||
;
|
;
|
||||||
tryhash pei (file+2)
|
tryhash pei (file+2)
|
||||||
pei (file)
|
pei (file)
|
||||||
ph4 hash_table
|
ph4 hash_table
|
||||||
ph4 #hash_paths
|
ph4 #hash_paths
|
||||||
|
@ -885,7 +885,7 @@ showcwd pei (ptr+2)
|
||||||
jsl nullfree
|
jsl nullfree
|
||||||
|
|
||||||
pea 0
|
pea 0
|
||||||
jsl getpfxstr Get value of prefix 0.
|
jsl getpfxstr Get value of prefix 0.
|
||||||
sta ptr
|
sta ptr
|
||||||
stx ptr+2
|
stx ptr+2
|
||||||
|
|
||||||
|
@ -940,7 +940,7 @@ exit lda space
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
|
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
whicherr dc c'Usage: which [file ...]',h'0d00'
|
whicherr dc c'Usage: which [file ...]',h'0d00'
|
||||||
builtstr dc c'Shell Built-in Command',h'00'
|
builtstr dc c'Shell Built-in Command',h'00'
|
||||||
|
@ -952,8 +952,8 @@ pwdmutex key
|
||||||
GRec dc i'4'
|
GRec dc i'4'
|
||||||
GRecPath ds 4
|
GRecPath ds 4
|
||||||
ds 2
|
ds 2
|
||||||
GRecFileType ds 2
|
GRecFileType ds 2
|
||||||
GRecAuxType ds 4
|
GRecAuxType ds 4
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
|
@ -1072,7 +1072,7 @@ showone ldy #1*4+2 Put pointer to
|
||||||
jsr cstrlen Get length of argument.
|
jsr cstrlen Get length of argument.
|
||||||
tax
|
tax
|
||||||
|
|
||||||
Dec2Int (numstr,@x,#0),@a Convert to integer.
|
Dec2Int (numstr,@x,#0),@a Convert to integer.
|
||||||
cmp #32 If prefix num >= 32,
|
cmp #32 If prefix num >= 32,
|
||||||
bcc getpfx
|
bcc getpfx
|
||||||
jsr newline just print blank line.
|
jsr newline just print blank line.
|
||||||
|
@ -1119,7 +1119,7 @@ setprefix ldy #1*4+2 Put pointer to
|
||||||
|
|
||||||
Dec2Int (numstr,@x,#0),PRecNum Convert to integer string.
|
Dec2Int (numstr,@x,#0),PRecNum Convert to integer string.
|
||||||
|
|
||||||
lda PRecNum
|
lda PRecNum
|
||||||
cmp #32 If prefix num >= 32,
|
cmp #32 If prefix num >= 32,
|
||||||
bcs done nothing to do.
|
bcs done nothing to do.
|
||||||
|
|
||||||
|
@ -1145,7 +1145,7 @@ setprefix ldy #1*4+2 Put pointer to
|
||||||
ErrorGS Err
|
ErrorGS Err
|
||||||
bra done
|
bra done
|
||||||
|
|
||||||
ok if2 GRecFT,eq,#$F,ok2 If filetype != $F,
|
ok if2 GRecFT,eq,#$F,ok2 If filetype != $F,
|
||||||
ldx #^direrr print error message
|
ldx #^direrr print error message
|
||||||
lda #direrr 'Not a directory'
|
lda #direrr 'Not a directory'
|
||||||
jsr errputs
|
jsr errputs
|
||||||
|
@ -1175,7 +1175,7 @@ done unlock mutex
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
|
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
mutex key
|
mutex key
|
||||||
|
|
||||||
|
@ -1185,7 +1185,7 @@ usage dc c'Usage: prefix prefixnum prefixname',h'0d00'
|
||||||
bootstr dc c' *: ',h'00'
|
bootstr dc c' *: ',h'00'
|
||||||
pfxstr dc c'00: ',h'00'
|
pfxstr dc c'00: ',h'00'
|
||||||
dirErr dc c'prefix: Not a directory',h'0d00'
|
dirErr dc c'prefix: Not a directory',h'0d00'
|
||||||
|
|
||||||
;
|
;
|
||||||
; Parameter block for GS/OS GetFileInfo call
|
; Parameter block for GS/OS GetFileInfo call
|
||||||
;
|
;
|
||||||
|
@ -1278,7 +1278,7 @@ exit lda space
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
|
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
Usage dc c'Usage: ',h'00'
|
Usage dc c'Usage: ',h'00'
|
||||||
|
|
||||||
|
@ -1373,7 +1373,7 @@ loop lda [argv]
|
||||||
and #$FF
|
and #$FF
|
||||||
if2 @a,eq,#'-',turnoff
|
if2 @a,eq,#'-',turnoff
|
||||||
if2 @a,eq,#'+',turnon
|
if2 @a,eq,#'+',turnon
|
||||||
ldx mode
|
ldx mode
|
||||||
bne showusage
|
bne showusage
|
||||||
ldx argc
|
ldx argc
|
||||||
dex
|
dex
|
||||||
|
@ -1511,7 +1511,7 @@ showusage ldx #^usage
|
||||||
jmp return
|
jmp return
|
||||||
|
|
||||||
ok getuid
|
ok getuid
|
||||||
sta myuid
|
sta myuid
|
||||||
kvm_open
|
kvm_open
|
||||||
sta ps
|
sta ps
|
||||||
stx ps+2
|
stx ps+2
|
||||||
|
@ -1730,7 +1730,7 @@ statetbl dc c'defunct '
|
||||||
dc c'waiting '
|
dc c'waiting '
|
||||||
dc c'paused '
|
dc c'paused '
|
||||||
dc c'unknown '
|
dc c'unknown '
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
|
@ -1870,7 +1870,7 @@ exit return 2:retval
|
||||||
usage dc c'usage: source file [arguments...]',h'0d00'
|
usage dc c'usage: source file [arguments...]',h'0d00'
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
* COMMANDS: builtin command
|
* COMMANDS: builtin command
|
||||||
|
|
1243
bin/gsh/cmd.asm
1243
bin/gsh/cmd.asm
File diff suppressed because it is too large
Load Diff
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: dir.asm,v 1.5 1998/08/03 17:30:27 tribby Exp $
|
* $Id: dir.asm,v 1.6 1998/09/08 16:53:07 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -63,7 +63,7 @@ InitDStack START
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -196,7 +196,7 @@ xgoodie jsl dotods
|
||||||
pla
|
pla
|
||||||
sta dirstack+2,y
|
sta dirstack+2,y
|
||||||
jmp gototop
|
jmp gototop
|
||||||
|
|
||||||
rotate add4 arg,#1,p
|
rotate add4 arg,#1,p
|
||||||
pei (p+2)
|
pei (p+2)
|
||||||
pei (p)
|
pei (p)
|
||||||
|
@ -247,7 +247,7 @@ nextrot pla
|
||||||
bra gototop
|
bra gototop
|
||||||
|
|
||||||
godir jsl dotods
|
godir jsl dotods
|
||||||
pei (arg+2)
|
pei (arg+2)
|
||||||
pei (arg)
|
pei (arg)
|
||||||
jsl gotodir
|
jsl gotodir
|
||||||
bne exit
|
bne exit
|
||||||
|
@ -429,7 +429,7 @@ space equ retval+2
|
||||||
|
|
||||||
stz retval
|
stz retval
|
||||||
|
|
||||||
pei (dir+2)
|
pei (dir+2)
|
||||||
pei (dir)
|
pei (dir)
|
||||||
jsr c2gsstr
|
jsr c2gsstr
|
||||||
sta PRecPath
|
sta PRecPath
|
||||||
|
@ -484,9 +484,9 @@ Err dc i2'1' pCount
|
||||||
ErrError ds 2 Error number
|
ErrError ds 2 Error number
|
||||||
|
|
||||||
dirErr dc c': Not a directory',h'0d00'
|
dirErr dc c': Not a directory',h'0d00'
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
* Display the directory stack
|
* Display the directory stack
|
||||||
|
@ -519,7 +519,7 @@ loop lda flag
|
||||||
pha
|
pha
|
||||||
jsr puts
|
jsr puts
|
||||||
jsl nullfree
|
jsl nullfree
|
||||||
bra next
|
bra next
|
||||||
long ldy idx
|
long ldy idx
|
||||||
lda dirstack+2,y
|
lda dirstack+2,y
|
||||||
tax
|
tax
|
||||||
|
@ -572,7 +572,7 @@ space equ idx+2
|
||||||
setit lock mutex
|
setit lock mutex
|
||||||
|
|
||||||
pea 0
|
pea 0
|
||||||
jsl getpfxstr Get value of prefix 0.
|
jsl getpfxstr Get value of prefix 0.
|
||||||
sta p
|
sta p
|
||||||
stx p+2
|
stx p+2
|
||||||
|
|
||||||
|
@ -602,7 +602,7 @@ ok clc Source is result
|
||||||
phy
|
phy
|
||||||
pei (p+2) Destination is first
|
pei (p+2) Destination is first
|
||||||
pei (p) byte of buffer.
|
pei (p) byte of buffer.
|
||||||
jsr copycstr
|
jsr copycstr
|
||||||
|
|
||||||
ldy idx Store address of string
|
ldy idx Store address of string
|
||||||
lda p in current position
|
lda p in current position
|
||||||
|
@ -638,7 +638,7 @@ tods dc i'0'
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
|
|
||||||
path2tilde START
|
path2tilde START
|
||||||
|
|
||||||
ptr equ 0
|
ptr equ 0
|
||||||
newpath equ ptr+4
|
newpath equ ptr+4
|
||||||
home equ newpath+4
|
home equ newpath+4
|
||||||
|
@ -670,7 +670,7 @@ space equ home+4
|
||||||
beq notfound2 If 0, just copy the rest.
|
beq notfound2 If 0, just copy the rest.
|
||||||
tax Use X to count down HOME chars.
|
tax Use X to count down HOME chars.
|
||||||
ldy #0 path index is based from 0.
|
ldy #0 path index is based from 0.
|
||||||
checkhome lda [path],y
|
checkhome lda [path],y
|
||||||
and #$FF Isolate character in parameter,
|
and #$FF Isolate character in parameter,
|
||||||
beq notfound2 checking for end of string,
|
beq notfound2 checking for end of string,
|
||||||
jsr tolower converting to lower-case
|
jsr tolower converting to lower-case
|
||||||
|
@ -687,14 +687,14 @@ checkhome lda [path],y
|
||||||
bne notfound there is no match.
|
bne notfound there is no match.
|
||||||
pla Pop the parameter character off stack.
|
pla Pop the parameter character off stack.
|
||||||
dex Decrement $home length counter.
|
dex Decrement $home length counter.
|
||||||
bne checkhome If more, stay in loop.
|
bne checkhome If more, stay in loop.
|
||||||
|
|
||||||
;
|
;
|
||||||
; First part of parameter matched $HOME
|
; First part of parameter matched $HOME
|
||||||
;
|
;
|
||||||
cmp #'/' This char = "/"?
|
cmp #'/' This char = "/"?
|
||||||
beq found yes -- it's a match.
|
beq found yes -- it's a match.
|
||||||
lda [path],y If the following character
|
lda [path],y If the following character
|
||||||
and #$FF is zero (end of string),
|
and #$FF is zero (end of string),
|
||||||
beq found
|
beq found
|
||||||
jsr toslash '/', or ':', we have a match.
|
jsr toslash '/', or ':', we have a match.
|
||||||
|
@ -703,13 +703,13 @@ checkhome lda [path],y
|
||||||
found lda #'~' Store '~' as first character
|
found lda #'~' Store '~' as first character
|
||||||
sta [ptr] in result buffer, and bump
|
sta [ptr] in result buffer, and bump
|
||||||
incad ptr result pointer.
|
incad ptr result pointer.
|
||||||
bra copyrest
|
bra copyrest
|
||||||
|
|
||||||
;
|
;
|
||||||
; First part of parameter does not match $HOME
|
; First part of parameter does not match $HOME
|
||||||
;
|
;
|
||||||
notfound pla Get rid of comparison value on stack.
|
notfound pla Get rid of comparison value on stack.
|
||||||
notfound2 ldy #0 Not found: copy from beginning.
|
notfound2 ldy #0 Not found: copy from beginning.
|
||||||
|
|
||||||
;
|
;
|
||||||
; Copy remainder of parameter (Y-reg marks start) to destination string
|
; Copy remainder of parameter (Y-reg marks start) to destination string
|
||||||
|
@ -720,13 +720,13 @@ copyloop lda [path],y
|
||||||
cmp #':'
|
cmp #':'
|
||||||
bne copyput
|
bne copyput
|
||||||
lda #'/'
|
lda #'/'
|
||||||
copyput sta [ptr]
|
copyput sta [ptr]
|
||||||
long a
|
long a
|
||||||
incad ptr
|
incad ptr
|
||||||
short a
|
short a
|
||||||
iny
|
iny
|
||||||
bra copyloop
|
bra copyloop
|
||||||
endcopy sta [ptr]
|
endcopy sta [ptr]
|
||||||
long a
|
long a
|
||||||
dec ptr If final character
|
dec ptr If final character
|
||||||
lda [ptr] was "/",
|
lda [ptr] was "/",
|
||||||
|
@ -753,7 +753,7 @@ homename gsstr 'home' Env variable name
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
|
|
||||||
getpfxstr START
|
getpfxstr START
|
||||||
|
|
||||||
p equ 0
|
p equ 0
|
||||||
space equ p+4
|
space equ p+4
|
||||||
|
|
||||||
|
@ -768,11 +768,11 @@ space equ p+4
|
||||||
beq doboot use GetBootVol, not GetPrefix.
|
beq doboot use GetBootVol, not GetPrefix.
|
||||||
|
|
||||||
sta gpnum Store prefix num in parameter block.
|
sta gpnum Store prefix num in parameter block.
|
||||||
ld4 TempResultBuf,gppath
|
ld4 TempResultBuf,gppath
|
||||||
GetPrefix gpparm
|
GetPrefix gpparm
|
||||||
bra chklen
|
bra chklen
|
||||||
|
|
||||||
doboot ld4 TempResultBuf,gbpath
|
doboot ld4 TempResultBuf,gbpath
|
||||||
GetBootVol gbparm
|
GetBootVol gbparm
|
||||||
|
|
||||||
chklen lda TempRBlen Use that length
|
chklen lda TempRBlen Use that length
|
||||||
|
@ -807,12 +807,12 @@ memok lda TempRBlen Store result buf
|
||||||
cmp #$FFFF whether to use
|
cmp #$FFFF whether to use
|
||||||
beq doboot2 GetPrefix or GetBootVol.
|
beq doboot2 GetPrefix or GetBootVol.
|
||||||
|
|
||||||
mv4 p,gppath
|
mv4 p,gppath
|
||||||
GetPrefix gpparm
|
GetPrefix gpparm
|
||||||
bcs rpterr
|
bcs rpterr
|
||||||
bra done
|
bra done
|
||||||
|
|
||||||
doboot2 mv4 p,gbpath
|
doboot2 mv4 p,gbpath
|
||||||
GetBootVol gbparm
|
GetBootVol gbparm
|
||||||
bcc done If there was an error,
|
bcc done If there was an error,
|
||||||
|
|
||||||
|
|
577
bin/gsh/edit.asm
577
bin/gsh/edit.asm
File diff suppressed because it is too large
Load Diff
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: expand.asm,v 1.5 1998/08/03 17:30:28 tribby Exp $
|
* $Id: expand.asm,v 1.6 1998/09/08 16:53:08 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -34,43 +34,43 @@ dummyexpand start ; ends up in .root
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
|
|
||||||
glob START
|
glob START
|
||||||
|
|
||||||
using vardata
|
using vardata
|
||||||
|
|
||||||
count equ 0
|
count equ 0
|
||||||
gname equ count+2
|
gname equ count+2
|
||||||
sepptr equ gname+4
|
sepptr equ gname+4
|
||||||
eptr equ sepptr+4
|
eptr equ sepptr+4
|
||||||
exppath equ eptr+4
|
exppath equ eptr+4
|
||||||
filesep equ exppath+4
|
filesep equ exppath+4
|
||||||
shallweglob equ filesep+2
|
shallweglob equ filesep+2
|
||||||
wordbuf equ shallweglob+2
|
wordbuf equ shallweglob+2
|
||||||
ptr equ wordbuf+4
|
ptr equ wordbuf+4
|
||||||
buf equ ptr+4
|
buf equ ptr+4
|
||||||
space equ buf+4
|
space equ buf+4
|
||||||
|
|
||||||
subroutine (4:cmd),space
|
subroutine (4:cmd),space
|
||||||
;
|
;
|
||||||
; Check for noglob variable and exit if it's set to something.
|
; Check for noglob variable and exit if it's set to something.
|
||||||
;
|
;
|
||||||
lda varnoglob
|
lda varnoglob
|
||||||
beq doglob
|
beq doglob
|
||||||
|
|
||||||
; Allocate a buffer, copy the command line into it, and return.
|
; Allocate a buffer, copy the command line into it, and return.
|
||||||
jsl alloc1024
|
jsl alloc1024
|
||||||
sta buf
|
sta buf
|
||||||
stx buf+2
|
stx buf+2
|
||||||
pei (cmd+2)
|
pei (cmd+2)
|
||||||
pei (cmd)
|
pei (cmd)
|
||||||
pei (buf+2)
|
pei (buf+2)
|
||||||
pei (buf)
|
pei (buf)
|
||||||
jsr copycstr
|
jsr copycstr
|
||||||
jmp bye
|
jmp bye
|
||||||
;
|
;
|
||||||
; noglob isn't set, so now we can actually start.
|
; noglob isn't set, so now we can actually start.
|
||||||
;
|
;
|
||||||
doglob jsl alloc1024 Create an output buffer.
|
doglob jsl alloc1024 Create an output buffer.
|
||||||
sta buf
|
sta buf
|
||||||
stx buf+2
|
stx buf+2
|
||||||
sta ptr ptr points to next
|
sta ptr ptr points to next
|
||||||
|
@ -83,12 +83,12 @@ doglob jsl alloc1024 Create an output buffer.
|
||||||
;
|
;
|
||||||
; Find the beginning of the next word
|
; Find the beginning of the next word
|
||||||
;
|
;
|
||||||
findword jsr g_getbyte Get character from command line.
|
findword jsr g_getbyte Get character from command line.
|
||||||
jeq alldone
|
jeq alldone
|
||||||
if2 @a,eq,#' ',passthru
|
if2 @a,eq,#' ',passthru
|
||||||
if2 @a,eq,#009,passthru
|
if2 @a,eq,#009,passthru
|
||||||
if2 @a,eq,#013,passthru
|
if2 @a,eq,#013,passthru
|
||||||
if2 @a,eq,#010,passthru
|
if2 @a,eq,#010,passthru
|
||||||
if2 @a,eq,#';',passthru
|
if2 @a,eq,#';',passthru
|
||||||
if2 @a,eq,#'&',passthru
|
if2 @a,eq,#'&',passthru
|
||||||
if2 @a,eq,#'|',passthru
|
if2 @a,eq,#'|',passthru
|
||||||
|
@ -97,98 +97,98 @@ findword jsr g_getbyte Get character from command line.
|
||||||
|
|
||||||
; It's not a simple pass-through character. See what needs to happen.
|
; It's not a simple pass-through character. See what needs to happen.
|
||||||
|
|
||||||
stz shallweglob
|
stz shallweglob
|
||||||
ldy #0
|
ldy #0
|
||||||
bra grabbingword
|
bra grabbingword
|
||||||
|
|
||||||
; For pass-through characters, just copy to output buffer.
|
; For pass-through characters, just copy to output buffer.
|
||||||
|
|
||||||
passthru jsr g_putbyte
|
passthru jsr g_putbyte
|
||||||
bra findword
|
bra findword
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
; single out the next word [y is initialized above]
|
; single out the next word [y is initialized above]
|
||||||
;
|
;
|
||||||
grabword jsr g_getbyte
|
grabword jsr g_getbyte
|
||||||
grabbingword if2 @a,eq,#"'",grabsingle
|
grabbingword if2 @a,eq,#"'",grabsingle
|
||||||
if2 @a,eq,#'"',grabdouble
|
if2 @a,eq,#'"',grabdouble
|
||||||
if2 @a,eq,#'\',grabslash
|
if2 @a,eq,#'\',grabslash
|
||||||
if2 @a,eq,#' ',procword
|
if2 @a,eq,#' ',procword
|
||||||
if2 @a,eq,#009,procword
|
if2 @a,eq,#009,procword
|
||||||
if2 @a,eq,#013,procword
|
if2 @a,eq,#013,procword
|
||||||
if2 @a,eq,#010,procword
|
if2 @a,eq,#010,procword
|
||||||
if2 @a,eq,#000,procword
|
if2 @a,eq,#000,procword
|
||||||
if2 @a,eq,#';',procword
|
if2 @a,eq,#';',procword
|
||||||
if2 @a,eq,#'&',procword
|
if2 @a,eq,#'&',procword
|
||||||
if2 @a,eq,#'|',procword
|
if2 @a,eq,#'|',procword
|
||||||
if2 @a,eq,#'>',procword
|
if2 @a,eq,#'>',procword
|
||||||
if2 @a,eq,#'<',procword
|
if2 @a,eq,#'<',procword
|
||||||
if2 @a,eq,#'[',grabglob
|
if2 @a,eq,#'[',grabglob
|
||||||
if2 @a,eq,#']',grabglob
|
if2 @a,eq,#']',grabglob
|
||||||
if2 @a,eq,#'*',grabglob
|
if2 @a,eq,#'*',grabglob
|
||||||
if2 @a,eq,#'?',grabglob
|
if2 @a,eq,#'?',grabglob
|
||||||
|
|
||||||
; Default action (also completion of some of the other special cases)
|
; Default action (also completion of some of the other special cases)
|
||||||
grabnext sta [wordbuf],y Save character in word buffer
|
grabnext sta [wordbuf],y Save character in word buffer
|
||||||
iny and bump its index.
|
iny and bump its index.
|
||||||
bra grabword Get next character of word.
|
bra grabword Get next character of word.
|
||||||
|
|
||||||
; "[", "]", "*", "?"
|
; "[", "]", "*", "?"
|
||||||
grabglob ldx #1 Set "shallweglob"
|
grabglob ldx #1 Set "shallweglob"
|
||||||
stx shallweglob flag.
|
stx shallweglob flag.
|
||||||
bra grabnext Store char in word buf & get next.
|
bra grabnext Store char in word buf & get next.
|
||||||
|
|
||||||
; "\"
|
; "\"
|
||||||
grabslash sta [wordbuf],y Save "\" in word buffer
|
grabslash sta [wordbuf],y Save "\" in word buffer
|
||||||
iny and bump its index.
|
iny and bump its index.
|
||||||
jsr g_getbyte Get next character in cmd line.
|
jsr g_getbyte Get next character in cmd line.
|
||||||
beq procword If null byte, word is terminated.
|
beq procword If null byte, word is terminated.
|
||||||
bra grabnext Store char in word buf & get next.
|
bra grabnext Store char in word buf & get next.
|
||||||
|
|
||||||
; '"'
|
; '"'
|
||||||
grabsingle sta [wordbuf],y Save char in word buffer
|
grabsingle sta [wordbuf],y Save char in word buffer
|
||||||
iny and bump its index.
|
iny and bump its index.
|
||||||
jsr g_getbyte Get next character in cmd line.
|
jsr g_getbyte Get next character in cmd line.
|
||||||
beq procword If null byte, word is terminated.
|
beq procword If null byte, word is terminated.
|
||||||
if2 @a,eq,#"'",grabnext If "'", store and grab next char.
|
if2 @a,eq,#"'",grabnext If "'", store and grab next char.
|
||||||
bra grabsingle Save new char and stay in this loop.
|
bra grabsingle Save new char and stay in this loop.
|
||||||
|
|
||||||
; "'"
|
; "'"
|
||||||
grabdouble sta [wordbuf],y Save char in word buffer
|
grabdouble sta [wordbuf],y Save char in word buffer
|
||||||
iny and bump its index.
|
iny and bump its index.
|
||||||
jsr g_getbyte Get next character in cmd line.
|
jsr g_getbyte Get next character in cmd line.
|
||||||
beq procword If null byte, word is terminated.
|
beq procword If null byte, word is terminated.
|
||||||
if2 @a,eq,#'"',grabnext If '"', store and grab next char.
|
if2 @a,eq,#'"',grabnext If '"', store and grab next char.
|
||||||
bra grabdouble Save new char and stay in this loop.
|
bra grabdouble Save new char and stay in this loop.
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
; The complete word is in the buffer. Time to process it.
|
; The complete word is in the buffer. Time to process it.
|
||||||
;
|
;
|
||||||
procword dec cmd Decrement cmd line pointer.
|
procword dec cmd Decrement cmd line pointer.
|
||||||
lda #0 Terminate word buffer with
|
lda #0 Terminate word buffer with
|
||||||
sta [wordbuf],y a null byte.
|
sta [wordbuf],y a null byte.
|
||||||
|
|
||||||
;
|
;
|
||||||
; Shall we glob? Shall we scream? What happened, to our postwar dream?
|
; Shall we glob? Shall we scream? What happened, to our postwar dream?
|
||||||
;
|
;
|
||||||
lda [wordbuf]
|
lda [wordbuf]
|
||||||
and #$FF
|
and #$FF
|
||||||
if2 @a,eq,#'-',skipdeglob ;This allows '-?' option.
|
if2 @a,eq,#'-',skipdeglob ;This allows '-?' option.
|
||||||
lda shallweglob
|
lda shallweglob
|
||||||
bne globword
|
bne globword
|
||||||
;
|
;
|
||||||
; we didn't glob this word, so copy the word buffer to the output buffer
|
; we didn't glob this word, so copy the word buffer to the output buffer
|
||||||
;
|
;
|
||||||
skipdeglob ldy #0
|
skipdeglob ldy #0
|
||||||
flushloop lda [wordbuf],y
|
flushloop lda [wordbuf],y
|
||||||
and #$FF
|
and #$FF
|
||||||
beq doneflush
|
beq doneflush
|
||||||
jsr g_putbyte
|
jsr g_putbyte
|
||||||
iny
|
iny
|
||||||
bra flushloop
|
bra flushloop
|
||||||
doneflush jmp findword
|
doneflush jmp findword
|
||||||
|
|
||||||
;
|
;
|
||||||
; Hello, boys and goils, velcome to Tim's Magik Shoppe
|
; Hello, boys and goils, velcome to Tim's Magik Shoppe
|
||||||
|
@ -224,64 +224,64 @@ globword stz filesep
|
||||||
stx eptr+2
|
stx eptr+2
|
||||||
sta sepptr
|
sta sepptr
|
||||||
stx sepptr+2
|
stx sepptr+2
|
||||||
|
|
||||||
ldy #0
|
ldy #0
|
||||||
exploop lda [wordbuf],y
|
exploop lda [wordbuf],y
|
||||||
and #$FF
|
and #$FF
|
||||||
beq endexp
|
beq endexp
|
||||||
iny
|
iny
|
||||||
if2 @a,eq,#'\',expslash
|
if2 @a,eq,#'\',expslash
|
||||||
if2 @a,eq,#"'",expsingle
|
if2 @a,eq,#"'",expsingle
|
||||||
if2 @a,eq,#'"',expdouble
|
if2 @a,eq,#'"',expdouble
|
||||||
if2 @a,eq,#'/',expsep
|
if2 @a,eq,#'/',expsep
|
||||||
if2 @a,eq,#':',expsep
|
if2 @a,eq,#':',expsep
|
||||||
expput sta [eptr]
|
expput sta [eptr]
|
||||||
incad eptr
|
incad eptr
|
||||||
bra exploop
|
bra exploop
|
||||||
expsep sty filesep
|
expsep sty filesep
|
||||||
sta [eptr]
|
sta [eptr]
|
||||||
incad eptr
|
incad eptr
|
||||||
mv4 eptr,sepptr
|
mv4 eptr,sepptr
|
||||||
bra exploop
|
bra exploop
|
||||||
expslash lda [wordbuf],y
|
expslash lda [wordbuf],y
|
||||||
iny
|
iny
|
||||||
and #$FF
|
and #$FF
|
||||||
beq endexp
|
beq endexp
|
||||||
bra expput
|
bra expput
|
||||||
expsingle lda [wordbuf],y
|
expsingle lda [wordbuf],y
|
||||||
iny
|
iny
|
||||||
and #$FF
|
and #$FF
|
||||||
beq endexp
|
beq endexp
|
||||||
if2 @a,eq,#"'",exploop
|
if2 @a,eq,#"'",exploop
|
||||||
sta [eptr]
|
sta [eptr]
|
||||||
incad eptr
|
incad eptr
|
||||||
bra expsingle
|
bra expsingle
|
||||||
expdouble lda [wordbuf],y
|
expdouble lda [wordbuf],y
|
||||||
iny
|
iny
|
||||||
and #$FF
|
and #$FF
|
||||||
beq endexp
|
beq endexp
|
||||||
if2 @a,eq,#'"',exploop
|
if2 @a,eq,#'"',exploop
|
||||||
sta [eptr]
|
sta [eptr]
|
||||||
incad 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..
|
||||||
;
|
;
|
||||||
endexp ldy filesep
|
endexp ldy filesep
|
||||||
copyback lda [wordbuf],y
|
copyback lda [wordbuf],y
|
||||||
iny
|
iny
|
||||||
and #$FF
|
and #$FF
|
||||||
sta [sepptr]
|
sta [sepptr]
|
||||||
incad sepptr
|
incad sepptr
|
||||||
cmp #0
|
cmp #0
|
||||||
bne copyback
|
bne copyback
|
||||||
;
|
;
|
||||||
; Calculate length by subtracting sepptr from starting address
|
; Calculate length by subtracting sepptr from starting address
|
||||||
;
|
;
|
||||||
sub2 sepptr,exppath,@a
|
sub2 sepptr,exppath,@a
|
||||||
dec2 a Don't count length word or \0
|
dec2 a Don't count length word or \0
|
||||||
dec a
|
dec a
|
||||||
sta [exppath]
|
sta [exppath]
|
||||||
;
|
;
|
||||||
; We now have enough to call InitWildCardGS!!!
|
; We now have enough to call InitWildCardGS!!!
|
||||||
; [ let's mutex the rest so we don't have to fix InitWC and NextWC ;-) ]
|
; [ let's mutex the rest so we don't have to fix InitWC and NextWC ;-) ]
|
||||||
|
@ -295,7 +295,7 @@ copyback lda [wordbuf],y
|
||||||
InitWildcardGS initWCparm
|
InitWildcardGS initWCparm
|
||||||
|
|
||||||
ph4 #65 Allocate memory for
|
ph4 #65 Allocate memory for
|
||||||
~NEW expanded name.
|
~NEW expanded name.
|
||||||
sta gname Store in direct
|
sta gname Store in direct
|
||||||
stx gname+2 page pointer
|
stx gname+2 page pointer
|
||||||
sta nWCname and in NextWildcardGS
|
sta nWCname and in NextWildcardGS
|
||||||
|
@ -305,7 +305,7 @@ copyback lda [wordbuf],y
|
||||||
;
|
;
|
||||||
; Call shell routine NextWildcardGS to get the next name that matches.
|
; Call shell routine NextWildcardGS to get the next name that matches.
|
||||||
;
|
;
|
||||||
WCloop NextWildcardGS nWCparm
|
WCloop NextWildcardGS nWCparm
|
||||||
ldy #2
|
ldy #2
|
||||||
lda [gname],y
|
lda [gname],y
|
||||||
beq nomore
|
beq nomore
|
||||||
|
@ -338,28 +338,28 @@ globoutta lda [gname],y Copy next character
|
||||||
;
|
;
|
||||||
; Place blank as separator after name and see if more are expanded.
|
; Place blank as separator after name and see if more are expanded.
|
||||||
;
|
;
|
||||||
lda #' '
|
lda #' '
|
||||||
jsr g_putbyte
|
jsr g_putbyte
|
||||||
bra WCloop
|
bra WCloop
|
||||||
|
|
||||||
;
|
;
|
||||||
; All of the names (if any) from this pattern have been expanded.
|
; All of the names (if any) from this pattern have been expanded.
|
||||||
;
|
;
|
||||||
nomore anop
|
nomore anop
|
||||||
|
|
||||||
unlock glob_mutex
|
unlock glob_mutex
|
||||||
;
|
;
|
||||||
; Deallocate path buffers (we should probably alloc once, not each word... )
|
; Deallocate path buffers (we should probably alloc once, not each word... )
|
||||||
;
|
;
|
||||||
pei (gname+2)
|
pei (gname+2)
|
||||||
pei (gname)
|
pei (gname)
|
||||||
jsl nullfree
|
jsl nullfree
|
||||||
ldx exppath+2
|
ldx exppath+2
|
||||||
lda exppath
|
lda exppath
|
||||||
jsl free1024
|
jsl free1024
|
||||||
|
|
||||||
lda count If somehing was expanded,
|
lda count If somehing was expanded,
|
||||||
jne findword go find the next word.
|
jne findword go find the next word.
|
||||||
|
|
||||||
; Nothing was expanded from the wildcard. If we wanted to act like
|
; Nothing was expanded from the wildcard. If we wanted to act like
|
||||||
; ksh, we could pass the original text by doing a "jmp skipdeglob".
|
; ksh, we could pass the original text by doing a "jmp skipdeglob".
|
||||||
|
@ -378,32 +378,32 @@ nomore anop
|
||||||
lda #ignored
|
lda #ignored
|
||||||
jsr errputs
|
jsr errputs
|
||||||
|
|
||||||
jmp findword Go find the next word.
|
jmp findword Go find the next word.
|
||||||
|
|
||||||
;
|
;
|
||||||
; Goodbye, cruel world, I'm leaving you today, Goodbye, goodbye.
|
; Goodbye, cruel world, I'm leaving you today, Goodbye, goodbye.
|
||||||
;
|
;
|
||||||
alldone jsr g_putbyte
|
alldone jsr g_putbyte
|
||||||
ldx wordbuf+2
|
ldx wordbuf+2
|
||||||
lda wordbuf
|
lda wordbuf
|
||||||
jsl free1024
|
jsl free1024
|
||||||
|
|
||||||
bye return 4:buf
|
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]
|
||||||
incad cmd
|
incad cmd
|
||||||
and #$FF
|
and #$FF
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;
|
;
|
||||||
; Subroutine of glob: put special characters. Same as g_putbyte, but
|
; Subroutine of glob: put special characters. Same as g_putbyte, but
|
||||||
; if it is a special shell character then quote it.
|
; if it is a special shell character then quote it.
|
||||||
;
|
;
|
||||||
g_putspecial and #$7F
|
g_putspecial and #$7F
|
||||||
if2 @a,eq,#' ',special
|
if2 @a,eq,#' ',special
|
||||||
if2 @a,eq,#'.',special
|
if2 @a,eq,#'.',special
|
||||||
if2 @a,eq,#013,special
|
if2 @a,eq,#013,special
|
||||||
|
@ -446,7 +446,7 @@ nWCname 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'
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -454,109 +454,109 @@ ignored dc c' ignored',h'0d00'
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
|
|
||||||
expandvars START
|
expandvars START
|
||||||
|
|
||||||
; Maximum number of characters in an environment variable or $<
|
; Maximum number of characters in an environment variable or $<
|
||||||
MAXVAL equ 512
|
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
|
||||||
space equ dflag+2
|
space equ dflag+2
|
||||||
cmd equ space+3
|
cmd equ space+3
|
||||||
end equ cmd+4
|
end equ cmd+4
|
||||||
|
|
||||||
; subroutine (4:cmd),space
|
; subroutine (4:cmd),space
|
||||||
|
|
||||||
tsc
|
tsc
|
||||||
sec
|
sec
|
||||||
sbc #space-1
|
sbc #space-1
|
||||||
tcs
|
tcs
|
||||||
phd
|
phd
|
||||||
tcd
|
tcd
|
||||||
|
|
||||||
stz dflag Delimiter flag = FALSE.
|
stz dflag Delimiter flag = FALSE.
|
||||||
|
|
||||||
jsl alloc1024
|
jsl alloc1024
|
||||||
sta buf
|
sta buf
|
||||||
sta ptr
|
sta ptr
|
||||||
stx buf+2
|
stx buf+2
|
||||||
stx ptr+2
|
stx ptr+2
|
||||||
|
|
||||||
loop jsr e_getbyte
|
loop jsr e_getbyte
|
||||||
jeq done
|
jeq done
|
||||||
if2 @a,eq,#"'",quote
|
if2 @a,eq,#"'",quote
|
||||||
if2 @a,eq,#'$',expand
|
if2 @a,eq,#'$',expand
|
||||||
if2 @a,eq,#'~',tilde
|
if2 @a,eq,#'~',tilde
|
||||||
if2 @a,eq,#'\',slasher
|
if2 @a,eq,#'\',slasher
|
||||||
jsr e_putbyte
|
jsr e_putbyte
|
||||||
bra loop
|
bra loop
|
||||||
|
|
||||||
slasher jsr e_putbyte
|
slasher jsr e_putbyte
|
||||||
jsr e_getbyte
|
jsr e_getbyte
|
||||||
jsr e_putbyte
|
jsr e_putbyte
|
||||||
bra loop
|
bra loop
|
||||||
|
|
||||||
quote jsr e_putbyte
|
quote jsr e_putbyte
|
||||||
jsr e_getbyte
|
jsr e_getbyte
|
||||||
jeq done
|
jeq done
|
||||||
if2 @a,ne,#"'",quote
|
if2 @a,ne,#"'",quote
|
||||||
jsr e_putbyte
|
jsr e_putbyte
|
||||||
bra loop
|
bra loop
|
||||||
|
|
||||||
;
|
;
|
||||||
; Tilde expansion: use the contents of $home, but make sure the
|
; Tilde expansion: use the contents of $home, but make sure the
|
||||||
; path delimiter(s) match what the user wants (either "/" or ":")
|
; path delimiter(s) match what the user wants (either "/" or ":")
|
||||||
;
|
;
|
||||||
tilde anop
|
tilde anop
|
||||||
lock exp_mutex
|
lock exp_mutex
|
||||||
|
|
||||||
lda #"oh" Strangely enough,
|
lda #"oh" Strangely enough,
|
||||||
sta name this spells "home"!
|
sta name this spells "home"!
|
||||||
lda #"em"
|
lda #"em"
|
||||||
sta name+2
|
sta name+2
|
||||||
sta dflag Delimiter flag = TRUE.
|
sta dflag Delimiter flag = TRUE.
|
||||||
ldx #4
|
ldx #4
|
||||||
jmp getval
|
jmp getval
|
||||||
|
|
||||||
;
|
;
|
||||||
; Expand an environment variable since a '$' was encountered.
|
; Expand an environment variable since a '$' was encountered.
|
||||||
;
|
;
|
||||||
expand anop
|
expand anop
|
||||||
lock exp_mutex
|
lock exp_mutex
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
sta name
|
sta name
|
||||||
lda [cmd]
|
lda [cmd]
|
||||||
and #$FF
|
and #$FF
|
||||||
if2 @a,eq,#'{',braceexpand
|
if2 @a,eq,#'{',braceexpand
|
||||||
if2 @a,eq,#'<',stdinexpand
|
if2 @a,eq,#'<',stdinexpand
|
||||||
ldx #0
|
ldx #0
|
||||||
nameloop lda [cmd]
|
nameloop lda [cmd]
|
||||||
and #$FF
|
and #$FF
|
||||||
beq getval
|
beq getval
|
||||||
if2 @a,cc,#'0',getval
|
if2 @a,cc,#'0',getval
|
||||||
if2 @a,cc,#'9'+1,inname
|
if2 @a,cc,#'9'+1,inname
|
||||||
if2 @a,cc,#'A',getval
|
if2 @a,cc,#'A',getval
|
||||||
if2 @a,cc,#'Z'+1,inname
|
if2 @a,cc,#'Z'+1,inname
|
||||||
if2 @a,eq,#'_',inname
|
if2 @a,eq,#'_',inname
|
||||||
if2 @a,cc,#'a',getval
|
if2 @a,cc,#'a',getval
|
||||||
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
|
cpx #255 Only the first 255 characters
|
||||||
beq nameloop are significant.
|
beq nameloop are significant.
|
||||||
sta name,x
|
sta name,x
|
||||||
inx
|
inx
|
||||||
bra nameloop
|
bra nameloop
|
||||||
|
|
||||||
;
|
;
|
||||||
; expand in braces {}
|
; expand in braces {}
|
||||||
;
|
;
|
||||||
braceexpand jsr e_getbyte
|
braceexpand jsr e_getbyte
|
||||||
ldx #0
|
ldx #0
|
||||||
braceloop lda [cmd]
|
braceloop lda [cmd]
|
||||||
and #$FF
|
and #$FF
|
||||||
beq getval
|
beq getval
|
||||||
jsr e_getbyte
|
jsr e_getbyte
|
||||||
|
@ -570,7 +570,7 @@ braceloop lda [cmd]
|
||||||
;
|
;
|
||||||
; get text from standard input
|
; get text from standard input
|
||||||
;
|
;
|
||||||
stdinexpand jsr e_getbyte
|
stdinexpand jsr e_getbyte
|
||||||
ReadLine (#value,#MAXVAL,#13,#0),@a
|
ReadLine (#value,#MAXVAL,#13,#0),@a
|
||||||
sta valueln
|
sta valueln
|
||||||
bra chklen
|
bra chklen
|
||||||
|
@ -578,15 +578,15 @@ stdinexpand jsr e_getbyte
|
||||||
;
|
;
|
||||||
; Get a value for this variable
|
; Get a value for this variable
|
||||||
;
|
;
|
||||||
getval stx nameln Save length of name.
|
getval stx nameln Save length of name.
|
||||||
ReadVariableGS ReadVarPB Read its value.
|
ReadVariableGS ReadVarPB Read its value.
|
||||||
|
|
||||||
lda valueln Get value length.
|
lda valueln Get value length.
|
||||||
cmp #MAXVAL+1 If > maximum allowed length,
|
cmp #MAXVAL+1 If > maximum allowed length,
|
||||||
bcs expanded we didn't get anything.
|
bcs expanded we didn't get anything.
|
||||||
cmp #0
|
cmp #0
|
||||||
chklen anop
|
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
|
||||||
|
@ -640,34 +640,34 @@ bump_c dex
|
||||||
storeval anop
|
storeval anop
|
||||||
lda valueln Get length.
|
lda valueln Get length.
|
||||||
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,x
|
putval lda value,x
|
||||||
jsr e_putbyte
|
jsr e_putbyte
|
||||||
inx
|
inx
|
||||||
dey
|
dey
|
||||||
bne putval
|
bne putval
|
||||||
|
|
||||||
expanded unlock exp_mutex
|
expanded unlock exp_mutex
|
||||||
stz dflag Delimiter flag = FALSE.
|
stz dflag Delimiter flag = FALSE.
|
||||||
jmp loop
|
jmp loop
|
||||||
|
|
||||||
done jsr e_putbyte
|
done jsr e_putbyte
|
||||||
|
|
||||||
ldx buf+2
|
ldx buf+2
|
||||||
ldy buf
|
ldy buf
|
||||||
|
|
||||||
lda space
|
lda space
|
||||||
sta end-3
|
sta end-3
|
||||||
lda space+1
|
lda space+1
|
||||||
sta end-2
|
sta end-2
|
||||||
pld
|
pld
|
||||||
tsc
|
tsc
|
||||||
clc
|
clc
|
||||||
adc #end-4
|
adc #end-4
|
||||||
tcs
|
tcs
|
||||||
|
|
||||||
tya
|
tya
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
e_getbyte lda [cmd]
|
e_getbyte lda [cmd]
|
||||||
incad cmd
|
incad cmd
|
||||||
|
@ -678,7 +678,7 @@ e_putbyte short a
|
||||||
sta [ptr]
|
sta [ptr]
|
||||||
long a
|
long a
|
||||||
incad ptr
|
incad ptr
|
||||||
rts
|
rts
|
||||||
|
|
||||||
exp_mutex key
|
exp_mutex key
|
||||||
|
|
||||||
|
@ -686,14 +686,14 @@ exp_mutex key
|
||||||
; GS/OS string to hold variable name
|
; GS/OS string to hold variable name
|
||||||
namestr anop
|
namestr anop
|
||||||
nameln ds 2 Length of name
|
nameln ds 2 Length of name
|
||||||
name ds 256 Room for 255 chars + 0.
|
name ds 256 Room for 255 chars + 0.
|
||||||
|
|
||||||
|
|
||||||
; GS/OS result buffer to hold up to MAXVAL bytes of value
|
; GS/OS result buffer to hold up to MAXVAL bytes of value
|
||||||
valueresult anop
|
valueresult anop
|
||||||
dc i2'MAXVAL+4' Length of result buffer
|
dc i2'MAXVAL+4' Length of result buffer
|
||||||
valueln ds 2 Length of value
|
valueln ds 2 Length of value
|
||||||
value ds MAXVAL Room for MAXVAL chars
|
value ds MAXVAL Room for MAXVAL chars
|
||||||
|
|
||||||
|
|
||||||
; Parameter block for shell ReadVariableGS calls
|
; Parameter block for shell ReadVariableGS calls
|
||||||
|
@ -703,4 +703,4 @@ RVname dc a4'namestr' Name (pointer to GS/OS string)
|
||||||
RVvalue dc a4'valueresult' Value (ptr to result buf or string)
|
RVvalue dc a4'valueresult' Value (ptr to result buf or string)
|
||||||
RVexport ds 2 Export flag
|
RVexport ds 2 Export flag
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
|
@ -1970,5 +1970,5 @@ skip&syscnt anop
|
||||||
MACRO
|
MACRO
|
||||||
&lab ~DISPOSE
|
&lab ~DISPOSE
|
||||||
&lab anop
|
&lab anop
|
||||||
jml ~DISPOSE
|
jml ~DISPOSE
|
||||||
MEND
|
MEND
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Resources for version and comment
|
* Resources for version and comment
|
||||||
*
|
*
|
||||||
* $Id: gsh.rez,v 1.4 1998/08/03 17:30:30 tribby Exp $
|
* $Id: gsh.rez,v 1.5 1998/09/08 16:53:09 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 */
|
||||||
3 }, /* non-final release number */
|
4 }, /* non-final release number */
|
||||||
verUS, /* Country */
|
verUS, /* Country */
|
||||||
PROG, /* Program name */
|
PROG, /* Program name */
|
||||||
DESC
|
DESC
|
||||||
|
|
800
bin/gsh/hash.asm
800
bin/gsh/hash.asm
File diff suppressed because it is too large
Load Diff
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: history.asm,v 1.5 1998/08/03 17:30:20 tribby Exp $
|
* $Id: history.asm,v 1.6 1998/09/08 16:53:10 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
* Where historyRec is:
|
* Where historyRec is:
|
||||||
*
|
*
|
||||||
* [+0] NextHistory: pointer to historyRec
|
* [+0] NextHistory: pointer to historyRec
|
||||||
* [+4] HistoryCmd: string of characters
|
* [+4] HistoryCmd: string of characters
|
||||||
*
|
*
|
||||||
* Note: text set up for tabs at col 16, 22, 41, 49, 57, 65
|
* Note: text set up for tabs at col 16, 22, 41, 49, 57, 65
|
||||||
* | | | | | |
|
* | | | | | |
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
*
|
*
|
||||||
* Interfaces defined in this file:
|
* Interfaces defined in this file:
|
||||||
*
|
*
|
||||||
* InsertHistory
|
* InsertHistory
|
||||||
*
|
*
|
||||||
* PrevHistory
|
* PrevHistory
|
||||||
*
|
*
|
||||||
|
@ -55,8 +55,8 @@ dummyhistory start ; ends up in .root
|
||||||
|
|
||||||
setcom 60
|
setcom 60
|
||||||
|
|
||||||
histNext gequ 0
|
histNext gequ 0
|
||||||
histCmd gequ 4
|
histCmd gequ 4
|
||||||
|
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
;
|
;
|
||||||
|
@ -64,10 +64,10 @@ histCmd gequ 4
|
||||||
;
|
;
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
|
|
||||||
InsertHistory START
|
InsertHistory START
|
||||||
|
|
||||||
using HistoryData
|
using HistoryData
|
||||||
using global
|
using global
|
||||||
|
|
||||||
ptr2 equ 0
|
ptr2 equ 0
|
||||||
ptr equ ptr2+4
|
ptr equ ptr2+4
|
||||||
|
@ -80,26 +80,26 @@ space equ histvalptr+4
|
||||||
pei (cmd+2)
|
pei (cmd+2)
|
||||||
pei (cmd)
|
pei (cmd)
|
||||||
jsr cstrlen
|
jsr cstrlen
|
||||||
sta len
|
sta len
|
||||||
pea 0
|
pea 0
|
||||||
clc
|
clc
|
||||||
adc #4+1
|
adc #4+1
|
||||||
pha
|
pha
|
||||||
~NEW
|
~NEW
|
||||||
sta ptr
|
sta ptr
|
||||||
stx ptr+2
|
stx ptr+2
|
||||||
ora ptr+2
|
ora ptr+2
|
||||||
beq putdone
|
beq putdone
|
||||||
|
|
||||||
inc lasthist
|
inc lasthist
|
||||||
inc numhist
|
inc numhist
|
||||||
|
|
||||||
lda historyptr ;Set up linked list pointers
|
lda historyptr ;Set up linked list pointers
|
||||||
sta [ptr]
|
sta [ptr]
|
||||||
ldy #histNext+2
|
ldy #histNext+2
|
||||||
lda historyptr+2
|
lda historyptr+2
|
||||||
sta [ptr],y
|
sta [ptr],y
|
||||||
mv4 ptr,historyptr
|
mv4 ptr,historyptr
|
||||||
|
|
||||||
pei (cmd+2)
|
pei (cmd+2)
|
||||||
pei (cmd)
|
pei (cmd)
|
||||||
|
@ -141,53 +141,53 @@ pushaddr phx Push address onto stack.
|
||||||
pea 0 Push signedFlag = 0 (unsigned)
|
pea 0 Push signedFlag = 0 (unsigned)
|
||||||
Tool $280b Dec2Int.
|
Tool $280b Dec2Int.
|
||||||
pla Get result.
|
pla Get result.
|
||||||
sta size
|
sta size
|
||||||
beq alldone
|
beq alldone
|
||||||
;
|
;
|
||||||
; Follow linked list until we reach size histories
|
; Follow linked list until we reach size histories
|
||||||
;
|
;
|
||||||
mv4 historyptr,ptr
|
mv4 historyptr,ptr
|
||||||
ldy #histNext+2
|
ldy #histNext+2
|
||||||
follow lda [ptr]
|
follow lda [ptr]
|
||||||
tax
|
tax
|
||||||
ora [ptr],y
|
ora [ptr],y
|
||||||
beq alldone ;not enough
|
beq alldone ;not enough
|
||||||
dec size
|
dec size
|
||||||
beq prune
|
beq prune
|
||||||
lda [ptr],y
|
lda [ptr],y
|
||||||
sta ptr+2
|
sta ptr+2
|
||||||
stx ptr
|
stx ptr
|
||||||
bra follow
|
bra follow
|
||||||
;
|
;
|
||||||
; we have enough, start pruning
|
; we have enough, start pruning
|
||||||
;
|
;
|
||||||
prune lda [ptr]
|
prune lda [ptr]
|
||||||
sta ptr2
|
sta ptr2
|
||||||
lda [ptr],y
|
lda [ptr],y
|
||||||
sta ptr2+2
|
sta ptr2+2
|
||||||
lda #0
|
lda #0
|
||||||
sta [ptr]
|
sta [ptr]
|
||||||
sta [ptr],y ;terminate last history
|
sta [ptr],y ;terminate last history
|
||||||
;
|
;
|
||||||
; Dispose remaining
|
; Dispose remaining
|
||||||
;
|
;
|
||||||
dispose lda ptr2
|
dispose lda ptr2
|
||||||
ora ptr2+2
|
ora ptr2+2
|
||||||
beq alldone
|
beq alldone
|
||||||
dec numhist
|
dec numhist
|
||||||
lda [ptr2]
|
lda [ptr2]
|
||||||
sta ptr
|
sta ptr
|
||||||
lda [ptr2],y
|
lda [ptr2],y
|
||||||
sta ptr+2
|
sta ptr+2
|
||||||
pei (ptr2+2)
|
pei (ptr2+2)
|
||||||
pei (ptr2)
|
pei (ptr2)
|
||||||
jsl nullfree
|
jsl nullfree
|
||||||
lda ptr
|
lda ptr
|
||||||
sta ptr2
|
sta ptr2
|
||||||
lda ptr+2
|
lda ptr+2
|
||||||
sta ptr2+2
|
sta ptr2+2
|
||||||
ldy #histNext+2
|
ldy #histNext+2
|
||||||
bra dispose
|
bra dispose
|
||||||
|
|
||||||
alldone pei (histvalptr+2)
|
alldone pei (histvalptr+2)
|
||||||
pei (histvalptr)
|
pei (histvalptr)
|
||||||
|
@ -195,9 +195,9 @@ alldone pei (histvalptr+2)
|
||||||
|
|
||||||
goback return
|
goback return
|
||||||
|
|
||||||
size ds 2
|
size ds 2
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
;
|
;
|
||||||
|
@ -206,23 +206,23 @@ size ds 2
|
||||||
;
|
;
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
|
|
||||||
PrevHistory START
|
PrevHistory START
|
||||||
|
|
||||||
using HistoryData
|
using HistoryData
|
||||||
using global
|
using global
|
||||||
using termdata
|
using termdata
|
||||||
|
|
||||||
ora2 historyptr,historyptr+2,@a ;If no history, then skip
|
ora2 historyptr,historyptr+2,@a ;If no history, then skip
|
||||||
jeq ctl5a
|
jeq ctl5a
|
||||||
|
|
||||||
ldx cmdloc ;Move cursor to beginning of line
|
ldx cmdloc ;Move cursor to beginning of line
|
||||||
jsr moveleft
|
jsr moveleft
|
||||||
|
|
||||||
lda cdcap
|
lda cdcap
|
||||||
ora cdcap
|
ora cdcap
|
||||||
beq ctl5b0
|
beq ctl5b0
|
||||||
tputs (cdcap,#0,#outc)
|
tputs (cdcap,#0,#outc)
|
||||||
bra ctl5g
|
bra ctl5g
|
||||||
|
|
||||||
ctl5b0 ldx cmdlen ;clear line
|
ctl5b0 ldx cmdlen ;clear line
|
||||||
ctl5b dex
|
ctl5b dex
|
||||||
|
@ -235,47 +235,47 @@ ctl5b dex
|
||||||
ctl5c ldx cmdlen
|
ctl5c ldx cmdlen
|
||||||
jsr moveleft
|
jsr moveleft
|
||||||
|
|
||||||
ctl5g ora2 currenthist,currenthist+2,@a
|
ctl5g ora2 currenthist,currenthist+2,@a
|
||||||
bne ctl5i ;If not set up for current hist then
|
bne ctl5i ;If not set up for current hist then
|
||||||
lda historyptr+2 ;Set up at start.
|
lda historyptr+2 ;Set up at start.
|
||||||
ldx historyptr
|
ldx historyptr
|
||||||
ldy #2
|
ldy #2
|
||||||
bra ctl5j
|
bra ctl5j
|
||||||
|
|
||||||
ctl5i mv4 currenthist,0 ;Otherwise move to previous history
|
ctl5i mv4 currenthist,0 ;Otherwise move to previous history
|
||||||
stz cmdlen
|
stz cmdlen
|
||||||
stz cmdloc
|
stz cmdloc
|
||||||
ldy #HistNext+2
|
ldy #HistNext+2
|
||||||
lda [0]
|
lda [0]
|
||||||
tax
|
tax
|
||||||
lda [0],y
|
lda [0],y
|
||||||
|
|
||||||
ctl5j sta 0+2 ;Save some pointers
|
ctl5j sta 0+2 ;Save some pointers
|
||||||
stx 0
|
stx 0
|
||||||
sta currenthist+2
|
sta currenthist+2
|
||||||
stx currenthist
|
stx currenthist
|
||||||
ora 0 ;If ptr is 0 then at end, quit
|
ora 0 ;If ptr is 0 then at end, quit
|
||||||
beq ctl5a
|
beq ctl5a
|
||||||
|
|
||||||
ldx #0 ;Display and store command
|
ldx #0 ;Display and store command
|
||||||
iny2
|
iny2
|
||||||
ctl5h lda [0],y
|
ctl5h lda [0],y
|
||||||
and #$FF
|
and #$FF
|
||||||
sta cmdline,x
|
sta cmdline,x
|
||||||
beq ctl5ha
|
beq ctl5ha
|
||||||
inx
|
inx
|
||||||
iny
|
iny
|
||||||
bra ctl5h
|
bra ctl5h
|
||||||
ctl5ha stx cmdlen
|
ctl5ha stx cmdlen
|
||||||
stx cmdloc
|
stx cmdloc
|
||||||
|
|
||||||
ldx #^cmdline
|
ldx #^cmdline
|
||||||
lda #cmdline
|
lda #cmdline
|
||||||
jsr puts
|
jsr puts
|
||||||
|
|
||||||
ctl5a rts
|
ctl5a rts
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
;
|
;
|
||||||
|
@ -284,37 +284,37 @@ ctl5a rts
|
||||||
;
|
;
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
|
|
||||||
NextHistory START
|
NextHistory START
|
||||||
|
|
||||||
using HistoryData
|
using HistoryData
|
||||||
using global
|
using global
|
||||||
using termdata
|
using termdata
|
||||||
|
|
||||||
ora2 historyptr,historyptr+2,@a ;No hist, then skip
|
ora2 historyptr,historyptr+2,@a ;No hist, then skip
|
||||||
jeq ctl6a
|
jeq ctl6a
|
||||||
|
|
||||||
stz 4 ;Walk through linked list searching
|
stz 4 ;Walk through linked list searching
|
||||||
stz 4+2 ; for hist prior to last hist.
|
stz 4+2 ; for hist prior to last hist.
|
||||||
mv4 historyptr,0
|
mv4 historyptr,0
|
||||||
ctl6i if2 0,ne,currenthist,ctl6j
|
ctl6i if2 0,ne,currenthist,ctl6j
|
||||||
if2 0+2,eq,currenthist+2,ctl6k
|
if2 0+2,eq,currenthist+2,ctl6k
|
||||||
ctl6j mv4 0,4
|
ctl6j mv4 0,4
|
||||||
ldy #HistNext+2
|
ldy #HistNext+2
|
||||||
lda [0]
|
lda [0]
|
||||||
tax
|
tax
|
||||||
lda [0],y
|
lda [0],y
|
||||||
sta 0+2
|
sta 0+2
|
||||||
stx 0
|
stx 0
|
||||||
bra ctl6i
|
bra ctl6i
|
||||||
|
|
||||||
ctl6k ldx cmdloc ;Move cursor to left
|
ctl6k ldx cmdloc ;Move cursor to left
|
||||||
jsr moveleft
|
jsr moveleft
|
||||||
|
|
||||||
lda cdcap
|
lda cdcap
|
||||||
ora cdcap
|
ora cdcap
|
||||||
beq ctl6b0
|
beq ctl6b0
|
||||||
tputs (cdcap,#0,#outc)
|
tputs (cdcap,#0,#outc)
|
||||||
bra ctl6g
|
bra ctl6g
|
||||||
|
|
||||||
ctl6b0 ldx cmdlen ;clear line
|
ctl6b0 ldx cmdlen ;clear line
|
||||||
ctl6b dex
|
ctl6b dex
|
||||||
|
@ -327,21 +327,21 @@ ctl6b dex
|
||||||
ctl6c ldx cmdlen
|
ctl6c ldx cmdlen
|
||||||
jsr moveleft
|
jsr moveleft
|
||||||
|
|
||||||
ctl6g stz cmdlen ;Get hist info.
|
ctl6g stz cmdlen ;Get hist info.
|
||||||
stz cmdloc
|
stz cmdloc
|
||||||
mv4 4,currenthist
|
mv4 4,currenthist
|
||||||
ora2 4,4+2,@a
|
ora2 4,4+2,@a
|
||||||
beq ctl6a ;Whoops, back to end, quit
|
beq ctl6a ;Whoops, back to end, quit
|
||||||
|
|
||||||
ldx #0 ;Output the new command
|
ldx #0 ;Output the new command
|
||||||
ldy #4
|
ldy #4
|
||||||
ctl6h lda [4],y
|
ctl6h lda [4],y
|
||||||
and #$ff
|
and #$ff
|
||||||
sta cmdline,x
|
sta cmdline,x
|
||||||
beq ctl6ha
|
beq ctl6ha
|
||||||
iny
|
iny
|
||||||
inx
|
inx
|
||||||
bra ctl6h
|
bra ctl6h
|
||||||
ctl6ha stx cmdlen
|
ctl6ha stx cmdlen
|
||||||
stx cmdloc
|
stx cmdloc
|
||||||
|
|
||||||
|
@ -349,9 +349,9 @@ ctl6ha stx cmdlen
|
||||||
lda #cmdline
|
lda #cmdline
|
||||||
jsr puts
|
jsr puts
|
||||||
|
|
||||||
ctl6a rts
|
ctl6a rts
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
;
|
;
|
||||||
|
@ -359,15 +359,15 @@ ctl6a rts
|
||||||
;
|
;
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
|
|
||||||
SaveHistory START
|
SaveHistory START
|
||||||
|
|
||||||
using HistoryData
|
using HistoryData
|
||||||
using global
|
using global
|
||||||
|
|
||||||
svhisvalptr equ 0
|
svhisvalptr equ 0
|
||||||
space equ svhisvalptr+4
|
space equ svhisvalptr+4
|
||||||
|
|
||||||
subroutine ,space
|
subroutine ,space
|
||||||
|
|
||||||
lda historyFN
|
lda historyFN
|
||||||
sta DestroyParm+2
|
sta DestroyParm+2
|
||||||
|
@ -409,28 +409,28 @@ pushaddr phx Push address onto stack.
|
||||||
;
|
;
|
||||||
; Create and write history to file
|
; Create and write history to file
|
||||||
;
|
;
|
||||||
Destroy DestroyParm
|
Destroy DestroyParm
|
||||||
Create CreateParm
|
Create CreateParm
|
||||||
jcs done
|
jcs done
|
||||||
Open OpenParm
|
Open OpenParm
|
||||||
bcs done
|
bcs done
|
||||||
mv2 OpenRef,(WriteRef,WriteCRRef,CloseRef)
|
mv2 OpenRef,(WriteRef,WriteCRRef,CloseRef)
|
||||||
|
|
||||||
loop1 mv4 historyptr,0
|
loop1 mv4 historyptr,0
|
||||||
mv2 size,count
|
mv2 size,count
|
||||||
ldy #histNext+2
|
ldy #histNext+2
|
||||||
loop2 lda 0
|
loop2 lda 0
|
||||||
ora 0+2
|
ora 0+2
|
||||||
beq next
|
beq next
|
||||||
lda [0]
|
lda [0]
|
||||||
tax
|
tax
|
||||||
dec count
|
dec count
|
||||||
beq write
|
beq write
|
||||||
lda [0],y
|
lda [0],y
|
||||||
sta 0+2
|
sta 0+2
|
||||||
stx 0
|
stx 0
|
||||||
bra loop2
|
bra loop2
|
||||||
write clc
|
write clc
|
||||||
lda 0
|
lda 0
|
||||||
adc #4
|
adc #4
|
||||||
tax
|
tax
|
||||||
|
@ -441,15 +441,15 @@ write clc
|
||||||
pha
|
pha
|
||||||
phx
|
phx
|
||||||
jsr cstrlen
|
jsr cstrlen
|
||||||
sta WriteReq
|
sta WriteReq
|
||||||
Write WriteParm
|
Write WriteParm
|
||||||
bcs doneclose
|
bcs doneclose
|
||||||
Write WriteCR
|
Write WriteCR
|
||||||
bcs doneclose
|
bcs doneclose
|
||||||
next dec size
|
next dec size
|
||||||
bne loop1
|
bne loop1
|
||||||
|
|
||||||
doneclose Close CloseParm
|
doneclose Close CloseParm
|
||||||
|
|
||||||
done pei (svhisvalptr+2) Free $SAVEHISTORY value buffer
|
done pei (svhisvalptr+2) Free $SAVEHISTORY value buffer
|
||||||
pei (svhisvalptr)
|
pei (svhisvalptr)
|
||||||
|
@ -458,38 +458,38 @@ done pei (svhisvalptr+2) Free $SAVEHISTORY value buffer
|
||||||
goback return
|
goback return
|
||||||
|
|
||||||
|
|
||||||
DestroyParm dc i2'1'
|
DestroyParm dc i2'1'
|
||||||
dc a4'historyFN'
|
dc a4'historyFN'
|
||||||
|
|
||||||
CreateParm dc i2'3'
|
CreateParm dc i2'3'
|
||||||
dc a4'historyFN'
|
dc a4'historyFN'
|
||||||
dc i2'$C3'
|
dc i2'$C3'
|
||||||
dc i2'0'
|
dc i2'0'
|
||||||
|
|
||||||
OpenParm dc i2'2'
|
OpenParm dc i2'2'
|
||||||
OpenRef ds 2
|
OpenRef ds 2
|
||||||
dc a4'historyFN'
|
dc a4'historyFN'
|
||||||
|
|
||||||
WriteParm dc i2'4'
|
WriteParm dc i2'4'
|
||||||
WriteRef ds 2
|
WriteRef ds 2
|
||||||
WriteBuf dc a4'buffer'
|
WriteBuf dc a4'buffer'
|
||||||
WriteReq ds 4
|
WriteReq ds 4
|
||||||
ds 4
|
ds 4
|
||||||
|
|
||||||
WriteCR dc i2'4'
|
WriteCR dc i2'4'
|
||||||
WriteCRRef ds 2
|
WriteCRRef ds 2
|
||||||
dc a4'CRBuf'
|
dc a4'CRBuf'
|
||||||
dc i4'1'
|
dc i4'1'
|
||||||
ds 4
|
ds 4
|
||||||
CRBuf dc i1'13'
|
CRBuf dc i1'13'
|
||||||
|
|
||||||
CloseParm dc i2'1'
|
CloseParm dc i2'1'
|
||||||
CloseRef ds 2
|
CloseRef ds 2
|
||||||
|
|
||||||
size ds 2
|
size ds 2
|
||||||
count ds 2
|
count ds 2
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
;
|
;
|
||||||
|
@ -497,65 +497,65 @@ count ds 2
|
||||||
;
|
;
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
|
|
||||||
ReadHistory START
|
ReadHistory START
|
||||||
|
|
||||||
using HistoryData
|
using HistoryData
|
||||||
using global
|
using global
|
||||||
|
|
||||||
lda historyFN
|
lda historyFN
|
||||||
sta OpenParm+4
|
sta OpenParm+4
|
||||||
lda historyFN+2
|
lda historyFN+2
|
||||||
sta OpenParm+6
|
sta OpenParm+6
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
sta historyptr
|
sta historyptr
|
||||||
sta historyptr+2
|
sta historyptr+2
|
||||||
|
|
||||||
Open OpenParm
|
Open OpenParm
|
||||||
bcs done
|
bcs done
|
||||||
mv2 OpenRef,(ReadRef,NLRef,CloseRef)
|
mv2 OpenRef,(ReadRef,NLRef,CloseRef)
|
||||||
NewLine NLParm
|
NewLine NLParm
|
||||||
bcs doneclose
|
bcs doneclose
|
||||||
|
|
||||||
loop anop
|
loop anop
|
||||||
Read ReadParm
|
Read ReadParm
|
||||||
bcs doneclose
|
bcs doneclose
|
||||||
ldy ReadTrans
|
ldy ReadTrans
|
||||||
beq doneclose
|
beq doneclose
|
||||||
dey
|
dey
|
||||||
lda #0
|
lda #0
|
||||||
sta buffer,y
|
sta buffer,y
|
||||||
ph4 #buffer
|
ph4 #buffer
|
||||||
jsl InsertHistory
|
jsl InsertHistory
|
||||||
bra loop
|
bra loop
|
||||||
|
|
||||||
doneclose Close CloseParm
|
doneclose Close CloseParm
|
||||||
|
|
||||||
done rts
|
done rts
|
||||||
|
|
||||||
OpenParm dc i2'2'
|
OpenParm dc i2'2'
|
||||||
OpenRef ds 2
|
OpenRef ds 2
|
||||||
dc a4'historyFN'
|
dc a4'historyFN'
|
||||||
|
|
||||||
NLParm dc i2'4'
|
NLParm dc i2'4'
|
||||||
NLRef ds 2
|
NLRef ds 2
|
||||||
dc i2'$7F'
|
dc i2'$7F'
|
||||||
dc i2'1'
|
dc i2'1'
|
||||||
dc a4'NLTable'
|
dc a4'NLTable'
|
||||||
NLTable dc i1'13'
|
NLTable dc i1'13'
|
||||||
|
|
||||||
ReadParm dc i2'4'
|
ReadParm dc i2'4'
|
||||||
ReadRef ds 2
|
ReadRef ds 2
|
||||||
dc a4'buffer'
|
dc a4'buffer'
|
||||||
dc i4'1024'
|
dc i4'1024'
|
||||||
ReadTrans ds 4
|
ReadTrans ds 4
|
||||||
|
|
||||||
CloseParm dc i2'1'
|
CloseParm dc i2'1'
|
||||||
CloseRef ds 2
|
CloseRef ds 2
|
||||||
|
|
||||||
size ds 2
|
size ds 2
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
;
|
;
|
||||||
|
@ -578,61 +578,61 @@ InitHistory START
|
||||||
;
|
;
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
|
|
||||||
PrintHistory START
|
PrintHistory START
|
||||||
|
|
||||||
using HistoryData
|
using HistoryData
|
||||||
using global
|
using global
|
||||||
|
|
||||||
ptr equ 0
|
ptr equ 0
|
||||||
space equ ptr+4
|
space equ ptr+4
|
||||||
|
|
||||||
subroutine (2:argc,4:argv),space
|
subroutine (2:argc,4:argv),space
|
||||||
|
|
||||||
lda historyptr
|
lda historyptr
|
||||||
ora historyptr+2
|
ora historyptr+2
|
||||||
beq done
|
beq done
|
||||||
|
|
||||||
lda numhist
|
lda numhist
|
||||||
sta num
|
sta num
|
||||||
loop1 mv4 historyptr,ptr
|
loop1 mv4 historyptr,ptr
|
||||||
lda num
|
lda num
|
||||||
bmi done
|
bmi done
|
||||||
sta count
|
sta count
|
||||||
loop2 lda count
|
loop2 lda count
|
||||||
beq print
|
beq print
|
||||||
ldy #histNext+2
|
ldy #histNext+2
|
||||||
lda [ptr]
|
lda [ptr]
|
||||||
tax
|
tax
|
||||||
lda [ptr],y
|
lda [ptr],y
|
||||||
sta ptr+2
|
sta ptr+2
|
||||||
stx ptr
|
stx ptr
|
||||||
ora ptr
|
ora ptr
|
||||||
beq next
|
beq next
|
||||||
dec count
|
dec count
|
||||||
bra loop2
|
bra loop2
|
||||||
|
|
||||||
print sub2 lasthist,num,@a
|
print sub2 lasthist,num,@a
|
||||||
Int2Dec (@a,#numbstr,#4,#0)
|
Int2Dec (@a,#numbstr,#4,#0)
|
||||||
ldx #^numbstr
|
ldx #^numbstr
|
||||||
lda #numbstr
|
lda #numbstr
|
||||||
jsr puts
|
jsr puts
|
||||||
clc
|
clc
|
||||||
ldx ptr+2
|
ldx ptr+2
|
||||||
lda ptr
|
lda ptr
|
||||||
adc #4
|
adc #4
|
||||||
ok jsr puts
|
ok jsr puts
|
||||||
jsr newline
|
jsr newline
|
||||||
|
|
||||||
next dec num
|
next dec num
|
||||||
bra loop1
|
bra loop1
|
||||||
|
|
||||||
done return 2:#0
|
done return 2:#0
|
||||||
|
|
||||||
numbstr dc c'0000: ',h'00'
|
numbstr dc c'0000: ',h'00'
|
||||||
num ds 2
|
num ds 2
|
||||||
count ds 2
|
count ds 2
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
;
|
;
|
||||||
|
@ -651,4 +651,4 @@ 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.6 1998/08/03 17:30:21 tribby Exp $
|
* $Id: invoke.asm,v 1.7 1998/09/08 16:53:10 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -76,11 +76,12 @@ end equ sfile+4
|
||||||
tsc
|
tsc
|
||||||
phd
|
phd
|
||||||
tcd
|
tcd
|
||||||
|
|
||||||
;
|
;
|
||||||
; Redirect standard input
|
; Redirect standard input
|
||||||
;
|
;
|
||||||
ora2 sfile,sfile+2,@a If no name provided,
|
ora2 sfile,sfile+2,@a If no name provided,
|
||||||
beq execa skip it.
|
beq execa skip it.
|
||||||
pei (sfile+2) Convert c-string
|
pei (sfile+2) Convert c-string
|
||||||
pei (sfile) filename to
|
pei (sfile) filename to
|
||||||
jsr c2gsstr GS/OS string.
|
jsr c2gsstr GS/OS string.
|
||||||
|
@ -118,7 +119,7 @@ execa ora2 dfile,dfile+2,@a
|
||||||
ldx #^err2 Print error message:
|
ldx #^err2 Print error message:
|
||||||
lda #err2 'Error redirecting standard output.'
|
lda #err2 'Error redirecting standard output.'
|
||||||
jmp badbye
|
jmp badbye
|
||||||
;
|
;
|
||||||
; Redirect standard error
|
; Redirect standard error
|
||||||
;
|
;
|
||||||
execb ora2 efile,efile+2,@a
|
execb ora2 efile,efile+2,@a
|
||||||
|
@ -139,12 +140,12 @@ execb ora2 efile,efile+2,@a
|
||||||
ldx #^err3 Print error message:
|
ldx #^err3 Print error message:
|
||||||
lda #err3 'Error redirecting standard error.'
|
lda #err3 'Error redirecting standard error.'
|
||||||
jmp badbye
|
jmp badbye
|
||||||
;
|
;
|
||||||
; Is input piped in?
|
; Is input piped in?
|
||||||
;
|
;
|
||||||
execc lda pipein
|
execc lda pipein
|
||||||
beq execd
|
beq execd
|
||||||
dup2 (pipein,#1)
|
dup2 (pipein,#1)
|
||||||
mv2 pipein2,CloseRef
|
mv2 pipein2,CloseRef
|
||||||
Close CloseParm
|
Close CloseParm
|
||||||
ldx #0
|
ldx #0
|
||||||
|
@ -170,7 +171,7 @@ goodbye ldy #0
|
||||||
bra exit
|
bra exit
|
||||||
|
|
||||||
badbye jsr errputs
|
badbye jsr errputs
|
||||||
cop $7F ; get out of the way
|
cop $7F ; get out of the way
|
||||||
ldy #1
|
ldy #1
|
||||||
|
|
||||||
exit lda space
|
exit lda space
|
||||||
|
@ -185,15 +186,15 @@ exit lda space
|
||||||
|
|
||||||
cpy #1 Clear/set carry for success/failure.
|
cpy #1 Clear/set carry for success/failure.
|
||||||
|
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
;
|
;
|
||||||
; Parameter block for shell call to redirect I/O (ORCA/M manual p.425)
|
; Parameter block for shell call to redirect I/O (ORCA/M manual p.425)
|
||||||
;
|
;
|
||||||
RedirectParm dc i2'3' pCount
|
RedirectParm dc i2'3' pCount
|
||||||
RedirectDev ds 2 Dev num (0=stdin,1=stdout,2=errout)
|
RedirectDev ds 2 Dev num (0=stdin,1=stdout,2=errout)
|
||||||
RedirectApp ds 2 Append flag (0=delete)
|
RedirectApp ds 2 Append flag (0=delete)
|
||||||
RedirectFile ds 4 File name (GS/OS input string)
|
RedirectFile ds 4 File name (GS/OS input string)
|
||||||
|
|
||||||
;
|
;
|
||||||
; Parameter block for GS/OS call to close a file
|
; Parameter block for GS/OS call to close a file
|
||||||
|
@ -204,8 +205,8 @@ CloseRef dc i'0' refNum
|
||||||
err1 dc c'gsh: Error redirecting standard input.',h'0d00'
|
err1 dc c'gsh: Error redirecting standard input.',h'0d00'
|
||||||
err2 dc c'gsh: Error redirecting standard output.',h'0d00'
|
err2 dc c'gsh: Error redirecting standard output.',h'0d00'
|
||||||
err3 dc c'gsh: Error redirecting standard error.',h'0d00'
|
err3 dc c'gsh: Error redirecting standard error.',h'0d00'
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -213,7 +214,7 @@ err3 dc c'gsh: Error redirecting standard error.',h'0d00'
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
|
|
||||||
invoke START
|
invoke START
|
||||||
|
|
||||||
using hashdata
|
using hashdata
|
||||||
using vardata
|
using vardata
|
||||||
|
@ -232,8 +233,8 @@ space equ dir+4
|
||||||
ld2 -1,rtnval
|
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.
|
||||||
bne chknull If != 0 continue with processing.
|
bne chknull If != 0 continue with processing.
|
||||||
|
|
||||||
lda sfile If any of the file pointers
|
lda sfile If any of the file pointers
|
||||||
ora sfile+2 are != NULL,
|
ora sfile+2 are != NULL,
|
||||||
|
@ -243,25 +244,25 @@ space equ dir+4
|
||||||
ora efile+2
|
ora efile+2
|
||||||
beq nulldone
|
beq nulldone
|
||||||
|
|
||||||
ldx #^hehstr print error message:
|
ldx #^spcmdstr print error message:
|
||||||
lda #hehstr ' specify a command before redirecting.'
|
lda #spcmdstr ' specify a command before redirecting.'
|
||||||
jsr errputs
|
jsr errputs
|
||||||
|
|
||||||
nulldone jmp done
|
nulldone jmp done
|
||||||
|
|
||||||
;
|
;
|
||||||
; Check for null command
|
; Check for null command
|
||||||
;
|
;
|
||||||
chknull ldy #2 Move command line
|
chknull ldy #2 Move command line
|
||||||
lda [argv] pointer to
|
lda [argv] pointer to
|
||||||
sta dir dir (4 bytes).
|
sta dir dir (4 bytes).
|
||||||
lda [argv],y
|
lda [argv],y
|
||||||
sta dir+2 If pointer == NULL
|
sta dir+2 If pointer == NULL
|
||||||
ora dir
|
ora dir
|
||||||
beq nulldone all done.
|
beq nulldone all done.
|
||||||
lda [dir] If first character == '\0',
|
lda [dir] If first character == '\0',
|
||||||
and #$FF
|
and #$FF
|
||||||
beq nulldone all done.
|
beq nulldone all done.
|
||||||
|
|
||||||
;
|
;
|
||||||
; check for file
|
; check for file
|
||||||
|
@ -276,37 +277,37 @@ checkfile anop
|
||||||
|
|
||||||
; Command is not listed in the built-in table. See if it was hashed
|
; Command is not listed in the built-in table. See if it was hashed
|
||||||
|
|
||||||
pei (dir+2)
|
pei (dir+2)
|
||||||
pei (dir)
|
pei (dir)
|
||||||
ph4 hash_table
|
ph4 hash_table
|
||||||
ph4 #hash_paths
|
ph4 #hash_paths
|
||||||
jsl search
|
jsl search
|
||||||
cmp #0
|
cmp #0
|
||||||
bne changeit
|
bne changeit
|
||||||
cpx #0
|
cpx #0
|
||||||
beq skip
|
beq skip
|
||||||
|
|
||||||
changeit sta dir
|
changeit sta dir
|
||||||
stx dir+2
|
stx dir+2
|
||||||
|
|
||||||
skip lock mutex2
|
skip lock mutex2
|
||||||
pei (dir+2)
|
pei (dir+2)
|
||||||
pei (dir)
|
pei (dir)
|
||||||
jsr c2gsstr
|
jsr c2gsstr
|
||||||
sta GRecPath
|
sta GRecPath
|
||||||
sta ptr
|
sta ptr
|
||||||
stx GRecPath+2
|
stx GRecPath+2
|
||||||
stx ptr+2
|
stx ptr+2
|
||||||
|
|
||||||
GetFileInfo GRec
|
GetFileInfo GRec
|
||||||
unlock mutex2
|
unlock mutex2
|
||||||
jcs notfound
|
jcs notfound
|
||||||
|
|
||||||
; File type $B5 is a GS/OS Shell application (EXE)
|
; File type $B5 is a GS/OS Shell application (EXE)
|
||||||
if2 GRecFileType,eq,#$B5,doExec
|
if2 GRecFileType,eq,#$B5,doExec
|
||||||
|
|
||||||
; File type $B3 is a GS/OS application (S16)
|
; File type $B3 is a GS/OS application (S16)
|
||||||
if2 @a,eq,#$B3,doExec
|
if2 @a,eq,#$B3,doExec
|
||||||
|
|
||||||
ldx vardirexec
|
ldx vardirexec
|
||||||
bne ft02
|
bne ft02
|
||||||
|
@ -314,14 +315,14 @@ skip lock mutex2
|
||||||
jeq doDir Target is a directory; change to it.
|
jeq doDir Target is a directory; change to it.
|
||||||
|
|
||||||
; File type $B0 is a source code file (SRC)
|
; File type $B0 is a source code file (SRC)
|
||||||
ft02 if2 @a,ne,#$B0,badfile
|
ft02 if2 @a,ne,#$B0,badfile
|
||||||
; Type $B0, Aux $00000006 is a shell command file (EXEC)
|
; Type $B0, Aux $00000006 is a shell command file (EXEC)
|
||||||
if2 GRecAuxType,ne,#6,badfile
|
if2 GRecAuxType,ne,#6,badfile
|
||||||
if2 GRecAuxType+2,ne,#0,badfile
|
if2 GRecAuxType+2,ne,#0,badfile
|
||||||
jmp doShell
|
jmp doShell
|
||||||
|
|
||||||
|
|
||||||
badfile ldx dir+2
|
badfile ldx dir+2
|
||||||
lda dir
|
lda dir
|
||||||
jsr errputs
|
jsr errputs
|
||||||
ldx #^err1 Print error message:
|
ldx #^err1 Print error message:
|
||||||
|
@ -330,17 +331,17 @@ badfile ldx dir+2
|
||||||
free pei (ptr+2)
|
free pei (ptr+2)
|
||||||
pei (ptr)
|
pei (ptr)
|
||||||
jsl nullfree
|
jsl nullfree
|
||||||
jmp done
|
jmp done
|
||||||
|
|
||||||
;
|
;
|
||||||
; launch an executable
|
; launch an executable
|
||||||
;
|
;
|
||||||
doExec pei (ptr+2)
|
doExec pei (ptr+2)
|
||||||
pei (ptr)
|
pei (ptr)
|
||||||
jsl nullfree
|
jsl nullfree
|
||||||
jsr prefork
|
jsr prefork
|
||||||
fork #invoke0
|
fork #invoke0
|
||||||
jsr postfork
|
jsr postfork
|
||||||
jmp done
|
jmp done
|
||||||
|
|
||||||
|
|
||||||
|
@ -417,9 +418,9 @@ invoke0 phk
|
||||||
|
|
||||||
jsl infork
|
jsl infork
|
||||||
bcs invoke1
|
bcs invoke1
|
||||||
case on
|
case on
|
||||||
jsl _execve For 2.0.6: call _execve, not execve
|
jsl _execve For 2.0.6: call _execve, not execve
|
||||||
case off
|
case off
|
||||||
rtl
|
rtl
|
||||||
invoke1 pla
|
invoke1 pla
|
||||||
pla
|
pla
|
||||||
|
@ -430,9 +431,9 @@ invoke1 pla
|
||||||
;
|
;
|
||||||
; Next command is a directory name, so change to that directory
|
; Next command is a directory name, so change to that directory
|
||||||
;
|
;
|
||||||
doDir lock cdmutex
|
doDir lock cdmutex
|
||||||
mv4 GRecPath,PRecPath
|
mv4 GRecPath,PRecPath
|
||||||
SetPrefix PRec
|
SetPrefix PRec
|
||||||
unlock cdmutex
|
unlock cdmutex
|
||||||
stz rtnval Return value: no fork done.
|
stz rtnval Return value: no fork done.
|
||||||
jmp free
|
jmp free
|
||||||
|
@ -440,11 +441,11 @@ doDir lock cdmutex
|
||||||
;
|
;
|
||||||
; Next command is a shell command file: fork a shell script
|
; Next command is a shell command file: fork a shell script
|
||||||
;
|
;
|
||||||
doShell inc biflag ;don't free argv...
|
doShell inc biflag ;don't free argv...
|
||||||
jsr prefork
|
jsr prefork
|
||||||
|
|
||||||
* int fork2(void *subr, int stack, int prio, char *name, word argc, ...)
|
* int fork2(void *subr, int stack, int prio, char *name, word argc, ...)
|
||||||
pea 0
|
pea 0
|
||||||
ldy #2
|
ldy #2
|
||||||
lda [argv],y
|
lda [argv],y
|
||||||
pha
|
pha
|
||||||
|
@ -453,12 +454,12 @@ doShell inc biflag ;don't free argv...
|
||||||
pea 0
|
pea 0
|
||||||
pea 1024
|
pea 1024
|
||||||
ph4 #exec0
|
ph4 #exec0
|
||||||
case on
|
case on
|
||||||
jsl fork2
|
jsl fork2
|
||||||
case off
|
case off
|
||||||
|
|
||||||
* fork #exec0
|
* fork #exec0
|
||||||
jsr postfork
|
jsr postfork
|
||||||
jmp free
|
jmp free
|
||||||
|
|
||||||
exec0 ph2 _argc ;for argfree
|
exec0 ph2 _argc ;for argfree
|
||||||
|
@ -470,11 +471,11 @@ exec0 ph2 _argc ;for argfree
|
||||||
jsl infork
|
jsl infork
|
||||||
bcs exec0c
|
bcs exec0c
|
||||||
signal (#SIGCHLD,#0)
|
signal (#SIGCHLD,#0)
|
||||||
PushVariablesGS NullPB
|
PushVariablesGS NullPB
|
||||||
pea 1
|
pea 1
|
||||||
jsl ShellExec
|
jsl ShellExec
|
||||||
jsl argfree
|
jsl argfree
|
||||||
PopVariablesGS NullPB
|
PopVariablesGS NullPB
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
exec0c pla
|
exec0c pla
|
||||||
|
@ -497,7 +498,7 @@ NullPB dc i2'0' pCount
|
||||||
* File name was found in the built-in table
|
* File name was found in the built-in table
|
||||||
|
|
||||||
trybuiltin inc biflag It's a built-in. Which type?
|
trybuiltin inc biflag It's a built-in. Which type?
|
||||||
cmp #1 Either fork or don't fork.
|
cmp #1 Either fork or don't fork.
|
||||||
beq noforkbuiltin
|
beq noforkbuiltin
|
||||||
|
|
||||||
;
|
;
|
||||||
|
@ -505,7 +506,7 @@ trybuiltin inc biflag It's a built-in. Which type?
|
||||||
;
|
;
|
||||||
jsr prefork
|
jsr prefork
|
||||||
fork #forkbuiltin
|
fork #forkbuiltin
|
||||||
jsr postfork
|
jsr postfork
|
||||||
jmp done
|
jmp done
|
||||||
;
|
;
|
||||||
; Control transfers here for a forked built-in command
|
; Control transfers here for a forked built-in command
|
||||||
|
@ -516,7 +517,7 @@ forkbuiltin cop $7F Give palloc a chance
|
||||||
ph4 _argv
|
ph4 _argv
|
||||||
jsl infork
|
jsl infork
|
||||||
bcs fork0c
|
bcs fork0c
|
||||||
jsl builtin
|
jsl builtin
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
; Error reported by infork; clean up stack and return to caller
|
; Error reported by infork; clean up stack and return to caller
|
||||||
|
@ -619,11 +620,11 @@ prefork lock mutex
|
||||||
postfork sta rtnval
|
postfork sta rtnval
|
||||||
lda pipein
|
lda pipein
|
||||||
beq postfork2
|
beq postfork2
|
||||||
sta CloseRef
|
sta CloseRef
|
||||||
Close CloseParm
|
Close CloseParm
|
||||||
postfork2 lda pipeout
|
postfork2 lda pipeout
|
||||||
beq postfork3
|
beq postfork3
|
||||||
sta CloseRef
|
sta CloseRef
|
||||||
Close CloseParm
|
Close CloseParm
|
||||||
postfork3 lda rtnval
|
postfork3 lda rtnval
|
||||||
cmp #-1
|
cmp #-1
|
||||||
|
@ -646,10 +647,10 @@ postfork4 ldx jobflag
|
||||||
jsl palloc
|
jsl palloc
|
||||||
bra postfork5
|
bra postfork5
|
||||||
postfork4a jsl pallocpipe
|
postfork4a jsl pallocpipe
|
||||||
postfork5 lda >mutex ;DANGER!!!!! Assumes knowledge of
|
postfork5 lda >mutex ;DANGER!!!!! Assumes knowledge of
|
||||||
beq postfork6 ;lock/unlock structure!!!!!!!!
|
beq postfork6 ;lock/unlock structure!!!!!!!!
|
||||||
cop $7F
|
cop $7F
|
||||||
bra postfork5
|
bra postfork5
|
||||||
postfork6 rts
|
postfork6 rts
|
||||||
|
|
||||||
;
|
;
|
||||||
|
@ -668,9 +669,9 @@ infork phk
|
||||||
bne invoke0a
|
bne invoke0a
|
||||||
tcnewpgrp ttyref
|
tcnewpgrp ttyref
|
||||||
invoke0a settpgrp ttyref
|
invoke0a settpgrp ttyref
|
||||||
lda _bg ;if in background then reset tty to
|
lda _bg ;if in background then reset tty to
|
||||||
and #$FF
|
and #$FF
|
||||||
beq invoke0b ;to the shell process group
|
beq invoke0b ;to the shell process group
|
||||||
tctpgrp (gshtty,gshpid)
|
tctpgrp (gshtty,gshpid)
|
||||||
|
|
||||||
invoke0b ph4 _sfile
|
invoke0b ph4 _sfile
|
||||||
|
@ -691,7 +692,7 @@ invoke0b ph4 _sfile
|
||||||
bne invoke0c
|
bne invoke0c
|
||||||
lda _pipeout
|
lda _pipeout
|
||||||
beq invoke0d
|
beq invoke0d
|
||||||
screate #0
|
screate #0
|
||||||
putsem sta >$FFFFFF
|
putsem sta >$FFFFFF
|
||||||
swait @a
|
swait @a
|
||||||
bra invoke0d
|
bra invoke0d
|
||||||
|
@ -712,7 +713,7 @@ invoke0d anop
|
||||||
doneinfork unlock mutex
|
doneinfork unlock mutex
|
||||||
sec
|
sec
|
||||||
indone rtl
|
indone rtl
|
||||||
|
|
||||||
mutex key
|
mutex key
|
||||||
mutex2 key
|
mutex2 key
|
||||||
cdmutex key
|
cdmutex key
|
||||||
|
@ -734,25 +735,24 @@ _bg dc i2'0'
|
||||||
_jobflag dc i2'0'
|
_jobflag dc i2'0'
|
||||||
_semaphore dc i2'0'
|
_semaphore dc i2'0'
|
||||||
|
|
||||||
str dc c'[0]',h'0d00'
|
str dc c'[0]',h'0d00'
|
||||||
err1 dc c': Not executable.',h'0d00'
|
err1 dc c': Not executable.',h'0d00'
|
||||||
err2 dc c': Command not found.',h'0d00'
|
err2 dc c': Command not found.',h'0d00'
|
||||||
hehstr dc c'heh heh, next time you''ll need to specify a command '
|
spcmdstr dc c'Specify a command before redirecting.',h'0d00'
|
||||||
dc c'before redirecting.',h'0d00'
|
|
||||||
deadstr dc c'Cannot fork (too many processes?)',h'0d00' ;try a spoon
|
deadstr dc c'Cannot fork (too many processes?)',h'0d00' ;try a spoon
|
||||||
|
|
||||||
|
|
||||||
; Parameter block for GS/OC call GetFileInfo
|
; Parameter block for GS/OC call GetFileInfo
|
||||||
GRec dc i'4' pCount (# of parameters)
|
GRec dc i'4' pCount (# of parameters)
|
||||||
GRecPath ds 4 pathname (input; ptr to GS/OS string)
|
GRecPath ds 4 pathname (input; ptr to GS/OS string)
|
||||||
ds 2 access (access attributes)
|
ds 2 access (access attributes)
|
||||||
GRecFileType ds 2 fileType (file type attribute)
|
GRecFileType ds 2 fileType (file type attribute)
|
||||||
GRecAuxType ds 4 auxType (auxiliary type attribute)
|
GRecAuxType ds 4 auxType (auxiliary type attribute)
|
||||||
|
|
||||||
|
|
||||||
PRec dc i'2'
|
PRec dc i'2'
|
||||||
PRecNum dc i'0'
|
PRecNum dc i'0'
|
||||||
PRecPath ds 4
|
PRecPath ds 4
|
||||||
|
|
||||||
CloseParm dc i2'1'
|
CloseParm dc i2'1'
|
||||||
CloseRef dc i2'0'
|
CloseRef dc i2'0'
|
||||||
|
|
144
bin/gsh/jobs.asm
144
bin/gsh/jobs.asm
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: jobs.asm,v 1.5 1998/08/03 17:30:22 tribby Exp $
|
* $Id: jobs.asm,v 1.6 1998/09/08 16:53:10 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -55,21 +55,21 @@ p_space gequ p_command+4 ;space for structure
|
||||||
; p_flags values
|
; p_flags values
|
||||||
;
|
;
|
||||||
PRUNNING gequ %0000000000000001 ;running
|
PRUNNING gequ %0000000000000001 ;running
|
||||||
PSTOPPED gequ %0000000000000010 ;stopped
|
PSTOPPED gequ %0000000000000010 ;stopped
|
||||||
PNEXITED gequ %0000000000000100 ;normally exited
|
PNEXITED gequ %0000000000000100 ;normally exited
|
||||||
PAEXITED gequ %0000000000001000 ;abnormally exited
|
PAEXITED gequ %0000000000001000 ;abnormally exited
|
||||||
PSIGNALED gequ %0000000000010000 ;terminated by signal != SIGINT
|
PSIGNALED gequ %0000000000010000 ;terminated by signal != SIGINT
|
||||||
PNOTIFY gequ %0000000000100000 ;notify async when done
|
PNOTIFY gequ %0000000000100000 ;notify async when done
|
||||||
PTIME gequ %0000000001000000 ;job times should be printed
|
PTIME gequ %0000000001000000 ;job times should be printed
|
||||||
PAWAITED gequ %0000000010000000 ;top level is waiting for it
|
PAWAITED gequ %0000000010000000 ;top level is waiting for it
|
||||||
PFOREGND gequ %0000000100000000 ;started in shells pgrp
|
PFOREGND gequ %0000000100000000 ;started in shells pgrp
|
||||||
PDUMPED gequ %0000001000000000 ;process dumped core
|
PDUMPED gequ %0000001000000000 ;process dumped core
|
||||||
PDIAG gequ %0000010000000000 ;diagnostic output also piped out
|
PDIAG gequ %0000010000000000 ;diagnostic output also piped out
|
||||||
PPOU gequ %0000100000000000 ;piped output
|
PPOU gequ %0000100000000000 ;piped output
|
||||||
PREPORTED gequ %0001000000000000 ;status has been reported
|
PREPORTED gequ %0001000000000000 ;status has been reported
|
||||||
PINTERRUPTED gequ %0010000000000000 ;job stopped via interrupt signal
|
PINTERRUPTED gequ %0010000000000000 ;job stopped via interrupt signal
|
||||||
PPTIME gequ %0100000000000000 ;time individual process
|
PPTIME gequ %0100000000000000 ;time individual process
|
||||||
PNEEDNOTE gequ %1000000000000000 ;notify as soon as practicle
|
PNEEDNOTE gequ %1000000000000000 ;notify as soon as practicle
|
||||||
|
|
||||||
;====================================================================
|
;====================================================================
|
||||||
;
|
;
|
||||||
|
@ -128,7 +128,7 @@ loop sta p
|
||||||
|
|
||||||
sigsetmask oldsig
|
sigsetmask oldsig
|
||||||
sigpause #0
|
sigpause #0
|
||||||
bra waitloop
|
bra waitloop
|
||||||
loop2 ldy #p_next+2
|
loop2 ldy #p_next+2
|
||||||
lda [p],y
|
lda [p],y
|
||||||
tax
|
tax
|
||||||
|
@ -185,7 +185,7 @@ done return
|
||||||
;====================================================================
|
;====================================================================
|
||||||
|
|
||||||
palloc START
|
palloc START
|
||||||
|
|
||||||
using pdata
|
using pdata
|
||||||
using global
|
using global
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ noprint anop
|
||||||
;====================================================================
|
;====================================================================
|
||||||
|
|
||||||
pallocpipe START
|
pallocpipe START
|
||||||
|
|
||||||
using pdata
|
using pdata
|
||||||
using global
|
using global
|
||||||
|
|
||||||
|
@ -394,7 +394,7 @@ bg01 ldy #p_flags
|
||||||
jsr copycstr
|
jsr copycstr
|
||||||
;
|
;
|
||||||
; update the current pipeline to know about the last pipe.
|
; update the current pipeline to know about the last pipe.
|
||||||
;
|
;
|
||||||
lda pjoblist
|
lda pjoblist
|
||||||
ldx pjoblist+2
|
ldx pjoblist+2
|
||||||
loop sta p
|
loop sta p
|
||||||
|
@ -474,7 +474,7 @@ end equ code+2
|
||||||
plb
|
plb
|
||||||
|
|
||||||
stz signum
|
stz signum
|
||||||
;
|
;
|
||||||
; get status for the process that just died
|
; get status for the process that just died
|
||||||
;
|
;
|
||||||
ldx #0
|
ldx #0
|
||||||
|
@ -545,11 +545,11 @@ stop2 pei (p+2)
|
||||||
pea 0
|
pea 0
|
||||||
pei (signum)
|
pei (signum)
|
||||||
jsl pprint
|
jsl pprint
|
||||||
bra done
|
bra done
|
||||||
kill ldy #p_flags
|
kill ldy #p_flags
|
||||||
lda [p],y
|
lda [p],y
|
||||||
bit #PFOREGND ;only set status variable if in
|
bit #PFOREGND ;only set status variable if in
|
||||||
beq zap0 ; foreground
|
beq zap0 ; foreground
|
||||||
lda waitstatus
|
lda waitstatus
|
||||||
jsr setstatus
|
jsr setstatus
|
||||||
bra zap
|
bra zap
|
||||||
|
@ -563,7 +563,7 @@ zap ldy #p_index
|
||||||
bit #PFOREGND
|
bit #PFOREGND
|
||||||
beq done
|
beq done
|
||||||
tctpgrp (gshtty,gshpid)
|
tctpgrp (gshtty,gshpid)
|
||||||
|
|
||||||
done anop
|
done anop
|
||||||
plb
|
plb
|
||||||
lda space
|
lda space
|
||||||
|
@ -578,7 +578,7 @@ done anop
|
||||||
|
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
;
|
;
|
||||||
; Set $status return variable
|
; Set $status return variable
|
||||||
;
|
;
|
||||||
setstatus ENTRY
|
setstatus ENTRY
|
||||||
|
@ -586,29 +586,29 @@ setstatus ENTRY
|
||||||
xba Isolate status
|
xba Isolate status
|
||||||
and #$FF byte.
|
and #$FF byte.
|
||||||
|
|
||||||
cmp #10
|
cmp #10
|
||||||
bcs digits2or3 If < 10,
|
bcs digits2or3 If < 10,
|
||||||
adc #'0' Convert to single digit
|
adc #'0' Convert to single digit
|
||||||
sta valstat_text and store in value string.
|
sta valstat_text and store in value string.
|
||||||
ldx #1 Set length of string to 1.
|
ldx #1 Set length of string to 1.
|
||||||
stx valstat
|
stx valstat
|
||||||
bra set_value
|
bra set_value
|
||||||
|
|
||||||
digits2or3 cmp #100 If parameter number
|
digits2or3 cmp #100 If parameter number
|
||||||
bcs digits3 >= 10 && < 99,
|
bcs digits3 >= 10 && < 99,
|
||||||
ldx #2 length = 2
|
ldx #2 length = 2
|
||||||
bra setit otherwise
|
bra setit otherwise
|
||||||
digits3 ldx #3 length = 3
|
digits3 ldx #3 length = 3
|
||||||
;
|
;
|
||||||
; Store length (2 or 3) and convert number to text
|
; Store length (2 or 3) and convert number to text
|
||||||
;
|
;
|
||||||
setit stx valstat
|
setit stx valstat
|
||||||
Int2Dec (@a,#valstat_text,valstat,#0)
|
Int2Dec (@a,#valstat_text,valstat,#0)
|
||||||
|
|
||||||
set_value anop
|
set_value anop
|
||||||
SetGS SetPB
|
SetGS SetPB
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;
|
;
|
||||||
; Parameter block for shell SetGS calls (p 427 in ORCA/M manual)
|
; Parameter block for shell SetGS calls (p 427 in ORCA/M manual)
|
||||||
|
@ -627,7 +627,7 @@ status gsstr 'status' Name of environment variable
|
||||||
valstat ds 2 Length word
|
valstat ds 2 Length word
|
||||||
valstat_text dc c'000' Text (up to three digits)
|
valstat_text dc c'000' Text (up to three digits)
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
;====================================================================
|
;====================================================================
|
||||||
;
|
;
|
||||||
|
@ -705,12 +705,12 @@ gotit3 anop
|
||||||
bne gotit3c
|
bne gotit3c
|
||||||
jsr newline
|
jsr newline
|
||||||
ldy #p_flags
|
ldy #p_flags
|
||||||
lda #0
|
lda #0
|
||||||
sta [p],y
|
sta [p],y
|
||||||
pei (p+2)
|
pei (p+2)
|
||||||
pei (p)
|
pei (p)
|
||||||
pea 0
|
pea 0
|
||||||
pea 0
|
pea 0
|
||||||
jsl pprint
|
jsl pprint
|
||||||
gotit3c anop
|
gotit3c anop
|
||||||
|
|
||||||
|
@ -754,7 +754,7 @@ gotit4 ldy #p_friends
|
||||||
pei (p+2)
|
pei (p+2)
|
||||||
pei (p)
|
pei (p)
|
||||||
jsl nullfree
|
jsl nullfree
|
||||||
pla
|
pla
|
||||||
sta P+2
|
sta P+2
|
||||||
pla
|
pla
|
||||||
sta p
|
sta p
|
||||||
|
@ -782,7 +782,7 @@ fmaxloop sta p
|
||||||
ora p+2
|
ora p+2
|
||||||
beq gotmax
|
beq gotmax
|
||||||
ldy #p_index
|
ldy #p_index
|
||||||
lda [p],y
|
lda [p],y
|
||||||
cmp prev
|
cmp prev
|
||||||
bcc skipmax
|
bcc skipmax
|
||||||
sta prev
|
sta prev
|
||||||
|
@ -846,7 +846,7 @@ done lda space,s
|
||||||
tcs
|
tcs
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
|
@ -1075,7 +1075,7 @@ killnull ldx #^err4
|
||||||
bra done
|
bra done
|
||||||
|
|
||||||
dokill kill (pid,signum)
|
dokill kill (pid,signum)
|
||||||
cmp #0
|
cmp #0
|
||||||
beq done
|
beq done
|
||||||
ldx #^err2
|
ldx #^err2
|
||||||
lda #err2
|
lda #err2
|
||||||
|
@ -1093,7 +1093,7 @@ done lda space
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
|
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
Usage dc c'Usage: kill [-signum | -signame] [pid | %jobid] ...',h'0d00'
|
Usage dc c'Usage: kill [-signum | -signame] [pid | %jobid] ...',h'0d00'
|
||||||
err1 dc c'kill: Invalid signal number.',h'0d00'
|
err1 dc c'kill: Invalid signal number.',h'0d00'
|
||||||
|
@ -1107,37 +1107,37 @@ liststr dc c'sighup sigint sigquit sigill sigtrap sigabrt sigemt '
|
||||||
dc c'sigttou sigio sigxcpu sigusr1 sigusr2',h'0d00'
|
dc c'sigttou sigio sigxcpu sigusr1 sigusr2',h'0d00'
|
||||||
|
|
||||||
names dc c'sighup',h'0000' ;1
|
names dc c'sighup',h'0000' ;1
|
||||||
dc c'sigint',h'0000' ;2
|
dc c'sigint',h'0000' ;2
|
||||||
dc c'sigquit',h'00' ;3
|
dc c'sigquit',h'00' ;3
|
||||||
dc c'sigill',h'0000' ;4
|
dc c'sigill',h'0000' ;4
|
||||||
dc c'sigtrap',h'00' ;5
|
dc c'sigtrap',h'00' ;5
|
||||||
dc c'sigabrt',h'00' ;6
|
dc c'sigabrt',h'00' ;6
|
||||||
dc c'sigemt',h'0000' ;7
|
dc c'sigemt',h'0000' ;7
|
||||||
dc c'sigfpe',h'0000' ;8
|
dc c'sigfpe',h'0000' ;8
|
||||||
dc c'sigkill',h'00' ;9
|
dc c'sigkill',h'00' ;9
|
||||||
dc c'sigbus',h'0000' ;10
|
dc c'sigbus',h'0000' ;10
|
||||||
dc c'sigsegv',h'00' ;11
|
dc c'sigsegv',h'00' ;11
|
||||||
dc c'sigsys',h'0000' ;12
|
dc c'sigsys',h'0000' ;12
|
||||||
dc c'sigpipe',h'00' ;13
|
dc c'sigpipe',h'00' ;13
|
||||||
dc c'sigalrm',h'00' ;14
|
dc c'sigalrm',h'00' ;14
|
||||||
dc c'sigterm',h'00' ;15
|
dc c'sigterm',h'00' ;15
|
||||||
dc c'sigurg',h'0000' ;16
|
dc c'sigurg',h'0000' ;16
|
||||||
dc c'sigstop',h'00' ;17
|
dc c'sigstop',h'00' ;17
|
||||||
dc c'sigtstp',h'00' ;18
|
dc c'sigtstp',h'00' ;18
|
||||||
dc c'sigcont',h'00' ;19
|
dc c'sigcont',h'00' ;19
|
||||||
dc c'sigchld',h'00' ;20
|
dc c'sigchld',h'00' ;20
|
||||||
dc c'sigttin',h'00' ;21
|
dc c'sigttin',h'00' ;21
|
||||||
dc c'sigttou',h'00' ;22
|
dc c'sigttou',h'00' ;22
|
||||||
dc c'sigio',h'000000' ;23
|
dc c'sigio',h'000000' ;23
|
||||||
dc c'sigxcpu',h'00' ;24
|
dc c'sigxcpu',h'00' ;24
|
||||||
dc h'0000000000000000' ;25
|
dc h'0000000000000000' ;25
|
||||||
dc h'0000000000000000' ;26
|
dc h'0000000000000000' ;26
|
||||||
dc h'0000000000000000' ;27
|
dc h'0000000000000000' ;27
|
||||||
dc h'0000000000000000' ;28
|
dc h'0000000000000000' ;28
|
||||||
dc h'0000000000000000' ;29
|
dc h'0000000000000000' ;29
|
||||||
dc c'sigusr1',h'00' ;30
|
dc c'sigusr1',h'00' ;30
|
||||||
dc c'sigusr2',h'00' ;31
|
dc c'sigusr2',h'00' ;31
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
|
@ -1148,7 +1148,7 @@ names dc c'sighup',h'0000' ;1
|
||||||
|
|
||||||
fg START
|
fg START
|
||||||
|
|
||||||
using pdata
|
using pdata
|
||||||
using global
|
using global
|
||||||
|
|
||||||
pid equ 0
|
pid equ 0
|
||||||
|
@ -1262,7 +1262,7 @@ err03 dc c'fg: No such job.',h'0d00'
|
||||||
|
|
||||||
bg START
|
bg START
|
||||||
|
|
||||||
using pdata
|
using pdata
|
||||||
using global
|
using global
|
||||||
|
|
||||||
pid equ 0
|
pid equ 0
|
||||||
|
@ -1327,7 +1327,7 @@ dofg1 anop
|
||||||
beq dobg0
|
beq dobg0
|
||||||
; lda [p],y
|
; lda [p],y
|
||||||
eor #PFOREGND
|
eor #PFOREGND
|
||||||
sta [p],y
|
sta [p],y
|
||||||
dobg0 anop
|
dobg0 anop
|
||||||
; lda [p],y
|
; lda [p],y
|
||||||
bit #PSTOPPED
|
bit #PSTOPPED
|
||||||
|
@ -1379,7 +1379,7 @@ err03 dc c'bg: No such job.',h'0d00'
|
||||||
|
|
||||||
stop START
|
stop START
|
||||||
|
|
||||||
using pdata
|
using pdata
|
||||||
using global
|
using global
|
||||||
|
|
||||||
pid equ 0
|
pid equ 0
|
||||||
|
@ -1549,11 +1549,11 @@ stat0 jsr puts
|
||||||
lda signum
|
lda signum
|
||||||
beq sig0
|
beq sig0
|
||||||
if2 @a,ne,#SIGTTIN,sig2
|
if2 @a,ne,#SIGTTIN,sig2
|
||||||
ldx #^sigttinstr
|
ldx #^sigttinstr
|
||||||
lda #sigttinstr
|
lda #sigttinstr
|
||||||
bra sig1
|
bra sig1
|
||||||
sig2 if2 @a,ne,#SIGTTOU,sig3
|
sig2 if2 @a,ne,#SIGTTOU,sig3
|
||||||
ldx #^sigttoustr
|
ldx #^sigttoustr
|
||||||
lda #sigttoustr
|
lda #sigttoustr
|
||||||
bra sig1
|
bra sig1
|
||||||
sig3 ldx #^sigotherstr
|
sig3 ldx #^sigotherstr
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: main.asm,v 1.6 1998/08/03 17:30:22 tribby Exp $
|
* $Id: main.asm,v 1.7 1998/09/08 16:53:11 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -29,8 +29,8 @@
|
||||||
|
|
||||||
; Segment for direct-page and stack
|
; Segment for direct-page and stack
|
||||||
|
|
||||||
stack data STACK ; ends up in main.root
|
stack data STACK ; ends up in main.root
|
||||||
kind $12
|
kind $12
|
||||||
|
|
||||||
; Define direct-page/stack and fill it with question marks it can be
|
; Define direct-page/stack and fill it with question marks it can be
|
||||||
; examined for how much is used.
|
; examined for how much is used.
|
||||||
|
@ -60,7 +60,7 @@ init START
|
||||||
|
|
||||||
|
|
||||||
MAIN START
|
MAIN START
|
||||||
|
|
||||||
using global
|
using global
|
||||||
|
|
||||||
p equ 0
|
p equ 0
|
||||||
|
@ -85,7 +85,7 @@ argloop dec argc Decrement argument count.
|
||||||
beq go_start If none left, ready to start working.
|
beq go_start If none left, ready to start working.
|
||||||
clc
|
clc
|
||||||
lda argv Point to next
|
lda argv Point to next
|
||||||
adc #4 argument pointer.
|
adc #4 argument pointer.
|
||||||
sta argv
|
sta argv
|
||||||
ldy #2
|
ldy #2
|
||||||
lda [argv] Set arg to point to
|
lda [argv] Set arg to point to
|
||||||
|
@ -116,7 +116,7 @@ cmd0 lda [arg],y
|
||||||
sta [p],y
|
sta [p],y
|
||||||
iny
|
iny
|
||||||
bra cmd0
|
bra cmd0
|
||||||
cmd1 lda #' '
|
cmd1 lda #' '
|
||||||
sta [p],y
|
sta [p],y
|
||||||
sec ;inc a
|
sec ;inc a
|
||||||
tya
|
tya
|
||||||
|
@ -126,7 +126,7 @@ cmd1 lda #' '
|
||||||
beq cmd2
|
beq cmd2
|
||||||
clc
|
clc
|
||||||
lda argv
|
lda argv
|
||||||
adc #4
|
adc #4
|
||||||
sta argv
|
sta argv
|
||||||
ldy #2
|
ldy #2
|
||||||
lda [argv]
|
lda [argv]
|
||||||
|
@ -166,7 +166,7 @@ nextarg cpy #1
|
||||||
jmp argloop
|
jmp argloop
|
||||||
|
|
||||||
; Option = "-c": execute shell commands found in file named by next argument
|
; Option = "-c": execute shell commands found in file named by next argument
|
||||||
parsec clc
|
parsec clc
|
||||||
lda argv
|
lda argv
|
||||||
adc #4
|
adc #4
|
||||||
sta argv
|
sta argv
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: mmdebug.asm,v 1.3 1998/08/03 17:30:23 tribby Exp $
|
* $Id: mmdebug.asm,v 1.5 1998/12/21 23:57:07 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -65,7 +65,7 @@ newh anop
|
||||||
stx hand preserving contents of
|
stx hand preserving contents of
|
||||||
plx possible error code
|
plx possible error code
|
||||||
stx hand+2 in accumulator.
|
stx hand+2 in accumulator.
|
||||||
|
|
||||||
bcc deref If there is a MM error,
|
bcc deref If there is a MM error,
|
||||||
brk $A2 allocation error #2.
|
brk $A2 allocation error #2.
|
||||||
foul stz ptr
|
foul stz ptr
|
||||||
|
@ -130,13 +130,13 @@ ckptr lda [hand] Dereference the
|
||||||
sta checkptr found handle.
|
sta checkptr found handle.
|
||||||
ldy #2
|
ldy #2
|
||||||
lda [hand],y
|
lda [hand],y
|
||||||
sta checkptr+2
|
sta checkptr+2
|
||||||
|
|
||||||
cmp ptr+2 If the pointer isn't
|
cmp ptr+2 If the pointer isn't
|
||||||
bne errD3 the first byte
|
bne errD3 the first byte
|
||||||
lda checkptr of the handle,
|
lda checkptr of the handle,
|
||||||
cmp ptr there is a problem.
|
cmp ptr there is a problem.
|
||||||
beq chkid
|
beq chkid
|
||||||
errD3 brk $D3
|
errD3 brk $D3
|
||||||
bra goback
|
bra goback
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: orca.asm,v 1.5 1998/08/03 17:30:22 tribby Exp $
|
* $Id: orca.asm,v 1.6 1998/09/08 16:53:12 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -58,38 +58,38 @@ space equ outPath+4
|
||||||
lda argc Make sure there are two or
|
lda argc Make sure there are two or
|
||||||
cmp #2 more parameters.
|
cmp #2 more parameters.
|
||||||
bcs enoughparms Otherwise,
|
bcs enoughparms Otherwise,
|
||||||
ldx #^enofile report error:
|
ldx #^enofile report error:
|
||||||
lda #enofile no filename specified
|
lda #enofile no filename specified
|
||||||
jsr errputs
|
jsr errputs
|
||||||
lda #1
|
lda #1
|
||||||
bra seterr
|
bra seterr
|
||||||
|
|
||||||
|
|
||||||
; Allocate memory for sFile, inPath, and outPath
|
; Allocate memory for sFile, inPath, and outPath
|
||||||
|
|
||||||
enoughparms anop
|
enoughparms anop
|
||||||
jsl alloc1024
|
jsl alloc1024
|
||||||
sta sFile
|
sta sFile
|
||||||
stx sFile+2
|
stx sFile+2
|
||||||
ora sFile+2
|
ora sFile+2
|
||||||
beq memerr1
|
beq memerr1
|
||||||
|
|
||||||
jsl alloc1024
|
jsl alloc1024
|
||||||
sta inPath
|
sta inPath
|
||||||
stx inPath+2
|
stx inPath+2
|
||||||
ora inPath+2
|
ora inPath+2
|
||||||
beq memerr1
|
beq memerr1
|
||||||
|
|
||||||
jsl alloc1024
|
jsl alloc1024
|
||||||
sta outPath
|
sta outPath
|
||||||
stx outPath+2
|
stx outPath+2
|
||||||
ora outPath+2
|
ora outPath+2
|
||||||
bne noerr1
|
bne noerr1
|
||||||
|
|
||||||
memerr1 ldx #^enomem Report error:
|
memerr1 ldx #^enomem Report error:
|
||||||
lda #enomem out of memory
|
lda #enomem out of memory
|
||||||
jsr errputs
|
jsr errputs
|
||||||
lda #-1
|
lda #-1
|
||||||
seterr sta retval
|
seterr sta retval
|
||||||
jmp goaway
|
jmp goaway
|
||||||
|
|
||||||
|
@ -97,9 +97,9 @@ seterr sta retval
|
||||||
; Ready to start processing the filename(s).
|
; Ready to start processing the filename(s).
|
||||||
noerr1 anop
|
noerr1 anop
|
||||||
stz retval Zero return status
|
stz retval Zero return status
|
||||||
stz sLen and length of source names.
|
stz sLen and length of source names.
|
||||||
|
|
||||||
lda #1 Initialize parameter
|
lda #1 Initialize parameter
|
||||||
sta pnum number to 1.
|
sta pnum number to 1.
|
||||||
|
|
||||||
lda sFile strPtr = sFile + 2
|
lda sFile strPtr = sFile + 2
|
||||||
|
@ -115,7 +115,7 @@ noerr1 anop
|
||||||
; Loop for getting name, converting it to a full path, and
|
; Loop for getting name, converting it to a full path, and
|
||||||
; appending it to sFile
|
; appending it to sFile
|
||||||
|
|
||||||
doloop short m Between parameters:
|
doloop short m Between parameters:
|
||||||
lda #10 Store newline as delimiter
|
lda #10 Store newline as delimiter
|
||||||
sta [strPtr] character in strPtr.
|
sta [strPtr] character in strPtr.
|
||||||
long m
|
long m
|
||||||
|
@ -123,20 +123,20 @@ doloop short m Between parameters:
|
||||||
incad strPtr and pointer.
|
incad strPtr and pointer.
|
||||||
|
|
||||||
nodelimit anop
|
nodelimit anop
|
||||||
lda pnum Get parameter number
|
lda pnum Get parameter number
|
||||||
asl a and turn it into an
|
asl a and turn it into an
|
||||||
asl a index to the proper
|
asl a index to the proper
|
||||||
tay argv pointer.
|
tay argv pointer.
|
||||||
lda [argv],y Store address in
|
lda [argv],y Store address in
|
||||||
sta argLoopPtr direct page variable
|
sta argLoopPtr direct page variable
|
||||||
iny2 argLoopPtr.
|
iny2 argLoopPtr.
|
||||||
lda [argv],y
|
lda [argv],y
|
||||||
sta argLoopPtr+2
|
sta argLoopPtr+2
|
||||||
|
|
||||||
lda inPath Get address of text field
|
lda inPath Get address of text field
|
||||||
clc in inPath.
|
clc in inPath.
|
||||||
adc #2
|
adc #2
|
||||||
sta inLoopPtr
|
sta inLoopPtr
|
||||||
lda inPath+2
|
lda inPath+2
|
||||||
adc #0
|
adc #0
|
||||||
sta inLoopPtr+2
|
sta inLoopPtr+2
|
||||||
|
@ -147,22 +147,22 @@ nodelimit anop
|
||||||
|
|
||||||
whileloop lda [argLoopPtr],y Get next character of name.
|
whileloop lda [argLoopPtr],y Get next character of name.
|
||||||
and #$00FF If it's the terminating null,
|
and #$00FF If it's the terminating null,
|
||||||
beq donewhile done copying.
|
beq donewhile done copying.
|
||||||
|
|
||||||
sta [inLoopPtr],y Store character (and null byte)
|
sta [inLoopPtr],y Store character (and null byte)
|
||||||
iny
|
iny
|
||||||
cpy #255 If < 255,
|
cpy #255 If < 255,
|
||||||
bcc whileloop stay in loop.
|
bcc whileloop stay in loop.
|
||||||
|
|
||||||
ldx #^einval Print error:
|
ldx #^einval Print error:
|
||||||
lda #einval invalid argument (filename too long)
|
lda #einval invalid argument (filename too long)
|
||||||
jsr errputs
|
jsr errputs
|
||||||
lda #2
|
lda #2
|
||||||
bra seterr
|
bra seterr
|
||||||
|
|
||||||
donewhile tya Set length of GS/OS string inPath.
|
donewhile tya Set length of GS/OS string inPath.
|
||||||
sta [inPath]
|
sta [inPath]
|
||||||
lda #1024 Set max len of result buffer outPath.
|
lda #1024 Set max len of result buffer outPath.
|
||||||
sta [outPath]
|
sta [outPath]
|
||||||
|
|
||||||
; Set up GS/OS ExpandPath parameter buffer and make call.
|
; Set up GS/OS ExpandPath parameter buffer and make call.
|
||||||
|
@ -180,14 +180,14 @@ donewhile tya Set length of GS/OS string inPath.
|
||||||
sta pathLen and store in pathLen.
|
sta pathLen and store in pathLen.
|
||||||
clc
|
clc
|
||||||
adc sLen If accumulated length is
|
adc sLen If accumulated length is
|
||||||
cmp #MAXPARMBUF beyond the maximum,
|
cmp #MAXPARMBUF beyond the maximum,
|
||||||
bcs doloopend don't add this name.
|
bcs doloopend don't add this name.
|
||||||
|
|
||||||
sta sLen Store accumulated length in sLen.
|
sta sLen Store accumulated length in sLen.
|
||||||
|
|
||||||
pei (pathLen) Append outPath string
|
pei (pathLen) Append outPath string
|
||||||
pei (outPath+2) to the end of sFile's text.
|
pei (outPath+2) to the end of sFile's text.
|
||||||
lda outPath
|
lda outPath
|
||||||
clc
|
clc
|
||||||
adc #4
|
adc #4
|
||||||
pha
|
pha
|
||||||
|
@ -195,7 +195,7 @@ donewhile tya Set length of GS/OS string inPath.
|
||||||
pei (strPtr)
|
pei (strPtr)
|
||||||
jsl rmemcpy
|
jsl rmemcpy
|
||||||
|
|
||||||
lda strPtr Add pathLen to strPtr.
|
lda strPtr Add pathLen to strPtr.
|
||||||
clc
|
clc
|
||||||
adc pathLen
|
adc pathLen
|
||||||
sta strPtr
|
sta strPtr
|
||||||
|
@ -203,28 +203,28 @@ donewhile tya Set length of GS/OS string inPath.
|
||||||
adc #0
|
adc #0
|
||||||
sta strPtr+2
|
sta strPtr+2
|
||||||
|
|
||||||
doloopend inc pnum pnum++
|
doloopend inc pnum pnum++
|
||||||
lda pnum if pnum < argc,
|
lda pnum if pnum < argc,
|
||||||
cmp argc
|
cmp argc
|
||||||
jcc doloop continue processing filenames.
|
jcc doloop continue processing filenames.
|
||||||
|
|
||||||
; All of the arguments have been processed.
|
; All of the arguments have been processed.
|
||||||
|
|
||||||
lda sLen Save length in
|
lda sLen Save length in
|
||||||
sta [sFile] GS/OS buffer.
|
sta [sFile] GS/OS buffer.
|
||||||
|
|
||||||
; Set up shell SetLInfo parameter buffer and make call.
|
; Set up shell SetLInfo parameter buffer and make call.
|
||||||
|
|
||||||
mv4 sFile,gl_sFile
|
mv4 sFile,gl_sFile
|
||||||
SetLInfoGS gl Set the edit environment.
|
SetLInfoGS gl Set the edit environment.
|
||||||
|
|
||||||
ph4 #editorvar Get value of environment
|
ph4 #editorvar Get value of environment
|
||||||
jsl getenv variable "editor".
|
jsl getenv variable "editor".
|
||||||
sta editcommand
|
sta editcommand
|
||||||
stx editcommand+2
|
stx editcommand+2
|
||||||
ora editcommand+2
|
ora editcommand+2
|
||||||
bne goteditvar If $editor is not defined,
|
bne goteditvar If $editor is not defined,
|
||||||
ph4 #defedit use default value.
|
ph4 #defedit use default value.
|
||||||
bra execit
|
bra execit
|
||||||
|
|
||||||
goteditvar anop Add 4 to value returned by getenv
|
goteditvar anop Add 4 to value returned by getenv
|
||||||
|
@ -239,7 +239,7 @@ nobump anop
|
||||||
pha
|
pha
|
||||||
execit ph2 #0 Tells execute we're called by system
|
execit ph2 #0 Tells execute we're called by system
|
||||||
jsl execute
|
jsl execute
|
||||||
sta retval
|
sta retval
|
||||||
|
|
||||||
lda editcommand If getenv allocated it,
|
lda editcommand If getenv allocated it,
|
||||||
ora editcommand+2
|
ora editcommand+2
|
||||||
|
@ -247,28 +247,28 @@ execit ph2 #0 Tells execute we're called by system
|
||||||
|
|
||||||
pei (editcommand+2) free the "editcommand" string.
|
pei (editcommand+2) free the "editcommand" string.
|
||||||
pei (editcommand)
|
pei (editcommand)
|
||||||
jsl nullfree
|
jsl nullfree
|
||||||
|
|
||||||
|
|
||||||
; See which GS/OS buffers need to be deallocated
|
; See which GS/OS buffers need to be deallocated
|
||||||
|
|
||||||
goaway lda sFile
|
goaway lda sFile
|
||||||
ora sFile+2
|
ora sFile+2
|
||||||
beq donedealloc
|
beq donedealloc
|
||||||
ldx sFile+2
|
ldx sFile+2
|
||||||
lda sFile
|
lda sFile
|
||||||
jsl free1024
|
jsl free1024
|
||||||
|
|
||||||
lda inPath
|
lda inPath
|
||||||
ora inPath+2
|
ora inPath+2
|
||||||
beq donedealloc
|
beq donedealloc
|
||||||
ldx inPath+2
|
ldx inPath+2
|
||||||
lda inPath
|
lda inPath
|
||||||
jsl free1024
|
jsl free1024
|
||||||
|
|
||||||
lda outPath
|
lda outPath
|
||||||
ora outPath+2
|
ora outPath+2
|
||||||
beq donedealloc
|
beq donedealloc
|
||||||
ldx outPath+2
|
ldx outPath+2
|
||||||
lda outPath
|
lda outPath
|
||||||
jsl free1024
|
jsl free1024
|
||||||
|
@ -276,7 +276,7 @@ goaway lda sFile
|
||||||
|
|
||||||
; Return to caller with status set to value in retval
|
; Return to caller with status set to value in retval
|
||||||
|
|
||||||
donedealloc return 2:retval
|
donedealloc return 2:retval
|
||||||
|
|
||||||
|
|
||||||
; Parameter block for GS/OS ExpandPath call (p. 140 in GS/OS Reference)
|
; Parameter block for GS/OS ExpandPath call (p. 140 in GS/OS Reference)
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: prompt.asm,v 1.5 1998/08/03 17:30:23 tribby Exp $
|
* $Id: prompt.asm,v 1.6 1998/09/08 16:53:12 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -28,7 +28,7 @@ dummyprompt start ; ends up in .root
|
||||||
|
|
||||||
setcom 60
|
setcom 60
|
||||||
|
|
||||||
WritePrompt START
|
WritePrompt START
|
||||||
|
|
||||||
using HistoryData
|
using HistoryData
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ 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 If "precmd" alias is defined,
|
ph4 #precmdstr If "precmd" alias is defined,
|
||||||
jsl findalias
|
jsl findalias
|
||||||
|
@ -66,8 +66,8 @@ precmd equ prompt
|
||||||
getvar ph4 #promptname
|
getvar ph4 #promptname
|
||||||
jsl getenv
|
jsl getenv
|
||||||
|
|
||||||
php Turn off interrupts: mutex
|
php Turn off interrupts: mutex
|
||||||
sei won't do what we want!
|
sei won't do what we want!
|
||||||
|
|
||||||
sta promptgsbuf Save pointer to GS/OS result buffer.
|
sta promptgsbuf Save pointer to GS/OS result buffer.
|
||||||
stx promptgsbuf+2 If there is no memory to hold it,
|
stx promptgsbuf+2 If there is no memory to hold it,
|
||||||
|
@ -76,12 +76,12 @@ getvar ph4 #promptname
|
||||||
ldx #^dfltPrompt
|
ldx #^dfltPrompt
|
||||||
lda #dfltPrompt
|
lda #dfltPrompt
|
||||||
jsr puts print the default prompt
|
jsr puts print the default prompt
|
||||||
bra donemark2 and exit.
|
bra donemark2 and exit.
|
||||||
|
|
||||||
;
|
;
|
||||||
; Prompt string begins in result buffer after the two length words
|
; Prompt string begins in result buffer after the two length words
|
||||||
;
|
;
|
||||||
parseprompt anop
|
parseprompt anop
|
||||||
clc
|
clc
|
||||||
lda promptgsbuf
|
lda promptgsbuf
|
||||||
adc #4
|
adc #4
|
||||||
|
@ -90,20 +90,20 @@ parseprompt anop
|
||||||
adc #0
|
adc #0
|
||||||
sta prompt+2
|
sta prompt+2
|
||||||
|
|
||||||
promptloop lda [prompt]
|
promptloop lda [prompt]
|
||||||
incad prompt
|
incad prompt
|
||||||
and #$FF
|
and #$FF
|
||||||
beq done
|
beq done
|
||||||
cmp #'%'
|
cmp #'%'
|
||||||
beq special
|
beq special
|
||||||
cmp #'!'
|
cmp #'!'
|
||||||
jeq phist
|
jeq phist
|
||||||
cmp #'\'
|
cmp #'\'
|
||||||
jeq quoteit
|
jeq quoteit
|
||||||
_putchar jsr putchar
|
_putchar jsr putchar
|
||||||
bra promptloop
|
bra promptloop
|
||||||
|
|
||||||
done jsr standend
|
done jsr standend
|
||||||
jsr cursoron
|
jsr cursoron
|
||||||
|
|
||||||
donemark2 anop
|
donemark2 anop
|
||||||
|
@ -118,115 +118,115 @@ donemark2 anop
|
||||||
;
|
;
|
||||||
; Previous character was a "%". Handle special character flags
|
; Previous character was a "%". Handle special character flags
|
||||||
;
|
;
|
||||||
special lda [prompt] Get character following "%".
|
special lda [prompt] Get character following "%".
|
||||||
incad prompt
|
incad prompt
|
||||||
and #$FF
|
and #$FF
|
||||||
beq done If end of string, all done.
|
beq done If end of string, all done.
|
||||||
cmp #'%' If another "%",
|
cmp #'%' If another "%",
|
||||||
beq _putchar print the "%"
|
beq _putchar print the "%"
|
||||||
cmp #'h' If 'h'
|
cmp #'h' If 'h'
|
||||||
beq phist
|
beq phist
|
||||||
cmp #'!' or '!',
|
cmp #'!' or '!',
|
||||||
beq phist print history number.
|
beq phist print history number.
|
||||||
cmp #'t' If 't'
|
cmp #'t' If 't'
|
||||||
beq ptime
|
beq ptime
|
||||||
cmp #'@' or '@',
|
cmp #'@' or '@',
|
||||||
beq ptime print time (am/pm format)
|
beq ptime print time (am/pm format)
|
||||||
cmp #'S' If 'S',
|
cmp #'S' If 'S',
|
||||||
jeq pstandout turn inverse mode on.
|
jeq pstandout turn inverse mode on.
|
||||||
cmp #'s' If 's',
|
cmp #'s' If 's',
|
||||||
jeq pstandend turn inverse mode off.
|
jeq pstandend turn inverse mode off.
|
||||||
cmp #'U' If 'U',
|
cmp #'U' If 'U',
|
||||||
jeq punderline turn underline mode on.
|
jeq punderline turn underline mode on.
|
||||||
cmp #'u' If 'u',
|
cmp #'u' If 'u',
|
||||||
jeq punderend turn underline mode off
|
jeq punderend turn underline mode off
|
||||||
cmp #'d' If 'd'
|
cmp #'d' If 'd'
|
||||||
jeq pcwd
|
jeq pcwd
|
||||||
cmp #'/' or '/',
|
cmp #'/' or '/',
|
||||||
jeq pcwd print working directory.
|
jeq pcwd print working directory.
|
||||||
cmp #'c' If 'c'
|
cmp #'c' If 'c'
|
||||||
jeq pcwdend
|
jeq pcwdend
|
||||||
cmp #'C' or 'C'
|
cmp #'C' or 'C'
|
||||||
jeq pcwdend
|
jeq pcwdend
|
||||||
cmp #'.' or '.',
|
cmp #'.' or '.',
|
||||||
jeq pcwdend print final part of wrk dir.
|
jeq pcwdend print final part of wrk dir.
|
||||||
cmp #'n' If 'n',
|
cmp #'n' If 'n',
|
||||||
jeq puser print $USER
|
jeq puser print $USER
|
||||||
cmp #'W' If 'W',
|
cmp #'W' If 'W',
|
||||||
jeq pdate1 print date (mm/dd/yy)
|
jeq pdate1 print date (mm/dd/yy)
|
||||||
cmp #'D' If 'D',
|
cmp #'D' If 'D',
|
||||||
jeq pdate2 print date (yy-mm-dd)
|
jeq pdate2 print date (yy-mm-dd)
|
||||||
cmp #'~' If '~',
|
cmp #'~' If '~',
|
||||||
jeq ptilde print wrk dir with ~ subs.
|
jeq ptilde print wrk dir with ~ subs.
|
||||||
jmp promptloop If none of these characters, ignore it.
|
jmp promptloop If none of these characters, ignore it.
|
||||||
|
|
||||||
;
|
;
|
||||||
; Put history number
|
; Put history number
|
||||||
;
|
;
|
||||||
phist lda lasthist
|
phist lda lasthist
|
||||||
inc a
|
inc a
|
||||||
jsr WriteNum
|
jsr WriteNum
|
||||||
jmp promptloop
|
jmp promptloop
|
||||||
|
|
||||||
;
|
;
|
||||||
; Print current time
|
; Print current time
|
||||||
;
|
;
|
||||||
ptime ReadTimeHex (minute,hour,@a,@a)
|
ptime ReadTimeHex (minute,hour,@a,@a)
|
||||||
lda hour
|
lda hour
|
||||||
and #$FF
|
and #$FF
|
||||||
if2 @a,cc,#13,ptime2
|
if2 @a,cc,#13,ptime2
|
||||||
sub2 @a,#12,@a
|
sub2 @a,#12,@a
|
||||||
ptime2 if2 @a,ne,#0,ptime2b
|
ptime2 if2 @a,ne,#0,ptime2b
|
||||||
lda #12
|
lda #12
|
||||||
ptime2b jsr WriteNum
|
ptime2b jsr WriteNum
|
||||||
lda #':'
|
lda #':'
|
||||||
jsr putchar
|
jsr putchar
|
||||||
lda minute
|
lda minute
|
||||||
xba
|
xba
|
||||||
and #$FF
|
and #$FF
|
||||||
pha
|
pha
|
||||||
cmp #10
|
cmp #10
|
||||||
bcs ptime2a
|
bcs ptime2a
|
||||||
lda #'0'
|
lda #'0'
|
||||||
jsr putchar
|
jsr putchar
|
||||||
ptime2a pla
|
ptime2a pla
|
||||||
jsr WriteNum
|
jsr WriteNum
|
||||||
lda hour
|
lda hour
|
||||||
and #$FF
|
and #$FF
|
||||||
if2 @a,cs,#12,ptime3
|
if2 @a,cs,#12,ptime3
|
||||||
ptime5 lda #'a'
|
ptime5 lda #'a'
|
||||||
bra ptime4
|
bra ptime4
|
||||||
ptime3 lda #'p'
|
ptime3 lda #'p'
|
||||||
ptime4 jsr putchar
|
ptime4 jsr putchar
|
||||||
lda #'m'
|
lda #'m'
|
||||||
jmp _putchar
|
jmp _putchar
|
||||||
|
|
||||||
;
|
;
|
||||||
; Set Stand Out (turn on inverse mode)
|
; Set Stand Out (turn on inverse mode)
|
||||||
;
|
;
|
||||||
pstandout jsr standout
|
pstandout jsr standout
|
||||||
jmp promptloop
|
jmp promptloop
|
||||||
;
|
;
|
||||||
; UnSet Stand Out (turn off inverse mode)
|
; UnSet Stand Out (turn off inverse mode)
|
||||||
;
|
;
|
||||||
pstandend jsr standend
|
pstandend jsr standend
|
||||||
jmp promptloop
|
jmp promptloop
|
||||||
;
|
;
|
||||||
; Set Underline
|
; Set Underline
|
||||||
;
|
;
|
||||||
punderline jsr underline
|
punderline jsr underline
|
||||||
jmp promptloop
|
jmp promptloop
|
||||||
;
|
;
|
||||||
; UnSet Underline
|
; UnSet Underline
|
||||||
;
|
;
|
||||||
punderend jsr underend
|
punderend jsr underend
|
||||||
jmp promptloop
|
jmp promptloop
|
||||||
;
|
;
|
||||||
; Current working directory
|
; Current working directory
|
||||||
;
|
;
|
||||||
pcwd anop
|
pcwd anop
|
||||||
pea 0
|
pea 0
|
||||||
jsl getpfxstr Get value of prefix 0.
|
jsl getpfxstr Get value of prefix 0.
|
||||||
sta pfx
|
sta pfx
|
||||||
stx pfx+2
|
stx pfx+2
|
||||||
|
|
||||||
|
@ -234,8 +234,8 @@ pcwd anop
|
||||||
jeq promptloop an error was reported.
|
jeq promptloop an error was reported.
|
||||||
|
|
||||||
ldy #4 Text starts at byte 4.
|
ldy #4 Text starts at byte 4.
|
||||||
pcwd1 lda [pfx],y Get next
|
pcwd1 lda [pfx],y Get next
|
||||||
and #$FF character.
|
and #$FF character.
|
||||||
beq freepfx Done when at end of string.
|
beq freepfx Done when at end of string.
|
||||||
jsr toslash Convert to slash.
|
jsr toslash Convert to slash.
|
||||||
phy Hold index on stack
|
phy Hold index on stack
|
||||||
|
@ -246,50 +246,50 @@ pcwd1 lda [pfx],y Get next
|
||||||
|
|
||||||
freepfx ph4 pfx Free the current directory buffer.
|
freepfx ph4 pfx Free the current directory buffer.
|
||||||
jsl nullfree
|
jsl nullfree
|
||||||
jmp promptloop
|
jmp promptloop
|
||||||
|
|
||||||
;
|
;
|
||||||
; Tail of current working directory
|
; Tail of current working directory
|
||||||
;
|
;
|
||||||
pcwdend anop
|
pcwdend anop
|
||||||
pea 0
|
pea 0
|
||||||
jsl getpfxstr Get value of prefix 0.
|
jsl getpfxstr Get value of prefix 0.
|
||||||
sta pfx
|
sta pfx
|
||||||
stx pfx+2
|
stx pfx+2
|
||||||
|
|
||||||
ora pfx+2 If NULL pointer returned,
|
ora pfx+2 If NULL pointer returned,
|
||||||
jeq promptloop an error was reported.
|
jeq promptloop an error was reported.
|
||||||
|
|
||||||
ldy #2 Get string's length word
|
ldy #2 Get string's length word
|
||||||
lda [pfx],y from bytes 2 & 3.
|
lda [pfx],y from bytes 2 & 3.
|
||||||
clc Add 3 to get offset
|
clc Add 3 to get offset
|
||||||
adc #3 from beginning of buffer.
|
adc #3 from beginning of buffer.
|
||||||
sta offset
|
sta offset
|
||||||
tay
|
tay
|
||||||
pcwdend1 dey If we've backed up to the beginning,
|
pcwdend1 dey If we've backed up to the beginning,
|
||||||
bmi pcwdend2 we can't go any further!
|
bmi pcwdend2 we can't go any further!
|
||||||
lda [pfx],y Get next character.
|
lda [pfx],y Get next character.
|
||||||
and #$FF
|
and #$FF
|
||||||
cmp #':' If it's not ':',
|
cmp #':' If it's not ':',
|
||||||
bne pcwdend1 keep searching backward.
|
bne pcwdend1 keep searching backward.
|
||||||
pcwdend2 iny
|
pcwdend2 iny
|
||||||
cpy offset
|
cpy offset
|
||||||
jeq freepfx Free the current directory buffer.
|
jeq freepfx Free the current directory buffer.
|
||||||
lda [pfx],y
|
lda [pfx],y
|
||||||
and #$FF
|
and #$FF
|
||||||
cmp #':'
|
cmp #':'
|
||||||
jeq freepfx Free the current directory buffer.
|
jeq freepfx Free the current directory buffer.
|
||||||
phy
|
phy
|
||||||
jsr putchar
|
jsr putchar
|
||||||
ply
|
ply
|
||||||
bra pcwdend2
|
bra pcwdend2
|
||||||
|
|
||||||
;
|
;
|
||||||
; Current working directory substituting '~' if necessary
|
; Current working directory substituting '~' if necessary
|
||||||
;
|
;
|
||||||
ptilde anop
|
ptilde anop
|
||||||
pea 0
|
pea 0
|
||||||
jsl getpfxstr Get value of prefix 0.
|
jsl getpfxstr Get value of prefix 0.
|
||||||
sta pfx
|
sta pfx
|
||||||
stx pfx+2
|
stx pfx+2
|
||||||
|
|
||||||
|
@ -297,7 +297,7 @@ ptilde anop
|
||||||
jeq promptloop an error was reported.
|
jeq promptloop an error was reported.
|
||||||
lda pfx Otherwise, restore low-order address.
|
lda pfx Otherwise, restore low-order address.
|
||||||
|
|
||||||
clc Add 4 to start of buffer
|
clc Add 4 to start of buffer
|
||||||
adc #4 so it can be treated like
|
adc #4 so it can be treated like
|
||||||
bcc pushad a c-string.
|
bcc pushad a c-string.
|
||||||
inx
|
inx
|
||||||
|
@ -311,10 +311,10 @@ pushad phx
|
||||||
|
|
||||||
jmp freepfx Free the current directory buffer.
|
jmp freepfx Free the current directory buffer.
|
||||||
|
|
||||||
;
|
;
|
||||||
; Write user name
|
; Write user name
|
||||||
;
|
;
|
||||||
puser ph4 #username Get value of $USER
|
puser ph4 #username Get value of $USER
|
||||||
jsl getenv
|
jsl getenv
|
||||||
sta usergsbuf If buffer wasn't allocated
|
sta usergsbuf If buffer wasn't allocated
|
||||||
stx usergsbuf+2
|
stx usergsbuf+2
|
||||||
|
@ -324,7 +324,7 @@ puser ph4 #username Get value of $USER
|
||||||
clc
|
clc
|
||||||
lda usergsbuf Text begins after
|
lda usergsbuf Text begins after
|
||||||
adc #4 four bytes of
|
adc #4 four bytes of
|
||||||
bcc printit length words.
|
bcc printit length words.
|
||||||
inx
|
inx
|
||||||
printit jsr puts
|
printit jsr puts
|
||||||
|
|
||||||
|
@ -337,56 +337,56 @@ goploop jmp promptloop
|
||||||
;
|
;
|
||||||
; Write date as mm/dd/yy
|
; Write date as mm/dd/yy
|
||||||
;
|
;
|
||||||
pdate1 ReadTimeHex (@a,year,monday,@a)
|
pdate1 ReadTimeHex (@a,year,monday,@a)
|
||||||
lda monday
|
lda monday
|
||||||
and #$FF00
|
and #$FF00
|
||||||
xba
|
xba
|
||||||
inc a
|
inc a
|
||||||
jsr WriteNum
|
jsr WriteNum
|
||||||
lda #'/'
|
lda #'/'
|
||||||
jsr putchar
|
jsr putchar
|
||||||
lda monday
|
lda monday
|
||||||
and #$FF
|
and #$FF
|
||||||
inc a
|
inc a
|
||||||
jsr WriteNum
|
jsr WriteNum
|
||||||
lda #'/'
|
lda #'/'
|
||||||
jsr putchar
|
jsr putchar
|
||||||
lda year
|
lda year
|
||||||
and #$FF00
|
and #$FF00
|
||||||
xba
|
xba
|
||||||
jsr WriteNum
|
jsr WriteNum
|
||||||
jmp promptloop
|
jmp promptloop
|
||||||
|
|
||||||
;
|
;
|
||||||
; Write date as yy-mm-dd
|
; Write date as yy-mm-dd
|
||||||
;
|
;
|
||||||
pdate2 ReadTimeHex (@a,year,monday,@a)
|
pdate2 ReadTimeHex (@a,year,monday,@a)
|
||||||
lda year
|
lda year
|
||||||
and #$FF00
|
and #$FF00
|
||||||
xba
|
xba
|
||||||
jsr WriteNum
|
jsr WriteNum
|
||||||
lda #'-'
|
lda #'-'
|
||||||
jsr putchar
|
jsr putchar
|
||||||
lda monday
|
lda monday
|
||||||
and #$FF00
|
and #$FF00
|
||||||
xba
|
xba
|
||||||
inc a
|
inc a
|
||||||
jsr WriteNum
|
jsr WriteNum
|
||||||
lda #'-'
|
lda #'-'
|
||||||
jsr putchar
|
jsr putchar
|
||||||
lda monday
|
lda monday
|
||||||
and #$FF
|
and #$FF
|
||||||
inc a
|
inc a
|
||||||
jsr WriteNum
|
jsr WriteNum
|
||||||
jmp promptloop
|
jmp promptloop
|
||||||
|
|
||||||
;
|
;
|
||||||
; check for \ quote
|
; check for \ quote
|
||||||
;
|
;
|
||||||
quoteit lda [prompt]
|
quoteit lda [prompt]
|
||||||
incad prompt
|
incad prompt
|
||||||
and #$FF
|
and #$FF
|
||||||
jeq done
|
jeq done
|
||||||
cmp #'n'
|
cmp #'n'
|
||||||
beq newline
|
beq newline
|
||||||
cmp #'r'
|
cmp #'r'
|
||||||
|
@ -402,29 +402,29 @@ tab lda #9
|
||||||
jmp _putchar
|
jmp _putchar
|
||||||
backspace lda #8
|
backspace lda #8
|
||||||
jmp _putchar
|
jmp _putchar
|
||||||
;
|
;
|
||||||
; Write a number between 0 and 9,999
|
; Write a number between 0 and 9,999
|
||||||
;
|
;
|
||||||
WriteNum cmp #10
|
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
|
||||||
|
@ -434,12 +434,12 @@ write3 Int2Dec (@a,#num,#4,#0)
|
||||||
precmdstr dc c'precmd',h'00'
|
precmdstr dc c'precmd',h'00'
|
||||||
|
|
||||||
; Names of environment variables
|
; Names of environment variables
|
||||||
promptname gsstr 'prompt'
|
promptname gsstr 'prompt'
|
||||||
username gsstr 'user'
|
username gsstr 'user'
|
||||||
|
|
||||||
; Default prompt
|
; Default prompt
|
||||||
dfltPrompt dc c'% ',h'00'
|
dfltPrompt dc c'% ',h'00'
|
||||||
|
|
||||||
num dc c'0000',h'00'
|
num dc c'0000',h'00'
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: shell.asm,v 1.5 1998/08/03 17:30:23 tribby Exp $
|
* $Id: shell.asm,v 1.6 1998/09/08 16:53:13 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -25,11 +25,11 @@
|
||||||
*
|
*
|
||||||
* shell subroutine (0:dummy)
|
* shell subroutine (0:dummy)
|
||||||
* NOTE: gnoloop is an entry defined in shell.
|
* NOTE: gnoloop is an entry defined in shell.
|
||||||
*
|
*
|
||||||
* AppendHome subroutine (4:str)
|
* AppendHome subroutine (4:str)
|
||||||
* return 4:outPtr
|
* return 4:outPtr
|
||||||
*
|
*
|
||||||
* DoLogin jsr with no parameters
|
* Dogshrc jsr with no parameters
|
||||||
*
|
*
|
||||||
* signal2 subroutine (4:fubar)
|
* signal2 subroutine (4:fubar)
|
||||||
*
|
*
|
||||||
|
@ -48,33 +48,35 @@ SIGINT gequ 2
|
||||||
SIGTSTP gequ 18
|
SIGTSTP gequ 18
|
||||||
SIGCHLD gequ 20
|
SIGCHLD gequ 20
|
||||||
|
|
||||||
cmdbuflen gequ 1024
|
cmdbuflen gequ 1024
|
||||||
|
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
* shell: entry point for acting upon commands
|
* shell: entry point for acting upon commands
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
case on
|
case on
|
||||||
shell start
|
shell start
|
||||||
case off
|
case off
|
||||||
|
|
||||||
using global
|
using global
|
||||||
using pdata
|
using pdata
|
||||||
using HistoryData
|
using HistoryData
|
||||||
using termdata
|
using termdata
|
||||||
|
using hashdata
|
||||||
p equ 0
|
|
||||||
space equ p+4
|
p equ 0 General pointer
|
||||||
|
cflag equ p+4 Flag: set when path converted
|
||||||
|
space equ cflag+2
|
||||||
|
|
||||||
subroutine (0:dummy),space
|
subroutine (0:dummy),space
|
||||||
|
|
||||||
tsc Save stack pointer
|
tsc Save stack pointer
|
||||||
sta cmdcontext in cmdcontext
|
sta cmdcontext in cmdcontext
|
||||||
tdc and direct page reg
|
tdc and direct page reg
|
||||||
sta cmddp ind cmddp.
|
sta cmddp in cmddp.
|
||||||
|
|
||||||
* PushVariables 0
|
PushVariablesGS NullPB Save environment variables.
|
||||||
|
|
||||||
Open ttyopen Open tty,
|
Open ttyopen Open tty,
|
||||||
bcc settty checking for error.
|
bcc settty checking for error.
|
||||||
|
@ -94,8 +96,8 @@ settty mv2 ttyref,gshtty
|
||||||
|
|
||||||
lda FastFlag If FastFlag is set,
|
lda FastFlag If FastFlag is set,
|
||||||
bne fastskip1 skip copyright message.
|
bne fastskip1 skip copyright message.
|
||||||
lda gshpid ; only print the copyright msg
|
lda gshpid Only print the copyright msg
|
||||||
cmp #2 ; if not using login
|
cmp #2 if not using login
|
||||||
bne fastskip1
|
bne fastskip1
|
||||||
ldx #^gnostr
|
ldx #^gnostr
|
||||||
lda #gnostr
|
lda #gnostr
|
||||||
|
@ -119,17 +121,94 @@ fastskip1 anop
|
||||||
jsr initalias Set all AliasTable entries to 0.
|
jsr initalias Set all AliasTable entries to 0.
|
||||||
jsr InitDStack Zero out directory stack.
|
jsr InitDStack Zero out directory stack.
|
||||||
jsr InitVars Set value of all env var flags.
|
jsr InitVars Set value of all env var flags.
|
||||||
|
;
|
||||||
|
; Check for login shell (argv[0] starts with '-')
|
||||||
|
;
|
||||||
|
mv4 ~COMMANDLINE,p Copy commandline addr to dir page.
|
||||||
|
ldy #8 Skip over shell identifier
|
||||||
|
lda [p],y to get first char of
|
||||||
|
and #$FF command name.
|
||||||
|
cmp #'-' If not '-',
|
||||||
|
bne nologin_init skip over login initialization.
|
||||||
|
|
||||||
|
; Change ":" to " " in $PATH if it doesn't start with ":" or contain a " "
|
||||||
|
|
||||||
|
ph4 #pathname Get $PATH environment variable string
|
||||||
|
jsl getenv
|
||||||
|
sta p Save address of allocated buffer.
|
||||||
|
stx p+2 in direct page variable
|
||||||
|
ora p+2 If null,
|
||||||
|
beq nopathconv no need to convert
|
||||||
|
|
||||||
|
stz cflag Initialize conversion flag = false.
|
||||||
|
ldy #4 Index over GS/OS length fields.
|
||||||
|
short m Use 8-bit mode.
|
||||||
|
lda [p],y
|
||||||
|
beq endpathconv If null string, or
|
||||||
|
cmp #':' if first character is ':',
|
||||||
|
beq endpathconv don't do the conversion.
|
||||||
|
|
||||||
|
bumpit iny
|
||||||
|
lda [p],y
|
||||||
|
beq endpathconv If at end of string, all done.
|
||||||
|
cmp #' ' If $PATH contains a space,
|
||||||
|
bne chkcolon
|
||||||
|
stz cflag abort the conversion.
|
||||||
|
bra endpathconv
|
||||||
|
chkcolon cmp #':' If next character is ':',
|
||||||
|
bne bumpit
|
||||||
|
lda #' ' change it to ' ', and
|
||||||
|
sta [p],y
|
||||||
|
sta cflag set conversion flag = true.
|
||||||
|
bra bumpit
|
||||||
|
|
||||||
|
endpathconv long m Back to 16-bit mode.
|
||||||
|
lda cflag If there was no conversion,
|
||||||
|
beq freepath skip the setting of $PATH.
|
||||||
|
|
||||||
|
clc Address of $PATH as a GS/OS
|
||||||
|
lda p output string is 2 bytes
|
||||||
|
adc #2 beyond the input string
|
||||||
|
sta SetValue starting address.
|
||||||
|
lda p+2
|
||||||
|
adc #0
|
||||||
|
sta SetValue+2
|
||||||
|
SetGS SetPB Set $PATH to the converted value.
|
||||||
|
|
||||||
|
freepath ph4 p Free the $PATH C string.
|
||||||
|
jsl nullfree
|
||||||
|
|
||||||
|
nopathconv anop
|
||||||
|
|
||||||
|
; Read and execute /etc/glogin
|
||||||
|
ph4 #etcglogin path = "/etc/glogin"
|
||||||
|
lda #0
|
||||||
|
pha argc = 0
|
||||||
|
pha argv = NULL
|
||||||
|
pha
|
||||||
|
pha jobflag = 0
|
||||||
|
jsl ShellExec
|
||||||
|
|
||||||
|
; Read and execute $HOME/glogin
|
||||||
|
jsr Doglogin
|
||||||
|
|
||||||
|
;
|
||||||
|
; Initialization that is not specific to login shells
|
||||||
|
;
|
||||||
|
nologin_init anop
|
||||||
lda FastFlag If fast startup flag isn't set,
|
lda FastFlag If fast startup flag isn't set,
|
||||||
bne fastskip2
|
bne fastskip2
|
||||||
jsr InitHistory Init: historyFN->"$HOME/history",
|
jsr InitHistory Init: historyFN->"$HOME/history",
|
||||||
jsr ReadHistory read in history from disk,
|
jsr ReadHistory read in history from disk,
|
||||||
jsr DoLogin and read $HOME/gshrc.
|
jsr Dogshrc and read $HOME/gshrc.
|
||||||
jsr newline
|
jsr newline
|
||||||
fastskip2 anop
|
fastskip2 anop
|
||||||
lda didReadTerm
|
lda didReadTerm
|
||||||
bne didit
|
bne didit
|
||||||
jsr readterm
|
jsr readterm
|
||||||
didit jsl hashpath ;hash $path
|
didit anop
|
||||||
|
jsl hashpath Hash $PATH.
|
||||||
|
ld2 1,hash_print Set hash print flag.
|
||||||
|
|
||||||
;
|
;
|
||||||
; Check for command-line arguments -c and -e
|
; Check for command-line arguments -c and -e
|
||||||
|
@ -162,9 +241,22 @@ cmdskip lda ExecFlag
|
||||||
ph4 ExecCmd
|
ph4 ExecCmd
|
||||||
ph2 #0
|
ph2 #0
|
||||||
jsl Execute
|
jsl Execute
|
||||||
jmp done1
|
jmp done1
|
||||||
|
|
||||||
execskip anop
|
;
|
||||||
|
; Parameter block for shell SetGS calls (p 427 in ORCA/M manual)
|
||||||
|
;
|
||||||
|
SetPB dc i2'3' pCount
|
||||||
|
dc i4'pathname' Name (pointer to GS/OS string)
|
||||||
|
SetValue ds 4 Value (pointer to GS/OS string)
|
||||||
|
dc i2'1' Export flag
|
||||||
|
|
||||||
|
pathname gsstr 'path' GS/OS string
|
||||||
|
|
||||||
|
|
||||||
|
etcglogin dc c'/etc/glogin',h'00'
|
||||||
|
|
||||||
|
execskip anop
|
||||||
|
|
||||||
****************************************************************
|
****************************************************************
|
||||||
*
|
*
|
||||||
|
@ -174,47 +266,47 @@ execskip anop
|
||||||
|
|
||||||
stz lastabort
|
stz lastabort
|
||||||
|
|
||||||
gnoloop entry
|
gnoloop entry
|
||||||
|
|
||||||
;
|
;
|
||||||
; Set the fundamental registers.
|
; Set the fundamental registers.
|
||||||
;
|
;
|
||||||
phk Copy Program Bank register
|
phk Copy Program Bank register
|
||||||
plb into Data Bank register.
|
plb into Data Bank register.
|
||||||
lda cmdcontext Set Stack Pointer and
|
lda cmdcontext Set Stack Pointer and
|
||||||
tcs Direct Page register
|
tcs Direct Page register
|
||||||
lda cmddp to values saved when
|
lda cmddp to values saved when
|
||||||
tcd entering shell.
|
tcd entering shell.
|
||||||
|
|
||||||
jsl WritePrompt Print prompt.
|
jsl WritePrompt Print prompt.
|
||||||
jsr GetCmdLine Get response.
|
jsr GetCmdLine Get response.
|
||||||
bcs done
|
bcs done
|
||||||
jsr newline
|
jsr newline
|
||||||
|
|
||||||
lda cmdlen Check for empty string.
|
lda cmdlen Check for empty string.
|
||||||
beq gnoloop
|
beq gnoloop
|
||||||
jsr cursoron
|
jsr cursoron
|
||||||
jsr newlineX
|
jsr newlineX
|
||||||
jsr flush
|
jsr flush
|
||||||
|
|
||||||
ph4 #cmdline
|
ph4 #cmdline
|
||||||
ph2 #0
|
ph2 #0
|
||||||
jsl execute
|
jsl execute
|
||||||
|
|
||||||
lda exit_requested
|
lda exit_requested
|
||||||
bne done1
|
bne done1
|
||||||
jsr newlineX
|
jsr newlineX
|
||||||
stz lastabort
|
stz lastabort
|
||||||
bra gnoloop
|
bra gnoloop
|
||||||
|
|
||||||
;
|
;
|
||||||
; shut down gsh
|
; shut down gsh
|
||||||
;
|
;
|
||||||
done jsr newline
|
done jsr newline
|
||||||
jsr newlineX
|
jsr newlineX
|
||||||
done1 ora2 pjoblist,pjoblist+2,@a
|
done1 ora2 pjoblist,pjoblist+2,@a
|
||||||
beq done2
|
beq done2
|
||||||
lda lastabort
|
lda lastabort
|
||||||
bne donekiller
|
bne donekiller
|
||||||
inc lastabort
|
inc lastabort
|
||||||
stz exit_requested
|
stz exit_requested
|
||||||
|
@ -227,22 +319,22 @@ done1 ora2 pjoblist,pjoblist+2,@a
|
||||||
donekiller jsl jobkiller
|
donekiller jsl jobkiller
|
||||||
done2 lda FastFlag
|
done2 lda FastFlag
|
||||||
bne fastskip5
|
bne fastskip5
|
||||||
jsl SaveHistory
|
jsl SaveHistory
|
||||||
fastskip5 jsr dispose_hash
|
fastskip5 jsr dispose_hash
|
||||||
|
|
||||||
quit PopVariablesGS NullPB
|
quit PopVariablesGS NullPB
|
||||||
Quit QuitParm
|
Quit QuitParm
|
||||||
|
|
||||||
QuitParm dc i'0'
|
QuitParm dc i'0'
|
||||||
|
|
||||||
; Null parameter block used for shell calls PushVariables
|
; Null parameter block used for shell calls PushVariables
|
||||||
; (ORCA/M manual p.420) and PopVariablesGS (p. 419)
|
; (ORCA/M manual p.420) and PopVariablesGS (p. 419)
|
||||||
NullPB dc i2'0' pCount
|
NullPB dc i2'0' pCount
|
||||||
|
|
||||||
gnostr dc h'0d',c'GNO/Shell 2.0.6',h'0d'
|
gnostr dc h'0d',c'GNO/Shell 2.0.6',h'0d'
|
||||||
dc c'Copyright 1991-1993, Procyon, Inc. & Tim Meekins. '
|
dc c'Copyright 1991-1993, Procyon, Inc. & Tim Meekins. '
|
||||||
dc c'ALL RIGHTS RESERVED',h'0d'
|
dc c'ALL RIGHTS RESERVED',h'0d'
|
||||||
dc h'0d00'
|
dc h'0d00'
|
||||||
stopstr dc c'gsh: There are stopped jobs.',h'0d00'
|
stopstr dc c'gsh: There are stopped jobs.',h'0d00'
|
||||||
|
|
||||||
ttyopen dc i2'2'
|
ttyopen dc i2'2'
|
||||||
|
@ -254,21 +346,28 @@ exitstr dc c'000000',h'0d00'
|
||||||
|
|
||||||
lastabort ds 2
|
lastabort ds 2
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
;
|
;
|
||||||
; Interpret the login file (gshrc).
|
; Interpret the login file (gshrc).
|
||||||
; If $HOME is set, we presume the gshrc file is there. If not,
|
; If $HOME is set, we presume the gshrc file is there. If not,
|
||||||
; or if an error occurs getting the $HOME variable, we use
|
; or if an error occurs getting the $HOME variable, we use
|
||||||
; @:gshrc.
|
; @:gshrc.
|
||||||
;
|
;
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
|
|
||||||
DoLogin START
|
Dogshrc START
|
||||||
|
|
||||||
ph4 #gshrcName
|
ph4 #gshrcName
|
||||||
jsl AppendHome
|
bra doit
|
||||||
|
|
||||||
|
; Alternate entry point: execute $HOME/glogin
|
||||||
|
|
||||||
|
Doglogin ENTRY
|
||||||
|
ph4 #gloginName
|
||||||
|
|
||||||
|
doit jsl AppendHome
|
||||||
phx Save pointer to GS/OS input
|
phx Save pointer to GS/OS input
|
||||||
pha string for later.
|
pha string for later.
|
||||||
|
|
||||||
|
@ -301,13 +400,14 @@ no_undf phx
|
||||||
rts
|
rts
|
||||||
|
|
||||||
gshrcName dc c'/gshrc',h'00'
|
gshrcName dc c'/gshrc',h'00'
|
||||||
|
gloginName dc c'/glogin',h'00'
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
;
|
;
|
||||||
; Append a C string to the value of the $HOME variable. If $HOME is
|
; 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
|
; not set, then it appends the C string to the string '@/'. Returns
|
||||||
; a pointer to a GS/OS input string.
|
; a pointer to a GS/OS input string.
|
||||||
;
|
;
|
||||||
|
@ -326,7 +426,7 @@ space equ buf_len+2
|
||||||
;
|
;
|
||||||
; Get the variable's length using ReadVariableGS
|
; Get the variable's length using ReadVariableGS
|
||||||
;
|
;
|
||||||
ld4 TempResultBuf,RVresult Use temporary result buf.
|
ld4 TempResultBuf,RVresult Use temporary result buf.
|
||||||
ReadVariableGS ReadVar Get length.
|
ReadVariableGS ReadVar Get length.
|
||||||
|
|
||||||
;
|
;
|
||||||
|
@ -362,12 +462,12 @@ notnull inc2 a Add 4 bytes for result buf len words.
|
||||||
; Read the full value into the allocated memory
|
; Read the full value into the allocated memory
|
||||||
;
|
;
|
||||||
ReadVariableGS ReadVar ReadVariable $HOME
|
ReadVariableGS ReadVar ReadVariable $HOME
|
||||||
bcs doAtSign If error, use @/
|
bcs doAtSign If error, use @/
|
||||||
|
|
||||||
ldy #2 Get length of
|
ldy #2 Get length of
|
||||||
lda [outPtr],y GS/OS string.
|
lda [outPtr],y GS/OS string.
|
||||||
beq doAtSign If $HOME not defined, use "@".
|
beq doAtSign If $HOME not defined, use "@".
|
||||||
clc
|
clc
|
||||||
adc #4 Turn into a c-string
|
adc #4 Turn into a c-string
|
||||||
tay by storing a 0 byte
|
tay by storing a 0 byte
|
||||||
short m after the last $HOME
|
short m after the last $HOME
|
||||||
|
@ -380,22 +480,22 @@ notnull inc2 a Add 4 bytes for result buf len words.
|
||||||
; $HOME is null string or not defined. Use @
|
; $HOME is null string or not defined. Use @
|
||||||
;
|
;
|
||||||
doAtSign lda atSign
|
doAtSign lda atSign
|
||||||
ldy #4
|
ldy #4
|
||||||
sta [outPtr],y
|
sta [outPtr],y
|
||||||
lda #1 Set GS/OS buffer
|
lda #1 Set GS/OS buffer
|
||||||
ldy #2 string length word
|
ldy #2 string length word
|
||||||
sta [outPtr],y to 1.
|
sta [outPtr],y to 1.
|
||||||
|
|
||||||
doAppend anop
|
doAppend anop
|
||||||
ldy #4 Start index beyond length words.
|
ldy #4 Start index beyond length words.
|
||||||
short m
|
short m
|
||||||
lp lda [outPtr],y
|
lp lda [outPtr],y
|
||||||
beq noSep
|
beq noSep
|
||||||
cmp #':'
|
cmp #':'
|
||||||
beq foundSep
|
beq foundSep
|
||||||
cmp #'/'
|
cmp #'/'
|
||||||
beq foundSep
|
beq foundSep
|
||||||
iny
|
iny
|
||||||
bra lp
|
bra lp
|
||||||
|
|
||||||
noSep lda #':' No separator found; use ":".
|
noSep lda #':' No separator found; use ":".
|
||||||
|
@ -424,7 +524,7 @@ pushptr phx
|
||||||
inc outPtr+2
|
inc outPtr+2
|
||||||
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 str_len string (parameter).
|
adc str_len string (parameter).
|
||||||
sta [outPtr]
|
sta [outPtr]
|
||||||
|
@ -449,7 +549,7 @@ ReadVar anop
|
||||||
RVresult ds 4 GS/OS Output buffer ptr
|
RVresult ds 4 GS/OS Output buffer ptr
|
||||||
ds 2 export flag (returned)
|
ds 2 export flag (returned)
|
||||||
;
|
;
|
||||||
; GS/OS result buffer for getting the full length of the PATH env var.
|
; GS/OS result buffer for getting the full length of the HOME env var.
|
||||||
;
|
;
|
||||||
TempResultBuf dc i2'5' Only five bytes total.
|
TempResultBuf dc i2'5' Only five bytes total.
|
||||||
TempRBlen ds 2 Value's length returned here.
|
TempRBlen ds 2 Value's length returned here.
|
||||||
|
@ -468,23 +568,23 @@ home gsstr 'HOME'
|
||||||
;
|
;
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
|
|
||||||
global DATA
|
global DATA
|
||||||
|
|
||||||
ID ds 2
|
ID ds 2
|
||||||
GSOSDP ds 2
|
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
|
||||||
wordbuf ds 256
|
wordbuf ds 256
|
||||||
nummatch ds 2
|
nummatch ds 2
|
||||||
matchbuf ds 512*4
|
matchbuf ds 512*4
|
||||||
cmdcontext ds 2
|
cmdcontext ds 2
|
||||||
cmddp ds 2
|
cmddp ds 2
|
||||||
gshtty ds 2
|
gshtty ds 2
|
||||||
gshpid ds 2
|
gshpid ds 2
|
||||||
exit_requested 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'
|
||||||
|
@ -494,7 +594,7 @@ CmdArgC ds 2
|
||||||
ExecFlag dc i'0'
|
ExecFlag dc i'0'
|
||||||
ExecCmd ds 4
|
ExecCmd ds 4
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
;
|
;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: shellutil.asm,v 1.5 1998/08/03 17:30:24 tribby Exp $
|
* $Id: shellutil.asm,v 1.6 1998/09/08 16:53:13 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -34,7 +34,7 @@ dummyshellutil start ; ends up in .root
|
||||||
;
|
;
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
|
|
||||||
tolower START
|
tolower START
|
||||||
|
|
||||||
cmp #'A'
|
cmp #'A'
|
||||||
bcc done
|
bcc done
|
||||||
|
@ -43,7 +43,7 @@ tolower START
|
||||||
adc #'a'-'A'
|
adc #'a'-'A'
|
||||||
done rts
|
done rts
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
;
|
;
|
||||||
|
@ -51,14 +51,14 @@ done rts
|
||||||
;
|
;
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
|
|
||||||
toslash START
|
toslash START
|
||||||
|
|
||||||
cmp #':'
|
cmp #':'
|
||||||
bne done
|
bne done
|
||||||
lda #'/'
|
lda #'/'
|
||||||
done rts
|
done rts
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
;
|
;
|
||||||
|
@ -66,42 +66,42 @@ done rts
|
||||||
;
|
;
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
|
|
||||||
lowercstr START
|
lowercstr START
|
||||||
|
|
||||||
space equ 1
|
space equ 1
|
||||||
p equ space+2
|
p equ space+2
|
||||||
end equ p+4
|
end equ p+4
|
||||||
|
|
||||||
tsc
|
tsc
|
||||||
phd
|
phd
|
||||||
tcd
|
tcd
|
||||||
|
|
||||||
short a
|
short a
|
||||||
|
|
||||||
ldy #-1
|
ldy #-1
|
||||||
loop iny
|
loop iny
|
||||||
lda [p],y
|
lda [p],y
|
||||||
beq done
|
beq done
|
||||||
cmp #'A'
|
cmp #'A'
|
||||||
bcc loop
|
bcc loop
|
||||||
cmp #'Z'+1
|
cmp #'Z'+1
|
||||||
bcs loop
|
bcs loop
|
||||||
adc #'a'-'A'
|
adc #'a'-'A'
|
||||||
sta [p],y
|
sta [p],y
|
||||||
bra loop
|
bra loop
|
||||||
|
|
||||||
done rep #$21
|
done rep #$21
|
||||||
longa on
|
longa on
|
||||||
lda space
|
lda space
|
||||||
sta end-2
|
sta end-2
|
||||||
pld
|
pld
|
||||||
tsc
|
tsc
|
||||||
adc #end-3
|
adc #end-3
|
||||||
tcs
|
tcs
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
;
|
;
|
||||||
|
@ -109,38 +109,38 @@ done rep #$21
|
||||||
;
|
;
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
|
|
||||||
cstrlen START
|
cstrlen START
|
||||||
|
|
||||||
space equ 1
|
space equ 1
|
||||||
p equ space+2
|
p equ space+2
|
||||||
end equ p+4
|
end equ p+4
|
||||||
|
|
||||||
tsc
|
tsc
|
||||||
phd
|
phd
|
||||||
tcd
|
tcd
|
||||||
|
|
||||||
short a
|
short a
|
||||||
|
|
||||||
ldy #0
|
ldy #0
|
||||||
loop lda [p],y
|
loop lda [p],y
|
||||||
beq done
|
beq done
|
||||||
iny
|
iny
|
||||||
bra loop
|
bra loop
|
||||||
|
|
||||||
done rep #$21
|
done rep #$21
|
||||||
longa on
|
longa on
|
||||||
lda space
|
lda space
|
||||||
sta end-2
|
sta end-2
|
||||||
pld
|
pld
|
||||||
tsc
|
tsc
|
||||||
adc #end-3
|
adc #end-3
|
||||||
tcs
|
tcs
|
||||||
|
|
||||||
tya
|
tya
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
;
|
;
|
||||||
|
@ -149,40 +149,40 @@ done rep #$21
|
||||||
;
|
;
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
|
|
||||||
copycstr START
|
copycstr START
|
||||||
|
|
||||||
space equ 1
|
space equ 1
|
||||||
q equ space+2
|
q equ space+2
|
||||||
p equ q+4
|
p equ q+4
|
||||||
end equ p+4
|
end equ p+4
|
||||||
|
|
||||||
tsc
|
tsc
|
||||||
phd
|
phd
|
||||||
tcd
|
tcd
|
||||||
|
|
||||||
short a
|
short a
|
||||||
|
|
||||||
ldy #0
|
ldy #0
|
||||||
loop lda [p],y
|
loop lda [p],y
|
||||||
beq done
|
beq done
|
||||||
sta [q],y
|
sta [q],y
|
||||||
iny
|
iny
|
||||||
bra loop
|
bra loop
|
||||||
|
|
||||||
done sta [q],y
|
done sta [q],y
|
||||||
|
|
||||||
rep #$21
|
rep #$21
|
||||||
longa on
|
longa on
|
||||||
lda space
|
lda space
|
||||||
sta end-2
|
sta end-2
|
||||||
pld
|
pld
|
||||||
tsc
|
tsc
|
||||||
adc #end-3
|
adc #end-3
|
||||||
tcs
|
tcs
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
;
|
;
|
||||||
|
@ -190,31 +190,31 @@ done sta [q],y
|
||||||
;
|
;
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
|
|
||||||
cmpcstr START
|
cmpcstr START
|
||||||
|
|
||||||
space equ 1
|
space equ 1
|
||||||
q equ space+2
|
q equ space+2
|
||||||
p equ q+4
|
p equ q+4
|
||||||
end equ p+4
|
end equ p+4
|
||||||
|
|
||||||
tsc
|
tsc
|
||||||
phd
|
phd
|
||||||
tcd
|
tcd
|
||||||
|
|
||||||
short a
|
short a
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
|
|
||||||
ldy #0
|
ldy #0
|
||||||
strloop lda [p],y
|
strloop lda [p],y
|
||||||
beq strchk
|
beq strchk
|
||||||
cmp [q],y
|
cmp [q],y
|
||||||
bne notequal
|
bne notequal
|
||||||
iny
|
iny
|
||||||
bra strloop
|
bra strloop
|
||||||
|
|
||||||
strchk lda [q],y
|
strchk lda [q],y
|
||||||
beq done
|
beq done
|
||||||
|
|
||||||
lessthan dex
|
lessthan dex
|
||||||
bra done
|
bra done
|
||||||
|
@ -222,19 +222,19 @@ lessthan dex
|
||||||
notequal bcc lessthan
|
notequal bcc lessthan
|
||||||
inx
|
inx
|
||||||
|
|
||||||
done rep #$21
|
done rep #$21
|
||||||
longa on
|
longa on
|
||||||
lda space
|
lda space
|
||||||
sta end-2
|
sta end-2
|
||||||
pld
|
pld
|
||||||
tsc
|
tsc
|
||||||
adc #end-3
|
adc #end-3
|
||||||
tcs
|
tcs
|
||||||
|
|
||||||
txa
|
txa
|
||||||
rts
|
rts
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
;
|
;
|
||||||
|
@ -244,37 +244,37 @@ done rep #$21
|
||||||
|
|
||||||
cmpdcstr START
|
cmpdcstr START
|
||||||
|
|
||||||
hold equ 1
|
hold equ 1
|
||||||
space equ hold+2
|
space equ hold+2
|
||||||
q equ space+2
|
q equ space+2
|
||||||
p equ q+4
|
p equ q+4
|
||||||
end equ p+4
|
end equ p+4
|
||||||
|
|
||||||
tsc
|
tsc
|
||||||
sec
|
sec
|
||||||
sbc #space-1
|
sbc #space-1
|
||||||
tcs
|
tcs
|
||||||
phd
|
phd
|
||||||
tcd
|
tcd
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
|
|
||||||
ldy #0
|
ldy #0
|
||||||
strloop lda [q],y
|
strloop lda [q],y
|
||||||
and #$FF
|
and #$FF
|
||||||
jsr tolower
|
jsr tolower
|
||||||
sta hold
|
sta hold
|
||||||
lda [p],y
|
lda [p],y
|
||||||
and #$FF
|
and #$FF
|
||||||
beq strchk
|
beq strchk
|
||||||
jsr tolower
|
jsr tolower
|
||||||
cmp hold
|
cmp hold
|
||||||
bne notequal
|
bne notequal
|
||||||
iny
|
iny
|
||||||
bra strloop
|
bra strloop
|
||||||
|
|
||||||
strchk lda hold
|
strchk lda hold
|
||||||
beq done
|
beq done
|
||||||
|
|
||||||
lessthan dex
|
lessthan dex
|
||||||
bra done
|
bra done
|
||||||
|
@ -282,19 +282,19 @@ lessthan dex
|
||||||
notequal bcc lessthan
|
notequal bcc lessthan
|
||||||
inx
|
inx
|
||||||
|
|
||||||
done anop
|
done anop
|
||||||
lda space
|
lda space
|
||||||
sta end-2
|
sta end-2
|
||||||
pld
|
pld
|
||||||
tsc
|
tsc
|
||||||
clc
|
clc
|
||||||
adc #end-3
|
adc #end-3
|
||||||
tcs
|
tcs
|
||||||
|
|
||||||
txa
|
txa
|
||||||
rts
|
rts
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
;
|
;
|
||||||
|
@ -302,55 +302,55 @@ done anop
|
||||||
;
|
;
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
|
|
||||||
c2gsstr START
|
c2gsstr START
|
||||||
|
|
||||||
len equ 1
|
len equ 1
|
||||||
gstr equ len+2
|
gstr equ len+2
|
||||||
space equ gstr+4
|
space equ gstr+4
|
||||||
cstr equ space+2
|
cstr equ space+2
|
||||||
end equ cstr+4
|
end equ cstr+4
|
||||||
|
|
||||||
tsc
|
tsc
|
||||||
sec
|
sec
|
||||||
sbc #space-1
|
sbc #space-1
|
||||||
tcs
|
tcs
|
||||||
phd
|
phd
|
||||||
tcd
|
tcd
|
||||||
|
|
||||||
pei (cstr+2)
|
pei (cstr+2)
|
||||||
pei (cstr)
|
pei (cstr)
|
||||||
jsr cstrlen
|
jsr cstrlen
|
||||||
sta len
|
sta len
|
||||||
adc #3
|
adc #3
|
||||||
pea 0
|
pea 0
|
||||||
pha
|
pha
|
||||||
~NEW
|
~NEW
|
||||||
sta gstr
|
sta gstr
|
||||||
stx gstr+2
|
stx gstr+2
|
||||||
incad @xa
|
incad @xa
|
||||||
incad @xa
|
incad @xa
|
||||||
pei (cstr+2)
|
pei (cstr+2)
|
||||||
pei (cstr)
|
pei (cstr)
|
||||||
phx
|
phx
|
||||||
pha
|
pha
|
||||||
jsr copycstr
|
jsr copycstr
|
||||||
lda len
|
lda len
|
||||||
sta [gstr]
|
sta [gstr]
|
||||||
|
|
||||||
ldx gstr+2
|
ldx gstr+2
|
||||||
ldy gstr
|
ldy gstr
|
||||||
|
|
||||||
lda space
|
lda space
|
||||||
sta end-2
|
sta end-2
|
||||||
pld
|
pld
|
||||||
tsc
|
tsc
|
||||||
adc #end-3
|
adc #end-3
|
||||||
tcs
|
tcs
|
||||||
|
|
||||||
tya
|
tya
|
||||||
rts
|
rts
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
;
|
;
|
||||||
|
@ -358,20 +358,20 @@ end equ cstr+4
|
||||||
;
|
;
|
||||||
;=========================================================================
|
;=========================================================================
|
||||||
|
|
||||||
catcstr START
|
catcstr START
|
||||||
|
|
||||||
new equ 1
|
new equ 1
|
||||||
space equ new+4
|
space equ new+4
|
||||||
q equ space+2
|
q equ space+2
|
||||||
p equ q+4
|
p equ q+4
|
||||||
end equ p+4
|
end equ p+4
|
||||||
|
|
||||||
tsc
|
tsc
|
||||||
sec
|
sec
|
||||||
sbc #space-1
|
sbc #space-1
|
||||||
tcs
|
tcs
|
||||||
phd
|
phd
|
||||||
tcd
|
tcd
|
||||||
|
|
||||||
pei (p+2)
|
pei (p+2)
|
||||||
pei (p)
|
pei (p)
|
||||||
|
@ -405,20 +405,20 @@ copy2 lda [q]
|
||||||
incad q
|
incad q
|
||||||
bra copy2
|
bra copy2
|
||||||
|
|
||||||
done ldx new+2
|
done ldx new+2
|
||||||
ldy new
|
ldy new
|
||||||
lda space
|
lda space
|
||||||
sta end-2
|
sta end-2
|
||||||
pld
|
pld
|
||||||
tsc
|
tsc
|
||||||
clc
|
clc
|
||||||
adc #end-3
|
adc #end-3
|
||||||
tcs
|
tcs
|
||||||
|
|
||||||
tya
|
tya
|
||||||
rts
|
rts
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
;=====================================================================
|
;=====================================================================
|
||||||
;
|
;
|
||||||
|
@ -427,11 +427,11 @@ done ldx new+2
|
||||||
;=====================================================================
|
;=====================================================================
|
||||||
|
|
||||||
nullfree START
|
nullfree START
|
||||||
|
|
||||||
lda 4,s
|
lda 4,s
|
||||||
ora 6,s
|
ora 6,s
|
||||||
bne ok
|
bne ok
|
||||||
lda 2,s
|
lda 2,s
|
||||||
sta 6,s
|
sta 6,s
|
||||||
lda 1,s
|
lda 1,s
|
||||||
sta 5,s
|
sta 5,s
|
||||||
|
@ -450,13 +450,13 @@ ok ~DISPOSE
|
||||||
;
|
;
|
||||||
;=====================================================================
|
;=====================================================================
|
||||||
|
|
||||||
newlineX START
|
newlineX START
|
||||||
|
|
||||||
using vardata
|
using vardata
|
||||||
|
|
||||||
lda varnewline
|
lda varnewline
|
||||||
beq newline
|
beq newline
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;=====================================================================
|
;=====================================================================
|
||||||
;
|
;
|
||||||
|
@ -464,7 +464,7 @@ newlineX START
|
||||||
;
|
;
|
||||||
;=====================================================================
|
;=====================================================================
|
||||||
|
|
||||||
newline ENTRY
|
newline ENTRY
|
||||||
|
|
||||||
lda #13
|
lda #13
|
||||||
jmp putchar
|
jmp putchar
|
||||||
|
@ -484,7 +484,7 @@ newline ENTRY
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
|
|
||||||
getenv START
|
getenv START
|
||||||
|
|
||||||
len equ 1
|
len equ 1
|
||||||
retval equ len+2
|
retval equ len+2
|
||||||
space equ retval+4
|
space equ retval+4
|
||||||
|
@ -505,7 +505,7 @@ end equ var+4
|
||||||
; Get the variable's length using ReadVariableGS
|
; Get the variable's length using ReadVariableGS
|
||||||
; Set up parameter block:
|
; Set up parameter block:
|
||||||
mv4 var,RVname Addr of name, from user.
|
mv4 var,RVname Addr of name, from user.
|
||||||
ld4 TempResultBuf,RVresult Use temporary result buf.
|
ld4 TempResultBuf,RVresult Use temporary result buf.
|
||||||
ReadVariableGS ReadVar Get length.
|
ReadVariableGS ReadVar Get length.
|
||||||
;
|
;
|
||||||
; Allocate memory for value string
|
; Allocate memory for value string
|
||||||
|
@ -565,7 +565,7 @@ exit unlock mutex
|
||||||
tya
|
tya
|
||||||
|
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
mutex key
|
mutex key
|
||||||
|
|
||||||
; Parameter block for shell ReadVariableGS call (p 423 in ORCA/M manual)
|
; Parameter block for shell ReadVariableGS call (p 423 in ORCA/M manual)
|
||||||
|
@ -604,6 +604,6 @@ lp1 lda [src],y
|
||||||
sta [dest],y
|
sta [dest],y
|
||||||
dey
|
dey
|
||||||
dey
|
dey
|
||||||
bpl lp1
|
bpl lp1
|
||||||
done return
|
done return
|
||||||
END
|
END
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
* Derek Taubert
|
* Derek Taubert
|
||||||
*
|
*
|
||||||
* $Id: shellvar.asm,v 1.5 1998/08/03 17:30:24 tribby Exp $
|
* $Id: shellvar.asm,v 1.6 1998/09/08 16:53:13 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -135,7 +135,7 @@ svwhoops ld2 $201,ErrError report memory error
|
||||||
ErrorGS Err
|
ErrorGS Err
|
||||||
jmp exit and exit.
|
jmp exit and exit.
|
||||||
|
|
||||||
startshow anop
|
startshow anop
|
||||||
lda #1022 Store buffer len == 1022 in value
|
lda #1022 Store buffer len == 1022 in value
|
||||||
sta [valbuf] buffer (save 2 bytes at end for 0).
|
sta [valbuf] buffer (save 2 bytes at end for 0).
|
||||||
lda #260 Store buffer len == 260 in name
|
lda #260 Store buffer len == 260 in name
|
||||||
|
@ -153,7 +153,7 @@ showloop ReadIndexedGS idxParm Get next indexed variable.
|
||||||
bcs bumpindx we didn't get it.
|
bcs bumpindx we didn't get it.
|
||||||
|
|
||||||
tay Store 0 at end of
|
tay Store 0 at end of
|
||||||
iny4 name string so it
|
iny4 name string so it
|
||||||
short a can be treated like
|
short a can be treated like
|
||||||
lda #0 a c-string.
|
lda #0 a c-string.
|
||||||
sta [varbuf],y
|
sta [varbuf],y
|
||||||
|
@ -212,7 +212,7 @@ orcastyle add2 argv,#4,argv Point to next argument.
|
||||||
ldy #2
|
ldy #2
|
||||||
lda [argv],y
|
lda [argv],y
|
||||||
pha
|
pha
|
||||||
lda [argv] Create GS/OS string
|
lda [argv] Create GS/OS string
|
||||||
pha that contains the value.
|
pha that contains the value.
|
||||||
bra set1 Complete operation in UNIX-style code.
|
bra set1 Complete operation in UNIX-style code.
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ orcastyle add2 argv,#4,argv Point to next argument.
|
||||||
; UNIX style set. Uses two arguments separated by "=".
|
; UNIX style set. Uses two arguments separated by "=".
|
||||||
; When we get here, Y-reg = index of "=" character.
|
; When we get here, Y-reg = index of "=" character.
|
||||||
;
|
;
|
||||||
unixstyle cpy #0
|
unixstyle cpy #0
|
||||||
bne unix0
|
bne unix0
|
||||||
ldx #^error1
|
ldx #^error1
|
||||||
lda #error1 Print error message:
|
lda #error1 Print error message:
|
||||||
|
@ -248,7 +248,7 @@ set1 jsr c2gsstr Convert value to GS/OS string.
|
||||||
|
|
||||||
lda exflag Set export flag in parameter block.
|
lda exflag Set export flag in parameter block.
|
||||||
sta RSexport
|
sta RSexport
|
||||||
|
|
||||||
SetGS ReadSetVar Set variable value & export flag.
|
SetGS ReadSetVar Set variable value & export flag.
|
||||||
|
|
||||||
pei (arg+2)
|
pei (arg+2)
|
||||||
|
@ -288,10 +288,10 @@ showonevar anop
|
||||||
stx varbuf+2
|
stx varbuf+2
|
||||||
sta RSname
|
sta RSname
|
||||||
stx RSname+2
|
stx RSname+2
|
||||||
|
|
||||||
stz RSexport
|
stz RSexport
|
||||||
|
|
||||||
ReadVariableGS ReadSetVar Read value of variable.
|
ReadVariableGS ReadSetVar Read value of variable.
|
||||||
|
|
||||||
lda RSexport If export flag is set, it's defined.
|
lda RSexport If export flag is set, it's defined.
|
||||||
bne def
|
bne def
|
||||||
|
@ -314,7 +314,7 @@ doneone anop
|
||||||
ldx valbuf+2
|
ldx valbuf+2
|
||||||
lda valbuf
|
lda valbuf
|
||||||
jsl free1024 Free valbuf.
|
jsl free1024 Free valbuf.
|
||||||
ph4 varbuf
|
ph4 varbuf
|
||||||
jsl nullfree Free varbuf.
|
jsl nullfree Free varbuf.
|
||||||
|
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ exit lda space
|
||||||
|
|
||||||
lda #0 Return status = 0.
|
lda #0 Return status = 0.
|
||||||
|
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
;
|
;
|
||||||
; Utility subroutine to print name and value in varname and varval
|
; Utility subroutine to print name and value in varname and varval
|
||||||
|
@ -502,7 +502,7 @@ done lda space
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
|
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
expmutex key
|
expmutex key
|
||||||
|
|
||||||
|
@ -596,7 +596,7 @@ done lda space
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
|
|
||||||
rtl
|
rtl
|
||||||
|
|
||||||
unsmutex key
|
unsmutex key
|
||||||
|
|
||||||
|
@ -704,7 +704,7 @@ up9 anop
|
||||||
bne done
|
bne done
|
||||||
lda flag
|
lda flag
|
||||||
sta varoldpmode
|
sta varoldpmode
|
||||||
|
|
||||||
done return
|
done return
|
||||||
|
|
||||||
END
|
END
|
||||||
|
@ -741,7 +741,7 @@ loop phx Hold onto value table index.
|
||||||
set sta evvaltbl,x Save flag in variable.
|
set sta evvaltbl,x Save flag in variable.
|
||||||
inx2 Bump index.
|
inx2 Bump index.
|
||||||
cpx evvaltblsz If not at end,
|
cpx evvaltblsz If not at end,
|
||||||
bcc loop stay in loop.
|
bcc loop stay in loop.
|
||||||
|
|
||||||
unlock gvmutex Mutual exclusion unlock.
|
unlock gvmutex Mutual exclusion unlock.
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: stdio.asm,v 1.4 1998/08/03 17:30:24 tribby Exp $
|
* $Id: stdio.asm,v 1.5 1998/09/08 16:53:14 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -77,7 +77,7 @@ puts START
|
||||||
|
|
||||||
tay Note: lock destroys Acc
|
tay Note: lock destroys Acc
|
||||||
lock mutex Wait for others to leave, and lock.
|
lock mutex Wait for others to leave, and lock.
|
||||||
sty getchar+1 Save low-order bytes of address.
|
sty getchar+1 Save low-order bytes of address.
|
||||||
txa
|
txa
|
||||||
|
|
||||||
short a SWITCH TO SINGLE-BYTE MEMORY MODE.
|
short a SWITCH TO SINGLE-BYTE MEMORY MODE.
|
||||||
|
@ -102,12 +102,12 @@ getchar lda >$FFFFFF,x Get next character from string.
|
||||||
_flush sty index Save length of stream.
|
_flush sty index Save length of stream.
|
||||||
phx Hold source string offset on stack.
|
phx Hold source string offset on stack.
|
||||||
long a SWITCH TO FULL-WORD MEMORY MODE.
|
long a SWITCH TO FULL-WORD MEMORY MODE.
|
||||||
Write WriteParm Write the stream to stdout
|
Write WriteParm Write the stream to stdout
|
||||||
Flush flushparm and flush it.
|
Flush flushparm and flush it.
|
||||||
short a SWITCH TO SINGLE-BYTE MEMORY MODE.
|
short a SWITCH TO SINGLE-BYTE MEMORY MODE.
|
||||||
plx Restore source string offset to X-reg.
|
plx Restore source string offset to X-reg.
|
||||||
ldy #0 Set stream length to 0.
|
ldy #0 Set stream length to 0.
|
||||||
bra getchar Continue copying characters.
|
bra getchar Continue copying characters.
|
||||||
|
|
||||||
; Arrive here when null character is encountered.
|
; Arrive here when null character is encountered.
|
||||||
done sty index Save stream length in global.
|
done sty index Save stream length in global.
|
||||||
|
@ -116,7 +116,7 @@ exit long a SWITCH TO FULL-WORD MEMORY MODE.
|
||||||
unlock mutex Allow others through.
|
unlock mutex Allow others through.
|
||||||
rts Return to caller.
|
rts Return to caller.
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
|
@ -129,12 +129,12 @@ flush START
|
||||||
|
|
||||||
using stdout
|
using stdout
|
||||||
|
|
||||||
lock mutex
|
lock mutex
|
||||||
lda index
|
lda index
|
||||||
beq skip
|
beq skip
|
||||||
Write WriteParm
|
Write WriteParm
|
||||||
Flush flushparm
|
Flush flushparm
|
||||||
stz index
|
stz index
|
||||||
skip unlock mutex
|
skip unlock mutex
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
@ -175,9 +175,9 @@ errputchar START
|
||||||
|
|
||||||
using stderr
|
using stderr
|
||||||
|
|
||||||
tay ;lock destroys Acc
|
tay ;lock destroys Acc
|
||||||
lock errmutex
|
lock errmutex
|
||||||
tya
|
tya
|
||||||
and #$FF
|
and #$FF
|
||||||
ldx errindex
|
ldx errindex
|
||||||
sta errstream,x
|
sta errstream,x
|
||||||
|
@ -187,7 +187,7 @@ errputchar START
|
||||||
cpx #256
|
cpx #256
|
||||||
bcc done
|
bcc done
|
||||||
_flush stx errindex
|
_flush stx errindex
|
||||||
Write errWriteParm
|
Write errWriteParm
|
||||||
ldx #0
|
ldx #0
|
||||||
done stx errindex
|
done stx errindex
|
||||||
unlock errmutex
|
unlock errmutex
|
||||||
|
@ -206,16 +206,16 @@ errputs START
|
||||||
|
|
||||||
using stderr
|
using stderr
|
||||||
|
|
||||||
tay ;lock destroys Acc
|
tay ;lock destroys Acc
|
||||||
lock errmutex
|
lock errmutex
|
||||||
sty getchar+1
|
sty getchar+1
|
||||||
txa
|
txa
|
||||||
|
|
||||||
short a
|
short a
|
||||||
sta getchar+3
|
sta getchar+3
|
||||||
|
|
||||||
ldy errindex
|
ldy errindex
|
||||||
ldx #0
|
ldx #0
|
||||||
|
|
||||||
getchar lda >$FFFFFF,x
|
getchar lda >$FFFFFF,x
|
||||||
beq done
|
beq done
|
||||||
|
@ -230,18 +230,18 @@ getchar lda >$FFFFFF,x
|
||||||
_flush sty errindex
|
_flush sty errindex
|
||||||
phx
|
phx
|
||||||
long a
|
long a
|
||||||
Write errWriteParm
|
Write errWriteParm
|
||||||
short a
|
short a
|
||||||
plx
|
plx
|
||||||
ldy #0
|
ldy #0
|
||||||
bra getchar
|
bra getchar
|
||||||
|
|
||||||
done sty errindex
|
done sty errindex
|
||||||
long a
|
long a
|
||||||
unlock errmutex
|
unlock errmutex
|
||||||
rts
|
rts
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -253,9 +253,9 @@ errflush START
|
||||||
|
|
||||||
using stderr
|
using stderr
|
||||||
|
|
||||||
lock errmutex
|
lock errmutex
|
||||||
Write errWriteParm
|
Write errWriteParm
|
||||||
stz errindex
|
stz errindex
|
||||||
unlock errmutex
|
unlock errmutex
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
@ -301,7 +301,7 @@ getchar START
|
||||||
readloop Read inReadParm
|
readloop Read inReadParm
|
||||||
bcc okread
|
bcc okread
|
||||||
ldy #-1 ;return EOF on ALL errors
|
ldy #-1 ;return EOF on ALL errors
|
||||||
jmp done2
|
jmp done2
|
||||||
|
|
||||||
okread stz inindex
|
okread stz inindex
|
||||||
lda insize
|
lda insize
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: sv.asm,v 1.5 1998/08/03 17:30:25 tribby Exp $
|
* $Id: sv.asm,v 1.6 1998/09/08 16:53:14 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
|
|
||||||
mcopy /obj/gno/bin/gsh/sv.mac
|
mcopy /obj/gno/bin/gsh/sv.mac
|
||||||
|
|
||||||
dummysv start ; ends up in .root
|
dummysv start ; ends up in .root
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ dummysv start ; ends up in .root
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
|
|
||||||
sv_alloc START
|
sv_alloc START
|
||||||
|
|
||||||
ptr equ 0
|
ptr equ 0
|
||||||
space equ ptr+4
|
space equ ptr+4
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ init sta [ptr],y Set all entries
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
|
|
||||||
sv_add START
|
sv_add START
|
||||||
|
|
||||||
p equ 0
|
p equ 0
|
||||||
base equ p+4
|
base equ p+4
|
||||||
space equ base+4
|
space equ base+4
|
||||||
|
@ -107,7 +107,7 @@ space equ base+4
|
||||||
pea 0
|
pea 0
|
||||||
pha
|
pha
|
||||||
~NEW Allocate memory for it.
|
~NEW Allocate memory for it.
|
||||||
sta p Store address in p/p+1.
|
sta p Store address in p/p+1.
|
||||||
stx p+2
|
stx p+2
|
||||||
|
|
||||||
pei (string+2) Copy the string into
|
pei (string+2) Copy the string into
|
||||||
|
@ -115,7 +115,7 @@ space equ base+4
|
||||||
phx
|
phx
|
||||||
pha
|
pha
|
||||||
jsr copycstr
|
jsr copycstr
|
||||||
bra doit else
|
bra doit else
|
||||||
|
|
||||||
asis mv4 string,p Just copy address to p/p+1.
|
asis mv4 string,p Just copy address to p/p+1.
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ foocol anop
|
||||||
|
|
||||||
;
|
;
|
||||||
; find the index for each column...
|
; find the index for each column...
|
||||||
;
|
;
|
||||||
lda #0
|
lda #0
|
||||||
tax
|
tax
|
||||||
clc
|
clc
|
||||||
|
@ -476,7 +476,7 @@ nextloop inc i
|
||||||
jmp forloop
|
jmp forloop
|
||||||
;
|
;
|
||||||
; swap(v, left, last)
|
; swap(v, left, last)
|
||||||
;
|
;
|
||||||
endloop lda left
|
endloop lda left
|
||||||
asl a
|
asl a
|
||||||
asl a
|
asl a
|
||||||
|
@ -526,7 +526,7 @@ endloop lda left
|
||||||
pha
|
pha
|
||||||
pei (right)
|
pei (right)
|
||||||
jsl _qsort
|
jsl _qsort
|
||||||
|
|
||||||
exit return
|
exit return
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Jawaid Bazyar
|
* Jawaid Bazyar
|
||||||
* Tim Meekins
|
* Tim Meekins
|
||||||
*
|
*
|
||||||
* $Id: term.asm,v 1.5 1998/08/03 17:30:25 tribby Exp $
|
* $Id: term.asm,v 1.6 1998/09/08 16:53:14 tribby Exp $
|
||||||
*
|
*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -38,7 +38,7 @@ TIOCGETP gequ $40067408
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
|
|
||||||
InitTerm START
|
InitTerm START
|
||||||
|
|
||||||
using termdata
|
using termdata
|
||||||
|
|
||||||
;
|
;
|
||||||
|
@ -54,7 +54,7 @@ allocate anop Allocate termcap buffers.
|
||||||
|
|
||||||
ph4 #1024
|
ph4 #1024
|
||||||
~NEW
|
~NEW
|
||||||
sta bp
|
sta bp
|
||||||
stx bp+2
|
stx bp+2
|
||||||
|
|
||||||
ph4 #1024
|
ph4 #1024
|
||||||
|
@ -108,7 +108,7 @@ forward_char equ 4
|
||||||
up_history equ 5
|
up_history equ 5
|
||||||
down_history equ 6
|
down_history equ 6
|
||||||
|
|
||||||
lda #1
|
lda #1
|
||||||
sta didReadTerm
|
sta didReadTerm
|
||||||
|
|
||||||
ph4 #termname
|
ph4 #termname
|
||||||
|
@ -147,7 +147,7 @@ noentry anop
|
||||||
ok jsl nullfree Free buffer allocated by getenv.
|
ok jsl nullfree Free buffer allocated by getenv.
|
||||||
lda #1
|
lda #1
|
||||||
sta termok
|
sta termok
|
||||||
mv4 areabuf,area
|
mv4 areabuf,area
|
||||||
|
|
||||||
tgetstr (#isid,#area)
|
tgetstr (#isid,#area)
|
||||||
jsr puts
|
jsr puts
|
||||||
|
@ -187,24 +187,24 @@ ok jsl nullfree Free buffer allocated by getenv.
|
||||||
tgetstr (#usid,#area)
|
tgetstr (#usid,#area)
|
||||||
sta uscap
|
sta uscap
|
||||||
stx uscap+2
|
stx uscap+2
|
||||||
|
|
||||||
tgetstr (#klid,#area)
|
tgetstr (#klid,#area)
|
||||||
phx
|
phx
|
||||||
pha
|
pha
|
||||||
ph2 #backward_char
|
ph2 #backward_char
|
||||||
jsl bindkeyfunc
|
jsl bindkeyfunc
|
||||||
tgetstr (#krid,#area)
|
tgetstr (#krid,#area)
|
||||||
phx
|
phx
|
||||||
pha
|
pha
|
||||||
ph2 #forward_char
|
ph2 #forward_char
|
||||||
jsl bindkeyfunc
|
jsl bindkeyfunc
|
||||||
tgetstr (#kuid,#area)
|
tgetstr (#kuid,#area)
|
||||||
phx
|
phx
|
||||||
pha
|
pha
|
||||||
ph2 #up_history
|
ph2 #up_history
|
||||||
jsl bindkeyfunc
|
jsl bindkeyfunc
|
||||||
tgetstr (#kdid,#area)
|
tgetstr (#kdid,#area)
|
||||||
phx
|
phx
|
||||||
pha
|
pha
|
||||||
ph2 #down_history
|
ph2 #down_history
|
||||||
jsl bindkeyfunc
|
jsl bindkeyfunc
|
||||||
|
@ -252,7 +252,7 @@ sg_flags dc i2'0'
|
||||||
hold_term_val ds 4
|
hold_term_val ds 4
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*
|
*
|
||||||
* outc for outputting characters by termcap
|
* outc for outputting characters by termcap
|
||||||
|
@ -512,7 +512,7 @@ termdata DATA
|
||||||
didReadTerm dc i2'0'
|
didReadTerm dc i2'0'
|
||||||
|
|
||||||
termok dc i2'0'
|
termok dc i2'0'
|
||||||
insertflag dc i2'1'
|
insertflag dc i2'1'
|
||||||
|
|
||||||
bp ds 4
|
bp ds 4
|
||||||
areabuf ds 4
|
areabuf ds 4
|
||||||
|
@ -532,4 +532,4 @@ vicap ds 4
|
||||||
vscap ds 4
|
vscap ds 4
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user