A2osX/BIN/CSH.S.txt

855 lines
17 KiB
Plaintext
Raw Normal View History

2019-01-21 06:52:04 +00:00
NEW
2020-01-25 18:56:36 +00:00
AUTO 3,1
2019-01-21 06:52:04 +00:00
.LIST OFF
2020-01-25 18:56:36 +00:00
.OP 65C02
.OR $2000
2020-02-18 15:34:56 +00:00
.TF bin/csh
2019-01-21 06:52:04 +00:00
*--------------------------------------
2020-07-31 14:46:11 +00:00
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/mli.i
.INB inc/mli.e.i
2019-01-26 16:33:03 +00:00
*--------------------------------------
2021-05-30 20:34:03 +00:00
CSH.T.VOID .EQ 1
CSH.T.UCHAR .EQ 2
CSH.T.SCHAR .EQ 3
CSH.T.UINT .EQ 4
CSH.T.SINT .EQ 5
CSH.T.ULONG .EQ 6
CSH.T.SLONG .EQ 7
CSH.T.FLOAT .EQ 8
2021-05-04 17:31:21 +00:00
CSH.T.VARIADIC .EQ $FF
*--------------------------------------
CSH.Q.POINTER .EQ %01000000
CSH.Q.PPOINTER .EQ %10000000
CSH.Q.PPPOINTER .EQ %11000000
CSH.Q.CONST .EQ %00010000
CSH.Q.FUNC .EQ %00001000
2019-01-21 06:52:04 +00:00
*--------------------------------------
* Zero Page Segment, up to 32 bytes
*--------------------------------------
.DUMMY
.OR ZPBIN
ZS.START
2020-08-02 12:19:43 +00:00
ZPCSHCode .BS 2
2019-02-13 16:20:44 +00:00
ZPCSHConst .BS 2
2020-02-19 16:42:05 +00:00
ZPCSHData .BS 2
2019-01-21 06:52:04 +00:00
ZPCSHStack .BS 2
2019-08-26 06:29:18 +00:00
2021-05-30 20:34:03 +00:00
ZPCSHfDecl .BS 2
ZPInputBufPtr .BS 2
hDefine .BS 1
hInclude .BS 1
2020-07-31 14:46:11 +00:00
ZPVarID .BS 2
2021-05-30 20:34:03 +00:00
ZPVarDef .EQ *
2021-01-12 21:14:13 +00:00
ZPVarType .BS 1
ZPVarQual .BS 1
2020-02-19 16:42:05 +00:00
ZPVarSizeOf .BS 2
ZPVarDataPtr .BS 2
2021-05-30 20:34:03 +00:00
ZPVarDefPtr .BS 2
2019-08-26 06:29:18 +00:00
2021-05-30 20:34:03 +00:00
ArgIndex .BS 1
2020-12-23 14:54:57 +00:00
bFastCall .BS 1
2020-02-19 16:42:05 +00:00
ZPPtr1 .BS 2
ZPPtr2 .BS 2
ZPPtr3 .BS 2
2019-01-21 06:52:04 +00:00
ZS.END .ED
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
.DA #0 S.PS.F.EVENT
.DA #0
.DA CS.END-CS.START Code Size (without Constants)
.DA DS.END-DS.START Data SegmentSize
2019-07-22 06:31:01 +00:00
.DA #64 Stack Size
2019-01-21 06:52:04 +00:00
.DA #ZS.END-ZS.START Zero Page Size
.DA 0
*--------------------------------------
* Relocation Table
2019-09-03 15:35:13 +00:00
*--------------------------------------
2019-01-21 06:52:04 +00:00
.1 .DA CS.INIT
.DA CS.RUN
2019-09-03 15:35:13 +00:00
.DA CS.DOEVENT
2019-01-21 06:52:04 +00:00
.DA CS.QUIT
2019-02-07 07:19:02 +00:00
L.MSG.GREETINGS .DA MSG.GREETINGS
2019-09-05 06:43:09 +00:00
L.MSG.USAGE .DA MSG.USAGE
2019-02-07 07:19:02 +00:00
L.MSG.ECHOCRLF .DA MSG.ECHOCRLF
2019-09-05 15:49:05 +00:00
L.MSG.DEBUG .DA MSG.DEBUG
2019-09-03 15:35:13 +00:00
L.MSG.ERR .DA MSG.ERR
2020-08-02 12:19:43 +00:00
L.ENV.INCLUDE .DA ENV.INCLUDE
2021-04-10 17:17:40 +00:00
L.CSH.BOPS .DA CSH.BOPS
2021-05-09 17:04:44 +00:00
J.CSH.bBOPS .DA CSH.BOPS.bMUL
.DA CSH.BOPS.bDIV
.DA CSH.BOPS.bMOD
.DA CSH.BOPS.ADD
.DA CSH.BOPS.SUB
.DA CSH.BOPS.SHL
.DA CSH.BOPS.SHR
.DA CSH.BOPS.L
.DA CSH.BOPS.LE
.DA CSH.BOPS.G
.DA CSH.BOPS.GE
.DA CSH.BOPS.EQ
.DA CSH.BOPS.NE
.DA CSH.BOPS.AND
.DA CSH.BOPS.OR
.DA CSH.BOPS.EOR
.DA CSH.BOPS.LAND
.DA CSH.BOPS.LOR
J.CSH.cBOPS .DA CSH.BOPS.cMUL
.DA CSH.BOPS.cDIV
.DA CSH.BOPS.cMOD
2021-05-04 17:31:21 +00:00
.DA CSH.BOPS.ADD
.DA CSH.BOPS.SUB
2021-04-10 17:17:40 +00:00
.DA CSH.BOPS.SHL
.DA CSH.BOPS.SHR
.DA CSH.BOPS.L
.DA CSH.BOPS.LE
2021-05-04 17:31:21 +00:00
.DA CSH.BOPS.G
2021-04-10 17:17:40 +00:00
.DA CSH.BOPS.GE
.DA CSH.BOPS.EQ
.DA CSH.BOPS.NE
.DA CSH.BOPS.AND
.DA CSH.BOPS.OR
.DA CSH.BOPS.EOR
.DA CSH.BOPS.LAND
.DA CSH.BOPS.LOR
L.CSH.FN .DA CSH.FN
L.CSH.DIRS .DA CSH.DIRS
L.CSH.KW .DA CSH.KW
2021-05-22 21:05:12 +00:00
L.CSH.TMODS .DA CSH.TMODS
L.CSH.TMODS2 .DA CSH.TMODS2
2021-04-10 17:17:40 +00:00
L.CSH.TYPES .DA CSH.TYPES
L.CSH.FTYPES .DA CSH.FTYPES
J.CSH.DIRS .DA CSH.DIR.DEFINE
.DA CSH.DIR.INCLUDE
J.CSH.KW .DA CSH.IF
.DA CSH.WHILE
.DA CSH.ELSE
.DA CSH.DO
.DA CSH.FOR
.DA CSH.SWITCH
.DA CSH.CASE
.DA CSH.BREAK
.DA CSH.CONTINUE
.DA CSH.SIZEOF
*--------------------------------------
.DA CSH.TYPEDEF
.DA CSH.STRUCT
*--------------------------------------
2021-05-22 21:05:12 +00:00
J.CSH.TMODS .DA CSH.CONST
J.CSH.TMODS2 .DA CSH.SIGNED
2021-04-10 17:17:40 +00:00
.DA CSH.UNSIGNED
.DA CSH.SHORT
J.CSH.TYPES .DA CSH.VOID
.DA CSH.CHAR
.DA CSH.INT
.DA CSH.LONG
.DA CSH.FLOAT
J.CSH.UTYPES .DA CSH.UCHAR
.DA CSH.UINT
.DA CSH.ULONG
J.CSH.STYPES .DA CSH.SCHAR
.DA CSH.SINT
.DA CSH.SLONG
2021-05-30 20:34:03 +00:00
*--------------------------------------
2021-04-10 17:17:40 +00:00
J.CSH.KW.END .DA CSH.IF.END
.DA CSH.WHILE.END
*--------------------------------------
2021-05-30 20:34:03 +00:00
L.CSH.LIBC .DA CSH.LIBC
*--------------------------------------
2021-05-14 20:58:20 +00:00
J.CSH.EXEC .DA EXEC.pwr
.DA EXEC.log
2021-04-10 17:17:40 +00:00
.DA EXEC.sqr
.DA EXEC.exp
.DA EXEC.cos
.DA EXEC.sin
.DA EXEC.tan
.DA EXEC.atan
.DA EXEC.getchar
.DA EXEC.puts
.DA EXEC.execl
.DA EXEC.printf
.DA EXEC.putenv
.DA EXEC.setenv
.DA EXEC.getenv
.DA EXEC.unsetenv
.DA EXEC.MD5
.DA EXEC.malloc
2021-05-14 20:58:20 +00:00
.DA EXEC.fopen
.DA EXEC.fclose
.DA EXEC.fread
.DA EXEC.fwrite
2019-01-21 06:52:04 +00:00
.DA 0
*--------------------------------------
* Called once at process creation
* Put code for loading LIB here
*--------------------------------------
CS.INIT clc
2019-09-05 15:49:05 +00:00
CS.INIT.RTS rts
2019-01-21 06:52:04 +00:00
*--------------------------------------
* Called until exit with CS
* if RUN exits with CC, RN entered again
*--------------------------------------
2020-01-31 20:26:51 +00:00
CS.RUN >PUSHW L.MSG.GREETINGS
2020-12-23 14:54:57 +00:00
>PUSHW A2osX.KVER
2019-02-06 16:20:51 +00:00
>PUSHBI 2
2020-02-28 07:21:46 +00:00
>SYSCALL PrintF
2019-09-05 15:49:05 +00:00
bcs CS.INIT.RTS
2020-01-22 16:31:48 +00:00
2019-09-05 15:49:05 +00:00
jsr CS.RUN.ARGS
bcs CS.INIT.RTS
2019-02-06 16:20:51 +00:00
jsr CSH.Init
2019-09-05 15:49:05 +00:00
bcs CS.INIT.RTS
2020-01-25 18:56:36 +00:00
2019-02-06 16:20:51 +00:00
.1 >SLEEP
2019-08-27 15:13:00 +00:00
2019-09-05 15:49:05 +00:00
>LDA.G bDebug
2019-08-27 15:13:00 +00:00
bpl .2
2020-12-23 14:54:57 +00:00
2019-09-05 15:49:05 +00:00
jsr PrintDebugMsg
.2 >LDA.G bTrace
bpl .3
2020-12-23 14:54:57 +00:00
>LDYA ZPInputBufPtr
2019-08-27 15:13:00 +00:00
jsr PrintTraceMsg
2019-09-05 15:49:05 +00:00
.3 jsr CSH.Run
2019-02-06 16:20:51 +00:00
bcc .1
2020-12-23 14:54:57 +00:00
2019-02-07 07:19:02 +00:00
cmp #MLI.E.EOF
beq .8
2019-08-27 15:13:00 +00:00
2019-02-07 07:19:02 +00:00
pha
jsr PrintErrMsg
pla
sec
rts
2020-01-22 16:31:48 +00:00
2019-09-05 06:43:09 +00:00
.8 lda #0 Exit Code = Success
2019-02-07 07:19:02 +00:00
sec
2019-01-21 06:52:04 +00:00
rts
2019-09-05 15:49:05 +00:00
*--------------------------------------
2021-05-30 20:34:03 +00:00
CS.RUN.ARGS inc ArgIndex
2019-09-05 15:49:05 +00:00
lda ArgIndex
2020-02-28 07:21:46 +00:00
>SYSCALL ArgV
2019-09-05 15:49:05 +00:00
bcs .7
2021-05-30 20:34:03 +00:00
2019-09-05 15:49:05 +00:00
>STYA ZPPtr1
lda (ZPPtr1)
cmp #'-'
bne .4
2020-01-22 16:31:48 +00:00
2019-09-05 15:49:05 +00:00
ldy #1
lda (ZPPtr1),y
2020-01-22 16:31:48 +00:00
2019-09-05 15:49:05 +00:00
ldx #OptionVars-OptionList-1
2020-01-22 16:31:48 +00:00
2019-09-05 15:49:05 +00:00
.1 cmp OptionList,x
beq .2
2020-01-22 16:31:48 +00:00
2019-09-05 15:49:05 +00:00
dex
bpl .1
bra .90
2020-01-22 16:31:48 +00:00
2019-09-05 15:49:05 +00:00
.2 ldy OptionVars,x
lda #$ff
sta (pData),y
bra CS.RUN.ARGS
2020-01-22 16:31:48 +00:00
2019-09-05 15:49:05 +00:00
.4 >LDA.G hFileBuf
bne .90
2020-01-22 16:31:48 +00:00
2020-08-27 06:30:03 +00:00
>LDYA ZPPtr1
jsr CS.RUN.LoadFile
2019-09-05 15:49:05 +00:00
bcs .9
2020-01-22 16:31:48 +00:00
2020-12-23 14:54:57 +00:00
>STYA ZPInputBufPtr
2021-05-30 20:34:03 +00:00
2020-12-23 14:54:57 +00:00
txa
2019-09-05 15:49:05 +00:00
>STA.G hFileBuf
bra CS.RUN.ARGS
2020-01-22 16:31:48 +00:00
2019-09-05 15:49:05 +00:00
.7 >LDA.G hFileBuf
beq .90
clc
2020-01-22 16:31:48 +00:00
.9 rts
2020-01-31 20:26:51 +00:00
.90 >PUSHW L.MSG.USAGE
>PUSHBI 0
2020-02-28 07:21:46 +00:00
>SYSCALL PrintF
2020-01-22 16:31:48 +00:00
2019-09-05 06:43:09 +00:00
lda #E.SYN
2019-01-21 06:52:04 +00:00
sec QUIT Process
2020-01-22 16:31:48 +00:00
rts
2019-01-21 06:52:04 +00:00
*--------------------------------------
2020-12-15 13:23:22 +00:00
CS.RUN.LoadFile >SYSCALL LoadTxtFile
2020-08-27 06:30:03 +00:00
bcs .9
phx
txa
>SYSCALL GetMemPtr
2020-12-23 14:54:57 +00:00
plx
2020-08-27 06:30:03 +00:00
.9 rts
*--------------------------------------
2019-01-21 06:52:04 +00:00
CS.DOEVENT sec
rts
*--------------------------------------
2019-02-06 16:20:51 +00:00
CS.QUIT jsr CSH.Quit
clc
2019-01-21 06:52:04 +00:00
rts
2019-01-26 16:33:03 +00:00
*--------------------------------------
2020-12-23 14:54:57 +00:00
PrintErrMsg lda hDefine
2020-01-26 19:36:49 +00:00
beq .10
2020-12-23 14:54:57 +00:00
>LDYA.G CSH.SaveDefine
>STYA ZPInputBufPtr
2021-05-30 20:34:03 +00:00
2021-01-12 21:14:13 +00:00
.10 lda hInclude
beq .11
2021-05-30 20:34:03 +00:00
2021-01-12 21:14:13 +00:00
bra .12
.11 >LDA.G hFileBuf
.12 >SYSCALL GetMemPtr
2019-02-07 07:19:02 +00:00
>STYA ZPPtr1
2021-05-30 20:34:03 +00:00
2019-08-27 15:13:00 +00:00
stz ZPPtr2
stz ZPPtr2+1 Line counter
2019-02-07 07:19:02 +00:00
2019-08-27 15:13:00 +00:00
.1 inc ZPPtr2
2019-02-07 07:19:02 +00:00
bne .2
2021-05-30 20:34:03 +00:00
2019-08-27 15:13:00 +00:00
inc ZPPtr2+1
2019-02-07 07:19:02 +00:00
2019-08-27 15:13:00 +00:00
.2 >LDYA ZPPtr1
>STYA ZPPtr3 save line start
.20 lda (ZPPtr1)
beq .4 EoF
2019-08-26 06:29:18 +00:00
2019-02-07 07:19:02 +00:00
inc ZPPtr1
bne .3
2021-05-30 20:34:03 +00:00
2019-02-07 07:19:02 +00:00
inc ZPPtr1+1
.3 cmp #C.CR
2019-08-27 15:13:00 +00:00
bne .20 Scan until EoL
2021-05-30 20:34:03 +00:00
2019-02-07 07:19:02 +00:00
ldx ZPPtr1
2020-12-23 14:54:57 +00:00
cpx ZPInputBufPtr
2019-02-07 07:19:02 +00:00
lda ZPPtr1+1
2020-12-23 14:54:57 +00:00
sbc ZPInputBufPtr+1
2019-02-07 07:19:02 +00:00
bcc .1 not this line....
2019-08-27 15:13:00 +00:00
.4 >LDA.G bTrace
bmi .5
2021-05-30 20:34:03 +00:00
2019-08-27 15:13:00 +00:00
jsr PrintTraceMsg.3
2020-02-18 15:34:56 +00:00
2019-08-27 15:13:00 +00:00
.5 lda ZPPtr3
2020-12-23 14:54:57 +00:00
cmp ZPInputBufPtr
2019-08-27 15:13:00 +00:00
bne .6
2020-12-23 14:54:57 +00:00
2019-08-27 15:13:00 +00:00
lda ZPPtr3+1
2021-05-30 20:34:03 +00:00
cmp ZPInputBufPtr+1
2019-08-27 15:13:00 +00:00
beq .8
2020-12-23 14:54:57 +00:00
2021-05-14 20:58:20 +00:00
.6 ldy #S.PS.hStdErr
2019-02-07 07:19:02 +00:00
lda (pPS),y
2021-05-14 20:58:20 +00:00
>PUSHA
>PUSHBI '-'
2020-02-28 07:21:46 +00:00
>SYSCALL FPutC
2019-08-27 15:13:00 +00:00
inc ZPPtr3
bne .5
2020-12-23 14:54:57 +00:00
2019-08-27 15:13:00 +00:00
inc ZPPtr3+1
2019-02-07 07:19:02 +00:00
bra .5
2021-05-30 20:34:03 +00:00
2020-02-14 07:21:56 +00:00
.8 ldy #S.PS.hStdErr
2019-02-07 07:19:02 +00:00
lda (pPS),y
2020-02-14 07:21:56 +00:00
>PUSHA
>PUSHW L.MSG.ERR
2021-01-12 21:14:13 +00:00
>PUSHW ZPPtr2 Line counter
2020-02-14 07:21:56 +00:00
>PUSHBI 2
2020-02-28 07:21:46 +00:00
>SYSCALL FPrintF
2019-02-07 07:19:02 +00:00
2019-08-27 15:13:00 +00:00
rts
*--------------------------------------
2020-02-21 13:24:16 +00:00
PrintDebugMsg >LDYA pStack
>STYA ZPPtr2
>PUSHW L.MSG.DEBUG
2021-05-30 20:34:03 +00:00
2020-02-21 13:24:16 +00:00
>PUSHW ZPPtr2
2021-05-30 20:34:03 +00:00
2019-09-03 15:35:13 +00:00
>PUSHBI 2
2020-02-28 07:21:46 +00:00
>SYSCALL PrintF
2021-06-03 17:43:28 +00:00
>DEBUG
2019-09-05 15:49:05 +00:00
rts
2019-10-03 06:25:27 +00:00
*--------------------------------------
2019-09-05 15:49:05 +00:00
PrintTraceMsg >STYA ZPPtr3
2020-02-18 15:34:56 +00:00
2021-05-14 20:58:20 +00:00
PrintTraceMsg.3 ldy #S.PS.hStdErr
2019-02-07 07:19:02 +00:00
lda (pPS),y
2021-05-14 20:58:20 +00:00
>PUSHA
>PUSHBI '>'
2020-02-28 07:21:46 +00:00
>SYSCALL FPutC
2021-05-30 20:34:03 +00:00
2019-08-27 15:13:00 +00:00
ldy #$ff
.1 iny
lda (ZPPtr3),y
beq .8
2021-05-30 20:34:03 +00:00
2019-08-27 15:13:00 +00:00
cmp #C.CR
beq .8
2021-05-30 20:34:03 +00:00
2019-08-27 15:13:00 +00:00
phy
2021-05-14 20:58:20 +00:00
pha
2019-08-27 15:13:00 +00:00
ldy #S.PS.hStdErr
lda (pPS),y
2021-05-14 20:58:20 +00:00
>PUSHA
pla
>PUSHA
2020-02-28 07:21:46 +00:00
>SYSCALL FPutC
2019-08-27 15:13:00 +00:00
ply
bra .1
2021-05-30 20:34:03 +00:00
2020-02-14 07:21:56 +00:00
.8 ldy #S.PS.hStdErr
2019-02-07 07:19:02 +00:00
lda (pPS),y
2020-02-14 07:21:56 +00:00
>PUSHA
2021-05-30 20:34:03 +00:00
2020-02-14 07:21:56 +00:00
>PUSHW L.MSG.ECHOCRLF
>PUSHBI 0
2020-02-28 07:21:46 +00:00
>SYSCALL FPrintF
2019-02-07 07:19:02 +00:00
rts
*--------------------------------------
2020-07-31 14:46:11 +00:00
.INB usr/src/bin/csh.s.core
2021-01-12 21:14:13 +00:00
.INB usr/src/bin/csh.s.dir
2020-08-02 12:19:43 +00:00
.INB usr/src/bin/csh.s.kw
.INB usr/src/bin/csh.s.exp
2020-07-31 14:46:11 +00:00
.INB usr/src/bin/csh.s.exec
2019-01-21 06:52:04 +00:00
*--------------------------------------
CS.END
*--------------------------------------
* Initialized DATA
*--------------------------------------
MSG.GREETINGS .CZ "\r\nCSH-Shell %d.%d\r\n\r\n"
MSG.USAGE .CS "Usage : CSH <option> file\r\n"
.CS " -D : Debug Mode\r\n"
.CS " -T : Trace On"
MSG.ECHOCRLF .CZ "\r\n"
MSG.DEBUG .CZ "pStack=%H\r\n"
MSG.ERR .CZ "-^\r\nLine #%D:"
2019-09-05 06:43:09 +00:00
*--------------------------------------
2020-08-02 12:19:43 +00:00
ENV.INCLUDE .AZ "INCLUDE"
*--------------------------------------
2019-09-05 15:49:05 +00:00
OptionList .AS "DdTt"
2019-09-05 06:43:09 +00:00
OptionVars .DA #bDebug,#bDebug,#bTrace,#bTrace
2019-08-26 06:29:18 +00:00
*--------------------------------------
2021-04-10 17:17:40 +00:00
*--------------------------------------
CSH.OPChars .AS "!~+-*/%=&|^<>"
CSH.OPChars.Cnt .EQ *-CSH.OPChars
*--------------------------------------
* Pre Operators: + - ! ~ ++ --
*--------------------------------------
CSH.PREOPS .PS "+"
.PS "-"
.PS "!"
.PS "~"
2021-04-10 17:17:40 +00:00
*--------------------------------------
2021-05-30 20:34:03 +00:00
* Post Operators: ++ --
2021-04-10 17:17:40 +00:00
*--------------------------------------
CSH.POSTOPS .PS "++"
.PS "--"
2021-04-10 17:17:40 +00:00
.HS 00
*--------------------------------------
* Assignment Operators: = += -= *= /= %= <<= >>= &= ^= |=
*--------------------------------------
CSH.AOPS .PS "="
.PS "+="
.PS "-="
.PS "*="
.PS "/="
.PS "%="
.PS "<<="
.PS ">>="
.PS "&="
.PS "^="
.PS "!="
2021-04-10 17:17:40 +00:00
.HS 00
*-- Binary ---- H to L precedence -----
* Arithmetic Operators: * / %
* Arithmetic Operators: + -
* Shift Operators: << >>
* Relational Operators: < > >= < >= == !=
* Bitwise Operators: & | ^ ~
* Logical Operators: && ||
*--------------------------------------
CSH.BOPS .PS "*"
.PS "/"
.PS "%"
.PS "+"
.PS "-"
.PS "<<"
.PS ">>"
.PS "<"
.PS "<="
.PS ">"
.PS ">="
.PS "=="
.PS "!="
.PS "&"
.PS "|"
.PS "^"
.PS "&&"
.PS "||"
2021-04-10 17:17:40 +00:00
.HS 00
*--------------------------------------
* Reserved Directives:
*--------------------------------------
CSH.DIRS .PS "define"
.PS "include"
2021-04-10 17:17:40 +00:00
.HS 00
*--------------------------------------
* Reserved Keywords:
*--------------------------------------
CSH.KW .PS "if"
.PS "while"
.PS "else"
.PS "do"
.PS "for"
.PS "switch"
.PS "case"
.PS "break"
.PS "continue"
.PS "sizeof"
.PS "typedef"
.PS "struct"
2021-05-22 21:05:12 +00:00
.HS 00
*--------------------------------------
* Type Declaration
*--------------------------------------
CSH.TMODS .PS "const" ALL
CSH.TMODS2 .PS "signed" char,int,long
.PS "unsigned" char,int,long
.PS "short" int
CSH.TYPES .PS "void"
.PS "char"
.PS "int"
.PS "long"
.PS "float"
2021-04-10 17:17:40 +00:00
.HS 00
*--------------------------------------
2021-05-09 17:04:44 +00:00
CSH.Type2FPU .DA #FPU.wMUL,#FPU.iMUL,#FPU.uMUL,#FPU.lMUL,FPU.fMUL
*--------------------------------------
CSH.FTYPES .PS "fastcall"
2021-04-10 17:17:40 +00:00
* .HS 00
*--------------------------------------
2021-05-04 17:31:21 +00:00
CSH.TYPESIZE .HS 0001010202040405
2021-04-10 17:17:40 +00:00
*--------------------------------------
CSH.LIBC .PS "chtyp"
.PS "chmod"
.PS "fstat"
.PS "stat"
.PS "mkdir"
.PS "mknod"
.PS "mkfifo"
.PS "pipe"
.PS "opendir"
.PS "readdir"
.PS "closedir"
.PS "open"
.PS "close"
.PS "read"
.PS "write"
.PS "chown"
.PS "fputc"
.PS "putchar"
.PS "getc"
.PS "getchar"
.PS "fputs"
.PS "puts"
.PS "fgets"
.PS "ungetc"
.PS "fopen"
.PS "fclose"
.PS "fread"
.PS "fwrite"
.PS "fflush"
.PS "fseek"
.PS "ftell"
.PS "feof"
.PS "remove"
.PS "rename"
.PS "printf"
.PS "fprintf"
.PS "sprintf"
.PS "scanf"
.PS "fscanf"
.PS "sscanf"
.PS "$50"
.PS "$52"
.PS "$54"
.PS "$56"
.PS "$58"
.PS "$5A"
.PS "$5C"
.PS "setattr"
.PS "mount"
.PS "umount"
.PS "loadstkobj"
.PS "getstkobj"
.PS "shift"
.PS "argv"
.PS "argvDup"
.PS "geterrmsg"
.PS "atof"
.PS "atoi"
.PS "atol"
.PS "strtof"
.PS "strtol"
.PS "strtoul"
.PS "realpath"
.PS "expand"
.PS "strlen"
.PS "strcpy"
.PS "strcat"
.PS "strdup"
.PS "strupr"
.PS "strlwr"
.PS "strcmp"
.PS "strcasecmp"
.PS "getdevbyname"
.PS "getdevstatus"
.PS "mkdev"
.PS "ioctl"
.PS "loadlib"
.PS "unloadlib"
.PS "loaddrv"
.PS "insdrv"
.PS "execl"
.PS "execv"
.PS "fork"
.PS "kill"
.PS "loadfile"
.PS "loadtxtfile"
.PS "filesearch"
.PS "getmemstat"
.PS "strvnew"
.PS "strvset"
.PS "strvget"
.PS "strvfree"
.PS "putenv"
.PS "setenv"
.PS "getenv"
.PS "unsetenv"
.PS "time"
.PS "strftime"
.PS "ctime2time"
.PS "md5"
.PS "md5init"
.PS "md5update"
.PS "md5finalize"
.PS "getpwuid"
.PS "getpwname"
.PS "putpw"
.PS "getgrpgid"
.PS "getgrpname"
.PS "putgr"
.PS "opensession"
.PS "closesession"
.PS "slistgetdata"
.PS "slistadddata"
.PS "slistsetdata"
.PS "slistgetbyid"
.PS "slistnewkey"
.PS "slistlookup"
.PS "slistfree"
.PS "slistnew"
.PS "malloc"
.PS "realloc"
.PS "getmemptr"
.PS "freemem"
.PS "free"
.PS "newstkobj"
.PS "getstkobjptr"
.PS "freestkobj"
2021-05-30 20:34:03 +00:00
.HS 00
*--------------------------------------
2021-04-10 17:17:40 +00:00
CSH.FN
2021-05-14 20:58:20 +00:00
* float pwr (float x, float y);
.PS "pwr"
2021-05-30 20:34:03 +00:00
.DA #CSH.T.FLOAT,#0 returned value
.DA #CSH.T.FLOAT,#0
.DA #CSH.T.FLOAT,#0
2021-05-14 20:58:20 +00:00
.DA #0
* float cos (float x);
.PS "log"
2021-05-30 20:34:03 +00:00
.DA #CSH.T.FLOAT,#0 returned value
.DA #CSH.T.FLOAT,#0
2021-04-10 17:17:40 +00:00
.DA #0
.PS "sqr"
2021-05-30 20:34:03 +00:00
.DA #CSH.T.FLOAT,#0 returned value
.DA #CSH.T.FLOAT,#0
2021-04-10 17:17:40 +00:00
.DA #0
.PS "exp"
2021-05-30 20:34:03 +00:00
.DA #CSH.T.FLOAT,#0 returned value
.DA #CSH.T.FLOAT,#0
2021-04-10 17:17:40 +00:00
.DA #0
.PS "cos"
2021-05-30 20:34:03 +00:00
.DA #CSH.T.FLOAT,#0 returned value
.DA #CSH.T.FLOAT,#0
2021-04-10 17:17:40 +00:00
.DA #0
.PS "sin"
2021-05-30 20:34:03 +00:00
.DA #CSH.T.FLOAT,#0 returned value
.DA #CSH.T.FLOAT,#0
2021-04-10 17:17:40 +00:00
.DA #0
.PS "tan"
2021-05-30 20:34:03 +00:00
.DA #CSH.T.FLOAT,#0 returned value
.DA #CSH.T.FLOAT,#0
2021-04-10 17:17:40 +00:00
.DA #0
.PS "atan"
2021-05-30 20:34:03 +00:00
.DA #CSH.T.FLOAT,#0 returned value
.DA #CSH.T.FLOAT,#0
2021-04-10 17:17:40 +00:00
.DA #0
* char getchar ( void );
.PS "getchar"
2021-05-30 20:34:03 +00:00
.DA #CSH.T.UCHAR,#0 returned value
2021-04-10 17:17:40 +00:00
.DA #0
* int puts ( const char * str );
.PS "puts"
2021-05-30 20:34:03 +00:00
.DA #CSH.T.SINT,#0 returned value
.DA #CSH.T.UCHAR,#CSH.Q.CONST+CSH.Q.POINTER
2021-04-10 17:17:40 +00:00
.DA #0
* int execl(const char* cmdline, short int flags);
.PS "execl"
2021-05-30 20:34:03 +00:00
.DA #CSH.T.SINT,#0 returned value
.DA #CSH.T.UCHAR,#CSH.Q.CONST+CSH.Q.POINTER
.DA #CSH.T.UCHAR,#0
2021-04-10 17:17:40 +00:00
.DA #0
* int printf ( const char * format, ... );
.PS "printf"
2021-05-30 20:34:03 +00:00
.DA #CSH.T.SINT,#0 returned value
.DA #CSH.T.UCHAR,#CSH.Q.CONST+CSH.Q.POINTER
.DA #CSH.T.VARIADIC,#0
2021-04-10 17:17:40 +00:00
.DA #0
* int putenv(const char *string);
.PS "putenv"
2021-05-30 20:34:03 +00:00
.DA #CSH.T.SINT,#0 returned value
.DA #CSH.T.UCHAR,#CSH.Q.CONST+CSH.Q.POINTER
2021-04-10 17:17:40 +00:00
.DA #0
* int setenv(const char *name, const char *value);
.PS "setenv"
2021-05-30 20:34:03 +00:00
.DA #CSH.T.SINT,#0 returned value
.DA #CSH.T.UCHAR,#CSH.Q.CONST+CSH.Q.POINTER
.DA #CSH.T.UCHAR,#CSH.Q.CONST+CSH.Q.POINTER
2021-04-10 17:17:40 +00:00
.DA #0
* char *getenv(const char *name, char *value);
.PS "getenv"
2021-05-30 20:34:03 +00:00
.DA #CSH.T.UCHAR,#CSH.Q.POINTER
.DA #CSH.T.UCHAR,#CSH.Q.CONST+CSH.Q.POINTER
.DA #CSH.T.UCHAR,#CSH.Q.POINTER
2021-04-10 17:17:40 +00:00
.DA #0
* int unsetenv(const char *name);
.PS "unsetenv"
2021-05-30 20:34:03 +00:00
.DA #CSH.T.SINT,#0 returned value
.DA #CSH.T.UCHAR,#CSH.Q.CONST+CSH.Q.POINTER
2021-04-10 17:17:40 +00:00
.DA #0
* void md5 (const char* str, char* digest);
.PS "md5"
2021-05-30 20:34:03 +00:00
.DA #CSH.T.VOID,#0
.DA #CSH.T.UCHAR,#CSH.Q.CONST+CSH.Q.POINTER
.DA #CSH.T.UCHAR,#CSH.Q.POINTER
2021-04-10 17:17:40 +00:00
.DA #0
* void * malloc ( int size );
.PS "malloc"
2021-05-30 20:34:03 +00:00
.DA #CSH.T.VOID,#CSH.Q.POINTER returned value
.DA #CSH.T.SINT,#0
2021-04-10 17:17:40 +00:00
.DA #0
2021-05-14 20:58:20 +00:00
* short int fopen(const char*,short int,short int,int);
.PS "fopen"
2021-05-30 20:34:03 +00:00
.DA #CSH.T.SCHAR,#0
.DA #CSH.T.UCHAR,#CSH.Q.CONST+CSH.Q.POINTER
.DA #CSH.T.SCHAR,#0
.DA #CSH.T.SCHAR,#0
.DA #CSH.T.SINT,#0
2021-05-14 20:58:20 +00:00
.DA #0
* int fclose(short int);
.PS "fclose"
2021-05-30 20:34:03 +00:00
.DA #CSH.T.SINT,#0
.DA #CSH.T.SCHAR,#0
2021-05-14 20:58:20 +00:00
.DA #0
* int fread (short int,void*,int);
.PS "fread"
2021-05-30 20:34:03 +00:00
.DA #CSH.T.SINT,#0
.DA #CSH.T.SCHAR,#0
.DA #CSH.T.VOID,#CSH.Q.POINTER
.DA #CSH.T.SINT,#0
2021-05-14 20:58:20 +00:00
.DA #0
* int fwrite (short int,const void*,int);
.PS "fwrite"
2021-05-30 20:34:03 +00:00
.DA #CSH.T.SINT,#0
.DA #CSH.T.SCHAR,#0
.DA #CSH.T.VOID,#CSH.Q.CONST+CSH.Q.POINTER
.DA #CSH.T.SINT,#0
.DA #0
2021-04-10 17:17:40 +00:00
*--------------------------------------
.DA #0
2019-01-21 06:52:04 +00:00
*--------------------------------------
.DUMMY
.OR 0
2021-05-30 20:34:03 +00:00
DS.START
2021-04-10 17:17:40 +00:00
PathBuf .BS 65
hFileBuf .BS 1
CSH.BufPtrSave .BS 2
CSH.CmdSave .BS 1
CSH.LookupOpt .BS 1
CSH.hDefines .BS 1
CSH.hSymbols .BS 1
CSH.hTags .BS 1
CSH.hCode .BS 1
CSH.CodePtr .BS 2
CSH.hConst .BS 1
CSH.ConstPtr .BS 2
CSH.hData .BS 1
CSH.DataPtr .BS 2
CSH.hStack .BS 1
CSH.StackPtr .BS 1
2021-05-22 21:05:12 +00:00
CSH.hfDecl .BS 1
CSH.fDeclBuf .BS 2
2021-04-10 17:17:40 +00:00
CSH.SaveInclude .BS 2
CSH.SaveDefine .BS 2
2021-05-30 20:34:03 +00:00
CSH.VarDef .BS 8
2021-04-10 17:17:40 +00:00
2019-09-05 06:43:09 +00:00
bDebug .BS 1
2019-08-27 15:13:00 +00:00
bTrace .BS 1
2021-04-10 17:17:40 +00:00
DS.END .ED
2019-01-21 06:52:04 +00:00
*--------------------------------------
MAN
2020-07-31 14:46:11 +00:00
SAVE usr/src/bin/csh.s
2019-01-21 06:52:04 +00:00
ASM