1997-11-18 05:31:00 +00:00
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* The GNO Shell Project
|
|
|
|
*
|
|
|
|
* Developed by:
|
|
|
|
* Jawaid Bazyar
|
|
|
|
* Tim Meekins
|
|
|
|
*
|
1998-12-21 23:57:08 +00:00
|
|
|
* $Id: bufpool.asm,v 1.6 1998/12/21 23:57:04 tribby Exp $
|
1998-04-24 15:38:47 +00:00
|
|
|
*
|
1997-11-18 05:31:00 +00:00
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* BUFPOOL
|
|
|
|
* By Tim Meekins
|
1998-08-03 17:30:30 +00:00
|
|
|
* Modified by Dave Tribby for GNO 2.0.6 (256-byte buffer code removed)
|
1997-11-18 05:31:00 +00:00
|
|
|
*
|
|
|
|
* This is the buffer pool
|
|
|
|
*
|
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
|
|
|
|
* | | | | | |
|
|
|
|
* ^ ^ ^ ^ ^ ^
|
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* Interfaces defined in this file:
|
1998-12-21 23:57:08 +00:00
|
|
|
* The alloc routine is a jsl without any stack params.
|
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
|
|
|
* Pointer to requested buffer is returned in X/A registers.
|
|
|
|
* alloc1024
|
1998-12-21 23:57:08 +00:00
|
|
|
* The free routine takes the address from the X/A registers
|
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
|
|
|
* free1024
|
|
|
|
*
|
|
|
|
* bufpool data:
|
|
|
|
* pool1024 dc i4'0'
|
|
|
|
* pool1024mutex key
|
1998-09-08 16:53:14 +00:00
|
|
|
*
|
1997-11-18 05:31:00 +00:00
|
|
|
**************************************************************************
|
|
|
|
|
1998-04-24 15:38:47 +00:00
|
|
|
mcopy /obj/gno/bin/gsh/bufpool.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
|
|
|
dummybufpool start ; ends up in .root
|
1998-04-24 15:38:47 +00:00
|
|
|
end
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
1998-12-21 23:57:08 +00:00
|
|
|
* Get a buffer of size 1024
|
1997-11-18 05:31:00 +00:00
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
alloc1024 START
|
1998-09-08 16:53:14 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
using bufpool
|
|
|
|
|
|
|
|
lock pool1024mutex
|
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
lda pool1024 If pool pointer
|
|
|
|
ora pool1024+2 isn't NULL,
|
1997-11-18 05:31:00 +00:00
|
|
|
beq allocbuf
|
|
|
|
|
|
|
|
phd
|
1998-12-21 23:57:08 +00:00
|
|
|
ph4 pool1024 Push pool pointer on stack.
|
1997-11-18 05:31:00 +00:00
|
|
|
tsc
|
|
|
|
tcd
|
1998-12-21 23:57:08 +00:00
|
|
|
lda [1] Replace pool pointer with
|
|
|
|
sta pool1024 the address it points to.
|
1997-11-18 05:31:00 +00:00
|
|
|
ldy #2
|
|
|
|
lda [1],y
|
|
|
|
sta pool1024+2
|
|
|
|
unlock pool1024mutex
|
1998-09-08 16:53:14 +00:00
|
|
|
pla
|
1997-11-18 05:31:00 +00:00
|
|
|
plx
|
|
|
|
pld
|
1998-12-21 23:57:08 +00:00
|
|
|
rtl Return to caller.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
;
|
|
|
|
; No memory in free pool; must allocate a new block.
|
|
|
|
;
|
1997-11-18 05:31:00 +00:00
|
|
|
allocbuf unlock pool1024mutex
|
|
|
|
ph4 #1024
|
1998-08-03 17:30:30 +00:00
|
|
|
~NEW
|
1997-11-18 05:31:00 +00:00
|
|
|
rtl
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
1998-12-21 23:57:08 +00:00
|
|
|
* Free a buffer of size 1024, putting it into the free pool
|
1997-11-18 05:31:00 +00:00
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
free1024 START
|
|
|
|
|
|
|
|
using bufpool
|
|
|
|
|
|
|
|
phd
|
|
|
|
phx
|
|
|
|
pha
|
|
|
|
tsc
|
|
|
|
tcd
|
|
|
|
lock pool1024mutex
|
1998-12-21 23:57:08 +00:00
|
|
|
lda pool1024 Move current head of pool list
|
|
|
|
sta [1] into the buffer being freed.
|
1997-11-18 05:31:00 +00:00
|
|
|
ldy #2
|
|
|
|
lda pool1024+2
|
|
|
|
sta [1],y
|
1998-12-21 23:57:08 +00:00
|
|
|
lda 1 Put address of buffer being freed
|
|
|
|
sta pool1024 into the pool list head.
|
1997-11-18 05:31:00 +00:00
|
|
|
lda 3
|
|
|
|
sta pool1024+2
|
|
|
|
unlock pool1024mutex
|
|
|
|
pla
|
|
|
|
plx
|
|
|
|
pld
|
1998-12-21 23:57:08 +00:00
|
|
|
rtl Return to caller.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
**************************************************************************
|
|
|
|
*
|
1998-12-21 23:57:08 +00:00
|
|
|
* Buffer pool data
|
1997-11-18 05:31:00 +00:00
|
|
|
*
|
|
|
|
**************************************************************************
|
|
|
|
|
|
|
|
bufpool DATA
|
|
|
|
|
1998-12-21 23:57:08 +00:00
|
|
|
pool1024 dc i4'0' Head of free pool list.
|
|
|
|
|
|
|
|
pool1024mutex key Mutual exclusion when modifying list.
|
1998-09-08 16:53:14 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
END
|