1997-11-18 05:31:00 +00:00
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* The GNO Shell Project
|
|
|
|
*
|
|
|
|
* Developed by:
|
|
|
|
* Jawaid Bazyar
|
|
|
|
* Tim Meekins
|
|
|
|
*
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
* $Id: stdio.asm,v 1.6 1998/10/26 17:04:51 tribby Exp $
|
1998-04-24 15:38:47 +00:00
|
|
|
*
|
1997-11-18 05:31:00 +00:00
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* STDIO.ASM
|
|
|
|
* By Tim Meekins
|
1998-08-03 17:30:30 +00:00
|
|
|
* Modified by Dave Tribby for GNO 2.0.6
|
1997-11-18 05:31:00 +00:00
|
|
|
*
|
|
|
|
* This is the custom stdio for the shell
|
|
|
|
*
|
|
|
|
* stdout buffer size: 512 bytes
|
|
|
|
* stderr buffer size: 256 bytes
|
|
|
|
* stdin buffer size: 128 bytes
|
|
|
|
*
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
* Note: text set up for tabs at col 16, 22, 41, 49, 57, 65
|
|
|
|
* | | | | | |
|
|
|
|
* ^ ^ ^ ^ ^ ^
|
1997-11-18 05:31:00 +00:00
|
|
|
**************************************************************************
|
|
|
|
|
1998-04-24 15:38:47 +00:00
|
|
|
mcopy /obj/gno/bin/gsh/stdio.mac
|
|
|
|
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
dummystdio start ; ends up in .root
|
1998-04-24 15:38:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
setcom 60
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* putchar - output a character to standard out
|
|
|
|
* On entry: A = character
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
putchar START
|
|
|
|
|
|
|
|
using stdout
|
|
|
|
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
tay Note: lock destroys Acc
|
|
|
|
lock mutex Wait for others to leave, and lock.
|
|
|
|
tya
|
|
|
|
and #$FF Isolate the single character.
|
|
|
|
ldx index Get num of chars already in stream.
|
|
|
|
sta stream,x Store this char + null byte.
|
|
|
|
inx Bump length of stream by one.
|
|
|
|
cmp #13 If character was newline,
|
|
|
|
beq _flush go write the stream.
|
|
|
|
cpx #512 If length < 512,
|
|
|
|
bcc done all done.
|
|
|
|
_flush stx index Save current length.
|
|
|
|
Write WriteParm Write the stream.
|
|
|
|
ldx #0 Set new length to 0.
|
|
|
|
|
|
|
|
done stx index Save stream length in global.
|
|
|
|
unlock mutex Allow others through.
|
|
|
|
rts Return to caller.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* puts - output a c string to standard out
|
|
|
|
* On entry: A/X = pointer to string
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
puts START
|
|
|
|
|
|
|
|
using stdout
|
|
|
|
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
tay Note: lock destroys Acc
|
|
|
|
lock mutex Wait for others to leave, and lock.
|
1998-09-08 16:53:14 +00:00
|
|
|
sty getchar+1 Save low-order bytes of address.
|
1997-11-18 05:31:00 +00:00
|
|
|
txa
|
|
|
|
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
short a SWITCH TO SINGLE-BYTE MEMORY MODE.
|
|
|
|
sta getchar+3 Store high-order byte of address.
|
|
|
|
ora getchar+2 If string address
|
|
|
|
ora getchar+1 is 00/0000,
|
|
|
|
beq exit don't do the write.
|
|
|
|
|
|
|
|
ldy index Get current number of chars in stream.
|
|
|
|
ldx #0 Clear source string offset.
|
|
|
|
|
|
|
|
getchar lda >$FFFFFF,x Get next character from string.
|
|
|
|
beq done Done when we see a null byte.
|
|
|
|
sta stream,y Store in output stream.
|
|
|
|
iny Bump the stream and
|
|
|
|
inx string pointers.
|
|
|
|
cmp #13 If newline was encountered,
|
|
|
|
beq _flush go write & flush the stream.
|
|
|
|
cpy #512 If stream length < 512,
|
|
|
|
bcc getchar continue copying characters.
|
|
|
|
|
|
|
|
_flush sty index Save length of stream.
|
|
|
|
phx Hold source string offset on stack.
|
|
|
|
long a SWITCH TO FULL-WORD MEMORY MODE.
|
1998-09-08 16:53:14 +00:00
|
|
|
Write WriteParm Write the stream to stdout
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
Flush flushparm and flush it.
|
|
|
|
short a SWITCH TO SINGLE-BYTE MEMORY MODE.
|
|
|
|
plx Restore source string offset to X-reg.
|
|
|
|
ldy #0 Set stream length to 0.
|
1998-09-08 16:53:14 +00:00
|
|
|
bra getchar Continue copying characters.
|
Major changes to gsh with this checkin:
* When ~ is parsed and next character is a delimiter, make sure contents
of expanded $HOME match the user's delimiter.
* When wildcard patterns don't match, rather than terminating the command
gsh now prints "No match: <pattern> ignored" and passes the command line
minus the unmatched patterns on to be executed.
* Modified echo command so it doesn't add a blank to the end.
* Make "clear" and "source" built-ins non-forked commands. Unforking
"source" allows prefixes to be set in files that are sourced.
* Add loop to parse a single command (removing leading whitespace) before
sending it off to be expanded and executed. Skip null lines and comments
at this level. This allows later commands that depend upon variables set
in the 1st command to work; e.g.: set t_num=1 ; echo "Test number $t_num"
Also fixes problems seen when tab was first character of multiple lines.
* Initialize environment variable flags at startup (for echo, nodirexec,
nonewline, noglob, nobeep, pushdsilent, term, and ignoreeof). Set
flag when env var is set in upper or lower case (formerly, only worked
with lower case).
* Lots of places two-word addresses are incremented using inc, without
checking for overflow into the high-order word. As these are discovered,
they are changed to use adc on both words.
See file UpdateLog for detailed list of changes.
1998-06-30 17:26:04 +00:00
|
|
|
|
|
|
|
; Arrive here when null character is encountered.
|
|
|
|
done sty index Save stream length in global.
|
|
|
|
|
|
|
|
exit long a SWITCH TO FULL-WORD MEMORY MODE.
|
|
|
|
unlock mutex Allow others through.
|
|
|
|
rts Return to caller.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
END
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* flush - flush stdout
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
flush START
|
|
|
|
|
|
|
|
using stdout
|
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
lock mutex
|
1997-11-18 05:31:00 +00:00
|
|
|
lda index
|
|
|
|
beq skip
|
1998-09-08 16:53:14 +00:00
|
|
|
Write WriteParm
|
1997-11-18 05:31:00 +00:00
|
|
|
Flush flushparm
|
1998-09-08 16:53:14 +00:00
|
|
|
stz index
|
1997-11-18 05:31:00 +00:00
|
|
|
skip unlock mutex
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* data for standard out
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
stdout PRIVDATA
|
|
|
|
|
|
|
|
mutex key
|
|
|
|
|
|
|
|
WriteParm dc i2'4'
|
|
|
|
dc i2'2' ;2 is standard out
|
|
|
|
dc i4'stream'
|
|
|
|
index dc i4'0'
|
|
|
|
dc i4'0'
|
|
|
|
|
|
|
|
flushparm dc i2'1'
|
|
|
|
dc i2'2'
|
|
|
|
|
|
|
|
stream ds 512+1
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* errputchar - output a character to standard error
|
|
|
|
* On entry: A = character
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
errputchar START
|
|
|
|
|
|
|
|
using stderr
|
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
tay ;lock destroys Acc
|
1997-11-18 05:31:00 +00:00
|
|
|
lock errmutex
|
1998-09-08 16:53:14 +00:00
|
|
|
tya
|
1997-11-18 05:31:00 +00:00
|
|
|
and #$FF
|
|
|
|
ldx errindex
|
|
|
|
sta errstream,x
|
|
|
|
inx
|
|
|
|
cmp #13
|
|
|
|
beq _flush
|
|
|
|
cpx #256
|
|
|
|
bcc done
|
|
|
|
_flush stx errindex
|
1998-09-08 16:53:14 +00:00
|
|
|
Write errWriteParm
|
1997-11-18 05:31:00 +00:00
|
|
|
ldx #0
|
|
|
|
done stx errindex
|
|
|
|
unlock errmutex
|
|
|
|
rts
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* errputs - output a c string to standard error
|
|
|
|
* On entry: A/X = pointer to string
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
errputs START
|
|
|
|
|
|
|
|
using stderr
|
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
tay ;lock destroys Acc
|
1997-11-18 05:31:00 +00:00
|
|
|
lock errmutex
|
1998-09-08 16:53:14 +00:00
|
|
|
sty getchar+1
|
1997-11-18 05:31:00 +00:00
|
|
|
txa
|
|
|
|
|
|
|
|
short a
|
|
|
|
sta getchar+3
|
|
|
|
|
|
|
|
ldy errindex
|
1998-09-08 16:53:14 +00:00
|
|
|
ldx #0
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
getchar lda >$FFFFFF,x
|
|
|
|
beq done
|
|
|
|
sta errstream,y
|
|
|
|
iny
|
|
|
|
inx
|
|
|
|
cmp #13
|
|
|
|
beq _flush
|
|
|
|
cpy #256
|
|
|
|
bcc getchar
|
|
|
|
|
|
|
|
_flush sty errindex
|
|
|
|
phx
|
|
|
|
long a
|
1998-09-08 16:53:14 +00:00
|
|
|
Write errWriteParm
|
1997-11-18 05:31:00 +00:00
|
|
|
short a
|
|
|
|
plx
|
|
|
|
ldy #0
|
1998-09-08 16:53:14 +00:00
|
|
|
bra getchar
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
done sty errindex
|
|
|
|
long a
|
|
|
|
unlock errmutex
|
|
|
|
rts
|
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
END
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* errflush - flush stderr
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
errflush START
|
|
|
|
|
|
|
|
using stderr
|
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
lock errmutex
|
|
|
|
Write errWriteParm
|
|
|
|
stz errindex
|
1997-11-18 05:31:00 +00:00
|
|
|
unlock errmutex
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* data for standard error
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
stderr PRIVDATA
|
|
|
|
|
|
|
|
errmutex key
|
|
|
|
|
|
|
|
errWriteParm dc i2'4'
|
|
|
|
dc i2'3' ;3 is standard err
|
|
|
|
dc i4'errstream'
|
|
|
|
errindex dc i4'0'
|
|
|
|
dc i4'0'
|
|
|
|
|
|
|
|
errstream ds 256+1 ;not as large as stdout
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* getchar - read a single character from standard input
|
|
|
|
* on exit: a = character, -1 if EOF
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
getchar START
|
|
|
|
|
|
|
|
using stdin
|
|
|
|
|
|
|
|
lock inmutex
|
|
|
|
|
|
|
|
lda insize ;any characters in stream?
|
|
|
|
bne grabchar ;yup
|
|
|
|
|
|
|
|
readloop Read inReadParm
|
|
|
|
bcc okread
|
Changes for gsh version 2.0d5:
Add quotes around null parameters from the command line so they will be
parsed properly (resolves PR#84).
Output piped to an unfound command caused gsh to terminate, due to an
interface change to the GNO 2.0.6 version of getpgrp(2): it now returns the
process group of the caller. To get the process group number for the
pid passed as a parameter pid, the call has to be made to _getpgrp(2).
In addition to fixing invoke.asm, updates were also made in jobs.asm.
When directory stack is full, pushd, reports a new error message: 'pushd:
Directory stack full'. (Previously, 50 pushds would cause a crash.)
When parameter passed to "pushd +n" is <= 0, report a new error message:
'pushd: Invalid number'. (Previously, tried to chdir to the parameter.)
When a command appends to stderr (e.g., echo test >>&/tmp/err), stdin was
closed, due to errappend being defined as pipefds+2 rather than pipefds+4
in cmd.asm.
When there was an error reading stdin, gsh went into an infinite loop of
beeping and requesting more input. Changed getchar (in stdio.asm) and
GetCmdLine (in edit.asm) to report the error and terminate.
Code in cmd.asm set and reset handler for signal SIGSTOP (17). This makes
no sense, since there cannot be a handler for SIGSTOP. This was changed
to set and reset signal SIGTSTP (18) since that handler is used by gsh.
The error message "specify a command before redirecting" was never
caught by the invoke() subroutine because the next higher routine,
command(), checked for argv==0 before calling invoke(). The error
message was moved into command().
1998-10-26 17:04:51 +00:00
|
|
|
ldy #-1 Return EOF if error code
|
|
|
|
cmp #$4C is "EOF encountered".
|
|
|
|
beq go_done2
|
|
|
|
ora #$FF00 For all other errors,
|
|
|
|
tay hi-byte is $FF, low-byte is error.
|
|
|
|
go_done2 jmp done2
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
okread stz inindex
|
|
|
|
lda insize
|
|
|
|
bne grabchar
|
|
|
|
|
|
|
|
cop $7F ;no characters ready, so wait
|
|
|
|
bra readloop
|
|
|
|
|
|
|
|
grabchar ldx inindex
|
|
|
|
lda instream,x
|
|
|
|
and #$7F
|
|
|
|
inc inindex
|
|
|
|
dec insize
|
|
|
|
|
|
|
|
tay
|
|
|
|
|
|
|
|
done2 unlock inmutex
|
|
|
|
tya
|
|
|
|
rts
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* data for standard input
|
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
stdin PRIVDATA
|
|
|
|
|
|
|
|
inmutex key
|
|
|
|
|
|
|
|
inReadParm dc i2'4'
|
|
|
|
dc i2'1' ;1 is standard input
|
|
|
|
dc i4'instream'
|
|
|
|
inrequest dc i4'128'
|
|
|
|
insize dc i4'0'
|
|
|
|
|
|
|
|
inindex dc i2'0'
|
|
|
|
|
|
|
|
instream ds 128+1
|
|
|
|
|
|
|
|
END
|