2015-03-14 22:48:35 +01:00
|
|
|
|
PR#3
|
2017-03-29 17:48:15 +02:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2017-09-05 17:17:10 +02:00
|
|
|
|
LOMEM $A00
|
2015-03-14 22:48:35 +01:00
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
2015-10-19 22:35:00 +02:00
|
|
|
|
.LIST OFF
|
2015-03-14 22:48:35 +01:00
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2017-03-29 17:48:15 +02:00
|
|
|
|
.TF /A2OSX.BUILD/SBIN/SHELL
|
2015-03-14 22:48:35 +01:00
|
|
|
|
*--------------------------------------
|
2017-03-29 17:48:15 +02:00
|
|
|
|
.INB /A2OSX.BUILD/INC/MACROS.I
|
|
|
|
|
.INB /A2OSX.BUILD/INC/A2OSX.I
|
|
|
|
|
.INB /A2OSX.BUILD/INC/MLI.ERR.I
|
2015-03-14 22:48:35 +01:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
ZPPTR1 .EQ ZPBIN
|
|
|
|
|
ZPPTR2 .EQ ZPBIN+2
|
2017-09-07 17:32:27 +02:00
|
|
|
|
ZPCMDBuf .EQ ZPBIN+4
|
|
|
|
|
ZPCSHBufBase .EQ ZPBIN+6
|
|
|
|
|
ZPCSHBufPtr .EQ ZPBIN+8
|
2017-07-21 16:46:25 +02:00
|
|
|
|
ZPCSHSymbols .EQ ZPBIN+10
|
|
|
|
|
ZPCSHData .EQ ZPBIN+12
|
2017-07-13 17:22:13 +02:00
|
|
|
|
ZPCSHStack .EQ ZPBIN+14
|
2015-03-14 22:48:35 +01:00
|
|
|
|
*--------------------------------------
|
2017-09-15 17:16:04 +02:00
|
|
|
|
CmdLine.MAX .EQ 255
|
2017-01-26 17:28:52 +01:00
|
|
|
|
VarLen.MAX .EQ 15
|
2017-09-25 17:50:33 +02:00
|
|
|
|
History.MAX .EQ 256
|
2017-09-01 17:40:26 +02:00
|
|
|
|
|
2017-07-12 17:25:23 +02:00
|
|
|
|
CSH.Stack.MAX .EQ 15
|
2017-07-25 16:37:19 +02:00
|
|
|
|
CSH.Name.MAX .EQ 15
|
2017-09-11 08:11:57 +02:00
|
|
|
|
CSH.E.SYNTAX .EQ $7F
|
2017-09-01 17:40:26 +02:00
|
|
|
|
CSH.E.SOVERFLW .EQ $7E
|
|
|
|
|
CSH.E.NOVERFLW .EQ $7D
|
|
|
|
|
CSH.E.OOM .EQ $7C
|
|
|
|
|
CSH.E.DUP .EQ $7B
|
|
|
|
|
CSH.E.UNDEF .EQ $7A
|
|
|
|
|
CSH.E.TOOLONG .EQ $79
|
2015-03-14 22:48:35 +01:00
|
|
|
|
*--------------------------------------
|
2015-06-03 20:30:57 +02:00
|
|
|
|
* File Header (16 Bytes)
|
2015-03-14 22:48:35 +01:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.START cld
|
|
|
|
|
jmp (.1,x)
|
2015-06-03 20:30:57 +02:00
|
|
|
|
.DA #$61 6502,Level 1 (65c02)
|
|
|
|
|
.DA #1 BIN Layout Version 1
|
|
|
|
|
.DA 0
|
2017-09-26 17:55:25 +02:00
|
|
|
|
.DA CS.END-CS.START CS
|
|
|
|
|
.DA DS.END-DS.START DS
|
|
|
|
|
.DA #64 SS
|
|
|
|
|
.DA #16 ZP
|
2015-06-03 20:30:57 +02:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
2015-10-19 22:35:00 +02:00
|
|
|
|
*--------------------------------------
|
2015-03-14 22:48:35 +01:00
|
|
|
|
.1 .DA CS.INIT
|
|
|
|
|
.DA CS.RUN
|
|
|
|
|
.DA CS.DOEVENT
|
|
|
|
|
.DA CS.QUIT
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
L.MSG.GREETINGS .DA MSG.GREETINGS
|
2016-10-29 21:58:21 +02:00
|
|
|
|
L.MSG.PROMPT .DA MSG.PROMPT
|
2016-10-17 08:21:04 +02:00
|
|
|
|
L.MSG.ECHO .DA MSG.ECHO
|
2015-11-22 23:30:06 +01:00
|
|
|
|
L.MSG.ERROR .DA MSG.ERROR
|
2016-10-17 17:47:50 +02:00
|
|
|
|
L.MSG.PRINTENV .DA MSG.PRINTENV
|
2017-07-13 17:22:13 +02:00
|
|
|
|
L.MSG.CSHERR .DA MSG.CSHERR
|
2015-10-19 22:35:00 +02:00
|
|
|
|
L.ENV.PATH .DA ENV.PATH
|
2016-10-29 21:58:21 +02:00
|
|
|
|
L.ENV.PWD .DA ENV.PWD
|
|
|
|
|
L.ENV.PS1 .DA ENV.PS1
|
2017-09-28 17:39:12 +02:00
|
|
|
|
L.ENV.HOME .DA ENV.HOME
|
2016-09-05 18:00:11 +02:00
|
|
|
|
L.FMT.DATE .DA FMT.DATE
|
|
|
|
|
L.FMT.TIME .DA FMT.TIME
|
2017-09-26 17:55:25 +02:00
|
|
|
|
J.ESC .DA CmdLine.BS left arrow
|
|
|
|
|
.DA HIS.GetNext
|
|
|
|
|
.DA HIS.GetPrev
|
|
|
|
|
.DA CmdLine.NAK right arow
|
2017-07-11 17:53:52 +02:00
|
|
|
|
L.INTCMDS .DA INTCMDS
|
2016-08-17 08:25:58 +02:00
|
|
|
|
J.INTCMDS .DA Cmd.Exec.CD
|
|
|
|
|
.DA Cmd.Exec.DATE
|
|
|
|
|
.DA Cmd.Exec.ECHO
|
|
|
|
|
.DA Cmd.Exec.EXIT
|
|
|
|
|
.DA Cmd.Exec.PAUSE
|
2016-10-25 08:58:15 +02:00
|
|
|
|
.DA Cmd.Exec.PWD
|
2016-08-17 08:25:58 +02:00
|
|
|
|
.DA Cmd.Exec.READ
|
|
|
|
|
.DA Cmd.Exec.SET
|
2017-07-17 07:59:30 +02:00
|
|
|
|
.DA Cmd.Exec.SLEEP
|
2016-08-17 08:25:58 +02:00
|
|
|
|
.DA Cmd.Exec.STARTPROC
|
|
|
|
|
.DA Cmd.Exec.TIME
|
2017-07-13 17:22:13 +02:00
|
|
|
|
L.CSHCMDS .DA CSHCMDS
|
|
|
|
|
J.CSHCMDS .DA CSH.IF
|
|
|
|
|
.DA CSH.WHILE
|
|
|
|
|
.DA CSH.BREAK
|
|
|
|
|
.DA CSH.CONTINUE
|
2017-07-21 16:46:25 +02:00
|
|
|
|
.DA CSH.CHAR
|
|
|
|
|
.DA CSH.INT
|
|
|
|
|
.DA CSH.LONG
|
|
|
|
|
.DA CSH.FLOAT
|
2017-07-13 17:22:13 +02:00
|
|
|
|
J.CSHCMDS.END .DA CSH.IF.END
|
|
|
|
|
.DA CSH.WHILE.END
|
2017-07-17 07:59:30 +02:00
|
|
|
|
L.CSH.ACC .DA CSH.ACC
|
2016-10-29 21:58:21 +02:00
|
|
|
|
L.ERR.Codes .DA ERR.Codes
|
|
|
|
|
L.ERR.Messages .DA ERR.Messages
|
2015-03-14 22:48:35 +01:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
2016-10-29 21:58:21 +02:00
|
|
|
|
CS.INIT jsr SetPWD
|
|
|
|
|
|
2017-09-07 17:32:27 +02:00
|
|
|
|
jsr CMD.Init
|
|
|
|
|
bcs .9
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-07-17 07:59:30 +02:00
|
|
|
|
lda (pPs)
|
|
|
|
|
ora #S.PS.F.EVENT Now accept events
|
|
|
|
|
sta (pPs)
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-09-01 17:40:26 +02:00
|
|
|
|
ldy #S.PS.ARGC
|
|
|
|
|
lda (pPs),y
|
2015-10-19 22:35:00 +02:00
|
|
|
|
|
2017-07-13 17:22:13 +02:00
|
|
|
|
beq .1 no arg, continue starting interactive
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-07-21 16:46:25 +02:00
|
|
|
|
jmp CSH.Init
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-07-13 17:22:13 +02:00
|
|
|
|
.1 jsr HIS.Init
|
2015-10-19 22:35:00 +02:00
|
|
|
|
bcs .9
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2015-11-22 23:30:06 +01:00
|
|
|
|
>LDYA L.MSG.GREETINGS
|
2017-08-25 17:02:16 +02:00
|
|
|
|
>SYSCALL PrintF.YA
|
2017-09-06 17:00:10 +02:00
|
|
|
|
|
2017-09-13 08:17:46 +02:00
|
|
|
|
.9 rts
|
2015-03-14 22:48:35 +01:00
|
|
|
|
*--------------------------------------
|
2017-09-12 17:24:36 +02:00
|
|
|
|
CS.RUN >LDA.G bReadMode READ Command ?
|
2017-01-26 17:28:52 +01:00
|
|
|
|
bne CS.RUN.READ
|
2016-11-08 17:56:05 +01:00
|
|
|
|
|
2017-02-23 17:43:42 +01:00
|
|
|
|
ldy #S.PS.RC
|
|
|
|
|
lda (pPs),y
|
|
|
|
|
beq .11
|
2017-08-22 08:37:03 +02:00
|
|
|
|
jsr IO.PrintErrMsg
|
2017-02-23 17:43:42 +01:00
|
|
|
|
bcs CS.RUN.EXIT.RTS
|
|
|
|
|
|
2017-09-08 16:49:23 +02:00
|
|
|
|
.11 >LDA.G bPause
|
2017-07-17 07:59:30 +02:00
|
|
|
|
bpl .13
|
|
|
|
|
|
2017-08-22 17:03:34 +02:00
|
|
|
|
>SYSCALL GetChar
|
2017-07-17 07:59:30 +02:00
|
|
|
|
bcs .8
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-09-08 16:49:23 +02:00
|
|
|
|
.13 jsr CheckSleep
|
2017-07-17 07:59:30 +02:00
|
|
|
|
bne .8
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-09-11 17:29:08 +02:00
|
|
|
|
>LDA.G CSH.hBuf batch mode ?
|
2017-01-26 17:28:52 +01:00
|
|
|
|
beq .10
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-01-26 17:28:52 +01:00
|
|
|
|
jmp CS.RUN.BATCH
|
2017-09-15 17:16:04 +02:00
|
|
|
|
*--------------------------------------
|
2017-09-21 08:35:44 +02:00
|
|
|
|
.10 jsr CmdLine.RESET reset CmdBuf
|
2017-09-15 08:37:15 +02:00
|
|
|
|
|
2017-02-23 17:43:42 +01:00
|
|
|
|
.12 jsr PrintPrompt
|
2017-01-26 17:28:52 +01:00
|
|
|
|
bcs CS.RUN.EXIT.RTS
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2016-10-24 17:54:43 +02:00
|
|
|
|
.1 >SYSCALL Sleep
|
2017-08-22 17:03:34 +02:00
|
|
|
|
>SYSCALL GetChar
|
2017-01-12 18:43:45 +01:00
|
|
|
|
bcs .1 no char
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-01-12 18:43:45 +01:00
|
|
|
|
jsr CS.CHARIN
|
|
|
|
|
|
2017-09-15 17:16:04 +02:00
|
|
|
|
>LDA.G bCmdBufExec Something to execute ?
|
2015-06-24 22:41:38 +02:00
|
|
|
|
bpl .1
|
2015-11-22 23:30:06 +01:00
|
|
|
|
|
2017-09-27 08:14:13 +02:00
|
|
|
|
>LDA.G CmdBuflen
|
|
|
|
|
beq .10 Empty line
|
|
|
|
|
|
2017-09-15 17:16:04 +02:00
|
|
|
|
jsr CMD.Parse
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-09-08 16:49:23 +02:00
|
|
|
|
>LDA.G CmdBuflen
|
2017-09-21 17:29:45 +02:00
|
|
|
|
beq .10 Empty line
|
2015-11-22 23:30:06 +01:00
|
|
|
|
|
2016-08-17 08:25:58 +02:00
|
|
|
|
jsr HIS.Add
|
2015-11-22 23:30:06 +01:00
|
|
|
|
|
2017-09-15 17:16:04 +02:00
|
|
|
|
jsr CMD.Exec
|
|
|
|
|
bcs .2
|
|
|
|
|
|
|
|
|
|
lda #0
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-09-15 17:16:04 +02:00
|
|
|
|
.2 ldy #S.PS.RC
|
2017-01-26 17:28:52 +01:00
|
|
|
|
sta (pPs),y
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-09-08 16:49:23 +02:00
|
|
|
|
>LDA.G bExit
|
2017-01-26 17:28:52 +01:00
|
|
|
|
bne CS.RUN.EXIT
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-07-17 07:59:30 +02:00
|
|
|
|
.8 clc
|
2015-03-14 22:48:35 +01:00
|
|
|
|
rts
|
2015-11-22 23:30:06 +01:00
|
|
|
|
|
2017-01-26 17:28:52 +01:00
|
|
|
|
CS.RUN.EXIT lda #0
|
|
|
|
|
CS.RUN.EXIT.ERR sec
|
|
|
|
|
CS.RUN.EXIT.RTS rts
|
|
|
|
|
*--------------------------------------
|
2017-09-28 17:39:12 +02:00
|
|
|
|
CS.RUN.READ lda #0 reset Buffer
|
2017-09-07 17:32:27 +02:00
|
|
|
|
sta (ZPCMDBuf)
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-01-26 17:28:52 +01:00
|
|
|
|
.1 >SYSCALL Sleep
|
2017-08-22 17:03:34 +02:00
|
|
|
|
>SYSCALL GetChar
|
2017-01-26 17:28:52 +01:00
|
|
|
|
bcs .1 no char
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-01-26 17:28:52 +01:00
|
|
|
|
jsr CS.CHARIN
|
|
|
|
|
|
2017-09-15 17:16:04 +02:00
|
|
|
|
>LDA.G bCmdBufExec
|
2017-01-26 17:28:52 +01:00
|
|
|
|
bpl .1
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-09-07 17:32:27 +02:00
|
|
|
|
>PUSHW ZPCMDBuf
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-09-28 17:39:12 +02:00
|
|
|
|
>PUSHEA.G CMD.VarName
|
2017-01-26 17:28:52 +01:00
|
|
|
|
>SYSCALL SetEnv
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-09-08 16:49:23 +02:00
|
|
|
|
CS.RUN.BATCH jsr CSH.Run
|
2017-09-15 17:16:04 +02:00
|
|
|
|
bcc .7
|
|
|
|
|
|
|
|
|
|
cmp #MLI.ERR.EOF
|
|
|
|
|
beq .9
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-09-15 17:16:04 +02:00
|
|
|
|
pha
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-07-13 17:22:13 +02:00
|
|
|
|
ldy #CSH.BufPtr+1
|
|
|
|
|
>PUSHB (pData),y
|
|
|
|
|
dey
|
|
|
|
|
>PUSHB (pData),y
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-07-13 17:22:13 +02:00
|
|
|
|
>LDYA L.MSG.CSHERR
|
2017-08-25 17:02:16 +02:00
|
|
|
|
>SYSCALL PrintF.YA
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-08-01 21:41:01 +02:00
|
|
|
|
jsr CSH.RestorePtr
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-09-15 17:16:04 +02:00
|
|
|
|
jsr CSH.GetChar
|
|
|
|
|
bcs .2
|
2017-08-25 08:37:21 +02:00
|
|
|
|
>SYSCALL PutChar.A
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-09-15 17:16:04 +02:00
|
|
|
|
.1 jsr CSH.GetNextChar
|
|
|
|
|
bcs .2
|
2017-07-13 17:22:13 +02:00
|
|
|
|
cmp #13
|
2017-09-15 17:16:04 +02:00
|
|
|
|
beq .2
|
2017-08-25 08:37:21 +02:00
|
|
|
|
>SYSCALL PutChar.A
|
2017-09-15 17:16:04 +02:00
|
|
|
|
bra .1
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-09-15 17:16:04 +02:00
|
|
|
|
.2 pla
|
2017-07-12 17:25:23 +02:00
|
|
|
|
|
2017-09-15 17:16:04 +02:00
|
|
|
|
ldy #S.PS.RC
|
2017-07-12 17:25:23 +02:00
|
|
|
|
sta (pPs),y
|
2017-07-13 17:22:13 +02:00
|
|
|
|
pha
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-07-12 17:25:23 +02:00
|
|
|
|
ldy #bExitOnEOF
|
2015-11-23 15:54:30 +01:00
|
|
|
|
lda (pData),y
|
2017-07-12 17:25:23 +02:00
|
|
|
|
asl CS if bExitOnEOF
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-07-13 17:22:13 +02:00
|
|
|
|
pla
|
2017-01-26 17:28:52 +01:00
|
|
|
|
rts
|
2017-09-15 17:16:04 +02:00
|
|
|
|
|
|
|
|
|
.7 >LDA.G bCmdBufExec
|
|
|
|
|
bpl .8 Empty line....nothing to do....
|
|
|
|
|
|
|
|
|
|
jsr Cmd.Parse
|
|
|
|
|
|
|
|
|
|
lda (ZPCMDBuf)
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
jsr Cmd.Exec
|
|
|
|
|
bcs .8
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
|
|
|
|
|
.8 ldy #S.PS.RC
|
|
|
|
|
sta (pPs),y
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 lda #0
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2015-03-14 22:48:35 +01:00
|
|
|
|
*--------------------------------------
|
2017-07-17 07:59:30 +02:00
|
|
|
|
CS.DOEVENT lda (pEvent)
|
|
|
|
|
bpl .9
|
|
|
|
|
|
|
|
|
|
jsr CheckSleep
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
* ldy #Sleep already set by CheckSleep
|
|
|
|
|
clc
|
|
|
|
|
ldx #4
|
|
|
|
|
|
|
|
|
|
.1 lda (pData),y
|
|
|
|
|
sbc #0
|
|
|
|
|
sta (pData),y
|
|
|
|
|
iny
|
|
|
|
|
dex
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
.9 sec
|
2015-12-13 22:29:51 +01:00
|
|
|
|
rts
|
2017-01-12 18:43:45 +01:00
|
|
|
|
*--------------------------------------
|
2017-09-05 17:17:10 +02:00
|
|
|
|
CS.CHARIN tax Save Char
|
2017-09-13 08:17:46 +02:00
|
|
|
|
>LDA.G CSH.hBuf Batch mode ?
|
2015-11-22 23:30:06 +01:00
|
|
|
|
beq .10
|
2017-09-13 08:17:46 +02:00
|
|
|
|
* Batch Mode
|
2015-11-22 23:30:06 +01:00
|
|
|
|
cpx #3 test Ctrl-c
|
|
|
|
|
bne .12
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-09-08 16:49:23 +02:00
|
|
|
|
>LDA.G bExitOnEOF
|
|
|
|
|
>STA.G bExit
|
2015-11-22 23:30:06 +01:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.12 cpx #19 test Ctrl-s
|
|
|
|
|
bne .8
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2015-11-22 23:30:06 +01:00
|
|
|
|
lda #$80
|
2017-09-08 16:49:23 +02:00
|
|
|
|
>STA.G bPause
|
2015-12-13 22:29:51 +01:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2017-09-26 17:55:25 +02:00
|
|
|
|
*--------------------------------------
|
2017-09-13 08:17:46 +02:00
|
|
|
|
* interactive mode
|
2017-09-15 08:37:15 +02:00
|
|
|
|
.10 >LDA.G bEscMode
|
2015-12-13 22:29:51 +01:00
|
|
|
|
beq .13
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2015-12-13 22:29:51 +01:00
|
|
|
|
cpx #'['
|
|
|
|
|
beq .8
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2015-12-13 22:29:51 +01:00
|
|
|
|
lda #0
|
2017-09-05 17:17:10 +02:00
|
|
|
|
sta (pData),y Y=bEscMode
|
2015-12-13 22:29:51 +01:00
|
|
|
|
txa
|
|
|
|
|
|
2017-09-26 17:55:25 +02:00
|
|
|
|
ldx #EscChars.count-1
|
|
|
|
|
|
2015-12-13 22:29:51 +01:00
|
|
|
|
.17 cmp EscChars,x
|
|
|
|
|
beq .18
|
|
|
|
|
dex
|
2017-09-26 17:55:25 +02:00
|
|
|
|
bpl .17
|
|
|
|
|
clc
|
|
|
|
|
rts
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-09-26 17:55:25 +02:00
|
|
|
|
.18 txa
|
|
|
|
|
asl
|
2015-12-13 22:29:51 +01:00
|
|
|
|
tax
|
2017-09-26 17:55:25 +02:00
|
|
|
|
jmp (J.ESC,x)
|
|
|
|
|
*--------------------------------------
|
2015-12-13 22:29:51 +01:00
|
|
|
|
.13 cpx #$20
|
2017-09-26 17:55:25 +02:00
|
|
|
|
bcc CS.CHARIN.CTRL
|
2015-03-14 22:48:35 +01:00
|
|
|
|
|
2015-06-03 20:30:57 +02:00
|
|
|
|
.1 cpx #$7f
|
2015-03-14 22:48:35 +01:00
|
|
|
|
bne .2
|
2017-09-26 17:55:25 +02:00
|
|
|
|
jmp CmdLine.DEL
|
2015-03-14 22:48:35 +01:00
|
|
|
|
|
2017-09-08 16:49:23 +02:00
|
|
|
|
.2 >LDA.G CmdBuflen
|
2017-01-26 17:28:52 +01:00
|
|
|
|
cmp #CmdLine.MAX
|
2017-09-26 17:55:25 +02:00
|
|
|
|
beq .8 Buffer full, discard...
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2015-06-03 20:30:57 +02:00
|
|
|
|
inc
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
2017-09-27 17:40:31 +02:00
|
|
|
|
clc Len-1-Ptr !!!!!
|
|
|
|
|
>SBC.G CmdBufPtr
|
|
|
|
|
beq .30
|
2017-09-29 16:57:20 +02:00
|
|
|
|
|
2017-09-27 17:40:31 +02:00
|
|
|
|
phx
|
|
|
|
|
tax
|
|
|
|
|
>LDA.G CmdBuflen
|
2017-09-26 17:55:25 +02:00
|
|
|
|
tay
|
2017-09-27 17:40:31 +02:00
|
|
|
|
|
|
|
|
|
.3 lda (ZPCMDBuf),y Move from Ptr To end of buffer forward...
|
|
|
|
|
iny
|
|
|
|
|
sta (ZPCMDBuf),y
|
|
|
|
|
dey
|
|
|
|
|
dey
|
|
|
|
|
dex
|
|
|
|
|
bne .3
|
|
|
|
|
plx
|
|
|
|
|
|
|
|
|
|
.30 >LDA.G CmdBufPtr Insert char at Ptr
|
2017-09-26 17:55:25 +02:00
|
|
|
|
tay
|
2017-09-27 08:14:13 +02:00
|
|
|
|
txa
|
2017-09-26 17:55:25 +02:00
|
|
|
|
sta (ZPCMDBuf),y
|
2017-09-27 17:40:31 +02:00
|
|
|
|
>SYSCALL PutChar.A
|
2017-09-26 17:55:25 +02:00
|
|
|
|
|
|
|
|
|
>INC.G CmdBufPtr
|
|
|
|
|
>CMP.G CmdBuflen
|
2017-09-29 16:57:20 +02:00
|
|
|
|
bne .8
|
|
|
|
|
|
|
|
|
|
tay
|
|
|
|
|
lda #0
|
|
|
|
|
sta (ZPCMDBuf),y
|
2017-09-27 08:14:13 +02:00
|
|
|
|
|
2017-09-29 16:57:20 +02:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2017-09-27 08:14:13 +02:00
|
|
|
|
|
2017-09-29 16:57:20 +02:00
|
|
|
|
.8 jmp CmdLine.PRINTPTR
|
2015-03-14 22:48:35 +01:00
|
|
|
|
*--------------------------------------
|
2017-09-26 17:55:25 +02:00
|
|
|
|
CS.CHARIN.CTRL
|
|
|
|
|
cpx #13 CR
|
2015-03-14 22:48:35 +01:00
|
|
|
|
bne .10
|
2017-09-26 17:55:25 +02:00
|
|
|
|
|
2015-11-22 23:30:06 +01:00
|
|
|
|
txa
|
2017-08-25 08:37:21 +02:00
|
|
|
|
>SYSCALL PutChar.A
|
2017-02-28 17:58:36 +01:00
|
|
|
|
lda #10
|
2017-08-25 08:37:21 +02:00
|
|
|
|
>SYSCALL PutChar.A
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-09-27 17:40:31 +02:00
|
|
|
|
>LDA.G CmdBufPtr
|
|
|
|
|
tay
|
|
|
|
|
lda #0
|
|
|
|
|
sta (ZPCMDBuf),y
|
|
|
|
|
tya
|
|
|
|
|
>STA.G CmdBuflen
|
|
|
|
|
|
2017-09-01 17:40:26 +02:00
|
|
|
|
lda #$ff
|
2017-09-08 16:49:23 +02:00
|
|
|
|
>STA.G bCmdBufexec
|
2015-03-14 22:48:35 +01:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2015-12-13 22:29:51 +01:00
|
|
|
|
.10 cpx #$1B esc
|
|
|
|
|
bne .11
|
|
|
|
|
|
|
|
|
|
lda #$ff
|
2017-09-08 16:49:23 +02:00
|
|
|
|
>STA.G bEscMode
|
2015-12-13 22:29:51 +01:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.11 cpx #3 Ctrl-C
|
2015-03-14 22:48:35 +01:00
|
|
|
|
bne .8
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2017-09-26 17:55:25 +02:00
|
|
|
|
jsr CmdLine.CLR
|
2015-03-14 22:48:35 +01:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2017-09-13 08:17:46 +02:00
|
|
|
|
|
2015-11-22 23:30:06 +01:00
|
|
|
|
.8 clc
|
2015-03-14 22:48:35 +01:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-08-17 08:25:58 +02:00
|
|
|
|
CS.QUIT jsr HIS.Quit
|
2017-07-21 16:46:25 +02:00
|
|
|
|
jsr CSH.Quit
|
2017-09-22 08:38:22 +02:00
|
|
|
|
jsr CMD.Quit
|
2017-07-21 16:46:25 +02:00
|
|
|
|
clc
|
2015-03-14 22:48:35 +01:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-07-17 07:59:30 +02:00
|
|
|
|
CheckSleep ldy #Sleep+3
|
|
|
|
|
lda (pData),y
|
|
|
|
|
dey
|
|
|
|
|
ora (pData),y
|
|
|
|
|
dey
|
|
|
|
|
ora (pData),y
|
|
|
|
|
dey
|
|
|
|
|
ora (pData),y
|
|
|
|
|
rts
|
2015-03-14 22:48:35 +01:00
|
|
|
|
*--------------------------------------
|
2016-10-29 21:58:21 +02:00
|
|
|
|
SetPWD ldy #S.PS.hPREFIX
|
|
|
|
|
lda (pPs),y
|
2017-08-25 08:37:21 +02:00
|
|
|
|
>SYSCALL GetMemPtr.A
|
2016-10-29 21:58:21 +02:00
|
|
|
|
>PUSHYA
|
|
|
|
|
>PUSHW L.ENV.PWD
|
|
|
|
|
>SYSCALL SetEnv
|
|
|
|
|
rts
|
2015-11-22 23:30:06 +01:00
|
|
|
|
*--------------------------------------
|
2016-10-29 21:58:21 +02:00
|
|
|
|
PrintPrompt >LDYA L.ENV.PS1
|
2017-08-31 08:23:29 +02:00
|
|
|
|
>SYSCALL GetEnv.YA
|
2017-08-24 17:29:22 +02:00
|
|
|
|
>SYSCALL ExpandStr.YA
|
2016-10-29 21:58:21 +02:00
|
|
|
|
phx
|
|
|
|
|
>PUSHYA
|
|
|
|
|
>LDYA L.MSG.PROMPT
|
2017-08-25 17:02:16 +02:00
|
|
|
|
>SYSCALL PrintF.YA
|
2017-07-10 17:50:32 +02:00
|
|
|
|
plx
|
|
|
|
|
php
|
|
|
|
|
pha
|
|
|
|
|
txa
|
2017-08-25 08:37:21 +02:00
|
|
|
|
>SYSCALL FreeMem.A
|
2017-07-10 17:50:32 +02:00
|
|
|
|
pla
|
|
|
|
|
plp
|
2017-09-18 08:30:07 +02:00
|
|
|
|
rts
|
2015-11-22 23:30:06 +01:00
|
|
|
|
*--------------------------------------
|
2017-09-27 17:40:31 +02:00
|
|
|
|
.INB /A2OSX.SRC/SBIN/SHELL.S.CL
|
2017-03-29 17:48:15 +02:00
|
|
|
|
.INB /A2OSX.SRC/SBIN/SHELL.S.CMD
|
2017-07-13 17:22:13 +02:00
|
|
|
|
.INB /A2OSX.SRC/SBIN/SHELL.S.CSH
|
2017-08-22 08:37:03 +02:00
|
|
|
|
.INB /A2OSX.SRC/SBIN/SHELL.S.IO
|
2017-03-29 17:48:15 +02:00
|
|
|
|
.INB /A2OSX.SRC/SBIN/SHELL.S.HIS
|
2015-03-14 22:48:35 +01:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
|
|
|
|
*--------------------------------------
|
2017-09-11 17:29:08 +02:00
|
|
|
|
ENV.PATH >CSTR "PATH"
|
|
|
|
|
ENV.PWD >CSTR "PWD"
|
|
|
|
|
ENV.PS1 >CSTR "PS1"
|
2017-09-28 17:39:12 +02:00
|
|
|
|
ENV.HOME >CSTR "HOME"
|
2017-09-11 17:29:08 +02:00
|
|
|
|
*--------------------------------------
|
2017-09-13 17:34:26 +02:00
|
|
|
|
INTCMDS >CSTR "CD"
|
|
|
|
|
>CSTR "DATE"
|
|
|
|
|
>CSTR "ECHO"
|
|
|
|
|
>CSTR "EXIT"
|
|
|
|
|
>CSTR "PAUSE"
|
|
|
|
|
>CSTR "PWD"
|
|
|
|
|
>CSTR "READ"
|
|
|
|
|
>CSTR "SET"
|
|
|
|
|
>CSTR "SLEEP"
|
|
|
|
|
>CSTR "STARTPROC"
|
|
|
|
|
>CSTR "TIME"
|
2015-10-19 22:35:00 +02:00
|
|
|
|
.HS 00
|
2017-07-13 17:22:13 +02:00
|
|
|
|
CSHCMDS >PSTR "IF"
|
2017-07-12 17:25:23 +02:00
|
|
|
|
>PSTR "WHILE"
|
|
|
|
|
>PSTR "BREAK"
|
|
|
|
|
>PSTR "CONTINUE"
|
2017-07-21 16:46:25 +02:00
|
|
|
|
>PSTR "CHAR"
|
|
|
|
|
>PSTR "INT"
|
|
|
|
|
>PSTR "LONG"
|
|
|
|
|
>PSTR "FLOAT"
|
2017-07-11 17:53:52 +02:00
|
|
|
|
.HS 00
|
2015-03-14 22:48:35 +01:00
|
|
|
|
*--------------------------------------
|
2017-09-21 17:29:45 +02:00
|
|
|
|
MSG.GREETINGS >CSTR "\r\nA2osX-Shell 0.9.1\r\n\r\n"
|
2017-09-11 17:29:08 +02:00
|
|
|
|
MSG.PROMPT >CSTR "%s$ "
|
|
|
|
|
MSG.ECHO >CSTR ">%s\r\n"
|
|
|
|
|
MSG.ERROR >CSTR "[$%h]:%S.\r\n"
|
2017-09-11 08:11:57 +02:00
|
|
|
|
MSG.PRINTENV >CSTR "%s=%s\r\n"
|
2017-09-11 17:29:08 +02:00
|
|
|
|
MSG.CSHERR >CSTR "Pos %D:"
|
2017-08-22 08:37:03 +02:00
|
|
|
|
FMT.DATE >CSTR "%A, %B %d %Y"
|
|
|
|
|
FMT.TIME >CSTR "%H:%M:%S (%I:%M:%S%p)"
|
2016-10-29 21:58:21 +02:00
|
|
|
|
*--------------------------------------
|
2017-03-29 17:48:15 +02:00
|
|
|
|
.INB /A2OSX.SRC/X.ERRORS.S
|
2016-10-17 17:47:50 +02:00
|
|
|
|
*--------------------------------------
|
2017-09-26 17:55:25 +02:00
|
|
|
|
EscChars.Count .EQ 4
|
|
|
|
|
EscChars .AS 'DBAC'
|
|
|
|
|
|
2017-07-21 16:46:25 +02:00
|
|
|
|
CSH.TSIZE .HS 0001020405 00,CHAR,INT,LONG,FLOAT....
|
|
|
|
|
CSH.ACCT .BS 1
|
|
|
|
|
CSH.ACC .BS 5
|
|
|
|
|
CSH.ARGT .BS 1
|
|
|
|
|
CSH.ARG .BS 5
|
2015-03-14 22:48:35 +01:00
|
|
|
|
*--------------------------------------
|
2015-06-03 20:30:57 +02:00
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
2015-03-14 22:48:35 +01:00
|
|
|
|
DS.START
|
2017-09-01 17:40:26 +02:00
|
|
|
|
hCmdBuf .BS 1
|
2017-09-26 17:55:25 +02:00
|
|
|
|
CmdBufPtr .BS 1
|
2017-09-05 17:17:10 +02:00
|
|
|
|
CmdBuflen .BS 1
|
|
|
|
|
bCmdBufexec .BS 1
|
2017-09-01 17:40:26 +02:00
|
|
|
|
|
2015-12-13 22:29:51 +01:00
|
|
|
|
bEscMode .BS 1
|
2015-11-22 23:30:06 +01:00
|
|
|
|
bPause .BS 1
|
|
|
|
|
bExit .BS 1
|
2016-01-10 23:19:11 +01:00
|
|
|
|
bEcho .BS 1
|
2015-12-13 22:29:51 +01:00
|
|
|
|
bExitOnEOF .BS 1
|
2017-09-06 17:00:10 +02:00
|
|
|
|
|
|
|
|
|
bReadMode .BS 1
|
|
|
|
|
bSecureRead .BS 1
|
|
|
|
|
|
2017-07-17 07:59:30 +02:00
|
|
|
|
Sleep .BS 4
|
2017-09-06 17:00:10 +02:00
|
|
|
|
|
2017-09-07 17:32:27 +02:00
|
|
|
|
CMD.hCmdLine .BS 1
|
2017-09-13 17:34:26 +02:00
|
|
|
|
CMD.hFullpath .BS 1
|
2017-09-14 17:21:06 +02:00
|
|
|
|
CMD.bStartProc .BS 1
|
2017-09-07 17:32:27 +02:00
|
|
|
|
CMD.VarName .BS VarLen.MAX+1
|
2017-09-13 17:34:26 +02:00
|
|
|
|
CMD.Stat .BS S.STAT
|
2017-09-15 17:16:04 +02:00
|
|
|
|
CMD.Time .BS S.TIME
|
2017-09-05 17:17:10 +02:00
|
|
|
|
|
2017-08-22 08:37:03 +02:00
|
|
|
|
HIS.hBuf .BS 1
|
2017-09-25 17:50:33 +02:00
|
|
|
|
HIS.Count .BS 1
|
|
|
|
|
HIS.Index .BS 1
|
2017-09-05 17:17:10 +02:00
|
|
|
|
|
2017-08-22 08:37:03 +02:00
|
|
|
|
IO.hIn .BS 1
|
|
|
|
|
IO.hOut .BS 1
|
|
|
|
|
IO.hErr .BS 1
|
2017-09-05 17:17:10 +02:00
|
|
|
|
|
2017-07-13 17:22:13 +02:00
|
|
|
|
CSH.hBuf .BS 1
|
|
|
|
|
CSH.BufPtr .BS 2
|
|
|
|
|
CSH.BufLen .BS 2
|
|
|
|
|
CSH.BufPtrSave .BS 2
|
2017-07-21 16:46:25 +02:00
|
|
|
|
CSH.hSymbols .BS 1
|
|
|
|
|
CSH.SymbolsPtr .BS 1
|
|
|
|
|
CSH.hData .BS 1
|
|
|
|
|
CSH.DataPtr .BS 1
|
2017-07-13 17:22:13 +02:00
|
|
|
|
CSH.hStack .BS 1
|
|
|
|
|
CSH.StackPtr .BS 1
|
2017-07-21 16:46:25 +02:00
|
|
|
|
CSH.CmdSave .BS 1
|
2017-07-25 16:37:19 +02:00
|
|
|
|
CSH.Name .BS CSH.Name.MAX+1
|
2017-07-11 17:53:52 +02:00
|
|
|
|
DS.END .ED
|
2015-03-14 22:48:35 +01:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2017-03-29 17:48:15 +02:00
|
|
|
|
SAVE /A2OSX.SRC/SBIN/SHELL.S
|
2015-03-14 22:48:35 +01:00
|
|
|
|
ASM
|