1997-11-18 05:31:00 +00:00
|
|
|
*************************************************************************
|
|
|
|
*
|
|
|
|
* The GNO Shell Project
|
|
|
|
*
|
|
|
|
* Developed by:
|
|
|
|
* Jawaid Bazyar
|
|
|
|
* Tim Meekins
|
|
|
|
*
|
1998-09-08 16:53:14 +00:00
|
|
|
* $Id: prompt.asm,v 1.6 1998/09/08 16:53:12 tribby Exp $
|
1998-04-24 15:38:47 +00:00
|
|
|
*
|
1997-11-18 05:31:00 +00:00
|
|
|
**************************************************************************
|
|
|
|
*
|
|
|
|
* PROMPT.ASM
|
|
|
|
* By Tim Meekins
|
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
|
|
|
* Modified by Dave Tribby for GNO 2.0.6
|
1997-11-18 05:31:00 +00:00
|
|
|
*
|
|
|
|
* This displays the command-line prompt
|
|
|
|
*
|
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/prompt.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
|
|
|
dummyprompt start ; ends up in .root
|
1998-04-24 15:38:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
setcom 60
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
WritePrompt START
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-04-24 15:38:47 +00:00
|
|
|
using HistoryData
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
prompt equ 0
|
1998-07-20 16:23:11 +00:00
|
|
|
promptgsbuf equ prompt+4
|
|
|
|
usergsbuf equ promptgsbuf+4
|
|
|
|
hour equ usergsbuf+4
|
|
|
|
minute equ hour+2
|
|
|
|
offset equ minute+2
|
1997-11-18 05:31:00 +00:00
|
|
|
pfx equ offset+2
|
1998-07-20 16:23:11 +00:00
|
|
|
space equ pfx+4
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
year equ hour
|
|
|
|
monday equ minute
|
|
|
|
precmd equ prompt
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
subroutine (0:dummy),space
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
ph4 #precmdstr If "precmd" alias is defined,
|
1997-11-18 05:31:00 +00:00
|
|
|
jsl findalias
|
|
|
|
sta precmd
|
|
|
|
stx precmd+2
|
|
|
|
ora precmd+2
|
|
|
|
beq getvar
|
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
pei (precmd+2) execute it before parsing prompt.
|
1997-11-18 05:31:00 +00:00
|
|
|
pei (precmd)
|
|
|
|
ph2 #0
|
|
|
|
jsl execute
|
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
;
|
|
|
|
; Get value of $PROMPT environment variable
|
|
|
|
;
|
|
|
|
getvar ph4 #promptname
|
|
|
|
jsl getenv
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
php Turn off interrupts: mutex
|
|
|
|
sei won't do what we want!
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
sta promptgsbuf Save pointer to GS/OS result buffer.
|
|
|
|
stx promptgsbuf+2 If there is no memory to hold it,
|
|
|
|
ora promptgsbuf+2 it's undefined, or it has a
|
|
|
|
bne parseprompt length of 0,
|
1997-11-18 05:31:00 +00:00
|
|
|
ldx #^dfltPrompt
|
|
|
|
lda #dfltPrompt
|
1998-07-20 16:23:11 +00:00
|
|
|
jsr puts print the default prompt
|
1998-09-08 16:53:14 +00:00
|
|
|
bra donemark2 and exit.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
;
|
|
|
|
; Prompt string begins in result buffer after the two length words
|
|
|
|
;
|
1998-09-08 16:53:14 +00:00
|
|
|
parseprompt anop
|
1998-07-20 16:23:11 +00:00
|
|
|
clc
|
|
|
|
lda promptgsbuf
|
|
|
|
adc #4
|
1997-11-18 05:31:00 +00:00
|
|
|
sta prompt
|
1998-07-20 16:23:11 +00:00
|
|
|
lda promptgsbuf+2
|
|
|
|
adc #0
|
|
|
|
sta prompt+2
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
promptloop lda [prompt]
|
1998-07-20 16:23:11 +00:00
|
|
|
incad prompt
|
1998-09-08 16:53:14 +00:00
|
|
|
and #$FF
|
|
|
|
beq done
|
|
|
|
cmp #'%'
|
|
|
|
beq special
|
|
|
|
cmp #'!'
|
|
|
|
jeq phist
|
1997-11-18 05:31:00 +00:00
|
|
|
cmp #'\'
|
|
|
|
jeq quoteit
|
1998-09-08 16:53:14 +00:00
|
|
|
_putchar jsr putchar
|
|
|
|
bra promptloop
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
done jsr standend
|
1997-11-18 05:31:00 +00:00
|
|
|
jsr cursoron
|
1998-07-20 16:23:11 +00:00
|
|
|
|
|
|
|
donemark2 anop
|
1998-08-03 17:30:30 +00:00
|
|
|
plp Restore interrupts.
|
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
pei (promptgsbuf+2) Free $PROMPT value buffer
|
|
|
|
pei (promptgsbuf)
|
1997-11-18 05:31:00 +00:00
|
|
|
jsl nullfree
|
1998-07-20 16:23:11 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
jsr flush
|
1998-07-20 16:23:11 +00:00
|
|
|
return
|
1998-08-03 17:30:30 +00:00
|
|
|
;
|
|
|
|
; Previous character was a "%". Handle special character flags
|
|
|
|
;
|
1998-09-08 16:53:14 +00:00
|
|
|
special lda [prompt] Get character following "%".
|
1998-07-20 16:23:11 +00:00
|
|
|
incad prompt
|
1998-09-08 16:53:14 +00:00
|
|
|
and #$FF
|
|
|
|
beq done If end of string, all done.
|
|
|
|
cmp #'%' If another "%",
|
|
|
|
beq _putchar print the "%"
|
|
|
|
cmp #'h' If 'h'
|
|
|
|
beq phist
|
|
|
|
cmp #'!' or '!',
|
|
|
|
beq phist print history number.
|
|
|
|
cmp #'t' If 't'
|
|
|
|
beq ptime
|
|
|
|
cmp #'@' or '@',
|
|
|
|
beq ptime print time (am/pm format)
|
|
|
|
cmp #'S' If 'S',
|
|
|
|
jeq pstandout turn inverse mode on.
|
|
|
|
cmp #'s' If 's',
|
|
|
|
jeq pstandend turn inverse mode off.
|
|
|
|
cmp #'U' If 'U',
|
|
|
|
jeq punderline turn underline mode on.
|
|
|
|
cmp #'u' If 'u',
|
|
|
|
jeq punderend turn underline mode off
|
|
|
|
cmp #'d' If 'd'
|
|
|
|
jeq pcwd
|
|
|
|
cmp #'/' or '/',
|
|
|
|
jeq pcwd print working directory.
|
|
|
|
cmp #'c' If 'c'
|
|
|
|
jeq pcwdend
|
|
|
|
cmp #'C' or 'C'
|
|
|
|
jeq pcwdend
|
|
|
|
cmp #'.' or '.',
|
|
|
|
jeq pcwdend print final part of wrk dir.
|
|
|
|
cmp #'n' If 'n',
|
|
|
|
jeq puser print $USER
|
|
|
|
cmp #'W' If 'W',
|
|
|
|
jeq pdate1 print date (mm/dd/yy)
|
|
|
|
cmp #'D' If 'D',
|
|
|
|
jeq pdate2 print date (yy-mm-dd)
|
1998-08-03 17:30:30 +00:00
|
|
|
cmp #'~' If '~',
|
|
|
|
jeq ptilde print wrk dir with ~ subs.
|
1998-09-08 16:53:14 +00:00
|
|
|
jmp promptloop If none of these characters, ignore it.
|
1997-11-18 05:31:00 +00:00
|
|
|
|
|
|
|
;
|
|
|
|
; Put history number
|
|
|
|
;
|
1998-09-08 16:53:14 +00:00
|
|
|
phist lda lasthist
|
|
|
|
inc a
|
|
|
|
jsr WriteNum
|
|
|
|
jmp promptloop
|
1998-08-03 17:30:30 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
; Print current time
|
|
|
|
;
|
1998-09-08 16:53:14 +00:00
|
|
|
ptime ReadTimeHex (minute,hour,@a,@a)
|
|
|
|
lda hour
|
|
|
|
and #$FF
|
|
|
|
if2 @a,cc,#13,ptime2
|
|
|
|
sub2 @a,#12,@a
|
|
|
|
ptime2 if2 @a,ne,#0,ptime2b
|
1997-11-18 05:31:00 +00:00
|
|
|
lda #12
|
1998-09-08 16:53:14 +00:00
|
|
|
ptime2b jsr WriteNum
|
1997-11-18 05:31:00 +00:00
|
|
|
lda #':'
|
|
|
|
jsr putchar
|
1998-09-08 16:53:14 +00:00
|
|
|
lda minute
|
|
|
|
xba
|
|
|
|
and #$FF
|
|
|
|
pha
|
|
|
|
cmp #10
|
|
|
|
bcs ptime2a
|
1997-11-18 05:31:00 +00:00
|
|
|
lda #'0'
|
|
|
|
jsr putchar
|
1998-09-08 16:53:14 +00:00
|
|
|
ptime2a pla
|
|
|
|
jsr WriteNum
|
|
|
|
lda hour
|
|
|
|
and #$FF
|
|
|
|
if2 @a,cs,#12,ptime3
|
|
|
|
ptime5 lda #'a'
|
|
|
|
bra ptime4
|
|
|
|
ptime3 lda #'p'
|
|
|
|
ptime4 jsr putchar
|
1997-11-18 05:31:00 +00:00
|
|
|
lda #'m'
|
|
|
|
jmp _putchar
|
1998-08-03 17:30:30 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
1998-08-03 17:30:30 +00:00
|
|
|
; Set Stand Out (turn on inverse mode)
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
1998-09-08 16:53:14 +00:00
|
|
|
pstandout jsr standout
|
1997-11-18 05:31:00 +00:00
|
|
|
jmp promptloop
|
|
|
|
;
|
1998-08-03 17:30:30 +00:00
|
|
|
; UnSet Stand Out (turn off inverse mode)
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
1998-09-08 16:53:14 +00:00
|
|
|
pstandend jsr standend
|
1997-11-18 05:31:00 +00:00
|
|
|
jmp promptloop
|
|
|
|
;
|
|
|
|
; Set Underline
|
|
|
|
;
|
1998-09-08 16:53:14 +00:00
|
|
|
punderline jsr underline
|
1997-11-18 05:31:00 +00:00
|
|
|
jmp promptloop
|
|
|
|
;
|
|
|
|
; UnSet Underline
|
|
|
|
;
|
1998-09-08 16:53:14 +00:00
|
|
|
punderend jsr underend
|
1997-11-18 05:31:00 +00:00
|
|
|
jmp promptloop
|
1998-09-08 16:53:14 +00:00
|
|
|
;
|
1997-11-18 05:31:00 +00:00
|
|
|
; Current working directory
|
|
|
|
;
|
1998-08-03 17:30:30 +00:00
|
|
|
pcwd anop
|
|
|
|
pea 0
|
1998-09-08 16:53:14 +00:00
|
|
|
jsl getpfxstr Get value of prefix 0.
|
1997-11-18 05:31:00 +00:00
|
|
|
sta pfx
|
|
|
|
stx pfx+2
|
1998-08-03 17:30:30 +00:00
|
|
|
|
|
|
|
ora pfx+2 If NULL pointer returned,
|
|
|
|
jeq promptloop an error was reported.
|
|
|
|
|
|
|
|
ldy #4 Text starts at byte 4.
|
1998-09-08 16:53:14 +00:00
|
|
|
pcwd1 lda [pfx],y Get next
|
|
|
|
and #$FF character.
|
1998-08-03 17:30:30 +00:00
|
|
|
beq freepfx Done when at end of string.
|
|
|
|
jsr toslash Convert to slash.
|
|
|
|
phy Hold index on stack
|
|
|
|
jsr putchar while printing character.
|
|
|
|
ply
|
|
|
|
iny Bump index
|
|
|
|
bra pcwd1 and stay in loop.
|
|
|
|
|
|
|
|
freepfx ph4 pfx Free the current directory buffer.
|
|
|
|
jsl nullfree
|
1998-09-08 16:53:14 +00:00
|
|
|
jmp promptloop
|
1998-08-03 17:30:30 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
1998-08-03 17:30:30 +00:00
|
|
|
; Tail of current working directory
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
1998-09-08 16:53:14 +00:00
|
|
|
pcwdend anop
|
1998-08-03 17:30:30 +00:00
|
|
|
pea 0
|
1998-09-08 16:53:14 +00:00
|
|
|
jsl getpfxstr Get value of prefix 0.
|
1997-11-18 05:31:00 +00:00
|
|
|
sta pfx
|
|
|
|
stx pfx+2
|
1998-08-03 17:30:30 +00:00
|
|
|
|
|
|
|
ora pfx+2 If NULL pointer returned,
|
|
|
|
jeq promptloop an error was reported.
|
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
ldy #2 Get string's length word
|
1998-08-03 17:30:30 +00:00
|
|
|
lda [pfx],y from bytes 2 & 3.
|
1998-09-08 16:53:14 +00:00
|
|
|
clc Add 3 to get offset
|
1998-08-03 17:30:30 +00:00
|
|
|
adc #3 from beginning of buffer.
|
1997-11-18 05:31:00 +00:00
|
|
|
sta offset
|
|
|
|
tay
|
1998-09-08 16:53:14 +00:00
|
|
|
pcwdend1 dey If we've backed up to the beginning,
|
|
|
|
bmi pcwdend2 we can't go any further!
|
|
|
|
lda [pfx],y Get next character.
|
|
|
|
and #$FF
|
|
|
|
cmp #':' If it's not ':',
|
|
|
|
bne pcwdend1 keep searching backward.
|
|
|
|
pcwdend2 iny
|
|
|
|
cpy offset
|
|
|
|
jeq freepfx Free the current directory buffer.
|
|
|
|
lda [pfx],y
|
|
|
|
and #$FF
|
|
|
|
cmp #':'
|
|
|
|
jeq freepfx Free the current directory buffer.
|
|
|
|
phy
|
1997-11-18 05:31:00 +00:00
|
|
|
jsr putchar
|
1998-09-08 16:53:14 +00:00
|
|
|
ply
|
|
|
|
bra pcwdend2
|
1998-08-03 17:30:30 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
; Current working directory substituting '~' if necessary
|
|
|
|
;
|
1998-09-08 16:53:14 +00:00
|
|
|
ptilde anop
|
1998-08-03 17:30:30 +00:00
|
|
|
pea 0
|
1998-09-08 16:53:14 +00:00
|
|
|
jsl getpfxstr Get value of prefix 0.
|
1997-11-18 05:31:00 +00:00
|
|
|
sta pfx
|
|
|
|
stx pfx+2
|
1998-08-03 17:30:30 +00:00
|
|
|
|
|
|
|
ora pfx+2 If NULL pointer returned,
|
|
|
|
jeq promptloop an error was reported.
|
|
|
|
lda pfx Otherwise, restore low-order address.
|
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
clc Add 4 to start of buffer
|
1998-08-03 17:30:30 +00:00
|
|
|
adc #4 so it can be treated like
|
|
|
|
bcc pushad a c-string.
|
|
|
|
inx
|
|
|
|
pushad phx
|
1997-11-18 05:31:00 +00:00
|
|
|
pha
|
1998-08-03 17:30:30 +00:00
|
|
|
jsl path2tilde Convert $HOME to "~"
|
|
|
|
phx Push addr onto stack
|
|
|
|
pha for nullfree.
|
|
|
|
jsr puts Print tilde string.
|
|
|
|
jsl nullfree Free the converted string.
|
|
|
|
|
|
|
|
jmp freepfx Free the current directory buffer.
|
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
;
|
1997-11-18 05:31:00 +00:00
|
|
|
; Write user name
|
|
|
|
;
|
1998-09-08 16:53:14 +00:00
|
|
|
puser ph4 #username Get value of $USER
|
1998-07-20 16:23:11 +00:00
|
|
|
jsl getenv
|
|
|
|
sta usergsbuf If buffer wasn't allocated
|
|
|
|
stx usergsbuf+2
|
|
|
|
ora usergsbuf+2
|
|
|
|
beq goploop ignore it.
|
|
|
|
|
|
|
|
clc
|
|
|
|
lda usergsbuf Text begins after
|
|
|
|
adc #4 four bytes of
|
1998-09-08 16:53:14 +00:00
|
|
|
bcc printit length words.
|
1998-07-20 16:23:11 +00:00
|
|
|
inx
|
|
|
|
printit jsr puts
|
|
|
|
|
|
|
|
pei (usergsbuf+2) Free $USER value buffer
|
|
|
|
pei (usergsbuf)
|
|
|
|
jsl nullfree
|
|
|
|
|
|
|
|
goploop jmp promptloop
|
1998-08-03 17:30:30 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
; Write date as mm/dd/yy
|
|
|
|
;
|
1998-09-08 16:53:14 +00:00
|
|
|
pdate1 ReadTimeHex (@a,year,monday,@a)
|
|
|
|
lda monday
|
|
|
|
and #$FF00
|
|
|
|
xba
|
|
|
|
inc a
|
|
|
|
jsr WriteNum
|
1997-11-18 05:31:00 +00:00
|
|
|
lda #'/'
|
|
|
|
jsr putchar
|
1998-09-08 16:53:14 +00:00
|
|
|
lda monday
|
|
|
|
and #$FF
|
|
|
|
inc a
|
|
|
|
jsr WriteNum
|
1997-11-18 05:31:00 +00:00
|
|
|
lda #'/'
|
|
|
|
jsr putchar
|
1998-09-08 16:53:14 +00:00
|
|
|
lda year
|
|
|
|
and #$FF00
|
|
|
|
xba
|
|
|
|
jsr WriteNum
|
|
|
|
jmp promptloop
|
1998-08-03 17:30:30 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
; Write date as yy-mm-dd
|
|
|
|
;
|
1998-09-08 16:53:14 +00:00
|
|
|
pdate2 ReadTimeHex (@a,year,monday,@a)
|
|
|
|
lda year
|
|
|
|
and #$FF00
|
|
|
|
xba
|
|
|
|
jsr WriteNum
|
1997-11-18 05:31:00 +00:00
|
|
|
lda #'-'
|
|
|
|
jsr putchar
|
1998-09-08 16:53:14 +00:00
|
|
|
lda monday
|
|
|
|
and #$FF00
|
|
|
|
xba
|
|
|
|
inc a
|
|
|
|
jsr WriteNum
|
1997-11-18 05:31:00 +00:00
|
|
|
lda #'-'
|
|
|
|
jsr putchar
|
1998-09-08 16:53:14 +00:00
|
|
|
lda monday
|
|
|
|
and #$FF
|
|
|
|
inc a
|
|
|
|
jsr WriteNum
|
|
|
|
jmp promptloop
|
1998-08-03 17:30:30 +00:00
|
|
|
|
1997-11-18 05:31:00 +00:00
|
|
|
;
|
|
|
|
; check for \ quote
|
|
|
|
;
|
1998-09-08 16:53:14 +00:00
|
|
|
quoteit lda [prompt]
|
1998-07-20 16:23:11 +00:00
|
|
|
incad prompt
|
1998-09-08 16:53:14 +00:00
|
|
|
and #$FF
|
|
|
|
jeq done
|
1997-11-18 05:31:00 +00:00
|
|
|
cmp #'n'
|
|
|
|
beq newline
|
|
|
|
cmp #'r'
|
|
|
|
beq newline
|
|
|
|
cmp #'t'
|
|
|
|
beq tab
|
|
|
|
cmp #'b'
|
|
|
|
beq backspace
|
|
|
|
jmp _putchar
|
|
|
|
newline lda #13
|
|
|
|
jmp _putchar
|
|
|
|
tab lda #9
|
|
|
|
jmp _putchar
|
|
|
|
backspace lda #8
|
|
|
|
jmp _putchar
|
1998-09-08 16:53:14 +00:00
|
|
|
;
|
1997-11-18 05:31:00 +00:00
|
|
|
; Write a number between 0 and 9,999
|
|
|
|
;
|
1998-09-08 16:53:14 +00:00
|
|
|
WriteNum cmp #10
|
|
|
|
bcs write1
|
|
|
|
adc #'0'
|
1997-11-18 05:31:00 +00:00
|
|
|
jmp putchar
|
1998-07-20 16:23:11 +00:00
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
write1 cmp #100
|
|
|
|
bcs write2
|
|
|
|
Int2Dec (@a,#num+2,#2,#0)
|
1997-11-18 05:31:00 +00:00
|
|
|
ldx #^num+2
|
|
|
|
lda #num+2
|
|
|
|
jmp puts
|
1998-07-20 16:23:11 +00:00
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
write2 cmp #1000
|
|
|
|
bcs write3
|
|
|
|
Int2Dec (@a,#num+1,#3,#0)
|
1997-11-18 05:31:00 +00:00
|
|
|
ldx #^num+1
|
|
|
|
lda #num+1
|
|
|
|
jmp puts
|
1998-07-20 16:23:11 +00:00
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
write3 Int2Dec (@a,#num,#4,#0)
|
1997-11-18 05:31:00 +00:00
|
|
|
ldx #^num
|
|
|
|
lda #num
|
|
|
|
jmp puts
|
|
|
|
|
1998-07-20 16:23:11 +00:00
|
|
|
|
|
|
|
; Name of alias to execute before prompt
|
|
|
|
precmdstr dc c'precmd',h'00'
|
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
; Names of environment variables
|
1998-09-08 16:53:14 +00:00
|
|
|
promptname gsstr 'prompt'
|
1998-07-20 16:23:11 +00:00
|
|
|
username gsstr 'user'
|
|
|
|
|
1998-08-03 17:30:30 +00:00
|
|
|
; Default prompt
|
1998-09-08 16:53:14 +00:00
|
|
|
dfltPrompt dc c'% ',h'00'
|
1998-08-03 17:30:30 +00:00
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
num dc c'0000',h'00'
|
1997-11-18 05:31:00 +00:00
|
|
|
|
1998-09-08 16:53:14 +00:00
|
|
|
END
|