2017-12-22 21:24:30 +00:00
|
|
|
|
NEW
|
2018-11-17 17:17:13 +00:00
|
|
|
|
PREFIX
|
2017-12-22 21:24:30 +00:00
|
|
|
|
AUTO 4,1
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.LIST OFF
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2019-02-07 16:52:25 +00:00
|
|
|
|
.TF BIN/SH
|
2018-11-10 14:30:09 +00:00
|
|
|
|
*--------------------------------------
|
2018-11-14 14:34:13 +00:00
|
|
|
|
History.MAX .EQ 256
|
2019-01-30 16:23:00 +00:00
|
|
|
|
CORE.STACK.MAX .EQ 64
|
2018-11-26 06:57:11 +00:00
|
|
|
|
PUSHD.STACK.MAX .EQ 8
|
2018-11-14 14:34:13 +00:00
|
|
|
|
*--------------------------------------
|
2019-02-03 21:58:26 +00:00
|
|
|
|
C.NOHUP .EQ 0
|
2018-11-26 06:57:11 +00:00
|
|
|
|
C.CD .EQ 2
|
|
|
|
|
C.DATE .EQ 4
|
|
|
|
|
C.ECHO .EQ 6
|
|
|
|
|
C.EXIT .EQ 8
|
2019-01-23 16:26:48 +00:00
|
|
|
|
C.GETKEY .EQ 10
|
|
|
|
|
C.MD .EQ 12
|
|
|
|
|
C.PAUSE .EQ 14
|
|
|
|
|
C.PWD .EQ 16
|
|
|
|
|
C.RD .EQ 18
|
|
|
|
|
C.READ .EQ 20
|
|
|
|
|
C.REN .EQ 22
|
|
|
|
|
C.SET .EQ 24
|
|
|
|
|
C.SLEEP .EQ 26
|
|
|
|
|
C.SHIFT .EQ 28
|
|
|
|
|
C.TIME .EQ 30
|
|
|
|
|
C.PUSHD .EQ 32
|
|
|
|
|
C.POPD .EQ 34
|
|
|
|
|
C.BREAK .EQ 36
|
|
|
|
|
C.CONTINUE .EQ 38
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
C.FOR .EQ 40
|
|
|
|
|
C.NEXT .EQ 42
|
|
|
|
|
C.WHILE .EQ 44
|
|
|
|
|
C.LOOP .EQ 46
|
|
|
|
|
C.IF .EQ 48
|
|
|
|
|
C.ELSE .EQ 50
|
|
|
|
|
C.FI .EQ 52
|
2018-11-19 16:15:16 +00:00
|
|
|
|
*--------------------------------------
|
2018-11-28 11:39:33 +00:00
|
|
|
|
E.CSYN .EQ $C0
|
2019-02-12 16:47:34 +00:00
|
|
|
|
E.ESYN .EQ $C1
|
|
|
|
|
E.STACKERROR .EQ $C2
|
2018-11-28 11:39:33 +00:00
|
|
|
|
E.STKOVERFLOW .EQ $C3
|
|
|
|
|
E.NOWHILE .EQ $C4
|
|
|
|
|
E.NOFOR .EQ $C5
|
|
|
|
|
E.NOIF .EQ $C6
|
|
|
|
|
E.BADEXP .EQ $C7
|
|
|
|
|
E.BADFTYPE .EQ $C8
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2018-07-23 15:28:42 +00:00
|
|
|
|
.INB INC/MACROS.I
|
|
|
|
|
.INB INC/A2OSX.I
|
2018-10-15 06:25:40 +00:00
|
|
|
|
.INB INC/MLI.I
|
2018-10-02 15:52:30 +00:00
|
|
|
|
.INB INC/MLI.E.I
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2019-01-21 06:52:04 +00:00
|
|
|
|
.DUMMY
|
2019-01-18 16:06:44 +00:00
|
|
|
|
.OR ZPBIN
|
|
|
|
|
ZS.START
|
|
|
|
|
ZPCLBuf .BS 2
|
2019-02-06 16:20:51 +00:00
|
|
|
|
ZPInputBuf .BS 2
|
2019-02-04 14:29:52 +00:00
|
|
|
|
ZPInputBufPtr .BS 2
|
2019-02-06 16:20:51 +00:00
|
|
|
|
ZPInputCmdPtr .BS 2
|
2019-01-26 21:46:39 +00:00
|
|
|
|
ZPArgVBuf .BS 2
|
2019-02-12 16:47:34 +00:00
|
|
|
|
ZPArgVBufPrev .BS 2
|
2019-02-03 21:58:26 +00:00
|
|
|
|
ZPArgVBufPtr .BS 2
|
2019-02-06 16:20:51 +00:00
|
|
|
|
ZPVarNamePtr .BS 2
|
2019-02-15 16:38:17 +00:00
|
|
|
|
ZPPtr1 .BS 2
|
|
|
|
|
ZPPtr2 .BS 2
|
|
|
|
|
TmpByte .BS 1
|
2019-01-18 16:06:44 +00:00
|
|
|
|
ZS.END .ED
|
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
|
2018-09-17 06:16:45 +00:00
|
|
|
|
.DA #S.PS.F.EVENT S.PS.F
|
|
|
|
|
.DA #0
|
2019-01-18 16:06:44 +00:00
|
|
|
|
.DA CS.END-CS.START Code Size (without Constants)
|
|
|
|
|
.DA DS.END-DS.START Data SegmentSize
|
|
|
|
|
.DA #64 Stack Size
|
|
|
|
|
.DA #ZS.END-ZS.START Zero Page Size
|
2015-06-03 18:30:57 +00:00
|
|
|
|
.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
|
2018-11-10 14:30:09 +00:00
|
|
|
|
L.MSG.TRACE .DA MSG.TRACE
|
2018-09-09 08:11:42 +00:00
|
|
|
|
L.MSG.ECHOCRLF .DA MSG.ECHOCRLF
|
2018-11-10 14:30:09 +00:00
|
|
|
|
L.MSG.BATCHERR .DA MSG.BATCHERR
|
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
|
2018-11-13 15:54:10 +00:00
|
|
|
|
L.MSG.PID .DA MSG.PID
|
2018-11-17 17:17:13 +00:00
|
|
|
|
L.ENV.ROOT .DA ENV.ROOT
|
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
|
2017-09-28 15:39:12 +00:00
|
|
|
|
L.ENV.HOME .DA ENV.HOME
|
2016-09-05 16:00:11 +00:00
|
|
|
|
L.FMT.DATE .DA FMT.DATE
|
|
|
|
|
L.FMT.TIME .DA FMT.TIME
|
2019-01-23 16:26:48 +00:00
|
|
|
|
L.FMT.GETKEY .DA FMT.GETKEY
|
2017-11-08 16:09:52 +00:00
|
|
|
|
J.ESC .DA CL.BS left arrow
|
2017-09-26 15:55:25 +00:00
|
|
|
|
.DA HIS.GetNext
|
|
|
|
|
.DA HIS.GetPrev
|
2017-11-08 16:09:52 +00:00
|
|
|
|
.DA CL.NAK right arow
|
2019-02-11 06:58:33 +00:00
|
|
|
|
L.CMD .DA CMD
|
|
|
|
|
J.CMD .DA CMD.NOHUP
|
2019-02-01 16:32:29 +00:00
|
|
|
|
.DA CMD.CD
|
|
|
|
|
.DA CMD.DATE
|
|
|
|
|
.DA CMD.ECHO
|
|
|
|
|
.DA CMD.EXIT
|
|
|
|
|
.DA CMD.GETKEY
|
|
|
|
|
.DA CMD.MD
|
|
|
|
|
.DA CMD.PAUSE
|
|
|
|
|
.DA CMD.PWD
|
|
|
|
|
.DA CMD.RD
|
|
|
|
|
.DA CMD.READ
|
|
|
|
|
.DA CMD.REN
|
|
|
|
|
.DA CMD.SET
|
|
|
|
|
.DA CMD.SLEEP
|
|
|
|
|
.DA CMD.SHIFT
|
|
|
|
|
.DA CMD.TIME
|
|
|
|
|
.DA CMD.PUSHD
|
|
|
|
|
.DA CMD.POPD
|
|
|
|
|
.DA CMD.BREAK
|
|
|
|
|
.DA CMD.CONTINUE
|
|
|
|
|
.DA CMD.FOR
|
|
|
|
|
.DA CMD.NEXT
|
|
|
|
|
.DA CMD.WHILE
|
|
|
|
|
.DA CMD.LOOP
|
|
|
|
|
.DA CMD.IF
|
|
|
|
|
.DA CMD.ELSE
|
|
|
|
|
.DA CMD.FI
|
2019-02-11 06:58:33 +00:00
|
|
|
|
L.CORE.IO .DA CORE.IO
|
|
|
|
|
J.CORE.IO .DA CORE.IO.AMP
|
|
|
|
|
.DA CORE.IO.IN
|
|
|
|
|
.DA CORE.IO.OUTA
|
|
|
|
|
.DA CORE.IO.OUT
|
|
|
|
|
.DA CORE.IO.1OUTA
|
|
|
|
|
.DA CORE.IO.1OUT
|
|
|
|
|
.DA CORE.IO.2OUTA
|
|
|
|
|
.DA CORE.IO.2OUT
|
2019-02-01 16:32:29 +00:00
|
|
|
|
L.EXP.BEGIN .DA EXP.BEGIN
|
|
|
|
|
L.EXP.OP.UNARY .DA EXP.OP.UNARY
|
|
|
|
|
J.EXP.OP.UNARY .DA EXP.OP.UNARY.D
|
|
|
|
|
.DA EXP.OP.UNARY.E
|
|
|
|
|
.DA EXP.OP.UNARY.F
|
2019-02-14 14:51:24 +00:00
|
|
|
|
.DA EXP.OP.UNARY.N
|
|
|
|
|
.DA EXP.OP.UNARY.Z
|
2019-02-01 16:32:29 +00:00
|
|
|
|
L.EXP.OP.BINARY .DA EXP.OP.BINARY
|
|
|
|
|
L.EXP.OP.MATH .DA EXP.OP.MATH
|
|
|
|
|
J.EXP.OP.MATH .DA M32.Add
|
2018-11-22 07:29:55 +00:00
|
|
|
|
.DA M32.Sub
|
|
|
|
|
.DA M32.Mul
|
|
|
|
|
.DA M32.Div
|
|
|
|
|
.DA M32.Mod
|
2019-01-23 16:26:48 +00:00
|
|
|
|
L.HOME.PROFILE .DA HOME.PROFILE
|
2018-11-22 16:39:41 +00:00
|
|
|
|
L.M32.Printf .DA M32.Printf
|
2016-10-29 19:58:21 +00:00
|
|
|
|
L.ERR.Codes .DA ERR.Codes
|
|
|
|
|
L.ERR.Messages .DA ERR.Messages
|
2019-02-15 16:38:17 +00:00
|
|
|
|
L.NOD.Template .DA NOD.Template
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
2018-11-10 14:30:09 +00:00
|
|
|
|
CS.INIT clc
|
|
|
|
|
CS.INIT.RTS rts
|
|
|
|
|
*--------------------------------------
|
2019-02-01 16:32:29 +00:00
|
|
|
|
CS.RUN jsr CL.Init
|
|
|
|
|
jsr CORE.Init
|
|
|
|
|
|
2018-11-22 16:39:41 +00:00
|
|
|
|
ldy #S.PS.ARGC
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
beq .1 no arg, continue starting interactive
|
2019-02-11 06:58:33 +00:00
|
|
|
|
|
2018-12-21 14:32:45 +00:00
|
|
|
|
>PUSHWI 0 Aux type
|
|
|
|
|
>PUSHBI S.FI.T.TXT
|
|
|
|
|
>PUSHBI O.RDONLY
|
2018-11-10 14:30:09 +00:00
|
|
|
|
lda #1
|
|
|
|
|
>SYSCALL ArgV
|
|
|
|
|
>SYSCALL LoadTxtFile
|
|
|
|
|
bcs CS.INIT.RTS
|
|
|
|
|
|
|
|
|
|
txa
|
2019-02-06 16:20:51 +00:00
|
|
|
|
>STA.G hInputBuf
|
2018-11-10 14:30:09 +00:00
|
|
|
|
>SYSCALL GetMemPtr
|
2019-02-06 16:20:51 +00:00
|
|
|
|
>STYA ZPInputBuf
|
2019-02-04 14:29:52 +00:00
|
|
|
|
>STYA ZPInputBufPtr
|
2018-11-10 17:43:20 +00:00
|
|
|
|
|
2018-11-20 15:54:49 +00:00
|
|
|
|
lda #0
|
2019-02-11 16:44:56 +00:00
|
|
|
|
jsr CMD.SHIFTA Remove $0=/bin/sh
|
2019-02-03 21:58:26 +00:00
|
|
|
|
|
2019-02-06 16:20:51 +00:00
|
|
|
|
lda #$ff
|
|
|
|
|
>STA.G bBatchMode
|
|
|
|
|
|
2018-11-10 14:30:09 +00:00
|
|
|
|
bra CS.RUN.LOOP
|
2019-01-26 21:46:39 +00:00
|
|
|
|
*--------------------------------------
|
2019-02-01 16:32:29 +00:00
|
|
|
|
.1 jsr CMD.CD.HOME
|
2018-11-21 13:08:11 +00:00
|
|
|
|
jsr HIS.Init
|
2018-11-10 14:30:09 +00:00
|
|
|
|
bcs CS.INIT.RTS
|
2017-09-13 06:17:46 +00:00
|
|
|
|
|
2018-08-25 11:23:59 +00:00
|
|
|
|
>PUSHWI K.VER
|
2018-08-22 15:23:27 +00:00
|
|
|
|
>PUSHBI 2
|
2015-11-22 22:30:06 +00:00
|
|
|
|
>LDYA L.MSG.GREETINGS
|
2018-06-21 15:12:10 +00:00
|
|
|
|
>SYSCALL printf
|
2019-01-23 16:26:48 +00:00
|
|
|
|
bcs CS.INIT.RTS
|
|
|
|
|
|
2019-01-30 16:23:00 +00:00
|
|
|
|
>PUSHEA.G StatBuf
|
2019-01-23 16:26:48 +00:00
|
|
|
|
>LDYA L.HOME.PROFILE
|
|
|
|
|
>SYSCALL STAT
|
|
|
|
|
bcs CS.RUN.LOOP
|
|
|
|
|
|
2019-01-23 22:03:10 +00:00
|
|
|
|
>PUSHBI S.PS.F.HOLD
|
|
|
|
|
>LDYA L.HOME.PROFILE
|
|
|
|
|
>SYSCALL execl
|
|
|
|
|
>SLEEP
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2019-02-15 16:38:17 +00:00
|
|
|
|
CS.RUN.LOOP
|
2018-11-13 15:54:10 +00:00
|
|
|
|
|
2018-11-12 14:48:28 +00:00
|
|
|
|
.1 jsr CheckSleep
|
|
|
|
|
beq .3
|
|
|
|
|
|
|
|
|
|
>SLEEP
|
|
|
|
|
>SYSCALL GetChar
|
|
|
|
|
bcs .2
|
|
|
|
|
|
|
|
|
|
cmp #3 Ctrl-C
|
|
|
|
|
bne .1
|
|
|
|
|
|
2019-02-06 16:20:51 +00:00
|
|
|
|
>LDA.G bBatchMode batch mode ?
|
2019-01-23 16:26:48 +00:00
|
|
|
|
beq .1
|
|
|
|
|
|
|
|
|
|
>LDA.G bSET.C
|
|
|
|
|
beq .8
|
2018-11-12 14:48:28 +00:00
|
|
|
|
bra .1
|
2017-07-17 05:59:30 +00:00
|
|
|
|
|
2018-11-12 14:48:28 +00:00
|
|
|
|
.2 tay
|
|
|
|
|
beq .1
|
|
|
|
|
rts I/O err
|
2018-08-08 15:13:37 +00:00
|
|
|
|
|
2018-11-12 14:48:28 +00:00
|
|
|
|
.3 >LDA.G bPause
|
|
|
|
|
bpl .6
|
|
|
|
|
|
|
|
|
|
.4 >SLEEP
|
2018-11-10 14:30:09 +00:00
|
|
|
|
>SYSCALL GetChar
|
2018-11-12 14:48:28 +00:00
|
|
|
|
bcc .5 got one
|
2018-11-10 14:30:09 +00:00
|
|
|
|
tay
|
2018-11-12 14:48:28 +00:00
|
|
|
|
beq .4 no char
|
|
|
|
|
rts I/O err
|
2018-11-10 14:30:09 +00:00
|
|
|
|
|
2018-11-12 14:48:28 +00:00
|
|
|
|
.5 cmp #3 Ctrl-C
|
|
|
|
|
bne .60
|
|
|
|
|
|
2019-02-06 16:20:51 +00:00
|
|
|
|
>LDA.G bBatchMode batch mode ?
|
2019-01-23 16:26:48 +00:00
|
|
|
|
beq .61
|
|
|
|
|
|
|
|
|
|
>LDA.G bSET.C
|
|
|
|
|
beq .8
|
2018-11-14 14:34:13 +00:00
|
|
|
|
bra .61
|
2018-11-12 14:48:28 +00:00
|
|
|
|
|
|
|
|
|
.60 cmp #C.CR
|
|
|
|
|
bne .4
|
2018-11-10 14:30:09 +00:00
|
|
|
|
|
2018-11-14 14:34:13 +00:00
|
|
|
|
.61 >STZ.G bPause
|
|
|
|
|
bra .62
|
2017-09-13 06:17:46 +00:00
|
|
|
|
|
2019-02-15 16:38:17 +00:00
|
|
|
|
.6 >LDA.G bReadMode read mode ?
|
2018-11-12 14:48:28 +00:00
|
|
|
|
bne .7
|
|
|
|
|
|
2019-02-06 16:20:51 +00:00
|
|
|
|
.62 >LDA.G bBatchMode batch mode ?
|
2018-12-03 06:59:30 +00:00
|
|
|
|
beq CS.RUN.INTERACTIVE
|
2018-04-16 05:53:19 +00:00
|
|
|
|
jmp CS.RUN.BATCH
|
2018-11-10 14:30:09 +00:00
|
|
|
|
.7 jmp CS.RUN.READ
|
2018-11-07 16:11:02 +00:00
|
|
|
|
|
2018-11-12 14:48:28 +00:00
|
|
|
|
.8 lda #3 User Interrupt
|
2018-11-10 14:30:09 +00:00
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-12-03 06:59:30 +00:00
|
|
|
|
CS.RUN.INTERACTIVE
|
2019-02-15 16:38:17 +00:00
|
|
|
|
jsr IO.Reset
|
2019-02-19 11:30:45 +00:00
|
|
|
|
|
|
|
|
|
>LDA.G hInputBuf some commmands left in buffer
|
|
|
|
|
beq .10
|
|
|
|
|
|
|
|
|
|
lda (ZPInputBufPtr)
|
|
|
|
|
bne .6
|
|
|
|
|
|
|
|
|
|
>LDA.G hInputBuf
|
|
|
|
|
>SYSCALL freemem
|
|
|
|
|
>STZ.G hInputBuf
|
|
|
|
|
|
|
|
|
|
.10 jsr CL.Reset
|
2018-09-25 06:25:32 +00:00
|
|
|
|
jsr CL.PrintPrompt
|
2017-11-09 16:39:01 +00:00
|
|
|
|
bcs .9
|
2017-09-13 06:17:46 +00:00
|
|
|
|
|
2017-11-17 16:16:05 +00:00
|
|
|
|
.1 >SLEEP
|
2017-08-22 15:03:34 +00:00
|
|
|
|
>SYSCALL GetChar
|
2018-11-12 14:48:28 +00:00
|
|
|
|
bcc .2
|
2018-07-18 15:30:42 +00:00
|
|
|
|
|
2018-09-19 15:25:42 +00:00
|
|
|
|
tay
|
2018-11-10 14:30:09 +00:00
|
|
|
|
beq .1 no char
|
2018-10-24 15:36:45 +00:00
|
|
|
|
|
2018-11-12 16:19:44 +00:00
|
|
|
|
.9 rts I/O error
|
2017-11-09 16:39:01 +00:00
|
|
|
|
|
2018-11-12 14:48:28 +00:00
|
|
|
|
.2 cmp #C.EOF ....or Ctrl-D
|
|
|
|
|
beq .9 CS
|
2018-09-19 15:25:42 +00:00
|
|
|
|
|
2018-07-19 15:33:55 +00:00
|
|
|
|
jsr CL.CHARIN
|
2017-01-12 17:43:45 +00:00
|
|
|
|
|
2019-02-06 16:20:51 +00:00
|
|
|
|
>LDA.G CL.bReady Something to execute ?
|
2015-06-24 20:41:38 +00:00
|
|
|
|
bpl .1
|
2017-09-27 06:14:13 +00:00
|
|
|
|
|
2019-02-18 12:52:10 +00:00
|
|
|
|
>PUSHBI 0
|
|
|
|
|
>LDYA L.MSG.ECHOCRLF
|
|
|
|
|
>SYSCALL printf
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2018-11-14 14:34:13 +00:00
|
|
|
|
lda (ZPCLBuf)
|
2018-11-12 14:48:28 +00:00
|
|
|
|
beq .8 Empty line
|
2018-10-29 08:41:10 +00:00
|
|
|
|
|
2018-10-23 15:36:57 +00:00
|
|
|
|
jsr HIS.Add
|
2017-09-13 06:17:46 +00:00
|
|
|
|
|
2019-02-04 14:29:52 +00:00
|
|
|
|
>LDYA ZPCLBuf
|
2019-02-06 16:20:51 +00:00
|
|
|
|
>SYSCALL strdup
|
|
|
|
|
bcs .8
|
|
|
|
|
>STYA ZPInputBuf
|
2019-02-04 14:29:52 +00:00
|
|
|
|
>STYA ZPInputBufPtr
|
2019-02-06 16:20:51 +00:00
|
|
|
|
txa
|
|
|
|
|
>STA.G hInputBuf
|
2019-02-04 14:29:52 +00:00
|
|
|
|
|
2019-02-19 11:30:45 +00:00
|
|
|
|
.6 jsr CORE.Run
|
2019-02-01 16:32:29 +00:00
|
|
|
|
|
|
|
|
|
.8 jmp CS.RUN.LOOP.END
|
2017-01-26 16:28:52 +00:00
|
|
|
|
*--------------------------------------
|
2019-02-06 16:20:51 +00:00
|
|
|
|
CS.RUN.READ jsr CL.RESET
|
|
|
|
|
|
2017-11-17 16:16:05 +00:00
|
|
|
|
.1 >SLEEP
|
2017-08-22 15:03:34 +00:00
|
|
|
|
>SYSCALL GetChar
|
2019-02-18 06:42:17 +00:00
|
|
|
|
bcc .11
|
|
|
|
|
|
|
|
|
|
tay
|
|
|
|
|
beq .1
|
|
|
|
|
|
|
|
|
|
.11 jsr CL.CHARIN
|
2017-01-26 16:28:52 +00:00
|
|
|
|
|
2019-02-06 16:20:51 +00:00
|
|
|
|
>LDA.G CL.bReady
|
2017-01-26 16:28:52 +00:00
|
|
|
|
bpl .1
|
2017-09-13 06:17:46 +00:00
|
|
|
|
|
2019-02-18 06:42:17 +00:00
|
|
|
|
.12 lda (ZPCLBuf)
|
2018-11-13 15:54:10 +00:00
|
|
|
|
bne .2
|
|
|
|
|
|
2019-02-15 16:38:17 +00:00
|
|
|
|
>LDYA ZPVarNamePtr
|
2018-11-13 15:54:10 +00:00
|
|
|
|
>SYSCALL UnSetEnv
|
|
|
|
|
bra .7
|
2018-09-17 06:16:45 +00:00
|
|
|
|
|
2018-11-14 14:34:13 +00:00
|
|
|
|
.2 >PUSHW ZPCLBuf
|
2017-09-13 06:17:46 +00:00
|
|
|
|
|
2019-02-15 16:38:17 +00:00
|
|
|
|
>LDYA ZPVarNamePtr
|
2017-01-26 16:28:52 +00:00
|
|
|
|
>SYSCALL SetEnv
|
2018-09-17 06:16:45 +00:00
|
|
|
|
|
2018-11-13 15:54:10 +00:00
|
|
|
|
.7 php
|
|
|
|
|
pha
|
2019-02-06 16:20:51 +00:00
|
|
|
|
|
2019-02-15 16:38:17 +00:00
|
|
|
|
>STZ.G bReadMode
|
2018-11-13 15:54:10 +00:00
|
|
|
|
>STA.G bREAD.S
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
plp
|
|
|
|
|
|
2018-11-10 14:30:09 +00:00
|
|
|
|
.8 jmp CS.RUN.LOOP.END
|
2017-01-26 16:28:52 +00:00
|
|
|
|
*--------------------------------------
|
2019-02-18 12:52:10 +00:00
|
|
|
|
CS.RUN.BATCH >SYSCALL GetChar
|
2017-11-09 16:39:01 +00:00
|
|
|
|
bcs .2
|
|
|
|
|
|
|
|
|
|
cmp #3 test Ctrl-c
|
|
|
|
|
bne .1
|
|
|
|
|
|
2018-11-10 14:30:09 +00:00
|
|
|
|
* sec
|
2018-11-14 14:34:13 +00:00
|
|
|
|
.9 rts
|
2017-11-09 16:39:01 +00:00
|
|
|
|
|
|
|
|
|
.1 cmp #19 test Ctrl-s
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
lda #$80
|
|
|
|
|
>STA.G bPause
|
2018-11-28 21:37:18 +00:00
|
|
|
|
clc
|
2018-11-12 16:19:44 +00:00
|
|
|
|
jmp CS.RUN.LOOP.END
|
2017-11-09 16:39:01 +00:00
|
|
|
|
|
2019-02-11 16:44:56 +00:00
|
|
|
|
.2 >LDA.G bSET.X
|
|
|
|
|
beq .5
|
2018-12-03 06:59:30 +00:00
|
|
|
|
|
2019-02-11 16:44:56 +00:00
|
|
|
|
ldy #$ff
|
|
|
|
|
|
|
|
|
|
.3 iny
|
|
|
|
|
lda (ZPInputBufPtr),y
|
|
|
|
|
sta (ZPArgVBuf),y
|
|
|
|
|
beq .4
|
|
|
|
|
eor #C.CR
|
|
|
|
|
bne .3
|
|
|
|
|
sta (ZPArgVBuf),y
|
|
|
|
|
|
|
|
|
|
.4 >PUSHW ZPArgVBuf
|
|
|
|
|
>PUSHBI 2
|
|
|
|
|
>LDYA L.MSG.TRACE
|
|
|
|
|
>SYSCALL printf
|
|
|
|
|
bcs .9
|
2019-02-01 16:32:29 +00:00
|
|
|
|
|
2019-02-11 16:44:56 +00:00
|
|
|
|
.5 jsr CORE.Run
|
|
|
|
|
bcc CS.RUN.LOOP.END
|
2019-02-01 16:32:29 +00:00
|
|
|
|
|
2019-02-11 16:44:56 +00:00
|
|
|
|
pha
|
|
|
|
|
lda #$ff
|
|
|
|
|
>STA.G bExit
|
|
|
|
|
pla
|
|
|
|
|
|
2018-11-10 14:30:09 +00:00
|
|
|
|
CS.RUN.LOOP.END ldy #S.PS.RC
|
|
|
|
|
sta (pPs),y
|
|
|
|
|
|
|
|
|
|
bcc CS.RUN.LOOP.8
|
2019-02-04 14:29:52 +00:00
|
|
|
|
tay
|
|
|
|
|
beq CS.RUN.LOOP.8
|
2019-02-06 16:20:51 +00:00
|
|
|
|
>LDA.G bBatchMode batch mode ?
|
2018-11-10 14:30:09 +00:00
|
|
|
|
beq .1
|
2017-09-15 15:16:04 +00:00
|
|
|
|
|
2018-11-10 14:30:09 +00:00
|
|
|
|
jsr IO.PrintBatchErrMsg
|
|
|
|
|
bcs CS.RUN.LOOP.RTS
|
|
|
|
|
|
|
|
|
|
.1 ldy #S.PS.RC
|
|
|
|
|
lda (pPs),y
|
2017-09-15 15:16:04 +00:00
|
|
|
|
|
2018-11-10 14:30:09 +00:00
|
|
|
|
jsr IO.PrintErrMsg
|
|
|
|
|
bcs CS.RUN.LOOP.RTS
|
2019-02-06 16:20:51 +00:00
|
|
|
|
|
2018-11-10 14:30:09 +00:00
|
|
|
|
CS.RUN.LOOP.8 >LDA.G bExit
|
|
|
|
|
beq CS.RUN.LOOP.80
|
|
|
|
|
|
2018-12-05 15:12:10 +00:00
|
|
|
|
ldy #S.PS.RC
|
|
|
|
|
lda (pPs),y
|
|
|
|
|
|
2017-09-15 15:16:04 +00:00
|
|
|
|
sec
|
2018-11-10 14:30:09 +00:00
|
|
|
|
CS.RUN.LOOP.RTS rts
|
|
|
|
|
|
|
|
|
|
CS.RUN.LOOP.80 jmp CS.RUN.LOOP
|
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
|
2018-11-12 14:48:28 +00:00
|
|
|
|
|
|
|
|
|
ldx #4
|
|
|
|
|
|
2017-07-17 05:59:30 +00:00
|
|
|
|
clc
|
|
|
|
|
|
|
|
|
|
.1 lda (pData),y
|
|
|
|
|
sbc #0
|
|
|
|
|
sta (pData),y
|
|
|
|
|
iny
|
2018-11-12 14:48:28 +00:00
|
|
|
|
dex
|
2017-07-17 05:59:30 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
.9 sec
|
2015-12-13 21:29:51 +00:00
|
|
|
|
rts
|
2017-01-12 17:43:45 +00:00
|
|
|
|
*--------------------------------------
|
2019-02-19 11:30:45 +00:00
|
|
|
|
CS.QUIT >LDA.G hInputBuf
|
|
|
|
|
beq .1
|
|
|
|
|
|
|
|
|
|
>SYSCALL FreeMem
|
|
|
|
|
|
|
|
|
|
.1 jsr HIS.Quit
|
2019-01-31 16:34:02 +00:00
|
|
|
|
jsr CL.Quit
|
2019-02-01 16:32:29 +00:00
|
|
|
|
jsr CORE.Quit
|
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
|
|
|
|
*--------------------------------------
|
2019-02-03 21:58:26 +00:00
|
|
|
|
RemoveStrFromArgV
|
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
>STYA ZPPtr2
|
|
|
|
|
|
|
|
|
|
ldy #$ff
|
|
|
|
|
|
|
|
|
|
.1 iny Compute ArgX len
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
.2 tya
|
|
|
|
|
sec
|
|
|
|
|
adc ZPPtr1
|
|
|
|
|
sta ZPPtr1
|
|
|
|
|
bcc .3
|
|
|
|
|
inc ZPPtr1+1
|
|
|
|
|
|
|
|
|
|
.3 ldy #$ff
|
|
|
|
|
|
|
|
|
|
.4 iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
sta (ZPPtr2),y
|
|
|
|
|
bne .4
|
|
|
|
|
tya
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
sec
|
|
|
|
|
adc ZPPtr2
|
|
|
|
|
sta ZPPtr2
|
|
|
|
|
bcc .2
|
|
|
|
|
inc ZPPtr2+1
|
|
|
|
|
bra .2
|
|
|
|
|
|
|
|
|
|
.8 rts
|
2015-11-22 22:30:06 +00:00
|
|
|
|
*--------------------------------------
|
2019-02-08 16:13:43 +00:00
|
|
|
|
.INB USR/SRC/BIN/SH.S.CL
|
|
|
|
|
.INB USR/SRC/BIN/SH.S.HIS
|
|
|
|
|
.INB USR/SRC/BIN/SH.S.CORE
|
|
|
|
|
.INB USR/SRC/BIN/SH.S.IO
|
|
|
|
|
.INB USR/SRC/BIN/SH.S.CMD
|
|
|
|
|
.INB USR/SRC/BIN/SH.S.EXP
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
|
|
|
|
*--------------------------------------
|
2019-02-08 16:13:43 +00:00
|
|
|
|
MSG.GREETINGS .AZ "\r\nA2osX-SH %d.%d\r\n\r\n"
|
2018-09-17 06:16:45 +00:00
|
|
|
|
MSG.PROMPT .AZ "\e[7h$ "
|
2018-12-21 14:32:45 +00:00
|
|
|
|
MSG.TRACE .AZ ">%s\r\n"
|
2018-11-10 14:30:09 +00:00
|
|
|
|
MSG.BATCHERR .AZ "^\r\nLine #%D:"
|
2018-11-27 21:26:03 +00:00
|
|
|
|
MSG.ERROR .AS "[$%h]:%S."
|
|
|
|
|
MSG.ECHOCRLF .AZ "\r\n"
|
2018-11-20 15:54:49 +00:00
|
|
|
|
MSG.PRINTENV .AZ "%s = %s\r\n"
|
2018-11-13 15:54:10 +00:00
|
|
|
|
MSG.PID .AZ "PID=%d\r\n"
|
2018-09-17 06:16:45 +00:00
|
|
|
|
FMT.DATE .AZ "%A (%w), %B %d %Y"
|
|
|
|
|
FMT.TIME .AZ "%H:%M:%S (%I:%M:%S%p)"
|
2019-01-23 16:26:48 +00:00
|
|
|
|
FMT.GETKEY .AZ "%d"
|
2018-09-17 06:16:45 +00:00
|
|
|
|
*--------------------------------------
|
2018-11-17 17:17:13 +00:00
|
|
|
|
ENV.ROOT .AZ "ROOT"
|
2018-04-11 15:35:51 +00:00
|
|
|
|
ENV.PATH .AZ "PATH"
|
|
|
|
|
ENV.PWD .AZ "PWD"
|
|
|
|
|
ENV.PS1 .AZ "PS1"
|
|
|
|
|
ENV.HOME .AZ "HOME"
|
2019-01-23 16:26:48 +00:00
|
|
|
|
HOME.PROFILE .AZ "${HOME}PROFILE"
|
2017-09-11 15:29:08 +00:00
|
|
|
|
*--------------------------------------
|
2019-02-11 06:58:33 +00:00
|
|
|
|
CMD .AZ "NOHUP"
|
2018-10-21 20:54:07 +00:00
|
|
|
|
.AZ "CD"
|
2018-04-11 15:35:51 +00:00
|
|
|
|
.AZ "DATE"
|
|
|
|
|
.AZ "ECHO"
|
|
|
|
|
.AZ "EXIT"
|
2019-01-23 16:26:48 +00:00
|
|
|
|
.AZ "GETKEY"
|
2018-11-10 14:30:09 +00:00
|
|
|
|
.AZ "MD"
|
2018-04-11 15:35:51 +00:00
|
|
|
|
.AZ "PAUSE"
|
|
|
|
|
.AZ "PWD"
|
2018-11-10 14:30:09 +00:00
|
|
|
|
.AZ "RD"
|
2018-04-11 15:35:51 +00:00
|
|
|
|
.AZ "READ"
|
2018-11-15 15:04:14 +00:00
|
|
|
|
.AZ "REN"
|
2018-04-11 15:35:51 +00:00
|
|
|
|
.AZ "SET"
|
|
|
|
|
.AZ "SLEEP"
|
2018-11-20 15:54:49 +00:00
|
|
|
|
.AZ "SHIFT"
|
2018-04-11 15:35:51 +00:00
|
|
|
|
.AZ "TIME"
|
2018-11-26 06:57:11 +00:00
|
|
|
|
.AZ "PUSHD"
|
|
|
|
|
.AZ "POPD"
|
|
|
|
|
.AZ "BREAK"
|
|
|
|
|
.AZ "CONTINUE"
|
|
|
|
|
.AZ "FOR"
|
2018-11-19 16:15:16 +00:00
|
|
|
|
.AZ "NEXT"
|
2018-11-26 06:57:11 +00:00
|
|
|
|
.AZ "WHILE"
|
2018-11-19 16:15:16 +00:00
|
|
|
|
.AZ "LOOP"
|
2018-11-26 06:57:11 +00:00
|
|
|
|
.AZ "IF"
|
2018-11-12 21:34:55 +00:00
|
|
|
|
.AZ "ELSE"
|
|
|
|
|
.AZ "FI"
|
2015-10-19 20:35:00 +00:00
|
|
|
|
.HS 00
|
2017-10-23 15:39:19 +00:00
|
|
|
|
*--------------------------------------
|
2019-02-07 16:52:25 +00:00
|
|
|
|
* https://www.tldp.org/LDP/abs/html/io-redirection.html
|
|
|
|
|
*--------------------------------------
|
2019-02-11 06:58:33 +00:00
|
|
|
|
CORE.IO .AZ "&"
|
2019-02-07 16:52:25 +00:00
|
|
|
|
.AZ "<"
|
|
|
|
|
.AZ ">>"
|
|
|
|
|
.AZ ">"
|
|
|
|
|
.AZ "1>>"
|
|
|
|
|
.AZ "1>"
|
|
|
|
|
.AZ "2>>"
|
|
|
|
|
.AZ "2>"
|
|
|
|
|
.HS 00
|
|
|
|
|
*--------------------------------------
|
2019-02-01 16:32:29 +00:00
|
|
|
|
EXP.BEGIN .AZ "!["
|
2018-11-13 15:54:10 +00:00
|
|
|
|
.AZ "["
|
2018-11-09 15:59:04 +00:00
|
|
|
|
.HS 00
|
2019-02-12 16:47:34 +00:00
|
|
|
|
EXP.OP.UNARY .AZ "-D"
|
|
|
|
|
.AZ "-E"
|
|
|
|
|
.AZ "-F"
|
2019-02-14 14:51:24 +00:00
|
|
|
|
.AZ "-N"
|
|
|
|
|
.AZ "-Z"
|
2018-11-09 15:59:04 +00:00
|
|
|
|
.HS 00
|
2019-02-01 16:32:29 +00:00
|
|
|
|
EXP.OP.BINARY .AZ "="
|
2018-11-13 15:54:10 +00:00
|
|
|
|
.AZ "!="
|
2019-02-12 16:47:34 +00:00
|
|
|
|
.AZ "-EQ"
|
|
|
|
|
.AZ "-NE"
|
|
|
|
|
.AZ "-LT"
|
|
|
|
|
.AZ "-LE"
|
|
|
|
|
.AZ "-GT"
|
|
|
|
|
.AZ "-GE"
|
2018-11-13 15:54:10 +00:00
|
|
|
|
.HS 00
|
2019-02-01 16:32:29 +00:00
|
|
|
|
EXP.OP.BINARY.BITS
|
2018-11-13 15:54:10 +00:00
|
|
|
|
.DA #%000
|
|
|
|
|
.DA #%000
|
|
|
|
|
.DA #%010
|
2018-11-26 10:40:19 +00:00
|
|
|
|
.DA #%101
|
|
|
|
|
.DA #%100
|
|
|
|
|
.DA #%110
|
|
|
|
|
.DA #%001
|
2018-11-13 15:54:10 +00:00
|
|
|
|
.DA #%011
|
2019-02-01 16:32:29 +00:00
|
|
|
|
EXP.OP.MATH .AZ "+"
|
2018-11-26 06:57:11 +00:00
|
|
|
|
.AZ "-"
|
|
|
|
|
.AZ "*"
|
|
|
|
|
.AZ "div"
|
|
|
|
|
.AZ "mod"
|
|
|
|
|
.HS 00
|
2016-10-29 19:58:21 +00:00
|
|
|
|
*--------------------------------------
|
2018-11-21 07:09:22 +00:00
|
|
|
|
.INB USR/SRC/X.M32.S
|
2018-11-17 17:17:13 +00:00
|
|
|
|
.INB USR/SRC/X.ERRORS.S
|
2016-10-17 15:47:50 +00:00
|
|
|
|
*--------------------------------------
|
2017-09-26 15:55:25 +00:00
|
|
|
|
EscChars .AS 'DBAC'
|
2018-09-14 13:08:30 +00:00
|
|
|
|
EscChars.Cnt .EQ *-EscChars
|
2019-02-15 16:38:17 +00:00
|
|
|
|
NOD.Template .AZ "/DEV/PIPE%h"
|
2018-11-22 16:39:41 +00:00
|
|
|
|
M32.Printf .AZ "%L"
|
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
|
2019-01-30 16:23:00 +00:00
|
|
|
|
CORE.STACK .BS CORE.STACK.MAX+1 pData (0 = Stack Ptr)
|
2018-11-26 06:57:11 +00:00
|
|
|
|
PUSHD.STACK .BS PUSHD.STACK.MAX+1
|
2018-11-19 16:15:16 +00:00
|
|
|
|
|
2019-02-15 16:38:17 +00:00
|
|
|
|
hInputBuf .BS 1
|
2017-09-01 15:40:26 +00:00
|
|
|
|
|
2019-02-15 16:38:17 +00:00
|
|
|
|
bReadMode .BS 1
|
2019-02-06 16:20:51 +00:00
|
|
|
|
bBatchMode .BS 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
|
2019-02-12 16:47:34 +00:00
|
|
|
|
|
2019-01-23 16:26:48 +00:00
|
|
|
|
bSET.C .BS 1
|
2018-10-16 15:48:03 +00:00
|
|
|
|
bSET.X .BS 1
|
2019-02-12 16:47:34 +00:00
|
|
|
|
|
2018-11-13 15:54:10 +00:00
|
|
|
|
bREAD.S .BS 1
|
2017-09-06 15:00:10 +00:00
|
|
|
|
|
2017-07-17 05:59:30 +00:00
|
|
|
|
Sleep .BS 4
|
2019-02-04 14:29:52 +00:00
|
|
|
|
StatBuf .BS S.STAT
|
|
|
|
|
TimeBuf .BS S.TIME
|
2017-09-06 15:00:10 +00:00
|
|
|
|
|
2019-01-26 21:46:39 +00:00
|
|
|
|
CL.hCLBuf .BS 1
|
2018-11-10 14:30:09 +00:00
|
|
|
|
CL.Ptr .BS 1
|
|
|
|
|
CL.Len .BS 1
|
2019-02-06 16:20:51 +00:00
|
|
|
|
CL.bReady .BS 1
|
2018-11-10 14:30:09 +00:00
|
|
|
|
|
2019-01-30 16:23:00 +00:00
|
|
|
|
CORE.IntCmd .BS 1
|
|
|
|
|
CORE.hArgVBuf .BS 1
|
2018-10-15 06:25:40 +00:00
|
|
|
|
|
2019-01-30 16:23:00 +00:00
|
|
|
|
CORE.ArgIndex .BS 1
|
|
|
|
|
CORE.Test .BS 1
|
|
|
|
|
CORE.Operator .BS 1
|
|
|
|
|
CORE.PSFlags .BS 1
|
2018-11-09 15:59:04 +00:00
|
|
|
|
|
2017-08-22 06:37:03 +00:00
|
|
|
|
HIS.hBuf .BS 1
|
2017-09-25 15:50:33 +00:00
|
|
|
|
HIS.Count .BS 1
|
|
|
|
|
HIS.Index .BS 1
|
2017-09-05 15:17:10 +00:00
|
|
|
|
|
2017-08-22 06:37:03 +00:00
|
|
|
|
IO.hIn .BS 1
|
|
|
|
|
IO.hOut .BS 1
|
|
|
|
|
IO.hErr .BS 1
|
2019-02-15 16:38:17 +00:00
|
|
|
|
IO.hPipe .BS 1
|
|
|
|
|
IO.NodBuf
|
|
|
|
|
* .BS 12 /DEV/PIPExx\0
|
2019-01-21 06:52:04 +00:00
|
|
|
|
*--------------------------------------
|
2018-11-22 16:39:41 +00:00
|
|
|
|
M32.BUF .BS 12 -1234567890\0
|
2018-11-21 07:09:22 +00:00
|
|
|
|
M32.ACC .BS 4
|
|
|
|
|
M32.ARG .BS 4
|
|
|
|
|
M32.TMP .BS 4
|
2017-07-11 15:53:52 +00:00
|
|
|
|
DS.END .ED
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2019-02-08 16:13:43 +00:00
|
|
|
|
SAVE USR/SRC/BIN/SH.S
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ASM
|