2015-03-14 21:48:35 +00:00
|
|
|
|
PR#3
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2015-03-14 21:48:35 +00:00
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.LIST OFF
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2017-03-29 15:48:15 +00:00
|
|
|
|
.TF /A2OSX.BUILD/SBIN/SHELL
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2017-03-29 15:48:15 +00:00
|
|
|
|
.INB /A2OSX.BUILD/INC/MACROS.I
|
|
|
|
|
.INB /A2OSX.BUILD/INC/A2OSX.I
|
|
|
|
|
.INB /A2OSX.BUILD/INC/MLI.ERR.I
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
ZPPTR1 .EQ ZPBIN
|
|
|
|
|
ZPPTR2 .EQ ZPBIN+2
|
|
|
|
|
ZPPTR3 .EQ ZPBIN+4
|
2017-07-21 14:46:25 +00:00
|
|
|
|
ZPBufBase .EQ ZPBIN+6
|
|
|
|
|
ZPBufPtr .EQ ZPBIN+8
|
|
|
|
|
ZPCSHSymbols .EQ ZPBIN+10
|
|
|
|
|
ZPCSHData .EQ ZPBIN+12
|
2017-07-13 15:22:13 +00:00
|
|
|
|
ZPCSHStack .EQ ZPBIN+14
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2017-01-26 16:28:52 +00:00
|
|
|
|
CmdLine.MAX .EQ 127
|
|
|
|
|
VarLen.MAX .EQ 15
|
2017-07-12 15:25:23 +00:00
|
|
|
|
CSH.Stack.MAX .EQ 15
|
2017-07-25 14:37:19 +00:00
|
|
|
|
CSH.Name.MAX .EQ 15
|
2017-07-13 15:22:13 +00:00
|
|
|
|
CSHERR.SYNTAX .EQ $7F
|
|
|
|
|
CSHERR.SOVERFLW .EQ $7E
|
|
|
|
|
CSHERR.NOVERFLW .EQ $7D
|
2017-07-21 14:46:25 +00:00
|
|
|
|
CSHERR.OOM .EQ $7C
|
|
|
|
|
CSHERR.DUP .EQ $7B
|
|
|
|
|
CSHERR.UNDEF .EQ $7A
|
2017-07-25 14:37:19 +00:00
|
|
|
|
CSHERR.TOOLONG .EQ $79
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
* File Header (16 Bytes)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.START cld
|
|
|
|
|
jmp (.1,x)
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DA #$61 6502,Level 1 (65c02)
|
|
|
|
|
.DA #1 BIN Layout Version 1
|
|
|
|
|
.DA 0
|
|
|
|
|
.DA CS.END-CS.START Code Length To Relocate
|
|
|
|
|
.DA DS.END-DS.START Data Segment to Allocate
|
|
|
|
|
.DA 0
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.1 .DA CS.INIT
|
|
|
|
|
.DA CS.RUN
|
|
|
|
|
.DA CS.DOEVENT
|
|
|
|
|
.DA CS.QUIT
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
L.MSG.GREETINGS .DA MSG.GREETINGS
|
2016-10-29 19:58:21 +00:00
|
|
|
|
L.MSG.PROMPT .DA MSG.PROMPT
|
2016-10-17 06:21:04 +00:00
|
|
|
|
L.MSG.ECHO .DA MSG.ECHO
|
2017-08-22 06:37:03 +00:00
|
|
|
|
L.MSG.PSTRCR .DA MSG.PSTRCR
|
|
|
|
|
L.MSG.PSTR .DA MSG.PSTR
|
2015-11-22 22:30:06 +00:00
|
|
|
|
L.MSG.ERROR .DA MSG.ERROR
|
2016-10-17 15:47:50 +00:00
|
|
|
|
L.MSG.PRINTENV .DA MSG.PRINTENV
|
2017-07-13 15:22:13 +00:00
|
|
|
|
L.MSG.CSHERR .DA MSG.CSHERR
|
2015-10-19 20:35:00 +00:00
|
|
|
|
L.ENV.PATH .DA ENV.PATH
|
2016-10-29 19:58:21 +00:00
|
|
|
|
L.ENV.PWD .DA ENV.PWD
|
|
|
|
|
L.ENV.PS1 .DA ENV.PS1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
L.CMD .DA CMD
|
|
|
|
|
L.ARGS .DA ARGS
|
2016-09-05 16:00:11 +00:00
|
|
|
|
L.TIME .DA TIME
|
2016-09-26 16:02:14 +00:00
|
|
|
|
L.STAT .DA STAT
|
2016-09-05 16:00:11 +00:00
|
|
|
|
L.FMT.DATE .DA FMT.DATE
|
|
|
|
|
L.FMT.TIME .DA FMT.TIME
|
2017-07-11 15:53:52 +00:00
|
|
|
|
L.INTCMDS .DA INTCMDS
|
2016-08-17 06:25:58 +00: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 06:58:15 +00:00
|
|
|
|
.DA Cmd.Exec.PWD
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.DA Cmd.Exec.READ
|
|
|
|
|
.DA Cmd.Exec.SET
|
2017-07-17 05:59:30 +00:00
|
|
|
|
.DA Cmd.Exec.SLEEP
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.DA Cmd.Exec.STARTPROC
|
|
|
|
|
.DA Cmd.Exec.TIME
|
2017-07-13 15:22:13 +00:00
|
|
|
|
L.CSHCMDS .DA CSHCMDS
|
|
|
|
|
J.CSHCMDS .DA CSH.IF
|
|
|
|
|
.DA CSH.WHILE
|
|
|
|
|
.DA CSH.BREAK
|
|
|
|
|
.DA CSH.CONTINUE
|
2017-07-21 14:46:25 +00:00
|
|
|
|
.DA CSH.CHAR
|
|
|
|
|
.DA CSH.INT
|
|
|
|
|
.DA CSH.LONG
|
|
|
|
|
.DA CSH.FLOAT
|
2017-07-13 15:22:13 +00:00
|
|
|
|
J.CSHCMDS.END .DA CSH.IF.END
|
|
|
|
|
.DA CSH.WHILE.END
|
2017-07-17 05:59:30 +00:00
|
|
|
|
L.CSH.ACC .DA CSH.ACC
|
2016-10-29 19:58:21 +00:00
|
|
|
|
L.ERR.Codes .DA ERR.Codes
|
|
|
|
|
L.ERR.Messages .DA ERR.Messages
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
2016-10-29 19:58:21 +00:00
|
|
|
|
CS.INIT jsr SetPWD
|
|
|
|
|
|
2017-07-17 05:59:30 +00:00
|
|
|
|
lda (pPs)
|
|
|
|
|
ora #S.PS.F.EVENT Now accept events
|
|
|
|
|
sta (pPs)
|
2017-07-13 15:22:13 +00:00
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
>SYSCALL GetArgC
|
2016-08-17 06:25:58 +00:00
|
|
|
|
cmp #1
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2017-07-13 15:22:13 +00:00
|
|
|
|
beq .1 no arg, continue starting interactive
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-07-10 15:50:32 +00:00
|
|
|
|
>PUSHWI 0 Aux type
|
|
|
|
|
>PUSHBI 4 S.FILEINFO.TYPE.TXT
|
|
|
|
|
>PUSHBI SYS.FOpen.R
|
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
lda #1
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>SYSCALL GetArgA
|
2017-07-10 15:50:32 +00:00
|
|
|
|
>PUSHYA
|
|
|
|
|
>SYSCALL LoadFile
|
2015-11-22 22:30:06 +00:00
|
|
|
|
bcs .9
|
2015-10-19 20:35:00 +00:00
|
|
|
|
|
2017-07-10 15:50:32 +00:00
|
|
|
|
phy
|
2017-07-13 15:22:13 +00:00
|
|
|
|
ldy #CSH.BufLen+1
|
2017-07-10 15:50:32 +00:00
|
|
|
|
sta (pData),y
|
|
|
|
|
dey
|
|
|
|
|
pla
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
txa
|
2017-07-13 15:22:13 +00:00
|
|
|
|
ldy #CSH.hBuf
|
2017-07-10 15:50:32 +00:00
|
|
|
|
sta (pData),y
|
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
ldy #bExitOnEOF
|
|
|
|
|
lda #$FF
|
|
|
|
|
sta (pData),y
|
2017-07-12 15:25:23 +00:00
|
|
|
|
|
2017-07-21 14:46:25 +00:00
|
|
|
|
jmp CSH.Init
|
2017-07-12 15:25:23 +00:00
|
|
|
|
|
2017-07-13 15:22:13 +00:00
|
|
|
|
.1 jsr HIS.Init
|
2015-10-19 20:35:00 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
>LDYA L.MSG.GREETINGS
|
2017-08-22 06:37:03 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2017-07-13 15:22:13 +00:00
|
|
|
|
* clc
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.9 rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2017-07-17 05:59:30 +00:00
|
|
|
|
CS.RUN ldy #VarBuffer READ Command ?
|
2017-01-26 16:28:52 +00:00
|
|
|
|
lda (pData),y
|
|
|
|
|
bne CS.RUN.READ
|
2016-11-08 16:56:05 +00:00
|
|
|
|
|
2017-02-23 16:43:42 +00:00
|
|
|
|
ldy #S.PS.RC
|
|
|
|
|
lda (pPs),y
|
|
|
|
|
beq .11
|
|
|
|
|
|
2017-08-22 06:37:03 +00:00
|
|
|
|
jsr IO.PrintErrMsg
|
2017-02-23 16:43:42 +00:00
|
|
|
|
bcs CS.RUN.EXIT.RTS
|
|
|
|
|
|
2017-07-17 05:59:30 +00:00
|
|
|
|
.11 ldy #bPause
|
|
|
|
|
lda (pData),y
|
|
|
|
|
bpl .13
|
|
|
|
|
|
|
|
|
|
>SYSCALL GetC
|
|
|
|
|
bcs .8
|
|
|
|
|
|
|
|
|
|
.13 jsr CheckSleep
|
|
|
|
|
bne .8
|
|
|
|
|
|
|
|
|
|
ldy #CSH.hBuf batch mode ?
|
2015-11-22 22:30:06 +00:00
|
|
|
|
lda (pData),y
|
2017-01-26 16:28:52 +00:00
|
|
|
|
beq .10
|
|
|
|
|
|
|
|
|
|
jmp CS.RUN.BATCH
|
|
|
|
|
|
|
|
|
|
.10 lda #0
|
|
|
|
|
sta (pData)
|
|
|
|
|
|
|
|
|
|
ldy #bSecureRead
|
|
|
|
|
sta (pData),y
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2017-02-23 16:43:42 +00:00
|
|
|
|
.12 jsr PrintPrompt
|
2017-01-26 16:28:52 +00:00
|
|
|
|
bcs CS.RUN.EXIT.RTS
|
2015-12-10 18:53:30 +00:00
|
|
|
|
|
2016-10-24 15:54:43 +00:00
|
|
|
|
.1 >SYSCALL Sleep
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>SYSCALL GetC
|
|
|
|
|
bcs .1 no char
|
|
|
|
|
|
|
|
|
|
jsr CS.CHARIN
|
|
|
|
|
|
2015-06-24 20:41:38 +00:00
|
|
|
|
lda (pData)
|
|
|
|
|
bpl .1
|
2017-01-12 17:43:45 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
and #$7F
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (pData)
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2017-07-17 05:59:30 +00:00
|
|
|
|
jsr Cmd.Normalize
|
2016-08-17 06:25:58 +00:00
|
|
|
|
lda (pData)
|
2017-02-23 16:43:42 +00:00
|
|
|
|
beq .12 Empty line
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
jsr HIS.Add
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2017-01-26 16:28:52 +00:00
|
|
|
|
>LDYA pData
|
2016-08-17 06:25:58 +00:00
|
|
|
|
jsr Cmd.ExecYA
|
2017-02-23 16:43:42 +00:00
|
|
|
|
|
2017-01-26 16:28:52 +00:00
|
|
|
|
ldy #S.PS.RC
|
|
|
|
|
sta (pPs),y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2017-07-17 05:59:30 +00:00
|
|
|
|
ldy #bEXIT
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (pData),y
|
2017-01-26 16:28:52 +00:00
|
|
|
|
bne CS.RUN.EXIT
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
2017-07-17 05:59:30 +00:00
|
|
|
|
.8 clc
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2017-01-26 16:28:52 +00:00
|
|
|
|
CS.RUN.EXIT lda #0
|
|
|
|
|
CS.RUN.EXIT.ERR sec
|
|
|
|
|
CS.RUN.EXIT.RTS rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.READ lda #0
|
|
|
|
|
sta (pData)
|
|
|
|
|
|
|
|
|
|
.1 >SYSCALL Sleep
|
|
|
|
|
>SYSCALL GetC
|
|
|
|
|
bcs .1 no char
|
|
|
|
|
|
|
|
|
|
jsr CS.CHARIN
|
|
|
|
|
|
|
|
|
|
lda (pData)
|
|
|
|
|
bpl .1
|
|
|
|
|
|
|
|
|
|
and #$7F
|
|
|
|
|
sta (pData)
|
|
|
|
|
|
|
|
|
|
>PUSHW pData
|
|
|
|
|
|
|
|
|
|
lda #VarBuffer
|
|
|
|
|
clc
|
|
|
|
|
adc pData
|
|
|
|
|
tay
|
|
|
|
|
lda pData+1
|
|
|
|
|
adc #0
|
|
|
|
|
>PUSHYA
|
|
|
|
|
>SYSCALL SetEnv
|
|
|
|
|
php
|
|
|
|
|
pha
|
|
|
|
|
|
|
|
|
|
ldy #VarBuffer
|
|
|
|
|
lda #0
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
plp
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-07-21 14:46:25 +00:00
|
|
|
|
CS.RUN.BATCH jsr CSH.Run
|
2017-01-26 16:28:52 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
lda (pData)
|
2017-07-12 15:25:23 +00:00
|
|
|
|
beq .8 Empty line....nothing to do....
|
2017-01-26 16:28:52 +00:00
|
|
|
|
|
2017-07-21 14:46:25 +00:00
|
|
|
|
jsr Cmd.Normalize
|
|
|
|
|
lda (pData)
|
|
|
|
|
beq .8
|
|
|
|
|
|
2017-01-26 16:28:52 +00:00
|
|
|
|
>LDYA pData
|
|
|
|
|
jsr Cmd.ExecYA
|
2017-07-12 15:25:23 +00:00
|
|
|
|
|
|
|
|
|
.8 ldy #S.PS.RC
|
2017-01-26 16:28:52 +00:00
|
|
|
|
sta (pPs),y
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2017-07-12 15:25:23 +00:00
|
|
|
|
.9 cmp #MLI.ERR.EOF
|
2017-07-21 14:46:25 +00:00
|
|
|
|
bne .7
|
|
|
|
|
lda #0
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2017-07-12 15:25:23 +00:00
|
|
|
|
|
2017-07-21 14:46:25 +00:00
|
|
|
|
.7 pha
|
2017-07-13 15:22:13 +00:00
|
|
|
|
|
|
|
|
|
ldy #CSH.BufPtr+1
|
|
|
|
|
>PUSHB (pData),y
|
|
|
|
|
dey
|
|
|
|
|
>PUSHB (pData),y
|
|
|
|
|
|
|
|
|
|
>LDYA L.MSG.CSHERR
|
2017-08-22 06:37:03 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
2017-07-13 15:22:13 +00:00
|
|
|
|
|
2017-08-01 19:41:01 +00:00
|
|
|
|
jsr CSH.RestorePtr
|
|
|
|
|
|
2017-07-13 15:22:13 +00:00
|
|
|
|
.90 jsr CSH.GetChar
|
2017-08-01 19:41:01 +00:00
|
|
|
|
bcs .92
|
2017-07-13 15:22:13 +00:00
|
|
|
|
>SYSCALL PutCA
|
|
|
|
|
|
2017-08-01 19:41:01 +00:00
|
|
|
|
.91 jsr CSH.GetNextChar
|
|
|
|
|
bcs .92
|
2017-07-13 15:22:13 +00:00
|
|
|
|
cmp #13
|
2017-08-01 19:41:01 +00:00
|
|
|
|
beq .92
|
2017-07-13 15:22:13 +00:00
|
|
|
|
>SYSCALL PutCA
|
2017-08-01 19:41:01 +00:00
|
|
|
|
bra .91
|
2017-07-13 15:22:13 +00:00
|
|
|
|
|
2017-08-01 19:41:01 +00:00
|
|
|
|
.92 pla
|
2017-07-13 15:22:13 +00:00
|
|
|
|
bra .99
|
|
|
|
|
|
|
|
|
|
.98 lda #0
|
2017-07-12 15:25:23 +00:00
|
|
|
|
|
2017-07-13 15:22:13 +00:00
|
|
|
|
.99 ldy #S.PS.RC
|
2017-07-12 15:25:23 +00:00
|
|
|
|
sta (pPs),y
|
2017-07-13 15:22:13 +00:00
|
|
|
|
pha
|
2017-07-12 15:25:23 +00:00
|
|
|
|
|
|
|
|
|
ldy #bExitOnEOF
|
2015-11-23 14:54:30 +00:00
|
|
|
|
lda (pData),y
|
2017-07-12 15:25:23 +00:00
|
|
|
|
asl CS if bExitOnEOF
|
2017-01-26 16:28:52 +00:00
|
|
|
|
|
2017-07-13 15:22:13 +00:00
|
|
|
|
pla
|
2017-01-26 16:28:52 +00:00
|
|
|
|
rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2017-07-17 05:59:30 +00: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 21:29:51 +00:00
|
|
|
|
rts
|
2017-01-12 17:43:45 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.CHARIN tax
|
2017-07-13 15:22:13 +00:00
|
|
|
|
ldy #CSH.hBuf Batch mode ?
|
2015-11-22 22:30:06 +00:00
|
|
|
|
lda (pData),y
|
|
|
|
|
beq .10
|
2015-12-13 21:29:51 +00:00
|
|
|
|
* Batch Mode
|
2015-11-22 22:30:06 +00:00
|
|
|
|
cpx #3 test Ctrl-c
|
|
|
|
|
bne .12
|
|
|
|
|
|
|
|
|
|
ldy #bExitOnEOF
|
|
|
|
|
lda (pData),y
|
|
|
|
|
ldy #bExit
|
|
|
|
|
sta (pData),y
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.12 cpx #19 test Ctrl-s
|
|
|
|
|
bne .8
|
|
|
|
|
ldy #bPause
|
|
|
|
|
lda #$80
|
|
|
|
|
sta (pData),y
|
2015-12-13 21:29:51 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
* interactive mode
|
|
|
|
|
.10 ldy #bEscMode
|
|
|
|
|
lda (pData),y
|
|
|
|
|
beq .13
|
|
|
|
|
|
|
|
|
|
cpx #'['
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
|
|
|
|
|
ldx EscChars
|
|
|
|
|
.17 cmp EscChars,x
|
|
|
|
|
beq .18
|
|
|
|
|
dex
|
|
|
|
|
bne .17
|
2015-11-22 22:30:06 +00:00
|
|
|
|
bra .8
|
|
|
|
|
|
2015-12-13 21:29:51 +00:00
|
|
|
|
.18 lda EscAscii,x
|
|
|
|
|
tax
|
|
|
|
|
|
|
|
|
|
.13 cpx #$20
|
2015-06-03 18:30:57 +00:00
|
|
|
|
bcs .1
|
2017-01-12 17:43:45 +00:00
|
|
|
|
jsr CS.CHARIN.CTRL
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bra .8
|
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.1 cpx #$7f
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .2
|
2017-08-22 06:37:03 +00:00
|
|
|
|
jsr CmdLine.DEL
|
2015-12-13 21:29:51 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.2 lda (pData) CmdBuffer
|
|
|
|
|
|
2017-01-26 16:28:52 +00:00
|
|
|
|
cmp #CmdLine.MAX
|
2015-03-14 21:48:35 +00:00
|
|
|
|
beq .8
|
2015-06-03 18:30:57 +00:00
|
|
|
|
|
|
|
|
|
inc
|
|
|
|
|
sta (pData)
|
|
|
|
|
tay
|
|
|
|
|
txa
|
|
|
|
|
sta (pData),y
|
|
|
|
|
|
2017-01-26 16:28:52 +00:00
|
|
|
|
tax
|
|
|
|
|
ldy #bSecureRead
|
|
|
|
|
lda (pData),y
|
|
|
|
|
bne .8
|
|
|
|
|
|
|
|
|
|
txa
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>SYSCALL PutCA
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.8 clc
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-01-12 17:43:45 +00:00
|
|
|
|
CS.CHARIN.CTRL cpx #13 CR
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .10
|
2015-11-22 22:30:06 +00:00
|
|
|
|
txa
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>SYSCALL PutCA
|
2017-02-28 16:58:36 +00:00
|
|
|
|
lda #10
|
|
|
|
|
>SYSCALL PutCA
|
|
|
|
|
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (pData) CmdBuffer
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ora #$80
|
2015-06-03 18:30:57 +00:00
|
|
|
|
sta (pData)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2015-12-13 21:29:51 +00:00
|
|
|
|
.10 cpx #$1B esc
|
|
|
|
|
bne .11
|
|
|
|
|
|
|
|
|
|
ldy #bEscMode
|
|
|
|
|
lda #$ff
|
|
|
|
|
sta (pData),y
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.11 cpx #3 Ctrl-C
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .1
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2017-08-22 06:37:03 +00:00
|
|
|
|
jsr CmdLine.CLR
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.1 cpx #8 BS (left arrow)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .2
|
2017-08-22 06:37:03 +00:00
|
|
|
|
jsr CmdLine.DEL
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.2 cpx #10 LF (down arrow)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .3
|
|
|
|
|
|
2016-09-22 06:19:49 +00:00
|
|
|
|
jsr HIS.GetNext
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.3 cpx #11 VT (up arrow)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .4
|
|
|
|
|
|
2016-09-22 06:19:49 +00:00
|
|
|
|
jsr HIS.GetPrev
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.4 cpx #21 NAK (right arrow)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .8
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.8 clc
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-08-17 06:25:58 +00:00
|
|
|
|
CS.QUIT jsr HIS.Quit
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2017-07-21 14:46:25 +00:00
|
|
|
|
jsr CSH.Quit
|
2017-07-13 15:22:13 +00:00
|
|
|
|
|
2017-07-21 14:46:25 +00:00
|
|
|
|
clc
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-07-17 05:59:30 +00:00
|
|
|
|
CheckSleep ldy #Sleep+3
|
|
|
|
|
lda (pData),y
|
|
|
|
|
dey
|
|
|
|
|
ora (pData),y
|
|
|
|
|
dey
|
|
|
|
|
ora (pData),y
|
|
|
|
|
dey
|
|
|
|
|
ora (pData),y
|
|
|
|
|
rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2016-10-29 19:58:21 +00:00
|
|
|
|
SetPWD ldy #S.PS.hPREFIX
|
|
|
|
|
lda (pPs),y
|
|
|
|
|
>SYSCALL GetMemPtrA
|
|
|
|
|
>PUSHYA
|
|
|
|
|
>PUSHW L.ENV.PWD
|
|
|
|
|
>SYSCALL SetEnv
|
|
|
|
|
rts
|
2015-11-22 22:30:06 +00:00
|
|
|
|
*--------------------------------------
|
2016-10-29 19:58:21 +00:00
|
|
|
|
PrintPrompt >LDYA L.ENV.PS1
|
|
|
|
|
>SYSCALL GetEnvYA
|
|
|
|
|
>SYSCALL ExpandPStrYA
|
|
|
|
|
phx
|
|
|
|
|
>PUSHYA
|
|
|
|
|
>LDYA L.MSG.PROMPT
|
2017-08-22 06:37:03 +00:00
|
|
|
|
>SYSCALL PrintFYA
|
2017-07-10 15:50:32 +00:00
|
|
|
|
plx
|
|
|
|
|
php
|
|
|
|
|
pha
|
|
|
|
|
txa
|
|
|
|
|
>SYSCALL FreeMemA
|
|
|
|
|
pla
|
|
|
|
|
plp
|
2016-10-29 19:58:21 +00:00
|
|
|
|
.9 rts
|
2015-11-22 22:30:06 +00:00
|
|
|
|
*--------------------------------------
|
2017-08-22 06:37:03 +00:00
|
|
|
|
CmdLine.CLR jsr CmdLine.DEL
|
|
|
|
|
bne CmdLine.CLR
|
2015-10-19 20:35:00 +00:00
|
|
|
|
rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2017-08-22 06:37:03 +00:00
|
|
|
|
CmdLine.DEL lda (pData)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
beq .9
|
|
|
|
|
lda #8
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>SYSCALL PutCA
|
2015-06-03 18:30:57 +00:00
|
|
|
|
lda (pData)
|
|
|
|
|
dec
|
|
|
|
|
sta (pData)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.9 rts
|
2017-08-22 06:37:03 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CmdLine.SET >PUSHW pData
|
|
|
|
|
>LDYA L.MSG.PSTR
|
|
|
|
|
>SYSCALL PrintfYA
|
|
|
|
|
rts
|
2015-10-19 20:35:00 +00:00
|
|
|
|
*--------------------------------------
|
2017-03-29 15:48:15 +00:00
|
|
|
|
.INB /A2OSX.SRC/SBIN/SHELL.S.CMD
|
2017-07-13 15:22:13 +00:00
|
|
|
|
.INB /A2OSX.SRC/SBIN/SHELL.S.CSH
|
2017-08-22 06:37:03 +00:00
|
|
|
|
.INB /A2OSX.SRC/SBIN/SHELL.S.IO
|
2017-03-29 15:48:15 +00:00
|
|
|
|
.INB /A2OSX.SRC/SBIN/SHELL.S.HIS
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
|
|
|
|
*--------------------------------------
|
2016-10-24 15:54:43 +00:00
|
|
|
|
ENV.PATH >PSTR "PATH"
|
2016-10-29 19:58:21 +00:00
|
|
|
|
ENV.PWD >PSTR "PWD"
|
|
|
|
|
ENV.PS1 >PSTR "PS1"
|
2017-07-11 15:53:52 +00:00
|
|
|
|
INTCMDS >PSTR "CD"
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>PSTR "DATE"
|
|
|
|
|
>PSTR "ECHO"
|
|
|
|
|
>PSTR "EXIT"
|
|
|
|
|
>PSTR "PAUSE"
|
2016-10-25 06:58:15 +00:00
|
|
|
|
>PSTR "PWD"
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>PSTR "READ"
|
|
|
|
|
>PSTR "SET"
|
2017-07-17 05:59:30 +00:00
|
|
|
|
>PSTR "SLEEP"
|
2016-10-24 15:54:43 +00:00
|
|
|
|
>PSTR "STARTPROC"
|
|
|
|
|
>PSTR "TIME"
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.HS 00
|
2017-07-13 15:22:13 +00:00
|
|
|
|
CSHCMDS >PSTR "IF"
|
2017-07-12 15:25:23 +00:00
|
|
|
|
>PSTR "WHILE"
|
|
|
|
|
>PSTR "BREAK"
|
|
|
|
|
>PSTR "CONTINUE"
|
2017-07-21 14:46:25 +00:00
|
|
|
|
>PSTR "CHAR"
|
|
|
|
|
>PSTR "INT"
|
|
|
|
|
>PSTR "LONG"
|
|
|
|
|
>PSTR "FLOAT"
|
2017-07-11 15:53:52 +00:00
|
|
|
|
.HS 00
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2017-08-22 06:37:03 +00:00
|
|
|
|
MSG.GREETINGS >CSTR "\r\nA2osX-Shell\r\n\r\n"
|
|
|
|
|
MSG.PROMPT >CSTR "%S$ "
|
|
|
|
|
MSG.ECHO >CSTR ">%S\r\n"
|
|
|
|
|
MSG.PSTRCR >CSTR "%S\r\n"
|
|
|
|
|
MSG.PSTR >CSTR "%S"
|
|
|
|
|
MSG.ERROR >CSTR "Err:%S [%h]\r\n"
|
|
|
|
|
MSG.PRINTENV >CSTR "%S=%S\r\n"
|
2017-07-13 15:22:13 +00:00
|
|
|
|
MSG.CSHERR >PSTR "Pos %D:"
|
2017-08-22 06:37:03 +00:00
|
|
|
|
FMT.DATE >CSTR "%A, %B %d %Y"
|
|
|
|
|
FMT.TIME >CSTR "%H:%M:%S (%I:%M:%S%p)"
|
2016-10-29 19:58:21 +00:00
|
|
|
|
*--------------------------------------
|
2017-03-29 15:48:15 +00:00
|
|
|
|
.INB /A2OSX.SRC/X.ERRORS.S
|
2016-10-17 15:47:50 +00:00
|
|
|
|
*--------------------------------------
|
2016-10-24 15:54:43 +00:00
|
|
|
|
EscChars >PSTR "DBAC"
|
2015-12-13 21:29:51 +00:00
|
|
|
|
EscAscii .HS 04080A0B15
|
2016-08-17 06:25:58 +00:00
|
|
|
|
CMD .BS 256
|
|
|
|
|
ARGS .BS 256
|
2016-09-26 16:02:14 +00:00
|
|
|
|
TIME .BS S.TIME
|
|
|
|
|
STAT .BS S.STAT
|
2017-07-11 15:53:52 +00:00
|
|
|
|
bStartProc .BS 1
|
2017-07-21 14:46:25 +00: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 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
2015-03-14 21:48:35 +00:00
|
|
|
|
DS.START
|
2017-01-26 16:28:52 +00:00
|
|
|
|
CmdBuffer .BS CmdLine.MAX+1 (pData)
|
|
|
|
|
VarBuffer .BS VarLen.MAX+1
|
2015-12-13 21:29:51 +00:00
|
|
|
|
bEscMode .BS 1
|
2015-11-22 22:30:06 +00:00
|
|
|
|
bPause .BS 1
|
|
|
|
|
bExit .BS 1
|
2016-01-10 22:19:11 +00:00
|
|
|
|
bEcho .BS 1
|
2017-01-26 16:28:52 +00:00
|
|
|
|
bSecureRead .BS 1
|
2015-12-13 21:29:51 +00:00
|
|
|
|
bExitOnEOF .BS 1
|
2017-07-17 05:59:30 +00:00
|
|
|
|
Sleep .BS 4
|
2017-08-22 06:37:03 +00:00
|
|
|
|
HIS.hBuf .BS 1
|
|
|
|
|
HIS.BufIndex .BS 1
|
|
|
|
|
HIS.BufEnd .BS 1
|
|
|
|
|
IO.hIn .BS 1
|
|
|
|
|
IO.hOut .BS 1
|
|
|
|
|
IO.hErr .BS 1
|
2017-07-13 15:22:13 +00:00
|
|
|
|
CSH.hBuf .BS 1
|
|
|
|
|
CSH.BufPtr .BS 2
|
|
|
|
|
CSH.BufLen .BS 2
|
|
|
|
|
CSH.BufPtrSave .BS 2
|
2017-07-21 14:46:25 +00:00
|
|
|
|
CSH.hSymbols .BS 1
|
|
|
|
|
CSH.SymbolsPtr .BS 1
|
|
|
|
|
CSH.hData .BS 1
|
|
|
|
|
CSH.DataPtr .BS 1
|
2017-07-13 15:22:13 +00:00
|
|
|
|
CSH.hStack .BS 1
|
|
|
|
|
CSH.StackPtr .BS 1
|
2017-07-21 14:46:25 +00:00
|
|
|
|
CSH.CmdSave .BS 1
|
2017-07-25 14:37:19 +00:00
|
|
|
|
CSH.Name .BS CSH.Name.MAX+1
|
2017-07-11 15:53:52 +00:00
|
|
|
|
DS.END .ED
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2017-03-29 15:48:15 +00:00
|
|
|
|
SAVE /A2OSX.SRC/SBIN/SHELL.S
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ASM
|